Files
ERitors-Scribe-Desktop/lib/models/Character.ts
natreex 209dc6f85a Remove CharacterComponent and CharacterDetail components
- Deleted `CharacterComponent` and `CharacterDetail` files from the project.
- Refactored related logic to improve code maintainability and reduce redundancy.
2026-02-05 14:12:08 -05:00

229 lines
5.7 KiB
TypeScript
Executable File

import {
faBrain,
faBullseye,
faExclamationTriangle,
faFire,
faRuler,
faShieldAlt,
faUsers,
faWrench,
faRoute,
faUserSecret,
faGhost,
faHeartBroken,
faHandHoldingHeart,
faBolt,
faQuoteLeft,
faFingerprint,
faBox,
faPeopleGroup,
} from '@fortawesome/free-solid-svg-icons';
import {SelectBoxProps} from "@/shared/interface";
type CharacterCategory = 'main' | 'secondary' | 'recurring' | 'none';
export const characterCategories: SelectBoxProps[] = [
{value: 'none', label: 'characterCategories.none'},
{value: 'main', label: 'characterCategories.main'},
{value: 'secondary', label: 'characterCategories.secondary'},
{value: 'recurring', label: 'characterCategories.recurring'},
];
export const characterStatus: SelectBoxProps[] = [
{value: 'alive', label: 'characterStatus.alive'},
{value: 'dead', label: 'characterStatus.dead'},
{value: 'unknown', label: 'characterStatus.unknown'},
];
export interface Relation {
name: string;
type: string;
description: string;
history: string;
}
export interface Attribute {
id: string;
name: string;
}
export interface CharacterAttribute {
[key: string]: Array<Attribute>;
}
export interface CharacterProps {
id: string | null;
name: string;
lastName: string;
nickname: string;
age: number | null;
gender: string;
species: string;
nationality: string;
status: 'alive' | 'dead' | 'unknown';
category: CharacterCategory;
title: string;
image: string;
physical: Attribute[];
psychological: Attribute[];
relations: Attribute[];
skills: Attribute[];
weaknesses: Attribute[];
strengths: Attribute[];
goals: Attribute[];
motivations: Attribute[];
arc: Attribute[];
secrets: Attribute[];
fears: Attribute[];
flaws: Attribute[];
beliefs: Attribute[];
conflicts: Attribute[];
quotes: Attribute[];
distinguishingMarks: Attribute[];
items: Attribute[];
affiliations: Attribute[];
role: string;
biography?: string;
history?: string;
speechPattern?: string;
catchphrase?: string;
residence?: string;
notes?: string;
color?: string;
seriesCharacterId?: string | null;
}
export interface CharacterListResponse {
characters: CharacterProps[];
enabled: boolean;
}
export interface CharacterElement {
title: string;
section: keyof CharacterProps;
placeholder: string;
icon: any; // Replace `any` with an appropriate type if you have a specific icon type.
}
// Attributs de base (toujours visibles)
export const basicCharacterElements: CharacterElement[] = [
{
title: 'Descriptions physiques',
section: 'physical',
placeholder: 'Nouvelle Description Physique',
icon: faRuler,
},
{
title: 'Descriptions psychologiques',
section: 'psychological',
placeholder: 'Nouvelle Description Psychologique',
icon: faBrain,
},
];
// Attributs avancés (visibles en mode avancé)
export const advancedCharacterElements: CharacterElement[] = [
{
title: 'Signes distinctifs',
section: 'distinguishingMarks',
placeholder: 'Nouveau signe distinctif',
icon: faFingerprint,
},
{
title: 'Arc du personnage',
section: 'arc',
placeholder: 'Nouvelle étape de l\'arc',
icon: faRoute,
},
{
title: 'Secrets',
section: 'secrets',
placeholder: 'Nouveau secret',
icon: faUserSecret,
},
{
title: 'Peurs',
section: 'fears',
placeholder: 'Nouvelle peur',
icon: faGhost,
},
{
title: 'Défauts',
section: 'flaws',
placeholder: 'Nouveau défaut',
icon: faHeartBroken,
},
{
title: 'Croyances',
section: 'beliefs',
placeholder: 'Nouvelle croyance',
icon: faHandHoldingHeart,
},
{
title: 'Conflits internes',
section: 'conflicts',
placeholder: 'Nouveau conflit',
icon: faBolt,
},
{
title: 'Citations',
section: 'quotes',
placeholder: 'Nouvelle citation',
icon: faQuoteLeft,
},
{
title: 'Relations',
section: 'relations',
placeholder: 'Nouveau Nom de Relation',
icon: faUsers,
},
{
title: 'Compétences',
section: 'skills',
placeholder: 'Nouvelle Compétence',
icon: faWrench,
},
{
title: 'Faiblesses',
section: 'weaknesses',
placeholder: 'Nouvelle Faiblesse',
icon: faExclamationTriangle,
},
{
title: 'Forces',
section: 'strengths',
placeholder: 'Nouvelle Force',
icon: faShieldAlt,
},
{
title: 'Objectifs',
section: 'goals',
placeholder: 'Nouvel Objectif',
icon: faBullseye,
},
{
title: 'Motivations',
section: 'motivations',
placeholder: 'Nouvelle Motivation',
icon: faFire,
},
{
title: 'Objets importants',
section: 'items',
placeholder: 'Nouvel objet',
icon: faBox,
},
{
title: 'Affiliations',
section: 'affiliations',
placeholder: 'Nouvelle affiliation',
icon: faPeopleGroup,
},
];
// Pour rétro-compatibilité, on garde characterElementCategory qui combine les deux
export const characterElementCategory: CharacterElement[] = [
...basicCharacterElements,
...advancedCharacterElements,
];