From 5ac369a64362bc60aeaff43939e20c3d4096a9e0 Mon Sep 17 00:00:00 2001 From: Sirttas Date: Tue, 9 Jun 2026 21:56:12 +0200 Subject: [PATCH] fix --- src/pages/rules/ListCharacterRuleBooks.vue | 34 +++++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/pages/rules/ListCharacterRuleBooks.vue b/src/pages/rules/ListCharacterRuleBooks.vue index dc0ea26..2004e19 100644 --- a/src/pages/rules/ListCharacterRuleBooks.vue +++ b/src/pages/rules/ListCharacterRuleBooks.vue @@ -4,9 +4,12 @@ import {Character, CharacterLabel, useCharactersStore} from "@/characters"; import {PencilSquareIcon} from "@heroicons/vue/24/outline"; import {findCharacterRuleBookByCharacterId, useRuleBooksStore} from "@/rules"; import {computedAsync} from "@vueuse/core"; +import {routeNames} from "@/routes.ts"; +import {SortableHeader, useSort} from "@/components/table"; type CharacterRuleBookView = { character: Character; + characterName: string; characterId: number; ruleBookName: string; } @@ -14,26 +17,41 @@ type CharacterRuleBookView = { const {characters} = storeToRefs(useCharactersStore()); const {findById: findRuleBookById} = useRuleBooksStore(); -const list = computedAsync(async () => await Promise.all(characters.value.map(createCharacterRuleBookView)), []) -const createCharacterRuleBookView = async (character: Character): Promise => { +const { sortedArray, headerProps } = useSort(computedAsync(async () => await Promise.all(characters.value.map(async (character: Character): Promise => { const characterRuleBook = await findCharacterRuleBookByCharacterId(character.characterId); const ruleBook = findRuleBookById(characterRuleBook.ruleBookId); return { character, + characterName: character.name, characterId: character.characterId, ruleBookName: ruleBook?.name ?? '' } -} +})), [])) \ No newline at end of file