Add base for LibraryView

This commit is contained in:
prayag17 committed 2023-04-03 21:02:39 +05:30
1 parent 1158c38575
commit c49f8d8c76
3 files changed
+55 -2

No files matched your search

+5
View File
@@ -59,6 +59,8 @@ import { v4 as uuidv4 } from "uuid";
import { delServer, getServer } from "./utils/storage/servers.js";
import { getUser } from "./utils/storage/user.js";
import { useDispatch } from "react-redux";
import { showSidemenu } from "./utils/slice/sidemenu.js";
const jellyfin = new Jellyfin({
clientInfo: {
name: "JellyPlayer",
@@ -120,12 +122,15 @@ const AnimationWrapper = () => {
function App() {
const navigate = useNavigate();
const dispatch = useDispatch();
const [serverReachable, setServerReachable] = useState(true);
const [checkingServer, setChecking] = useState(false);
const createApi = async () => {
const server = await getServer();
event.emit("create-jellyfin-api", server.Ip);
dispatch(showSidemenu());
};
const serverAvailable = async () => {
-1
View File
@@ -85,7 +85,6 @@ const Home = () => {
const libraries = useQuery({
queryKey: ["home", "libraries"],
queryFn: async () => {
dispatch(showSidemenu());
let libs = await getUserViewsApi(window.api).getUserViews({
userId: user.data.Id,
});
+50 -1
View File
@@ -1,9 +1,58 @@
/** @format */
import { useState, useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { showAppBar, setBackdrop } from "../../utils/slice/appBar";
import { useParams } from "react-router-dom";
import Box from "@mui/material/Box";
import useScrollTrigger from "@mui/material/useScrollTrigger";
const LibraryView = () => {
const dispatch = useDispatch();
const appBarVisiblity = useSelector((state) => state.appBar.visible);
if (!appBarVisiblity) {
dispatch(showAppBar());
}
const { id } = useParams();
return <h1>{id}</h1>;
const [scrollTarget, setScrollTarget] = useState(undefined);
const trigger = useScrollTrigger({
disableHysteresis: true,
threshold: 0,
target: scrollTarget,
});
useEffect(() => {
dispatch(setBackdrop(trigger));
}, [trigger]);
return (
<Box
sx={{
display: "flex",
}}
>
<Box
component="main"
className="scrollY"
sx={{
flexGrow: 1,
pt: 11,
px: 3,
pb: 3,
position: "relative",
}}
ref={(node) => {
if (node) {
setScrollTarget(node);
}
}}
>
{id}
</Box>
</Box>
);
};
export default LibraryView;