mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-22 16:06:19 -05:00
Multiple tags can be selected. Restoring TagsDropdown functionality for Videos and Archives search.
This commit is contained in:
parent
023e6c771e
commit
e9f820d483
5 changed files with 61 additions and 38 deletions
|
|
@ -42,7 +42,7 @@ import _ from 'lodash';
|
|||
import {FileBrowser} from "./FileBrowser";
|
||||
import {refreshDirectoryFiles, refreshFiles} from "../api";
|
||||
import {useSubscribeEventName} from "../Events";
|
||||
import {TagsContext} from "../Tags";
|
||||
import {TagsContext, TagsDropdown, TagsProvider} from "../Tags";
|
||||
|
||||
function EbookCard({file}) {
|
||||
const {s} = useContext(ThemeContext);
|
||||
|
|
@ -347,7 +347,9 @@ export function FilesView({
|
|||
{selectButton}
|
||||
{viewButton}
|
||||
{limitDropdown}
|
||||
<TagsFilesGroupDropdown/>
|
||||
<TagsProvider>
|
||||
<TagsFilesGroupDropdown/>
|
||||
</TagsProvider>
|
||||
{filterOptions && filtersDropdown}
|
||||
</Grid.Column>
|
||||
{menuColumns}
|
||||
|
|
@ -360,8 +362,7 @@ export function FilesView({
|
|||
export function TagsFilesGroupDropdown({onChange}) {
|
||||
// Creates dropdown that the User can use to manipulate the tag query.
|
||||
const {searchParams, updateQuery} = useQuery();
|
||||
const activeTag = searchParams.get('tag');
|
||||
const {tags} = React.useContext(TagsContext);
|
||||
const activeTags = searchParams.getAll('tag');
|
||||
|
||||
const localOnChange = (name) => {
|
||||
updateQuery({'tag': name});
|
||||
|
|
@ -370,23 +371,11 @@ export function TagsFilesGroupDropdown({onChange}) {
|
|||
}
|
||||
}
|
||||
|
||||
let tagOptions = [];
|
||||
if (tags && tags.length) {
|
||||
for (let i = 0; i < tags.length; i++) {
|
||||
const {name} = tags[i];
|
||||
tagOptions = [...tagOptions, {key: name, text: name, value: name}];
|
||||
}
|
||||
|
||||
return <Dropdown selection clearable search
|
||||
options={tagOptions || []}
|
||||
placeholder={'Tags'}
|
||||
onChange={(e, {value}) => localOnChange(value)}
|
||||
style={{marginLeft: '0.3em', marginTop: '0.3em'}}
|
||||
value={activeTag}
|
||||
/>;
|
||||
} else {
|
||||
return <React.Fragment/>
|
||||
}
|
||||
return <TagsDropdown
|
||||
value={activeTags}
|
||||
onChange={localOnChange}
|
||||
style={{marginLeft: '0.3em', marginTop: '0.3em'}}
|
||||
/>
|
||||
}
|
||||
|
||||
export function FilesSearchView({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue