From 31a43161861438880c41465f325a88f7062d2850 Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Thu, 6 Mar 2025 20:34:59 +0100 Subject: [PATCH] Commit stuff in case my computer explodes --- components/calendar/PreviewCard.vue | 21 ++-- components/calendar/dialog/Update.vue | 49 +++++++++ components/calendar/form/Create.vue | 6 +- components/calendar/form/Update.vue | 145 ++++++++++++++++++++++++++ i18n.config.ts | 15 ++- models/CalendarConfig.ts | 1 + pages/my/worlds/[id].vue | 33 ++++-- server/api/calendars/[id].patch.ts | 78 ++++++++++++++ server/api/calendars/query.get.ts | 8 +- supabase/migrations/202401_init.sql | 5 +- 10 files changed, 333 insertions(+), 28 deletions(-) create mode 100644 components/calendar/dialog/Update.vue create mode 100644 components/calendar/form/Update.vue create mode 100644 server/api/calendars/[id].patch.ts diff --git a/components/calendar/PreviewCard.vue b/components/calendar/PreviewCard.vue index 04887a6..4c87e96 100644 --- a/components/calendar/PreviewCard.vue +++ b/components/calendar/PreviewCard.vue @@ -1,5 +1,5 @@ + + diff --git a/components/calendar/form/Create.vue b/components/calendar/form/Create.vue index e6e3c51..fa7c625 100644 --- a/components/calendar/form/Create.vue +++ b/components/calendar/form/Create.vue @@ -79,21 +79,21 @@ function handleFormCancel() {
- {{ $t('entity.calendar.createDialog.tabs.general.title') }} + {{ $t('entity.calendar.actionDialog.tabs.general.title') }}
- {{ $t('entity.calendar.createDialog.tabs.months.title') }} + {{ $t('entity.calendar.actionDialog.tabs.months.title') }}
- {{ $t('entity.calendar.createDialog.tabs.today.title') }} + {{ $t('entity.calendar.actionDialog.tabs.today.title') }}
diff --git a/components/calendar/form/Update.vue b/components/calendar/form/Update.vue new file mode 100644 index 0000000..a0d9ebd --- /dev/null +++ b/components/calendar/form/Update.vue @@ -0,0 +1,145 @@ + + + diff --git a/i18n.config.ts b/i18n.config.ts index 40c41ae..8ee5b1e 100644 --- a/i18n.config.ts +++ b/i18n.config.ts @@ -197,8 +197,7 @@ export default defineI18nConfig(() => ({ title: "The event \"{event}\" has been successfuly deleted.", }, }, - createDialog: { - title: "Create a calendar", + actionDialog: { tabs: { general: { title: "General", @@ -211,6 +210,9 @@ export default defineI18nConfig(() => ({ }, } }, + createDialog: { + title: "Create a calendar", + }, deleteDialog: { title: "Are you sure you want to delete this calendar ?", subtitle: "Its events won't be accessible anymore and you won't be able to retrieve the deleted data !", @@ -460,8 +462,7 @@ export default defineI18nConfig(() => ({ title: "L'évènement \"{event}\" a été supprimé avec succès.", }, }, - createDialog: { - title: "Créer un calendrier", + actionDialog: { tabs: { general: { title: "Général", @@ -474,6 +475,12 @@ export default defineI18nConfig(() => ({ }, } }, + createDialog: { + title: "Créer un calendrier", + }, + updateDialog: { + title: "Modifier le calendrier", + }, deleteDialog: { title: "Êtes-vous sûr de supprimer ce calendrier ?", subtitle: "Les évènements ne seront plus accessibles et vous ne pourrez plus récupérer les données !", diff --git a/models/CalendarConfig.ts b/models/CalendarConfig.ts index ca0971b..159a4f2 100644 --- a/models/CalendarConfig.ts +++ b/models/CalendarConfig.ts @@ -34,4 +34,5 @@ export const postCalendarSchema = z.object({ color: z.string().optional().nullable(), months: z.array(calendarMonthSchema).min(1), worldId: z.number().int(), + state: z.string().optional().nullable().default("draft"), }) diff --git a/pages/my/worlds/[id].vue b/pages/my/worlds/[id].vue index 275b426..c7a2eca 100644 --- a/pages/my/worlds/[id].vue +++ b/pages/my/worlds/[id].vue @@ -24,12 +24,6 @@ watch(user, (n) => { } }) -const isCreateCalendarModalOpen = ref(false) - -function hideCreateDialog() { - isCreateCalendarModalOpen.value = false -} - /** * === Subscriptions === */ @@ -120,14 +114,28 @@ onUnmounted(() => { }) const markedCalendar = ref(null) -const isDeleteCalendarModalOpen = ref(false) const isEditWorldModalOpen = ref(false) +const isCreateCalendarModalOpen = ref(false) +const isUpdateCalendarModalOpen = ref(false) +const isDeleteCalendarModalOpen = ref(false) + +function hideCreateDialog() { + isCreateCalendarModalOpen.value = false +} + +function deployUpdateDialog(calendar: Calendar) { + markedCalendar.value = calendar + isUpdateCalendarModalOpen.value = true +} +function hideUpdateDialog() { + isUpdateCalendarModalOpen.value = false +} + function deployDeleteCalendarModal(calendar: Calendar) { isDeleteCalendarModalOpen.value = true markedCalendar.value = calendar } - function hideDeleteCalendarModal() { isDeleteCalendarModalOpen.value = false markedCalendar.value = null @@ -136,7 +144,6 @@ function hideDeleteCalendarModal() { function deployEditModal() { isEditWorldModalOpen.value = true } - function hideEditModal() { isEditWorldModalOpen.value = false } @@ -193,7 +200,12 @@ function hideEditModal() {
  • - +
  • @@ -212,6 +224,7 @@ function hideEditModal() { +