From c19262e3c2ed0dfdaed498a15e5e32d49ceef83a Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Mon, 9 Sep 2024 22:09:59 +0200 Subject: [PATCH] Added world creation dialog --- components/calendar/form/Create.vue | 4 +- components/global/Heading.vue | 20 ++++- components/global/input/Color.vue | 20 +++++ components/world/dialog/Create.vue | 48 ++++++++++++ components/world/form/Create.vue | 100 ++++++++++++++++++++++++ i18n.config.ts | 60 +++++++++++++- models/Color.ts | 8 +- models/World.ts | 17 +++- pages/index.vue | 2 +- pages/my/index.vue | 117 ++++++++++++++++++---------- pages/my/worlds/[id].vue | 18 +++-- server/api/worlds/create.post.ts | 51 ++++++++++++ 12 files changed, 403 insertions(+), 62 deletions(-) create mode 100644 components/global/input/Color.vue create mode 100644 components/world/dialog/Create.vue create mode 100644 components/world/form/Create.vue create mode 100644 server/api/worlds/create.post.ts diff --git a/components/calendar/form/Create.vue b/components/calendar/form/Create.vue index f92b1d3..d8f8353 100644 --- a/components/calendar/form/Create.vue +++ b/components/calendar/form/Create.vue @@ -40,7 +40,7 @@ const isCreatingCalendar = ref(false) async function handleSubmit() { try { isCreatingCalendar.value = true - await $fetch("/api/calendars/create", { method: "POST", body: {...calendarSkeleton.value, worldId: 1 } }) + await $fetch("/api/calendars/create", { method: "POST", body: { ...calendarSkeleton.value, worldId: 1 } }) emit("on-close") } catch (err) { @@ -104,7 +104,7 @@ function handleFormCancel() { type="text" name="new-calendar-name" required - placeholder="Titre" + :placeholder="$t('common.title')" class="w-full -my-1 py-2 -mx-1 px-1 text-xl border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600" @input="handleNameChange" > diff --git a/components/global/Heading.vue b/components/global/Heading.vue index 2726bcc..8e51843 100644 --- a/components/global/Heading.vue +++ b/components/global/Heading.vue @@ -1,5 +1,23 @@ + + diff --git a/components/global/input/Color.vue b/components/global/input/Color.vue new file mode 100644 index 0000000..7f597e4 --- /dev/null +++ b/components/global/input/Color.vue @@ -0,0 +1,20 @@ + + + diff --git a/components/world/dialog/Create.vue b/components/world/dialog/Create.vue new file mode 100644 index 0000000..25eb825 --- /dev/null +++ b/components/world/dialog/Create.vue @@ -0,0 +1,48 @@ + + + diff --git a/components/world/form/Create.vue b/components/world/form/Create.vue new file mode 100644 index 0000000..94bbc72 --- /dev/null +++ b/components/world/form/Create.vue @@ -0,0 +1,100 @@ + + +