mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-08-29 10:43:56 +00:00
Toggle datatypes visibility (#366)
* showDatatype setting added in view control panel * removed shortcut can be discussed later * fixed linting issue and made sure the condition check is above div element in table.jsx code in the else part im directly returning the element by keeping a check for settings.showDataTypes? which helps to not add empty element for setSetting issue I used the similar code used just above the snippet and modified it
This commit is contained in:
@@ -354,7 +354,7 @@ export default function Table(props) {
|
|||||||
icon={<IconMinus />}
|
icon={<IconMinus />}
|
||||||
onClick={() => deleteField(fieldData, tableData.id)}
|
onClick={() => deleteField(fieldData, tableData.id)}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : settings.showDataTypes ? (
|
||||||
<div className="flex gap-1 items-center">
|
<div className="flex gap-1 items-center">
|
||||||
{fieldData.primary && <IconKeyStroked />}
|
{fieldData.primary && <IconKeyStroked />}
|
||||||
{!fieldData.notNull && <span>?</span>}
|
{!fieldData.notNull && <span>?</span>}
|
||||||
@@ -362,13 +362,14 @@ export default function Table(props) {
|
|||||||
{fieldData.type +
|
{fieldData.type +
|
||||||
((dbToTypes[database][fieldData.type].isSized ||
|
((dbToTypes[database][fieldData.type].isSized ||
|
||||||
dbToTypes[database][fieldData.type].hasPrecision) &&
|
dbToTypes[database][fieldData.type].hasPrecision) &&
|
||||||
fieldData.size &&
|
fieldData.size &&
|
||||||
fieldData.size !== ""
|
fieldData.size !== ""
|
||||||
? "(" + fieldData.size + ")"
|
? `(${fieldData.size})`
|
||||||
: "")}
|
: "")}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
) : null
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@@ -1211,6 +1211,15 @@ export default function ControlPanel({
|
|||||||
function: resetView,
|
function: resetView,
|
||||||
shortcut: "Ctrl+R",
|
shortcut: "Ctrl+R",
|
||||||
},
|
},
|
||||||
|
show_datatype: {
|
||||||
|
state: settings.showDataTypes ? (
|
||||||
|
<i className="bi bi-toggle-on" />
|
||||||
|
) : (
|
||||||
|
<i className="bi bi-toggle-off" />
|
||||||
|
),
|
||||||
|
function: () =>
|
||||||
|
setSettings((prev) => ({ ...prev, showDataTypes: !prev.showDataTypes })),
|
||||||
|
},
|
||||||
show_grid: {
|
show_grid: {
|
||||||
state: settings.showGrid ? (
|
state: settings.showGrid ? (
|
||||||
<i className="bi bi-toggle-on" />
|
<i className="bi bi-toggle-on" />
|
||||||
|
@@ -5,6 +5,7 @@ const defaultSettings = {
|
|||||||
strictMode: false,
|
strictMode: false,
|
||||||
showFieldSummary: true,
|
showFieldSummary: true,
|
||||||
showGrid: true,
|
showGrid: true,
|
||||||
|
showDataTypes: true,
|
||||||
mode: "light",
|
mode: "light",
|
||||||
autosave: true,
|
autosave: true,
|
||||||
panning: true,
|
panning: true,
|
||||||
|
@@ -49,6 +49,7 @@ const en = {
|
|||||||
field_details: "Field details",
|
field_details: "Field details",
|
||||||
reset_view: "Reset view",
|
reset_view: "Reset view",
|
||||||
show_grid: "Show grid",
|
show_grid: "Show grid",
|
||||||
|
show_datatype: "Show datatype",
|
||||||
show_cardinality: "Show cardinality",
|
show_cardinality: "Show cardinality",
|
||||||
theme: "Theme",
|
theme: "Theme",
|
||||||
light: "Light",
|
light: "Light",
|
||||||
|
Reference in New Issue
Block a user