mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-05-24 10:29:11 +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:
parent
2a03298d29
commit
3e7d1ac6f6
@ -354,7 +354,7 @@ export default function Table(props) {
|
||||
icon={<IconMinus />}
|
||||
onClick={() => deleteField(fieldData, tableData.id)}
|
||||
/>
|
||||
) : (
|
||||
) : settings.showDataTypes ? (
|
||||
<div className="flex gap-1 items-center">
|
||||
{fieldData.primary && <IconKeyStroked />}
|
||||
{!fieldData.notNull && <span>?</span>}
|
||||
@ -362,13 +362,14 @@ export default function Table(props) {
|
||||
{fieldData.type +
|
||||
((dbToTypes[database][fieldData.type].isSized ||
|
||||
dbToTypes[database][fieldData.type].hasPrecision) &&
|
||||
fieldData.size &&
|
||||
fieldData.size !== ""
|
||||
? "(" + fieldData.size + ")"
|
||||
fieldData.size &&
|
||||
fieldData.size !== ""
|
||||
? `(${fieldData.size})`
|
||||
: "")}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
) : null
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
@ -1211,6 +1211,15 @@ export default function ControlPanel({
|
||||
function: resetView,
|
||||
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: {
|
||||
state: settings.showGrid ? (
|
||||
<i className="bi bi-toggle-on" />
|
||||
|
@ -5,6 +5,7 @@ const defaultSettings = {
|
||||
strictMode: false,
|
||||
showFieldSummary: true,
|
||||
showGrid: true,
|
||||
showDataTypes: true,
|
||||
mode: "light",
|
||||
autosave: true,
|
||||
panning: true,
|
||||
|
@ -49,6 +49,7 @@ const en = {
|
||||
field_details: "Field details",
|
||||
reset_view: "Reset view",
|
||||
show_grid: "Show grid",
|
||||
show_datatype: "Show datatype",
|
||||
show_cardinality: "Show cardinality",
|
||||
theme: "Theme",
|
||||
light: "Light",
|
||||
|
Loading…
Reference in New Issue
Block a user