Start working on new library page #176
This commit is contained in:
2 files changed
+75
-462
No files matched your search
+61
-462
@@ -387,8 +387,6 @@ const LibraryView = () => {
|
|||||||
queryFn: () => fetchLibItems(id),
|
queryFn: () => fetchLibItems(id),
|
||||||
enabled: currentLib.isSuccess,
|
enabled: currentLib.isSuccess,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
keepPreviousData: false,
|
|
||||||
cacheTime: 0,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleCurrentViewType = (e) => {
|
const handleCurrentViewType = (e) => {
|
||||||
@@ -458,454 +456,57 @@ const LibraryView = () => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<main className="scrollY library">
|
||||||
sx={{
|
<div
|
||||||
display: "flex",
|
style={{
|
||||||
}}
|
padding: "1em 1em 1em 0.6em",
|
||||||
>
|
height: "4em",
|
||||||
<Box
|
boxShadow: "0 0px 10px 12px hsl(256, 100%, 6%)",
|
||||||
component="main"
|
zIndex: 10,
|
||||||
className="scrollY"
|
display: "flex",
|
||||||
sx={{
|
alignItems: "center",
|
||||||
flexGrow: 1,
|
justifyContent: "center",
|
||||||
pt: 19,
|
|
||||||
position: "relative",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<AppBar
|
<div
|
||||||
position="fixed"
|
style={{
|
||||||
elevation={trigger ? 1 : 0}
|
display: "flex",
|
||||||
sx={{
|
alignItems: "center",
|
||||||
width: `calc(100vw - ${theme.spacing(7)} - 10px)`,
|
width: "fit-content",
|
||||||
top: `${8 * 8}px !important`,
|
|
||||||
backdropFilter: trigger ? `blur(30px)` : "none",
|
|
||||||
background: "transparent",
|
|
||||||
backgroundColor: trigger
|
|
||||||
? `${clrBackgroundDarkOpacity0_8} !important`
|
|
||||||
: "transparent",
|
|
||||||
transition:
|
|
||||||
"transition: background-color 150ms, box-shadow 150ms, backdrop-filter 150ms !important",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Divider
|
<Typography
|
||||||
sx={{
|
variant="h5"
|
||||||
transform: trigger
|
sx={{ mr: 2, flexShrink: 0 }}
|
||||||
? "scaleX(1)"
|
noWrap
|
||||||
: "scaleX(0)",
|
>
|
||||||
transition: "transform 150ms",
|
{currentLib.isLoading ? (
|
||||||
transformOrigin: "left",
|
<CircularProgress sx={{ p: 1 }} />
|
||||||
transitionDelay: "50ms",
|
) : (
|
||||||
}}
|
currentLib.data.Items[0].Name
|
||||||
|
)}
|
||||||
|
</Typography>
|
||||||
|
<Chip
|
||||||
|
label={
|
||||||
|
items.isLoading ? (
|
||||||
|
<CircularProgress sx={{ p: 1.5 }} />
|
||||||
|
) : (
|
||||||
|
items.data.TotalRecordCount
|
||||||
|
)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<Toolbar sx={{ justifyContent: "space-between" }}>
|
</div>
|
||||||
<Stack alignItems="center" direction="row">
|
</div>
|
||||||
<Typography
|
<div
|
||||||
variant="h5"
|
style={{
|
||||||
sx={{ mr: 2, flexShrink: 0 }}
|
height: "calc(100vh - 4em)",
|
||||||
noWrap
|
overflowY: "auto",
|
||||||
>
|
overflowX: "hidden",
|
||||||
{currentLib.isLoading ? (
|
paddingBottom: "1em",
|
||||||
<CircularProgress sx={{ p: 1 }} />
|
paddingRight: "1em",
|
||||||
) : (
|
paddingTop: "15px",
|
||||||
currentLib.data.Items[0].Name
|
}}
|
||||||
)}
|
>
|
||||||
</Typography>
|
|
||||||
<Chip
|
|
||||||
label={
|
|
||||||
items.isLoading ? (
|
|
||||||
<CircularProgress
|
|
||||||
sx={{ p: 1.5 }}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
items.data.TotalRecordCount
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
|
|
||||||
{/* <InputLabel id="demo-simple-select-label">
|
|
||||||
Age
|
|
||||||
</InputLabel> */}
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
spacing={2}
|
|
||||||
divider={
|
|
||||||
<Divider
|
|
||||||
orientation="vertical"
|
|
||||||
flexItem
|
|
||||||
variant="inset"
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{currentLib.isSuccess &&
|
|
||||||
allowedFilterViews.includes(
|
|
||||||
currentLib.data.Items[0]
|
|
||||||
.CollectionType,
|
|
||||||
) && (
|
|
||||||
<>
|
|
||||||
<Button
|
|
||||||
id="basic-button"
|
|
||||||
aria-controls={
|
|
||||||
open
|
|
||||||
? "basic-menu"
|
|
||||||
: undefined
|
|
||||||
}
|
|
||||||
aria-haspopup="true"
|
|
||||||
aria-expanded={
|
|
||||||
open
|
|
||||||
? "true"
|
|
||||||
: undefined
|
|
||||||
}
|
|
||||||
startIcon={
|
|
||||||
<MdiFilterOutline />
|
|
||||||
}
|
|
||||||
endIcon={
|
|
||||||
<MdiChevronDown />
|
|
||||||
}
|
|
||||||
onClick={openFiltersMenu}
|
|
||||||
color="white"
|
|
||||||
// sx={{ p: 1 }}
|
|
||||||
// size="small"
|
|
||||||
>
|
|
||||||
Filter
|
|
||||||
</Button>
|
|
||||||
<Menu
|
|
||||||
id="basic-menu"
|
|
||||||
anchorEl={
|
|
||||||
filterButtonAnchorEl
|
|
||||||
}
|
|
||||||
open={filterMenuOpen}
|
|
||||||
onClose={
|
|
||||||
closeFiltersMenu
|
|
||||||
}
|
|
||||||
MenuListProps={{
|
|
||||||
"aria-labelledby":
|
|
||||||
"basic-button",
|
|
||||||
sx: { p: 1 },
|
|
||||||
}}
|
|
||||||
anchorOrigin={{
|
|
||||||
vertical: "bottom",
|
|
||||||
horizontal:
|
|
||||||
"center",
|
|
||||||
}}
|
|
||||||
transformOrigin={{
|
|
||||||
vertical: "top",
|
|
||||||
horizontal:
|
|
||||||
"center",
|
|
||||||
}}
|
|
||||||
sx={{
|
|
||||||
maxHeight: "55%",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Accordion>
|
|
||||||
<AccordionSummary
|
|
||||||
expandIcon={
|
|
||||||
<MdiChevronDown />
|
|
||||||
}
|
|
||||||
aria-controls="panel1bh-content"
|
|
||||||
id="panel1bh-header"
|
|
||||||
>
|
|
||||||
<Typography
|
|
||||||
sx={{
|
|
||||||
width: "33%",
|
|
||||||
flexShrink: 0,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Status
|
|
||||||
</Typography>
|
|
||||||
</AccordionSummary>
|
|
||||||
<Divider />
|
|
||||||
<AccordionDetails
|
|
||||||
sx={{
|
|
||||||
maxHeight:
|
|
||||||
"15em",
|
|
||||||
overflow:
|
|
||||||
"auto",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Stack>
|
|
||||||
{availableWatchStatus.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>
|
|
||||||
{!onlyStatusFilterViews.includes(
|
|
||||||
currentLib.data
|
|
||||||
.Items[0]
|
|
||||||
.CollectionType,
|
|
||||||
) && (
|
|
||||||
<Accordion>
|
|
||||||
<AccordionSummary
|
|
||||||
expandIcon={
|
|
||||||
<MdiChevronDown />
|
|
||||||
}
|
|
||||||
aria-controls="panel1bh-content"
|
|
||||||
id="panel1bh-header"
|
|
||||||
>
|
|
||||||
<Typography
|
|
||||||
sx={{
|
|
||||||
width: "33%",
|
|
||||||
flexShrink: 0,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Features
|
|
||||||
</Typography>
|
|
||||||
</AccordionSummary>
|
|
||||||
<Divider />
|
|
||||||
<AccordionDetails
|
|
||||||
sx={{
|
|
||||||
maxHeight:
|
|
||||||
"15em",
|
|
||||||
overflow:
|
|
||||||
"auto",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Stack>
|
|
||||||
{availableFeatureFilters.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>
|
|
||||||
)}
|
|
||||||
{!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>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{!disabledSortViews.includes(
|
|
||||||
currentViewType,
|
|
||||||
) && (
|
|
||||||
<>
|
|
||||||
{sortByData != undefined &&
|
|
||||||
sortBy != undefined && (
|
|
||||||
<>
|
|
||||||
<Checkbox
|
|
||||||
icon={
|
|
||||||
<MdiSortDescending />
|
|
||||||
}
|
|
||||||
checkedIcon={
|
|
||||||
<MdiSortAscending />
|
|
||||||
}
|
|
||||||
sx={{
|
|
||||||
color: "white !important",
|
|
||||||
}}
|
|
||||||
color="white"
|
|
||||||
onChange={
|
|
||||||
handleSortChange
|
|
||||||
}
|
|
||||||
checked={
|
|
||||||
sortAscending
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<TextField
|
|
||||||
select
|
|
||||||
hiddenLabel
|
|
||||||
value={sortBy}
|
|
||||||
size="small"
|
|
||||||
variant="filled"
|
|
||||||
onChange={
|
|
||||||
handleSortBy
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{sortByData.map(
|
|
||||||
(
|
|
||||||
item,
|
|
||||||
index,
|
|
||||||
) => {
|
|
||||||
return (
|
|
||||||
<MenuItem
|
|
||||||
key={
|
|
||||||
index
|
|
||||||
}
|
|
||||||
value={
|
|
||||||
item.value
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{`By ${item.title}`}
|
|
||||||
</MenuItem>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
)}
|
|
||||||
</TextField>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{viewType.length != 0 &&
|
|
||||||
currentViewType != undefined && (
|
|
||||||
<TextField
|
|
||||||
select
|
|
||||||
hiddenLabel
|
|
||||||
// value={viewType[0].value}
|
|
||||||
value={currentViewType}
|
|
||||||
size="small"
|
|
||||||
variant="filled"
|
|
||||||
onChange={
|
|
||||||
handleCurrentViewType
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{viewType.map(
|
|
||||||
(item, index) => {
|
|
||||||
return (
|
|
||||||
<MenuItem
|
|
||||||
key={
|
|
||||||
item.value
|
|
||||||
}
|
|
||||||
value={
|
|
||||||
item.value
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{
|
|
||||||
item.title
|
|
||||||
}
|
|
||||||
</MenuItem>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
)}
|
|
||||||
</TextField>
|
|
||||||
)}
|
|
||||||
</Stack>
|
|
||||||
</Toolbar>
|
|
||||||
</AppBar>
|
|
||||||
{items.isLoading ? (
|
{items.isLoading ? (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@@ -933,27 +534,25 @@ const LibraryView = () => {
|
|||||||
) : items.data.TotalRecordCount == 0 ? (
|
) : items.data.TotalRecordCount == 0 ? (
|
||||||
<EmptyNotice />
|
<EmptyNotice />
|
||||||
) : currentViewType != BaseItemKind.Audio ? (
|
) : currentViewType != BaseItemKind.Audio ? (
|
||||||
<Grid2 container columns={{ xs: 2, sm: 4, md: 8 }}>
|
<div className="library-grid">
|
||||||
{items.data.Items.map((item, index) => {
|
{items.data.Items.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<Grid2
|
<motion.div
|
||||||
|
style={{
|
||||||
|
width: "100%",
|
||||||
|
}}
|
||||||
key={item.Id}
|
key={item.Id}
|
||||||
xs={1}
|
|
||||||
sm={1}
|
|
||||||
md={1}
|
|
||||||
component={motion.div}
|
|
||||||
initial={{
|
initial={{
|
||||||
transform: "scale(0.8)",
|
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
|
transform: "scale(0.9)",
|
||||||
}}
|
}}
|
||||||
animate={{
|
animate={{
|
||||||
transform: "scale(1)",
|
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
|
transform: "scale(1)",
|
||||||
}}
|
}}
|
||||||
transition={{
|
transition={{
|
||||||
duration: 0.25,
|
duration: 0.2,
|
||||||
ease: "easeInOut",
|
ease: "anticipate",
|
||||||
delay: 0.02 * index,
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Card
|
<Card
|
||||||
@@ -1048,10 +647,10 @@ const LibraryView = () => {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
></Card>
|
></Card>
|
||||||
</Grid2>
|
</motion.div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</Grid2>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<TableContainer>
|
<TableContainer>
|
||||||
<Table>
|
<Table>
|
||||||
@@ -1176,7 +775,7 @@ const LibraryView = () => {
|
|||||||
</TableContainer>
|
</TableContainer>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!items.isFetching &&
|
{!items.isLoading &&
|
||||||
!disablePaginationViews.includes(currentViewType) &&
|
!disablePaginationViews.includes(currentViewType) &&
|
||||||
items.isSuccess &&
|
items.isSuccess &&
|
||||||
items.data.TotalRecordCount > maxDisplayItems && (
|
items.data.TotalRecordCount > maxDisplayItems && (
|
||||||
@@ -1212,10 +811,10 @@ const LibraryView = () => {
|
|||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
{items.isError && <ErrorNotice />}
|
{items.isError && <ErrorNotice />}
|
||||||
</Box>
|
</main>
|
||||||
</Box>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -34,3 +34,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.library {
|
||||||
|
padding: 0 !important;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
&-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(8, minmax(0, 1fr));
|
||||||
|
justify-items: center;
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user