Add spell management to book settings

- Moved spell-related components to the `book/settings/spells` directory for better organization.
- Added "Spells" as a new tool in book settings and composer sidebar with localization support.
- Integrated spell-related UI elements (`SpellComponent`, `SpellList`, `SpellTagManager`) into settings and sidebars.
- Updated logic to handle enabling/disabling of the spells tool per book.
This commit is contained in:
natreex
2026-01-19 23:00:33 -05:00
parent e7d35c0f0b
commit 9461eb6120
10 changed files with 64 additions and 6 deletions

View File

@@ -7,6 +7,7 @@ import {RefObject, useRef} from "react";
import PanelHeader from "@/components/PanelHeader";
import LocationComponent from "@/components/book/settings/locations/LocationComponent";
import CharacterComponent from "@/components/book/settings/characters/CharacterComponent";
import SpellComponent from "@/components/book/settings/spells/SpellComponent";
import QuillSenseSetting from "@/components/book/settings/quillsense/QuillSenseSetting";
import {useTranslations} from "next-intl"; // Ajouté pour la traduction
@@ -36,6 +37,9 @@ export default function BookSettingOption(
const characterRef: RefObject<{ handleSave: () => Promise<void> } | null> = useRef<{
handleSave: () => Promise<void>
}>(null);
const spellRef: RefObject<{ handleSave: () => Promise<void> } | null> = useRef<{
handleSave: () => Promise<void>
}>(null);
const quillSenseRef: RefObject<{ handleSave: () => Promise<void> } | null> = useRef<{
handleSave: () => Promise<void>
}>(null);
@@ -54,6 +58,8 @@ export default function BookSettingOption(
return t("bookSettingOption.yourLocations");
case 'characters':
return t("bookSettingOption.characters");
case 'spells':
return t("bookSettingOption.spells");
case 'objects':
return t("bookSettingOption.objectsList");
case 'goals':
@@ -85,6 +91,9 @@ export default function BookSettingOption(
case 'characters':
characterRef.current?.handleSave();
break;
case 'spells':
spellRef.current?.handleSave();
break;
case 'quillsense':
quillSenseRef.current?.handleSave();
break;
@@ -118,6 +127,8 @@ export default function BookSettingOption(
<LocationComponent ref={locationRef}/>
) : setting === 'characters' ? (
<CharacterComponent ref={characterRef}/>
) : setting === 'spells' ? (
<SpellComponent ref={spellRef}/>
) : setting === 'quillsense' ? (
<QuillSenseSetting ref={quillSenseRef}/>
) : <div