Remove CharacterComponent and CharacterDetail components

- Deleted `CharacterComponent` and `CharacterDetail` files from the project.
- Refactored related logic to improve code maintainability and reduce redundancy.
This commit is contained in:
natreex
2026-02-05 14:12:08 -05:00
parent cec5830360
commit 209dc6f85a
133 changed files with 17673 additions and 3110 deletions

View File

@@ -1,7 +1,7 @@
'use client';
import type {Context, Dispatch, JSX, ReactNode, SetStateAction} from 'react';
import {createContext, useCallback, useState} from 'react';
import React, {createContext, useCallback, useState} from 'react';
import AlertStack from '@/components/AlertStack';
import {cleanErrorMessage} from '@/lib/errors';
@@ -38,10 +38,11 @@ export const AlertContext: Context<AlertContextProps> = createContext<AlertConte
export function AlertProvider({children}: AlertProviderProps): JSX.Element {
const [alerts, setAlerts]: [Alert[], Dispatch<SetStateAction<Alert[]>>] = useState<Alert[]>([]);
const addAlert: (type: AlertType, message: string) => void = useCallback((type: AlertType, message: string): void => {
const addAlert: (type: AlertType, message: string) => void = useCallback((type: AlertType, message: unknown): void => {
const safeMessage: string = typeof message === 'string' ? message : String(message ?? 'Une erreur est survenue');
const id: string = `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
const newAlert: Alert = {id, type, message};
const newAlert: Alert = {id, type, message: safeMessage};
setAlerts((prev: Alert[]): Alert[] => [...prev, newAlert]);
}, []);
@@ -54,7 +55,7 @@ export function AlertProvider({children}: AlertProviderProps): JSX.Element {
}, [addAlert]);
const errorMessage: (message: string) => void = useCallback((message: string): void => {
addAlert('error', cleanErrorMessage(message));
addAlert('error', message);
}, [addAlert]);
const infoMessage: (message: string) => void = useCallback((message: string): void => {