Files
ERitors-Scribe-Desktop/lib/models/Character.ts
natreex 0fbd3743e7 Expand character model with additional attributes and advanced customization options
- Added fields such as `nickname`, `age`, `gender`, `species`, `nationality`, `status`, and others to enhance character customization.
- Modified localization files to include new field labels and placeholders.
- Updated `CharacterComponent` and `CharacterDetail` components with UI elements for the newly added attributes.
- Introduced "Advanced Mode" toggle to manage visibility of extended customization options.
- Refactored database models and repository methods (`addNewCharacter`, `updateCharacter`, and `fetchCharacters`) to handle the extended schema.
- Improved data encryption and decryption workflows for secure storage of added attributes.
- Enhanced user experience by reorganizing character customization layouts.
2026-01-23 20:49:57 -05:00

240 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: 'Sélectionner son rôle',
},
{
value: 'main',
label: 'Principal',
},
{
value: 'secondary',
label: 'Secondaire',
},
{
value: 'recurring',
label: 'Récurrent',
},
];
export const characterStatus: SelectBoxProps[] = [
{value: 'alive', label: 'Vivant'},
{value: 'dead', label: 'Décédé'},
{value: 'unknown', label: 'Inconnu'},
];
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: string;
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;
}
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,
];