Update CardScroller and start using Mui Cards
This commit is contained in:
8 files changed
+399
-238
No files matched your search
@@ -2,6 +2,10 @@
|
||||
import React from "react";
|
||||
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 {
|
||||
@@ -13,43 +17,43 @@ import "./card.module.scss";
|
||||
|
||||
export const CardLandscape = ({ itemName, itemId, imageTags, iconType }) => {
|
||||
const imageAvailable = () => {
|
||||
console.log(imageTags);
|
||||
if (imageTags == undefined) {
|
||||
console.log("hee");
|
||||
if (imageTags == {}) {
|
||||
return false;
|
||||
} else {
|
||||
console.log("hee");
|
||||
return true;
|
||||
}
|
||||
};
|
||||
console.log(!!imageTags.Primary);
|
||||
return (
|
||||
<div className="card landscape">
|
||||
<div className="card-image-container">
|
||||
{imageAvailable ? (
|
||||
<div
|
||||
className="card-image"
|
||||
style={{
|
||||
backgroundImage:
|
||||
"url('" +
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
itemId +
|
||||
"/Images/Primary')",
|
||||
}}
|
||||
></div>
|
||||
<Card className="card landscape">
|
||||
<CardActionArea>
|
||||
{imageTags ? (
|
||||
<CardMedia
|
||||
component="img"
|
||||
image={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
itemId +
|
||||
"/Images/Primary"
|
||||
}
|
||||
// alt={MediaCollectionTypeIconCollectionCard[iconType]}
|
||||
alt={itemName}
|
||||
className="card-image-container"
|
||||
></CardMedia>
|
||||
) : (
|
||||
<div className="card-image empty"></div>
|
||||
<CardMedia className="card-image-container">
|
||||
{MediaCollectionTypeIconCollectionCard[iconType]}
|
||||
</CardMedia>
|
||||
)}
|
||||
<div className="card-image-icon-container">
|
||||
{MediaCollectionTypeIconCollectionCard[iconType]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="card-text-container">
|
||||
<Typography variant="button" color="white">
|
||||
{itemName}
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
<div className="card-text-container">
|
||||
<Typography variant="button" color="white">
|
||||
{itemName}
|
||||
</Typography>
|
||||
</div>
|
||||
</CardActionArea>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @format */
|
||||
|
||||
import { useRef, useEffect } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Carousel from "react-multi-carousel";
|
||||
@@ -10,41 +10,13 @@ import { MdiChevronLeft } from "../icons/mdiChevronLeft";
|
||||
import { MdiChevronRight } from "../icons/mdiChevronRight";
|
||||
|
||||
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 "./cardScroller.module.scss";
|
||||
|
||||
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 }) => {
|
||||
export const CardScroller = ({ children, displayCards, title }) => {
|
||||
const responsive = {
|
||||
desktop: {
|
||||
breakpoint: { max: 3000, min: 1024 },
|
||||
@@ -63,21 +35,51 @@ export const CardScroller = ({ children, displayCards }) => {
|
||||
},
|
||||
};
|
||||
|
||||
const [carouselRef, setCarouselRef] = useState();
|
||||
|
||||
return (
|
||||
<Carousel
|
||||
swipeable={false}
|
||||
draggable={false}
|
||||
responsive={responsive}
|
||||
arrows={true}
|
||||
customRightArrow={<SliderButtonRight />}
|
||||
customLeftArrow={<SliderButtonLeft />}
|
||||
className="card-scroller"
|
||||
>
|
||||
{children}
|
||||
</Carousel>
|
||||
<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
|
||||
swipeable={false}
|
||||
draggable={false}
|
||||
responsive={responsive}
|
||||
arrows={false}
|
||||
ref={(el) => setCarouselRef(el)}
|
||||
// customButtonGroup={<HomeSectionHeader />}
|
||||
// renderButtonGroupOutside={true}
|
||||
className="card-scroller"
|
||||
>
|
||||
{children}
|
||||
</Carousel>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
CardScroller.propTypes = {
|
||||
displayCards: PropTypes.number.isRequired,
|
||||
title: PropTypes.string.isRequired,
|
||||
};
|
||||
@@ -7,23 +7,25 @@
|
||||
display: flex;
|
||||
}
|
||||
&-button {
|
||||
color: white;
|
||||
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 {
|
||||
right: 0%;
|
||||
}
|
||||
&.left {
|
||||
left: 0%;
|
||||
aspect-ratio: 1;
|
||||
}
|
||||
&-header-container {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
&-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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
.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 { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-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 { formateDate } from "../../utils/date/formateDate";
|
||||
import { getRuntime } from "../../utils/date/time";
|
||||
import { CarouselSkeleton } from "../../components/skeleton/carousel";
|
||||
|
||||
export const Home = () => {
|
||||
const queryClient = useQueryClient();
|
||||
@@ -97,6 +99,48 @@ export const Home = () => {
|
||||
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 [latestMovies, setLatestMovies] = useState([]);
|
||||
const [Auser, setUser] = useState({
|
||||
@@ -109,14 +153,78 @@ export const Home = () => {
|
||||
});
|
||||
|
||||
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 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 () => {
|
||||
await window.api.logout();
|
||||
navigate("/login");
|
||||
console.log("logged out user");
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (libraries.isSuccess) {
|
||||
getLatestMedia();
|
||||
setLayoutState(layout);
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box
|
||||
@@ -124,71 +232,6 @@ export const Home = () => {
|
||||
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
|
||||
component="main"
|
||||
className="scrollY"
|
||||
@@ -227,46 +270,7 @@ export const Home = () => {
|
||||
interval={10000}
|
||||
>
|
||||
{latestMedia.isLoading ? (
|
||||
<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>
|
||||
<CarouselSkeleton />
|
||||
) : (
|
||||
// <></>
|
||||
latestMedia.data != null &&
|
||||
@@ -465,8 +469,25 @@ export const Home = () => {
|
||||
})
|
||||
)}
|
||||
</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
|
||||
variant="h4"
|
||||
color="textPrimary"
|
||||
@@ -491,32 +512,7 @@ export const Home = () => {
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
</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>
|
||||
|
||||
</Box> */}
|
||||
<Button variant="contained" onClick={handleLogout}>
|
||||
Logout
|
||||
</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 sideBarReducer from "./utils/slice/sidemenu";
|
||||
import homePageReducer from "./utils/slice/homePage";
|
||||
|
||||
export default configureStore({
|
||||
reducer: {
|
||||
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