import { useState } from 'react' import { Search, Grid, List, SlidersHorizontal, FolderOpen, Upload, Settings, Menu, Trash2 } from 'lucide-react' import clsx from 'clsx' import { usePhotoStore } from '../../store/photoStore' import { photos } from '../../services/api' import { toast } from '../ToastContainer' import { useMutation, useQueryClient } from '@tanstack/react-query' import muliLogo from '../../assets/muli-logo.png' export function TopBar() { const [searchQuery, setSearchQuery] = useState('') 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() // Mutation for moving photos to trash const trashPhotosMutation = useMutation({ mutationFn: async () => { await photos.bulkUpdate(selectedPhotos, { trash: true }) }, onSuccess: () => { toast.success('Moved to Trash', `${selectedCount} photo${selectedCount > 1 ? 's' : ''} moved to trash`) clearSelection() queryClient.invalidateQueries({ queryKey: ['photos'] }) }, onError: (error: any) => { toast.error('Failed to Move to Trash', error.message || 'An error occurred') }, }) return (
{/* Left Section - Menu and App Name */}
Mulita

Mulita

{selectedCount > 0 && ( <> {selectedCount} selected )}
{/* Center Section - Search */}
setSearchQuery(e.target.value)} placeholder="Search photos..." className="w-full rounded-md border border-border bg-bg py-1.5 pl-9 pr-3 text-sm text-text placeholder-text-muted focus:border-primary focus:outline-none" />
{/* Right Section - View Controls and Actions */}
{/* View Mode Toggle */}
{/* Filter Button */}
{/* Action Buttons */}
) }