diff --git a/src/renderer/frontend/components/FileTag.tsx b/src/renderer/frontend/components/FileTag.tsx index d70085fba..efacd4a2b 100644 --- a/src/renderer/frontend/components/FileTag.tsx +++ b/src/renderer/frontend/components/FileTag.tsx @@ -12,20 +12,13 @@ interface IFileTagProps { const Single = observer(({ file }: { file: ClientFile }) => { const { tagStore } = useContext(StoreContext); - const handleClear = useCallback( - () => file.tags.clear(), - [file], - ); + const handleClear = useCallback(() => file.tags.clear(), [file]); - const handleDeselect = useCallback( - (index) => file.tags.splice(index, 1), - [file], - ); + const handleDeselect = useCallback((index) => file.tags.splice(index, 1), [ + file, + ]); - const handleSelect = useCallback( - (tag) => file.tags.push(tag.id), - [file], - ); + const handleSelect = useCallback((tag) => file.tags.push(tag.id), [file]); const handleCreate = useCallback( (name: string) => { @@ -57,13 +50,11 @@ const Multi = observer(({ files }: IFileTagProps) => { combinedTags.forEach((t) => countMap.set(t, (countMap.get(t) || 0) + 1)); // Sort based on count - // tslint:disable-next-line: newline-per-chained-call const sortedTags = Array.from(countMap.entries()).sort((a, b) => b[1] - a[1]); - const handleClear = useCallback( - () => files.forEach((f) => f.tags.clear()), - [files], - ); + const handleClear = useCallback(() => files.forEach((f) => f.tags.clear()), [ + files, + ]); const handleSelect = useCallback( (tag: ClientTag) => files.forEach((f) => f.tags.push(tag.id)), diff --git a/src/renderer/frontend/components/Gallery.tsx b/src/renderer/frontend/components/Gallery.tsx index 5882146c9..163a736e6 100644 --- a/src/renderer/frontend/components/Gallery.tsx +++ b/src/renderer/frontend/components/Gallery.tsx @@ -15,9 +15,13 @@ const Gallery = ({ }: IGalleryProps) => { // Todo: Maybe move these to UiStore so that it can be reset when the fileList changes? /** The first item that is selected in a multi-selection */ - const [initialSelectionIndex, setInitialSelectionIndex] = useState(undefined); + const [initialSelectionIndex, setInitialSelectionIndex] = useState< + number | undefined + >(undefined); /** The last item that is selected in a multi-selection */ - const [lastSelectionIndex, setLastSelectionIndex] = useState(undefined); + const [lastSelectionIndex, setLastSelectionIndex] = useState< + number | undefined + >(undefined); const selectionModeOn = uiStore.fileSelection.length > 0; @@ -61,7 +65,9 @@ const Gallery = ({ uiStore.selectFile(fileList[Math.max(0, lastSelectionIndex - 1)]); } else if (e.key === 'ArrowRight' || e.key === 'ArrowDown') { uiStore.fileSelection.clear(); - uiStore.selectFile(fileList[Math.min(fileList.length - 1, lastSelectionIndex + 1)]); + uiStore.selectFile( + fileList[Math.min(fileList.length - 1, lastSelectionIndex + 1)], + ); } }; @@ -74,19 +80,17 @@ const Gallery = ({ return (
- { - fileList.map((file, fileIndex) => ( - file.removeTag(tag.id)} - onSelect={(f, e) => onSelect(fileIndex, e)} - onDeselect={(f) => uiStore.deselectFile(f)} - onDrop={(tag) => file.addTag(tag.id)} - /> - )) - } + {fileList.map((file, fileIndex) => ( + file.removeTag(tag.id)} + onSelect={(f, e) => onSelect(fileIndex, e)} + onDeselect={(f) => uiStore.deselectFile(f)} + onDrop={(tag) => file.addTag(tag.id)} + /> + ))}
); }; diff --git a/src/renderer/frontend/components/MultiTagSelector.tsx b/src/renderer/frontend/components/MultiTagSelector.tsx index 3496ad6fe..8f2ca562c 100644 --- a/src/renderer/frontend/components/MultiTagSelector.tsx +++ b/src/renderer/frontend/components/MultiTagSelector.tsx @@ -32,9 +32,9 @@ const filterTag: ItemPredicate = (query, tag, index, exactMatch) => { const normalizedQuery = query.toLowerCase(); if (exactMatch) { - return normalizedName === normalizedQuery; + return normalizedName === normalizedQuery; } else { - return normalizedName.indexOf(normalizedQuery) >= 0; + return normalizedName.indexOf(normalizedQuery) >= 0; } }; @@ -77,12 +77,13 @@ const MultiTagSelector = ({ ); // Todo: Might need a confirmation pop over - const ClearButton = useMemo(() => - selectedTags.length > 0 ? ( -