Update CardScroller and start using Mui Cards
This commit is contained in:
8 files changed
+381
-220
No files matched your search
@@ -2,6 +2,10 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
|
import Card from "@mui/material/Card";
|
||||||
|
import CardContent from "@mui/material/CardContent";
|
||||||
|
import CardMedia from "@mui/material/CardMedia";
|
||||||
|
import CardActionArea from "@mui/material/CardActionArea";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -13,43 +17,43 @@ import "./card.module.scss";
|
|||||||
|
|
||||||
export const CardLandscape = ({ itemName, itemId, imageTags, iconType }) => {
|
export const CardLandscape = ({ itemName, itemId, imageTags, iconType }) => {
|
||||||
const imageAvailable = () => {
|
const imageAvailable = () => {
|
||||||
console.log(imageTags);
|
if (imageTags == {}) {
|
||||||
if (imageTags == undefined) {
|
|
||||||
console.log("hee");
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
console.log("hee");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
console.log(!!imageTags.Primary);
|
||||||
return (
|
return (
|
||||||
<div className="card landscape">
|
<Card className="card landscape">
|
||||||
<div className="card-image-container">
|
<CardActionArea>
|
||||||
{imageAvailable ? (
|
{imageTags ? (
|
||||||
<div
|
<CardMedia
|
||||||
className="card-image"
|
component="img"
|
||||||
style={{
|
image={
|
||||||
backgroundImage:
|
|
||||||
"url('" +
|
|
||||||
window.api.basePath +
|
window.api.basePath +
|
||||||
"/Items/" +
|
"/Items/" +
|
||||||
itemId +
|
itemId +
|
||||||
"/Images/Primary')",
|
"/Images/Primary"
|
||||||
}}
|
}
|
||||||
></div>
|
// alt={MediaCollectionTypeIconCollectionCard[iconType]}
|
||||||
|
alt={itemName}
|
||||||
|
className="card-image-container"
|
||||||
|
></CardMedia>
|
||||||
) : (
|
) : (
|
||||||
<div className="card-image empty"></div>
|
<CardMedia className="card-image-container">
|
||||||
)}
|
|
||||||
<div className="card-image-icon-container">
|
|
||||||
{MediaCollectionTypeIconCollectionCard[iconType]}
|
{MediaCollectionTypeIconCollectionCard[iconType]}
|
||||||
</div>
|
</CardMedia>
|
||||||
</div>
|
)}
|
||||||
|
|
||||||
<div className="card-text-container">
|
<div className="card-text-container">
|
||||||
<Typography variant="button" color="white">
|
<Typography variant="button" color="white">
|
||||||
{itemName}
|
{itemName}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</CardActionArea>
|
||||||
|
</Card>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
|
|
||||||
import { useRef, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
import Carousel from "react-multi-carousel";
|
import Carousel from "react-multi-carousel";
|
||||||
@@ -10,41 +10,13 @@ import { MdiChevronLeft } from "../icons/mdiChevronLeft";
|
|||||||
import { MdiChevronRight } from "../icons/mdiChevronRight";
|
import { MdiChevronRight } from "../icons/mdiChevronRight";
|
||||||
|
|
||||||
import { styled } from "@mui/material/styles";
|
import { styled } from "@mui/material/styles";
|
||||||
import Button from "@mui/material/Button";
|
import IconButton from "@mui/material/IconButton";
|
||||||
|
import Box from "@mui/material/Box";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
import ButtonGroup from "@mui/material/ButtonGroup";
|
import ButtonGroup from "@mui/material/ButtonGroup";
|
||||||
|
|
||||||
import "./cardScroller.module.scss";
|
import "./cardScroller.module.scss";
|
||||||
|
export const CardScroller = ({ children, displayCards, title }) => {
|
||||||
const CarouselButton = styled(Button)(() => ({
|
|
||||||
color: "white",
|
|
||||||
height: "100%",
|
|
||||||
}));
|
|
||||||
|
|
||||||
const SliderButtonRight = ({ onClick }) => {
|
|
||||||
return (
|
|
||||||
<CarouselButton
|
|
||||||
onClick={() => onClick()}
|
|
||||||
className="card-scroller-button right"
|
|
||||||
variant="text"
|
|
||||||
>
|
|
||||||
<MdiChevronRight />
|
|
||||||
</CarouselButton>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const SliderButtonLeft = ({ onClick }) => {
|
|
||||||
return (
|
|
||||||
<CarouselButton
|
|
||||||
onClick={() => onClick()}
|
|
||||||
className="card-scroller-button left"
|
|
||||||
variant="text"
|
|
||||||
>
|
|
||||||
<MdiChevronLeft />
|
|
||||||
</CarouselButton>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const CardScroller = ({ children, displayCards }) => {
|
|
||||||
const responsive = {
|
const responsive = {
|
||||||
desktop: {
|
desktop: {
|
||||||
breakpoint: { max: 3000, min: 1024 },
|
breakpoint: { max: 3000, min: 1024 },
|
||||||
@@ -63,21 +35,51 @@ export const CardScroller = ({ children, displayCards }) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [carouselRef, setCarouselRef] = useState();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<Box className="card-scroller-container">
|
||||||
|
<Box sx={{ mb: 2 }} className="card-scroller-header-container">
|
||||||
|
<Typography
|
||||||
|
variant="h4"
|
||||||
|
color="textPrimary"
|
||||||
|
className="card-scroller-heading"
|
||||||
|
>
|
||||||
|
<div className="card-scroller-heading-decoration"></div>{" "}
|
||||||
|
{title}
|
||||||
|
</Typography>
|
||||||
|
<ButtonGroup className="card-scroller-button-group">
|
||||||
|
<IconButton
|
||||||
|
className="card-scroller-button"
|
||||||
|
onClick={() => carouselRef.previous()}
|
||||||
|
>
|
||||||
|
<MdiChevronLeft />
|
||||||
|
</IconButton>
|
||||||
|
<IconButton
|
||||||
|
className="card-scroller-button"
|
||||||
|
onClick={() => carouselRef.next()}
|
||||||
|
>
|
||||||
|
<MdiChevronRight />
|
||||||
|
</IconButton>
|
||||||
|
</ButtonGroup>
|
||||||
|
</Box>
|
||||||
<Carousel
|
<Carousel
|
||||||
swipeable={false}
|
swipeable={false}
|
||||||
draggable={false}
|
draggable={false}
|
||||||
responsive={responsive}
|
responsive={responsive}
|
||||||
arrows={true}
|
arrows={false}
|
||||||
customRightArrow={<SliderButtonRight />}
|
ref={(el) => setCarouselRef(el)}
|
||||||
customLeftArrow={<SliderButtonLeft />}
|
// customButtonGroup={<HomeSectionHeader />}
|
||||||
|
// renderButtonGroupOutside={true}
|
||||||
className="card-scroller"
|
className="card-scroller"
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</Carousel>
|
</Carousel>
|
||||||
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
CardScroller.propTypes = {
|
CardScroller.propTypes = {
|
||||||
displayCards: PropTypes.number.isRequired,
|
displayCards: PropTypes.number.isRequired,
|
||||||
|
title: PropTypes.string.isRequired,
|
||||||
};
|
};
|
||||||
@@ -7,23 +7,25 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
&-button {
|
&-button {
|
||||||
color: white;
|
aspect-ratio: 1;
|
||||||
position: absolute !important;
|
|
||||||
top: 49%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
background-color: $clr-background-dark !important;
|
|
||||||
border-radius: $border-radius-intensity-1 !important;
|
|
||||||
opacity: 0;
|
|
||||||
transition: opacity $transition-time-default !important;
|
|
||||||
&:hover,
|
|
||||||
&:focus {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
}
|
||||||
&.right {
|
&-header-container {
|
||||||
right: 0%;
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
&.left {
|
&-heading {
|
||||||
left: 0%;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
gap: 0.35em;
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 0.25em !important;
|
||||||
|
&-decoration {
|
||||||
|
width: 0.75em;
|
||||||
|
height: 3px;
|
||||||
|
background: white;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/** @format */
|
||||||
|
import Skeleton from "@mui/material/Skeleton";
|
||||||
|
import Paper from "@mui/material/Paper";
|
||||||
|
import Box from "@mui/material/Box";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
import { theme } from "../../theme";
|
||||||
|
export const CarouselSkeleton = () => {
|
||||||
|
return (
|
||||||
|
<Paper
|
||||||
|
className="hero-carousel-slide"
|
||||||
|
sx={{
|
||||||
|
background: theme.palette.primary.background.dark,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className="hero-carousel-background">
|
||||||
|
<Skeleton
|
||||||
|
variant="rectangular"
|
||||||
|
height="100%"
|
||||||
|
animation="wave"
|
||||||
|
></Skeleton>
|
||||||
|
</div>
|
||||||
|
<Box className="hero-carousel-detail">
|
||||||
|
<Typography variant="h3" className="hero-carousel-text">
|
||||||
|
<Skeleton
|
||||||
|
variant="text"
|
||||||
|
sx={{ fontSize: "5rem" }}
|
||||||
|
width={300}
|
||||||
|
animation="wave"
|
||||||
|
></Skeleton>
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="p" className="hero-carousel-text">
|
||||||
|
<Skeleton
|
||||||
|
variant="text"
|
||||||
|
sx={{ fontSize: "3rem" }}
|
||||||
|
width={400}
|
||||||
|
animation="wave"
|
||||||
|
></Skeleton>
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
</Paper>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -89,19 +89,3 @@
|
|||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-section {
|
|
||||||
&-heading {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-start;
|
|
||||||
gap: 0.35em;
|
|
||||||
position: relative;
|
|
||||||
margin-bottom: 0.25em !important;
|
|
||||||
&-decoration {
|
|
||||||
width: 0.75em;
|
|
||||||
height: 3px;
|
|
||||||
background: white;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+195
-133
@@ -38,11 +38,13 @@ import { showSidemenu } from "../../utils/slice/sidemenu";
|
|||||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||||
|
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import { formateDate } from "../../utils/date/formateDate";
|
import { formateDate } from "../../utils/date/formateDate";
|
||||||
import { getRuntime } from "../../utils/date/time";
|
import { getRuntime } from "../../utils/date/time";
|
||||||
|
import { CarouselSkeleton } from "../../components/skeleton/carousel";
|
||||||
|
|
||||||
export const Home = () => {
|
export const Home = () => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@@ -97,6 +99,48 @@ export const Home = () => {
|
|||||||
enabled: !!user.data,
|
enabled: !!user.data,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const resumeItemsVideo = useQuery({
|
||||||
|
queryKey: ["home", "resume", "video"],
|
||||||
|
queryFn: async () => {
|
||||||
|
const resumeItems = await getItemsApi(window.api).getResumeItems(
|
||||||
|
{
|
||||||
|
userId: user.data.Id,
|
||||||
|
limit: 16,
|
||||||
|
mediaTypes: ["Video"],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return resumeItems.data;
|
||||||
|
},
|
||||||
|
enabled: !!user.data,
|
||||||
|
});
|
||||||
|
|
||||||
|
const resumeItemsAudio = useQuery({
|
||||||
|
queryKey: ["home", "resume", "audio"],
|
||||||
|
queryFn: async () => {
|
||||||
|
const resumeItems = await getItemsApi(window.api).getResumeItems(
|
||||||
|
{
|
||||||
|
userId: user.data.Id,
|
||||||
|
limit: 16,
|
||||||
|
mediaTypes: ["Audio"],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return resumeItems.data;
|
||||||
|
},
|
||||||
|
enabled: !!user.data,
|
||||||
|
});
|
||||||
|
|
||||||
|
const upNextItems = useQuery({
|
||||||
|
queryKey: ["home", "upNext"],
|
||||||
|
queryFn: async () => {
|
||||||
|
const upNext = await getTvShowsApi(window.api).getNextUp({
|
||||||
|
userId: user.data.Id,
|
||||||
|
limit: 16,
|
||||||
|
});
|
||||||
|
return upNext.data;
|
||||||
|
},
|
||||||
|
enabled: !!user.data,
|
||||||
|
});
|
||||||
|
|
||||||
const [userLibraries, setUserLibraries] = useState([]);
|
const [userLibraries, setUserLibraries] = useState([]);
|
||||||
const [latestMovies, setLatestMovies] = useState([]);
|
const [latestMovies, setLatestMovies] = useState([]);
|
||||||
const [Auser, setUser] = useState({
|
const [Auser, setUser] = useState({
|
||||||
@@ -109,14 +153,78 @@ export const Home = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const [layoutState, setLayoutState] = useState(null);
|
||||||
|
|
||||||
|
const layout = [
|
||||||
|
{
|
||||||
|
type: "libs",
|
||||||
|
name: "Libraries",
|
||||||
|
data: libraries.data,
|
||||||
|
// isLoading: libraries.isLoading,
|
||||||
|
isLoading: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "resumeVideo",
|
||||||
|
name: "Continue Watching",
|
||||||
|
data: resumeItemsVideo.data,
|
||||||
|
// isLoading: resumeItemsVideo.isLoading,
|
||||||
|
isLoading: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "resumeAudio",
|
||||||
|
name: "Continue Listnening",
|
||||||
|
data: resumeItemsAudio.data,
|
||||||
|
// isLoading: resumeItemsAudio.isLoading,
|
||||||
|
isLoading: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "nextup",
|
||||||
|
name: "Next Up",
|
||||||
|
data: upNextItems.data,
|
||||||
|
// isLoading: upNextItems.isLoading,
|
||||||
|
isLoading: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const excludeTypes = ["boxsets", "playlists", "livetv", "channels"];
|
const excludeTypes = ["boxsets", "playlists", "livetv", "channels"];
|
||||||
|
|
||||||
|
const getLatestMedia = async () => {
|
||||||
|
libraries.data.Items.map(async (lib) => {
|
||||||
|
// console.log(lib);
|
||||||
|
if (excludeTypes.includes(lib.CollectionType)) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
let latmedia = await getUserLibraryApi(
|
||||||
|
window.api,
|
||||||
|
).getLatestMedia({
|
||||||
|
userId: user.data.Id,
|
||||||
|
parentId: lib.Id,
|
||||||
|
limit: 16,
|
||||||
|
});
|
||||||
|
layout.push({
|
||||||
|
type: "latestMedia",
|
||||||
|
name: `Latest ${lib.Name}`,
|
||||||
|
data: latmedia.data,
|
||||||
|
isLoading: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const handleLogout = async () => {
|
const handleLogout = async () => {
|
||||||
await window.api.logout();
|
await window.api.logout();
|
||||||
navigate("/login");
|
navigate("/login");
|
||||||
console.log("logged out user");
|
console.log("logged out user");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (libraries.isSuccess) {
|
||||||
|
getLatestMedia();
|
||||||
|
setLayoutState(layout);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box
|
<Box
|
||||||
@@ -124,71 +232,6 @@ export const Home = () => {
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* <MuiDrawer
|
|
||||||
anchor="left"
|
|
||||||
open={drawerState}
|
|
||||||
onClose={handleDrawerClose}
|
|
||||||
>
|
|
||||||
<DrawerHeader
|
|
||||||
className="Mui-DrawerHeader"
|
|
||||||
sx={{ position: "relative", height: "20vh" }}
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<Avatar src={""}/>
|
|
||||||
<Typography variant="h3">
|
|
||||||
{user["Name"]}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
<IconButton
|
|
||||||
onClick={handleDrawerClose}
|
|
||||||
sx={{
|
|
||||||
position: "absolute",
|
|
||||||
top: "10%",
|
|
||||||
right: "5%",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Close />
|
|
||||||
</IconButton>
|
|
||||||
</DrawerHeader>
|
|
||||||
<Divider />
|
|
||||||
<List sx={{ border: "none" }}>
|
|
||||||
{userLibraries.map((library, index) => {
|
|
||||||
return (
|
|
||||||
<ListItem disablePadding key={index}>
|
|
||||||
<ListItemButton
|
|
||||||
sx={{
|
|
||||||
minHeight: 48,
|
|
||||||
justifyContent:
|
|
||||||
drawerState
|
|
||||||
? "initial"
|
|
||||||
: "center",
|
|
||||||
px: 2.5,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ListItemIcon
|
|
||||||
sx={{
|
|
||||||
minWidth: 0,
|
|
||||||
mr: 3,
|
|
||||||
justifyContent:
|
|
||||||
"center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{
|
|
||||||
MediaCollectionTypeIconCollection[
|
|
||||||
library
|
|
||||||
.CollectionType
|
|
||||||
]
|
|
||||||
}
|
|
||||||
</ListItemIcon>
|
|
||||||
<ListItemText
|
|
||||||
primary={library.Name}
|
|
||||||
/>
|
|
||||||
</ListItemButton>
|
|
||||||
</ListItem>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</List>
|
|
||||||
</MuiDrawer> */}
|
|
||||||
<Box
|
<Box
|
||||||
component="main"
|
component="main"
|
||||||
className="scrollY"
|
className="scrollY"
|
||||||
@@ -227,46 +270,7 @@ export const Home = () => {
|
|||||||
interval={10000}
|
interval={10000}
|
||||||
>
|
>
|
||||||
{latestMedia.isLoading ? (
|
{latestMedia.isLoading ? (
|
||||||
<Paper
|
<CarouselSkeleton />
|
||||||
className="hero-carousel-slide"
|
|
||||||
sx={{
|
|
||||||
background:
|
|
||||||
theme.palette.primary
|
|
||||||
.background.dark,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className="hero-carousel-background">
|
|
||||||
<Skeleton
|
|
||||||
variant="rectangular"
|
|
||||||
height="100%"
|
|
||||||
animation="wave"
|
|
||||||
></Skeleton>
|
|
||||||
</div>
|
|
||||||
<Box className="hero-carousel-detail">
|
|
||||||
<Typography
|
|
||||||
variant="h3"
|
|
||||||
className="hero-carousel-text"
|
|
||||||
>
|
|
||||||
<Skeleton
|
|
||||||
variant="text"
|
|
||||||
sx={{ fontSize: "5rem" }}
|
|
||||||
width={300}
|
|
||||||
animation="wave"
|
|
||||||
></Skeleton>
|
|
||||||
</Typography>
|
|
||||||
<Typography
|
|
||||||
variant="p"
|
|
||||||
className="hero-carousel-text"
|
|
||||||
>
|
|
||||||
<Skeleton
|
|
||||||
variant="text"
|
|
||||||
sx={{ fontSize: "3rem" }}
|
|
||||||
width={400}
|
|
||||||
animation="wave"
|
|
||||||
></Skeleton>
|
|
||||||
</Typography>
|
|
||||||
</Box>
|
|
||||||
</Paper>
|
|
||||||
) : (
|
) : (
|
||||||
// <></>
|
// <></>
|
||||||
latestMedia.data != null &&
|
latestMedia.data != null &&
|
||||||
@@ -465,8 +469,25 @@ export const Home = () => {
|
|||||||
})
|
})
|
||||||
)}
|
)}
|
||||||
</Carousel>
|
</Carousel>
|
||||||
|
<CardScroller displayCards={4} title={"Libraries"}>
|
||||||
|
{libraries.isLoading == false &&
|
||||||
|
libraries.data.Items.map((item, index) => {
|
||||||
|
return (
|
||||||
|
<CardLandscape
|
||||||
|
key={index}
|
||||||
|
itemName={item.Name}
|
||||||
|
itemId={item.Id}
|
||||||
|
// imageTags={false}
|
||||||
|
imageTags={
|
||||||
|
!!item.ImageTags.Primary
|
||||||
|
}
|
||||||
|
iconType={item.CollectionType}
|
||||||
|
></CardLandscape>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</CardScroller>
|
||||||
|
|
||||||
<Box className="home-section">
|
{/* <Box className="home-section">
|
||||||
<Typography
|
<Typography
|
||||||
variant="h4"
|
variant="h4"
|
||||||
color="textPrimary"
|
color="textPrimary"
|
||||||
@@ -491,32 +512,7 @@ export const Home = () => {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
</Box>
|
</Box> */}
|
||||||
|
|
||||||
<Box className="home-section">
|
|
||||||
<Typography
|
|
||||||
variant="h4"
|
|
||||||
color="textPrimary"
|
|
||||||
className="home-section-heading"
|
|
||||||
>
|
|
||||||
<div className="home-section-heading-decoration"></div>{" "}
|
|
||||||
Latest Movies
|
|
||||||
</Typography>
|
|
||||||
<CardScroller displayCards={7}>
|
|
||||||
{latestMovies.map((movie, index) => {
|
|
||||||
return (
|
|
||||||
<CardPotrait
|
|
||||||
key={index}
|
|
||||||
itemName={movie.Name}
|
|
||||||
itemId={movie.Id}
|
|
||||||
imageTags={movie.imageTags}
|
|
||||||
iconType={movie.MediaType}
|
|
||||||
></CardPotrait>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</CardScroller>
|
|
||||||
</Box>
|
|
||||||
|
|
||||||
<Button variant="contained" onClick={handleLogout}>
|
<Button variant="contained" onClick={handleLogout}>
|
||||||
Logout
|
Logout
|
||||||
</Button>
|
</Button>
|
||||||
@@ -525,3 +521,69 @@ export const Home = () => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* <MuiDrawer
|
||||||
|
anchor="left"
|
||||||
|
open={drawerState}
|
||||||
|
onClose={handleDrawerClose}
|
||||||
|
>
|
||||||
|
<DrawerHeader
|
||||||
|
className="Mui-DrawerHeader"
|
||||||
|
sx={{ position: "relative", height: "20vh" }}
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<Avatar src={""}/>
|
||||||
|
<Typography variant="h3">
|
||||||
|
{user["Name"]}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
<IconButton
|
||||||
|
onClick={handleDrawerClose}
|
||||||
|
sx={{
|
||||||
|
position: "absolute",
|
||||||
|
top: "10%",
|
||||||
|
right: "5%",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Close />
|
||||||
|
</IconButton>
|
||||||
|
</DrawerHeader>
|
||||||
|
<Divider />
|
||||||
|
<List sx={{ border: "none" }}>
|
||||||
|
{userLibraries.map((library, index) => {
|
||||||
|
return (
|
||||||
|
<ListItem disablePadding key={index}>
|
||||||
|
<ListItemButton
|
||||||
|
sx={{
|
||||||
|
minHeight: 48,
|
||||||
|
justifyContent:
|
||||||
|
drawerState
|
||||||
|
? "initial"
|
||||||
|
: "center",
|
||||||
|
px: 2.5,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ListItemIcon
|
||||||
|
sx={{
|
||||||
|
minWidth: 0,
|
||||||
|
mr: 3,
|
||||||
|
justifyContent:
|
||||||
|
"center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
MediaCollectionTypeIconCollection[
|
||||||
|
library
|
||||||
|
.CollectionType
|
||||||
|
]
|
||||||
|
}
|
||||||
|
</ListItemIcon>
|
||||||
|
<ListItemText
|
||||||
|
primary={library.Name}
|
||||||
|
/>
|
||||||
|
</ListItemButton>
|
||||||
|
</ListItem>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</List>
|
||||||
|
</MuiDrawer> */
|
||||||
@@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
import { configureStore } from "@reduxjs/toolkit";
|
import { configureStore } from "@reduxjs/toolkit";
|
||||||
import sideBarReducer from "./utils/slice/sidemenu";
|
import sideBarReducer from "./utils/slice/sidemenu";
|
||||||
|
import homePageReducer from "./utils/slice/homePage";
|
||||||
|
|
||||||
export default configureStore({
|
export default configureStore({
|
||||||
reducer: {
|
reducer: {
|
||||||
sidebar: sideBarReducer,
|
sidebar: sideBarReducer,
|
||||||
|
homePage: homePageReducer,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import { createSlice } from "@reduxjs/toolkit";
|
||||||
|
|
||||||
|
export const homePageSlice = createSlice({
|
||||||
|
name: "homePage",
|
||||||
|
initialState: [
|
||||||
|
{
|
||||||
|
type: "libs",
|
||||||
|
name: "Libraries",
|
||||||
|
data: [],
|
||||||
|
// isLoading: libraries.isLoading,
|
||||||
|
isLoading: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "resumeVideo",
|
||||||
|
name: "Continue Watching",
|
||||||
|
data: [],
|
||||||
|
// isLoading: resumeItemsVideo.isLoading,
|
||||||
|
isLoading: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "resumeAudio",
|
||||||
|
name: "Continue Listnening",
|
||||||
|
data: [],
|
||||||
|
// isLoading: resumeItemsAudio.isLoading,
|
||||||
|
isLoading: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "nextup",
|
||||||
|
name: "Next Up",
|
||||||
|
data: [],
|
||||||
|
// isLoading: upNextItems.isLoading,
|
||||||
|
isLoading: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
reducers: {
|
||||||
|
setData: (state, action) => {
|
||||||
|
switch (action.payload[0]) {
|
||||||
|
case "libs":
|
||||||
|
state[0].data = action.payload[1];
|
||||||
|
break;
|
||||||
|
case "resumeVideo":
|
||||||
|
state[1].data = action.payload[1];
|
||||||
|
break;
|
||||||
|
case "resumeAudio":
|
||||||
|
state[2].data = action.payload[1];
|
||||||
|
break;
|
||||||
|
case "nextup":
|
||||||
|
state[3].data = action.payload[1];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addLatestMedia: (state, action) => {
|
||||||
|
state.push(action.payload);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const { setData, addLatestMedia } = homePageSlice.actions;
|
||||||
|
export default homePageSlice.reducer;
|
||||||
Reference in new issue
Block a user