mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Add separate sidebar toggle button (#6077)
* Move sidebar toggle to right. Change icon * Show sidebar button on selection * Fix clicking toggle cycling visibility on smaller views * Show more tags component when cutoff == 0 * Hide filter/filter icon buttons in certain situations * Move sidebar toggle to left on xl viewports
This commit is contained in:
@@ -179,7 +179,7 @@ export const FilterTags: React.FC<IFilterTagsProps> = ({
|
|||||||
return (child as HTMLElement).classList.contains("more-tags");
|
return (child as HTMLElement).classList.contains("more-tags");
|
||||||
});
|
});
|
||||||
|
|
||||||
if (moreTags && !!cutoff) {
|
if (moreTags && cutoff !== undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,8 +302,9 @@ export const FilterTags: React.FC<IFilterTagsProps> = ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const visibleCriteria = cutoff ? filterTags.slice(0, cutoff) : filterTags;
|
const visibleCriteria =
|
||||||
const hiddenCriteria = cutoff ? filterTags.slice(cutoff) : [];
|
cutoff !== undefined ? filterTags.slice(0, cutoff) : filterTags;
|
||||||
|
const hiddenCriteria = cutoff !== undefined ? filterTags.slice(cutoff) : [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={className} ref={ref}>
|
<div className={className} ref={ref}>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import {
|
|||||||
faPencil,
|
faPencil,
|
||||||
faPlay,
|
faPlay,
|
||||||
faPlus,
|
faPlus,
|
||||||
|
faSliders,
|
||||||
faTimes,
|
faTimes,
|
||||||
faTrash,
|
faTrash,
|
||||||
} from "@fortawesome/free-solid-svg-icons";
|
} from "@fortawesome/free-solid-svg-icons";
|
||||||
@@ -346,7 +347,7 @@ const ListToolbarContent: React.FC<{
|
|||||||
operations: IOperations[];
|
operations: IOperations[];
|
||||||
onToggleSidebar: () => void;
|
onToggleSidebar: () => void;
|
||||||
onSetFilter: (filter: ListFilterModel) => void;
|
onSetFilter: (filter: ListFilterModel) => void;
|
||||||
onEditCriterion: (c: Criterion) => void;
|
onEditCriterion: (c?: Criterion) => void;
|
||||||
onRemoveCriterion: (criterion: Criterion, valueIndex?: number) => void;
|
onRemoveCriterion: (criterion: Criterion, valueIndex?: number) => void;
|
||||||
onRemoveAllCriterion: () => void;
|
onRemoveAllCriterion: () => void;
|
||||||
onEditSearchTerm: () => void;
|
onEditSearchTerm: () => void;
|
||||||
@@ -381,6 +382,17 @@ const ListToolbarContent: React.FC<{
|
|||||||
const { criteria, searchTerm } = filter;
|
const { criteria, searchTerm } = filter;
|
||||||
const hasSelection = selectedIds.size > 0;
|
const hasSelection = selectedIds.size > 0;
|
||||||
|
|
||||||
|
const sidebarToggle = (
|
||||||
|
<Button
|
||||||
|
className="minimal sidebar-toggle-button ignore-sidebar-outside-click"
|
||||||
|
variant="secondary"
|
||||||
|
onClick={() => onToggleSidebar()}
|
||||||
|
title={intl.formatMessage({ id: "actions.sidebar.toggle" })}
|
||||||
|
>
|
||||||
|
<Icon icon={faSliders} />
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{!hasSelection && (
|
{!hasSelection && (
|
||||||
@@ -390,9 +402,8 @@ const ListToolbarContent: React.FC<{
|
|||||||
</div>
|
</div>
|
||||||
<div className="filter-section">
|
<div className="filter-section">
|
||||||
<FilterButton
|
<FilterButton
|
||||||
onClick={() => onToggleSidebar()}
|
onClick={() => onEditCriterion()}
|
||||||
count={criteria.length}
|
count={criteria.length}
|
||||||
title={intl.formatMessage({ id: "actions.sidebar.toggle" })}
|
|
||||||
/>
|
/>
|
||||||
<FilterTags
|
<FilterTags
|
||||||
searchTerm={searchTerm}
|
searchTerm={searchTerm}
|
||||||
@@ -404,6 +415,7 @@ const ListToolbarContent: React.FC<{
|
|||||||
onRemoveSearchTerm={onRemoveSearchTerm}
|
onRemoveSearchTerm={onRemoveSearchTerm}
|
||||||
truncateOnOverflow
|
truncateOnOverflow
|
||||||
/>
|
/>
|
||||||
|
{sidebarToggle}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -421,6 +433,7 @@ const ListToolbarContent: React.FC<{
|
|||||||
<Button variant="link" onClick={() => onSelectAll()}>
|
<Button variant="link" onClick={() => onSelectAll()}>
|
||||||
<FormattedMessage id="actions.select_all" />
|
<FormattedMessage id="actions.select_all" />
|
||||||
</Button>
|
</Button>
|
||||||
|
{sidebarToggle}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div>
|
<div>
|
||||||
@@ -822,7 +835,7 @@ export const FilteredSceneList = (props: IFilteredScenes) => {
|
|||||||
selectedIds={selectedIds}
|
selectedIds={selectedIds}
|
||||||
operations={otherOperations}
|
operations={otherOperations}
|
||||||
onToggleSidebar={() => setShowSidebar(!showSidebar)}
|
onToggleSidebar={() => setShowSidebar(!showSidebar)}
|
||||||
onEditCriterion={(c) => showEditFilter(c.criterionOption.type)}
|
onEditCriterion={(c) => showEditFilter(c?.criterionOption.type)}
|
||||||
onRemoveCriterion={removeCriterion}
|
onRemoveCriterion={removeCriterion}
|
||||||
onRemoveAllCriterion={() => clearAllCriteria(true)}
|
onRemoveAllCriterion={() => clearAllCriteria(true)}
|
||||||
onEditSearchTerm={() => {
|
onEditSearchTerm={() => {
|
||||||
|
|||||||
@@ -942,11 +942,6 @@ input[type="range"].blue-slider {
|
|||||||
transition-property: opacity;
|
transition-property: opacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
.scene-list:not(.hide-sidebar) .sidebar-toggle-button {
|
|
||||||
opacity: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scene-wall,
|
.scene-wall,
|
||||||
.marker-wall {
|
.marker-wall {
|
||||||
.wall-item {
|
.wall-item {
|
||||||
@@ -1063,11 +1058,17 @@ input[type="range"].blue-slider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.selected-items-info,
|
||||||
> div.filter-section {
|
> div.filter-section {
|
||||||
border: 1px solid $secondary;
|
border: 1px solid $secondary;
|
||||||
border-radius: 0.25rem;
|
border-radius: 0.25rem;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
> div.filter-toolbar {
|
||||||
|
border: 1px solid $secondary;
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
|
||||||
.filter-button {
|
.filter-button {
|
||||||
border-bottom-right-radius: 0;
|
border-bottom-right-radius: 0;
|
||||||
@@ -1075,12 +1076,16 @@ input[type="range"].blue-slider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sidebar-toggle-button {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.search-container {
|
.search-container {
|
||||||
border-right: 1px solid $secondary;
|
border-right: 1px solid $secondary;
|
||||||
display: block;
|
display: block;
|
||||||
margin-right: -0.5rem;
|
margin-right: -0.5rem;
|
||||||
|
min-width: calc($sidebar-width - 15px);
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
width: calc($sidebar-width - 15px);
|
|
||||||
|
|
||||||
.search-term-input {
|
.search-term-input {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
@@ -1097,7 +1102,9 @@ input[type="range"].blue-slider {
|
|||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
width: calc(100% - 35px - 0.5rem);
|
|
||||||
|
// account for filter button, and toggle sidebar buttons with gaps
|
||||||
|
width: calc(100% - 70px - 1rem);
|
||||||
|
|
||||||
@include media-breakpoint-down(xs) {
|
@include media-breakpoint-down(xs) {
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
@@ -1121,6 +1128,38 @@ input[type="range"].blue-slider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// hide Edit Filter button on larger screens
|
||||||
|
@include media-breakpoint-up(lg) {
|
||||||
|
.scene-list .sidebar .edit-filter-button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// hide the filter icon button when sidebar is shown on smaller screens
|
||||||
|
@include media-breakpoint-down(md) {
|
||||||
|
.sidebar-pane:not(.hide-sidebar) .scene-list-toolbar .filter-button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
// adjust the width of the filter-tags as well
|
||||||
|
.sidebar-pane:not(.hide-sidebar) .scene-list-toolbar .filter-tags {
|
||||||
|
width: calc(100% - 35px - 0.5rem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// move the sidebar toggle to the left on xl viewports
|
||||||
|
@include media-breakpoint-up(xl) {
|
||||||
|
.scene-list .scene-list-toolbar .filter-section {
|
||||||
|
.sidebar-toggle-button {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-tags {
|
||||||
|
order: 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// hide the search term tag item when the search box is visible
|
// hide the search term tag item when the search box is visible
|
||||||
@include media-breakpoint-up(lg) {
|
@include media-breakpoint-up(lg) {
|
||||||
.scene-list-toolbar .filter-tags .search-term-filter-tag {
|
.scene-list-toolbar .filter-tags .search-term-filter-tag {
|
||||||
|
|||||||
Reference in New Issue
Block a user