From 43768cb49d1007fae9c54af85dbfc11039540a2f Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Sun, 9 Jun 2024 14:03:12 +0200 Subject: [PATCH 1/4] Added shadcn switch --- assets/main.css | 6 ++++-- components.json | 1 + components/ui/switch/Switch.vue | 37 +++++++++++++++++++++++++++++++++ components/ui/switch/index.ts | 1 + 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 components/ui/switch/Switch.vue create mode 100644 components/ui/switch/index.ts diff --git a/assets/main.css b/assets/main.css index ad39aa5..68dd98d 100644 --- a/assets/main.css +++ b/assets/main.css @@ -2,7 +2,8 @@ @tailwind components; @tailwind utilities; -:root { +@layer base { + :root { --background: 0 0% 100%; --foreground: 222.2 84% 4.9%; @@ -35,7 +36,7 @@ --radius: 0.5rem; } - :root.dark { + .dark { --background: 222.2 84% 4.9%; --foreground: 210 40% 98%; @@ -64,6 +65,7 @@ --destructive-foreground: 210 40% 98%; --ring: 212.7 26.8% 83.9%; + } } @layer base { diff --git a/components.json b/components.json index be94b1d..3dc3dc9 100644 --- a/components.json +++ b/components.json @@ -2,6 +2,7 @@ "$schema": "https://shadcn-vue.com/schema.json", "style": "default", "typescript": true, + "tsConfigPath": ".nuxt/tsconfig.json", "tailwind": { "config": "tailwind.config.js", "css": "assets/main.css", diff --git a/components/ui/switch/Switch.vue b/components/ui/switch/Switch.vue new file mode 100644 index 0000000..f2ee993 --- /dev/null +++ b/components/ui/switch/Switch.vue @@ -0,0 +1,37 @@ + + + diff --git a/components/ui/switch/index.ts b/components/ui/switch/index.ts new file mode 100644 index 0000000..87b4b17 --- /dev/null +++ b/components/ui/switch/index.ts @@ -0,0 +1 @@ +export { default as Switch } from './Switch.vue' From 737ee6739b715fb4ee046934605d1fd2c5ebe25b Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Sun, 9 Jun 2024 14:27:53 +0200 Subject: [PATCH 2/4] Added switch component to toggle visibility --- components/calendar/form/CreateEvent.vue | 27 +++++++++++++++++--- components/calendar/form/UpdateEvent.vue | 29 ++++++++++++++++++---- components/ui/label/Label.vue | 27 ++++++++++++++++++++ components/ui/label/index.ts | 1 + models/CalendarEvent.ts | 3 ++- server/api/calendars/events/[id].patch.ts | 1 + server/api/calendars/events/create.post.ts | 1 + 7 files changed, 79 insertions(+), 10 deletions(-) create mode 100644 components/ui/label/Label.vue create mode 100644 components/ui/label/index.ts diff --git a/components/calendar/form/CreateEvent.vue b/components/calendar/form/CreateEvent.vue index 524121f..e2841fe 100644 --- a/components/calendar/form/CreateEvent.vue +++ b/components/calendar/form/CreateEvent.vue @@ -1,7 +1,7 @@ + + diff --git a/components/ui/label/index.ts b/components/ui/label/index.ts new file mode 100644 index 0000000..572c2f0 --- /dev/null +++ b/components/ui/label/index.ts @@ -0,0 +1 @@ +export { default as Label } from './Label.vue' diff --git a/models/CalendarEvent.ts b/models/CalendarEvent.ts index c59f2fe..a1e9be0 100644 --- a/models/CalendarEvent.ts +++ b/models/CalendarEvent.ts @@ -24,7 +24,8 @@ export const postEventBodySchema = z.object({ description: z.string().optional().nullable(), location: z.string().optional().nullable(), startDate: dateSchema.required(), - endDate: dateSchema.optional().nullable() + endDate: dateSchema.optional().nullable(), + hidden: z.boolean().optional().nullable() }), calendarId: z.number({ coerce: true }).int().positive() }) diff --git a/server/api/calendars/events/[id].patch.ts b/server/api/calendars/events/[id].patch.ts index bd0815b..6e3298f 100644 --- a/server/api/calendars/events/[id].patch.ts +++ b/server/api/calendars/events/[id].patch.ts @@ -41,6 +41,7 @@ export default defineEventHandler(async (event) => { title: bodyData?.event.title, description: bodyData.event.description, location: bodyData.event.location, + hidden: bodyData.event.hidden, calendar_id: bodyData?.calendarId } as never ) diff --git a/server/api/calendars/events/create.post.ts b/server/api/calendars/events/create.post.ts index c550ecb..9782b41 100644 --- a/server/api/calendars/events/create.post.ts +++ b/server/api/calendars/events/create.post.ts @@ -25,6 +25,7 @@ export default defineEventHandler(async (event) => { title: bodyData?.event.title, description: bodyData.event.description, location: bodyData.event.location, + hidden: bodyData.event.hidden, calendar_id: bodyData?.calendarId } as never ) From 92850861cd9c8b44b4b17247e2cf56075b01e121 Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Sun, 9 Jun 2024 17:20:21 +0200 Subject: [PATCH 3/4] Added private event visual feedback --- components/calendar/CalendarEvent.vue | 1 + components/calendar/CalendarEventDetails.vue | 16 ++++++++++++++- .../calendar/search/lists/EventCallout.vue | 20 ++++++++++++++++--- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/components/calendar/CalendarEvent.vue b/components/calendar/CalendarEvent.vue index 8abdc39..96b530d 100644 --- a/components/calendar/CalendarEvent.vue +++ b/components/calendar/CalendarEvent.vue @@ -60,6 +60,7 @@ onMounted(() => { class="text-xs px-2 py-1 block w-full text-left rounded-sm focus-visible:bg-red-200" :class=" cn({ + 'italic': event.hidden, 'text-white bg-slate-600 hover:bg-slate-700': !event.category, 'text-white bg-lime-600 hover:bg-lime-700': event.category?.name === 'naissance', 'text-white bg-stone-500 hover:bg-stone-700': event.category?.name === 'mort', diff --git a/components/calendar/CalendarEventDetails.vue b/components/calendar/CalendarEventDetails.vue index 3ae0c96..27013ba 100644 --- a/components/calendar/CalendarEventDetails.vue +++ b/components/calendar/CalendarEventDetails.vue @@ -9,7 +9,8 @@ import { PhHourglassHigh, PhHourglassLow, PhMapPinArea, - PhDotsThreeOutlineVertical + PhDotsThreeOutlineVertical, + PhEye } from '@phosphor-icons/vue' const { defaultDate, getFormattedDateTitle, jumpToDate, getRelativeString } = useCalendar() @@ -189,6 +190,19 @@ function deployDeleteModal() { + + + + + + Évènement privé + + + +

Cet évènement est uniquement visible pour vous

+
+
+
diff --git a/components/calendar/search/lists/EventCallout.vue b/components/calendar/search/lists/EventCallout.vue index 9eef932..85f9a03 100644 --- a/components/calendar/search/lists/EventCallout.vue +++ b/components/calendar/search/lists/EventCallout.vue @@ -3,7 +3,7 @@ import type { RPGDate } from '@/models/Date' import type { CalendarEvent } from '@/models/CalendarEvent' import { useCalendar } from '@/stores/CalendarStore' -import { PhArrowSquareOut, PhHourglassMedium, PhAlarm, PhMapPinArea } from '@phosphor-icons/vue' +import { PhArrowSquareOut, PhHourglassMedium, PhAlarm, PhMapPinArea, PhEye } from '@phosphor-icons/vue' const props = defineProps<{ event: CalendarEvent @@ -27,6 +27,7 @@ const dateDuration: string | null = props.event.endDate From 15527fd98376722159085fc29ec04f0f0aef82ba Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Sun, 9 Jun 2024 17:22:56 +0200 Subject: [PATCH 4/4] Changed create event trigger to be double click This might get reverted, I'm testing to see how it feels first --- components/calendar/form/CreateEvent.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/calendar/form/CreateEvent.vue b/components/calendar/form/CreateEvent.vue index e2841fe..8fd6d42 100644 --- a/components/calendar/form/CreateEvent.vue +++ b/components/calendar/form/CreateEvent.vue @@ -1,6 +1,6 @@