From 324cc0298b79a9f0d6678a2522643f3a99f3b100 Mon Sep 17 00:00:00 2001 From: dtoro Date: Tue, 7 Apr 2026 23:22:30 +0200 Subject: [PATCH] chore: drop duplicate selected count + Discard button from TopBar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both were redundant: - "N selected" is already shown by the contextual KeyboardHints pill below the FilterBar - The Discard action is in the RightSidebar Flag section and bound to X (and exists as a per-photo button on the thumbnail when is_discarded) Also removes the no-longer-used discardPhotosMutation, the photos api import, the toast import, the useMutation/useQueryClient imports, and the usePhotoStore selectedPhotos read — TopBar is leaner now. Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/components/layout/TopBar.tsx | 48 ++--------------------- 1 file changed, 4 insertions(+), 44 deletions(-) diff --git a/frontend/src/components/layout/TopBar.tsx b/frontend/src/components/layout/TopBar.tsx index 41ddaac..5f44464 100644 --- a/frontend/src/components/layout/TopBar.tsx +++ b/frontend/src/components/layout/TopBar.tsx @@ -8,16 +8,11 @@ import { Upload, Settings, Menu, - Trash2, X, ShoppingBasket, } from 'lucide-react' import clsx from 'clsx' -import { usePhotoStore } from '../../store/photoStore' import { useFilterStore, hasActiveFilters } from '../../store/filterStore' -import { photos } from '../../services/api' -import { toast } from '../ToastContainer' -import { useMutation, useQueryClient } from '@tanstack/react-query' import { useHeapsQuery } from '../../hooks/useHeapsQuery' import muliLogo from '../../assets/muli-logo.png' @@ -55,31 +50,12 @@ export function TopBar() { }, [searchQuery, storeQ, setStoreQ]) const [viewMode, setViewMode] = useState<'grid' | 'list'>('grid') - const selectedPhotos = usePhotoStore((state) => state.selectedPhotos) - const clearSelection = usePhotoStore((state) => state.clearSelection) - const selectedCount = selectedPhotos.length - const queryClient = useQueryClient() - // Currently active heap (for the T shortcut). Shown as a pill so the user - // always knows where their next T-press will land. + // Currently active heap. Shown as a pill so the user always knows where + // their next P-press will land. const { data: heapsList = [] } = useHeapsQuery() const activeHeap = heapsList.find((h) => h.is_active) - - // Mutation for discarding selected photos - const discardPhotosMutation = useMutation({ - mutationFn: async () => { - await photos.bulkUpdate(selectedPhotos, { discard: true }) - }, - onSuccess: () => { - toast.success('Discarded', `${selectedCount} photo${selectedCount > 1 ? 's' : ''} discarded`) - clearSelection() - queryClient.invalidateQueries({ queryKey: ['photos'] }) - }, - onError: (error: any) => { - toast.error('Failed to discard', error.message || 'An error occurred') - }, - }) - + return (
{/* Left Section - Menu and App Name */} @@ -100,28 +76,12 @@ export function TopBar() { {activeHeap && ( {activeHeap.name} )} - {selectedCount > 0 && ( - <> - - {selectedCount} selected - - - - )} {/* Center Section - Search */}