From 58f3783b13ee09a55f271e506e42a17a323c233b Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Tue, 15 Apr 2025 15:34:05 +0200 Subject: [PATCH] Added category creation interface --- components/calendar/category/Table.vue | 12 +- components/calendar/category/TableFooter.vue | 130 ++++++++++++++++++ components/calendar/category/TableHeader.vue | 19 +++ components/calendar/category/TableRow.vue | 21 +-- components/global/input/Color.vue | 2 +- i18n.config.ts | 8 ++ models/CalendarEvent.ts | 8 +- models/Category.ts | 10 +- server/api/calendars/categories/[id].patch.ts | 5 +- .../api/calendars/categories/create.post.ts | 56 ++++++++ stores/CategoryStore.ts | 32 ++++- supabase/migrations/202401_init.sql | 14 ++ 12 files changed, 285 insertions(+), 32 deletions(-) create mode 100644 components/calendar/category/TableFooter.vue create mode 100644 components/calendar/category/TableHeader.vue create mode 100644 server/api/calendars/categories/create.post.ts diff --git a/components/calendar/category/Table.vue b/components/calendar/category/Table.vue index bf22252..c90a9c8 100644 --- a/components/calendar/category/Table.vue +++ b/components/calendar/category/Table.vue @@ -11,15 +11,7 @@ const sortedCategories = computed(() => categories.toSorted((a, b) => a.name.loc diff --git a/components/calendar/category/TableFooter.vue b/components/calendar/category/TableFooter.vue new file mode 100644 index 0000000..4b4616f --- /dev/null +++ b/components/calendar/category/TableFooter.vue @@ -0,0 +1,130 @@ + + + diff --git a/components/calendar/category/TableHeader.vue b/components/calendar/category/TableHeader.vue new file mode 100644 index 0000000..7f454b7 --- /dev/null +++ b/components/calendar/category/TableHeader.vue @@ -0,0 +1,19 @@ + + + + diff --git a/components/calendar/category/TableRow.vue b/components/calendar/category/TableRow.vue index ed0986d..4690e3e 100644 --- a/components/calendar/category/TableRow.vue +++ b/components/calendar/category/TableRow.vue @@ -34,10 +34,10 @@ function toggleView(options: ToggleViewOptions = { execution: "now" }) { currentMode.value = "view" if (options.execution === "now") { - inputFocused.value = false; + inputFocused.value = false } else { nextTick(() => { - inputFocused.value = false; + inputFocused.value = false }) } } @@ -46,11 +46,11 @@ function toggleView(options: ToggleViewOptions = { execution: "now" }) { * Toggle edit mode */ function toggleEdit() { - currentMode.value = "edit"; + currentMode.value = "edit" categorySkeleton.value = structuredClone(toRaw(category)) nextTick(() => { - inputFocused.value = true; + inputFocused.value = true }) } @@ -66,7 +66,6 @@ onUnmounted(() => { /** * Submit the update - * TODO: Implement the update logic */ async function submitUpdate() { const { error } = await tryCatch(updateCategoryFromSkeleton()) @@ -90,18 +89,20 @@ async function submitUpdate() {