Files
ERitors-Scribe-Desktop/components/book/settings/BookSettingSidebar.tsx
natreex 9461eb6120 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.
2026-01-19 23:00:33 -05:00

111 lines
3.4 KiB
TypeScript

'use client'
// Removed Next.js Link import for Electron
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
import {
faBook,
faGlobe,
faHatWizard,
faListAlt,
faMapMarkedAlt,
faPencilAlt,
faUser,
faWandMagicSparkles
} from "@fortawesome/free-solid-svg-icons";
import {Dispatch, SetStateAction} from "react";
import {IconDefinition} from "@fortawesome/fontawesome-svg-core";
import {useTranslations} from "next-intl";
interface BookSettingOption {
id: string;
name: string;
icon: IconDefinition;
}
export default function BookSettingSidebar(
{
selectedSetting,
setSelectedSetting
}: {
selectedSetting: string,
setSelectedSetting: Dispatch<SetStateAction<string>>
}) {
const t = useTranslations();
const settings: BookSettingOption[] = [
{
id: 'basic-information',
name: 'bookSetting.basicInformation',
icon: faPencilAlt
},
{
id: 'guide-line',
name: 'bookSetting.guideLine',
icon: faListAlt
},
{
id: 'story',
name: 'bookSetting.story',
icon: faBook
},
{
id: 'world',
name: 'bookSetting.world',
icon: faGlobe
},
{
id: 'locations',
name: 'bookSetting.locations',
icon: faMapMarkedAlt
},
{
id: 'characters',
name: 'bookSetting.characters',
icon: faUser
},
{
id: 'spells',
name: 'bookSetting.spells',
icon: faHatWizard
},
{
id: 'quillsense',
name: 'bookSetting.quillsense',
icon: faWandMagicSparkles
},
// {
// id: 'objects',
// name: t('bookSetting.objects'),
// icon: faLocationArrow
// },
// {
// id: 'goals',
// name: t('bookSetting.goals'),
// icon: faCogs
// },
]
return (
<div className="py-6 px-3">
<nav className="space-y-1">
{
settings.map((setting: BookSettingOption) => (
<button
key={setting.id}
onClick={(): void => setSelectedSetting(setting.id)}
type="button"
className={`flex items-center text-base rounded-xl transition-all duration-200 w-full ${
selectedSetting === setting.id
? 'bg-primary/20 text-text-primary border-l-4 border-primary font-semibold shadow-md scale-105'
: 'text-text-secondary hover:bg-secondary/50 hover:text-text-primary hover:scale-102'
} p-3 mb-1`}>
<FontAwesomeIcon icon={setting.icon}
className={`mr-3 ${selectedSetting === setting.id ? 'text-primary w-5 h-5' : 'text-text-secondary w-5 h-5'}`}/>
{t(setting.name)}
</button>
))
}
</nav>
</div>
)
}