Remove unused components and models for improved maintainability

- Deleted redundant components (`AddActionButton`, `AlertBox`, `AlertStack`, `BackButton`, `CancelButton`, and `CollapsableArea`) and related files.
- Removed unused models (`Book`, `BookSerie`, `BookTables`, `Character`, and `Chapter`) to reduce codebase clutter.
- Updated project structure and references to reflect these removals.
This commit is contained in:
natreex
2026-03-22 22:37:31 -04:00
parent e8aaef108b
commit 64ed90d993
229 changed files with 15091 additions and 21289 deletions

View File

@@ -1,26 +1,12 @@
'use client'
// Removed Next.js Link import for Electron
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
import {
faBook,
faDownload,
faGlobe,
faHatWizard,
faListAlt,
faMapMarkedAlt,
faPencilAlt,
faUser,
faWandMagicSparkles
} from "@fortawesome/free-solid-svg-icons";
import {Dispatch, SetStateAction, useContext} from "react";
import {IconDefinition} from "@fortawesome/fontawesome-svg-core";
import {useTranslations} from "next-intl";
import OfflineContext, {OfflineContextType} from "@/context/OfflineContext";
import React, {Dispatch, SetStateAction} from "react";
import {Book, Download, Globe, List, LucideIcon, Map, Pencil, User, Wand2} from 'lucide-react';
import {useTranslations} from '@/lib/i18n';
interface BookSettingOption {
id: string;
name: string;
icon: IconDefinition;
icon: LucideIcon;
}
export default function BookSettingSidebar(
@@ -32,92 +18,44 @@ export default function BookSettingSidebar(
setSelectedSetting: Dispatch<SetStateAction<string>>
}) {
const t = useTranslations();
const {isCurrentlyOffline} = useContext<OfflineContextType>(OfflineContext);
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: 'export',
name: 'bookSetting.export',
icon: faDownload
},
// {
// id: 'objects',
// name: t('bookSetting.objects'),
// icon: faLocationArrow
// },
// {
// id: 'goals',
// name: t('bookSetting.goals'),
// icon: faCogs
// },
]
// Filter out QuillSense when offline (requires server connection)
const availableSettings: BookSettingOption[] = isCurrentlyOffline()
? settings.filter((s: BookSettingOption) => s.id !== 'quillsense')
: settings;
{id: 'basic-information', name: 'bookSetting.basicInformation', icon: Pencil},
{id: 'guide-line', name: 'bookSetting.guideLine', icon: List},
{id: 'story', name: 'bookSetting.story', icon: Book},
{id: 'world', name: 'bookSetting.world', icon: Globe},
{id: 'locations', name: 'bookSetting.locations', icon: Map},
{id: 'characters', name: 'bookSetting.characters', icon: User},
{id: 'spells', name: 'bookSetting.spells', icon: Wand2},
{id: 'quillsense', name: 'bookSetting.quillsense', icon: Wand2},
{id: 'export', name: 'bookSetting.export', icon: Download},
];
return (
<div className="py-6 px-3">
<nav className="space-y-1">
{
availableSettings.map((setting: BookSettingOption) => (
<div className="py-4 px-2">
<nav className="space-y-0.5">
{settings.map((setting: BookSettingOption) => {
const Icon: LucideIcon = setting.icon;
const isActive: boolean = selectedSetting === setting.id;
return (
<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'}`}/>
className={`flex items-center w-full text-sm rounded-lg transition-colors duration-150 px-3 py-2 ${
isActive
? 'bg-secondary text-text-primary font-medium'
: 'text-text-secondary hover:bg-secondary/50 hover:text-text-primary'
}`}
>
<Icon
className={`mr-2.5 w-4 h-4 flex-shrink-0 ${isActive ? 'text-primary' : 'text-muted'}`}
strokeWidth={1.75}
/>
{t(setting.name)}
</button>
))
}
);
})}
</nav>
</div>
)
);
}