From 11eb06c5ad56127b1e465fd5ec78f351b8dabef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Br=C3=BCckner?= Date: Fri, 5 Jun 2026 09:20:52 +0200 Subject: [PATCH] fix(logbook): system filter as proper type button, default hides system entries --- src/components/Logbook.tsx | 39 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/src/components/Logbook.tsx b/src/components/Logbook.tsx index e54be35..3a2a6d6 100644 --- a/src/components/Logbook.tsx +++ b/src/components/Logbook.tsx @@ -20,8 +20,7 @@ interface LogbookProps { export default function Logbook({ logs, devices, users, currentUser, onAddLog }: LogbookProps) { const [searchTerm, setSearchTerm] = useState(''); - const [typeFilter, setTypeFilter] = useState('all'); - const [showSystem, setShowSystem] = useState(false); + const [typeFilter, setTypeFilter] = useState('non-system'); // Custom Maintenance Log state const [showAddLog, setShowAddLog] = useState(false); @@ -33,9 +32,11 @@ export default function Logbook({ logs, devices, users, currentUser, onAddLog }: // Filter logs const filteredLogs = sortedLogs.filter(log => { - if (!showSystem && log.type === 'system') return false; const matchesSearch = log.message.toLowerCase().includes(searchTerm.toLowerCase()); - const matchesType = typeFilter === 'all' || log.type === typeFilter; + const matchesType = + typeFilter === 'all' ? true : + typeFilter === 'non-system' ? log.type !== 'system' : + log.type === typeFilter; return matchesSearch && matchesType; }); @@ -124,30 +125,26 @@ export default function Logbook({ logs, devices, users, currentUser, onAddLog }: />
- {['all', 'booking', 'maintenance', 'status'].map((type) => ( + {[ + { key: 'non-system', label: 'All' }, + { key: 'booking', label: 'Booking' }, + { key: 'maintenance',label: 'Maintenance' }, + { key: 'status', label: 'Status' }, + { key: 'system', label: 'System' }, + { key: 'all', label: 'All incl. System' }, + ].map(({ key, label }) => ( ))} -