From f3fd97e3cd33158a80d4e4937ee6b37dc7121386 Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Fri, 14 Mar 2025 22:25:50 +0100 Subject: [PATCH 01/24] Changed categories to be linked to calendars and worlds --- supabase/migrations/202401_init.sql | 107 ++++++++++++++++------------ supabase/seed.sql | 102 +++++++++++++------------- 2 files changed, 111 insertions(+), 98 deletions(-) diff --git a/supabase/migrations/202401_init.sql b/supabase/migrations/202401_init.sql index 9cdfde2..e4a11c0 100644 --- a/supabase/migrations/202401_init.sql +++ b/supabase/migrations/202401_init.sql @@ -14,40 +14,40 @@ create type public.calendar_state as enum ('published', 'draft', 'archived'); -- DATA STRUCTURES -- Users create table public.users ( - id uuid references auth.users not null primary key, -- UUID from auth.users - username text + id uuid references auth.users not null primary key, -- UUID from auth.users + username text ); comment on table public.users is 'Profile data for each user.'; comment on column public.users.id is 'References the internal Supabase Auth user.'; -- Roles create table public.user_roles ( - id bigint generated by default as identity primary key, - role app_role not null, - user_id uuid references public.users on delete cascade not null, + id bigint generated by default as identity primary key, + role app_role not null, + user_id uuid references public.users on delete cascade not null, unique (user_id, role) ); comment on table public.user_roles is 'Application roles for each user.'; -- Permissions create table public.role_permissions ( - id bigint generated by default as identity primary key, - role app_role not null, - permission app_permission not null, + id bigint generated by default as identity primary key, + role app_role not null, + permission app_permission not null, unique (role, permission) ); comment on table public.role_permissions is 'Application permissions for each role.'; -- Worlds create table public.worlds ( - id bigint generated by default as identity primary key, - name text not null, - description text, - color app_colors default 'black', - state world_state default 'draft', - created_at timestamptz default now(), - updated_at timestamptz, - gm_id uuid references public.users on delete cascade + id bigint generated by default as identity primary key, + name text not null, + description text, + color app_colors default 'black', + state world_state default 'draft', + created_at timestamptz default now(), + updated_at timestamptz, + gm_id uuid references public.users on delete cascade ); comment on table public.worlds is 'Worlds belonging to a single user ; a game master.'; create trigger handle_updated_at before update on public.worlds @@ -55,9 +55,9 @@ create trigger handle_updated_at before update on public.worlds -- World Players (join table) create table public.world_players ( - world_id bigint references public.worlds on delete cascade, - player_id uuid references public.users on delete cascade, - joined_at timestamptz default now(), + world_id bigint references public.worlds on delete cascade, + player_id uuid references public.users on delete cascade, + joined_at timestamptz default now(), primary key (world_id, player_id) ); comment on table public.world_players is 'Players (users) that belong to specific worlds'; @@ -91,27 +91,27 @@ comment on table public.calendar_months is 'A calendar month.'; -- Calendar Event categories create table public.calendar_event_categories ( - id bigint generated by default as identity primary key, - name text not null, - color app_colors default 'black', - unique (name) + id bigint generated by default as identity primary key, + name text not null, + color app_colors default 'black', + calendar_id bigint references public.calendars on delete cascade not null ); comment on table public.calendar_event_categories is 'Categories describing events.'; -- Calendar Events create table public.calendar_events ( - id bigint generated by default as identity primary key, - title text not null, - description text, - location text, - start_date json not null, - end_date json, - category bigint references public.calendar_event_categories on delete cascade, - hidden boolean default false, - wiki text, - created_at timestamptz default now(), - updated_at timestamptz, - calendar_id bigint references public.calendars on delete cascade not null + id bigint generated by default as identity primary key, + title text not null, + description text, + location text, + start_date json not null, + end_date json, + category bigint references public.calendar_event_categories on delete cascade, + hidden boolean default false, + wiki text, + created_at timestamptz default now(), + updated_at timestamptz, + calendar_id bigint references public.calendars on delete cascade not null ); comment on table public.calendar_events is 'Events linked to a world'; @@ -134,12 +134,12 @@ comment on table public.calendar_event_categories_links is 'Link tables for mult -- Character categories create table public.character_categories ( - id bigint generated by default as identity primary key, - name text not null, - color app_colors default 'black', - created_at timestamptz default now(), - updated_at timestamptz, - unique (name) + id bigint generated by default as identity primary key, + name text not null, + color app_colors default 'black', + created_at timestamptz default now(), + updated_at timestamptz, + world_id bigint references public.worlds on delete cascade not null ); comment on table public.character_categories is 'Categories describing characters'; @@ -420,12 +420,25 @@ create policy "Allow individual update access for GMs" on public.characters for ) ); --- Categories are public to view but not to insert --- Needs to be refactored maybe, if in the future we want a default set AND user defined ones -create policy "Allow all read access" on public.calendar_event_categories for select to authenticated, anon using ( true ); -create policy "Allow all read access" on public.calendar_event_categories_links for select to authenticated, anon using ( true ); -create policy "Allow logged-in read access" on public.character_categories for select using ( auth.role() = 'authenticated' ); -create policy "Allow logged-in read access" on public.character_categories_links for select using ( auth.role() = 'authenticated' ); +-- Categories policies +create policy "Allow anonymous access to published event categories" on public.calendar_event_categories + for select + to authenticated, anon + using ( + exists ( + select 1 + from public.calendars c + join public.calendar_event_categories_links l on l.calendar_event_category_id = calendar_event_categories.id + where c.id = calendar_event_categories.calendar_id + and c.state = 'published' + ) + or exists ( + select 1 + from public.calendars c + where c.id = calendar_event_categories.calendar_id + and c.state = 'published' + ) + ); -- Send "previous data" on change alter table public.users replica identity full; diff --git a/supabase/seed.sql b/supabase/seed.sql index d3d9d24..4a2c029 100644 --- a/supabase/seed.sql +++ b/supabase/seed.sql @@ -1,57 +1,57 @@ insert into public.role_permissions (role, permission) values ('sa', 'events.see.hidden'); insert into public.role_permissions (role, permission) values ('sa', 'users.ban'); --- Event categories -insert into public.calendar_event_categories (name, color) values ('Naissance', 'white'); -insert into public.calendar_event_categories (name, color) values ('Mort', 'black'); -insert into public.calendar_event_categories (name, color) values ('Catastrophe', 'orange'); -insert into public.calendar_event_categories (name, color) values ('Catastrophe naturelle', 'red'); -insert into public.calendar_event_categories (name, color) values ('Inauguration', 'green'); -insert into public.calendar_event_categories (name, color) values ('Religion', 'violet'); -insert into public.calendar_event_categories (name, color) values ('Invention', 'teal'); -insert into public.calendar_event_categories (name, color) values ('Science', 'indigo'); -insert into public.calendar_event_categories (name, color) values ('Bénédiction', 'white'); -insert into public.calendar_event_categories (name, color) values ('Joueurs', 'white'); -insert into public.calendar_event_categories (name, color) values ('Découverte', 'purple'); -insert into public.calendar_event_categories (name, color) values ('Exploration', 'lime'); -insert into public.calendar_event_categories (name, color) values ('Construction', 'blue'); -insert into public.calendar_event_categories (name, color) values ('Arcanologie', 'cyan'); -insert into public.calendar_event_categories (name, color) values ('Criminalité', 'rose'); -insert into public.calendar_event_categories (name, color) values ('Scandale', 'pink'); -insert into public.calendar_event_categories (name, color) values ('Commerce', 'amber'); -insert into public.calendar_event_categories (name, color) values ('Législation', 'blue'); - --- Character categories -insert into public.character_categories (name, color) values ('Joueur', 'white'); -insert into public.character_categories (name, color) values ('Comte', 'emerald'); -insert into public.character_categories (name, color) values ('Scientifique', 'indigo'); -insert into public.character_categories (name, color) values ('Mage', 'cyan'); -insert into public.character_categories (name, color) values ('Professeur', 'teal'); -insert into public.character_categories (name, color) values ('Criminel', 'rose'); -insert into public.character_categories (name, color) values ('Étincelle', 'lime'); -insert into public.character_categories (name, color) values ('Buse blanche', 'yellow'); -insert into public.character_categories (name, color) values ('Ecclésiastique', 'violet'); -insert into public.character_categories (name, color) values ('Militaire', 'orange'); -insert into public.character_categories (name, color) values ('Activiste', 'sky'); -insert into public.character_categories (name, color) values ('Commerçant', 'amber'); - -- Worlds insert into public.worlds (name, description, color, state) values ('Léïm', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis aliquet congue aliquet. Curabitur eu iaculis diam. Nunc iaculis nibh orci, eu semper nunc congue congue. Praesent euismod tortor eget metus tristique lobortis vel in risus. In volutpat ligula orci, id pharetra lectus egestas at.', 'black', 'published'); +-- Character categories +insert into public.character_categories (name, color, world_id) values ('Joueur', 'white', 1); +insert into public.character_categories (name, color, world_id) values ('Comte', 'emerald', 1); +insert into public.character_categories (name, color, world_id) values ('Scientifique', 'indigo', 1); +insert into public.character_categories (name, color, world_id) values ('Mage', 'cyan', 1); +insert into public.character_categories (name, color, world_id) values ('Professeur', 'teal', 1); +insert into public.character_categories (name, color, world_id) values ('Criminel', 'rose', 1); +insert into public.character_categories (name, color, world_id) values ('Étincelle', 'lime', 1); +insert into public.character_categories (name, color, world_id) values ('Buse blanche', 'yellow', 1); +insert into public.character_categories (name, color, world_id) values ('Ecclésiastique', 'violet', 1); +insert into public.character_categories (name, color, world_id) values ('Militaire', 'orange', 1); +insert into public.character_categories (name, color, world_id) values ('Activiste', 'sky', 1); +insert into public.character_categories (name, color, world_id) values ('Commerçant', 'amber', 1); + -- Worlds' calendars insert into public.calendars (world_id, name, today, state) values (1, 'Calendrier solaire', '{ "day": 23, "month": 8, "year": 3209 }', 'published'); -- Calendar's months -insert into public.calendar_months (calendar_id, name, days, position) values (1, 'Jalen', 32, 1); -insert into public.calendar_months (calendar_id, name, days, position) values (1, 'Malsen', 32, 2); -insert into public.calendar_months (calendar_id, name, days, position) values (1, 'Verlys', 32, 3); -insert into public.calendar_months (calendar_id, name, days, position) values (1, 'Nalys', 32, 4); -insert into public.calendar_months (calendar_id, name, days, position) values (1, 'Verdore', 32, 5); -insert into public.calendar_months (calendar_id, name, days, position) values (1, 'Sidore', 32, 6); -insert into public.calendar_months (calendar_id, name, days, position) values (1, 'Lyllion', 32, 7); -insert into public.calendar_months (calendar_id, name, days, position) values (1, 'Rion', 32, 8); -insert into public.calendar_months (calendar_id, name, days, position) values (1, 'Farene', 32, 9); -insert into public.calendar_months (calendar_id, name, days, position) values (1, 'Dalvene', 32, 10); +insert into public.calendar_months (name, days, position, calendar_id) values ('Jalen', 32, 1, 1); +insert into public.calendar_months (name, days, position, calendar_id) values ('Malsen', 32, 2, 1); +insert into public.calendar_months (name, days, position, calendar_id) values ('Verlys', 32, 3, 1); +insert into public.calendar_months (name, days, position, calendar_id) values ('Nalys', 32, 4, 1); +insert into public.calendar_months (name, days, position, calendar_id) values ('Verdore', 32, 5, 1); +insert into public.calendar_months (name, days, position, calendar_id) values ('Sidore', 32, 6, 1); +insert into public.calendar_months (name, days, position, calendar_id) values ('Lyllion', 32, 7, 1); +insert into public.calendar_months (name, days, position, calendar_id) values ('Rion', 32, 8, 1); +insert into public.calendar_months (name, days, position, calendar_id) values ('Farene', 32, 9, 1); +insert into public.calendar_months (name, days, position, calendar_id) values ('Dalvene', 32, 10, 1); + +-- Event categories +insert into public.calendar_event_categories (name, color, calendar_id) values ('Naissance', 'white', 1); +insert into public.calendar_event_categories (name, color, calendar_id) values ('Mort', 'black', 1); +insert into public.calendar_event_categories (name, color, calendar_id) values ('Catastrophe', 'orange', 1); +insert into public.calendar_event_categories (name, color, calendar_id) values ('Catastrophe naturelle', 'red', 1); +insert into public.calendar_event_categories (name, color, calendar_id) values ('Inauguration', 'green', 1); +insert into public.calendar_event_categories (name, color, calendar_id) values ('Religion', 'violet', 1); +insert into public.calendar_event_categories (name, color, calendar_id) values ('Invention', 'teal', 1); +insert into public.calendar_event_categories (name, color, calendar_id) values ('Science', 'indigo', 1); +insert into public.calendar_event_categories (name, color, calendar_id) values ('Bénédiction', 'white', 1); +insert into public.calendar_event_categories (name, color, calendar_id) values ('Joueurs', 'white', 1); +insert into public.calendar_event_categories (name, color, calendar_id) values ('Découverte', 'purple', 1); +insert into public.calendar_event_categories (name, color, calendar_id) values ('Exploration', 'lime', 1); +insert into public.calendar_event_categories (name, color, calendar_id) values ('Construction', 'blue', 1); +insert into public.calendar_event_categories (name, color, calendar_id) values ('Magie', 'cyan', 1); +insert into public.calendar_event_categories (name, color, calendar_id) values ('Criminalité', 'rose', 1); +insert into public.calendar_event_categories (name, color, calendar_id) values ('Scandale', 'pink', 1); +insert into public.calendar_event_categories (name, color, calendar_id) values ('Commerce', 'amber', 1); +insert into public.calendar_event_categories (name, color, calendar_id) values ('Législation', 'blue', 1); -- Events insert into public.calendar_events (title, description, start_date, category, hidden, wiki, calendar_id) values ( @@ -203,7 +203,7 @@ insert into public.calendar_events (title, description, start_date, end_date, ca 'Celui qu''on surnomme la Bête d''Ambrose arrive à Handany, où il purgera sa peine.', '{ "day": 14, "month": 7, "year": 3209 }', null, - 18, + 15, false, 'https://alexcreates.fr/leim/index.php/Tivian_Rodhus', 1 @@ -221,7 +221,7 @@ insert into public.calendar_events (title, description, location, start_date, en 'Tourgrise', '{ "day": 4, "month": 8, "year": 3209 }', null, - 18, + 15, false, null, 1 @@ -245,7 +245,7 @@ insert into public.calendar_events (title, description, location, start_date, en '{ "day": 28, "month": 7, "year": 3209 }', null, 2, - true, + false, null, 1 ); @@ -256,7 +256,7 @@ insert into public.calendar_events (title, description, location, start_date, en '{ "day": 32, "month": 7, "year": 3209 }', null, 2, - true, + false, null, 1 ); @@ -267,7 +267,7 @@ insert into public.calendar_events (title, description, location, start_date, en '{ "day": 10, "month": 8, "year": 3209 }', null, 2, - true, + false, null, 1 ); @@ -278,7 +278,7 @@ insert into public.calendar_events (title, description, location, start_date, en '{ "day": 19, "month": 8, "year": 3209 }', null, 2, - true, + false, null, 1 ); @@ -289,7 +289,7 @@ insert into public.calendar_events (title, description, location, start_date, en '{ "day": 22, "month": 8, "year": 3209 }', null, 2, - true, + false, null, 1 ); From 6992bca9571a02a89b8a1bd5634cba951e3c75c9 Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Fri, 14 Mar 2025 22:30:10 +0100 Subject: [PATCH 02/24] Changed hidden translations --- i18n.config.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/i18n.config.ts b/i18n.config.ts index 67fbf01..510fe8c 100644 --- a/i18n.config.ts +++ b/i18n.config.ts @@ -183,8 +183,8 @@ export default defineI18nConfig(() => ({ title: "Event title", isStart: "Start", isEnd: "End", - isHidden: "Hidden event", - isPublic: "Public event", + isHidden: "Hidden", + isPublic: "Public", hiddenTooltip: "This event is visible only to game masters.", addLocation: "Add a place", prevPage: "Previous page with events", @@ -479,8 +479,8 @@ export default defineI18nConfig(() => ({ title: "Titre de l'évènement", isStart: "Début", isEnd: "Fin", - isHidden: "Évènement privé", - isPublic: "Évènement public", + isHidden: "Privé", + isPublic: "Public", hiddenTooltip: "Cet évènement est uniquement visible pour les maîtres du jeu.", addLocation: "Ajouter un endroit", prevPage: "Précédente page à évènements", From 7f3a2b8d56712a33aa57f3eb6ac4bc023077cb5b Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Sat, 15 Mar 2025 14:52:26 +0100 Subject: [PATCH 03/24] Fixed long RLS name --- supabase/migrations/202401_init.sql | 6 +++--- supabase/seed.sql | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/supabase/migrations/202401_init.sql b/supabase/migrations/202401_init.sql index e4a11c0..e8683e5 100644 --- a/supabase/migrations/202401_init.sql +++ b/supabase/migrations/202401_init.sql @@ -93,7 +93,7 @@ comment on table public.calendar_months is 'A calendar month.'; create table public.calendar_event_categories ( id bigint generated by default as identity primary key, name text not null, - color app_colors default 'black', + color app_colors default 'white', calendar_id bigint references public.calendars on delete cascade not null ); comment on table public.calendar_event_categories is 'Categories describing events.'; @@ -136,7 +136,7 @@ comment on table public.calendar_event_categories_links is 'Link tables for mult create table public.character_categories ( id bigint generated by default as identity primary key, name text not null, - color app_colors default 'black', + color app_colors default 'white', created_at timestamptz default now(), updated_at timestamptz, world_id bigint references public.worlds on delete cascade not null @@ -335,7 +335,7 @@ create policy "Allow GMs to delete their calendar's months" ); -- Event policies -create policy "Allow anonymous access to non-hidden events in published calendars" on public.calendar_events +create policy "Allow anon access to non-hidden events in published calendars" on public.calendar_events for select to authenticated, anon using ( diff --git a/supabase/seed.sql b/supabase/seed.sql index 4a2c029..45f7f10 100644 --- a/supabase/seed.sql +++ b/supabase/seed.sql @@ -2,7 +2,7 @@ insert into public.role_permissions (role, permission) values ('sa', 'events.see insert into public.role_permissions (role, permission) values ('sa', 'users.ban'); -- Worlds -insert into public.worlds (name, description, color, state) values ('Léïm', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis aliquet congue aliquet. Curabitur eu iaculis diam. Nunc iaculis nibh orci, eu semper nunc congue congue. Praesent euismod tortor eget metus tristique lobortis vel in risus. In volutpat ligula orci, id pharetra lectus egestas at.', 'black', 'published'); +insert into public.worlds (name, description, color, state) values ('Léïm', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis aliquet congue aliquet. Curabitur eu iaculis diam. Nunc iaculis nibh orci, eu semper nunc congue congue. Praesent euismod tortor eget metus tristique lobortis vel in risus. In volutpat ligula orci, id pharetra lectus egestas at.', 'white', 'published'); -- Character categories insert into public.character_categories (name, color, world_id) values ('Joueur', 'white', 1); @@ -19,7 +19,7 @@ insert into public.character_categories (name, color, world_id) values ('Activis insert into public.character_categories (name, color, world_id) values ('Commerçant', 'amber', 1); -- Worlds' calendars -insert into public.calendars (world_id, name, today, state) values (1, 'Calendrier solaire', '{ "day": 23, "month": 8, "year": 3209 }', 'published'); +insert into public.calendars (world_id, name, today, color, state) values (1, 'Calendrier solaire', '{ "day": 23, "month": 8, "year": 3209 }', 'white', 'published'); -- Calendar's months insert into public.calendar_months (name, days, position, calendar_id) values ('Jalen', 32, 1, 1); From 149d0794e3f57bb830d5e51f56564967a3298adc Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Fri, 28 Mar 2025 12:11:54 +0100 Subject: [PATCH 04/24] Moved navigation to sub nav --- components/calendar/CalendarCurrentDate.vue | 19 +- components/calendar/CalendarMenu.vue | 7 +- components/calendar/CalendarMenuNav.vue | 200 ----------------- components/calendar/CalendarMenuSubnav.vue | 234 ++++++++++++++------ i18n.config.ts | 4 +- 5 files changed, 186 insertions(+), 278 deletions(-) delete mode 100644 components/calendar/CalendarMenuNav.vue diff --git a/components/calendar/CalendarCurrentDate.vue b/components/calendar/CalendarCurrentDate.vue index 279e514..bdb88cc 100644 --- a/components/calendar/CalendarCurrentDate.vue +++ b/components/calendar/CalendarCurrentDate.vue @@ -4,26 +4,29 @@ import { computed } from "vue" import { PhMapPin } from "@phosphor-icons/vue" -const { defaultDate, getFormattedDateTitle, getRelativeString } = useCalendar() +const { defaultDate, getFormattedDateTitle, getRelativeString, getDifferenceInDays } = useCalendar() const { selectedDate } = storeToRefs(useCalendar()) const mainDateTitle = computed(() => getFormattedDateTitle(selectedDate.value, true)) // const mainDateTitle = computed(() => convertDateToDays(selectedDate.value)) const dateDifference = computed(() => getRelativeString(defaultDate, selectedDate.value)) +const isToday = computed(() => getDifferenceInDays(defaultDate, selectedDate.value) === 0) diff --git a/i18n.config.ts b/i18n.config.ts index 48bbf02..175d7a1 100644 --- a/i18n.config.ts +++ b/i18n.config.ts @@ -79,7 +79,7 @@ export default defineI18nConfig(() => ({ dark: "Dark", light: "Light", system: "System", - displayMode: "Display mode" + displayMode: "Display" }, common: { title: "Title", @@ -148,6 +148,7 @@ export default defineI18nConfig(() => ({ backToList: "Go back to calendars", isLoading: "Calendar is loading…", hasXEvents: "{count} available events", + seeOptions: "Calendar options", date: { start: "Start date", end: "End date", @@ -242,26 +243,31 @@ export default defineI18nConfig(() => ({ }, millennia: { nameSingular: "Millennia", + displayMode: "Millennial", nextSingular: "Next millennia", prevSingular: "Last millennia", }, centuries: { nameSingular: "Century", + displayMode: "Centuries", nextSingular: "Next century", prevSingular: "Last century", }, decades: { nameSingular: "Decade", + displayMode: "Decadal", nextSingular: "Next decade", prevSingular: "Last decade", }, years: { nameSingular: "Year", + displayMode: "Yearly", nextSingular: "Next year", prevSingular: "Last year", }, months: { nameSingular: "Month", + displayMode: "Monthly", nextSingular: "Next month", prevSingular: "Last month", inputName: "Month's name", @@ -375,7 +381,7 @@ export default defineI18nConfig(() => ({ dark: "Sombre", light: "Clair", system: "Système", - displayMode: "Mode d'affichage", + displayMode: "Affichage", }, common: { title: "Titre", @@ -444,6 +450,7 @@ export default defineI18nConfig(() => ({ backToList: "Retourner aux calendriers", isLoading: "Chargement du calendrier…", hasXEvents: "{count} évènements disponibles", + seeOptions: "Options du calendrier", date: { start: "Date de début", end: "Date de fin", @@ -541,26 +548,31 @@ export default defineI18nConfig(() => ({ }, millennia: { nameSingular: "Millénaire", + displayMode: "Par millénaire", nextSingular: "Millénaire suivant", prevSingular: "Millénaire précédent", }, centuries: { nameSingular: "Siècle", + displayMode: "Par siècle", nextSingular: "Siècle suivant", prevSingular: "Siècle précédent", }, decades: { nameSingular: "Décennie", + displayMode: "Par décennie", nextSingular: "Décennie suivante", prevSingular: "Décennie précédente", }, years: { nameSingular: "Année", + displayMode: "Annuel", nextSingular: "Année suivante", prevSingular: "Année précédente", }, months: { nameSingular: "Mois", + displayMode: "Mensuel", nextSingular: "Mois suivant", prevSingular: "Mois précédent", inputName: "Nom du mois", diff --git a/stores/CalendarStore.ts b/stores/CalendarStore.ts index b678d44..1eab643 100644 --- a/stores/CalendarStore.ts +++ b/stores/CalendarStore.ts @@ -345,17 +345,17 @@ export const useCalendar = defineStore("calendar", () => { function getViewTypeTitle(viewType: CalendarViewType): string { switch (viewType) { case "year": - return t("entity.calendar.years.nameSingular") + return t("entity.calendar.years.displayMode") case "decade": - return "Décennie" + return t("entity.calendar.decades.displayMode") case "century": - return "Siècle" + return t("entity.calendar.centuries.displayMode") case "month": default: - return t("entity.calendar.months.nameSingular") + return t("entity.calendar.months.displayMode") } } From 2856185a3c5a4c7984e13ef8c6cef9b4d6fec4ce Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Fri, 28 Mar 2025 15:34:30 +0100 Subject: [PATCH 07/24] Display category menu cta only if not read only --- components/calendar/CalendarOptions.vue | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/components/calendar/CalendarOptions.vue b/components/calendar/CalendarOptions.vue index aba7ad3..8628365 100644 --- a/components/calendar/CalendarOptions.vue +++ b/components/calendar/CalendarOptions.vue @@ -4,13 +4,23 @@ import { useCalendar } from "@/stores/CalendarStore" import { PhCalendarBlank, PhCheckCircle, PhGear, PhTag } from "@phosphor-icons/vue" import { computed } from "vue" +const optionsOpened = ref(false) + +const user = useSupabaseUser() + +function closeMenu() { + optionsOpened.value = false +} +watch(user, closeMenu) + const { currentConfig, viewTypeOptions, getViewTypeTitle, setViewType } = useCalendar() +const { isReadOnly } = storeToRefs(useCalendar()) const viewTypeTitle = computed(() => getViewTypeTitle(currentConfig.viewType)) From 637a5cd7e3246e394cf7076b0469b5dc7046c7dc Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Fri, 28 Mar 2025 20:54:12 +0100 Subject: [PATCH 08/24] Added sample behaviour for category modal --- assets/main.css | 2 +- components/calendar/Calendar.vue | 1 + components/calendar/CalendarMenu.vue | 8 +- components/calendar/CategoriesCTA.vue | 23 ++ .../{CalendarOptions.vue => OptionsCTA.vue} | 27 +- components/calendar/dialog/Categories.vue | 36 +++ .../ui/alert-dialog/AlertDialogContent.vue | 2 +- components/ui/button/index.ts | 2 +- components/ui/dialog/DialogContent.vue | 2 +- components/ui/dialog/DialogScrollContent.vue | 2 +- .../ui/dropdown-menu/DropdownMenuArrow.vue | 13 + components/ui/dropdown-menu/index.ts | 1 + i18n.config.ts | 4 +- stores/CalendarStore.ts | 15 +- stores/EventStore.ts | 306 ------------------ 15 files changed, 104 insertions(+), 340 deletions(-) create mode 100644 components/calendar/CategoriesCTA.vue rename components/calendar/{CalendarOptions.vue => OptionsCTA.vue} (74%) create mode 100644 components/calendar/dialog/Categories.vue create mode 100644 components/ui/dropdown-menu/DropdownMenuArrow.vue delete mode 100644 stores/EventStore.ts diff --git a/assets/main.css b/assets/main.css index a480816..579d8b4 100644 --- a/assets/main.css +++ b/assets/main.css @@ -22,7 +22,7 @@ --primary: 245 58% 51%; --primary-foreground: 0 0% 100%; - --secondary: 210 40% 96.1%; + --secondary: 210 50% 95%; --secondary-foreground: 222.2 47.4% 11.2%; --accent: 210 40% 96.1%; diff --git a/components/calendar/Calendar.vue b/components/calendar/Calendar.vue index 07234d7..49c6411 100644 --- a/components/calendar/Calendar.vue +++ b/components/calendar/Calendar.vue @@ -52,6 +52,7 @@ onMounted(() => { + diff --git a/components/calendar/CalendarMenu.vue b/components/calendar/CalendarMenu.vue index 3c29a07..b8dce29 100644 --- a/components/calendar/CalendarMenu.vue +++ b/components/calendar/CalendarMenu.vue @@ -2,7 +2,6 @@ import { useCalendar } from "@/stores/CalendarStore" import { PhMagnifyingGlass } from "@phosphor-icons/vue" -import CalendarOptions from "./CalendarOptions.vue" const { revealAdvancedSearch } = useCalendar() const { isReadOnly } = storeToRefs(useCalendar()) @@ -13,7 +12,7 @@ const { isReadOnly } = storeToRefs(useCalendar())
  • - +
  • @@ -33,7 +32,10 @@ const { isReadOnly } = storeToRefs(useCalendar())
  • - + +
  • +
  • +
  • diff --git a/components/calendar/CategoriesCTA.vue b/components/calendar/CategoriesCTA.vue new file mode 100644 index 0000000..17f1066 --- /dev/null +++ b/components/calendar/CategoriesCTA.vue @@ -0,0 +1,23 @@ + + + diff --git a/components/calendar/CalendarOptions.vue b/components/calendar/OptionsCTA.vue similarity index 74% rename from components/calendar/CalendarOptions.vue rename to components/calendar/OptionsCTA.vue index 8628365..7a61982 100644 --- a/components/calendar/CalendarOptions.vue +++ b/components/calendar/OptionsCTA.vue @@ -1,32 +1,23 @@ diff --git a/components/calendar/dialog/Categories.vue b/components/calendar/dialog/Categories.vue new file mode 100644 index 0000000..d63b49e --- /dev/null +++ b/components/calendar/dialog/Categories.vue @@ -0,0 +1,36 @@ + + + diff --git a/components/ui/alert-dialog/AlertDialogContent.vue b/components/ui/alert-dialog/AlertDialogContent.vue index 776974c..ef4d8ec 100644 --- a/components/ui/alert-dialog/AlertDialogContent.vue +++ b/components/ui/alert-dialog/AlertDialogContent.vue @@ -25,7 +25,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)