Update
This commit is contained in:
7 files changed
+919
-883
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 289 KiB |
Generated
+773
-819
File diff suppressed because it is too large.
Load diff
+3
-1
@@ -19,6 +19,7 @@ import { EventEmitter as event } from "./eventEmitter.js";
|
|||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
|
|
||||||
// Theming
|
// Theming
|
||||||
|
import CssBaseline from "@mui/material/CssBaseline";
|
||||||
import { theme } from "./theme";
|
import { theme } from "./theme";
|
||||||
import "./styles/global.scss";
|
import "./styles/global.scss";
|
||||||
|
|
||||||
@@ -97,7 +98,7 @@ const AnimationWrapper = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function App() {
|
function App({ hideLoader }) {
|
||||||
const [userCookies] = useCookies(["user"]);
|
const [userCookies] = useCookies(["user"]);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
@@ -169,6 +170,7 @@ function App() {
|
|||||||
<SnackbarProvider maxSnack={5}>
|
<SnackbarProvider maxSnack={5}>
|
||||||
<ThemeProvider theme={theme}>
|
<ThemeProvider theme={theme}>
|
||||||
<AnimatePresence>
|
<AnimatePresence>
|
||||||
|
<CssBaseline />
|
||||||
<Routes key={location.pathname} location={location}>
|
<Routes key={location.pathname} location={location}>
|
||||||
<Route element={<AnimationWrapper />}>
|
<Route element={<AnimationWrapper />}>
|
||||||
{/* Main Routes */}
|
{/* Main Routes */}
|
||||||
|
|||||||
@@ -66,6 +66,10 @@ export const AvatarImage = ({ userId }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const AvatarSideMenu = ({ userName }) => {
|
||||||
|
return <div></div>;
|
||||||
|
};
|
||||||
|
|
||||||
AvatarCard.propType = {
|
AvatarCard.propType = {
|
||||||
userName: PropTypes.string.isRequired,
|
userName: PropTypes.string.isRequired,
|
||||||
userId: PropTypes.string.isRequired,
|
userId: PropTypes.string.isRequired,
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
&-image {
|
&-image {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
z-index: 0;
|
z-index: 1;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
|
|||||||
+134
-62
@@ -40,30 +40,10 @@ import Close from "mdi-material-ui/Close";
|
|||||||
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";
|
||||||
|
|
||||||
const drawerWidth = 320;
|
const drawerWidth = 320;
|
||||||
|
|
||||||
const openedMixin = (theme) => ({
|
|
||||||
width: drawerWidth,
|
|
||||||
transition: theme.transitions.create("width", {
|
|
||||||
easing: theme.transitions.easing.sharp,
|
|
||||||
duration: theme.transitions.duration.enteringScreen,
|
|
||||||
}),
|
|
||||||
overflowX: "hidden",
|
|
||||||
});
|
|
||||||
|
|
||||||
const closedMixin = (theme) => ({
|
|
||||||
transition: theme.transitions.create("width", {
|
|
||||||
easing: theme.transitions.easing.sharp,
|
|
||||||
duration: theme.transitions.duration.leavingScreen,
|
|
||||||
}),
|
|
||||||
overflowX: "hidden",
|
|
||||||
width: `calc(${theme.spacing(7)} + 1px)`,
|
|
||||||
[theme.breakpoints.up("sm")]: {
|
|
||||||
width: `calc(${theme.spacing(8)} + 1px)`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const DrawerHeader = styled("div")(({ theme }) => ({
|
const DrawerHeader = styled("div")(({ theme }) => ({
|
||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
@@ -73,27 +53,20 @@ const DrawerHeader = styled("div")(({ theme }) => ({
|
|||||||
...theme.mixins.toolbar,
|
...theme.mixins.toolbar,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const Drawer = styled(MuiDrawer, {
|
const MiniDrawer = styled(MuiDrawer, {
|
||||||
shouldForwardProp: (prop) => prop !== "open",
|
shouldForwardProp: (prop) => prop !== "open",
|
||||||
})(({ theme, open }) => ({
|
})(({ theme }) => ({
|
||||||
width: drawerWidth,
|
|
||||||
flexShrink: 0,
|
flexShrink: 0,
|
||||||
whiteSpace: "nowrap",
|
whiteSpace: "nowrap",
|
||||||
boxSizing: "border-box",
|
boxSizing: "border-box",
|
||||||
backgroundColor: theme.palette.primary.background.dark,
|
backgroundColor: theme.palette.primary.background.dark,
|
||||||
...(open && {
|
overflowX: "hidden",
|
||||||
...openedMixin(theme),
|
width: `calc(${theme.spacing(7)} + 1px)`,
|
||||||
"& .MuiDrawer-paper": openedMixin(theme),
|
|
||||||
}),
|
|
||||||
...(!open && {
|
|
||||||
...closedMixin(theme),
|
|
||||||
"& .MuiDrawer-paper": closedMixin(theme),
|
|
||||||
}),
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const AppBar = styled(MuiAppBar, {
|
const AppBar = styled(MuiAppBar, {
|
||||||
shouldForwardProp: (prop) => prop !== "open",
|
shouldForwardProp: (prop) => prop !== "open",
|
||||||
})(({ theme, open }) => ({
|
})(({ theme }) => ({
|
||||||
zIndex: theme.zIndex.drawer + 1,
|
zIndex: theme.zIndex.drawer + 1,
|
||||||
transition: theme.transitions.create(["width", "margin"], {
|
transition: theme.transitions.create(["width", "margin"], {
|
||||||
easing: theme.transitions.easing.sharp,
|
easing: theme.transitions.easing.sharp,
|
||||||
@@ -101,14 +74,6 @@ const AppBar = styled(MuiAppBar, {
|
|||||||
}),
|
}),
|
||||||
backgroundColor: "transparent",
|
backgroundColor: "transparent",
|
||||||
backgroundImage: "none",
|
backgroundImage: "none",
|
||||||
...(open && {
|
|
||||||
marginLeft: drawerWidth,
|
|
||||||
width: `calc(100% - ${drawerWidth}px)`,
|
|
||||||
transition: theme.transitions.create(["width", "margin"], {
|
|
||||||
easing: theme.transitions.easing.sharp,
|
|
||||||
duration: theme.transitions.duration.enteringScreen,
|
|
||||||
}),
|
|
||||||
}),
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const Home = () => {
|
export const Home = () => {
|
||||||
@@ -120,6 +85,11 @@ export const Home = () => {
|
|||||||
const [user, setUser] = useState({
|
const [user, setUser] = useState({
|
||||||
Name: "",
|
Name: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const excludeTypes = ["boxsets", "playlists", "livetv", "channels"];
|
||||||
|
|
||||||
|
// const [lestMediaTypes, setLatestMediaTypes] = useState([]);
|
||||||
|
const [latestMediaLibs, setLatestMediaLibs] = useState([]);
|
||||||
const [latestMedia, setLatestMedia] = useState([]);
|
const [latestMedia, setLatestMedia] = useState([]);
|
||||||
|
|
||||||
const [drawerState, setDrawerState] = useState(false);
|
const [drawerState, setDrawerState] = useState(false);
|
||||||
@@ -159,34 +129,79 @@ export const Home = () => {
|
|||||||
return media;
|
return media;
|
||||||
};
|
};
|
||||||
const getLatestMovies = async (user) => {
|
const getLatestMovies = async (user) => {
|
||||||
const media = await getUserLibraryApi(window.api).getLatestMedia({
|
let latest = [];
|
||||||
|
for (const parentid of latestMediaLibs) {
|
||||||
|
let media = (
|
||||||
|
await getUserLibraryApi(window.api).getLatestMedia({
|
||||||
userId: user.Id,
|
userId: user.Id,
|
||||||
|
limit: 16,
|
||||||
fields: ["PrimaryImageAspectRatio", "Overview"],
|
fields: ["PrimaryImageAspectRatio", "Overview"],
|
||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
includeItemTypes: ["Movie"],
|
parentId: parentid,
|
||||||
|
})
|
||||||
|
).data;
|
||||||
|
latest.push({
|
||||||
|
name: "Latest Media",
|
||||||
|
data: media,
|
||||||
});
|
});
|
||||||
return media;
|
// console.log("from a => ", latestMediaLibs);
|
||||||
|
setLatestMediaLibs((current) => {
|
||||||
|
current.filter((id) => id !== parentid);
|
||||||
|
});
|
||||||
|
console.log("from a => ", latestMediaLibs);
|
||||||
|
}
|
||||||
|
return latest;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const userViews = async (user) => {
|
||||||
|
const userviews = await getUserViewsApi(window.api).getUserViews({
|
||||||
|
userId: user.Id,
|
||||||
|
});
|
||||||
|
return userviews;
|
||||||
|
};
|
||||||
|
|
||||||
|
// const homeSection = []
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
currentUser().then((usr) => {
|
currentUser().then((usr) => {
|
||||||
setUser(usr.data);
|
setUser(usr.data);
|
||||||
userLibs(usr.data).then((libs) => {
|
userLibs(usr.data).then((libs) => {
|
||||||
setUserLibraries(libs.data.Items);
|
setUserLibraries(libs.data.Items);
|
||||||
setSkeletonStateSideMenu(true);
|
setSkeletonStateSideMenu(true);
|
||||||
// console.log(userLibraries);
|
for (let library of userLibraries) {
|
||||||
|
if (excludeTypes.includes(library.CollectionType)) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
let libs = latestMediaLibs;
|
||||||
|
let updated = null;
|
||||||
|
if (
|
||||||
|
!libs.some(
|
||||||
|
(elem) =>
|
||||||
|
elem == library.CollectionType,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
updated = libs.push(library.Id);
|
||||||
|
} else {
|
||||||
|
updated = libs;
|
||||||
|
}
|
||||||
|
|
||||||
|
setLatestMediaLibs(libs);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
getLatestMedia(usr.data).then((media) => {
|
getLatestMedia(usr.data).then((media) => {
|
||||||
setLatestMedia(media.data);
|
setLatestMedia(media.data);
|
||||||
setSkeletonStateCarousel(true);
|
setSkeletonStateCarousel(true);
|
||||||
});
|
});
|
||||||
getLatestMovies(usr.data).then((media) => {
|
getLatestMovies(usr.data).then((media) => {
|
||||||
setLatestMovies(media.data);
|
// let latestmovies = latestMovies;
|
||||||
|
// latestmovies.push(media.data);
|
||||||
|
setLatestMovies(media);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
for (let lib of latestMovies) {
|
// for (let lib of latestMovies) {
|
||||||
console.log(lib);
|
// console.log(lib);
|
||||||
}
|
// }
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -218,9 +233,9 @@ export const Home = () => {
|
|||||||
</Toolbar>
|
</Toolbar>
|
||||||
</AppBar>
|
</AppBar>
|
||||||
|
|
||||||
<Drawer
|
<MiniDrawer
|
||||||
variant="permanent"
|
variant="permanent"
|
||||||
open={drawerState}
|
open={false}
|
||||||
PaperProps={{
|
PaperProps={{
|
||||||
sx: {
|
sx: {
|
||||||
backgroundColor: "inherit",
|
backgroundColor: "inherit",
|
||||||
@@ -286,16 +301,6 @@ export const Home = () => {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText
|
|
||||||
primary={
|
|
||||||
library.Name
|
|
||||||
}
|
|
||||||
sx={{
|
|
||||||
opacity: drawerState
|
|
||||||
? 1
|
|
||||||
: 0,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
);
|
);
|
||||||
@@ -322,7 +327,73 @@ export const Home = () => {
|
|||||||
></Skeleton>
|
></Skeleton>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Drawer>
|
</MiniDrawer>
|
||||||
|
|
||||||
|
<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>
|
||||||
{/* <h1>Hey {userId} this is WIP Home</h1> */}
|
{/* <h1>Hey {userId} this is WIP Home</h1> */}
|
||||||
<Box
|
<Box
|
||||||
component="main"
|
component="main"
|
||||||
@@ -477,6 +548,7 @@ export const Home = () => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
<CardScroller displayCards={4}>
|
<CardScroller displayCards={4}>
|
||||||
{userLibraries.map((library, index) => {
|
{userLibraries.map((library, index) => {
|
||||||
|
// console.log(userLibraries);
|
||||||
return (
|
return (
|
||||||
<CardLandscape
|
<CardLandscape
|
||||||
key={index}
|
key={index}
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ export const theme = createTheme({
|
|||||||
secondary: {
|
secondary: {
|
||||||
main: clrSecondaryDefault,
|
main: clrSecondaryDefault,
|
||||||
},
|
},
|
||||||
|
background: {
|
||||||
|
default: clrBackgroundDefault,
|
||||||
|
paper: clrBackgroundDark,
|
||||||
|
},
|
||||||
mode: "dark",
|
mode: "dark",
|
||||||
},
|
},
|
||||||
typography: {
|
typography: {
|
||||||
|
|||||||
Reference in new issue
Block a user