mirror of
https://github.com/drawdb-io/drawdb.git
synced 2026-02-12 02:00:40 +08:00
Make variable naming consistent
This commit is contained in:
@@ -10,9 +10,9 @@ import {
|
||||
Action,
|
||||
ObjectType,
|
||||
tableThemes,
|
||||
defaultTableTheme,
|
||||
defaultBlue,
|
||||
State,
|
||||
} from "../data/data";
|
||||
} from "../data/constants";
|
||||
import useLayout from "../hooks/useLayout";
|
||||
import useSettings from "../hooks/useSettings";
|
||||
import useUndoRedo from "../hooks/useUndoRedo";
|
||||
@@ -143,7 +143,7 @@ export default function Area(props) {
|
||||
size="small"
|
||||
onClick={() => {
|
||||
updateArea(props.areaData.id, {
|
||||
color: defaultTableTheme,
|
||||
color: defaultBlue,
|
||||
});
|
||||
setSaveState(State.SAVING);
|
||||
}}
|
||||
@@ -271,11 +271,10 @@ export default function Area(props) {
|
||||
...prev,
|
||||
element: ObjectType.AREA,
|
||||
id: props.areaData.id,
|
||||
currentTab: Tab.subject_areas,
|
||||
currentTab: Tab.AREAS,
|
||||
open: true,
|
||||
}));
|
||||
if (selectedElement.currentTab !== Tab.subject_areas)
|
||||
return;
|
||||
if (selectedElement.currentTab !== Tab.AREAS) return;
|
||||
document
|
||||
.getElementById(`scroll_area_${props.areaData.id}`)
|
||||
.scrollIntoView({ behavior: "smooth" });
|
||||
|
||||
@@ -20,12 +20,12 @@ import {
|
||||
IconDeleteStroked,
|
||||
} from "@douyinfe/semi-icons";
|
||||
import {
|
||||
defaultTableTheme,
|
||||
defaultBlue,
|
||||
tableThemes,
|
||||
Action,
|
||||
ObjectType,
|
||||
State,
|
||||
} from "../data/data";
|
||||
} from "../data/constants";
|
||||
import useUndoRedo from "../hooks/useUndoRedo";
|
||||
import useAreas from "../hooks/useAreas";
|
||||
import useSaveState from "../hooks/useSaveState";
|
||||
@@ -140,7 +140,7 @@ export default function AreaOverview() {
|
||||
type="tertiary"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
updateArea(i, { color: defaultTableTheme });
|
||||
updateArea(i, { color: defaultBlue });
|
||||
setSaveState(State.SAVING);
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useRef, useState, useEffect } from "react";
|
||||
import Table from "./Table";
|
||||
import { Action, Cardinality, Constraint, ObjectType } from "../data/data";
|
||||
import { Action, Cardinality, Constraint, ObjectType } from "../data/constants";
|
||||
import Area from "./Area";
|
||||
import Relationship from "./Relationship";
|
||||
import Note from "./Note";
|
||||
@@ -39,8 +39,8 @@ export default function Canvas() {
|
||||
endY: 0,
|
||||
name: "",
|
||||
cardinality: Cardinality.ONE_TO_ONE,
|
||||
updateConstraint: Constraint.none,
|
||||
deleteConstraint: Constraint.none,
|
||||
updateConstraint: Constraint.NONE,
|
||||
deleteConstraint: Constraint.NONE,
|
||||
mandatory: false,
|
||||
});
|
||||
const [offset, setOffset] = useState({ x: 0, y: 0 });
|
||||
|
||||
@@ -44,7 +44,7 @@ import {
|
||||
jsonToSQLServer,
|
||||
} from "../utils/toSQL";
|
||||
import { IconAddTable, IconAddArea, IconAddNote } from "./CustomIcons";
|
||||
import { ObjectType, Action, Tab, State, Cardinality } from "../data/data";
|
||||
import { ObjectType, Action, Tab, State, Cardinality } from "../data/constants";
|
||||
import jsPDF from "jspdf";
|
||||
import { useHotkeys } from "react-hotkeys-hook";
|
||||
import { Validator } from "jsonschema";
|
||||
@@ -581,9 +581,9 @@ export default function ControlPanel({
|
||||
setSelectedElement((prev) => ({
|
||||
...prev,
|
||||
open: true,
|
||||
currentTab: Tab.tables,
|
||||
currentTab: Tab.TABLES,
|
||||
}));
|
||||
if (selectedElement.currentTab !== Tab.tables) return;
|
||||
if (selectedElement.currentTab !== Tab.TABLES) return;
|
||||
document
|
||||
.getElementById(`scroll_table_${selectedElement.id}`)
|
||||
.scrollIntoView({ behavior: "smooth" });
|
||||
@@ -592,9 +592,9 @@ export default function ControlPanel({
|
||||
if (layout.sidebar) {
|
||||
setSelectedElement((prev) => ({
|
||||
...prev,
|
||||
currentTab: Tab.subject_areas,
|
||||
currentTab: Tab.AREAS,
|
||||
}));
|
||||
if (selectedElement.currentTab !== Tab.subject_areas) return;
|
||||
if (selectedElement.currentTab !== Tab.AREAS) return;
|
||||
document
|
||||
.getElementById(`scroll_area_${selectedElement.id}`)
|
||||
.scrollIntoView({ behavior: "smooth" });
|
||||
@@ -609,10 +609,10 @@ export default function ControlPanel({
|
||||
if (layout.sidebar) {
|
||||
setSelectedElement((prev) => ({
|
||||
...prev,
|
||||
currentTab: Tab.notes,
|
||||
currentTab: Tab.NOTES,
|
||||
open: false,
|
||||
}));
|
||||
if (selectedElement.currentTab !== Tab.notes) return;
|
||||
if (selectedElement.currentTab !== Tab.NOTES) return;
|
||||
document
|
||||
.getElementById(`scroll_note_${selectedElement.id}`)
|
||||
.scrollIntoView({ behavior: "smooth" });
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState } from "react";
|
||||
import { Action, ObjectType, noteThemes, Tab, State } from "../data/data";
|
||||
import { Action, ObjectType, noteThemes, Tab, State } from "../data/constants";
|
||||
import { Input, Button, Popover, Toast } from "@douyinfe/semi-ui";
|
||||
import {
|
||||
IconEdit,
|
||||
@@ -257,9 +257,9 @@ export default function Note({ data, onMouseDown }) {
|
||||
if (layout.sidebar) {
|
||||
setSelectedElement((prev) => ({
|
||||
...prev,
|
||||
currentTab: Tab.notes,
|
||||
currentTab: Tab.NOTES,
|
||||
}));
|
||||
if (selectedElement.currentTab !== Tab.notes) return;
|
||||
if (selectedElement.currentTab !== Tab.NOTES) return;
|
||||
document
|
||||
.getElementById(`scroll_note_${data.id}`)
|
||||
.scrollIntoView({ behavior: "smooth" });
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
IconSearch,
|
||||
IconCheckboxTick,
|
||||
} from "@douyinfe/semi-icons";
|
||||
import { noteThemes, Action, ObjectType } from "../data/data";
|
||||
import { noteThemes, Action, ObjectType } from "../data/constants";
|
||||
import useUndoRedo from "../hooks/useUndoRedo";
|
||||
import useNotes from "../hooks/useNotes";
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
IllustrationNoContent,
|
||||
IllustrationNoContentDark,
|
||||
} from "@douyinfe/semi-illustrations";
|
||||
import { Cardinality, Constraint, Action, ObjectType } from "../data/data";
|
||||
import { Cardinality, Constraint, Action, ObjectType } from "../data/constants";
|
||||
import useTables from "../hooks/useTables";
|
||||
import useUndoRedo from "../hooks/useUndoRedo";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useRef } from "react";
|
||||
import { Cardinality } from "../data/data";
|
||||
import { Cardinality } from "../data/constants";
|
||||
import useSettings from "../hooks/useSettings";
|
||||
import { calcPath } from "../utils/calcPath";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Tabs } from "@douyinfe/semi-ui";
|
||||
import { Tab } from "../data/data";
|
||||
import { Tab } from "../data/constants";
|
||||
import TableOverview from "./TableOverview";
|
||||
import ReferenceOverview from "./ReferenceOverview";
|
||||
import AreaOverview from "./AreaOverview";
|
||||
@@ -14,11 +14,11 @@ export default function SidePanel({ width, resize, setResize }) {
|
||||
const { selectedElement, setSelectedElement } = useSelect();
|
||||
|
||||
const tabList = [
|
||||
{ tab: "Tables", itemKey: Tab.tables },
|
||||
{ tab: "Relationships", itemKey: Tab.relationships },
|
||||
{ tab: "Subject Areas", itemKey: Tab.subject_areas },
|
||||
{ tab: "Notes", itemKey: Tab.notes },
|
||||
{ tab: "Types", itemKey: Tab.types },
|
||||
{ tab: "Tables", itemKey: Tab.TABLES },
|
||||
{ tab: "Relationships", itemKey: Tab.RELATIONSHIPS },
|
||||
{ tab: "Subject Areas", itemKey: Tab.AREAS },
|
||||
{ tab: "Notes", itemKey: Tab.NOTES },
|
||||
{ tab: "Types", itemKey: Tab.TYPES },
|
||||
];
|
||||
const contentList = [
|
||||
<TableOverview key={1} />,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState, useRef } from "react";
|
||||
import { Cardinality } from "../data/data";
|
||||
import { Cardinality } from "../data/constants";
|
||||
import { calcPath } from "../utils/calcPath";
|
||||
|
||||
function Table({ table, grab }) {
|
||||
|
||||
@@ -2,11 +2,11 @@ import { useState } from "react";
|
||||
import {
|
||||
sqlDataTypes,
|
||||
tableThemes,
|
||||
defaultTableTheme,
|
||||
defaultBlue,
|
||||
Tab,
|
||||
Action,
|
||||
ObjectType,
|
||||
} from "../data/data";
|
||||
} from "../data/constants";
|
||||
import {
|
||||
IconEdit,
|
||||
IconMore,
|
||||
@@ -120,12 +120,12 @@ export default function Table(props) {
|
||||
} else {
|
||||
setSelectedElement((prev) => ({
|
||||
...prev,
|
||||
currentTab: Tab.tables,
|
||||
currentTab: Tab.TABLES,
|
||||
element: ObjectType.TABLE,
|
||||
id: props.tableData.id,
|
||||
open: true,
|
||||
}));
|
||||
if (selectedElement.currentTab !== Tab.tables) return;
|
||||
if (selectedElement.currentTab !== Tab.TABLES) return;
|
||||
document
|
||||
.getElementById(`scroll_table_${props.tableData.id}`)
|
||||
.scrollIntoView({ behavior: "smooth" });
|
||||
@@ -1058,13 +1058,13 @@ export default function Table(props) {
|
||||
component: "self",
|
||||
tid: props.tableData.id,
|
||||
undo: { color: props.tableData.color },
|
||||
redo: { color: defaultTableTheme },
|
||||
redo: { color: defaultBlue },
|
||||
message: `Edit table color to default`,
|
||||
},
|
||||
]);
|
||||
setRedoStack([]);
|
||||
updateTable(props.tableData.id, {
|
||||
color: defaultTableTheme,
|
||||
color: defaultBlue,
|
||||
});
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -2,10 +2,10 @@ import { useState } from "react";
|
||||
import {
|
||||
Action,
|
||||
ObjectType,
|
||||
defaultTableTheme,
|
||||
defaultBlue,
|
||||
sqlDataTypes,
|
||||
tableThemes,
|
||||
} from "../data/data";
|
||||
} from "../data/constants";
|
||||
import {
|
||||
Collapse,
|
||||
Row,
|
||||
@@ -946,12 +946,12 @@ export default function TableOverview() {
|
||||
component: "self",
|
||||
tid: i,
|
||||
undo: { color: t.color },
|
||||
redo: { color: defaultTableTheme },
|
||||
redo: { color: defaultBlue },
|
||||
message: `Edit table color to default`,
|
||||
},
|
||||
]);
|
||||
setRedoStack([]);
|
||||
updateTable(i, { color: defaultTableTheme });
|
||||
updateTable(i, { color: defaultBlue });
|
||||
}}
|
||||
>
|
||||
Clear
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
IconDeleteStroked,
|
||||
IconCaretdown,
|
||||
} from "@douyinfe/semi-icons";
|
||||
import { State } from "../data/data";
|
||||
import { State } from "../data/constants";
|
||||
import useTasks from "../hooks/useTasks";
|
||||
import useSaveState from "../hooks/useSaveState";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState } from "react";
|
||||
import { Action, ObjectType, sqlDataTypes } from "../data/data";
|
||||
import { Action, ObjectType, sqlDataTypes } from "../data/constants";
|
||||
import {
|
||||
Collapse,
|
||||
Row,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback } from "react";
|
||||
import ControlPanel from "../components/ControlPanel";
|
||||
import Canvas from "../components/Canvas";
|
||||
import SidePanel from "../components/SidePanel";
|
||||
import { State } from "../data/data";
|
||||
import { State } from "../data/constants";
|
||||
import { db } from "../data/db";
|
||||
import useLayout from "../hooks/useLayout";
|
||||
import useSettings from "../hooks/useSettings";
|
||||
|
||||
Reference in New Issue
Block a user