Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
valadaptive committed Jan 3, 2024
1 parent 495baad commit e47dcc8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
28 changes: 15 additions & 13 deletions src/components/CharacterList/CharacterList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,21 @@ const CharacterListing = ({char, active, onClick, onEdit, onDelete}: {
onClick?: (char: Character) => void,
onEdit?: (char: Character) => void,
onDelete?: (char: Character) => void,
}): JSX.Element => useMemo(() => (
<div
className={classNames(style.character, {[style.active]: active})}
onClick={onClick && ((): void => onClick(char))}
>
<div
className={style.characterName}
style={`color: ${colorToHex(char.color)}`}
>{char.name}</div>
<Icon type='edit' title='Edit' onClick={((): void => onEdit && onEdit(char))} />
<Icon type='delete' title='Delete' onClick={((): void => onDelete && onDelete(char))} />
</div>
), [char, active, onClick, onEdit, onDelete]);
}): JSX.Element => useMemo(() => {
const handleClick = useCallback(() => onClick && onClick(char), [onClick, char]);
const handleEdit = useCallback(() => onEdit && onEdit(char), [onEdit, char]);
const handleDelete = useCallback(() => onDelete && onDelete(char), [onDelete, char]);
return (
<div className={classNames(style.character, {[style.active]: active})} onClick={handleClick}>
<div
className={style.characterName}
style={`color: ${colorToHex(char.color)}`}
>{char.name}</div>
<Icon type='edit' title='Edit' onClick={handleEdit} />
<Icon type='delete' title='Delete' onClick={handleDelete} />
</div>
);
}, [char, active, onClick, onEdit, onDelete]);

const CharacterList = (): JSX.Element => {
const {chars, currentCharID, convos, currentConvoID} = useAppState();
Expand Down
2 changes: 1 addition & 1 deletion src/util/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const loadStore = (): AppState => {
const autosave = localStorage.getItem('autosave');
if (autosave) {
const parsedAutosave: unknown = JSON.parse(autosave);
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
if (validate(parsedAutosave).length === 0) loadState(defaultStore, parsedAutosave as any);
}

Expand Down

0 comments on commit e47dcc8

Please sign in to comment.