diff --git a/AGENTS.md b/AGENTS.md index de9d0009..d8645e43 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -396,6 +396,7 @@ To prevent Temporal from indefinitely retrying fatal, expected business validati ## Radix UI / Shadcn UI Patterns - **Modal Overlays**: When triggering a dialog (e.g., `Dialog`, `AlertDialog`) from inside a `DropdownMenu`, you must set `modal={false}` on the `` component. Failing to do so will cause the UI to freeze due to conflicting focus management between the two modal components. +- **Scrollable Content**: Always use the Shadcn `ScrollArea` component (`@/ui/components/ui/scroll-area`) for scrollable content containers to ensure consistent custom scrollbar UI across the application. ## Logging diff --git a/packages/webui/components/search/search-filter-dialog.tsx b/packages/webui/components/search/search-filter-dialog.tsx index 79939470..b6a8518b 100644 --- a/packages/webui/components/search/search-filter-dialog.tsx +++ b/packages/webui/components/search/search-filter-dialog.tsx @@ -4,6 +4,7 @@ import type { SearchCondition } from '@shumai/dtos' import { client } from '@/ui/api/client' import { Button } from '@/ui/components/ui/button' import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/ui/components/ui/dialog' +import { ScrollArea } from '@/ui/components/ui/scroll-area' import { Input } from '@/ui/components/ui/input' import { Label } from '@/ui/components/ui/label' import { Switch } from '@/ui/components/ui/switch' @@ -255,7 +256,7 @@ export function SearchFilterDialog({ return ( - + Search @@ -328,17 +329,20 @@ export function SearchFilterDialog({ -
setIsFiltersExpanded(!isFiltersExpanded)} - className="flex items-center justify-between py-1.5 px-1 mt-1 rounded-lg hover:bg-accent/50 cursor-pointer select-none transition-colors group" - > +
- {isFiltersExpanded ? ( - - ) : ( - - )} - Filters + {activeFiltersCount > 0 && ( @@ -362,148 +366,155 @@ export function SearchFilterDialog({
{isFiltersExpanded && ( -
- -
+ +
+ +
+
)}
{/* Results Body ported from Demo */} -
-
- - Search Results - - {isLoading && ( - - - {isSemantic - ? 'Semantic search using media intelligence might be slow...' - : 'Querying database...'} + +
+
+ + Search Results - )} -
+ {isLoading && ( + + + {isSemantic + ? 'Semantic search using media intelligence might be slow...' + : 'Querying database...'} + + )} +
-
- {!hasActiveCriteria ? ( -
- -

Ready to Search

-

- Type your query above and click the Search button to display results. -

- {isSemantic && ( -

- Semantic search results will be ordered by their relevance to the search query - text, but won't be strictly filtered. If you need accurate filtering, please add - filter conditions to control that. +

+ {!hasActiveCriteria ? ( +
+ +

Ready to Search

+

+ Type your query above and click the Search button to display results.

- )} -
- ) : searchError ? ( -
- -

Search failed

-

- {searchError.message.includes('Embedding agent not configured') - ? 'Please create and enable an embedding agent in the team settings to use semantic search.' - : searchError.message} -

-
- ) : isLoading ? ( - Array.from({ length: 3 }).map((_, idx) => ( -
-
-
-
-
-
+ {isSemantic && ( +

+ Semantic search results will be ordered by their relevance to the search query + text, but won't be strictly filtered. If you need accurate filtering, please + add filter conditions to control that. +

+ )}
- )) - ) : flattenedResults.length === 0 ? ( -
- -

- No records matched your criteria -

-

- Try adjusting spelling or removing filter rows. -

-
- ) : ( - <> - {flattenedResults.map((record) => ( + ) : searchError ? ( +
+ +

Search failed

+

+ {searchError.message.includes('Embedding agent not configured') + ? 'Please create and enable an embedding agent in the team settings to use semantic search.' + : searchError.message} +

+
+ ) : isLoading ? ( + Array.from({ length: 3 }).map((_, idx) => (
handleResultClick(record)} - className="p-3.5 flex items-center gap-3 hover:bg-muted/40 transition-colors group/record cursor-pointer" + key={idx} + className="p-3.5 flex items-center gap-3 animate-pulse bg-muted/10" > -
- {record.preview?.thumbnailUrl ? ( - - ) : record.type === 'folder' ? ( - - ) : ( - - )} +
+
+
+
+
+ )) + ) : flattenedResults.length === 0 ? ( +
+ +

+ No records matched your criteria +

+

+ Try adjusting spelling or removing filter rows. +

+
+ ) : ( + <> + {flattenedResults.map((record) => ( +
handleResultClick(record)} + className="p-3.5 flex items-center gap-3 hover:bg-muted/40 transition-colors group/record cursor-pointer" + > +
+ {record.preview?.thumbnailUrl ? ( + + ) : record.type === 'folder' ? ( + + ) : ( + + )} +
-
-
-
- - {record.name} +
+
+
+ + {record.name} + + + {record.type === 'folder' + ? 'Folder' + : `Size: ${formatSize(record.sizeByte || 0)}`} + + {record.startTime !== undefined && + record.startTime !== null && + record.endTime !== undefined && + record.endTime !== null && ( + + Match found at {formatTimestamp(record.startTime)} -{' '} + {formatTimestamp(record.endTime)} + + )} +
+ + {new Date(record.createdAt).toLocaleDateString(undefined, { + year: 'numeric', + month: 'short', + })} - - {record.type === 'folder' - ? 'Folder' - : `Size: ${formatSize(record.sizeByte || 0)}`} - - {record.startTime !== undefined && - record.startTime !== null && - record.endTime !== undefined && - record.endTime !== null && ( - - Match found at {formatTimestamp(record.startTime)} -{' '} - {formatTimestamp(record.endTime)} - - )}
- - {new Date(record.createdAt).toLocaleDateString(undefined, { - year: 'numeric', - month: 'short', - })} -
-
- ))} - {(hasNextPage || isFetchingNextPage) && ( -
- -
- )} - - )} + ))} + {(hasNextPage || isFetchingNextPage) && ( +
+ +
+ )} + + )} +
-
+ {/* Footer ported from Demo */}