Files
ERitors-Scribe-Desktop/lib/models/Spell.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

115 lines
3.0 KiB
TypeScript

import {SelectBoxProps} from "@/shared/interface";
// ==================== SPELL TAG INTERFACES ====================
export interface SpellTagProps {
id: string;
name: string;
color: string | null;
}
// ==================== SPELL INTERFACES ====================
// Réponse de GET /spell/detail et POST /spell/add
export interface SpellProps {
id: string;
name: string;
description: string;
appearance: string;
tags: string[]; // IDs des tags
powerLevel: string | null;
components: string | null;
limitations: string | null;
notes: string | null;
seriesSpellId?: string | null;
}
// Pour POST /spell/add et PUT /spell/update
export interface SpellPropsPost {
id?: string;
name: string;
description: string;
appearance: string;
tags: string[];
powerLevel?: string | null;
components?: string | null;
limitations?: string | null;
notes?: string | null;
seriesSpellId?: string | null;
}
// Item dans la liste (GET /spell/list)
export interface SpellListItem {
id: string;
name: string;
description: string;
tags: SpellTagProps[]; // Tags résolus (pas les IDs)
seriesSpellId?: string | null;
}
// Réponse de GET /spell/list
export interface SpellListResponse {
enabled: boolean;
spells: SpellListItem[];
tags: SpellTagProps[];
}
// État local pour l'édition (avec id nullable pour création)
export interface SpellEditState {
id: string | null;
name: string;
description: string;
appearance: string;
tags: string[];
powerLevel: string | null;
components: string | null;
limitations: string | null;
notes: string | null;
seriesSpellId?: string | null;
}
export const initialSpellState: SpellEditState = {
id: null,
name: '',
description: '',
appearance: '',
tags: [],
powerLevel: null,
components: null,
limitations: null,
notes: null,
seriesSpellId: null,
};
export const spellPowerLevels: SelectBoxProps[] = [
{value: 'none', label: 'spellPowerLevels.none'},
{value: 'cantrip', label: 'spellPowerLevels.cantrip'},
{value: 'novice', label: 'spellPowerLevels.novice'},
{value: 'apprentice', label: 'spellPowerLevels.apprentice'},
{value: 'journeyman', label: 'spellPowerLevels.journeyman'},
{value: 'expert', label: 'spellPowerLevels.expert'},
{value: 'master', label: 'spellPowerLevels.master'},
{value: 'grandmaster', label: 'spellPowerLevels.grandmaster'},
{value: 'legendary', label: 'spellPowerLevels.legendary'},
{value: 'divine', label: 'spellPowerLevels.divine'},
];
export const defaultTagColors: string[] = [
'#51AE84',
'#3A8B69',
'#2196F3',
'#1976D2',
'#FFA726',
'#FF9800',
'#EF5350',
'#E53935',
'#AB47BC',
'#9C27B0',
'#26A69A',
'#00897B',
'#5C6BC0',
'#3F51B5',
'#EC407A',
'#D81B60',
];