Skip to content

Commit f064862

Browse files
authored
update(Frontend V2): Rename store.ts > projectStore.ts (#97)
1 parent 1a7e746 commit f064862

12 files changed

Lines changed: 126 additions & 126 deletions

File tree

frontend/src/assets/main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
body {
22
font-family: "DM Sans", sans-serif;
33
font-optical-sizing: auto;
4-
}
4+
}

frontend/src/components/StepWizard.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
</div>
1515

1616
<div class="step-actions">
17-
<button v-if="currentStep > 0" @click="currentStep--" class="btn prev-btn">
18-
Previous
19-
</button>
17+
<button v-if="currentStep > 0" @click="currentStep--" class="btn prev-btn">Previous</button>
2018
<button v-if="currentStep < steps.length - 1" @click="nextStep" class="btn next-btn">
2119
Next
2220
</button>
@@ -55,7 +53,7 @@ const goToStep = (index) => {
5553
display: flex;
5654
flex-direction: column;
5755
align-items: center;
58-
height: 100%
56+
height: 100%;
5957
}
6058
6159
.step-indicators {
@@ -77,7 +75,9 @@ const goToStep = (index) => {
7775
cursor: pointer;
7876
border: 2px solid black;
7977
box-shadow: 2px 2px 0px rgba(0, 0, 0, 1);
80-
transition: transform 0.1s ease-out, box-shadow 0.1s;
78+
transition:
79+
transform 0.1s ease-out,
80+
box-shadow 0.1s;
8181
}
8282
8383
.step:hover {
@@ -125,7 +125,9 @@ const goToStep = (index) => {
125125
border-radius: 4px;
126126
background-color: #f4f4f0;
127127
box-shadow: 3px 3px 0px rgba(0, 0, 0, 1);
128-
transition: transform 0.1s ease-in-out, box-shadow 0.1s;
128+
transition:
129+
transform 0.1s ease-in-out,
130+
box-shadow 0.1s;
129131
font-weight: bold;
130132
}
131133

frontend/src/components/modal/AddFieldModal.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@
4242

4343
<script setup lang="ts">
4444
import { ref } from "vue"
45-
import { useProjectStore } from "@/stores/store"
45+
import { useProjectStore } from "@/stores/useProjectStore"
4646
import { useModalStore } from "@/stores/useModalStore"
4747
4848
const props = defineProps<{
4949
id: string
5050
}>()
5151
52-
const store = useProjectStore()
52+
const projectStore = useProjectStore()
5353
const modalStore = useModalStore()
5454
5555
const fieldName = ref("")
@@ -62,7 +62,7 @@ const isIndex = ref(false)
6262
6363
const saveField = () => {
6464
if (!fieldName.value || !type.value) return
65-
store.addField(props.id, {
65+
projectStore.addField(props.id, {
6666
name: fieldName.value,
6767
type: type.value,
6868
default: defaultValue.value || undefined,

frontend/src/components/modal/AddRelationModal.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@
4343

4444
<script setup lang="ts">
4545
import { ref, computed } from "vue"
46-
import { useProjectStore } from "@/stores/store"
46+
import { useProjectStore } from "@/stores/useProjectStore"
4747
import { useModalStore } from "@/stores/useModalStore"
4848
4949
const props = defineProps<{
5050
id: string
5151
}>()
5252
53-
const store = useProjectStore()
53+
const projectStore = useProjectStore()
5454
const modalStore = useModalStore()
5555
5656
const fieldName = ref("")
@@ -61,12 +61,12 @@ const nullable = ref(false)
6161
const unique = ref(false)
6262
const indexed = ref(false)
6363
64-
const filteredNodes = computed(() => store.nodes.filter((node) => node.id !== props.id))
64+
const filteredNodes = computed(() => projectStore.nodes.filter((node) => node.id !== props.id))
6565
6666
const saveSelect = () => {
6767
if (!selectedNodeId.value || !fieldName.value) return
6868
69-
store.addRelation(props.id, selectedNodeId.value, {
69+
projectStore.addRelation(props.id, selectedNodeId.value, {
7070
fieldName: fieldName.value,
7171
targetModel: selectedNodeId.value,
7272
backPopulates: backPopulates.value,

frontend/src/components/modal/EditFieldModal.vue

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
<label class="field-label">Default value</label>
2424
<input class="field-input" v-model="defaultValue" type="text" />
2525
</div>
26-
27-
2826
</div>
2927

3028
<div class="checkbox-group">
@@ -43,7 +41,7 @@
4341

4442
<script setup lang="ts">
4543
import { ref } from "vue"
46-
import { useProjectStore } from "@/stores/store"
44+
import { useProjectStore } from "@/stores/useProjectStore"
4745
import { useModalStore } from "@/stores/useModalStore"
4846
import type { Field } from "@/types/types"
4947
@@ -52,7 +50,7 @@ const props = defineProps<{
5250
field: Field
5351
}>()
5452
55-
const store = useProjectStore()
53+
const projectStore = useProjectStore()
5654
const modalStore = useModalStore()
5755
5856
const fieldName = ref(props.field.name)
@@ -64,7 +62,7 @@ const isUnique = ref(props.field.isUnique || false)
6462
const isIndex = ref(props.field.isIndex || false)
6563
6664
const saveField = () => {
67-
store.updateField(props.id, props.field.name, {
65+
projectStore.updateField(props.id, props.field.name, {
6866
name: fieldName.value,
6967
type: type.value,
7068
default: defaultValue.value || undefined,
@@ -77,7 +75,7 @@ const saveField = () => {
7775
}
7876
7977
const deleteField = () => {
80-
store.deleteField(props.id, props.field.name)
78+
projectStore.deleteField(props.id, props.field.name)
8179
modalStore.close()
8280
}
8381
</script>
@@ -103,8 +101,6 @@ const deleteField = () => {
103101
gap: 0.15rem;
104102
}
105103
106-
107-
108104
.field-label {
109105
font-weight: bold;
110106
margin-bottom: 5px;
@@ -120,7 +116,7 @@ const deleteField = () => {
120116
121117
.checkbox-group {
122118
display: flex;
123-
flex-direction: column;
119+
flex-direction: column;
124120
gap: 0.5rem;
125121
font-weight: bold;
126122
}
@@ -139,7 +135,9 @@ const deleteField = () => {
139135
border-radius: 4px;
140136
background-color: #ff6b6b;
141137
box-shadow: 3px 3px 0px black;
142-
transition: transform 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
138+
transition:
139+
transform 0.1s ease-in-out,
140+
box-shadow 0.1s ease-in-out;
143141
}
144142
145143
.delete-field-btn:hover {
@@ -155,7 +153,9 @@ const deleteField = () => {
155153
border-radius: 4px;
156154
background-color: #2fff2f;
157155
box-shadow: 3px 3px 0px black;
158-
transition: transform 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
156+
transition:
157+
transform 0.1s ease-in-out,
158+
box-shadow 0.1s ease-in-out;
159159
}
160160
161161
.save-field-btn:hover {

frontend/src/components/modal/EditRelationModal.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
<script setup lang="ts">
4848
import { ref, computed, onMounted } from "vue"
49-
import { useProjectStore } from "@/stores/store"
49+
import { useProjectStore } from "@/stores/useProjectStore"
5050
import { useModalStore } from "@/stores/useModalStore"
5151
import type { RelationalRelationField } from "@/types.types"
5252
@@ -55,7 +55,7 @@ const props = defineProps<{
5555
relation: RelationalRelationField
5656
}>()
5757
58-
const store = useProjectStore()
58+
const projectStore = useProjectStore()
5959
const modalStore = useModalStore()
6060
6161
const originalFieldName = ref("")
@@ -78,12 +78,12 @@ onMounted(() => {
7878
indexed.value = props.relation.isIndex || false
7979
})
8080
81-
const filteredNodes = computed(() => store.nodes.filter((node) => node.id !== props.id))
81+
const filteredNodes = computed(() => projectStore.nodes.filter((node) => node.id !== props.id))
8282
8383
const saveChanges = () => {
8484
if (!selectedNodeId.value || !fieldName.value) return
8585
86-
store.updateRelation(props.id, props.relation.targetModel, props.relation.fieldName, {
86+
projectStore.updateRelation(props.id, props.relation.targetModel, props.relation.fieldName, {
8787
fieldName: fieldName.value,
8888
targetModel: selectedNodeId.value,
8989
backPopulates: backPopulates.value,
@@ -97,7 +97,7 @@ const saveChanges = () => {
9797
}
9898
9999
const deleteRelation = () => {
100-
store.deleteRelation(props.id, props.relation.targetModel, props.relation.fieldName)
100+
projectStore.deleteRelation(props.id, props.relation.targetModel, props.relation.fieldName)
101101
modalStore.close()
102102
}
103103
</script>

frontend/src/components/modal/GlobalModal.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,21 @@
77
<div name="title">{{ modalTitle }}</div>
88
</div>
99
<div class="modal-actions" @click="close">
10-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x h-4 w-4"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg>
10+
<svg
11+
xmlns="http://www.w3.org/2000/svg"
12+
width="24"
13+
height="24"
14+
viewBox="0 0 24 24"
15+
fill="none"
16+
stroke="currentColor"
17+
stroke-width="2"
18+
stroke-linecap="round"
19+
stroke-linejoin="round"
20+
class="lucide lucide-x h-4 w-4"
21+
>
22+
<path d="M18 6 6 18"></path>
23+
<path d="m6 6 12 12"></path>
24+
</svg>
1125
</div>
1226
</div>
1327
<div class="modal-body">

frontend/src/components/modal/RenameNodeModal.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111

1212
<script setup lang="ts">
1313
import { ref } from "vue"
14-
import { useProjectStore } from "@/stores/store"
14+
import { useProjectStore } from "@/stores/useProjectStore"
1515
import { useModalStore } from "@/stores/useModalStore"
1616
1717
const props = defineProps<{
1818
id: string
1919
}>()
2020
21-
const store = useProjectStore()
21+
const projectStore = useProjectStore()
2222
const modalStore = useModalStore()
2323
2424
const newNodeId = ref(props.id)
@@ -29,7 +29,7 @@ const rename = () => {
2929
return
3030
}
3131
32-
store.renameNode(props.id, newNodeId.value.trim())
32+
projectStore.renameNode(props.id, newNodeId.value.trim())
3333
modalStore.close()
3434
}
3535
</script>

frontend/src/components/schema_editor/SchemaEditor.vue

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,24 @@
88
</div>
99

1010
<div class="vue-flow-viewport">
11-
<VueFlow v-model:nodes="store.nodes" v-model:edges="store.edges">
11+
<VueFlow v-model:nodes="projectStore.nodes" v-model:edges="projectStore.edges">
1212
<div class="create-wrapper">
1313
<div v-if="showInput" class="floating-create-expanded">
1414
<button class="collapse-btn" @click="showInput = false">
15-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-left size-4 rdp-nav_icon"><path d="m15 18-6-6 6-6"></path></svg>
15+
<svg
16+
xmlns="http://www.w3.org/2000/svg"
17+
width="24"
18+
height="24"
19+
viewBox="0 0 24 24"
20+
fill="none"
21+
stroke="currentColor"
22+
stroke-width="2"
23+
stroke-linecap="round"
24+
stroke-linejoin="round"
25+
class="lucide lucide-chevron-left size-4 rdp-nav_icon"
26+
>
27+
<path d="m15 18-6-6 6-6"></path>
28+
</svg>
1629
</button>
1730
<input
1831
class="create-model-input"
@@ -54,26 +67,26 @@ import EditFieldModal from "@/components/modal/EditFieldModal.vue"
5467
import EditRelationModal from "@/components/modal/EditRelationModal.vue"
5568
import AddRelationModal from "@/components/modal/AddRelationModal.vue"
5669
import RenameNodeModal from "@/components/modal/RenameNodeModal.vue"
57-
import { useProjectStore } from "@/stores/store"
70+
import { useProjectStore } from "@/stores/useProjectStore"
5871
import { VueFlow } from "@vue-flow/core"
5972
import { useModalStore } from "@/stores/useModalStore"
6073
import type { RelationalRelationField, RelationalField } from "@/types.types"
6174
62-
const store = useProjectStore()
75+
const projectStore = useProjectStore()
6376
const modalStore = useModalStore()
6477
6578
const modelName = ref("")
6679
const showInput = ref(false)
6780
6881
const handleCreateClick = () => {
6982
if (modelName.value.trim() === "") return
70-
store.createNode(modelName.value)
83+
projectStore.createNode(modelName.value)
7184
modelName.value = ""
7285
showInput.value = false
7386
}
7487
7588
const deleteNode = (id: string) => {
76-
store.deleteNode(id)
89+
projectStore.deleteNode(id)
7790
}
7891
7992
const openRenameNodeModal = (id: string) => {
@@ -167,7 +180,9 @@ const openEditRelationModal = (id: string, relation: RelationalRelationField) =>
167180
font-weight: bold;
168181
z-index: 10;
169182
box-shadow: 2px 2px 0px rgba(0, 0, 0, 1);
170-
transition: transform 0.1s ease-out, box-shadow 0.1s;
183+
transition:
184+
transform 0.1s ease-out,
185+
box-shadow 0.1s;
171186
}
172187
173188
.create-circle:hover {
@@ -224,6 +239,4 @@ const openEditRelationModal = (id: string, relation: RelationalRelationField) =>
224239
.create-model-btn:hover {
225240
background-color: #2fff2f;
226241
}
227-
228-
229-
</style>
242+
</style>

frontend/src/components/steps/DatabaseStep.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
v-for="db in databases"
1010
:key="db"
1111
:class="{
12-
confirmed: store.getDatabase() === db,
12+
confirmed: projectStore.getDatabase() === db,
1313
disabled: db !== 'PostgreSQL',
1414
enabled: db === 'PostgreSQL',
1515
}"
@@ -24,19 +24,19 @@
2424

2525
<script setup lang="ts">
2626
import { onMounted } from "vue"
27-
import { useProjectStore } from "@/stores/store"
27+
import { useProjectStore } from "@/stores/useProjectStore"
2828
29-
const store = useProjectStore()
29+
const projectStore = useProjectStore()
3030
const databases = ["PostgreSQL", "MySQL", "SQLite"]
3131
3232
const handleDatabaseClick = (db) => {
3333
if (db !== "PostgreSQL") return
34-
store.setDatabase(store.getDatabase() === db ? "" : db)
34+
projectStore.setDatabase(projectStore.getDatabase() === db ? "" : db)
3535
}
3636
3737
onMounted(() => {
38-
if (store.getDatabase() && store.getDatabase() !== "PostgreSQL") {
39-
store.setDatabase("")
38+
if (projectStore.getDatabase() && projectStore.getDatabase() !== "PostgreSQL") {
39+
projectStore.setDatabase("")
4040
}
4141
})
4242
</script>

0 commit comments

Comments
 (0)