Compare commits
35
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9022dc16ab | ||
|
|
a08c51a00c | ||
|
|
ccb2a628cf | ||
|
|
d3708bd83b | ||
|
|
41c4c333d1 | ||
|
|
1d31496854 | ||
|
|
9c4c1191d8 | ||
|
|
ddd6485a0b | ||
|
|
53f042a453 | ||
|
|
a507b0a0c9 | ||
|
|
ed1633fb21 | ||
|
|
cf59815089 | ||
|
|
58dfe935c6 | ||
|
|
aef5629343 | ||
|
|
864219c0fe | ||
|
|
d9a12e24e7 | ||
|
|
fa3b2c7e6b | ||
|
|
0035488770 | ||
|
|
ac565b65fe | ||
|
|
464a3ff5a2 | ||
|
|
e9cd7c4e27 | ||
|
|
a6b377208f | ||
|
|
8ef12225c6 | ||
|
|
ca9cb9e7d6 | ||
|
|
201bc0b092 | ||
|
|
3f92769b86 | ||
|
|
b1d1985a80 | ||
|
|
d73eade38a | ||
|
|
9ad438429f | ||
|
|
0d3b7c855c | ||
|
|
45655b7464 | ||
|
|
dbe719744a | ||
|
|
fadc3f7a70 | ||
|
|
3d12d416f7 | ||
|
|
cfe0361224 |
No files matched your search
@@ -6,6 +6,7 @@
|
||||
|
||||
# ℹ️ Getting started:
|
||||
- Install Nodejs and Rust.
|
||||
> **Note** : Install Rust from https://www.rust-lang.org/learn/get-started
|
||||
- install depencies using npm:
|
||||
```shell
|
||||
npm install
|
||||
|
||||
Generated
+388
-2435
File diff suppressed because it is too large.
Load diff
+10
-9
@@ -13,16 +13,16 @@
|
||||
"@emotion/react": "^11.10.5",
|
||||
"@emotion/styled": "^11.10.5",
|
||||
"@fontsource/open-sans": "^4.5.13",
|
||||
"@jellyfin/sdk": "^0.7.0",
|
||||
"@jellyfin/sdk": "^0.8.2",
|
||||
"@mdi/js": "^7.2.96",
|
||||
"@mui/lab": "^5.0.0-alpha.124",
|
||||
"@mui/material": "^5.11.15",
|
||||
"@mui/lab": "^5.0.0-alpha.127",
|
||||
"@mui/material": "^5.11.16",
|
||||
"@reduxjs/toolkit": "^1.9.3",
|
||||
"@tanstack/react-query": "^4.26.1",
|
||||
"@tanstack/react-query-devtools": "^4.28.0",
|
||||
"@tanstack/react-query-devtools": "^4.29.3",
|
||||
"blurhash": "^2.0.5",
|
||||
"events": "^3.3.0",
|
||||
"framer-motion": "^10.10.0",
|
||||
"framer-motion": "^10.12.4",
|
||||
"localforage": "^1.10.0",
|
||||
"match-sorter": "^6.3.1",
|
||||
"notistack": "^3.0.1",
|
||||
@@ -30,6 +30,7 @@
|
||||
"react-blurhash": "^0.3.0",
|
||||
"react-cookie": "^4.1.1",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-konami-code": "^2.3.0",
|
||||
"react-material-ui-carousel": "^3.4.2",
|
||||
"react-multi-carousel": "^2.8.3",
|
||||
"react-parallax": "^3.5.1",
|
||||
@@ -43,11 +44,11 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^1.2.2",
|
||||
"@types/react": "^18.0.32",
|
||||
"@types/react": "^18.0.38",
|
||||
"@types/react-dom": "^18.0.8",
|
||||
"@vitejs/plugin-react": "^3.1.0",
|
||||
"sass": "^1.60.0",
|
||||
"vite": "^4.2.1"
|
||||
"@vitejs/plugin-react": "^4.0.0",
|
||||
"sass": "^1.61.0",
|
||||
"vite": "^4.3.1"
|
||||
},
|
||||
"license": "GPL-3.0-only"
|
||||
}
|
||||
+13
-15
@@ -1,25 +1,23 @@
|
||||
#![cfg_attr(
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use tauri::Manager;
|
||||
|
||||
// Create the command:
|
||||
// This command must be async so that it doesn't run on the main thread.
|
||||
#[tauri::command]
|
||||
async fn close_splashscreen(window: tauri::Window) {
|
||||
// Close splashscreen
|
||||
if let Some(splashscreen) = window.get_window("splashscreen") {
|
||||
splashscreen.close().unwrap();
|
||||
}
|
||||
// Show main window
|
||||
window.get_window("main").unwrap().show().unwrap();
|
||||
// Close splashscreen
|
||||
if let Some(splashscreen) = window.get_window("splashscreen") {
|
||||
splashscreen.close().unwrap();
|
||||
}
|
||||
// Show main window
|
||||
window.get_window("main").unwrap().show().unwrap();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![close_splashscreen])
|
||||
.plugin(tauri_plugin_store::Builder::default().build())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![close_splashscreen])
|
||||
.plugin(tauri_plugin_store::Builder::default().build())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
+86
-65
@@ -1,6 +1,11 @@
|
||||
/** @format */
|
||||
|
||||
import React, { useState } from "react";
|
||||
|
||||
import Konami from "react-konami-code";
|
||||
// @ts-ignore
|
||||
const Kon = Konami.default ? Konami.default : Konami;
|
||||
|
||||
import { ThemeProvider } from "@mui/material/styles";
|
||||
import { SnackbarProvider } from "notistack";
|
||||
import {
|
||||
@@ -19,7 +24,7 @@ import { relaunch } from "@tauri-apps/api/process";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||
// import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||
|
||||
// Theming
|
||||
import CssBaseline from "@mui/material/CssBaseline";
|
||||
@@ -37,16 +42,13 @@ import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
|
||||
// Routes
|
||||
import { ServerSetup, ServerList } from "./routes/setup/server/root";
|
||||
import Home from "./routes/home/root";
|
||||
import {
|
||||
UserLogin,
|
||||
LoginWithImage,
|
||||
UserLoginManual,
|
||||
} from "./routes/login/root";
|
||||
import LibraryView from "./routes/library/root.jsx";
|
||||
import ItemMovie from "./routes/item/Movie/root.jsx";
|
||||
import ItemSeries from "./routes/item/Series/root.jsx";
|
||||
import { ServerSetup, ServerList } from "./routes/setup/server";
|
||||
import Home from "./routes/home";
|
||||
import { UserLogin, LoginWithImage, UserLoginManual } from "./routes/login";
|
||||
import LibraryView from "./routes/library";
|
||||
import ItemDetail from "./routes/item";
|
||||
import Settings from "./routes/settings";
|
||||
import About from "./routes/about";
|
||||
|
||||
import { SideMenu } from "./components/menu/sidemenu.jsx";
|
||||
import { AppBar } from "./components/appBar/appBar.jsx";
|
||||
@@ -59,10 +61,11 @@ import { Jellyfin } from "@jellyfin/sdk";
|
||||
import { version as appVer } from "../package.json";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { delServer, getServer } from "./utils/storage/servers.js";
|
||||
import { getUser } from "./utils/storage/user.js";
|
||||
import { delUser, getUser } from "./utils/storage/user.js";
|
||||
|
||||
import { useDispatch } from "react-redux";
|
||||
import { showSidemenu } from "./utils/slice/sidemenu.js";
|
||||
import FavouritePage from "./routes/favourite/index.jsx";
|
||||
const jellyfin = new Jellyfin({
|
||||
clientInfo: {
|
||||
name: "JellyPlayer",
|
||||
@@ -75,10 +78,7 @@ const jellyfin = new Jellyfin({
|
||||
});
|
||||
|
||||
event.on("create-jellyfin-api", (serverAddress) => {
|
||||
window.api = jellyfin.createApi(
|
||||
serverAddress,
|
||||
sessionStorage.getItem("accessToken"),
|
||||
);
|
||||
window.api = jellyfin.createApi(serverAddress);
|
||||
// window.api = jellyfin.createApi(serverAddress);
|
||||
});
|
||||
event.on("set-api-accessToken", (serverAddress) => {
|
||||
@@ -91,15 +91,12 @@ event.on("set-api-accessToken", (serverAddress) => {
|
||||
const anim = {
|
||||
initial: {
|
||||
opacity: 0,
|
||||
x: -50,
|
||||
},
|
||||
animate: {
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
},
|
||||
exit: {
|
||||
opacity: 0,
|
||||
x: 50,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -112,8 +109,7 @@ const AnimationWrapper = () => {
|
||||
animate="animate"
|
||||
exit="exit"
|
||||
transition={{
|
||||
duration: 0.3,
|
||||
ease: "easeInOut",
|
||||
duration: 0.35,
|
||||
}}
|
||||
>
|
||||
<Outlet />
|
||||
@@ -139,13 +135,8 @@ function App() {
|
||||
const server = await getServer();
|
||||
|
||||
if (server == null) {
|
||||
console.log("server not found");
|
||||
return false;
|
||||
} else {
|
||||
// if (!window.api) {
|
||||
// console.log("Creating Jf api (without accessToken)");
|
||||
// event.emit("create-jellyfin-api", server.Ip);
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -161,7 +152,6 @@ function App() {
|
||||
|
||||
const userSaved = async () => {
|
||||
const user = await getUser();
|
||||
console.log("User store => ", user);
|
||||
if (user == null) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -191,7 +181,6 @@ function App() {
|
||||
})
|
||||
.catch((error) => {
|
||||
setServerReachable(false);
|
||||
console.error(error);
|
||||
setChecking(false);
|
||||
});
|
||||
};
|
||||
@@ -211,24 +200,31 @@ function App() {
|
||||
const LogicalRoutes = () => {
|
||||
serverAvailable().then(async (server) => {
|
||||
if (server == true) {
|
||||
pingServer();
|
||||
if (serverReachable == true) {
|
||||
userSaved().then((user_available) => {
|
||||
if (user_available == true) {
|
||||
navigate("/home");
|
||||
} else {
|
||||
usersAvailable().then(
|
||||
(users_list_available) => {
|
||||
if (users_list_available == true) {
|
||||
navigate("/login/users");
|
||||
} else {
|
||||
navigate("/login/manual");
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
createApi().then(() => {
|
||||
pingServer();
|
||||
if (serverReachable == true) {
|
||||
userSaved().then((user_available) => {
|
||||
if (user_available == true) {
|
||||
navigate("/home");
|
||||
} else {
|
||||
usersAvailable().then(
|
||||
(users_list_available) => {
|
||||
if (
|
||||
users_list_available ==
|
||||
true
|
||||
) {
|
||||
navigate("/login/users");
|
||||
} else {
|
||||
navigate(
|
||||
"/login/manual",
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
navigate("/setup/server");
|
||||
setChecking(false);
|
||||
@@ -248,26 +244,32 @@ function App() {
|
||||
|
||||
const handleRelaunch = async () => {
|
||||
let result = await relaunch();
|
||||
console.log(result);
|
||||
};
|
||||
|
||||
const handleRemoveServer = async () => {
|
||||
await delServer();
|
||||
await delUser();
|
||||
let result = await relaunch();
|
||||
console.log(result);
|
||||
};
|
||||
const location = useLocation();
|
||||
|
||||
if (!window.api) {
|
||||
console.log("WindowAPi not present");
|
||||
createApi().then(
|
||||
userSaved().then((userSavedBool) => {
|
||||
if (userSavedBool) {
|
||||
userLogin();
|
||||
}
|
||||
}),
|
||||
);
|
||||
serverAvailable().then((available) => {
|
||||
if (available) {
|
||||
createApi().then(
|
||||
userSaved().then((userSavedBool) => {
|
||||
if (userSavedBool) {
|
||||
userLogin();
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
const [easterEgg, setEasterEgg] = useState(false);
|
||||
const sixtyNine = () => {
|
||||
setEasterEgg(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<SnackbarProvider maxSnack={5}>
|
||||
@@ -277,7 +279,7 @@ function App() {
|
||||
sx={{
|
||||
display: "flex",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
height: "100vh",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
}}
|
||||
@@ -285,6 +287,21 @@ function App() {
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
)}
|
||||
|
||||
<Kon resetDelay={1000} action={sixtyNine}></Kon>
|
||||
<Dialog
|
||||
open={easterEgg}
|
||||
onClose={() => setEasterEgg(false)}
|
||||
>
|
||||
<iframe
|
||||
width="560"
|
||||
height="315"
|
||||
src="https://www.youtube.com/embed/dQw4w9WgXcQ?controls=0&autoplay=1"
|
||||
title="EasterEgg"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||
></iframe>
|
||||
</Dialog>
|
||||
{/* Show Dialog if server not reachable */}
|
||||
<Dialog
|
||||
open={!serverReachable}
|
||||
@@ -337,12 +354,10 @@ function App() {
|
||||
element={<ServerList />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/login/withImg/:userName/:userId/"
|
||||
element={<LoginWithImage />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/login/users"
|
||||
element={<UserLogin />}
|
||||
/>
|
||||
@@ -355,12 +370,20 @@ function App() {
|
||||
element={<LibraryView />}
|
||||
/>
|
||||
<Route
|
||||
path="/item/Movie/:id"
|
||||
element={<ItemMovie />}
|
||||
path="/item/:id"
|
||||
element={<ItemDetail />}
|
||||
/>
|
||||
<Route
|
||||
path="/item/Series/:id"
|
||||
element={<ItemSeries />}
|
||||
path="/favourite"
|
||||
element={<FavouritePage />}
|
||||
/>
|
||||
<Route
|
||||
path="/settings"
|
||||
element={<Settings />}
|
||||
/>
|
||||
<Route
|
||||
path="/about"
|
||||
element={<About />}
|
||||
/>
|
||||
|
||||
{/* Logical Routes */}
|
||||
@@ -370,7 +393,6 @@ function App() {
|
||||
element={<LogicalRoutes />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/login"
|
||||
element={<LoginLogicalRoutes />}
|
||||
/>
|
||||
@@ -378,7 +400,6 @@ function App() {
|
||||
</Routes>
|
||||
</div>
|
||||
</AnimatePresence>
|
||||
<ReactQueryDevtools />
|
||||
</ThemeProvider>
|
||||
</SnackbarProvider>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Part of the Jellyfin project (https://jellyfin.media)
|
||||
-
|
||||
- All copyright belongs to the Jellyfin contributors; a full list can
|
||||
- be found in the file CONTRIBUTORS.md
|
||||
-
|
||||
- This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||
- To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/.
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
<svg id="banner-dark" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1536 512">
|
||||
<defs>
|
||||
<linearGradient id="linear-gradient" x1="110.25" y1="213.3" x2="496.14" y2="436.09" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#aa5cc3"/>
|
||||
<stop offset="1" stop-color="#00a4dc"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<title>banner-dark</title>
|
||||
<g id="banner-dark">
|
||||
<g id="banner-dark-icon">
|
||||
<path id="inner-shape" d="M261.42,201.62c-20.44,0-86.24,119.29-76.2,139.43s142.48,19.92,152.4,0S281.86,201.63,261.42,201.62Z" fill="url(#linear-gradient)"/>
|
||||
<path id="outer-shape" d="M261.42,23.3C199.83,23.3,1.57,382.73,31.8,443.43s429.34,60,459.24,0S323,23.3,261.42,23.3ZM411.9,390.76c-19.59,39.33-281.08,39.77-300.9,0S221.1,115.48,261.45,115.48,431.49,351.42,411.9,390.76Z" fill="url(#linear-gradient)"/>
|
||||
</g>
|
||||
<g id="jellyfin-light-outlines" style="isolation:isolate" transform="translate(43.8)">
|
||||
<path d="M556.64,350.75a67,67,0,0,1-22.87-27.47,8.91,8.91,0,0,1-1.49-4.75,7.42,7.42,0,0,1,2.83-5.94,9.25,9.25,0,0,1,6.09-2.38c3.16,0,5.94,1.69,8.31,5.05a48.09,48.09,0,0,0,16.34,20.34,40.59,40.59,0,0,0,24,7.58q20.51,0,33.27-12.62t12.77-33.12V159a8.44,8.44,0,0,1,2.67-6.39,9.56,9.56,0,0,1,6.83-2.52,9,9,0,0,1,6.68,2.52,8.7,8.7,0,0,1,2.53,6.39v138.4a64.7,64.7,0,0,1-8.32,32.67,59,59,0,0,1-23,22.72Q608.62,361,589.9,361A57.21,57.21,0,0,1,556.64,350.75Z" fill="#fff"/>
|
||||
<path d="M831.66,279.47a8.77,8.77,0,0,1-6.24,2.53H713.16q0,17.82,7.27,31.92a54.91,54.91,0,0,0,20.79,22.28q13.51,8.18,31.93,8.17a54,54,0,0,0,25.54-5.94,52.7,52.7,0,0,0,18.12-15.15,10,10,0,0,1,6.24-2.67,8.14,8.14,0,0,1,7.72,7.72,8.81,8.81,0,0,1-3,6.24,74.7,74.7,0,0,1-23.91,19A65.56,65.56,0,0,1,773.45,361q-22.87,0-40.4-9.8a69.51,69.51,0,0,1-27.32-27.48q-9.79-17.66-9.8-40.83,0-24.36,9.65-42.62t25.69-27.92a65.2,65.2,0,0,1,34.16-9.65A70,70,0,0,1,798.84,211a65.78,65.78,0,0,1,25.39,24.36q9.81,16,10.1,38A8.07,8.07,0,0,1,831.66,279.47ZM733.5,231.8Q718.8,243.68,714.64,266H815.92v-2.38A46.91,46.91,0,0,0,807,240.27a48.47,48.47,0,0,0-18.56-15.15,54,54,0,0,0-23-5.2Q748.2,219.92,733.5,231.8Z" fill="#fff"/>
|
||||
<path d="M888.24,355.5a8.92,8.92,0,0,1-15.3-6.38v-202a8.91,8.91,0,1,1,17.82,0v202A8.65,8.65,0,0,1,888.24,355.5Z" fill="#fff"/>
|
||||
<path d="M956.55,355.5a8.92,8.92,0,0,1-15.3-6.38v-202a8.91,8.91,0,1,1,17.82,0v202A8.65,8.65,0,0,1,956.55,355.5Z" fill="#fff"/>
|
||||
<path d="M1122.86,206.11a8.7,8.7,0,0,1,2.53,6.39v131q0,23.44-9.21,40.09a61.58,61.58,0,0,1-25.54,25.25q-16.34,8.61-36.83,8.61a96.73,96.73,0,0,1-23.31-2.68,61.72,61.72,0,0,1-18-7.12q-6.24-3.87-6.24-8.62a17.94,17.94,0,0,1,.6-3,8.06,8.06,0,0,1,3-4.45,7.49,7.49,0,0,1,4.45-1.49,7.91,7.91,0,0,1,3.56.89q19,10.39,36.24,10.4,24.65,0,39.06-15.44t14.4-42.18V333.38a54.37,54.37,0,0,1-21.38,20,62.55,62.55,0,0,1-30.3,7.58q-25.83,0-39.2-15.45t-13.37-41.87V212.5a8.91,8.91,0,1,1,17.82,0V301q0,21.39,9.36,32.38t29.25,11a48,48,0,0,0,23.32-6.09,49.88,49.88,0,0,0,17.82-16,37.44,37.44,0,0,0,6.68-21.24V212.5a9,9,0,0,1,15.29-6.39Z" fill="#fff"/>
|
||||
<path d="M1210.18,161.41q-5.21,6.24-5.2,17.23v30.59h33.27a8.19,8.19,0,0,1,5.79,2.38,8.26,8.26,0,0,1,0,11.88,8.22,8.22,0,0,1-5.79,2.37H1205V349.12a8.91,8.91,0,1,1-17.82,0V225.86h-21.68a7.83,7.83,0,0,1-5.94-2.52,8.21,8.21,0,0,1-2.37-5.79,8,8,0,0,1,2.37-6.09,8.33,8.33,0,0,1,5.94-2.23h21.68V178.64q0-18.7,10.84-29t29-10.24a46.1,46.1,0,0,1,15.45,2.52q7.13,2.53,7.12,8.17a8.07,8.07,0,0,1-2.37,5.94,7.37,7.37,0,0,1-5.35,2.37,18.81,18.81,0,0,1-6.53-1.48,42,42,0,0,0-10.4-1.78Q1215.37,155.18,1210.18,161.41ZM1276,180.87c-2.19-1.88-3.27-4.61-3.27-8.17v-3q0-5.34,3.41-8.17t9.36-2.82q11.88,0,11.88,11v3c0,3.56-1,6.29-3.12,8.17s-5.1,2.82-9.06,2.82S1278.14,182.75,1276,180.87Zm15.59,174.63a8.92,8.92,0,0,1-15.3-6.38V212.5a8.91,8.91,0,1,1,17.82,0V349.12A8.65,8.65,0,0,1,1291.56,355.5Z" fill="#fff"/>
|
||||
<path d="M1452.53,218.88q12.92,16.2,12.92,42.92v87.32a8.4,8.4,0,0,1-2.67,6.38,8.8,8.8,0,0,1-6.24,2.53,8.64,8.64,0,0,1-8.91-8.91V262.69q0-19.31-9.65-31.33t-29.85-12a53.28,53.28,0,0,0-42.77,21.83,36.24,36.24,0,0,0-7.13,21.53v86.43a8.91,8.91,0,1,1-17.82,0V216.06a8.91,8.91,0,1,1,17.82,0V232.4q8-12.77,23-21.24A61.84,61.84,0,0,1,1412,202.7Q1439.61,202.7,1452.53,218.88Z" fill="#fff"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.7 KiB |
@@ -1,5 +1,5 @@
|
||||
/** @format */
|
||||
import { useEffect } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import MuiAppBar from "@mui/material/AppBar";
|
||||
import TextField from "@mui/material/TextField";
|
||||
@@ -7,14 +7,16 @@ import IconButton from "@mui/material/IconButton";
|
||||
import Toolbar from "@mui/material/Toolbar";
|
||||
import Avatar from "@mui/material/Avatar";
|
||||
import Box from "@mui/material/Box";
|
||||
import Zoom from "@mui/material/Zoom";
|
||||
import ListItemIcon from "@mui/material/ListItemIcon";
|
||||
import Menu from "@mui/material/Menu";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||
|
||||
import { MdiMagnify } from "../icons/mdiMagnify";
|
||||
import { theme } from "../../theme";
|
||||
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
import { hideBackButton } from "../../utils/slice/appBar";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { useQueryClient, useQuery } from "@tanstack/react-query";
|
||||
@@ -23,16 +25,15 @@ import "./appBar.module.scss";
|
||||
import { MdiAccount } from "../icons/mdiAccount";
|
||||
import { MdiHeartOutline } from "../icons/mdiHeartOutline";
|
||||
import { MdiArrowLeft } from "../icons/mdiArrowLeft";
|
||||
import { MdiCog } from "../icons/mdiCog";
|
||||
import { MdiInformation } from "../icons/mdiInformation";
|
||||
|
||||
export const AppBar = () => {
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const visible = useSelector((state) => state.appBar.visible);
|
||||
const backButtonVisible = useSelector(
|
||||
(state) => state.appBar.backButtonVisible,
|
||||
);
|
||||
const backdropVisible = useSelector((state) => state.appBar.backdrop);
|
||||
const [display, setDisplay] = useState(false);
|
||||
const [backButtonVisible, setBackButtonVisible] = useState(true);
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
@@ -42,26 +43,56 @@ export const AppBar = () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
enabled: display,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const trigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 0,
|
||||
});
|
||||
|
||||
const [anchorEl, setAnchorEl] = useState(null);
|
||||
const openMenu = Boolean(anchorEl);
|
||||
const handleMenuOpen = (event) => {
|
||||
setAnchorEl(event.currentTarget);
|
||||
};
|
||||
const handleMenuClose = () => {
|
||||
setAnchorEl(null);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
location.pathname.includes("login") ||
|
||||
location.pathname.includes("setup")
|
||||
) {
|
||||
setDisplay(false);
|
||||
} else {
|
||||
setDisplay(true);
|
||||
}
|
||||
}, [location]);
|
||||
|
||||
useEffect(() => {
|
||||
if (location.pathname == "/home") {
|
||||
dispatch(hideBackButton());
|
||||
setBackButtonVisible(false);
|
||||
} else {
|
||||
setBackButtonVisible(true);
|
||||
}
|
||||
});
|
||||
}, [location]);
|
||||
|
||||
return (
|
||||
visible && (
|
||||
if (!display) {
|
||||
return <></>;
|
||||
}
|
||||
if (display) {
|
||||
return (
|
||||
<MuiAppBar
|
||||
sx={{
|
||||
width: `calc(100vw - ${theme.spacing(7)} - 10px)`,
|
||||
width: `calc(100vw - ${theme.spacing(7)})`,
|
||||
// mr: "10px",
|
||||
background: "transparent",
|
||||
backgroundColor: "transparent",
|
||||
}}
|
||||
className={
|
||||
backdropVisible ? "appBar backdropVisible" : "appBar"
|
||||
}
|
||||
elevation={backdropVisible ? 6 : 0}
|
||||
className={trigger ? "appBar backdropVisible" : "appBar"}
|
||||
elevation={0}
|
||||
>
|
||||
<Toolbar sx={{ justifyContent: "space-between" }}>
|
||||
<Box
|
||||
@@ -97,7 +128,10 @@ export const AppBar = () => {
|
||||
<IconButton>
|
||||
<MdiHeartOutline />
|
||||
</IconButton>
|
||||
<IconButton sx={{ p: 0 }}>
|
||||
<IconButton
|
||||
sx={{ p: 0 }}
|
||||
onClick={handleMenuOpen}
|
||||
>
|
||||
{user.isSuccess &&
|
||||
(user.data.PrimaryImageTag ==
|
||||
undefined ? (
|
||||
@@ -122,9 +156,30 @@ export const AppBar = () => {
|
||||
</Avatar>
|
||||
))}
|
||||
</IconButton>
|
||||
<Menu
|
||||
anchorEl={anchorEl}
|
||||
open={openMenu}
|
||||
onClose={handleMenuClose}
|
||||
sx={{ mt: 1 }}
|
||||
>
|
||||
<MenuItem
|
||||
onClick={() => navigate("/settings")}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<MdiCog />
|
||||
</ListItemIcon>
|
||||
Settings
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => navigate("/about")}>
|
||||
<ListItemIcon>
|
||||
<MdiInformation />
|
||||
</ListItemIcon>
|
||||
About
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</Box>
|
||||
</Toolbar>
|
||||
</MuiAppBar>
|
||||
)
|
||||
);
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -1,10 +1,12 @@
|
||||
/** @format */
|
||||
|
||||
.appBar {
|
||||
transition: background $transition-time-default,
|
||||
box-shadow $transition-time-default;
|
||||
transition: background-color $transition-time-fast,
|
||||
backdrop-filter $transition-time-fast,
|
||||
box-shadow $transition-time-default !important;
|
||||
&.backdropVisible {
|
||||
background: $clr-background-dark;
|
||||
background-color: $clr-background-dark-opacity-0_8;
|
||||
backdrop-filter: blur(30px);
|
||||
}
|
||||
&-avatar {
|
||||
background: $clr-gradient-dark;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/** @format */
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import ButtonBase from "@mui/material/ButtonBase";
|
||||
|
||||
@@ -10,7 +11,7 @@ import "./avatar.module.scss";
|
||||
|
||||
export const AvatarImage = ({ userId, userImageTags }) => {
|
||||
return (
|
||||
<div className="avatar-image-container">
|
||||
<Box className="avatar-image-container">
|
||||
{!!userImageTags && (
|
||||
<div
|
||||
className="avatar-image"
|
||||
@@ -28,7 +29,7 @@ export const AvatarImage = ({ userId, userImageTags }) => {
|
||||
<div className="avatar-image-icon-container">
|
||||
<MdiAccount className="avatar-image-icon" />
|
||||
</div>
|
||||
</div>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
&-icon {
|
||||
height: 100%;
|
||||
padding: 0.2em;
|
||||
background: $clr-accent-dark;
|
||||
color: $clr-accent-default;
|
||||
font-size: 2em !important;
|
||||
background: $clr-gradient-dark;
|
||||
fill: url(#clr-gradient-default) !important;
|
||||
font-size: 7em !important;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
import React, { useState } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import MuiCard from "@mui/material/Card";
|
||||
import CardContent from "@mui/material/CardContent";
|
||||
@@ -46,9 +48,10 @@ export const Card = ({
|
||||
currentUser,
|
||||
favourite,
|
||||
}) => {
|
||||
const navigate = useNavigate();
|
||||
const [imgLoading, setImgLoading] = useState(true);
|
||||
const [isWatched, setIsWatched] = useState(watchedStatus);
|
||||
const [isFavourite, setIsFavourite] = useState(favourite);
|
||||
const [isFavorite, setisFavorite] = useState(favourite);
|
||||
const [watchedCountState, setWatchedCountState] = useState(watchedCount);
|
||||
const handleMarkAsPlayOrUnMarkAsPlay = async () => {
|
||||
let result;
|
||||
@@ -63,25 +66,23 @@ export const Card = ({
|
||||
itemId: itemId,
|
||||
});
|
||||
}
|
||||
console.log(result.data);
|
||||
setIsWatched(result.data.Played);
|
||||
setWatchedCountState(result.data.UnplayedItemCount);
|
||||
};
|
||||
const handleLiking = async () => {
|
||||
let result;
|
||||
if (isFavourite) {
|
||||
if (isFavorite) {
|
||||
result = await getUserLibraryApi(window.api).unmarkFavoriteItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
} else if (!isFavourite) {
|
||||
} else if (!isFavorite) {
|
||||
result = await getUserLibraryApi(window.api).markFavoriteItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
}
|
||||
console.log(result.data.IsFavorite);
|
||||
setIsFavourite(result.data.IsFavorite);
|
||||
setisFavorite(result.data.IsFavorite);
|
||||
};
|
||||
|
||||
const availableMarkButtonTypes = [
|
||||
@@ -132,7 +133,16 @@ export const Card = ({
|
||||
{...cardProps}
|
||||
>
|
||||
<CardActionArea
|
||||
onClick={!!onClickEvent ? onClickEvent : () => {}}
|
||||
sx={{ p: "1px" }}
|
||||
component={Box}
|
||||
onClick={
|
||||
!!onClickEvent
|
||||
? onClickEvent
|
||||
: () => {
|
||||
navigate(`/item/${itemId}`);
|
||||
}
|
||||
}
|
||||
className="cardBox"
|
||||
>
|
||||
<Box
|
||||
className="card-media-container"
|
||||
@@ -204,7 +214,7 @@ export const Card = ({
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
itemId +
|
||||
"/Images/Primary"
|
||||
"/Images/Primary?fillHeight=532&fillWidth=300&quality=96"
|
||||
}
|
||||
alt={itemName}
|
||||
sx={{
|
||||
@@ -230,8 +240,8 @@ export const Card = ({
|
||||
hash={blurhash}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={64}
|
||||
resolutionY={64}
|
||||
resolutionX={24}
|
||||
resolutionY={24}
|
||||
style={{
|
||||
aspectRatio:
|
||||
cardOrientation == "landscape"
|
||||
@@ -288,7 +298,7 @@ export const Card = ({
|
||||
<MdiCheck
|
||||
sx={{
|
||||
color: isWatched
|
||||
? green[200]
|
||||
? green[400]
|
||||
: "white",
|
||||
}}
|
||||
/>
|
||||
@@ -301,7 +311,7 @@ export const Card = ({
|
||||
handleLiking();
|
||||
}}
|
||||
>
|
||||
{isFavourite ? (
|
||||
{isFavorite ? (
|
||||
<MdiHeart
|
||||
sx={{ color: pink[700] }}
|
||||
/>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
position: relative;
|
||||
border-radius: $border-radius-default;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 0 7px rgb(0 0 0 / 0.2);
|
||||
}
|
||||
&-overlay {
|
||||
position: absolute;
|
||||
@@ -23,7 +24,9 @@
|
||||
transition: opacity $transition-time-default;
|
||||
}
|
||||
}
|
||||
&:hover .card-media-overlay {
|
||||
&Box:hover .card-media-overlay,
|
||||
&Box:focus-within .card-media-overlay,
|
||||
&Box:focus .card-media-overlay {
|
||||
opacity: 1;
|
||||
}
|
||||
&-image {
|
||||
@@ -77,7 +80,6 @@
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
top: 5px;
|
||||
// padding: 2px 10px;
|
||||
z-index: 10;
|
||||
// border-radius: 100px;
|
||||
background: $clr-gradient-default;
|
||||
|
||||
@@ -0,0 +1,415 @@
|
||||
/** @format */
|
||||
import React, { useState } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import { useNavigate, Link } from "react-router-dom";
|
||||
// import Link from "@mui/material/Link";
|
||||
|
||||
import Divider from "@mui/material/Divider";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Box from "@mui/material/Box";
|
||||
import MuiCard 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 LinearProgress from "@mui/material/LinearProgress";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import ButtonGroup from "@mui/material/ButtonGroup";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import { green, pink } from "@mui/material/colors";
|
||||
|
||||
import {
|
||||
MediaCollectionTypeIconCollectionCard,
|
||||
TypeIconCollectionCard,
|
||||
} from "../utils/iconsCollection";
|
||||
|
||||
import { borderRadiusDefault } from "../../palette.module.scss";
|
||||
import "./card.module.scss";
|
||||
import { MdiCheck } from "../icons/mdiCheck";
|
||||
|
||||
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { MdiHeartOutline } from "../icons/mdiHeartOutline";
|
||||
import { MdiHeart } from "../icons/mdiHeart";
|
||||
import { endsAt, getRuntime } from "../../utils/date/time";
|
||||
import { MdiStarHalfFull } from "../icons/mdiStarHalfFull";
|
||||
|
||||
export const EpisodeCard = ({
|
||||
itemName,
|
||||
itemRating,
|
||||
itemTicks,
|
||||
itemId,
|
||||
imageTags,
|
||||
subText = "",
|
||||
playedPercent,
|
||||
cardProps,
|
||||
onClickEvent,
|
||||
watchedStatus,
|
||||
blurhash,
|
||||
currentUser,
|
||||
favourite,
|
||||
showName,
|
||||
episodeLocation,
|
||||
centerAlignText = false,
|
||||
parentId,
|
||||
}) => {
|
||||
const navigate = useNavigate();
|
||||
const [isWatched, setIsWatched] = useState(watchedStatus);
|
||||
const [isFavourite, setIsFavourite] = useState(favourite);
|
||||
const handleMarkAsPlayOrUnMarkAsPlay = async () => {
|
||||
let result;
|
||||
if (!isWatched) {
|
||||
result = await getPlaystateApi(window.api).markPlayedItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
} else if (isWatched) {
|
||||
result = await getPlaystateApi(window.api).markUnplayedItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
}
|
||||
setIsWatched(result.data.Played);
|
||||
};
|
||||
const handleLiking = async () => {
|
||||
let result;
|
||||
if (isFavourite) {
|
||||
result = await getUserLibraryApi(window.api).unmarkFavoriteItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
} else if (!isFavourite) {
|
||||
result = await getUserLibraryApi(window.api).markFavoriteItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
}
|
||||
setIsFavourite(result.data.IsFavorite);
|
||||
};
|
||||
|
||||
return (
|
||||
<MuiCard
|
||||
className="card landscape"
|
||||
sx={{
|
||||
background: "transparent",
|
||||
borderRadius: borderRadiusDefault,
|
||||
mr: 1,
|
||||
mb: 0.5,
|
||||
}}
|
||||
elevation={0}
|
||||
{...cardProps}
|
||||
>
|
||||
<CardActionArea
|
||||
sx={{ p: "1px" }}
|
||||
component="div"
|
||||
onClick={
|
||||
!!onClickEvent
|
||||
? onClickEvent
|
||||
: () => {
|
||||
navigate(`/item/${itemId}`);
|
||||
}
|
||||
}
|
||||
className="cardBox"
|
||||
>
|
||||
<Box
|
||||
className="card-media-container"
|
||||
sx={{
|
||||
position: "relative",
|
||||
m: 1,
|
||||
aspectRatio: "1.777",
|
||||
}}
|
||||
>
|
||||
<>
|
||||
<Chip
|
||||
className="card-indicator"
|
||||
label={<MdiCheck />}
|
||||
sx={{
|
||||
transition: "opacity 150ms",
|
||||
opacity: isWatched ? 1 : 0,
|
||||
}}
|
||||
/>
|
||||
<Box className="card-media-image-container">
|
||||
{imageTags && (
|
||||
<CardMedia
|
||||
component="div"
|
||||
image={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
itemId +
|
||||
"/Images/Primary?fillHeight=300&fillWidth=532&quality=96"
|
||||
}
|
||||
alt={itemName}
|
||||
sx={{
|
||||
width: "100%",
|
||||
aspectRatio: "1.777",
|
||||
borderRadius:
|
||||
borderRadiusDefault,
|
||||
overflow: "hidden",
|
||||
}}
|
||||
className="card-image"
|
||||
></CardMedia>
|
||||
)}
|
||||
</Box>
|
||||
{!!blurhash && (
|
||||
<Blurhash
|
||||
hash={blurhash}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={12}
|
||||
resolutionY={18}
|
||||
style={{
|
||||
aspectRatio: "1.777",
|
||||
}}
|
||||
className="card-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
<div className="card-image-icon-container">
|
||||
{TypeIconCollectionCard["Episode"]}
|
||||
</div>
|
||||
{!!playedPercent && (
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={playedPercent}
|
||||
sx={{
|
||||
width: "90%",
|
||||
position: "absolute",
|
||||
left: "5%",
|
||||
bottom: "5%",
|
||||
borderRadius: "100px",
|
||||
height: "5px",
|
||||
}}
|
||||
color="white"
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
<Box
|
||||
className="card-media-overlay"
|
||||
sx={{
|
||||
display: "flex",
|
||||
alignItems: "flex-end",
|
||||
justifyContent: "flex-end",
|
||||
p: 1,
|
||||
}}
|
||||
>
|
||||
<ButtonGroup>
|
||||
<IconButton
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
handleMarkAsPlayOrUnMarkAsPlay();
|
||||
}}
|
||||
>
|
||||
<MdiCheck
|
||||
sx={{
|
||||
color: isWatched
|
||||
? green[200]
|
||||
: "white",
|
||||
}}
|
||||
/>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
handleLiking();
|
||||
}}
|
||||
>
|
||||
{isFavourite ? (
|
||||
<MdiHeart
|
||||
sx={{ color: pink[700] }}
|
||||
/>
|
||||
) : (
|
||||
<MdiHeartOutline />
|
||||
)}
|
||||
</IconButton>
|
||||
</ButtonGroup>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<CardContent
|
||||
className="card-text-container"
|
||||
sx={{
|
||||
padding: "0 0.5em",
|
||||
alignItems: "flex-start",
|
||||
backgroundColor: "transparent",
|
||||
}}
|
||||
>
|
||||
{!!showName && (
|
||||
<>
|
||||
<Typography
|
||||
gutterBottom={false}
|
||||
variant="h5"
|
||||
component="div"
|
||||
color="white"
|
||||
fontWeight={500}
|
||||
textAlign="left"
|
||||
noWrap
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
navigate(`/item/${parentId}`);
|
||||
}}
|
||||
sx={{
|
||||
"&:hover": {
|
||||
textDecoration: "underline",
|
||||
},
|
||||
}}
|
||||
>
|
||||
{showName}
|
||||
{" - "}
|
||||
{episodeLocation}
|
||||
</Typography>
|
||||
</>
|
||||
)}
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
opacity: !!showName ? 0.75 : 1,
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
}}
|
||||
width="100%"
|
||||
mb={0.5}
|
||||
mt={0.5}
|
||||
>
|
||||
<Typography
|
||||
gutterBottom={false}
|
||||
variant="h6"
|
||||
component="div"
|
||||
color="white"
|
||||
fontWeight={500}
|
||||
textAlign={
|
||||
centerAlignText ? "center" : "left"
|
||||
}
|
||||
noWrap
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
>
|
||||
{itemName}
|
||||
</Typography>
|
||||
{!!itemTicks && (
|
||||
<Typography
|
||||
gutterBottom={false}
|
||||
variant="h6"
|
||||
component="div"
|
||||
color="white"
|
||||
fontWeight={300}
|
||||
textAlign="left"
|
||||
noWrap
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
sx={{
|
||||
opacity: 0.65,
|
||||
flexShrink: 0,
|
||||
}}
|
||||
>
|
||||
{getRuntime(itemTicks)}
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
<Stack
|
||||
alignItems="flex-start"
|
||||
width="100%"
|
||||
direction="row"
|
||||
gap={1}
|
||||
divider={
|
||||
<Divider
|
||||
flexItem
|
||||
orientation="vertical"
|
||||
variant="middle"
|
||||
/>
|
||||
}
|
||||
mb={1}
|
||||
>
|
||||
{!!itemRating && (
|
||||
<Typography
|
||||
gutterBottom={false}
|
||||
variant="subtitle1"
|
||||
component="div"
|
||||
color="white"
|
||||
fontWeight={300}
|
||||
textAlign="left"
|
||||
noWrap
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
sx={{
|
||||
opacity: 0.65,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "flex-start",
|
||||
}}
|
||||
>
|
||||
<MdiStarHalfFull
|
||||
sx={{
|
||||
fontSize: "1.2em",
|
||||
mr: "0.25em",
|
||||
}}
|
||||
/>{" "}
|
||||
{itemRating}
|
||||
</Typography>
|
||||
)}
|
||||
{!!itemTicks && (
|
||||
<Typography
|
||||
gutterBottom={false}
|
||||
variant="subtitle1"
|
||||
component="div"
|
||||
color="white"
|
||||
fontWeight={300}
|
||||
textAlign="left"
|
||||
noWrap
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
sx={{
|
||||
opacity: 0.65,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "flex-start",
|
||||
}}
|
||||
>
|
||||
{endsAt(itemTicks)}
|
||||
</Typography>
|
||||
)}
|
||||
</Stack>
|
||||
<Typography
|
||||
gutterBottom
|
||||
variant="body2"
|
||||
component="div"
|
||||
color="white"
|
||||
textAlign="left"
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
sx={{
|
||||
display: "-webkit-box",
|
||||
overflow: "hidden",
|
||||
WebkitBoxOrient: "vertical",
|
||||
WebkitLineClamp: 3,
|
||||
opacity: 0.45,
|
||||
}}
|
||||
>
|
||||
{subText}
|
||||
</Typography>
|
||||
</CardContent>
|
||||
</CardActionArea>
|
||||
</MuiCard>
|
||||
);
|
||||
};
|
||||
|
||||
EpisodeCard.propTypes = {
|
||||
itemName: PropTypes.string.isRequired,
|
||||
itemId: PropTypes.string.isRequired,
|
||||
imageTags: PropTypes.bool,
|
||||
subText: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
playedPercent: PropTypes.number,
|
||||
onClickEvent: PropTypes.func,
|
||||
watchedStatus: PropTypes.bool,
|
||||
blurhash: PropTypes.string,
|
||||
currentUser: PropTypes.object,
|
||||
favourite: PropTypes.bool,
|
||||
showName: PropTypes.string,
|
||||
episodeLocation: PropTypes.string,
|
||||
itemTicks: PropTypes.number,
|
||||
itemRating: PropTypes.number,
|
||||
centerAlignText: PropTypes.bool,
|
||||
parentId: PropTypes.any,
|
||||
};
|
||||
@@ -16,7 +16,13 @@ import Typography from "@mui/material/Typography";
|
||||
import ButtonGroup from "@mui/material/ButtonGroup";
|
||||
|
||||
import "./cardScroller.module.scss";
|
||||
export const CardScroller = ({ children, displayCards, title }) => {
|
||||
export const CardScroller = ({
|
||||
children,
|
||||
displayCards,
|
||||
title,
|
||||
headingProps,
|
||||
disableDecoration = false,
|
||||
}) => {
|
||||
const responsive = {
|
||||
superLargeDesktop: {
|
||||
// the naming can be any, depends on you.
|
||||
@@ -45,11 +51,19 @@ export const CardScroller = ({ children, displayCards, title }) => {
|
||||
|
||||
return (
|
||||
<Box className="card-scroller-container" sx={{ mb: 4 }}>
|
||||
<Box sx={{ mb: 2 }} className="card-scroller-header-container">
|
||||
<Box
|
||||
sx={{ mb: 1 }}
|
||||
className={
|
||||
disableDecoration
|
||||
? `card-scroller-header-container hidden-decoration`
|
||||
: `card-scroller-header-container`
|
||||
}
|
||||
>
|
||||
<Typography
|
||||
variant="h4"
|
||||
color="textPrimary"
|
||||
className="card-scroller-heading"
|
||||
{...headingProps}
|
||||
>
|
||||
<div className="card-scroller-heading-decoration"></div>{" "}
|
||||
{title}
|
||||
@@ -88,4 +102,5 @@ export const CardScroller = ({ children, displayCards, title }) => {
|
||||
CardScroller.propTypes = {
|
||||
displayCards: PropTypes.number.isRequired,
|
||||
title: PropTypes.string.isRequired,
|
||||
headingProps: PropTypes.any,
|
||||
};
|
||||
@@ -29,3 +29,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.hidden-decoration {
|
||||
.card-scroller-heading-decoration {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import { CardsSkeleton } from "../skeleton/cards";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
|
||||
export const LatestMediaSection = ({ latestMediaLib }) => {
|
||||
const user = useQuery({
|
||||
@@ -15,6 +16,7 @@ export const LatestMediaSection = ({ latestMediaLib }) => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
const fetchLatestMedia = async (library) => {
|
||||
const media = await getUserLibraryApi(window.api).getLatestMedia({
|
||||
@@ -29,6 +31,7 @@ export const LatestMediaSection = ({ latestMediaLib }) => {
|
||||
queryKey: ["homeSection, latestMedia", latestMediaLib],
|
||||
queryFn: () => fetchLatestMedia(latestMediaLib[0]),
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
if (data.isLoading) {
|
||||
return <CardsSkeleton />;
|
||||
@@ -65,7 +68,11 @@ export const LatestMediaSection = ({ latestMediaLib }) => {
|
||||
? "sqaure"
|
||||
: "portait"
|
||||
}
|
||||
watchedStatus={item.UserData.Played}
|
||||
watchedStatus={
|
||||
item.Type == BaseItemKind.Audio
|
||||
? false
|
||||
: item.UserData.Played
|
||||
}
|
||||
watchedCount={
|
||||
item.UserData.UnplayedItemCount
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiAlertDecagram } from "@mdi/js";
|
||||
|
||||
export const MdiAlertDecagram = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiAlertDecagram}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiClockOutline } from "@mdi/js";
|
||||
|
||||
export const MdiClockOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiClockOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
/** @format */
|
||||
|
||||
import { MdiChevronLeft } from "./mdiChevronLeft";
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiCog } from "@mdi/js";
|
||||
|
||||
export const MdiCog = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiCog}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiEmoticonCry } from "@mdi/js";
|
||||
|
||||
export const MdiEmoticonCry = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiEmoticonCry}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiEmoticonDead } from "@mdi/js";
|
||||
|
||||
export const MdiEmoticonDead = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiEmoticonDead}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiInformation } from "@mdi/js";
|
||||
|
||||
export const MdiInformation = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiInformation}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -15,6 +15,7 @@ import Skeleton from "@mui/material/Skeleton";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import List from "@mui/material/List";
|
||||
import ListItem from "@mui/material/ListItem";
|
||||
import Link from "@mui/material/Link";
|
||||
import ListItemText from "@mui/material/ListItemText";
|
||||
import ListItemIcon from "@mui/material/ListItemIcon";
|
||||
import ListItemButton from "@mui/material/ListItemButton";
|
||||
@@ -61,7 +62,6 @@ export const SideMenu = ({}) => {
|
||||
|
||||
const [display, setDisplay] = useState(false);
|
||||
|
||||
const visible = useSelector((state) => state.sidebar.visible);
|
||||
const backdrop = useSelector((state) => state.sidebar.backdrop);
|
||||
const navigate = useNavigate();
|
||||
const user = useQuery({
|
||||
@@ -70,7 +70,8 @@ export const SideMenu = ({}) => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
enabled: false,
|
||||
enabled: !!window.api,
|
||||
networkMode: "always",
|
||||
});
|
||||
let libraries = useQuery({
|
||||
queryKey: ["libraries"],
|
||||
@@ -81,6 +82,7 @@ export const SideMenu = ({}) => {
|
||||
return libs.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
const handleDrawerOpen = () => {};
|
||||
const dispatch = useDispatch();
|
||||
@@ -89,19 +91,22 @@ export const SideMenu = ({}) => {
|
||||
console.log("Logging out user...");
|
||||
await window.api.logout();
|
||||
delUser();
|
||||
dispatch(hideSidemenu());
|
||||
sessionStorage.removeItem("accessToken");
|
||||
event.emit("create-jellyfin-api", window.api.basePath);
|
||||
navigate("/login");
|
||||
};
|
||||
|
||||
const getCurrentPathWithoutParam = () => {
|
||||
const getCurrentLocation = () => {
|
||||
return location.pathname.slice(0, location.pathname.lastIndexOf("/"));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
getCurrentPathWithoutParam() != "/login" &&
|
||||
getCurrentPathWithoutParam() != "/setup/server"
|
||||
location.pathname.includes("login") ||
|
||||
location.pathname.includes("setup")
|
||||
) {
|
||||
setDisplay(false);
|
||||
} else {
|
||||
setDisplay(true);
|
||||
}
|
||||
}, [location]);
|
||||
@@ -119,21 +124,16 @@ export const SideMenu = ({}) => {
|
||||
sx: {
|
||||
backgroundColor: "inherit",
|
||||
border: "none",
|
||||
width: visible
|
||||
? `calc(${theme.spacing(7)} + 10px)`
|
||||
: 0,
|
||||
width: `calc(${theme.spacing(7)} + 10px)`,
|
||||
height: "100vh",
|
||||
// display: visible ? "block" : "none",
|
||||
},
|
||||
}}
|
||||
sx={{
|
||||
width: visible
|
||||
? `calc(${theme.spacing(7)} + 10px)`
|
||||
: 0,
|
||||
width: `calc(${theme.spacing(7)} + 10px)`,
|
||||
background: backdrop
|
||||
? theme.palette.background.paper
|
||||
: "transparent",
|
||||
borderLeft: "1px solid white",
|
||||
}}
|
||||
>
|
||||
<DrawerHeader
|
||||
@@ -183,47 +183,37 @@ export const SideMenu = ({}) => {
|
||||
className="sidemenu-item-container"
|
||||
disablePadding
|
||||
>
|
||||
<NavLink
|
||||
<ListItemButton
|
||||
component={
|
||||
NavLink
|
||||
}
|
||||
to={
|
||||
"/library/" +
|
||||
library.Id
|
||||
}
|
||||
className={({
|
||||
isActive,
|
||||
isPending,
|
||||
}) =>
|
||||
isPending
|
||||
? "sidemenu-item-pending sidemenu-item"
|
||||
: isActive
|
||||
? "sidemenu-item-active sidemenu-item"
|
||||
: "sidemenu-item"
|
||||
}
|
||||
className="sidemenu-item"
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
"center",
|
||||
px: 2.5,
|
||||
}}
|
||||
>
|
||||
<ListItemButton
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
px: 2.5,
|
||||
}}
|
||||
color="white"
|
||||
>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
}}
|
||||
>
|
||||
{
|
||||
MediaCollectionTypeIconCollection[
|
||||
library
|
||||
.CollectionType
|
||||
]
|
||||
}
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</NavLink>
|
||||
{
|
||||
MediaCollectionTypeIconCollection[
|
||||
library
|
||||
.CollectionType
|
||||
]
|
||||
}
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
);
|
||||
@@ -241,38 +231,26 @@ export const SideMenu = ({}) => {
|
||||
className="sidemenu-item-container"
|
||||
disablePadding
|
||||
>
|
||||
<NavLink
|
||||
<ListItemButton
|
||||
component={NavLink}
|
||||
to="/home"
|
||||
className={({
|
||||
isActive,
|
||||
isPending,
|
||||
}) =>
|
||||
isPending
|
||||
? "sidemenu-item-pending sidemenu-item"
|
||||
: isActive
|
||||
? "sidemenu-item-active sidemenu-item"
|
||||
: "sidemenu-item"
|
||||
}
|
||||
className="sidemenu-item"
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent: "center",
|
||||
px: 2.5,
|
||||
}}
|
||||
>
|
||||
<ListItemButton
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
px: 2.5,
|
||||
}}
|
||||
>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
}}
|
||||
>
|
||||
<MdiHomeVariantOutline></MdiHomeVariantOutline>
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</NavLink>
|
||||
<MdiHomeVariantOutline></MdiHomeVariantOutline>
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
<Tooltip
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
transition: transform $transition-time-default,
|
||||
opacity $transition-time-default;
|
||||
}
|
||||
&-active::before {
|
||||
&.active::before {
|
||||
opacity: 1;
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
/** @format */
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import { MdiEmoticonCryOutline } from "../icons/mdiEmoticonCryOutline";
|
||||
import { MdiEmoticonCry } from "../../icons/mdiEmoticonCry";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
export const EmptyNotice = () => {
|
||||
@@ -17,7 +17,7 @@ export const EmptyNotice = () => {
|
||||
opacity: 0.2,
|
||||
}}
|
||||
>
|
||||
<MdiEmoticonCryOutline sx={{ fontSize: 200 }} />
|
||||
<MdiEmoticonCry sx={{ fontSize: 200 }} />
|
||||
<Typography variant="h3">Nothing found</Typography>
|
||||
</Box>
|
||||
);
|
||||
@@ -0,0 +1,24 @@
|
||||
/** @format */
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { MdiEmoticonDead } from "../../icons/mdiEmoticonDead";
|
||||
|
||||
export const ErrorNotice = () => {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
flexFlow: "column",
|
||||
opacity: 0.2,
|
||||
}}
|
||||
>
|
||||
<MdiEmoticonDead sx={{ fontSize: 200 }} />
|
||||
<Typography variant="h3">Something went wrong</Typography>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,85 @@
|
||||
/** @format */
|
||||
|
||||
import Card from "@mui/material/Card";
|
||||
import CardMedia from "@mui/material/CardMedia";
|
||||
import CardContent from "@mui/material/CardContent";
|
||||
import Grid from "@mui/material/Unstable_Grid2";
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Skeleton from "@mui/material/Skeleton";
|
||||
|
||||
import { borderRadiusDefault } from "../../palette.module.scss";
|
||||
|
||||
export const EpisodeCardsSkeleton = () => {
|
||||
return (
|
||||
<Grid
|
||||
container
|
||||
columns={{
|
||||
xs: 2,
|
||||
sm: 3,
|
||||
md: 4,
|
||||
}}
|
||||
sx={{ width: "100%" }}
|
||||
>
|
||||
{Array.from(new Array(4)).map((a, index) => {
|
||||
return (
|
||||
<Grid xs={1} sm={1} md={1} key={index}>
|
||||
<Card
|
||||
sx={{ background: "transparent" }}
|
||||
elevation={0}
|
||||
>
|
||||
<CardMedia>
|
||||
<Skeleton
|
||||
animation="wave"
|
||||
variant="rectangular"
|
||||
sx={{
|
||||
aspectRatio: "1.777",
|
||||
height: "auto",
|
||||
m: 1,
|
||||
borderRadius:
|
||||
borderRadiusDefault,
|
||||
}}
|
||||
/>
|
||||
</CardMedia>
|
||||
<CardContent
|
||||
sx={{
|
||||
padding: "0 0.5em",
|
||||
alignItems: "flex-start",
|
||||
backgroundColor: "transparent",
|
||||
}}
|
||||
>
|
||||
<Typography variant="h6">
|
||||
<Skeleton
|
||||
variant="text"
|
||||
animation="wave"
|
||||
/>
|
||||
</Typography>
|
||||
<Typography variant="subtitle1" mb={1}>
|
||||
<Skeleton
|
||||
variant="text"
|
||||
width="50%"
|
||||
animation="wave"
|
||||
/>
|
||||
</Typography>
|
||||
<Typography variant="body2">
|
||||
<Skeleton
|
||||
variant="text"
|
||||
animation="wave"
|
||||
/>
|
||||
<Skeleton
|
||||
variant="text"
|
||||
animation="wave"
|
||||
/>
|
||||
<Skeleton
|
||||
variant="text"
|
||||
animation="wave"
|
||||
/>
|
||||
</Typography>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Grid>
|
||||
);
|
||||
})}
|
||||
</Grid>
|
||||
);
|
||||
};
|
||||
@@ -101,4 +101,5 @@ export const TypeIconCollectionCard = {
|
||||
UserView: <MdiMultimedia className="card-image-icon" />,
|
||||
Video: <MdiFilmstrip className="card-image-icon" />,
|
||||
Year: <MdiMultimedia className="card-image-icon" />,
|
||||
Genre: <MdiDramaMasks className="card-image-icon" />,
|
||||
};
|
||||
@@ -9,6 +9,7 @@
|
||||
clrBackgroundDefault: $clr-background-default;
|
||||
|
||||
clrBackgroundDark: $clr-background-dark;
|
||||
clrBackgroundDarkOpacity0_8: $clr-background-dark-opacity-0_8;
|
||||
clrBackgroundLight: $clr-background-light;
|
||||
|
||||
borderRadiusDefault: $border-radius-default;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/** @format */
|
||||
|
||||
.about {
|
||||
&-sections {
|
||||
&-container {
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
&-logo {
|
||||
width: 75% !important;
|
||||
max-width: 50vw;
|
||||
height: 15em;
|
||||
object-fit: contain;
|
||||
object-position: center;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
/** @format */
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import TableContainer from "@mui/material/TableContainer";
|
||||
import Table from "@mui/material/Table";
|
||||
import TableHead from "@mui/material/TableHead";
|
||||
import TableRow from "@mui/material/TableRow";
|
||||
import TableBody from "@mui/material/TableBody";
|
||||
import TableCell from "@mui/material/TableCell";
|
||||
import Link from "@mui/material/Link";
|
||||
|
||||
import logo from "../../assets/logo.svg";
|
||||
import jellyfinLogo from "../../assets/jellyfinLogo.svg";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
||||
|
||||
import { version } from "../../../package.json";
|
||||
|
||||
import "./about.module.scss";
|
||||
|
||||
const About = () => {
|
||||
const systemInfo = useQuery({
|
||||
queryKey: ["about", "systemInfo"],
|
||||
queryFn: async () => {
|
||||
const result = await getSystemApi(window.api).getSystemInfo();
|
||||
return result.data;
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<Box
|
||||
component="main"
|
||||
className="scrollY"
|
||||
sx={{
|
||||
flexGrow: 1,
|
||||
pt: 11,
|
||||
px: 3,
|
||||
pb: 3,
|
||||
position: "relative",
|
||||
}}
|
||||
>
|
||||
<Stack
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
className="about-sections"
|
||||
>
|
||||
<Link
|
||||
href="https://github.com/prayag17/JellyPlayer"
|
||||
className="about-logo"
|
||||
>
|
||||
<img width="100%" height="100%" src={logo} />
|
||||
</Link>
|
||||
<TableContainer
|
||||
component={Paper}
|
||||
sx={{ width: "50%", borderRadius: "15px" }}
|
||||
>
|
||||
<Table>
|
||||
<TableBody>
|
||||
<TableRow
|
||||
sx={{
|
||||
"&:last-child td, &:last-child th":
|
||||
{
|
||||
border: 0,
|
||||
},
|
||||
"&:hover": {
|
||||
background:
|
||||
"rgb(255 255 255 / 0.05)",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<TableCell>
|
||||
<Typography
|
||||
variant="h4"
|
||||
fontWeight={100}
|
||||
>
|
||||
Version
|
||||
</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Typography
|
||||
variant="h4"
|
||||
sx={{ opacity: 0.7 }}
|
||||
>
|
||||
{version}
|
||||
</Typography>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow
|
||||
sx={{
|
||||
"&:last-child td, &:last-child th":
|
||||
{
|
||||
border: 0,
|
||||
},
|
||||
"&:hover": {
|
||||
background:
|
||||
"rgb(255 255 255 / 0.05)",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<TableCell>
|
||||
<Typography
|
||||
variant="h4"
|
||||
fontWeight={100}
|
||||
>
|
||||
Jellyfin Version
|
||||
</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Typography
|
||||
variant="h4"
|
||||
sx={{ opacity: 0.7 }}
|
||||
>
|
||||
{systemInfo.isSuccess &&
|
||||
systemInfo.data.Version}
|
||||
</Typography>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow
|
||||
sx={{
|
||||
"&:last-child td, &:last-child th":
|
||||
{
|
||||
border: 0,
|
||||
},
|
||||
"&:hover": {
|
||||
background:
|
||||
"rgb(255 255 255 / 0.05)",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<TableCell>
|
||||
<Typography
|
||||
variant="h4"
|
||||
fontWeight={100}
|
||||
>
|
||||
Server OS
|
||||
</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Typography
|
||||
variant="h4"
|
||||
sx={{ opacity: 0.7 }}
|
||||
>
|
||||
{systemInfo.isSuccess &&
|
||||
systemInfo.data
|
||||
.OperatingSystemDisplayName}
|
||||
</Typography>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default About;
|
||||
@@ -0,0 +1,7 @@
|
||||
/** @format */
|
||||
|
||||
const FavouritePage = () => {
|
||||
return <></>;
|
||||
};
|
||||
|
||||
export default FavouritePage;
|
||||
@@ -69,6 +69,7 @@
|
||||
&-container {
|
||||
position: absolute;
|
||||
background: $clr-gradient-dark;
|
||||
// background: url("/public/assetsStatic//meshbackground.png");
|
||||
z-index: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/** @format */
|
||||
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import { useState } from "react";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
|
||||
import { useQueryClient, useQuery } from "@tanstack/react-query";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { EventEmitter as event } from "../../eventEmitter";
|
||||
import { getServer } from "../../utils/storage/servers";
|
||||
@@ -14,13 +14,11 @@ import { theme } from "../../theme";
|
||||
import "./home.module.scss";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import Skeleton from "@mui/material/Skeleton";
|
||||
import Button from "@mui/material/Button";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||
|
||||
import { yellow } from "@mui/material/colors";
|
||||
|
||||
@@ -39,24 +37,17 @@ import { MdiStarHalfFull } from "../../components/icons/mdiStarHalfFull";
|
||||
import { MdiPlayOutline } from "../../components/icons/mdiPlayOutline";
|
||||
import { MdiChevronRight } from "../../components/icons/mdiChevronRight";
|
||||
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { showSidemenu } from "../../utils/slice/sidemenu";
|
||||
import { showAppBar, setBackdrop } from "../../utils/slice/appBar";
|
||||
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||
|
||||
import { useNavigate, useLocation, Link } from "react-router-dom";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
import { formateDate } from "../../utils/date/formateDate";
|
||||
import { getRuntime } from "../../utils/date/time";
|
||||
|
||||
const Home = () => {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const authUser = useQuery({
|
||||
queryKey: ["home", "authenticateUser"],
|
||||
queryFn: async () => {
|
||||
@@ -72,6 +63,7 @@ const Home = () => {
|
||||
return true;
|
||||
},
|
||||
enabled: false,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const user = useQuery({
|
||||
@@ -80,6 +72,7 @@ const Home = () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const libraries = useQuery({
|
||||
@@ -91,6 +84,7 @@ const Home = () => {
|
||||
return libs.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const latestMedia = useQuery({
|
||||
@@ -106,6 +100,7 @@ const Home = () => {
|
||||
return media.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const resumeItemsVideo = useQuery({
|
||||
@@ -122,6 +117,7 @@ const Home = () => {
|
||||
return resumeItems.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const resumeItemsAudio = useQuery({
|
||||
@@ -138,6 +134,7 @@ const Home = () => {
|
||||
return resumeItems.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const upNextItems = useQuery({
|
||||
@@ -150,14 +147,12 @@ const Home = () => {
|
||||
return upNext.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const [latestMediaLibs, setLatestMediaLibs] = useState([]);
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
||||
const excludeTypes = ["boxsets", "playlists", "livetv", "channels"];
|
||||
|
||||
@@ -165,6 +160,8 @@ const Home = () => {
|
||||
console.log("Logging out user...");
|
||||
await window.api.logout();
|
||||
delUser();
|
||||
sessionStorage.removeItem("accessToken");
|
||||
event.emit("create-jellyfin-api", window.api.basePath);
|
||||
navigate("/login");
|
||||
};
|
||||
|
||||
@@ -187,24 +184,11 @@ const Home = () => {
|
||||
});
|
||||
}
|
||||
|
||||
const appBarVisiblity = useSelector((state) => state.appBar.visible);
|
||||
|
||||
if (!appBarVisiblity) {
|
||||
dispatch(showAppBar());
|
||||
if (user.isPaused) {
|
||||
user.refetch();
|
||||
console.log(user.isError);
|
||||
}
|
||||
|
||||
const [scrollTarget, setScrollTarget] = useState(undefined);
|
||||
|
||||
const trigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 0,
|
||||
target: scrollTarget,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(setBackdrop(trigger));
|
||||
}, [trigger]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box
|
||||
@@ -217,11 +201,6 @@ const Home = () => {
|
||||
pb: 3,
|
||||
position: "relative",
|
||||
}}
|
||||
ref={(node) => {
|
||||
if (node) {
|
||||
setScrollTarget(node);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Carousel
|
||||
className="hero-carousel"
|
||||
@@ -261,7 +240,6 @@ const Home = () => {
|
||||
// <></>
|
||||
latestMedia.data != null &&
|
||||
latestMedia.data.map((item, index) => {
|
||||
// console.log(item);
|
||||
return (
|
||||
<Paper
|
||||
className="hero-carousel-slide"
|
||||
@@ -289,10 +267,10 @@ const Home = () => {
|
||||
width="1080"
|
||||
height="720"
|
||||
resolutionX={
|
||||
720
|
||||
64
|
||||
}
|
||||
resolutionY={
|
||||
1080
|
||||
96
|
||||
}
|
||||
className="hero-carousel-background-blurhash"
|
||||
/>
|
||||
@@ -473,7 +451,11 @@ const Home = () => {
|
||||
endIcon={
|
||||
<MdiChevronRight />
|
||||
}
|
||||
disabled
|
||||
onClick={() =>
|
||||
navigate(
|
||||
`/item/${item.Id}`,
|
||||
)
|
||||
}
|
||||
>
|
||||
More info
|
||||
</Button>
|
||||
@@ -1,362 +0,0 @@
|
||||
/** @format */
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import {
|
||||
setBackdrop,
|
||||
showAppBar,
|
||||
showBackButton,
|
||||
} from "../../../utils/slice/appBar";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useParams } from "react-router-dom";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { MdiStarHalfFull } from "../../../components/icons/mdiStarHalfFull";
|
||||
import { getRuntimeFull } from "../../../utils/date/time";
|
||||
import { TypeIconCollectionCard } from "../../../components/utils/iconsCollection";
|
||||
|
||||
import { Card } from "../../../components/card/card";
|
||||
import { CardScroller } from "../../../components/cardScroller/cardScroller";
|
||||
|
||||
import "./Movie.module.scss";
|
||||
|
||||
const ItemMovie = () => {
|
||||
const { id } = useParams();
|
||||
const dispatch = useDispatch();
|
||||
const appBarVisiblity = useSelector((state) => state.appBar.visible);
|
||||
const [scrollTarget, setScrollTarget] = useState(undefined);
|
||||
const [primageImageLoaded, setPrimaryImageLoaded] = useState(false);
|
||||
const [backdropImageLoaded, setBackdropImageLoaded] = useState(false);
|
||||
|
||||
const trigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 0,
|
||||
target: scrollTarget,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!appBarVisiblity) {
|
||||
dispatch(showAppBar());
|
||||
}
|
||||
dispatch(setBackdrop(trigger));
|
||||
dispatch(showBackButton());
|
||||
}, [trigger]);
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
});
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item,Movie", id],
|
||||
queryFn: async () => {
|
||||
const result = await getUserLibraryApi(window.api).getItem({
|
||||
userId: user.data.Id,
|
||||
itemId: id,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
});
|
||||
if (item.isLoading) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
if (item.isSuccess) {
|
||||
return (
|
||||
<>
|
||||
<Box className="item-detail-backdrop">
|
||||
{item.data.BackdropImageTags.length != 0 && (
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data.ImageBlurHashes.Backdrop[
|
||||
item.data.BackdropImageTags[0]
|
||||
]
|
||||
}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={64}
|
||||
resolutionY={96}
|
||||
style={{
|
||||
aspectRatio: "0.666",
|
||||
}}
|
||||
className="item-detail-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
<Box
|
||||
recomponent="main"
|
||||
className="scrollY"
|
||||
sx={{
|
||||
display: "flex",
|
||||
pt: 11,
|
||||
px: 3,
|
||||
pb: 3,
|
||||
position: "relative",
|
||||
flexFlow: "column",
|
||||
gap: 5,
|
||||
}}
|
||||
ref={(node) => {
|
||||
if (node) {
|
||||
setScrollTarget(node);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Box className="item-detail-header">
|
||||
<Box className="item-detail-header-backdrop">
|
||||
{item.data.BackdropImageTags.length != 0 && (
|
||||
<img
|
||||
src={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
item.data.Id +
|
||||
"/Images/Backdrop"
|
||||
}
|
||||
style={{
|
||||
opacity: backdropImageLoaded
|
||||
? 1
|
||||
: 0,
|
||||
}}
|
||||
className="item-detail-image"
|
||||
onLoad={() =>
|
||||
setBackdropImageLoaded(true)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{item.data.BackdropImageTags.length != 0 && (
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data.ImageBlurHashes
|
||||
.Backdrop[
|
||||
item.data
|
||||
.BackdropImageTags[0]
|
||||
]
|
||||
}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={64}
|
||||
resolutionY={96}
|
||||
style={{
|
||||
aspectRatio: "0.666",
|
||||
}}
|
||||
className="item-detail-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
<Box
|
||||
sx={{ fontSize: "4em" }}
|
||||
className="item-detail-image-icon-container"
|
||||
>
|
||||
{TypeIconCollectionCard[item.data.Type]}
|
||||
</Box>
|
||||
</Box>
|
||||
<Box className="item-detail-image-container">
|
||||
{!!item.data.ImageTags.Primary && (
|
||||
<img
|
||||
src={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
item.data.Id +
|
||||
"/Images/Primary"
|
||||
}
|
||||
style={{
|
||||
opacity: primageImageLoaded
|
||||
? 1
|
||||
: 0,
|
||||
}}
|
||||
className="item-detail-image"
|
||||
onLoad={() =>
|
||||
setPrimaryImageLoaded(true)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{!!item.data.ImageBlurHashes.Primary && (
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data.ImageBlurHashes
|
||||
.Primary[
|
||||
item.data.ImageTags
|
||||
.Primary
|
||||
]
|
||||
}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={64}
|
||||
resolutionY={96}
|
||||
style={{
|
||||
aspectRatio: 0.666,
|
||||
}}
|
||||
className="item-detail-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
<div className="item-detail-image-icon-container">
|
||||
{TypeIconCollectionCard[item.data.Type]}
|
||||
</div>
|
||||
</Box>
|
||||
<Box className="item-detail-info-container">
|
||||
<Box
|
||||
className="item-detail-title-name"
|
||||
sx={{ mb: 2 }}
|
||||
>
|
||||
<Typography variant="h3">
|
||||
{item.data.Name}
|
||||
</Typography>
|
||||
{!!item.data.UserData
|
||||
.PlayedPercentage && (
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={
|
||||
item.data.UserData
|
||||
.PlayedPercentage
|
||||
}
|
||||
sx={{
|
||||
borderRadius: 1000,
|
||||
width: "75%",
|
||||
mt: 1,
|
||||
mb: 1,
|
||||
}}
|
||||
color="primary"
|
||||
/>
|
||||
)}
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
color="gray"
|
||||
>
|
||||
{item.data.OriginalTitle}
|
||||
</Typography>
|
||||
</Box>
|
||||
<Stack
|
||||
direction="row"
|
||||
gap={2}
|
||||
divider={
|
||||
<Divider
|
||||
variant="middle"
|
||||
flexItem
|
||||
orientation="vertical"
|
||||
/>
|
||||
}
|
||||
ex={{ alignItems: "center" }}
|
||||
>
|
||||
<Typography
|
||||
sx={{ flexGrow: 0 }}
|
||||
variant="subtitle1"
|
||||
>
|
||||
{item.data.ProductionYear}
|
||||
</Typography>
|
||||
<Chip
|
||||
variant="outlined"
|
||||
label={
|
||||
!!item.data.OfficialRating
|
||||
? item.data
|
||||
.OfficialRating
|
||||
: "Not Rated"
|
||||
}
|
||||
/>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
gap: "0.25em",
|
||||
alignItems: "center",
|
||||
}}
|
||||
className="item-detail-info-rating"
|
||||
>
|
||||
{!!item.data.CommunityRating ? (
|
||||
<>
|
||||
<MdiStarHalfFull />
|
||||
<Typography variant="subtitle1">
|
||||
{Math.round(
|
||||
item.data
|
||||
.CommunityRating *
|
||||
10,
|
||||
) / 10}
|
||||
</Typography>
|
||||
</>
|
||||
) : (
|
||||
<Typography variant="subtitle1">
|
||||
No Community Rating
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
<Typography variant="subtitle1">
|
||||
{getRuntimeFull(
|
||||
item.data.RunTimeTicks,
|
||||
)}
|
||||
</Typography>
|
||||
</Stack>
|
||||
</Box>
|
||||
</Box>
|
||||
<Box className="item-media-container">
|
||||
<Stack
|
||||
direction="row"
|
||||
gap={1}
|
||||
alignItems="center"
|
||||
>
|
||||
<Typography variant="h5">Genre</Typography>
|
||||
{item.data.Genres.map((genre, index) => {
|
||||
return (
|
||||
<Chip
|
||||
key={index}
|
||||
variant="filled"
|
||||
label={genre}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</Stack>
|
||||
</Box>
|
||||
<Typography variant="body1">
|
||||
{item.data.Overview}
|
||||
</Typography>
|
||||
<CardScroller displayCards={8} title="Cast">
|
||||
{item.data.People.map((person, index) => {
|
||||
return (
|
||||
<Card
|
||||
key={index}
|
||||
itemName={person.Name}
|
||||
itemId={person.Id}
|
||||
// imageTags={false}
|
||||
imageTags={
|
||||
!!person.PrimaryImageTag
|
||||
}
|
||||
iconType="Person"
|
||||
subText={person.Role}
|
||||
cardOrientation="sqaure"
|
||||
currentUser={user.data}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
if (item.isError) {
|
||||
return <h1>{"Something went wrong :("}</h1>;
|
||||
}
|
||||
};
|
||||
|
||||
export default ItemMovie;
|
||||
@@ -1,63 +0,0 @@
|
||||
/** @format */
|
||||
|
||||
.item-detail {
|
||||
&-backdrop {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: inherit;
|
||||
height: 100%;
|
||||
z-index: -2;
|
||||
opacity: 0.1;
|
||||
}
|
||||
&-header {
|
||||
display: flex;
|
||||
gap: 2em;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-end;
|
||||
position: relative;
|
||||
&-backdrop {
|
||||
position: absolute;
|
||||
width: 100vw;
|
||||
height: 150%;
|
||||
top: -88px;
|
||||
width: 100vw;
|
||||
right: 0;
|
||||
left: -24px;
|
||||
z-index: -1;
|
||||
filter: brightness(0.5);
|
||||
mask-image: linear-gradient(0deg, transparent, black);
|
||||
-webkit-mask-image: linear-gradient(0deg, transparent, black);
|
||||
}
|
||||
}
|
||||
&-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
position: absolute;
|
||||
transition: opacity $transition-time-default;
|
||||
&-blurhash {
|
||||
z-index: -1;
|
||||
}
|
||||
&-container {
|
||||
width: 15%;
|
||||
position: relative;
|
||||
aspect-ratio: 0.666;
|
||||
border-radius: $border-radius-default;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 0 15px rgb(0 0 0 / 0.4);
|
||||
}
|
||||
&-icon-container {
|
||||
background: $clr-gradient-dark;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,362 +0,0 @@
|
||||
/** @format */
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import {
|
||||
setBackdrop,
|
||||
showAppBar,
|
||||
showBackButton,
|
||||
} from "../../../utils/slice/appBar";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useParams } from "react-router-dom";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { MdiStarHalfFull } from "../../../components/icons/mdiStarHalfFull";
|
||||
import { getRuntimeFull } from "../../../utils/date/time";
|
||||
import { TypeIconCollectionCard } from "../../../components/utils/iconsCollection";
|
||||
|
||||
import { Card } from "../../../components/card/card";
|
||||
import { CardScroller } from "../../../components/cardScroller/cardScroller";
|
||||
|
||||
import "./Series.module.scss";
|
||||
|
||||
const ItemSeries = () => {
|
||||
const { id } = useParams();
|
||||
const dispatch = useDispatch();
|
||||
const appBarVisiblity = useSelector((state) => state.appBar.visible);
|
||||
const [scrollTarget, setScrollTarget] = useState(undefined);
|
||||
const [primageImageLoaded, setPrimaryImageLoaded] = useState(false);
|
||||
const [backdropImageLoaded, setBackdropImageLoaded] = useState(false);
|
||||
|
||||
const trigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 0,
|
||||
target: scrollTarget,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!appBarVisiblity) {
|
||||
dispatch(showAppBar());
|
||||
}
|
||||
dispatch(setBackdrop(trigger));
|
||||
dispatch(showBackButton());
|
||||
}, [trigger]);
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
});
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item, Series", id],
|
||||
queryFn: async () => {
|
||||
const result = await getUserLibraryApi(window.api).getItem({
|
||||
userId: user.data.Id,
|
||||
itemId: id,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
});
|
||||
if (item.isLoading) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
if (item.isSuccess) {
|
||||
return (
|
||||
<>
|
||||
<Box className="item-detail-backdrop">
|
||||
{item.data.BackdropImageTags.length != 0 && (
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data.ImageBlurHashes.Backdrop[
|
||||
item.data.BackdropImageTags[0]
|
||||
]
|
||||
}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={64}
|
||||
resolutionY={96}
|
||||
style={{
|
||||
aspectRatio: "0.666",
|
||||
}}
|
||||
className="item-detail-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
<Box
|
||||
recomponent="main"
|
||||
className="scrollY"
|
||||
sx={{
|
||||
display: "flex",
|
||||
pt: 11,
|
||||
px: 3,
|
||||
pb: 3,
|
||||
position: "relative",
|
||||
flexFlow: "column",
|
||||
gap: 5,
|
||||
}}
|
||||
ref={(node) => {
|
||||
if (node) {
|
||||
setScrollTarget(node);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Box className="item-detail-header">
|
||||
<Box className="item-detail-header-backdrop">
|
||||
{item.data.BackdropImageTags.length != 0 && (
|
||||
<img
|
||||
src={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
item.data.Id +
|
||||
"/Images/Backdrop"
|
||||
}
|
||||
style={{
|
||||
opacity: backdropImageLoaded
|
||||
? 1
|
||||
: 0,
|
||||
}}
|
||||
className="item-detail-image"
|
||||
onLoad={() =>
|
||||
setBackdropImageLoaded(true)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{item.data.BackdropImageTags.length != 0 && (
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data.ImageBlurHashes
|
||||
.Backdrop[
|
||||
item.data
|
||||
.BackdropImageTags[0]
|
||||
]
|
||||
}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={64}
|
||||
resolutionY={96}
|
||||
style={{
|
||||
aspectRatio: "0.666",
|
||||
}}
|
||||
className="item-detail-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
<Box
|
||||
sx={{ fontSize: "4em" }}
|
||||
className="item-detail-image-icon-container"
|
||||
>
|
||||
{TypeIconCollectionCard[item.data.Type]}
|
||||
</Box>
|
||||
</Box>
|
||||
<Box className="item-detail-image-container">
|
||||
{!!item.data.ImageTags.Primary && (
|
||||
<img
|
||||
src={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
item.data.Id +
|
||||
"/Images/Primary"
|
||||
}
|
||||
style={{
|
||||
opacity: primageImageLoaded
|
||||
? 1
|
||||
: 0,
|
||||
}}
|
||||
className="item-detail-image"
|
||||
onLoad={() =>
|
||||
setPrimaryImageLoaded(true)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{!!item.data.ImageBlurHashes.Primary && (
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data.ImageBlurHashes
|
||||
.Primary[
|
||||
item.data.ImageTags
|
||||
.Primary
|
||||
]
|
||||
}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={64}
|
||||
resolutionY={96}
|
||||
style={{
|
||||
aspectRatio: 0.666,
|
||||
}}
|
||||
className="item-detail-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
<div className="item-detail-image-icon-container">
|
||||
{TypeIconCollectionCard[item.data.Type]}
|
||||
</div>
|
||||
</Box>
|
||||
<Box className="item-detail-info-container">
|
||||
<Box
|
||||
className="item-detail-title-name"
|
||||
sx={{ mb: 2 }}
|
||||
>
|
||||
<Typography variant="h3">
|
||||
{item.data.Name}
|
||||
</Typography>
|
||||
{!!item.data.UserData
|
||||
.PlayedPercentage && (
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={
|
||||
item.data.UserData
|
||||
.PlayedPercentage
|
||||
}
|
||||
sx={{
|
||||
borderRadius: 1000,
|
||||
width: "75%",
|
||||
mt: 1,
|
||||
mb: 1,
|
||||
}}
|
||||
color="primary"
|
||||
/>
|
||||
)}
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
color="gray"
|
||||
>
|
||||
{item.data.OriginalTitle}
|
||||
</Typography>
|
||||
</Box>
|
||||
<Stack
|
||||
direction="row"
|
||||
gap={2}
|
||||
divider={
|
||||
<Divider
|
||||
variant="middle"
|
||||
flexItem
|
||||
orientation="vertical"
|
||||
/>
|
||||
}
|
||||
ex={{ alignItems: "center" }}
|
||||
>
|
||||
<Typography
|
||||
sx={{ flexGrow: 0 }}
|
||||
variant="subtitle1"
|
||||
>
|
||||
{item.data.ProductionYear}
|
||||
</Typography>
|
||||
<Chip
|
||||
variant="outlined"
|
||||
label={
|
||||
!!item.data.OfficialRating
|
||||
? item.data
|
||||
.OfficialRating
|
||||
: "Not Rated"
|
||||
}
|
||||
/>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
gap: "0.25em",
|
||||
alignItems: "center",
|
||||
}}
|
||||
className="item-detail-info-rating"
|
||||
>
|
||||
{!!item.data.CommunityRating ? (
|
||||
<>
|
||||
<MdiStarHalfFull />
|
||||
<Typography variant="subtitle1">
|
||||
{Math.round(
|
||||
item.data
|
||||
.CommunityRating *
|
||||
10,
|
||||
) / 10}
|
||||
</Typography>
|
||||
</>
|
||||
) : (
|
||||
<Typography variant="subtitle1">
|
||||
No Community Rating
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
<Typography variant="subtitle1">
|
||||
{getRuntimeFull(
|
||||
item.data.RunTimeTicks,
|
||||
)}
|
||||
</Typography>
|
||||
</Stack>
|
||||
</Box>
|
||||
</Box>
|
||||
<Box className="item-media-container">
|
||||
<Stack
|
||||
direction="row"
|
||||
gap={1}
|
||||
alignItems="center"
|
||||
>
|
||||
<Typography variant="h5">Genre</Typography>
|
||||
{item.data.Genres.map((genre, index) => {
|
||||
return (
|
||||
<Chip
|
||||
key={index}
|
||||
variant="filled"
|
||||
label={genre}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</Stack>
|
||||
</Box>
|
||||
<Typography variant="body1">
|
||||
{item.data.Overview}
|
||||
</Typography>
|
||||
<CardScroller displayCards={8} title="Cast">
|
||||
{item.data.People.map((person, index) => {
|
||||
return (
|
||||
<Card
|
||||
key={index}
|
||||
itemName={person.Name}
|
||||
itemId={person.Id}
|
||||
// imageTags={false}
|
||||
imageTags={
|
||||
!!person.PrimaryImageTag
|
||||
}
|
||||
iconType="Person"
|
||||
subText={person.Role}
|
||||
cardOrientation="sqaure"
|
||||
currentUser={user.data}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
if (item.isError) {
|
||||
return <h1>{"Something went wrong :("}</h1>;
|
||||
}
|
||||
};
|
||||
|
||||
export default ItemSeries;
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,9 @@
|
||||
/** @format */
|
||||
|
||||
.item-detail {
|
||||
&-heading {
|
||||
opacity: 0.85;
|
||||
}
|
||||
&-backdrop {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
@@ -8,39 +11,46 @@
|
||||
width: inherit;
|
||||
height: 100%;
|
||||
z-index: -2;
|
||||
opacity: 0.1;
|
||||
opacity: 0.2;
|
||||
}
|
||||
&-header {
|
||||
display: flex;
|
||||
gap: 2em;
|
||||
gap: 1em;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-end;
|
||||
position: relative;
|
||||
flex-wrap: wrap;
|
||||
&-backdrop {
|
||||
position: absolute;
|
||||
width: 100vw;
|
||||
height: 150%;
|
||||
height: 135%;
|
||||
top: -88px;
|
||||
width: 100vw;
|
||||
right: 0;
|
||||
left: -24px;
|
||||
z-index: -1;
|
||||
filter: brightness(0.5);
|
||||
mask-image: linear-gradient(0deg, transparent, black);
|
||||
-webkit-mask-image: linear-gradient(0deg, transparent, black);
|
||||
z-index: -2;
|
||||
filter: brightness(0.7);
|
||||
mask-image: linear-gradient(0deg, transparent, black 75%);
|
||||
-webkit-mask-image: linear-gradient(
|
||||
0deg,
|
||||
transparent,
|
||||
black 75%
|
||||
);
|
||||
}
|
||||
}
|
||||
&-image {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
position: absolute;
|
||||
object-position: top;
|
||||
transition: opacity $transition-time-default;
|
||||
&-blurhash {
|
||||
z-index: -1;
|
||||
}
|
||||
&-container {
|
||||
width: 15%;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
aspect-ratio: 0.666;
|
||||
border-radius: $border-radius-default;
|
||||
@@ -60,4 +70,11 @@
|
||||
z-index: -2;
|
||||
}
|
||||
}
|
||||
&-title-logo {
|
||||
filter: drop-shadow(0 0 10px rgb(0 0 0 /0.2));
|
||||
height: 100%;
|
||||
width: 45%;
|
||||
object-fit: contain;
|
||||
object-position: bottom;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,11 @@
|
||||
/** @format */
|
||||
import { useState, useEffect } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import {
|
||||
showAppBar,
|
||||
setBackdrop,
|
||||
showBackButton,
|
||||
} from "../../utils/slice/appBar";
|
||||
import { useParams, useNavigate } from "react-router-dom";
|
||||
import { useParams, useNavigate, Link } from "react-router-dom";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||
import Box from "@mui/material/Box";
|
||||
import Grid2 from "@mui/material/Unstable_Grid2";
|
||||
import Stack from "@mui/material/Stack";
|
||||
@@ -27,10 +23,19 @@ import Accordion from "@mui/material/Accordion";
|
||||
import AccordionSummary from "@mui/material/AccordionSummary";
|
||||
import AccordionDetails from "@mui/material/AccordionDetails";
|
||||
import Button from "@mui/material/Button";
|
||||
import Table from "@mui/material/Table";
|
||||
import TableBody from "@mui/material/TableBody";
|
||||
import TableContainer from "@mui/material/TableContainer";
|
||||
import TableRow from "@mui/material/TableRow";
|
||||
import TableCell from "@mui/material/TableCell";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Pagination from "@mui/material/Pagination";
|
||||
import ButtonBase from "@mui/material/ButtonBase";
|
||||
|
||||
import { theme } from "../../theme";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getArtistsApi } from "@jellyfin/sdk/lib/utils/api/artists-api";
|
||||
import { getGenresApi } from "@jellyfin/sdk/lib/utils/api/genres-api";
|
||||
@@ -39,40 +44,51 @@ import { getStudiosApi } from "@jellyfin/sdk/lib/utils/api/studios-api";
|
||||
import { getPersonsApi } from "@jellyfin/sdk/lib/utils/api/persons-api";
|
||||
|
||||
import { Card } from "../../components/card/card";
|
||||
import { EmptyNotice } from "../../components/emptyNotice/emptyNotice";
|
||||
import { EmptyNotice } from "../../components/notices/emptyNotice/emptyNotice";
|
||||
|
||||
import { MdiSortDescending } from "../../components/icons/mdiSortDescending";
|
||||
import { MdiSortAscending } from "../../components/icons/mdiSortAscending";
|
||||
import { MdiChevronDown } from "../../components/icons/mdiChevronDown";
|
||||
import { MdiFilterOutline } from "../../components/icons/mdiFilterOutline";
|
||||
|
||||
import { clrBackgroundDarkOpacity0_8 } from "../../palette.module.scss";
|
||||
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
|
||||
import {
|
||||
BaseItemKind,
|
||||
ItemFields,
|
||||
SortOrder,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getRuntimeMusic } from "../../utils/date/time";
|
||||
|
||||
import "./library.module.scss";
|
||||
import { MdiMusic } from "../../components/icons/mdiMusic";
|
||||
import { MdiHeart } from "../../components/icons/mdiHeart";
|
||||
import { MdiHeartOutline } from "../../components/icons/mdiHeartOutline";
|
||||
|
||||
const LibraryView = () => {
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
const appBarVisiblity = useSelector((state) => state.appBar.visible);
|
||||
|
||||
if (!appBarVisiblity) {
|
||||
dispatch(showAppBar());
|
||||
}
|
||||
const [page, setPage] = useState(1);
|
||||
const maxDisplayItems = 50;
|
||||
|
||||
const { id } = useParams();
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["libraryView", "user"],
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const [sortAscending, setSortAscending] = useState(false);
|
||||
const [sortBy, setSortBy] = useState("SortName");
|
||||
const [sortByData, setSortByData] = useState([
|
||||
{ title: "Name", value: "SortName" },
|
||||
{ title: "Rating", value: "CommunityRating" },
|
||||
{ title: "Release Date", value: "PremiereDate" },
|
||||
]);
|
||||
const [sortAscending, setSortAscending] = useState(true);
|
||||
const [sortBy, setSortBy] = useState();
|
||||
const [sortByData, setSortByData] = useState();
|
||||
|
||||
const handleSortChange = (e) => {
|
||||
setSortAscending(e.target.checked);
|
||||
console.log(e.target.checked);
|
||||
};
|
||||
const handleSortBy = (e) => {
|
||||
setSortBy(e.target.value);
|
||||
@@ -82,6 +98,7 @@ const LibraryView = () => {
|
||||
const result = await getItemsApi(window.api).getItems({
|
||||
userId: user.data.Id,
|
||||
ids: [libraryId],
|
||||
fields: [ItemFields.RecursiveItemCount],
|
||||
});
|
||||
return result.data;
|
||||
};
|
||||
@@ -89,16 +106,13 @@ const LibraryView = () => {
|
||||
queryKey: ["libraryView", "currentLib", id],
|
||||
queryFn: () => fetchLib(id),
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
if (currentLib.isSuccess) {
|
||||
dispatch(showBackButton());
|
||||
}
|
||||
|
||||
const [isPlayed, setIsPlayed] = useState(false);
|
||||
const [isUnPlayed, setIsUnPlayed] = useState(false);
|
||||
const [isResumable, setIsResumable] = useState(false);
|
||||
const [isFavourite, setIsFavourite] = useState(false);
|
||||
const [isFavorite, setisFavorite] = useState(false);
|
||||
const [isLiked, setIsLiked] = useState(false);
|
||||
const [isUnliked, setIsUnliked] = useState(false);
|
||||
const availableWatchStatus = [
|
||||
@@ -120,7 +134,7 @@ const LibraryView = () => {
|
||||
{
|
||||
title: "Favourite",
|
||||
value: false,
|
||||
state: (val) => setIsFavourite(val),
|
||||
state: (val) => setisFavorite(val),
|
||||
},
|
||||
{
|
||||
title: "Liked",
|
||||
@@ -186,33 +200,88 @@ const LibraryView = () => {
|
||||
if (currentLib.isSuccess) {
|
||||
if (currentLib.data.Items[0].CollectionType == "movies") {
|
||||
setViewType([
|
||||
{ title: "Movies", value: "Movie" },
|
||||
{ title: "Collections", value: "BoxSet" },
|
||||
{ title: "Actors", value: "Person" },
|
||||
{ title: "Genres", value: "Genre" },
|
||||
{ title: "Studios", value: "Studio" },
|
||||
{ title: "Movies", value: BaseItemKind.Movie },
|
||||
{ title: "Collections", value: BaseItemKind.BoxSet },
|
||||
{ title: "Actors", value: BaseItemKind.Person },
|
||||
{ title: "Genres", value: BaseItemKind.Genre },
|
||||
{ title: "Studios", value: BaseItemKind.Studio },
|
||||
]);
|
||||
} else if (currentLib.data.Items[0].CollectionType == "music") {
|
||||
setViewType([
|
||||
{ title: "Albums", value: "MusicAlbum" },
|
||||
{ title: "Artists", value: "MusicArtist" },
|
||||
{ title: "Genres", value: "MusicGenre" },
|
||||
{ title: "Albums", value: BaseItemKind.MusicAlbum },
|
||||
{ title: "Songs", value: BaseItemKind.Audio },
|
||||
{ title: "Artists", value: BaseItemKind.MusicArtist },
|
||||
{ title: "Genres", value: BaseItemKind.MusicGenre },
|
||||
]);
|
||||
} else if (
|
||||
currentLib.data.Items[0].CollectionType == "tvshows"
|
||||
) {
|
||||
setViewType([
|
||||
{ title: "Series", value: "Series" },
|
||||
{ title: "Actors", value: "Person" },
|
||||
{ title: "Genres", value: "Genre" },
|
||||
{ title: "Networks", value: "Studio" },
|
||||
{ title: "Series", value: BaseItemKind.Series },
|
||||
{ title: "Actors", value: BaseItemKind.Person },
|
||||
{ title: "Genres", value: BaseItemKind.Genre },
|
||||
{ title: "Networks", value: BaseItemKind.Studio },
|
||||
]);
|
||||
} else {
|
||||
setViewType([]);
|
||||
}
|
||||
|
||||
if (currentLib.data.Items[0].CollectionType == "movies") {
|
||||
setSortByData([
|
||||
{ title: "Name", value: "SortName" },
|
||||
{ title: "Critic Rating", value: "CriticRating" },
|
||||
{ title: "Rating", value: "CommunityRating" },
|
||||
{ title: "Date Added", value: "DateCreated" },
|
||||
{ title: "Play Count", value: "PlayCount" },
|
||||
{ title: "Release Date", value: "PremiereDate" },
|
||||
{ title: "Runtime", value: "Runtime" },
|
||||
{ title: "Random", value: "Random" },
|
||||
]);
|
||||
} else if (
|
||||
currentLib.data.Items[0].CollectionType == "tvshows"
|
||||
) {
|
||||
setSortByData([
|
||||
{ title: "Name", value: "SortName" },
|
||||
{ title: "Critic Rating", value: "CriticRating" },
|
||||
{ title: "Rating", value: "CommunityRating" },
|
||||
{ title: "Date Added", value: "DateCreated" },
|
||||
{ title: "Date Played", value: "DatePlayed" },
|
||||
{ title: "Release Date", value: "PremiereDate" },
|
||||
{ title: "Random", value: "Random" },
|
||||
]);
|
||||
} else if (currentLib.data.Items[0].CollectionType == "music") {
|
||||
setSortByData([
|
||||
{ title: "Name", value: "Name" },
|
||||
{ title: "Album Artist", value: "AlbumArtist" },
|
||||
{ title: "Critic Rating", value: "CriticRating" },
|
||||
{ title: "Rating", value: "CommunityRating" },
|
||||
{ title: "Release Date", value: "PremiereDate" },
|
||||
{ title: "Date Added", value: "DateCreated" },
|
||||
{ title: "Play Count", value: "PlayCount" },
|
||||
{ title: "Runtime", value: "Runtime" },
|
||||
{ title: "Random", value: "Random" },
|
||||
]);
|
||||
} else {
|
||||
setSortByData([
|
||||
{ title: "Name", value: "SortName" },
|
||||
{ title: "Critic Rating", value: "CriticRating" },
|
||||
{ title: "Rating", value: "CommunityRating" },
|
||||
{ title: "Release Date", value: "PremiereDate" },
|
||||
{ title: "Date Added", value: "DateCreated" },
|
||||
{ title: "Play Count", value: "PlayCount" },
|
||||
{ title: "Runtime", value: "Runtime" },
|
||||
{ title: "Random", value: "Random" },
|
||||
]);
|
||||
}
|
||||
}
|
||||
}, [currentLib.isSuccess]);
|
||||
|
||||
useEffect(() => {
|
||||
if (sortByData != undefined) {
|
||||
setSortBy(sortByData[0].value);
|
||||
}
|
||||
}, [sortByData]);
|
||||
|
||||
const fetchLibItems = async (libraryId) => {
|
||||
let result;
|
||||
if (currentViewType == "MusicArtist") {
|
||||
@@ -244,15 +313,27 @@ const LibraryView = () => {
|
||||
result = await getItemsApi(window.api).getItems({
|
||||
userId: user.data.Id,
|
||||
parentId: libraryId,
|
||||
recursive: true,
|
||||
recursive:
|
||||
currentLib.data.Items[0].CollectionType ===
|
||||
"homevideos" ||
|
||||
currentLib.data.Items[0].Type === "Folder" ||
|
||||
(currentLib.data.Items[0].Type ===
|
||||
"CollectionFolder" &&
|
||||
!("CollectionType" in currentLib.data.Items[0]))
|
||||
? undefined
|
||||
: true,
|
||||
includeItemTypes: [currentViewType],
|
||||
sortOrder: [sortAscending ? "Ascending" : "Descending"],
|
||||
sortOrder: [
|
||||
sortAscending
|
||||
? SortOrder.Ascending
|
||||
: SortOrder.Descending,
|
||||
],
|
||||
sortBy: sortBy,
|
||||
filters: [
|
||||
isPlayed && "IsPlayed",
|
||||
isUnPlayed && "IsUnplayed",
|
||||
isResumable && "IsResumable",
|
||||
isFavourite && "IsFavorite",
|
||||
isFavorite && "IsFavorite",
|
||||
isLiked && "IsFavoriteOrLikes",
|
||||
isUnliked && "Dislikes",
|
||||
],
|
||||
@@ -265,6 +346,8 @@ const LibraryView = () => {
|
||||
isHd: isHD ? true : undefined,
|
||||
is4K: is4K ? true : undefined,
|
||||
is3D: is3D ? true : undefined,
|
||||
startIndex: maxDisplayItems * (page - 1),
|
||||
limit: maxDisplayItems,
|
||||
});
|
||||
}
|
||||
return result.data;
|
||||
@@ -275,15 +358,18 @@ const LibraryView = () => {
|
||||
"libraryView",
|
||||
"currentLibItems",
|
||||
id,
|
||||
`page: ${page}`,
|
||||
[
|
||||
currentViewType,
|
||||
sortAscending,
|
||||
|
||||
sortAscending ? SortOrder.Ascending : SortOrder.Descending,
|
||||
,
|
||||
sortBy,
|
||||
[
|
||||
isPlayed,
|
||||
isUnPlayed,
|
||||
isResumable,
|
||||
isFavourite,
|
||||
isFavorite,
|
||||
isLiked,
|
||||
isUnliked,
|
||||
],
|
||||
@@ -298,20 +384,30 @@ const LibraryView = () => {
|
||||
],
|
||||
],
|
||||
queryFn: () => fetchLibItems(id),
|
||||
enabled: !!user.data,
|
||||
enabled: currentLib.isSuccess,
|
||||
networkMode: "always",
|
||||
keepPreviousData: true,
|
||||
});
|
||||
|
||||
dispatch(setBackdrop(true));
|
||||
|
||||
const handleCurrentViewType = (e) => {
|
||||
setCurrentViewType(e.target.value);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (viewType.length != 0) setCurrentViewType(viewType[0].value);
|
||||
if (viewType.length != 0) {
|
||||
setCurrentViewType(viewType[0].value);
|
||||
console.log(viewType);
|
||||
}
|
||||
}, [viewType]);
|
||||
|
||||
const allowedSortViews = ["Movie", "Series", "MusicAlbum"];
|
||||
const disabledSortViews = [
|
||||
"MusicArtist",
|
||||
"Person",
|
||||
"Genre",
|
||||
"MusicGenre",
|
||||
"MusicGenre",
|
||||
"Studio",
|
||||
];
|
||||
const allowedFilterViews = ["movies", "tvshows", "music", "books"];
|
||||
const onlyStatusFilterViews = ["books", "music"];
|
||||
|
||||
@@ -324,6 +420,27 @@ const LibraryView = () => {
|
||||
setFilterButtonAnchorEl(null);
|
||||
};
|
||||
|
||||
const trigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 1,
|
||||
});
|
||||
|
||||
const handleLiking = async (item) => {
|
||||
let result;
|
||||
if (item.UserData.isFavorite) {
|
||||
result = await getUserLibraryApi(window.api).unmarkFavoriteItem({
|
||||
userId: user.data.Id,
|
||||
itemId: item.Id,
|
||||
});
|
||||
} else if (!item.UserData.isFavorite) {
|
||||
result = await getUserLibraryApi(window.api).markFavoriteItem({
|
||||
userId: user.data.Id,
|
||||
itemId: item.Id,
|
||||
});
|
||||
}
|
||||
items.refetch();
|
||||
};
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -343,13 +460,29 @@ const LibraryView = () => {
|
||||
>
|
||||
<AppBar
|
||||
position="fixed"
|
||||
elevation={0}
|
||||
elevation={trigger ? 1 : 0}
|
||||
sx={{
|
||||
width: `calc(100vw - ${theme.spacing(7)} - 10px)`,
|
||||
width: `calc(100vw - ${theme.spacing(7)})`,
|
||||
mt: 8,
|
||||
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 />
|
||||
<Divider
|
||||
sx={{
|
||||
transform: trigger
|
||||
? "scaleX(1)"
|
||||
: "scaleX(0)",
|
||||
transition: "transform 150ms",
|
||||
transformOrigin: "left",
|
||||
transitionDelay: "50ms",
|
||||
}}
|
||||
/>
|
||||
<Toolbar sx={{ justifyContent: "space-between" }}>
|
||||
<Stack alignItems="center" direction="row">
|
||||
<Typography
|
||||
@@ -664,33 +797,79 @@ const LibraryView = () => {
|
||||
</Menu>
|
||||
</>
|
||||
)}
|
||||
{allowedSortViews.includes(
|
||||
{!disabledSortViews.includes(
|
||||
currentViewType,
|
||||
) && (
|
||||
<>
|
||||
<Checkbox
|
||||
icon={<MdiSortDescending />}
|
||||
checkedIcon={
|
||||
<MdiSortAscending />
|
||||
}
|
||||
color="white"
|
||||
onChange={handleSortChange}
|
||||
defaultValue={sortAscending}
|
||||
sx={{
|
||||
color: "white !important",
|
||||
}}
|
||||
/>
|
||||
{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
|
||||
defaultValue={
|
||||
sortByData[0].value
|
||||
}
|
||||
// value={viewType[0].value}
|
||||
value={currentViewType}
|
||||
size="small"
|
||||
variant="filled"
|
||||
onChange={handleSortBy}
|
||||
onChange={
|
||||
handleCurrentViewType
|
||||
}
|
||||
>
|
||||
{sortByData.map(
|
||||
{viewType.map(
|
||||
(item, index) => {
|
||||
return (
|
||||
<MenuItem
|
||||
@@ -701,126 +880,260 @@ const LibraryView = () => {
|
||||
item.value
|
||||
}
|
||||
>
|
||||
{`By ${item.title}`}
|
||||
{
|
||||
item.title
|
||||
}
|
||||
</MenuItem>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</TextField>
|
||||
</>
|
||||
)}
|
||||
{viewType.length != 0 && (
|
||||
<TextField
|
||||
select
|
||||
hiddenLabel
|
||||
defaultValue={viewType[0].value}
|
||||
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.isSuccess &&
|
||||
(items.data.TotalRecordCount == 0 ? (
|
||||
<EmptyNotice />
|
||||
) : (
|
||||
<Grid2
|
||||
container
|
||||
columns={{ xs: 3, sm: 5, md: 8 }}
|
||||
>
|
||||
{items.data.Items.map((item, index) => {
|
||||
return (
|
||||
<Grid2
|
||||
key={index}
|
||||
xs={1}
|
||||
sm={1}
|
||||
md={1}
|
||||
>
|
||||
<Card
|
||||
itemName={item.Name}
|
||||
itemId={item.Id}
|
||||
imageTags={
|
||||
!!item.ImageTags
|
||||
.Primary
|
||||
}
|
||||
subText={
|
||||
item.ProductionYear
|
||||
}
|
||||
iconType={item.Type}
|
||||
playedPercent={
|
||||
!!item.UserData
|
||||
? item.UserData
|
||||
.PlayedPercentage
|
||||
: 0
|
||||
}
|
||||
cardOrientation={
|
||||
item.Type ==
|
||||
"MusicArtist" ||
|
||||
item.Type ==
|
||||
"MusicAlbum" ||
|
||||
item.Type ==
|
||||
"MusicGenre" ||
|
||||
item.Type ==
|
||||
"Playlist"
|
||||
? "square"
|
||||
: "portait"
|
||||
}
|
||||
watchedStatus={
|
||||
!!item.UserData
|
||||
? item.UserData
|
||||
.Played
|
||||
: false
|
||||
}
|
||||
watchedCount={
|
||||
!!item.UserData &&
|
||||
item.UserData
|
||||
.UnplayedItemCount
|
||||
}
|
||||
blurhash={
|
||||
item.ImageBlurHashes ==
|
||||
{}
|
||||
? ""
|
||||
: !!item
|
||||
.ImageTags
|
||||
.Primary
|
||||
? !!item
|
||||
{items.isLoading || items.isFetching ? (
|
||||
<Box
|
||||
sx={{
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<CircularProgress
|
||||
variant="indeterminate"
|
||||
sx={{
|
||||
position: "absolute",
|
||||
top: "50%",
|
||||
left: "50%",
|
||||
transform: "translate(-50%,50%)",
|
||||
width: "50%",
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
) : items.data.TotalRecordCount == 0 ? (
|
||||
<EmptyNotice />
|
||||
) : currentViewType != BaseItemKind.Audio ? (
|
||||
<Grid2 container columns={{ xs: 2, sm: 4, md: 8 }}>
|
||||
{items.data.Items.map((item, index) => {
|
||||
return (
|
||||
<Grid2
|
||||
key={item.Id}
|
||||
xs={1}
|
||||
sm={1}
|
||||
md={1}
|
||||
>
|
||||
<Card
|
||||
itemName={item.Name}
|
||||
itemId={item.Id}
|
||||
imageTags={
|
||||
!!item.ImageTags.Primary
|
||||
}
|
||||
subText={item.ProductionYear}
|
||||
iconType={item.Type}
|
||||
playedPercent={
|
||||
!!item.UserData
|
||||
? item.UserData
|
||||
.PlayedPercentage
|
||||
: 0
|
||||
}
|
||||
cardOrientation={
|
||||
item.Type ==
|
||||
"MusicArtist" ||
|
||||
item.Type ==
|
||||
"MusicAlbum" ||
|
||||
item.Type ==
|
||||
"MusicGenre" ||
|
||||
item.Type == "Playlist"
|
||||
? "square"
|
||||
: "portait"
|
||||
}
|
||||
watchedStatus={
|
||||
!!item.UserData
|
||||
? item.UserData
|
||||
.Played
|
||||
: false
|
||||
}
|
||||
watchedCount={
|
||||
!!item.UserData &&
|
||||
item.UserData
|
||||
.UnplayedItemCount
|
||||
}
|
||||
blurhash={
|
||||
item.ImageBlurHashes ==
|
||||
{}
|
||||
? ""
|
||||
: !!item.ImageTags
|
||||
.Primary
|
||||
? !!item
|
||||
.ImageBlurHashes
|
||||
.Primary
|
||||
? item
|
||||
.ImageBlurHashes
|
||||
.Primary
|
||||
? item
|
||||
.ImageBlurHashes
|
||||
.Primary[
|
||||
item
|
||||
.ImageTags
|
||||
.Primary
|
||||
]
|
||||
: ""
|
||||
.Primary[
|
||||
item
|
||||
.ImageTags
|
||||
.Primary
|
||||
]
|
||||
: ""
|
||||
}
|
||||
currentUser={user.data}
|
||||
onClickEvent={() => {
|
||||
navigate(
|
||||
`/item/${item.Type}/${item.Id}`,
|
||||
);
|
||||
: ""
|
||||
}
|
||||
currentUser={user.data}
|
||||
></Card>
|
||||
</Grid2>
|
||||
);
|
||||
})}
|
||||
</Grid2>
|
||||
) : (
|
||||
<TableContainer>
|
||||
<Table>
|
||||
<TableBody>
|
||||
{items.data.Items.map((item, index) => {
|
||||
return (
|
||||
<TableRow
|
||||
key={index}
|
||||
sx={{
|
||||
"& td,& th": {
|
||||
borderBottom:
|
||||
"1px solid rgb(255 255 255 / 0.1)",
|
||||
},
|
||||
"&:last-child td, &:last-child th":
|
||||
{ border: 0 },
|
||||
"&:hover": {
|
||||
background:
|
||||
"rgb(255 255 255 / 0.05)",
|
||||
},
|
||||
}}
|
||||
></Card>
|
||||
</Grid2>
|
||||
);
|
||||
})}
|
||||
</Grid2>
|
||||
))}
|
||||
>
|
||||
<TableCell width="4.5em">
|
||||
<Box className="library-list-image-container">
|
||||
{!!item
|
||||
.ImageTags
|
||||
.Primary && (
|
||||
<img
|
||||
className="library-list-image"
|
||||
src={`${window.api.basePath}/Items/${item.Id}/Images/Primary?quality=80&tag=${item.ImageTags.Primary}`}
|
||||
/>
|
||||
)}
|
||||
<Box className="library-list-icon-container">
|
||||
<MdiMusic className="library-list-icon" />
|
||||
</Box>
|
||||
</Box>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Typography variant="h6">
|
||||
{item.Name}
|
||||
</Typography>
|
||||
<Stack
|
||||
direction="row"
|
||||
divider={
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
sx={{
|
||||
opacity: 0.7,
|
||||
}}
|
||||
>
|
||||
,
|
||||
</Typography>
|
||||
}
|
||||
>
|
||||
{item.Artists.map(
|
||||
(
|
||||
artist,
|
||||
aindex,
|
||||
) => {
|
||||
return (
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
sx={{
|
||||
opacity: 0.7,
|
||||
}}
|
||||
key={
|
||||
aindex
|
||||
}
|
||||
>
|
||||
{
|
||||
artist
|
||||
}
|
||||
</Typography>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</Stack>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Typography variant="subtitle1">
|
||||
{getRuntimeMusic(
|
||||
item.RunTimeTicks,
|
||||
)}
|
||||
</Typography>
|
||||
</TableCell>
|
||||
<TableCell width="1em">
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
handleLiking(
|
||||
item,
|
||||
);
|
||||
}}
|
||||
>
|
||||
{item.UserData
|
||||
.IsFavorite ? (
|
||||
<MdiHeart />
|
||||
) : (
|
||||
<MdiHeartOutline />
|
||||
)}
|
||||
</IconButton>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
})}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
)}
|
||||
|
||||
{!items.isFetching &&
|
||||
items.isSuccess &&
|
||||
items.data.TotalRecordCount > 75 && (
|
||||
<Stack
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
paddingTop={2}
|
||||
direction="row"
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
sx={{ opacity: 0.5 }}
|
||||
>
|
||||
{maxDisplayItems * (page - 1)} -{" "}
|
||||
{items.data.TotalRecordCount <=
|
||||
maxDisplayItems * page
|
||||
? items.data.TotalRecordCount
|
||||
: maxDisplayItems * page}{" "}
|
||||
of {items.data.TotalRecordCount}
|
||||
</Typography>
|
||||
<Pagination
|
||||
page={page}
|
||||
onChange={(e, val) => {
|
||||
setPage(val);
|
||||
}}
|
||||
count={Math.ceil(
|
||||
items.data.TotalRecordCount /
|
||||
maxDisplayItems,
|
||||
)}
|
||||
sx={{
|
||||
width: "fit-content",
|
||||
}}
|
||||
/>
|
||||
</Stack>
|
||||
)}
|
||||
|
||||
{items.isError && <ErrorNotice />}
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
@@ -0,0 +1,36 @@
|
||||
/** @format */
|
||||
.library-list {
|
||||
&-image {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1;
|
||||
object-fit: cover;
|
||||
&-container {
|
||||
position: relative;
|
||||
width: 4.5em;
|
||||
height: 4.5em;
|
||||
aspect-ratio: 1;
|
||||
border-radius: $border-radius-intensity-1;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2px 7px rgb(0 0 0 / 0.2);
|
||||
}
|
||||
}
|
||||
&-icon {
|
||||
font-size: 3em;
|
||||
fill: url(#clr-gradient-default) !important;
|
||||
|
||||
&-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 0;
|
||||
background: $clr-gradient-dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,16 +5,19 @@ import { useQuery } from "@tanstack/react-query";
|
||||
import { useNavigate, useParams, Link } from "react-router-dom";
|
||||
import { EventEmitter as event } from "../../eventEmitter.js";
|
||||
|
||||
import { useDispatch } from "react-redux";
|
||||
import { showSidemenu } from "../../utils/slice/sidemenu.js";
|
||||
|
||||
import { getServer } from "../../utils/storage/servers.js";
|
||||
import { saveUser } from "../../utils/storage/user.js";
|
||||
|
||||
// import Icon from "mdi-material-ui";
|
||||
import { MdiEyeOffOutline } from "../../components/icons/mdiEyeOffOutline";
|
||||
import { MdiEyeOutline } from "../../components/icons/mdiEyeOutline";
|
||||
import { MdiChevronRight } from "../../components/icons/mdiChevronRight";
|
||||
import { MdiEyeOffOutline } from "../../components/icons/mdiEyeOffOutline.jsx";
|
||||
import { MdiEyeOutline } from "../../components/icons/mdiEyeOutline.jsx";
|
||||
import { MdiChevronRight } from "../../components/icons/mdiChevronRight.jsx";
|
||||
|
||||
import Container from "@mui/material/Container";
|
||||
import Grid from "@mui/material/Grid";
|
||||
import Grid from "@mui/material/Unstable_Grid2";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import OutlinedInput from "@mui/material/OutlinedInput";
|
||||
import FormControl from "@mui/material/FormControl";
|
||||
@@ -23,6 +26,9 @@ import InputLabel from "@mui/material/InputLabel";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import LoadingButton from "@mui/lab/LoadingButton";
|
||||
import Button from "@mui/material/Button";
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import { useSnackbar } from "notistack";
|
||||
import FormGroup from "@mui/material/FormGroup";
|
||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||
@@ -40,8 +46,10 @@ import { getBrandingApi } from "@jellyfin/sdk/lib/utils/api/branding-api";
|
||||
|
||||
import "./login.module.scss";
|
||||
import { CardsSkeleton } from "../../components/skeleton/cards.jsx";
|
||||
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice.jsx";
|
||||
|
||||
export const LoginWithImage = () => {
|
||||
const dispatch = useDispatch();
|
||||
const { userName, userId } = useParams();
|
||||
|
||||
const [password, setPassword] = useState({
|
||||
@@ -91,6 +99,7 @@ export const LoginWithImage = () => {
|
||||
}
|
||||
event.emit("set-api-accessToken", window.api.basePath);
|
||||
setLoading(false);
|
||||
dispatch(showSidemenu());
|
||||
navigate(`/home`);
|
||||
};
|
||||
|
||||
@@ -101,13 +110,22 @@ export const LoginWithImage = () => {
|
||||
return (
|
||||
<>
|
||||
<AppBarBackOnly />
|
||||
<Container maxWidth="xs" className="centered">
|
||||
<Container
|
||||
maxWidth="xs"
|
||||
sx={{
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Grid
|
||||
container
|
||||
direction="column"
|
||||
justifyContent="center"
|
||||
alignItems="center"
|
||||
spacing={2}
|
||||
width="100%"
|
||||
>
|
||||
<Grid
|
||||
container
|
||||
@@ -120,9 +138,9 @@ export const LoginWithImage = () => {
|
||||
textAlign="center"
|
||||
variant="h3"
|
||||
color="textPrimary"
|
||||
mb={2}
|
||||
>
|
||||
Login
|
||||
<br />
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid
|
||||
@@ -130,6 +148,7 @@ export const LoginWithImage = () => {
|
||||
direction="column"
|
||||
justifyContent="center"
|
||||
alignItems="center"
|
||||
mb={1}
|
||||
>
|
||||
<AvatarImage userId={userId} />
|
||||
<Typography
|
||||
@@ -222,31 +241,58 @@ export const UserLogin = () => {
|
||||
queryKey: ["login", "users"],
|
||||
queryFn: async () => {
|
||||
const users = await getUserApi(window.api).getPublicUsers();
|
||||
// console.log(users.data);
|
||||
console.log(users.data);
|
||||
return users.data;
|
||||
// return {};
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<AppBarBackOnly />
|
||||
<Container maxWidth="md" className="centered">
|
||||
{/* <Typography variant="h3" sx={{ marginBottom: "1em" }}>
|
||||
Users
|
||||
</Typography> */}
|
||||
{users.isLoading ? (
|
||||
<CardsSkeleton />
|
||||
) : (
|
||||
<CardScroller displayCards={5} title="Users">
|
||||
if (users.isLoading) {
|
||||
return <LinearProgress />;
|
||||
}
|
||||
if (users.isSuccess) {
|
||||
return (
|
||||
<>
|
||||
<AppBarBackOnly />
|
||||
<Container
|
||||
maxWidth="md"
|
||||
sx={{
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Typography variant="h3" mb={2}>
|
||||
Users
|
||||
</Typography>
|
||||
|
||||
<Grid
|
||||
container
|
||||
columns={{
|
||||
xs: 2,
|
||||
sm: 3,
|
||||
md: 4,
|
||||
}}
|
||||
wrap="nowrap"
|
||||
alignItems="center"
|
||||
overflow="auto"
|
||||
width="100%"
|
||||
mb={3}
|
||||
paddingBottom={2}
|
||||
className="roundedScrollbar"
|
||||
>
|
||||
{users.data.map((item, index) => {
|
||||
return (
|
||||
//
|
||||
<Link
|
||||
to={`/login/withImg/${item.Name}/${item.Id}/`}
|
||||
key={item.Id}
|
||||
className="userCard"
|
||||
index={index}
|
||||
<Grid
|
||||
key={index}
|
||||
flexShrink={0}
|
||||
flexGrow={1}
|
||||
xs={1}
|
||||
sm={1}
|
||||
md={1}
|
||||
>
|
||||
<Card
|
||||
key={index}
|
||||
@@ -258,38 +304,48 @@ export const UserLogin = () => {
|
||||
// cardType="sqaure"
|
||||
iconType="Person"
|
||||
cardOrientation="sqaure"
|
||||
onClickEvent={() =>
|
||||
navigate(
|
||||
`/login/withImg/${item.Name}/${item.Id}/`,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Link>
|
||||
</Grid>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
<div className="buttons">
|
||||
<Button
|
||||
color="secondary"
|
||||
variant="contained"
|
||||
className="userEventButton"
|
||||
onClick={handleChangeServer}
|
||||
>
|
||||
Change Server
|
||||
</Button>
|
||||
<Button
|
||||
variant="contained"
|
||||
className="userEventButton"
|
||||
onClick={handleManualLogin}
|
||||
>
|
||||
Manual Login
|
||||
</Button>
|
||||
</div>
|
||||
</Container>
|
||||
</>
|
||||
);
|
||||
</Grid>
|
||||
|
||||
<div className="buttons">
|
||||
<Button
|
||||
color="secondary"
|
||||
variant="contained"
|
||||
className="userEventButton"
|
||||
onClick={handleChangeServer}
|
||||
>
|
||||
Change Server
|
||||
</Button>
|
||||
<Button
|
||||
variant="contained"
|
||||
className="userEventButton"
|
||||
onClick={handleManualLogin}
|
||||
>
|
||||
Manual Login
|
||||
</Button>
|
||||
</div>
|
||||
</Container>
|
||||
</>
|
||||
);
|
||||
}
|
||||
if (users.isError) {
|
||||
return <ErrorNotice />;
|
||||
}
|
||||
};
|
||||
|
||||
export const UserLoginManual = () => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [rememberMe, setRememberMe] = useState(true);
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
@@ -306,7 +362,8 @@ export const UserLoginManual = () => {
|
||||
).getBrandingOptions();
|
||||
return result.data;
|
||||
},
|
||||
enabled: !window.api,
|
||||
enabled: !!window.api,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const handleUsername = (event) => {
|
||||
@@ -362,14 +419,27 @@ export const UserLoginManual = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
{server.isLoading && <LinearProgress />}
|
||||
<AppBarBackOnly />
|
||||
<Container maxWidth="xs" className="centered">
|
||||
<Container
|
||||
maxWidth="xs"
|
||||
sx={{
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Grid
|
||||
container
|
||||
spacing={2}
|
||||
direction="column"
|
||||
justifyContent="center"
|
||||
alignItems="center"
|
||||
sx={{
|
||||
opacity: server.isLoading ? 0 : 1,
|
||||
transition: "opacity 200ms",
|
||||
}}
|
||||
>
|
||||
<Grid item xl={5} md={6} sx={{ marginBottom: "1em" }}>
|
||||
<Typography variant="h3" color="textPrimary">
|
||||
@@ -0,0 +1,7 @@
|
||||
/** @format */
|
||||
|
||||
const Settings = () => {
|
||||
return <h1>WIP Settings</h1>;
|
||||
};
|
||||
|
||||
export default Settings;
|
||||
@@ -1,7 +1,6 @@
|
||||
/** @format */
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import { Cookies, useCookies } from "react-cookie";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
@@ -31,7 +30,6 @@ import "./server.module.scss";
|
||||
export const ServerList = () => {
|
||||
const [renderServerList, setRenderServerList] = useState(false);
|
||||
const [serverListRender, setServerListRender] = useState([]);
|
||||
const cookies = new Cookies();
|
||||
|
||||
const currentServer = cookies.get("currentServer");
|
||||
const serverList = cookies.get("servers");
|
||||
@@ -218,7 +216,20 @@ export const ServerSetup = (props) => {
|
||||
variant="outlined"
|
||||
// inputRef={serverIp}
|
||||
onChange={(event) => {
|
||||
setServerIp(event.target.value);
|
||||
if (
|
||||
event.target.value.charAt(
|
||||
event.target.value.length - 1,
|
||||
) == "/"
|
||||
) {
|
||||
setServerIp(
|
||||
event.target.value.slice(
|
||||
0,
|
||||
-1,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
setServerIp(event.target.value);
|
||||
}
|
||||
}}
|
||||
helperText="Add your server adddress with https:// or http://"
|
||||
></TextField>
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import sideBarReducer from "./utils/slice/sidemenu";
|
||||
import appBarReducer from "./utils/slice/appBar";
|
||||
export default configureStore({
|
||||
reducer: {
|
||||
sidebar: sideBarReducer,
|
||||
appBar: appBarReducer,
|
||||
},
|
||||
});
|
||||
+32
-10
@@ -1,19 +1,32 @@
|
||||
/** @format */
|
||||
::-webkit-scrollbar {
|
||||
z-index: 10000;
|
||||
width: 10px;
|
||||
width: 14px;
|
||||
background: $clr-background-dark;
|
||||
}
|
||||
|
||||
div::-webkit-scrollbar {
|
||||
width: 14px;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.roundedScrollbar::-webkit-scrollbar-track {
|
||||
border-radius: 1000px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
z-index: 10000;
|
||||
background-color: transparent;
|
||||
&:hover {
|
||||
background: rgb(255 255 255 / 0.25);
|
||||
background-color: rgb(255 255 255 / 0.15);
|
||||
}
|
||||
}
|
||||
::-webkit-scrollbar-thumb {
|
||||
z-index: 10000;
|
||||
background: rgb(255 255 255 / 0.25);
|
||||
border: 4px solid transparent;
|
||||
background-clip: padding-box;
|
||||
border-radius: 9999px;
|
||||
background-color: rgb(255 255 255 / 0.25);
|
||||
&:hover {
|
||||
background-color: rgb(255 255 255 / 0.35);
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
@@ -24,14 +37,22 @@ body {
|
||||
position: relative;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
overflow-x: hidden;
|
||||
overflow-y: overlay;
|
||||
}
|
||||
|
||||
#root,
|
||||
.root-page {
|
||||
height: 100vh;
|
||||
height: fit-content;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
overflow-y: visible;
|
||||
overflow-x: hidden;
|
||||
min-height: 100vh;
|
||||
// display: flex;
|
||||
// flex-direction: column;
|
||||
// justify-content: center;
|
||||
// align-items: center;
|
||||
}
|
||||
|
||||
.centered {
|
||||
@@ -81,10 +102,11 @@ h1 {
|
||||
|
||||
.scrollY {
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
height: 100vh;
|
||||
overflow-y: visible;
|
||||
height: fit-content;
|
||||
width: inherit;
|
||||
box-sizing: border-box;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.empty {
|
||||
|
||||
@@ -7,6 +7,7 @@ $clr-secondary-dark: hsl(273, 100%, 12%);
|
||||
$clr-background-default: hsl(256, 100%, 6%);
|
||||
|
||||
$clr-background-dark: hsl(256, 100%, 4%);
|
||||
$clr-background-dark-opacity-0_8: hsl(256, 100%, 4%, 80%);
|
||||
$clr-background-light: hsl(256, 100%, 16%);
|
||||
|
||||
$clr-gradient-default: linear-gradient(
|
||||
@@ -24,3 +25,4 @@ $border-radius-default: 10px;
|
||||
$border-radius-intensity-1: 5px;
|
||||
|
||||
$transition-time-default: 250ms;
|
||||
$transition-time-fast: 150ms;
|
||||
+66
-4
@@ -8,11 +8,17 @@ const ticksToMs = (ticks) => {
|
||||
return Math.round(ticks / 10000);
|
||||
};
|
||||
|
||||
/**
|
||||
* @format
|
||||
* @param {number} ticks - C# ticks of a particular item
|
||||
* @return {number} Converted ticks to Hhr Mmin formate
|
||||
*/
|
||||
export const getRuntime = (ticks) => {
|
||||
let time = ticksToMs(ticks);
|
||||
let formatedTime = "";
|
||||
let timeSec = Math.round(time / 1000);
|
||||
let timeMin = Math.round(timeSec / 60);
|
||||
let timeSec = Math.floor(time / 1000);
|
||||
let timeMin = Math.floor(timeSec / 60);
|
||||
timeSec -= timeMin * 60;
|
||||
if (timeMin > 60) {
|
||||
let timeHr = Math.floor(timeMin / 60);
|
||||
timeMin -= timeHr * 60;
|
||||
@@ -23,11 +29,48 @@ export const getRuntime = (ticks) => {
|
||||
return formatedTime;
|
||||
};
|
||||
|
||||
/**
|
||||
* @format
|
||||
* @param {number} ticks - C# ticks of a particular item
|
||||
* @return {number} Converted ticks to hh:mm:ss formate
|
||||
*/
|
||||
export const getRuntimeMusic = (ticks) => {
|
||||
let time = ticksToMs(ticks);
|
||||
let formatedTime = "";
|
||||
let timeSec = Math.floor(time / 1000);
|
||||
let timeMin = Math.floor(timeSec / 60);
|
||||
timeSec -= timeMin * 60;
|
||||
timeSec = timeSec == 0 ? 0o0 : timeSec;
|
||||
if (timeMin > 60) {
|
||||
let timeHr = Math.floor(timeMin / 60);
|
||||
timeMin -= timeHr * 60;
|
||||
formatedTime = `${timeHr}:${timeMin.toLocaleString([], {
|
||||
minimumIntegerDigits: 2,
|
||||
useGrouping: false,
|
||||
})}:${timeSec.toLocaleString([], {
|
||||
minimumIntegerDigits: 2,
|
||||
useGrouping: false,
|
||||
})}`;
|
||||
} else {
|
||||
formatedTime = `${timeMin}:${timeSec.toLocaleString([], {
|
||||
minimumIntegerDigits: 2,
|
||||
useGrouping: false,
|
||||
})}`;
|
||||
}
|
||||
return formatedTime;
|
||||
};
|
||||
|
||||
/**
|
||||
* @format
|
||||
* @param {number} ticks - C# ticks of a particular item
|
||||
* @return {number} Converted ticks to H hour M minutes formate
|
||||
*/
|
||||
export const getRuntimeFull = (ticks) => {
|
||||
let time = ticksToMs(ticks);
|
||||
let formatedTime = "";
|
||||
let timeSec = Math.round(time / 1000);
|
||||
let timeMin = Math.round(timeSec / 60);
|
||||
let timeSec = Math.floor(time / 1000);
|
||||
let timeMin = Math.floor(timeSec / 60);
|
||||
timeSec -= timeMin * 60;
|
||||
if (timeMin > 60) {
|
||||
let timeHr = Math.floor(timeMin / 60);
|
||||
timeMin -= timeHr * 60;
|
||||
@@ -37,3 +80,22 @@ export const getRuntimeFull = (ticks) => {
|
||||
}
|
||||
return formatedTime;
|
||||
};
|
||||
|
||||
/**
|
||||
* @format
|
||||
* @param {number} ticks - C# ticks of a particular item
|
||||
* @return {number} End time of an item
|
||||
*/
|
||||
export const endsAt = (ticks) => {
|
||||
let current = new Date();
|
||||
let currentTime = current.getTime();
|
||||
let time = ticksToMs(ticks);
|
||||
let calculatedTime = currentTime + time;
|
||||
let formated = new Date(calculatedTime).toLocaleString([], {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
});
|
||||
// let formated = `${hr - 12}:${min}`;
|
||||
// return `Ends at ${formated.getHours()}:${formated.getMinutes()}`;
|
||||
return `Ends at ${formated}`;
|
||||
};
|
||||
@@ -1,37 +0,0 @@
|
||||
/** @format */
|
||||
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
export const appBarSlice = createSlice({
|
||||
name: "appBar",
|
||||
initialState: {
|
||||
visible: false,
|
||||
backdrop: false,
|
||||
backButtonVisible: false,
|
||||
},
|
||||
reducers: {
|
||||
showAppBar: (state) => {
|
||||
state.visible = true;
|
||||
},
|
||||
hideAppBar: (state) => {
|
||||
state.visible = false;
|
||||
},
|
||||
setBackdrop: (state, action) => {
|
||||
state.backdrop = action.payload;
|
||||
},
|
||||
showBackButton: (state, action) => {
|
||||
state.backButtonVisible = true;
|
||||
},
|
||||
hideBackButton: (state) => {
|
||||
state.backButtonVisible = false;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const {
|
||||
showAppBar,
|
||||
hideAppBar,
|
||||
setBackdrop,
|
||||
showBackButton,
|
||||
hideBackButton,
|
||||
} = appBarSlice.actions;
|
||||
export default appBarSlice.reducer;
|
||||
@@ -6,7 +6,6 @@ import svgr from "vite-plugin-svgr";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
base: "./",
|
||||
plugins: [react(), svgr()],
|
||||
css: {
|
||||
modules: {
|
||||
|
||||
Reference in new issue
Block a user