Add more filter option to libView #9
This commit is contained in:
3 files changed
+119
-6
No files matched your search
@@ -64,12 +64,15 @@ export const Card = ({
|
|||||||
: "1",
|
: "1",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{watchedStatus && (
|
<Chip
|
||||||
<Chip
|
className="card-indicator"
|
||||||
className="card-indicator"
|
label={<MdiCheck />}
|
||||||
label={<MdiCheck />}
|
sx={{
|
||||||
/>
|
transition: "opacity 150ms",
|
||||||
)}
|
opacity: watchedStatus ? 1 : 0,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
{!!watchedCount && (
|
{!!watchedCount && (
|
||||||
<Chip
|
<Chip
|
||||||
className="card-indicator card-indicator-text"
|
className="card-indicator card-indicator-text"
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiFilterOutline } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiFilterOutline = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiFilterOutline}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -46,6 +46,7 @@ import { MdiSortDescending } from "../../components/icons/mdiSortDescending";
|
|||||||
import { MdiSortAscending } from "../../components/icons/mdiSortAscending";
|
import { MdiSortAscending } from "../../components/icons/mdiSortAscending";
|
||||||
import { MdiChevronRight } from "../../components/icons/mdiChevronRight";
|
import { MdiChevronRight } from "../../components/icons/mdiChevronRight";
|
||||||
import { MdiChevronDown } from "../../components/icons/mdiChevronDown";
|
import { MdiChevronDown } from "../../components/icons/mdiChevronDown";
|
||||||
|
import { MdiFilterOutline } from "../../components/icons/mdiFilterOutline";
|
||||||
|
|
||||||
const LibraryView = () => {
|
const LibraryView = () => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@@ -168,6 +169,19 @@ const LibraryView = () => {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const [isBluRay, setIsBluRay] = useState(false);
|
||||||
|
const [isDVD, setIsDVD] = useState(false);
|
||||||
|
const [isHD, setIsHD] = useState(false);
|
||||||
|
const [is4K, setIs4K] = useState(false);
|
||||||
|
const [is3D, setIs3D] = useState(false);
|
||||||
|
const availableVideoTypeFilters = [
|
||||||
|
{ title: "Blu-Ray", value: false, state: (val) => setIsBluRay(val) },
|
||||||
|
{ title: "DVD", value: false, state: (val) => setIsDVD(val) },
|
||||||
|
{ title: "HD", value: false, state: (val) => setIsHD(val) },
|
||||||
|
{ title: "4K", value: false, state: (val) => setIs4K(val) },
|
||||||
|
{ title: "3D", value: false, state: (val) => setIs3D(val) },
|
||||||
|
];
|
||||||
|
|
||||||
const [currentViewType, setCurrentViewType] = useState(undefined);
|
const [currentViewType, setCurrentViewType] = useState(undefined);
|
||||||
const [viewType, setViewType] = useState([]);
|
const [viewType, setViewType] = useState([]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -250,6 +264,10 @@ const LibraryView = () => {
|
|||||||
hasSpecialFeature: hasSpecialFeature ? true : undefined,
|
hasSpecialFeature: hasSpecialFeature ? true : undefined,
|
||||||
hasThemeSong: hasThemeSong ? true : undefined,
|
hasThemeSong: hasThemeSong ? true : undefined,
|
||||||
hasThemeVideo: hasThemeVideo ? true : undefined,
|
hasThemeVideo: hasThemeVideo ? true : undefined,
|
||||||
|
videoTypes: [isBluRay && "BluRay", isDVD && "Dvd"],
|
||||||
|
isHd: isHD ? true : undefined,
|
||||||
|
is4K: is4K ? true : undefined,
|
||||||
|
is3D: is3D ? true : undefined,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return result.data;
|
return result.data;
|
||||||
@@ -279,6 +297,7 @@ const LibraryView = () => {
|
|||||||
hasThemeSong,
|
hasThemeSong,
|
||||||
hasThemeVideo,
|
hasThemeVideo,
|
||||||
],
|
],
|
||||||
|
[isBluRay, isDVD, isHD, is4K, is3D],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
queryFn: () => fetchLibItems(id),
|
queryFn: () => fetchLibItems(id),
|
||||||
@@ -404,11 +423,16 @@ const LibraryView = () => {
|
|||||||
? "true"
|
? "true"
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
|
startIcon={
|
||||||
|
<MdiFilterOutline />
|
||||||
|
}
|
||||||
endIcon={
|
endIcon={
|
||||||
<MdiChevronDown />
|
<MdiChevronDown />
|
||||||
}
|
}
|
||||||
onClick={openFiltersMenu}
|
onClick={openFiltersMenu}
|
||||||
color="white"
|
color="white"
|
||||||
|
// sx={{ p: 1 }}
|
||||||
|
// size="small"
|
||||||
>
|
>
|
||||||
Filter
|
Filter
|
||||||
</Button>
|
</Button>
|
||||||
@@ -578,6 +602,79 @@ const LibraryView = () => {
|
|||||||
</AccordionDetails>
|
</AccordionDetails>
|
||||||
</Accordion>
|
</Accordion>
|
||||||
)}
|
)}
|
||||||
|
{!onlyStatusFilterViews.includes(
|
||||||
|
currentLib.data
|
||||||
|
.Items[0]
|
||||||
|
.CollectionType,
|
||||||
|
) && (
|
||||||
|
<Accordion>
|
||||||
|
<AccordionSummary
|
||||||
|
expandIcon={
|
||||||
|
<MdiChevronDown />
|
||||||
|
}
|
||||||
|
aria-controls="panel1bh-content"
|
||||||
|
id="panel1bh-header"
|
||||||
|
>
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
flexShrink: 0,
|
||||||
|
}}
|
||||||
|
noWrap
|
||||||
|
>
|
||||||
|
Video
|
||||||
|
Type
|
||||||
|
</Typography>
|
||||||
|
</AccordionSummary>
|
||||||
|
<Divider />
|
||||||
|
<AccordionDetails
|
||||||
|
sx={{
|
||||||
|
maxHeight:
|
||||||
|
"15em",
|
||||||
|
overflow:
|
||||||
|
"auto",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Stack>
|
||||||
|
{availableVideoTypeFilters.map(
|
||||||
|
(
|
||||||
|
item,
|
||||||
|
index,
|
||||||
|
) => {
|
||||||
|
return (
|
||||||
|
<MenuItem
|
||||||
|
sx={{
|
||||||
|
justifyContent:
|
||||||
|
"space-between",
|
||||||
|
}}
|
||||||
|
key={
|
||||||
|
index
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
item.title
|
||||||
|
}
|
||||||
|
<Checkbox
|
||||||
|
value={
|
||||||
|
item.value
|
||||||
|
}
|
||||||
|
onChange={(
|
||||||
|
e,
|
||||||
|
) =>
|
||||||
|
item.state(
|
||||||
|
e
|
||||||
|
.target
|
||||||
|
.checked,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</MenuItem>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</AccordionDetails>
|
||||||
|
</Accordion>
|
||||||
|
)}
|
||||||
</Menu>
|
</Menu>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in new issue
Block a user