+import type { Category } from "~/models/Category";
+
+defineProps<{
+ categories: Category[]
+}>()
+
+
+
+
+
diff --git a/components/calendar/category/ListItem.vue b/components/calendar/category/ListItem.vue
new file mode 100644
index 0000000..83efb48
--- /dev/null
+++ b/components/calendar/category/ListItem.vue
@@ -0,0 +1,15 @@
+
+
+
+
+
+ {{ category.name }}
+
+
+
diff --git a/components/calendar/category/Table.vue b/components/calendar/category/Table.vue
new file mode 100644
index 0000000..c77ecd1
--- /dev/null
+++ b/components/calendar/category/Table.vue
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('entity.category.deleteDialog.title') }}
+
+
+ {{ $t('entity.category.deleteDialog.subtitle') }}
+
+
+
+
+
+
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 @@
+
+
+
+
+
+
+ Nom
+
+
+ Couleur
+
+
+
+
+
diff --git a/components/calendar/category/TableRow.vue b/components/calendar/category/TableRow.vue
new file mode 100644
index 0000000..7d6f3ad
--- /dev/null
+++ b/components/calendar/category/TableRow.vue
@@ -0,0 +1,187 @@
+
+
+
+
+
+
+
+
diff --git a/components/calendar/dialog/Categories.vue b/components/calendar/dialog/Categories.vue
new file mode 100644
index 0000000..e001d48
--- /dev/null
+++ b/components/calendar/dialog/Categories.vue
@@ -0,0 +1,41 @@
+
+
+
+
+ e.preventDefault()"
+ >
+
+
+
+ {{ $t('entity.category.manageDialog.title') }}
+
+
+
+
+ {{ $t('entity.category.manageDialog.subtitle') }}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/calendar/dialog/CreateEvent.vue b/components/calendar/dialog/CreateEvent.vue
index b28d68a..866ce99 100644
--- a/components/calendar/dialog/CreateEvent.vue
+++ b/components/calendar/dialog/CreateEvent.vue
@@ -35,8 +35,7 @@ function openEventCreatePopover() {
*
* @param e The closing event (can be keydown or click)
*/
-function handleClosing(e: Event) {
- e.preventDefault()
+function handleClosing() {
popoverOpen.value = false
resetSkeleton()
}
@@ -54,8 +53,8 @@ function handleClosing(e: Event) {
:disable-outside-pointer-events="true"
:trap-focus="true"
class="pl-3 w-[30rem] max-w-full border-indigo-200 dark:bg-slate-950 dark:border-indigo-950"
- @escape-key-down="handleClosing"
- @pointer-down-outside="handleClosing"
+ @escape-key-down.prevent="handleClosing"
+ @pointer-down-outside.prevent="handleClosing"
>
diff --git a/components/calendar/dialog/QuickCreateEvent.vue b/components/calendar/dialog/QuickCreateEvent.vue
index 53f0446..41a9218 100644
--- a/components/calendar/dialog/QuickCreateEvent.vue
+++ b/components/calendar/dialog/QuickCreateEvent.vue
@@ -11,11 +11,8 @@ function toggleDialog() {
/**
* Prevents the modal from closing if's still loading
- *
- * @param e The closing event (can be keydown or click)
*/
-function handleClosing(e: Event) {
- e.preventDefault()
+function handleClosing() {
setTimeout(() => resetSkeleton(), 100)
}
@@ -32,8 +29,8 @@ function handleClosing(e: Event) {
{{ $t("entity.calendar.event.addSingle") }}
diff --git a/components/calendar/CalendarEventDetails.vue b/components/calendar/event/Details.vue
similarity index 100%
rename from components/calendar/CalendarEventDetails.vue
rename to components/calendar/event/Details.vue
diff --git a/components/calendar/CalendarEvent.vue b/components/calendar/event/Event.vue
similarity index 100%
rename from components/calendar/CalendarEvent.vue
rename to components/calendar/event/Event.vue
diff --git a/components/calendar/form/DeleteCategory.vue b/components/calendar/form/DeleteCategory.vue
new file mode 100644
index 0000000..096f49e
--- /dev/null
+++ b/components/calendar/form/DeleteCategory.vue
@@ -0,0 +1,85 @@
+
+
+
+
+
diff --git a/components/calendar/CalendarMenu.vue b/components/calendar/menu/Menu.vue
similarity index 69%
rename from components/calendar/CalendarMenu.vue
rename to components/calendar/menu/Menu.vue
index f37698f..b8dce29 100644
--- a/components/calendar/CalendarMenu.vue
+++ b/components/calendar/menu/Menu.vue
@@ -8,18 +8,15 @@ const { isReadOnly } = storeToRefs(useCalendar())
-
-
+
+
diff --git a/components/calendar/menu/MenuSubnav.vue b/components/calendar/menu/MenuSubnav.vue
new file mode 100644
index 0000000..e55163a
--- /dev/null
+++ b/components/calendar/menu/MenuSubnav.vue
@@ -0,0 +1,230 @@
+
+
+
+
+
+
+ {{ currentDate.currentDateTitle }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ activeDirectionLabels.pastFar }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ activeDirectionLabels.pastNear }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ activeDirectionLabels.futureNear }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ activeDirectionLabels.futureFar }}
+
+
+
+
+
+
diff --git a/components/calendar/CalendarMenuToday.vue b/components/calendar/menu/MenuToday.vue
similarity index 100%
rename from components/calendar/CalendarMenuToday.vue
rename to components/calendar/menu/MenuToday.vue
diff --git a/components/calendar/search/CalendarSearch.vue b/components/calendar/search/CalendarSearch.vue
index 92e4b80..531413b 100644
--- a/components/calendar/search/CalendarSearch.vue
+++ b/components/calendar/search/CalendarSearch.vue
@@ -26,7 +26,7 @@ import {
import SearchList from "./lists/SearchList.vue"
import type { Category } from "~/models/Category"
-const { isAdvancedSearchOpen, allEvents } = storeToRefs(useCalendar())
+const { isAdvancedSearchOpen, allEvents, categories } = storeToRefs(useCalendar())
const { characters } = storeToRefs(useCharacters())
const searchInput = shallowRef()
@@ -207,8 +207,7 @@ watch([currentPage, selectedEntity], () => {
})
// Compute categories based on current selectedEntity
-const { data: resCategories } = await useFetch("/api/calendars/categories/query")
-const currentCategories = ref(resCategories.value?.data as Category[])
+const currentCategories = computed(() => categories.value)
const selectedCategories = ref<(Category)[]>([])
const categoryFilterOpened = ref(false)
diff --git a/components/calendar/state/monthly/DayTile.vue b/components/calendar/state/monthly/DayTile.vue
index 7d8f32a..4d596be 100644
--- a/components/calendar/state/monthly/DayTile.vue
+++ b/components/calendar/state/monthly/DayTile.vue
@@ -5,7 +5,7 @@ import { useElementBounding } from "@vueuse/core"
import { storeToRefs } from "pinia"
import { computed, ref, type ComputedRef } from "vue"
-import CalendarEventButton from "../../CalendarEvent.vue"
+import CalendarEventButton from "../../event/Event.vue"
const props = defineProps<{
date: RPGDate
diff --git a/components/global/input/Color.vue b/components/global/input/Color.vue
index 871b22c..529feb0 100644
--- a/components/global/input/Color.vue
+++ b/components/global/input/Color.vue
@@ -2,8 +2,10 @@
import { cn } from "@/lib/utils";
import { type RPGColor, rpgColors } from "~/models/Color";
-defineProps<{
+const { id, theme = "normal", position = "popper" } = defineProps<{
id: string
+ theme?: "normal" | "subtle"
+ position?: "item-aligned" | "popper" | undefined
}>();
const model = defineModel({ default: "white" });
@@ -11,27 +13,23 @@ const model = defineModel({ default: "white" });
-
+
-
+
@@ -41,76 +39,3 @@ const model = defineModel({ default: "white" });
-
-
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)
(), {
v-if="props.searchSlash"
class="h-4 p-1 ml-1 grid place-items-center text-[0.7em] leading-none font-semibold text-slate-500 bg-slate-100 border-slate-300 border-[1px] rounded-[3px] shadow-sm group-hover:text-slate-600 group-hover:bg-slate-200 group-hover:border-slate-400 transition-colors"
>
- CTRL + :
+ CTRL + :
diff --git a/components/ui/button/index.ts b/components/ui/button/index.ts
index e92f470..88cb71f 100644
--- a/components/ui/button/index.ts
+++ b/components/ui/button/index.ts
@@ -10,7 +10,7 @@ export const buttonVariants = cva(
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline: "border border-input hover:bg-accent hover:text-accent-foreground",
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
+ secondary: "bg-secondary text-secondary-foreground hover:bg-primary/20",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline"
},
diff --git a/components/ui/dialog/DialogContent.vue b/components/ui/dialog/DialogContent.vue
index 1501281..73f797c 100644
--- a/components/ui/dialog/DialogContent.vue
+++ b/components/ui/dialog/DialogContent.vue
@@ -27,7 +27,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
+import { DropdownMenuArrow, type DropdownMenuArrowProps, useForwardProps } from "radix-vue"
+
+const props = defineProps()
+
+const forwardedProps = useForwardProps(props)
+
+
+
+
+
+
+
diff --git a/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue b/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue
index 12cd05b..2c3ac29 100644
--- a/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue
+++ b/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue
@@ -5,10 +5,10 @@ import {
type DropdownMenuSubTriggerProps,
useForwardProps
} from "radix-vue"
-import { ChevronRight } from "lucide-vue-next"
import { cn } from "@/lib/utils"
+import { PhCaretLeft, PhCaretRight } from "@phosphor-icons/vue";
-const props = defineProps()
+const props = defineProps()
const delegatedProps = computed(() => {
const { class: _, ...delegated } = props
@@ -29,7 +29,17 @@ const forwardedProps = useForwardProps(delegatedProps)
)
"
>
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/ui/dropdown-menu/index.ts b/components/ui/dropdown-menu/index.ts
index 7e62fd1..b56627d 100644
--- a/components/ui/dropdown-menu/index.ts
+++ b/components/ui/dropdown-menu/index.ts
@@ -1,6 +1,7 @@
export { DropdownMenuPortal } from "radix-vue"
export { default as DropdownMenu } from "./DropdownMenu.vue"
+export { default as DropdownMenuArrow } from "./DropdownMenuArrow.vue"
export { default as DropdownMenuTrigger } from "./DropdownMenuTrigger.vue"
export { default as DropdownMenuContent } from "./DropdownMenuContent.vue"
export { default as DropdownMenuGroup } from "./DropdownMenuGroup.vue"
diff --git a/components/ui/select/SelectTrigger.vue b/components/ui/select/SelectTrigger.vue
index 3bd70da..cd9940d 100644
--- a/components/ui/select/SelectTrigger.vue
+++ b/components/ui/select/SelectTrigger.vue
@@ -20,7 +20,7 @@ const forwardedProps = useForwardProps(delegatedProps)
v-bind="forwardedProps"
:class="
cn(
- 'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background dark:bg-slate-950 contrast-more:dark:bg-slate-900 px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
+ 'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background dark:bg-slate-950 contrast-more:dark:bg-slate-900 px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
props.class
)
"
diff --git a/components/ui/table/Table.vue b/components/ui/table/Table.vue
new file mode 100644
index 0000000..26c7c45
--- /dev/null
+++ b/components/ui/table/Table.vue
@@ -0,0 +1,16 @@
+
+
+
+
+
diff --git a/components/ui/table/TableBody.vue b/components/ui/table/TableBody.vue
new file mode 100644
index 0000000..fadb9a7
--- /dev/null
+++ b/components/ui/table/TableBody.vue
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/components/ui/table/TableCaption.vue b/components/ui/table/TableCaption.vue
new file mode 100644
index 0000000..a2bf57f
--- /dev/null
+++ b/components/ui/table/TableCaption.vue
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/components/ui/table/TableCell.vue b/components/ui/table/TableCell.vue
new file mode 100644
index 0000000..4a86e3a
--- /dev/null
+++ b/components/ui/table/TableCell.vue
@@ -0,0 +1,21 @@
+
+
+
+
+
+ |
+
diff --git a/components/ui/table/TableEmpty.vue b/components/ui/table/TableEmpty.vue
new file mode 100644
index 0000000..a9d62c9
--- /dev/null
+++ b/components/ui/table/TableEmpty.vue
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/ui/table/TableFooter.vue b/components/ui/table/TableFooter.vue
new file mode 100644
index 0000000..7f3bf64
--- /dev/null
+++ b/components/ui/table/TableFooter.vue
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/components/ui/table/TableHead.vue b/components/ui/table/TableHead.vue
new file mode 100644
index 0000000..ddf635c
--- /dev/null
+++ b/components/ui/table/TableHead.vue
@@ -0,0 +1,14 @@
+
+
+
+
+
+ |
+
diff --git a/components/ui/table/TableHeader.vue b/components/ui/table/TableHeader.vue
new file mode 100644
index 0000000..66e1e60
--- /dev/null
+++ b/components/ui/table/TableHeader.vue
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/components/ui/table/TableRow.vue b/components/ui/table/TableRow.vue
new file mode 100644
index 0000000..036db30
--- /dev/null
+++ b/components/ui/table/TableRow.vue
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/components/ui/table/index.ts b/components/ui/table/index.ts
new file mode 100644
index 0000000..2b4ce39
--- /dev/null
+++ b/components/ui/table/index.ts
@@ -0,0 +1,9 @@
+export { default as Table } from './Table.vue'
+export { default as TableBody } from './TableBody.vue'
+export { default as TableCaption } from './TableCaption.vue'
+export { default as TableCell } from './TableCell.vue'
+export { default as TableEmpty } from './TableEmpty.vue'
+export { default as TableFooter } from './TableFooter.vue'
+export { default as TableHead } from './TableHead.vue'
+export { default as TableHeader } from './TableHeader.vue'
+export { default as TableRow } from './TableRow.vue'
diff --git a/i18n.config.ts b/i18n.config.ts
index 67fbf01..9d77160 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",
@@ -93,13 +93,32 @@ export default defineI18nConfig(() => ({
search: "Search categories",
notFoundAny: "No categories found.",
addPrimary: "Add a primary category",
- addSecondaries: "Add secondary categories"
+ addSecondaries: "Add secondary categories",
+ manageDialog: {
+ title: "Manage categories",
+ subtitle: "Add and change the categories of your calendar",
+ },
+ deleteDialog: {
+ title: "Delete this category ?",
+ subtitle: "The events attached to this category won't be deleted, but you'll lose the category for this calendar.",
+ },
+ addedToast: {
+ title: "The category \"{category}\" has been added to the calendar.",
+ titleError: "An error has occured and the category \"{category}\" wasn't added to the calendar.",
+ },
+ updatedToast: {
+ title: "The category \"{category}\" has been successfuly updated.",
+ titleError: "An error has occured and the category \"{category}\" wasn't updated.",
+ },
+ deletedToast: {
+ title: "The category \"{category}\" has been successfuly deleted.",
+ },
},
isLoading: "Loading in progress…",
addDescription: "Add a description",
deleteOne: "Delete \"{entity}\"",
advancedSearch: {
- title: "Advanced search",
+ title: "Search",
subtitle: "Search through calendar and world data",
older: "Older",
newer: "Newer",
@@ -147,7 +166,10 @@ export default defineI18nConfig(() => ({
notFoundForWorld: "No calendar for this world… yet !",
backToList: "Go back to calendars",
isLoading: "Calendar is loading…",
+ hasXEvent: "{count} available event",
hasXEvents: "{count} available events",
+ seeCategories: "Modify categories",
+ seeOptions: "Calendar options",
date: {
start: "Start date",
end: "End date",
@@ -183,8 +205,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",
@@ -242,26 +264,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 +402,7 @@ export default defineI18nConfig(() => ({
dark: "Sombre",
light: "Clair",
system: "Système",
- displayMode: "Mode d'affichage",
+ displayMode: "Affichage",
},
common: {
title: "Titre",
@@ -389,13 +416,32 @@ export default defineI18nConfig(() => ({
search: "Rechercher les catégories",
notFoundAny: "Aucune catégorie trouvée.",
addPrimary: "Ajouter une catégorie principale",
- addSecondaries: "Ajouter des catégories secondaires"
+ addSecondaries: "Ajouter des catégories secondaires",
+ manageDialog: {
+ title: "Gestion des catégories",
+ subtitle: "Créer et modifier les catégories de votre calendrier",
+ },
+ deleteDialog: {
+ title: "Supprimer cette catégorie ?",
+ subtitle: "Les évènements l'utilisant ne seront pas supprimés.",
+ },
+ addedToast: {
+ title: "La catégorie \"{category}\" a été ajoutée au calendrier.",
+ titleError: "Une erreur s'est produite et la catégorie \"{category}\" n'a pas pu être ajoutée.",
+ },
+ updatedToast: {
+ title: "La catégorie \"{category}\" a été modifiée avec succès.",
+ titleError: "Une erreur s'est produite et la catégorie \"{category}\" n'a pas pu être modifiée.",
+ },
+ deletedToast: {
+ title: "La catégorie \"{category}\" a été supprimée avec succès.",
+ },
},
isLoading: "Chargement en cours…",
addDescription: "Ajouter une description",
deleteOne: "Supprimer \"{entity}\"",
advancedSearch: {
- title: "Recherche avancée",
+ title: "Rechercher",
subtitle: "Rechercher les données disponibles sur le calendrier",
older: "Plus ancien",
newer: "Plus récent",
@@ -443,7 +489,10 @@ export default defineI18nConfig(() => ({
notFoundForWorld: "Aucun calendrier pour ce monde… pour l'instant !",
backToList: "Retourner aux calendriers",
isLoading: "Chargement du calendrier…",
+ hasXEvent: "{count} évènement disponible",
hasXEvents: "{count} évènements disponibles",
+ seeCategories: "Gestion des catégories",
+ seeOptions: "Options du calendrier",
date: {
start: "Date de début",
end: "Date de fin",
@@ -479,8 +528,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",
@@ -541,26 +590,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/models/CalendarConfig.ts b/models/CalendarConfig.ts
index 159a4f2..8c8d7e8 100644
--- a/models/CalendarConfig.ts
+++ b/models/CalendarConfig.ts
@@ -5,7 +5,7 @@ import { dateSchema, type RPGDate } from "./Date"
import type { World } from "./World"
import type { ContentState } from "./Entity"
import type { RPGColor } from "./Color"
-
+import type { Category } from "./Category"
export interface CalendarConfig {
months: CalendarMonth[]
@@ -16,7 +16,8 @@ export interface Calendar extends CalendarConfig {
id?: number
shortId?: string
name: string
- events: CalendarEvent[]
+ events: CalendarEvent[],
+ categories: Category[]
eventNb?: Array<{ count: number }>
state: ContentState
color?: RPGColor
diff --git a/models/CalendarEvent.ts b/models/CalendarEvent.ts
index 65562fa..3ac68b1 100644
--- a/models/CalendarEvent.ts
+++ b/models/CalendarEvent.ts
@@ -1,5 +1,5 @@
import { z } from "zod"
-import { categorySchema, type Category } from "./Category"
+import type { Category } from "./Category"
import { dateSchema, type RPGDate } from "./Date"
export interface CalendarEvent {
@@ -26,7 +26,11 @@ export const postEventBodySchema = z.object({
startDate: dateSchema.required(),
endDate: dateSchema.optional().nullable(),
hidden: z.boolean().optional().nullable(),
- category: categorySchema.optional().nullable(),
+ category: z.object({
+ id: z.number().int(),
+ name: z.string(),
+ color: z.string().default("black")
+ }).optional().nullable(),
}),
calendarId: z.number({ coerce: true }).int().positive()
})
diff --git a/models/Category.ts b/models/Category.ts
index af2849a..7ee0024 100644
--- a/models/Category.ts
+++ b/models/Category.ts
@@ -2,13 +2,15 @@ import { z } from "zod"
import type { RPGColor } from "./Color"
export interface Category {
- id: number
+ id?: number
name: string
color?: RPGColor
}
export const categorySchema = z.object({
- id: z.number().int(),
- name: z.string(),
- color: z.string().default("black")
+ category: z.object({
+ name: z.string(),
+ color: z.string().default("black"),
+ }),
+ calendarId: z.number({ coerce: true }).int().positive()
})
diff --git a/pages/calendars/[id].vue b/pages/calendars/[id].vue
index 2b523f4..f459de0 100644
--- a/pages/calendars/[id].vue
+++ b/pages/calendars/[id].vue
@@ -1,7 +1,6 @@
@@ -52,12 +48,12 @@ watch(user, () => {
-
+
{{ calendar.data.name }}
-
+
diff --git a/pages/my/calendars/[id].vue b/pages/my/calendars/[id].vue
index 219053f..7d1ba95 100644
--- a/pages/my/calendars/[id].vue
+++ b/pages/my/calendars/[id].vue
@@ -1,7 +1,6 @@
@@ -81,7 +55,7 @@ const isLoading = computed(() => calendarStatus.value === "pending" || categorie
-