diff --git a/app.vue b/app.vue index 210c286..d386b6b 100644 --- a/app.vue +++ b/app.vue @@ -1,13 +1,11 @@ diff --git a/db.sqlite b/db.sqlite index 7c42625..76c388d 100644 Binary files a/db.sqlite and b/db.sqlite differ diff --git a/db.sqlite-shm b/db.sqlite-shm index fe9ac28..74c3d56 100644 Binary files a/db.sqlite-shm and b/db.sqlite-shm differ diff --git a/db.sqlite-wal b/db.sqlite-wal index e69de29..268e880 100644 Binary files a/db.sqlite-wal and b/db.sqlite-wal differ diff --git a/layouts/default.vue b/layouts/default.vue index bf79388..35e5662 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -1,87 +1,20 @@ \ No newline at end of file diff --git a/pages/character/[id]/index.client.vue b/pages/character/[id]/index.client.vue index be35e0c..592068e 100644 --- a/pages/character/[id]/index.client.vue +++ b/pages/character/[id]/index.client.vue @@ -26,12 +26,12 @@ onMounted(() => { if(container.value && id) { const character = new CharacterSheet(id, user); - container.value.appendChild(character.container); + container.value.replaceWith(character.container); } }); }); \ No newline at end of file diff --git a/shared/character.util.ts b/shared/character.util.ts index 1763587..3d8cbf4 100644 --- a/shared/character.util.ts +++ b/shared/character.util.ts @@ -374,7 +374,7 @@ export class CharacterCompiler } saveNotes() { - useRequestFetch()(`/api/character/${this.character.id}/notes`, { + return useRequestFetch()(`/api/character/${this.character.id}/notes`, { method: 'POST', body: this._character.notes, }).then(() => {}).catch(() => { @@ -1233,7 +1233,7 @@ export class CharacterSheet { user: ComputedRef; character?: CharacterCompiler; - container: HTMLElement = div(); + container: HTMLElement = div('flex h-full'); tabs?: HTMLDivElement & { refresh: () => void }; constructor(id: string, user: ComputedRef) { @@ -1274,6 +1274,10 @@ export class CharacterSheet const publicNotes = new MarkdownEditor(); const privateNotes = new MarkdownEditor(); + const loadableIcon = icon('radix-icons:paper-plane', { width: 16, height: 16 }); + const saveLoading = loading('small'); + const saveNotes = () => { loadableIcon.replaceWith(saveLoading); this.character?.saveNotes().finally(() => { saveLoading.replaceWith(loadableIcon) }); } + publicNotes.onChange = (v) => this.character!.character.notes!.public = v; privateNotes.onChange = (v) => this.character!.character.notes!.private = v; publicNotes.content = this.character!.character.notes!.public!; @@ -1292,8 +1296,8 @@ export class CharacterSheet { id: 'notes', title: [ text('Notes') ], content: () => [ div('flex flex-col gap-2', [ - div('flex flex-col gap-2 border-b border-light-35 dark:border-dark-35 pb-4', [ div('flex flex-row w-full items-center justify-between', [ span('text-lg font-bold', 'Notes publics'), tooltip(button(icon('radix-icons:paper-plane', { width: 16, height: 16 }), () => this.character!.saveNotes(), 'p-1'), 'Enregistrer', 'right') ]), div('border border-light-35 dark:border-dark-35 p-1', [ publicNotes.dom ]) ]), - div('flex flex-col gap-2', [ span('text-lg font-bold', 'Notes privés'), div('border border-light-35 dark:border-dark-35 p-1', [ privateNotes.dom ]) ]), + div('flex flex-col gap-2 border-b border-light-35 dark:border-dark-35 pb-4', [ div('flex flex-row w-full items-center justify-between', [ span('text-lg font-bold', 'Notes publics'), tooltip(button(loadableIcon, saveNotes, 'p-1 items-center justify-center'), 'Enregistrer', 'right') ]), div('border border-light-35 dark:border-dark-35 bg-light20 dark:bg-dark-20 p-1 h-64', [ publicNotes.dom ]) ]), + div('flex flex-col gap-2', [ span('text-lg font-bold', 'Notes privés'), div('border border-light-35 dark:border-dark-35 bg-light20 dark:bg-dark-20 p-1 h-64', [ privateNotes.dom ]) ]), ]) ] }, ], { focused: 'abilities', class: { container: 'flex-1 gap-4 px-4 w-[960px]' } }); diff --git a/shared/components.util.ts b/shared/components.util.ts index d7d6965..00e12b3 100644 --- a/shared/components.util.ts +++ b/shared/components.util.ts @@ -5,7 +5,7 @@ import { clamp } from "./general.util"; import { Tree } from "./tree"; import type { Placement } from "@floating-ui/dom"; -export function link(properties?: NodeProperties & { active?: Class }, link?: RouteLocationAsRelativeTyped, children?: NodeChildren) +export function link(children: NodeChildren, properties?: NodeProperties & { active?: Class }, link?: RouteLocationAsRelativeTyped) { const router = useRouter(); const nav = link ? router.resolve(link) : undefined;