Skip to content

Commit b12d7b0

Browse files
committed
Fix calendar overlay bug and add Explore tab state persistence
- Fixed calendar widget appearing over modification date entries in History card (was using Calendar component instead of CalendarIcon) - Explore page tabs now preserve state when switching (filters, sort, columns, page) - Added reset button to restore column defaults on data tabs
1 parent b86ed83 commit b12d7b0

File tree

4 files changed

+47
-16
lines changed

4 files changed

+47
-16
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
- **Explore page**: Tab state is now preserved when switching between tabs (filters, sort, column visibility/order, pagination)
12+
- Added reset button to restore columns to default settings
13+
14+
### Fixed
15+
- **Item detail sheet**: Fixed calendar widget appearing over modification date entries in History card
16+
1017
## [v0.2.12] - 2025-11-17
1118

1219
### Changed

frontend/src/components/shared/ItemDetailSheet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ export function ItemDetailSheet({
824824
{change.meta_change && change.mod_date_old !== change.mod_date_new && (
825825
<div className="bg-muted/50 p-2 rounded">
826826
<p className="font-medium mb-1 flex items-center gap-1">
827-
<Calendar className="h-3 w-3" />
827+
<CalendarIcon className="h-3 w-3" />
828828
Modification Date
829829
</p>
830830
<div className="flex items-center gap-2">

frontend/src/pages/explore/DataExplorerView.tsx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { useState, useEffect, useCallback, useRef } from 'react'
2-
import { GripVertical, Plus, X } from 'lucide-react'
2+
import { GripVertical, ListRestart, Plus, X } from 'lucide-react'
33
import { fetchMetadata, countQuery, fetchQuery } from '@/lib/api'
44
import { FilterModal } from './FilterModal'
55
import { Card, CardContent } from '@/components/ui/card'
66
import { Badge } from '@/components/ui/badge'
7+
import { Button } from '@/components/ui/button'
78
import { formatDateFull } from '@/lib/dateUtils'
89
import type {
910
ColumnState,
@@ -30,6 +31,7 @@ export function DataExplorerView({ domain }: DataExplorerViewProps) {
3031
const [isDraggingDown, setIsDraggingDown] = useState(false)
3132
const [filterModalColumn, setFilterModalColumn] = useState<ColumnState | null>(null)
3233
const lastFilterKeyRef = useRef<string>('')
34+
const originalMetadataRef = useRef<ColumnState[]>([])
3335

3436
// Load column metadata on mount
3537
useEffect(() => {
@@ -46,6 +48,8 @@ export function DataExplorerView({ domain }: DataExplorerViewProps) {
4648
position: index,
4749
}))
4850

51+
// Store a deep copy for reset functionality
52+
originalMetadataRef.current = JSON.parse(JSON.stringify(columnState))
4953
setColumns(columnState)
5054
setError(null)
5155
} catch (err) {
@@ -193,6 +197,15 @@ export function DataExplorerView({ domain }: DataExplorerViewProps) {
193197
setCurrentPage(1)
194198
}
195199

200+
const handleResetColumns = () => {
201+
if (originalMetadataRef.current.length > 0) {
202+
// Create a deep copy to reset all column state
203+
setColumns(JSON.parse(JSON.stringify(originalMetadataRef.current)))
204+
setFilters([])
205+
setCurrentPage(1)
206+
}
207+
}
208+
196209
if (loading && columns.length === 0) {
197210
return <div className="p-4">Loading metadata...</div>
198211
}
@@ -209,7 +222,17 @@ export function DataExplorerView({ domain }: DataExplorerViewProps) {
209222
<table className="w-full text-sm">
210223
<thead className="sticky top-0 bg-muted">
211224
<tr className="border-b border-border">
212-
<th className="text-center font-medium py-2 px-2 w-8"></th>
225+
<th className="text-center font-medium py-2 px-2 w-8">
226+
<Button
227+
variant="outline"
228+
size="icon"
229+
onClick={handleResetColumns}
230+
className="w-6 h-6"
231+
title="Reset columns"
232+
>
233+
<ListRestart className="w-4 h-4 text-blue-500" />
234+
</Button>
235+
</th>
213236
<th className="text-center font-medium py-2 px-2 w-8"></th>
214237
<th className="text-center font-medium py-2 uppercase text-xs tracking-wide">COLUMN</th>
215238
<th className="text-center font-medium py-2 w-16 uppercase text-xs tracking-wide">SORT</th>

frontend/src/pages/explore/ExplorePage.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useEffect } from 'react'
22
import { useLocation, useNavigate } from 'react-router-dom'
3-
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
3+
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'
44
import { Card, CardContent, CardHeader } from '@/components/ui/card'
55
import { RootsView } from './RootsView'
66
import { ScansView } from './ScansView'
@@ -67,29 +67,30 @@ export function ExplorePage() {
6767
</CardHeader>
6868

6969
<CardContent className="flex-1 flex flex-col px-6 pb-6 pt-4">
70-
<TabsContent value="roots" className="flex-1 mt-0">
70+
{/* Keep all tabs mounted for instant switching - use CSS hiding */}
71+
<div className={`flex-1 flex flex-col ${currentTab === 'roots' ? '' : 'hidden'}`}>
7172
<RootsView />
72-
</TabsContent>
73+
</div>
7374

74-
<TabsContent value="scans" className="flex-1 mt-0">
75+
<div className={`flex-1 flex flex-col ${currentTab === 'scans' ? '' : 'hidden'}`}>
7576
<ScansView />
76-
</TabsContent>
77+
</div>
7778

78-
<TabsContent value="items" className="flex-1 mt-0">
79+
<div className={`flex-1 flex flex-col ${currentTab === 'items' ? '' : 'hidden'}`}>
7980
<ItemsView />
80-
</TabsContent>
81+
</div>
8182

82-
<TabsContent value="changes" className="flex-1 mt-0">
83+
<div className={`flex-1 flex flex-col ${currentTab === 'changes' ? '' : 'hidden'}`}>
8384
<ChangesView />
84-
</TabsContent>
85+
</div>
8586

86-
<TabsContent value="alerts" className="flex-1 mt-0">
87+
<div className={`flex-1 flex flex-col ${currentTab === 'alerts' ? '' : 'hidden'}`}>
8788
<AlertsView />
88-
</TabsContent>
89+
</div>
8990

90-
<TabsContent value="query" className="flex-1 mt-0">
91+
<div className={`flex-1 flex flex-col ${currentTab === 'query' ? '' : 'hidden'}`}>
9192
<QueryView />
92-
</TabsContent>
93+
</div>
9394
</CardContent>
9495
</Tabs>
9596
</Card>

0 commit comments

Comments
 (0)