mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-29 19:36:20 -05:00
Consolidate search options into a single Filter modal (#497)
* Consolidate search options into a single Filter modal Reworks the file-search UI on the Dashboard, Videos, Archives, and Docs pages. The crowded row of controls (sort, tags, limit, file-type filter, date selector) is replaced with a single "Filter" button that opens one comprehensive modal. - Add SearchFilterModal + SearchFilterButton (violet + count badge when active). Sections (Sort, File Type, Tags, Results Per Page, Published Date) are shown per-page via props; layout uses a Semantic Grid. - Selections are drafted locally and applied in a single updateQuery only on close/Done, so the search isn't re-run on every field change. - Results Per Page and Sort use buttons (fewer clicks, no clipped dropdown). - Extract shared SearchControlBar (view toggle + input + Filter) for the three results pages; move the global-search view toggle onto the tab row. - Rework the Dashboard search line into one adaptive flex row; clear button only shows when there's an active search. - Remove now-dead FilesView limit/tag returns and SearchLimitDropdown. * Address review: reset limit on Clear All; use replace over replaceAll - handleClearAll now resets Results Per Page to the default page size (DEFAULT_SEARCH_LIMIT = 24) so "Clear All" actually clears every setting. - Replace start-anchored replaceAll(/^-/g) with replace(/^-/) for the sort key. - Add a test covering the Clear All limit reset. * Remove now-unused Media import from Files.js The FilesSearchView refactor dropped the last <Media> usage in this file, leaving an unused import (a build warning). Remove it. --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
36b29afef7
commit
264cc8cd58
9 changed files with 549 additions and 243 deletions
|
|
@ -38,7 +38,6 @@ import {
|
|||
PreviewPath,
|
||||
resolveDataPath,
|
||||
SearchInput,
|
||||
SortButton,
|
||||
TabLinks,
|
||||
textEllipsis,
|
||||
useTitle
|
||||
|
|
@ -78,10 +77,10 @@ import {
|
|||
useSearchDomain,
|
||||
useSearchOrder
|
||||
} from "../hooks/customHooks";
|
||||
import {FileCards, FileRowTagIcon, FilesView} from "./Files";
|
||||
import {FileCards, FileRowTagIcon, FilesView, SearchControlBar} from "./Files";
|
||||
import Grid from "semantic-ui-react/dist/commonjs/collections/Grid";
|
||||
import _ from "lodash";
|
||||
import {Media, ThemeContext} from "../contexts/contexts";
|
||||
import {ThemeContext} from "../contexts/contexts";
|
||||
import {Button, Card, darkTheme, Header, Loader, Placeholder, Popup, Segment, Statistic, Tab} from "./Theme";
|
||||
import {BulkTagModal} from "./BulkTagModal";
|
||||
import {taggedImageLabel, TagsSelector} from "../Tags";
|
||||
|
|
@ -1216,7 +1215,7 @@ function ArchivesPage() {
|
|||
/>
|
||||
</div>;
|
||||
|
||||
const {body, paginator, viewButton, limitDropdown, tagQuerySelector} = FilesView(
|
||||
const {body, paginator, viewButton} = FilesView(
|
||||
{
|
||||
files: archives,
|
||||
activePage: activePage,
|
||||
|
|
@ -1230,16 +1229,6 @@ function ArchivesPage() {
|
|||
);
|
||||
|
||||
|
||||
const [localSearchStr, setLocalSearchStr] = React.useState(searchStr || '');
|
||||
const searchInput = <SearchInput
|
||||
onChange={setLocalSearchStr}
|
||||
onClear={() => setLocalSearchStr(null)}
|
||||
searchStr={localSearchStr}
|
||||
onSubmit={setSearchStr}
|
||||
placeholder='Search Archives...'
|
||||
inputRef={searchInputRef}
|
||||
/>;
|
||||
|
||||
// Domain header with edit link when filtering by domain
|
||||
let header;
|
||||
if (domainObj && domainObj.domain) {
|
||||
|
|
@ -1263,30 +1252,14 @@ function ArchivesPage() {
|
|||
|
||||
return <>
|
||||
{header}
|
||||
<Media at='mobile'>
|
||||
<Grid>
|
||||
<Grid.Row>
|
||||
<Grid.Column width={2}>{viewButton}</Grid.Column>
|
||||
<Grid.Column width={4}>{limitDropdown}</Grid.Column>
|
||||
<Grid.Column width={2}>{tagQuerySelector}</Grid.Column>
|
||||
<Grid.Column width={8}><SortButton sorts={archiveOrders}/></Grid.Column>
|
||||
</Grid.Row>
|
||||
<Grid.Row width={16}>
|
||||
<Grid.Column>{searchInput}</Grid.Column>
|
||||
</Grid.Row>
|
||||
</Grid>
|
||||
</Media>
|
||||
<Media greaterThanOrEqual='tablet'>
|
||||
<Grid>
|
||||
<Grid.Row>
|
||||
<Grid.Column width={1}>{viewButton}</Grid.Column>
|
||||
<Grid.Column width={2}>{limitDropdown}</Grid.Column>
|
||||
<Grid.Column width={1}>{tagQuerySelector}</Grid.Column>
|
||||
<Grid.Column width={3}><SortButton sorts={archiveOrders}/></Grid.Column>
|
||||
<Grid.Column width={9}>{searchInput}</Grid.Column>
|
||||
</Grid.Row>
|
||||
</Grid>
|
||||
</Media>
|
||||
<SearchControlBar
|
||||
searchStr={searchStr}
|
||||
setSearchStr={setSearchStr}
|
||||
placeholder='Search Archives...'
|
||||
inputRef={searchInputRef}
|
||||
viewButton={viewButton}
|
||||
sorts={archiveOrders}
|
||||
/>
|
||||
{body}
|
||||
{paginator}
|
||||
<TaggedDeleteConfirmModal
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue