Compare commits
72
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e81f4f6c56 | ||
|
|
fea68f8cab | ||
|
|
ce4b635d78 | ||
|
|
83ebd5de7e | ||
|
|
3f44e5fc96 | ||
|
|
39ad113573 | ||
|
|
9ff7482aea | ||
|
|
36e3d2a7cb | ||
|
|
691d5e0157 | ||
|
|
94986db688 | ||
|
|
9bf0b25662 | ||
|
|
42ca912ca7 | ||
|
|
6ac3383f6e | ||
|
|
922d956565 | ||
|
|
ca527548d1 | ||
|
|
e16a6c2415 | ||
|
|
c60b1e416e | ||
|
|
df7994b4b2 | ||
|
|
03e72d81da | ||
|
|
c8a7f8a632 | ||
|
|
d9644f325c | ||
|
|
38dde2a63d | ||
|
|
8aef2fc22d | ||
|
|
458890ba35 | ||
|
|
8d9d38fa39 | ||
|
|
957f9b53bb | ||
|
|
02d412a9b6 | ||
|
|
e4ade5659c | ||
|
|
19ff2af29b | ||
|
|
3c058928cb | ||
|
|
25ac859efd | ||
|
|
5b2968b5bf | ||
|
|
6cccd12a41 | ||
|
|
3ea75c8308 | ||
|
|
2ce1cd688d | ||
|
|
756d8d7f4b | ||
|
|
3738d81fab | ||
|
|
9f4c2f990a | ||
|
|
027cf93492 | ||
|
|
092a1c74ab | ||
|
|
fb7c86631d | ||
|
|
7137cbc13e | ||
|
|
989542107f | ||
|
|
97981c7d35 | ||
|
|
797c80b8cd | ||
|
|
377f926fea | ||
|
|
dd4f5bab30 | ||
|
|
e47b7afd15 | ||
|
|
a16523118b | ||
|
|
b2aaed792e | ||
|
|
117ddba9b6 | ||
|
|
1a25bb20cb | ||
|
|
8ba41979e2 | ||
|
|
1bd295e0d4 | ||
|
|
479ae161b1 | ||
|
|
6957641999 | ||
|
|
419c76d81c | ||
|
|
bd5313ebf3 | ||
|
|
16dcff113d | ||
|
|
e2d50addc1 | ||
|
|
2ddaf61399 | ||
|
|
2570c96f31 | ||
|
|
fbe31a190a | ||
|
|
7c1df32117 | ||
|
|
b690ff5b3e | ||
|
|
a04e263ad5 | ||
|
|
0e0833876b | ||
|
|
4d92a059d1 | ||
|
|
5c41bfeca1 | ||
|
|
7df95a05ed | ||
|
|
3911459eed | ||
|
|
b1c0704bac |
No files matched your search
@@ -3,6 +3,7 @@
|
||||
# 📝 Prerequisites:
|
||||
- Nodejs (≥19.1.0)
|
||||
- Rust (≥1.66.1)
|
||||
- Visual Studio C++ Build tools
|
||||
|
||||
# ℹ️ Getting started:
|
||||
- Install Nodejs and Rust.
|
||||
|
||||
Generated
+704
-817
File diff suppressed because it is too large.
Load diff
+16
-20
@@ -10,44 +10,40 @@
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.10.5",
|
||||
"@emotion/react": "^11.11.1",
|
||||
"@emotion/styled": "^11.10.5",
|
||||
"@fontsource/open-sans": "^4.5.13",
|
||||
"@fontsource/open-sans": "^5.0.3",
|
||||
"@jellyfin/sdk": "^0.8.2",
|
||||
"@mdi/js": "^7.2.96",
|
||||
"@mui/lab": "^5.0.0-alpha.127",
|
||||
"@mui/material": "^5.11.16",
|
||||
"@reduxjs/toolkit": "^1.9.3",
|
||||
"@mui/lab": "^5.0.0-alpha.134",
|
||||
"@mui/material": "^5.13.0",
|
||||
"@tanstack/react-query": "^4.26.1",
|
||||
"@tanstack/react-query-devtools": "^4.29.3",
|
||||
"@tanstack/react-query-devtools": "^4.29.19",
|
||||
"@tauri-apps/api": "^1.4.0",
|
||||
"axios": "^1.4.0",
|
||||
"blurhash": "^2.0.5",
|
||||
"events": "^3.3.0",
|
||||
"framer-motion": "^10.12.4",
|
||||
"localforage": "^1.10.0",
|
||||
"match-sorter": "^6.3.1",
|
||||
"framer-motion": "^10.12.10",
|
||||
"notistack": "^3.0.1",
|
||||
"react": "^18.2.0",
|
||||
"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",
|
||||
"react-redux": "^8.0.5",
|
||||
"react-router-dom": "^6.10.0",
|
||||
"redux": "^4.2.1",
|
||||
"sort-by": "^1.2.0",
|
||||
"react-player": "^2.12.0",
|
||||
"react-router-dom": "^6.14.0",
|
||||
"tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store",
|
||||
"uuid": "^9.0.0",
|
||||
"vite-plugin-svgr": "^2.2.2"
|
||||
"vite-plugin-svgr": "^3.2.0",
|
||||
"zustand": "^4.3.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^1.2.2",
|
||||
"@types/react": "^18.0.38",
|
||||
"@types/react-dom": "^18.0.8",
|
||||
"@tauri-apps/cli": "^1.3.1",
|
||||
"@types/react": "^18.2.11",
|
||||
"@types/react-dom": "^18.2.6",
|
||||
"@vitejs/plugin-react": "^4.0.0",
|
||||
"sass": "^1.61.0",
|
||||
"sass": "^1.63.3",
|
||||
"vite": "^4.3.1"
|
||||
},
|
||||
"license": "GPL-3.0-only"
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 393 KiB After Width: | Height: | Size: 632 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
@@ -90,11 +90,6 @@
|
||||
transform: scaleX(1) translateX(100%);
|
||||
transform-origin: left;
|
||||
}
|
||||
|
||||
/* 100% {
|
||||
transform: scaleX(0) translateX(-100%);
|
||||
transform-origin: left;
|
||||
} */
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
@@ -17,8 +17,10 @@ tauri-build = { version = "1.2.1", features = [] }
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = { version = "1.2.2", features = ["process-exit", "process-relaunch"] }
|
||||
tauri = { version = "1.2.2", features = ["devtools", "http-all", "process-exit", "process-relaunch", "shell-all", "window-set-fullscreen"] }
|
||||
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||
tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
|
||||
portpicker = "0.1" # used in the example to pick a random free port
|
||||
|
||||
[features]
|
||||
# by default Tauri runs in production mode
|
||||
|
||||
+34
-2
@@ -2,6 +2,8 @@
|
||||
|
||||
use tauri::Manager;
|
||||
|
||||
use tauri::{utils::config::AppUrl, WindowUrl};
|
||||
|
||||
// Create the command:
|
||||
// This command must be async so that it doesn't run on the main thread.
|
||||
#[tauri::command]
|
||||
@@ -14,10 +16,40 @@ async fn close_splashscreen(window: tauri::Window) {
|
||||
window.get_window("main").unwrap().show().unwrap();
|
||||
}
|
||||
|
||||
// Tauri by default uses HTTPS, so use the localhost plugin to downgrade back to
|
||||
// HTTP. However, when running tauri dev, we already have a localhost server
|
||||
// provided by vite, so don't enable it
|
||||
#[cfg(debug_assertions)]
|
||||
const USE_LOCALHOST_SERVER: bool = false;
|
||||
#[cfg(not(debug_assertions))]
|
||||
const USE_LOCALHOST_SERVER: bool = true;
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
let port = portpicker::pick_unused_port().expect("failed to find unused port");
|
||||
|
||||
let window_url = if USE_LOCALHOST_SERVER {
|
||||
WindowUrl::External(format!("http://localhost:{}", port).parse().unwrap())
|
||||
} else {
|
||||
WindowUrl::App("index.html".into())
|
||||
};
|
||||
|
||||
let mut context = tauri::generate_context!();
|
||||
let mut builder = tauri::Builder::default();
|
||||
|
||||
if USE_LOCALHOST_SERVER {
|
||||
// rewrite the config so the IPC is enabled on this URL
|
||||
context.config_mut().build.dist_dir = AppUrl::Url(window_url.clone());
|
||||
context.config_mut().build.dev_path = AppUrl::Url(window_url.clone());
|
||||
builder = builder.plugin(tauri_plugin_localhost::Builder::new(port).build());
|
||||
}
|
||||
|
||||
|
||||
builder
|
||||
.invoke_handler(tauri::generate_handler![close_splashscreen])
|
||||
.plugin(tauri_plugin_store::Builder::default().build())
|
||||
.run(tauri::generate_context!())
|
||||
.run(context)
|
||||
.expect("error while running tauri application");
|
||||
// tauri::Builder::default()
|
||||
// .run(tauri::generate_context!())
|
||||
// .expect("error while running tauri application");
|
||||
}
|
||||
@@ -12,12 +12,20 @@
|
||||
},
|
||||
"tauri": {
|
||||
"allowlist": {
|
||||
"all": false,
|
||||
"process": {
|
||||
"all": false,
|
||||
"exit": true,
|
||||
"relaunch": true,
|
||||
"relaunchDangerousAllowSymlinkMacos": false
|
||||
},
|
||||
"window": {
|
||||
"setFullscreen": true
|
||||
},
|
||||
"shell": {
|
||||
"all": true
|
||||
},
|
||||
"http": {
|
||||
"all": true
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
#root {
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 6em;
|
||||
padding: 1.5em;
|
||||
will-change: filter;
|
||||
}
|
||||
.logo:hover {
|
||||
filter: drop-shadow(0 0 2em #646cffaa);
|
||||
}
|
||||
.logo.react:hover {
|
||||
filter: drop-shadow(0 0 2em #61dafbaa);
|
||||
}
|
||||
|
||||
@keyframes logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
a:nth-of-type(2) .logo {
|
||||
animation: logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 2em;
|
||||
}
|
||||
|
||||
.read-the-docs {
|
||||
color: #888;
|
||||
}
|
||||
+57
-60
@@ -1,13 +1,15 @@
|
||||
/** @format */
|
||||
|
||||
import React, { useState } from "react";
|
||||
import React, { useState, useEffect } from "react";
|
||||
|
||||
import { appWindow } from "@tauri-apps/api/window";
|
||||
|
||||
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 { SnackbarProvider, useSnackbar } from "notistack";
|
||||
import {
|
||||
Routes,
|
||||
Route,
|
||||
@@ -23,8 +25,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";
|
||||
@@ -47,9 +48,12 @@ import Home from "./routes/home";
|
||||
import { UserLogin, LoginWithImage, UserLoginManual } from "./routes/login";
|
||||
import LibraryView from "./routes/library";
|
||||
import ItemDetail from "./routes/item";
|
||||
import FavouritePage from "./routes/favourite/index.jsx";
|
||||
import Settings from "./routes/settings";
|
||||
import About from "./routes/about";
|
||||
|
||||
import { VideoPlayer } from "./routes/player/videoPlayer.jsx";
|
||||
|
||||
import { SideMenu } from "./components/menu/sidemenu.jsx";
|
||||
import { AppBar } from "./components/appBar/appBar.jsx";
|
||||
|
||||
@@ -57,15 +61,18 @@ import { AppBar } from "./components/appBar/appBar.jsx";
|
||||
import "@fontsource/open-sans";
|
||||
|
||||
// Jellyfin SDK TypeScript
|
||||
import { Jellyfin } from "@jellyfin/sdk";
|
||||
import {
|
||||
Jellyfin,
|
||||
VersionOutdatedIssue,
|
||||
VersionUnsupportedIssue,
|
||||
} 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 { 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";
|
||||
import axios from "axios";
|
||||
|
||||
const jellyfin = new Jellyfin({
|
||||
clientInfo: {
|
||||
name: "JellyPlayer",
|
||||
@@ -90,12 +97,15 @@ event.on("set-api-accessToken", (serverAddress) => {
|
||||
|
||||
const anim = {
|
||||
initial: {
|
||||
transform: "scale(0.99)",
|
||||
opacity: 0,
|
||||
},
|
||||
animate: {
|
||||
transform: "scale(1)",
|
||||
opacity: 1,
|
||||
},
|
||||
exit: {
|
||||
transform: "scale(0.99)",
|
||||
opacity: 0,
|
||||
},
|
||||
};
|
||||
@@ -120,15 +130,13 @@ const AnimationWrapper = () => {
|
||||
function App() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const [serverReachable, setServerReachable] = useState(true);
|
||||
const [checkingServer, setChecking] = useState(false);
|
||||
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
const createApi = async () => {
|
||||
const server = await getServer();
|
||||
event.emit("create-jellyfin-api", server.Ip);
|
||||
dispatch(showSidemenu());
|
||||
};
|
||||
|
||||
const serverAvailable = async () => {
|
||||
@@ -159,30 +167,25 @@ function App() {
|
||||
}
|
||||
};
|
||||
|
||||
const pingServer = () => {
|
||||
setChecking(true);
|
||||
let data;
|
||||
fetch(`${window.api.basePath}/System/Ping`, {
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
if (data == "Jellyfin Server") {
|
||||
setServerReachable(true);
|
||||
setChecking(false);
|
||||
} else {
|
||||
enqueueSnackbar(
|
||||
"The server address does not seem be a jellyfin server",
|
||||
{ variant: "error" },
|
||||
);
|
||||
setServerReachable(false);
|
||||
setChecking(false);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
const pingServer = async () => {
|
||||
const server = await getServer();
|
||||
try {
|
||||
const result = await axios.get(
|
||||
new URL(`${server.Ip}/System/Ping`).href,
|
||||
);
|
||||
if (result.data == "Jellyfin Server") {
|
||||
event.emit("create-jellyfin-api", server.Ip);
|
||||
setServerReachable(true);
|
||||
} else {
|
||||
setServerReachable(false);
|
||||
setChecking(false);
|
||||
}
|
||||
} catch (error) {
|
||||
setServerReachable(false);
|
||||
enqueueSnackbar("Unable to verfiy server address.", {
|
||||
variant: "error",
|
||||
});
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
const userLogin = async () => {
|
||||
@@ -193,8 +196,6 @@ function App() {
|
||||
);
|
||||
sessionStorage.setItem("accessToken", auth.data.AccessToken);
|
||||
event.emit("set-api-accessToken", window.api.basePath);
|
||||
|
||||
// navigate("/home");
|
||||
};
|
||||
|
||||
const LogicalRoutes = () => {
|
||||
@@ -227,7 +228,6 @@ function App() {
|
||||
});
|
||||
} else {
|
||||
navigate("/setup/server");
|
||||
setChecking(false);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -242,14 +242,17 @@ function App() {
|
||||
});
|
||||
};
|
||||
|
||||
const handleRelaunch = async () => {
|
||||
let result = await relaunch();
|
||||
const handleRelaunch = async (event, reason) => {
|
||||
if (reason && reason == "backdropClick") {
|
||||
return;
|
||||
}
|
||||
await relaunch();
|
||||
};
|
||||
|
||||
const handleRemoveServer = async () => {
|
||||
await delServer();
|
||||
await delUser();
|
||||
let result = await relaunch();
|
||||
await relaunch();
|
||||
};
|
||||
const location = useLocation();
|
||||
|
||||
@@ -271,23 +274,13 @@ function App() {
|
||||
setEasterEgg(true);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
appWindow.setFullscreen(false);
|
||||
}, [location]);
|
||||
|
||||
return (
|
||||
<SnackbarProvider maxSnack={5}>
|
||||
<ThemeProvider theme={theme}>
|
||||
{checkingServer && (
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
width: "100%",
|
||||
height: "100vh",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
)}
|
||||
|
||||
<Kon resetDelay={1000} action={sixtyNine}></Kon>
|
||||
<Dialog
|
||||
open={easterEgg}
|
||||
@@ -340,7 +333,11 @@ function App() {
|
||||
location={location}
|
||||
>
|
||||
<Route element={<AnimationWrapper />}>
|
||||
{/* Main Routes */}
|
||||
<Route
|
||||
path="/"
|
||||
element={<LogicalRoutes />}
|
||||
/>
|
||||
|
||||
<Route
|
||||
path="/home"
|
||||
element={<Home />}
|
||||
@@ -366,10 +363,12 @@ function App() {
|
||||
element={<UserLoginManual />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/library/:id"
|
||||
element={<LibraryView />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/item/:id"
|
||||
element={<ItemDetail />}
|
||||
/>
|
||||
@@ -385,13 +384,11 @@ function App() {
|
||||
path="/about"
|
||||
element={<About />}
|
||||
/>
|
||||
|
||||
{/* Logical Routes */}
|
||||
|
||||
<Route
|
||||
path="/"
|
||||
element={<LogicalRoutes />}
|
||||
path="/player"
|
||||
element={<VideoPlayer />}
|
||||
/>
|
||||
|
||||
<Route
|
||||
path="/login"
|
||||
element={<LoginLogicalRoutes />}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/** @format */
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { relaunch } from "@tauri-apps/api/process";
|
||||
|
||||
import MuiAppBar from "@mui/material/AppBar";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
@@ -15,11 +17,10 @@ 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 { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { useQueryClient, useQuery } from "@tanstack/react-query";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import "./appBar.module.scss";
|
||||
import { MdiAccount } from "../icons/mdiAccount";
|
||||
@@ -27,13 +28,17 @@ import { MdiHeartOutline } from "../icons/mdiHeartOutline";
|
||||
import { MdiArrowLeft } from "../icons/mdiArrowLeft";
|
||||
import { MdiCog } from "../icons/mdiCog";
|
||||
import { MdiInformation } from "../icons/mdiInformation";
|
||||
import { MdiMenu } from "../icons/mdiMenu";
|
||||
import { useDrawerStore } from "../../utils/store/drawer";
|
||||
import { delServer } from "../../utils/storage/servers";
|
||||
import { delUser } from "../../utils/storage/user";
|
||||
import { MdiDelete } from "../icons/mdiDelete";
|
||||
|
||||
export const AppBar = () => {
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [display, setDisplay] = useState(false);
|
||||
const [backButtonVisible, setBackButtonVisible] = useState(true);
|
||||
const [backButtonVisible, setBackButtonVisible] = useState(false);
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
@@ -61,10 +66,18 @@ export const AppBar = () => {
|
||||
setAnchorEl(null);
|
||||
};
|
||||
|
||||
const [setDrawerOpen] = useDrawerStore((state) => [state.setOpen]);
|
||||
|
||||
const handleDrawerOpen = () => {
|
||||
setDrawerOpen(true);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
location.pathname.includes("login") ||
|
||||
location.pathname.includes("setup")
|
||||
location.pathname.includes("setup") ||
|
||||
location.pathname.includes("player") ||
|
||||
location.pathname === "/"
|
||||
) {
|
||||
setDisplay(false);
|
||||
} else {
|
||||
@@ -87,14 +100,18 @@ export const AppBar = () => {
|
||||
return (
|
||||
<MuiAppBar
|
||||
sx={{
|
||||
width: `calc(100vw - ${theme.spacing(7)})`,
|
||||
// mr: "10px",
|
||||
backgroundColor: "transparent",
|
||||
paddingRight: "0 !important",
|
||||
}}
|
||||
className={trigger ? "appBar backdropVisible" : "appBar"}
|
||||
elevation={0}
|
||||
>
|
||||
<Toolbar sx={{ justifyContent: "space-between" }}>
|
||||
<Toolbar
|
||||
sx={{
|
||||
justifyContent: "space-between",
|
||||
paddingLeft: "12px !important",
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
@@ -102,6 +119,13 @@ export const AppBar = () => {
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<IconButton
|
||||
color="inherit"
|
||||
aria-label="open drawer"
|
||||
onClick={handleDrawerOpen}
|
||||
>
|
||||
<MdiMenu />
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() => navigate(-1)}
|
||||
sx={{
|
||||
@@ -110,6 +134,7 @@ export const AppBar = () => {
|
||||
? "scale(1)"
|
||||
: "scale(0)",
|
||||
transformOrigin: "left",
|
||||
ml: 2,
|
||||
}}
|
||||
>
|
||||
<MdiArrowLeft />
|
||||
@@ -176,6 +201,18 @@ export const AppBar = () => {
|
||||
</ListItemIcon>
|
||||
About
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
onClick={async () => {
|
||||
await delServer();
|
||||
await delUser();
|
||||
await relaunch();
|
||||
}}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<MdiDelete />
|
||||
</ListItemIcon>
|
||||
Remove Server
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</Box>
|
||||
</Toolbar>
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import ButtonBase from "@mui/material/ButtonBase";
|
||||
|
||||
import { MdiAccount } from "../icons/mdiAccount";
|
||||
|
||||
@@ -12,19 +10,17 @@ import "./avatar.module.scss";
|
||||
export const AvatarImage = ({ userId, userImageTags }) => {
|
||||
return (
|
||||
<Box className="avatar-image-container">
|
||||
{!!userImageTags && (
|
||||
<div
|
||||
className="avatar-image"
|
||||
style={{
|
||||
backgroundImage:
|
||||
"url('" +
|
||||
window.api.basePath +
|
||||
"/Users/" +
|
||||
userId +
|
||||
"/Images/Primary')",
|
||||
}}
|
||||
></div>
|
||||
)}
|
||||
<div
|
||||
className="avatar-image"
|
||||
style={{
|
||||
backgroundImage:
|
||||
"url('" +
|
||||
window.api.basePath +
|
||||
"/Users/" +
|
||||
userId +
|
||||
"/Images/Primary')",
|
||||
}}
|
||||
></div>
|
||||
|
||||
<div className="avatar-image-icon-container">
|
||||
<MdiAccount className="avatar-image-icon" />
|
||||
|
||||
@@ -14,6 +14,7 @@ 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";
|
||||
|
||||
@@ -47,6 +48,7 @@ export const Card = ({
|
||||
blurhash,
|
||||
currentUser,
|
||||
favourite,
|
||||
disableOverlay,
|
||||
}) => {
|
||||
const navigate = useNavigate();
|
||||
const [imgLoading, setImgLoading] = useState(true);
|
||||
@@ -92,8 +94,6 @@ export const Card = ({
|
||||
"BoxSet",
|
||||
"CollectionFolder",
|
||||
"Movie",
|
||||
"MusicAlbum",
|
||||
"MusicVideo",
|
||||
"Season",
|
||||
"Series",
|
||||
"Video",
|
||||
@@ -176,6 +176,7 @@ export const Card = ({
|
||||
<div
|
||||
className="card-media-image-container"
|
||||
style={{ opacity: imgLoading ? 0 : 1 }}
|
||||
// style={{ opacity: 1 }}
|
||||
>
|
||||
{imageTags &&
|
||||
(cardType == "thumb" ? (
|
||||
@@ -211,10 +212,17 @@ export const Card = ({
|
||||
<CardMedia
|
||||
component="img"
|
||||
image={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
itemId +
|
||||
"/Images/Primary?fillHeight=532&fillWidth=300&quality=96"
|
||||
iconType == "User"
|
||||
? window.api
|
||||
.basePath +
|
||||
"/Users/" +
|
||||
itemId +
|
||||
"/Images/Primary?fillHeight=532&fillWidth=300&quality=96"
|
||||
: window.api
|
||||
.basePath +
|
||||
"/Items/" +
|
||||
itemId +
|
||||
"/Images/Primary?fillHeight=532&fillWidth=300&quality=96"
|
||||
}
|
||||
alt={itemName}
|
||||
sx={{
|
||||
@@ -276,52 +284,66 @@ export const Card = ({
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
<Box
|
||||
className="card-media-overlay"
|
||||
sx={{
|
||||
display: "flex",
|
||||
alignItems: "flex-end",
|
||||
justifyContent: "flex-end",
|
||||
p: 1,
|
||||
}}
|
||||
>
|
||||
<ButtonGroup>
|
||||
{availableMarkButtonTypes.includes(
|
||||
iconType,
|
||||
) && (
|
||||
<IconButton
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
handleMarkAsPlayOrUnMarkAsPlay();
|
||||
}}
|
||||
>
|
||||
<MdiCheck
|
||||
sx={{
|
||||
color: isWatched
|
||||
? green[400]
|
||||
: "white",
|
||||
{!disableOverlay && (
|
||||
<Box
|
||||
className="card-media-overlay"
|
||||
sx={{
|
||||
display: "flex",
|
||||
alignItems: "flex-end",
|
||||
justifyContent: "flex-end",
|
||||
p: 1,
|
||||
}}
|
||||
>
|
||||
<ButtonGroup>
|
||||
{availableMarkButtonTypes.includes(
|
||||
iconType,
|
||||
) && (
|
||||
<IconButton
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
handleMarkAsPlayOrUnMarkAsPlay();
|
||||
}}
|
||||
/>
|
||||
</IconButton>
|
||||
)}
|
||||
{allowedLikeButton.includes(iconType) && (
|
||||
<IconButton
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
handleLiking();
|
||||
}}
|
||||
>
|
||||
{isFavorite ? (
|
||||
<MdiHeart
|
||||
sx={{ color: pink[700] }}
|
||||
onFocus={(e) =>
|
||||
e.stopPropagation
|
||||
}
|
||||
>
|
||||
<MdiCheck
|
||||
sx={{
|
||||
color: isWatched
|
||||
? green[400]
|
||||
: "white",
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<MdiHeartOutline />
|
||||
)}
|
||||
</IconButton>
|
||||
)}
|
||||
</ButtonGroup>
|
||||
</Box>
|
||||
</IconButton>
|
||||
)}
|
||||
{allowedLikeButton.includes(
|
||||
iconType,
|
||||
) && (
|
||||
<IconButton
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
handleLiking();
|
||||
}}
|
||||
onFocus={(e) =>
|
||||
e.stopPropagation
|
||||
}
|
||||
>
|
||||
{isFavorite ? (
|
||||
<MdiHeart
|
||||
sx={{
|
||||
color: pink[700],
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<MdiHeartOutline />
|
||||
)}
|
||||
</IconButton>
|
||||
)}
|
||||
</ButtonGroup>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
<CardContent
|
||||
@@ -344,17 +366,16 @@ export const Card = ({
|
||||
>
|
||||
{itemName}
|
||||
</Typography>
|
||||
|
||||
<Typography
|
||||
gutterBottom
|
||||
variant="subtitle2"
|
||||
variant="subtitle1"
|
||||
component="div"
|
||||
color="gray"
|
||||
textAlign="left"
|
||||
// textOverflow={}
|
||||
// fontSize="0.85em"
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
noWrap
|
||||
sx={{ opacity: 0.5 }}
|
||||
>
|
||||
{subText}
|
||||
</Typography>
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
import React, { useState } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import { useNavigate, Link } from "react-router-dom";
|
||||
// import Link from "@mui/material/Link";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
import Divider from "@mui/material/Divider";
|
||||
import Stack from "@mui/material/Stack";
|
||||
@@ -20,10 +19,7 @@ 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 { TypeIconCollectionCard } from "../utils/iconsCollection";
|
||||
|
||||
import { borderRadiusDefault } from "../../palette.module.scss";
|
||||
import "./card.module.scss";
|
||||
@@ -56,6 +52,7 @@ export const EpisodeCard = ({
|
||||
parentId,
|
||||
}) => {
|
||||
const navigate = useNavigate();
|
||||
const [imgLoaded, setImgLoaded] = useState(false);
|
||||
const [isWatched, setIsWatched] = useState(watchedStatus);
|
||||
const [isFavourite, setIsFavourite] = useState(favourite);
|
||||
const handleMarkAsPlayOrUnMarkAsPlay = async () => {
|
||||
@@ -130,10 +127,16 @@ export const EpisodeCard = ({
|
||||
opacity: isWatched ? 1 : 0,
|
||||
}}
|
||||
/>
|
||||
<Box className="card-media-image-container">
|
||||
<Box
|
||||
className="card-media-image-container"
|
||||
sx={{
|
||||
opacity: imgLoaded ? 1 : 0,
|
||||
transition: "opacity 250ms",
|
||||
}}
|
||||
>
|
||||
{imageTags && (
|
||||
<CardMedia
|
||||
component="div"
|
||||
component="img"
|
||||
image={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
@@ -148,6 +151,7 @@ export const EpisodeCard = ({
|
||||
borderRadiusDefault,
|
||||
overflow: "hidden",
|
||||
}}
|
||||
onLoad={() => setImgLoaded(true)}
|
||||
className="card-image"
|
||||
></CardMedia>
|
||||
)}
|
||||
@@ -195,8 +199,9 @@ export const EpisodeCard = ({
|
||||
>
|
||||
<ButtonGroup>
|
||||
<IconButton
|
||||
onClick={(e) => {
|
||||
onMouseDown={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleMarkAsPlayOrUnMarkAsPlay();
|
||||
}}
|
||||
>
|
||||
@@ -209,8 +214,9 @@ export const EpisodeCard = ({
|
||||
/>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={(e) => {
|
||||
onMouseDown={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleLiking();
|
||||
}}
|
||||
>
|
||||
@@ -346,7 +352,7 @@ export const EpisodeCard = ({
|
||||
mr: "0.25em",
|
||||
}}
|
||||
/>{" "}
|
||||
{itemRating}
|
||||
{Math.round(itemRating * 10) / 10}
|
||||
</Typography>
|
||||
)}
|
||||
{!!itemTicks && (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @format */
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import { useState } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Carousel from "react-multi-carousel";
|
||||
@@ -9,7 +9,6 @@ import "react-multi-carousel/lib/styles.css";
|
||||
import { MdiChevronLeft } from "../icons/mdiChevronLeft";
|
||||
import { MdiChevronRight } from "../icons/mdiChevronRight";
|
||||
|
||||
import { styled } from "@mui/material/styles";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
@@ -22,6 +21,7 @@ export const CardScroller = ({
|
||||
title,
|
||||
headingProps,
|
||||
disableDecoration = false,
|
||||
boxProps,
|
||||
}) => {
|
||||
const responsive = {
|
||||
superLargeDesktop: {
|
||||
@@ -31,26 +31,26 @@ export const CardScroller = ({
|
||||
slidesToSlide: displayCards + 1,
|
||||
},
|
||||
desktop: {
|
||||
breakpoint: { max: 3000, min: 1025 },
|
||||
breakpoint: { max: 3000, min: 625 },
|
||||
items: displayCards,
|
||||
slidesToSlide: displayCards, // optional, default to 1.
|
||||
},
|
||||
tablet: {
|
||||
breakpoint: { max: 1024, min: 464 },
|
||||
breakpoint: { max: 624, min: 464 },
|
||||
items: displayCards - 2,
|
||||
slidesToSlide: displayCards - 2, // optional, default to 1.
|
||||
},
|
||||
mobile: {
|
||||
breakpoint: { max: 464, min: 0 },
|
||||
items: displayCards - 3,
|
||||
slidesToSlide: displayCards - 3, // optional, default to 1.
|
||||
items: displayCards - 5,
|
||||
slidesToSlide: displayCards - 5, // optional, default to 1.
|
||||
},
|
||||
};
|
||||
|
||||
const [carouselRef, setCarouselRef] = useState();
|
||||
|
||||
return (
|
||||
<Box className="card-scroller-container" sx={{ mb: 4 }}>
|
||||
<Box {...boxProps} className="card-scroller-container" mb={1}>
|
||||
<Box
|
||||
sx={{ mb: 1 }}
|
||||
className={
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiBackburger } from "@mdi/js";
|
||||
|
||||
export const MdiBackburger = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiBackburger}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -6,7 +6,7 @@ import { mdiCheck } from "@mdi/js";
|
||||
|
||||
export const MdiCheck = (props) => {
|
||||
return (
|
||||
<SvgIcon color="red" {...props}>
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiCheck}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiClose } from "@mdi/js";
|
||||
|
||||
export const MdiClose = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiClose}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiDelete } from "@mdi/js";
|
||||
|
||||
export const MdiDelete = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiDelete}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiFastForward } from "@mdi/js";
|
||||
|
||||
export const MdiFastForward = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiFastForward}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiFullscreen } from "@mdi/js";
|
||||
|
||||
export const MdiFullscreen = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiFullscreen}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiFullscreenExit } from "@mdi/js";
|
||||
|
||||
export const MdiFullscreenExit = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiFullscreenExit}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiPause } from "@mdi/js";
|
||||
|
||||
export const MdiPause = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiPause}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiPictureInPictureBottomRight } from "@mdi/js";
|
||||
|
||||
export const MdiPictureInPictureBottomRight = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiPictureInPictureBottomRight}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiPlaySpeed } from "@mdi/js";
|
||||
|
||||
export const MdiPlaySpeed = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiPlaySpeed}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiRewind } from "@mdi/js";
|
||||
|
||||
export const MdiRewind = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiRewind}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiStar } from "@mdi/js";
|
||||
|
||||
export const MdiStar = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiStar}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiVolumeHigh } from "@mdi/js";
|
||||
|
||||
export const MdiVolumeHigh = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiVolumeHigh}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiVolumeOff } from "@mdi/js";
|
||||
|
||||
export const MdiVolumeOff = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiVolumeOff}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
/** @format */
|
||||
|
||||
.album {
|
||||
&-image-icon {
|
||||
fill: url(#clr-gradient-default) !important;
|
||||
|
||||
&-container {
|
||||
background: $clr-gradient-dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
/** @format */
|
||||
import { useState } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import TableContainer from "@mui/material/TableContainer";
|
||||
import Table from "@mui/material/Table";
|
||||
import TableBody from "@mui/material/TableBody";
|
||||
import TableHead from "@mui/material/TableHead";
|
||||
import TableRow from "@mui/material/TableRow";
|
||||
import TableCell from "@mui/material/TableCell";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import MuiLink from "@mui/material/Link";
|
||||
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
|
||||
import { getRuntimeMusic } from "../../../utils/date/time";
|
||||
|
||||
import { MdiClockOutline } from "../../icons/mdiClockOutline";
|
||||
import { MdiHeart } from "../../icons/mdiHeart";
|
||||
import { MdiHeartOutline } from "../../icons/mdiHeartOutline";
|
||||
import { MdiAlbum } from "../../icons/mdiAlbum";
|
||||
|
||||
import "./albumArtist.scss";
|
||||
|
||||
export const ArtistAlbum = ({ user, album, boxProps }) => {
|
||||
const albumTracks = useQuery({
|
||||
queryKey: ["artist", "album", album.Id],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(window.api).getItems({
|
||||
userId: user.Id,
|
||||
parentId: album.Id,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const handleLikingTrack = async (track) => {
|
||||
let result;
|
||||
if (track.UserData.IsFavorite) {
|
||||
result = await getUserLibraryApi(window.api).unmarkFavoriteItem({
|
||||
userId: user.Id,
|
||||
itemId: track.Id,
|
||||
});
|
||||
} else if (!track.UserData.IsFavorite) {
|
||||
result = await getUserLibraryApi(window.api).markFavoriteItem({
|
||||
userId: user.Id,
|
||||
itemId: track.Id,
|
||||
});
|
||||
}
|
||||
albumTracks.refetch();
|
||||
};
|
||||
|
||||
const [imgLoaded, setImgLoaded] = useState(false);
|
||||
|
||||
return (
|
||||
<Box sx={{ mb: 6 }} {...boxProps}>
|
||||
<Stack direction="row" gap={3} mb={3}>
|
||||
{!!album.ImageTags?.Primary && (
|
||||
<Box
|
||||
className="album-image"
|
||||
sx={{
|
||||
aspectRatio: 1,
|
||||
borderRadius: "10px",
|
||||
overflow: "hidden",
|
||||
width: "12em",
|
||||
boxShadow: "0 0 10px rgb(0 0 0 /0.2)",
|
||||
position: "relative",
|
||||
height: "12em",
|
||||
}}
|
||||
>
|
||||
<img
|
||||
src={`${window.api.basePath}/Items/${album.Id}/Images/Primary?fillHeight=532&fillWidth=532&quality=96`}
|
||||
style={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
objectFit: "cover",
|
||||
opacity: imgLoaded ? 1 : 0,
|
||||
transition: "opacity 250ms",
|
||||
position: "relative",
|
||||
zIndex: 2,
|
||||
}}
|
||||
onLoad={() => setImgLoaded(true)}
|
||||
/>
|
||||
<Box
|
||||
className="album-image-icon-container"
|
||||
sx={{
|
||||
position: "absolute",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
top: 0,
|
||||
left: 0,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
zIndex: 1,
|
||||
}}
|
||||
>
|
||||
<MdiAlbum
|
||||
className="album-image-icon"
|
||||
sx={{ fontSize: "6em" }}
|
||||
/>
|
||||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
<Stack>
|
||||
<Typography
|
||||
variant="h5"
|
||||
sx={{ opacity: `0.7`, mb: 1 }}
|
||||
>
|
||||
{album.ProductionYear}
|
||||
</Typography>
|
||||
<MuiLink
|
||||
component={Link}
|
||||
to={`/item/${album.Id}`}
|
||||
variant="h3"
|
||||
color="inherit"
|
||||
underline="hover"
|
||||
>
|
||||
{album.Name}
|
||||
</MuiLink>
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
<TableContainer
|
||||
component={Paper}
|
||||
sx={{ mb: 2, borderRadius: "15px" }}
|
||||
>
|
||||
<Table>
|
||||
<TableHead
|
||||
sx={{
|
||||
mb: 1,
|
||||
}}
|
||||
>
|
||||
<TableRow>
|
||||
<TableCell
|
||||
sx={{
|
||||
maxWidth: 120,
|
||||
width: 20,
|
||||
}}
|
||||
>
|
||||
<Typography variant="h6">#</Typography>
|
||||
</TableCell>
|
||||
<TableCell sx={{ width: 20 }}></TableCell>
|
||||
<TableCell>
|
||||
<Typography variant="h6">
|
||||
Name
|
||||
</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Typography variant="h6" align="right">
|
||||
<MdiClockOutline />
|
||||
</Typography>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{albumTracks.isSuccess &&
|
||||
albumTracks.data.Items.map(
|
||||
(mitem, mindex) => {
|
||||
return (
|
||||
<TableRow
|
||||
key={mindex}
|
||||
sx={{
|
||||
"&:last-child td, &:last-child th":
|
||||
{
|
||||
border: 0,
|
||||
},
|
||||
"&:hover": {
|
||||
background:
|
||||
"rgb(255 255 255 / 0.05)",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<TableCell
|
||||
sx={{
|
||||
maxWidth: 120,
|
||||
width: 20,
|
||||
}}
|
||||
>
|
||||
<Typography variant="body1">
|
||||
{
|
||||
mitem.IndexNumber
|
||||
}
|
||||
</Typography>
|
||||
</TableCell>
|
||||
<TableCell
|
||||
sx={{
|
||||
width: 20,
|
||||
}}
|
||||
align="center"
|
||||
>
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
handleLikingTrack(
|
||||
mitem,
|
||||
)
|
||||
}
|
||||
>
|
||||
{mitem.UserData
|
||||
.IsFavorite ? (
|
||||
<MdiHeart />
|
||||
) : (
|
||||
<MdiHeartOutline />
|
||||
)}
|
||||
</IconButton>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Typography variant="body1">
|
||||
{mitem.Name}
|
||||
</Typography>
|
||||
</TableCell>
|
||||
<TableCell align="right">
|
||||
<Typography variant="body1">
|
||||
{getRuntimeMusic(
|
||||
mitem.RunTimeTicks,
|
||||
)}
|
||||
</Typography>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
+327
-168
@@ -2,7 +2,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { delUser } from "../../utils/storage/user";
|
||||
|
||||
import { useQueryClient, useQuery, QueryClient } from "@tanstack/react-query";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
|
||||
@@ -15,25 +15,24 @@ 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";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import MuiDrawer from "@mui/material/Drawer";
|
||||
import ListItemText from "@mui/material/ListItemText";
|
||||
|
||||
import { MdiMenu } from "../icons/mdiMenu";
|
||||
import { MdiClose } from "../icons/mdiClose";
|
||||
import { MdiLogoutVariant } from "../icons/mdiLogoutVariant";
|
||||
|
||||
import { MediaCollectionTypeIconCollection } from "../../components/utils/iconsCollection.jsx";
|
||||
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import { hideSidemenu, setBackdrop } from "../../utils/slice/sidemenu";
|
||||
|
||||
import { MdiHomeVariantOutline } from "../icons/mdiHomeVariantOutline";
|
||||
|
||||
import { EventEmitter as event } from "../../eventEmitter.js";
|
||||
|
||||
import "./sidemenu.module.scss";
|
||||
import { useDrawerStore } from "../../utils/store/drawer";
|
||||
|
||||
const drawerWidth = 320;
|
||||
|
||||
@@ -42,7 +41,6 @@ const DrawerHeader = styled("div")(({ theme }) => ({
|
||||
alignItems: "center",
|
||||
justifyContent: "flex-end",
|
||||
padding: theme.spacing(0, 1),
|
||||
// necessary for content to be below app bar
|
||||
...theme.mixins.toolbar,
|
||||
}));
|
||||
|
||||
@@ -54,7 +52,6 @@ const MiniDrawer = styled(MuiDrawer, {
|
||||
boxSizing: "border-box",
|
||||
backgroundColor: theme.palette.primary.background.dark,
|
||||
overflowX: "hidden",
|
||||
// width: `calc(${theme.spacing(7)} + 10px)`,
|
||||
}));
|
||||
|
||||
export const SideMenu = ({}) => {
|
||||
@@ -62,7 +59,6 @@ export const SideMenu = ({}) => {
|
||||
|
||||
const [display, setDisplay] = useState(false);
|
||||
|
||||
const backdrop = useSelector((state) => state.sidebar.backdrop);
|
||||
const navigate = useNavigate();
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
@@ -70,7 +66,7 @@ export const SideMenu = ({}) => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
enabled: !!window.api,
|
||||
enabled: display,
|
||||
networkMode: "always",
|
||||
});
|
||||
let libraries = useQuery({
|
||||
@@ -84,8 +80,6 @@ export const SideMenu = ({}) => {
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
const handleDrawerOpen = () => {};
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const handleLogout = async () => {
|
||||
console.log("Logging out user...");
|
||||
@@ -96,14 +90,12 @@ export const SideMenu = ({}) => {
|
||||
navigate("/login");
|
||||
};
|
||||
|
||||
const getCurrentLocation = () => {
|
||||
return location.pathname.slice(0, location.pathname.lastIndexOf("/"));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
location.pathname.includes("login") ||
|
||||
location.pathname.includes("setup")
|
||||
location.pathname.includes("setup") ||
|
||||
location.pathname.includes("player") ||
|
||||
location.pathname === "/"
|
||||
) {
|
||||
setDisplay(false);
|
||||
} else {
|
||||
@@ -111,184 +103,351 @@ export const SideMenu = ({}) => {
|
||||
}
|
||||
}, [location]);
|
||||
|
||||
const [open, setDrawerOpen] = useDrawerStore((state) => [
|
||||
state.open,
|
||||
state.setOpen,
|
||||
]);
|
||||
|
||||
if (!display) {
|
||||
return <></>;
|
||||
}
|
||||
|
||||
if (display) {
|
||||
return (
|
||||
<MiniDrawer
|
||||
variant="permanent"
|
||||
open={false}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
backgroundColor: "inherit",
|
||||
border: "none",
|
||||
width: `calc(${theme.spacing(7)} + 10px)`,
|
||||
height: "100vh",
|
||||
// display: visible ? "block" : "none",
|
||||
},
|
||||
}}
|
||||
sx={{
|
||||
width: `calc(${theme.spacing(7)} + 10px)`,
|
||||
background: backdrop
|
||||
? theme.palette.background.paper
|
||||
: "transparent",
|
||||
}}
|
||||
>
|
||||
<DrawerHeader
|
||||
className="Mui-DrawerHeader"
|
||||
<>
|
||||
<MiniDrawer
|
||||
variant="permanent"
|
||||
open={false}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
backgroundColor: "inherit",
|
||||
border: "none",
|
||||
width: `calc(${theme.spacing(7)} + 10px)`,
|
||||
height: "100vh",
|
||||
zIndex: "1",
|
||||
// display: visible ? "block" : "none",
|
||||
},
|
||||
}}
|
||||
sx={{
|
||||
justifyContent: "center",
|
||||
width: `calc(${theme.spacing(7)} + 10px)`,
|
||||
background: theme.palette.background.paper,
|
||||
}}
|
||||
>
|
||||
{/* <div>
|
||||
<Avatar src={""}/>
|
||||
<Typography variant="h3">
|
||||
{user["Name"]}
|
||||
</Typography>
|
||||
</div> */}
|
||||
<IconButton
|
||||
color="inherit"
|
||||
aria-label="open drawer"
|
||||
onClick={handleDrawerOpen}
|
||||
>
|
||||
<MdiMenu />
|
||||
</IconButton>
|
||||
</DrawerHeader>
|
||||
<Divider />
|
||||
{libraries.isLoading ? (
|
||||
<>
|
||||
<Skeleton
|
||||
height="100%"
|
||||
variant="rounded"
|
||||
width="calc(100% - 10px )"
|
||||
sx={{ margin: "5px" }}
|
||||
></Skeleton>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<List sx={{ border: "none" }}>
|
||||
{libraries.data.Items.map(
|
||||
(library, index) => {
|
||||
return (
|
||||
<Tooltip
|
||||
title={library.Name}
|
||||
placement="right"
|
||||
arrow
|
||||
followCursor
|
||||
key={index}
|
||||
>
|
||||
<ListItem
|
||||
className="sidemenu-item-container"
|
||||
disablePadding
|
||||
<DrawerHeader
|
||||
className="Mui-DrawerHeader"
|
||||
sx={{
|
||||
justifyContent: "center",
|
||||
}}
|
||||
></DrawerHeader>
|
||||
<Divider />
|
||||
{libraries.isLoading ? (
|
||||
<>
|
||||
<Skeleton
|
||||
height="100%"
|
||||
variant="rounded"
|
||||
width="calc(100% - 10px )"
|
||||
sx={{ margin: "5px" }}
|
||||
></Skeleton>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<List sx={{ border: "none" }}>
|
||||
{libraries.data.Items.map(
|
||||
(library, index) => {
|
||||
return (
|
||||
<Tooltip
|
||||
title={library.Name}
|
||||
placement="right"
|
||||
arrow
|
||||
followCursor
|
||||
key={index}
|
||||
>
|
||||
<ListItemButton
|
||||
component={
|
||||
NavLink
|
||||
}
|
||||
to={
|
||||
"/library/" +
|
||||
library.Id
|
||||
}
|
||||
className="sidemenu-item"
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
"center",
|
||||
px: 2.5,
|
||||
}}
|
||||
<ListItem
|
||||
className="sidemenu-item-container"
|
||||
disablePadding
|
||||
>
|
||||
<ListItemIcon
|
||||
<ListItemButton
|
||||
component={
|
||||
NavLink
|
||||
}
|
||||
to={
|
||||
"/library/" +
|
||||
library.Id
|
||||
}
|
||||
className="sidemenu-item"
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
"center",
|
||||
px: 2.5,
|
||||
display: "flex",
|
||||
flexDirection:
|
||||
"column",
|
||||
}}
|
||||
>
|
||||
{
|
||||
MediaCollectionTypeIconCollection[
|
||||
library
|
||||
.CollectionType
|
||||
]
|
||||
}
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</List>
|
||||
<List sx={{ marginTop: "auto" }}>
|
||||
<Tooltip
|
||||
title="Home"
|
||||
placement="right"
|
||||
followCursor
|
||||
arrow
|
||||
>
|
||||
<ListItem
|
||||
className="sidemenu-item-container"
|
||||
disablePadding
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
}}
|
||||
>
|
||||
{
|
||||
MediaCollectionTypeIconCollection[
|
||||
library
|
||||
.CollectionType
|
||||
]
|
||||
}
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</List>
|
||||
<List sx={{ marginTop: "auto" }}>
|
||||
<Divider />
|
||||
<Tooltip
|
||||
title="Home"
|
||||
placement="right"
|
||||
followCursor
|
||||
arrow
|
||||
>
|
||||
<ListItemButton
|
||||
component={NavLink}
|
||||
to="/home"
|
||||
className="sidemenu-item"
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent: "center",
|
||||
px: 2.5,
|
||||
}}
|
||||
<ListItem
|
||||
className="sidemenu-item-container"
|
||||
disablePadding
|
||||
>
|
||||
<ListItemIcon
|
||||
<ListItemButton
|
||||
component={NavLink}
|
||||
to="/home"
|
||||
className="sidemenu-item"
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
"center",
|
||||
px: 2.5,
|
||||
display: "flex",
|
||||
flexDirection:
|
||||
"column",
|
||||
}}
|
||||
>
|
||||
<MdiHomeVariantOutline></MdiHomeVariantOutline>
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
<Tooltip
|
||||
title="Logout"
|
||||
placement="right"
|
||||
followCursor
|
||||
arrow
|
||||
>
|
||||
<ListItem disablePadding>
|
||||
<ListItemButton
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent: "center",
|
||||
px: 2.5,
|
||||
}}
|
||||
onClick={handleLogout}
|
||||
>
|
||||
<ListItemIcon
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
}}
|
||||
>
|
||||
<MdiHomeVariantOutline />
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
<Tooltip
|
||||
title="Logout"
|
||||
placement="right"
|
||||
followCursor
|
||||
arrow
|
||||
>
|
||||
<ListItem disablePadding>
|
||||
<ListItemButton
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
"center",
|
||||
px: 2.5,
|
||||
}}
|
||||
onClick={handleLogout}
|
||||
>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
}}
|
||||
>
|
||||
<MdiLogoutVariant></MdiLogoutVariant>
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
</List>
|
||||
</>
|
||||
)}
|
||||
</MiniDrawer>
|
||||
|
||||
<MuiDrawer
|
||||
open={open}
|
||||
variant="persistent"
|
||||
onClose={() => setDrawerOpen(false)}
|
||||
elevation={0}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
background: "rgb(0 0 0 / 0.5)",
|
||||
backdropFilter: "blur(10px)",
|
||||
boxShadow: "0 0 15px rgb(0 0 0 / 0.2)",
|
||||
width: 260,
|
||||
},
|
||||
}}
|
||||
className="sidemenu-open"
|
||||
>
|
||||
<DrawerHeader
|
||||
className="Mui-DrawerHeader"
|
||||
sx={{
|
||||
justifyContent: "flex-start",
|
||||
}}
|
||||
>
|
||||
<IconButton onClick={() => setDrawerOpen(false)}>
|
||||
<MdiClose />
|
||||
</IconButton>
|
||||
</DrawerHeader>
|
||||
<Divider />
|
||||
{libraries.isLoading ? (
|
||||
<>
|
||||
<Skeleton
|
||||
height="100%"
|
||||
variant="rounded"
|
||||
width="calc(100% - 10px )"
|
||||
sx={{ margin: "5px" }}
|
||||
></Skeleton>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<List sx={{ border: "none" }}>
|
||||
{libraries.data.Items.map(
|
||||
(library, index) => {
|
||||
return (
|
||||
<Tooltip
|
||||
title={library.Name}
|
||||
placement="right"
|
||||
arrow
|
||||
followCursor
|
||||
key={index}
|
||||
>
|
||||
<ListItem
|
||||
className="sidemenu-item-container"
|
||||
disablePadding
|
||||
>
|
||||
<ListItemButton
|
||||
component={
|
||||
NavLink
|
||||
}
|
||||
to={
|
||||
"/library/" +
|
||||
library.Id
|
||||
}
|
||||
className="sidemenu-item"
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
"center",
|
||||
px: 2.5,
|
||||
}}
|
||||
>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
mr: 2,
|
||||
}}
|
||||
>
|
||||
{
|
||||
MediaCollectionTypeIconCollection[
|
||||
library
|
||||
.CollectionType
|
||||
]
|
||||
}
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
{
|
||||
library.Name
|
||||
}
|
||||
</ListItemText>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</List>
|
||||
<List sx={{ marginTop: "auto" }}>
|
||||
<Divider />
|
||||
<Tooltip
|
||||
title="Home"
|
||||
placement="right"
|
||||
followCursor
|
||||
arrow
|
||||
>
|
||||
<ListItem
|
||||
className="sidemenu-item-container"
|
||||
disablePadding
|
||||
>
|
||||
<ListItemButton
|
||||
component={NavLink}
|
||||
to="/home"
|
||||
className="sidemenu-item"
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
"center",
|
||||
px: 2.5,
|
||||
}}
|
||||
>
|
||||
<MdiLogoutVariant></MdiLogoutVariant>
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
</List>
|
||||
</>
|
||||
)}
|
||||
</MiniDrawer>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
mr: 2,
|
||||
}}
|
||||
>
|
||||
<MdiHomeVariantOutline />
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
Home
|
||||
</ListItemText>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
<Tooltip
|
||||
title="Logout"
|
||||
placement="right"
|
||||
followCursor
|
||||
arrow
|
||||
>
|
||||
<ListItem disablePadding>
|
||||
<ListItemButton
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
"center",
|
||||
px: 2.5,
|
||||
}}
|
||||
onClick={handleLogout}
|
||||
>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
mr: 2,
|
||||
}}
|
||||
>
|
||||
<MdiLogoutVariant></MdiLogoutVariant>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
Logout
|
||||
</ListItemText>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
</List>
|
||||
</>
|
||||
)}
|
||||
</MuiDrawer>
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
// SideMenu.propTypes = {
|
||||
// skeleton: PropTypes.bool.isRequired,
|
||||
// data: PropTypes.array.isRequired,
|
||||
// };
|
||||
@@ -26,4 +26,12 @@
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
&-open {
|
||||
.sidemenu-item::before {
|
||||
width: 100%;
|
||||
inset: 0;
|
||||
border-radius: 0;
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ export const EmptyNotice = () => {
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
|
||||
@@ -9,7 +9,7 @@ export const ErrorNotice = () => {
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
|
||||
@@ -4,7 +4,6 @@ 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";
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
/** @format */
|
||||
|
||||
export const SplashScreen = () => {
|
||||
return <h1>I am loading...</h1>;
|
||||
};
|
||||
@@ -23,6 +23,7 @@ import { MdiAccountMusic } from "../icons/mdiAccountMusic";
|
||||
import { MdiDramaMasks } from "../icons/mdiDramaMasks";
|
||||
import { MdiMusic } from "../icons/mdiMusic";
|
||||
import { MdiAccountTie } from "../icons/mdiAccountTie";
|
||||
import { MdiAccount } from "../icons/mdiAccount";
|
||||
|
||||
export const MediaCollectionTypeIconCollection = {
|
||||
universal: <MdiMultimedia />,
|
||||
@@ -60,6 +61,8 @@ export const MediaTypeIconCollection = {
|
||||
Audio: <MdiMicrophone className="hero-carousel-background-icon" />,
|
||||
Photo: <MdiImage className="hero-carousel-background-icon" />,
|
||||
Book: <MdiBook className="hero-carousel-background-icon" />,
|
||||
MusicAlbum: <MdiAlbum className="hero-carousel-background-icon" />,
|
||||
AudioBook: <MdiBookMusic className="hero-carousel-background-icon" />,
|
||||
};
|
||||
|
||||
export const TypeIconCollectionCard = {
|
||||
@@ -97,6 +100,7 @@ export const TypeIconCollectionCard = {
|
||||
Trailer: <MdiYoutube className="card-image-icon" />,
|
||||
TvChannel: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
TvProgram: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
User: <MdiAccount className="card-image-icon" />,
|
||||
UserRootFolder: <MdiFolderOutline className="card-image-icon" />,
|
||||
UserView: <MdiMultimedia className="card-image-icon" />,
|
||||
Video: <MdiFilmstrip className="card-image-icon" />,
|
||||
|
||||
+11
-10
@@ -11,19 +11,20 @@ import App from "./App";
|
||||
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
|
||||
import store from "./store";
|
||||
import { Provider } from "react-redux";
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
networkMode: "always",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
ReactDOM.createRoot(document.getElementById("root")).render(
|
||||
<React.StrictMode>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<Provider store={store}>
|
||||
<Router>
|
||||
<App />
|
||||
</Router>
|
||||
</Provider>
|
||||
<QueryClientProvider client={queryClient} option>
|
||||
<Router>
|
||||
<App />
|
||||
</Router>
|
||||
</QueryClientProvider>
|
||||
</React.StrictMode>,
|
||||
);
|
||||
|
||||
@@ -48,15 +48,15 @@
|
||||
opacity: 1;
|
||||
mask-image: linear-gradient(
|
||||
to right,
|
||||
transparent 10%,
|
||||
rgba(0, 0, 0, 0.5) 50%,
|
||||
black 90%
|
||||
transparent 2%,
|
||||
rgba(0, 0, 0, 0.5) 20%,
|
||||
black 70%
|
||||
);
|
||||
-webkit-mask-image: linear-gradient(
|
||||
to right,
|
||||
transparent 10%,
|
||||
rgba(0, 0, 0, 0.5) 50%,
|
||||
black 90%
|
||||
transparent 2%,
|
||||
rgba(0, 0, 0, 0.5) 20%,
|
||||
black 70%
|
||||
);
|
||||
}
|
||||
&-icon {
|
||||
@@ -84,7 +84,7 @@
|
||||
-webkit-line-clamp: 2;
|
||||
margin-bottom: 0.5em;
|
||||
&-logo {
|
||||
max-width: 6em;
|
||||
max-width: 12em;
|
||||
height: 2em;
|
||||
object-fit: contain;
|
||||
object-position: bottom;
|
||||
@@ -96,7 +96,7 @@
|
||||
display: flex;
|
||||
height: 70vh;
|
||||
width: 70%;
|
||||
padding: 0 2em 2em 2em;
|
||||
padding: 2em;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
|
||||
+112
-64
@@ -19,6 +19,7 @@ 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 Stack from "@mui/material/Stack";
|
||||
|
||||
import { yellow } from "@mui/material/colors";
|
||||
|
||||
@@ -33,7 +34,7 @@ import { CardsSkeleton } from "../../components/skeleton/cards";
|
||||
|
||||
// Icons
|
||||
import { MediaTypeIconCollection } from "../../components/utils/iconsCollection.jsx";
|
||||
import { MdiStarHalfFull } from "../../components/icons/mdiStarHalfFull";
|
||||
import { MdiStar } from "../../components/icons/mdiStar";
|
||||
import { MdiPlayOutline } from "../../components/icons/mdiPlayOutline";
|
||||
import { MdiChevronRight } from "../../components/icons/mdiChevronRight";
|
||||
|
||||
@@ -45,7 +46,8 @@ import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
import { getRuntime } from "../../utils/date/time";
|
||||
import { endsAt, getRuntime } from "../../utils/date/time";
|
||||
import { BaseItemKind, ItemFields } from "@jellyfin/sdk/lib/generated-client";
|
||||
|
||||
const Home = () => {
|
||||
const authUser = useQuery({
|
||||
@@ -93,8 +95,14 @@ const Home = () => {
|
||||
const media = await getUserLibraryApi(window.api).getLatestMedia(
|
||||
{
|
||||
userId: user.data.Id,
|
||||
fields: "Overview",
|
||||
fields: [ItemFields.Overview, ItemFields.ParentId],
|
||||
includeItemTypes: [
|
||||
BaseItemKind.Series,
|
||||
BaseItemKind.Movie,
|
||||
BaseItemKind.AudioBook,
|
||||
],
|
||||
enableUserData: true,
|
||||
limit: 16,
|
||||
},
|
||||
);
|
||||
return media.data;
|
||||
@@ -109,7 +117,7 @@ const Home = () => {
|
||||
const resumeItems = await getItemsApi(window.api).getResumeItems(
|
||||
{
|
||||
userId: user.data.Id,
|
||||
limit: 16,
|
||||
limit: 10,
|
||||
mediaTypes: ["Video"],
|
||||
enableUserData: true,
|
||||
},
|
||||
@@ -126,7 +134,7 @@ const Home = () => {
|
||||
const resumeItems = await getItemsApi(window.api).getResumeItems(
|
||||
{
|
||||
userId: user.data.Id,
|
||||
limit: 16,
|
||||
limit: 10,
|
||||
mediaTypes: ["Audio"],
|
||||
enableUserData: true,
|
||||
},
|
||||
@@ -142,7 +150,7 @@ const Home = () => {
|
||||
queryFn: async () => {
|
||||
const upNext = await getTvShowsApi(window.api).getNextUp({
|
||||
userId: user.data.Id,
|
||||
limit: 16,
|
||||
limit: 10,
|
||||
});
|
||||
return upNext.data;
|
||||
},
|
||||
@@ -238,7 +246,7 @@ const Home = () => {
|
||||
<CarouselSkeleton />
|
||||
) : (
|
||||
// <></>
|
||||
latestMedia.data != null &&
|
||||
latestMedia.data.length != 0 &&
|
||||
latestMedia.data.map((item, index) => {
|
||||
return (
|
||||
<Paper
|
||||
@@ -251,29 +259,68 @@ const Home = () => {
|
||||
key={index}
|
||||
>
|
||||
<div className="hero-carousel-background-container">
|
||||
{item.ImageBlurHashes
|
||||
.Backdrop ? (
|
||||
<>
|
||||
<Blurhash
|
||||
hash={
|
||||
item
|
||||
.ImageBlurHashes
|
||||
.Backdrop[
|
||||
{item.Type ==
|
||||
BaseItemKind.MusicAlbum ? (
|
||||
!!item.ParentBackdropItemId && (
|
||||
<>
|
||||
<Blurhash
|
||||
hash={
|
||||
item
|
||||
.BackdropImageTags[0]
|
||||
]
|
||||
}
|
||||
// hash="LEHV6nWB2yk8pyo0adR*.7kCMdnj"
|
||||
width="1080"
|
||||
height="720"
|
||||
resolutionX={
|
||||
64
|
||||
}
|
||||
resolutionY={
|
||||
96
|
||||
}
|
||||
className="hero-carousel-background-blurhash"
|
||||
/>
|
||||
.ImageBlurHashes
|
||||
.Backdrop[
|
||||
item
|
||||
.ParentBackdropImageTags[0]
|
||||
]
|
||||
}
|
||||
// hash="LEHV6nWB2yk8pyo0adR*.7kCMdnj"
|
||||
width="1080"
|
||||
height="720"
|
||||
resolutionX={
|
||||
64
|
||||
}
|
||||
resolutionY={
|
||||
96
|
||||
}
|
||||
className="hero-carousel-background-blurhash"
|
||||
punch={1}
|
||||
/>
|
||||
<div
|
||||
className="hero-carousel-background-image"
|
||||
style={{
|
||||
backgroundImage: `url(${window.api.basePath}/Items/${item.ParentBackdropItemId}/Images/Backdrop)`,
|
||||
}}
|
||||
></div>
|
||||
</>
|
||||
)
|
||||
) : item.ImageBlurHashes
|
||||
.Backdrop ? (
|
||||
<>
|
||||
{item
|
||||
.BackdropImageTags
|
||||
.length !=
|
||||
0 && (
|
||||
<Blurhash
|
||||
hash={
|
||||
item
|
||||
.ImageBlurHashes
|
||||
.Backdrop[
|
||||
item
|
||||
.BackdropImageTags[0]
|
||||
]
|
||||
}
|
||||
// hash="LEHV6nWB2yk8pyo0adR*.7kCMdnj"
|
||||
width="1080"
|
||||
height="720"
|
||||
resolutionX={
|
||||
64
|
||||
}
|
||||
resolutionY={
|
||||
96
|
||||
}
|
||||
className="hero-carousel-background-blurhash"
|
||||
punch={1}
|
||||
/>
|
||||
)}
|
||||
<div
|
||||
className="hero-carousel-background-image"
|
||||
style={{
|
||||
@@ -294,7 +341,7 @@ const Home = () => {
|
||||
<div className="hero-carousel-background-icon-container">
|
||||
{
|
||||
MediaTypeIconCollection[
|
||||
item.MediaType
|
||||
item.Type
|
||||
]
|
||||
}
|
||||
</div>
|
||||
@@ -325,15 +372,25 @@ const Home = () => {
|
||||
></img>
|
||||
)}
|
||||
</Typography>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
alignItems:
|
||||
"center",
|
||||
width: "fit-content",
|
||||
gap: "1em",
|
||||
mb: 1.5,
|
||||
}}
|
||||
<Stack
|
||||
// sx={{
|
||||
// display: "flex",
|
||||
// alignItems:
|
||||
// "center",
|
||||
// width: "fit-content",
|
||||
// gap: "1em",
|
||||
// mb: 1.5,
|
||||
// }}
|
||||
direction="row"
|
||||
gap={1}
|
||||
divider={
|
||||
<Divider
|
||||
variant="middle"
|
||||
component="div"
|
||||
orientation="vertical"
|
||||
flexItem
|
||||
/>
|
||||
}
|
||||
className="hero-carousel-info"
|
||||
>
|
||||
<Typography
|
||||
@@ -344,12 +401,6 @@ const Home = () => {
|
||||
? item.ProductionYear
|
||||
: "Unknown"}
|
||||
</Typography>
|
||||
<Divider
|
||||
variant="middle"
|
||||
component="div"
|
||||
orientation="vertical"
|
||||
flexItem
|
||||
/>
|
||||
<Chip
|
||||
variant="outlined"
|
||||
label={
|
||||
@@ -358,12 +409,6 @@ const Home = () => {
|
||||
: "Not Rated"
|
||||
}
|
||||
/>
|
||||
<Divider
|
||||
variant="middle"
|
||||
component="div"
|
||||
orientation="vertical"
|
||||
flexItem
|
||||
/>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
@@ -375,7 +420,7 @@ const Home = () => {
|
||||
>
|
||||
{!!item.CommunityRating ? (
|
||||
<>
|
||||
<MdiStarHalfFull
|
||||
<MdiStar
|
||||
sx={{
|
||||
color: yellow[700],
|
||||
}}
|
||||
@@ -396,18 +441,21 @@ const Home = () => {
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
<Divider
|
||||
variant="middle"
|
||||
component="div"
|
||||
orientation="vertical"
|
||||
flexItem
|
||||
/>
|
||||
<Typography variant="subtitle1">
|
||||
{getRuntime(
|
||||
item.RunTimeTicks,
|
||||
)}
|
||||
</Typography>
|
||||
</Box>
|
||||
{!!item.RunTimeTicks && (
|
||||
<Typography variant="subtitle1">
|
||||
{getRuntime(
|
||||
item.RunTimeTicks,
|
||||
)}
|
||||
</Typography>
|
||||
)}
|
||||
{!!item.RunTimeTicks && (
|
||||
<Typography variant="subtitle1">
|
||||
{endsAt(
|
||||
item.RunTimeTicks,
|
||||
)}
|
||||
</Typography>
|
||||
)}
|
||||
</Stack>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
className="hero-carousel-text"
|
||||
|
||||
+1359
-343
File diff suppressed because it is too large.
Load diff
@@ -23,13 +23,13 @@
|
||||
&-backdrop {
|
||||
position: absolute;
|
||||
width: 100vw;
|
||||
height: 135%;
|
||||
height: 80vh;
|
||||
top: -88px;
|
||||
width: 100vw;
|
||||
right: 0;
|
||||
left: -24px;
|
||||
z-index: -2;
|
||||
filter: brightness(0.7);
|
||||
filter: brightness(0.6);
|
||||
mask-image: linear-gradient(0deg, transparent, black 75%);
|
||||
-webkit-mask-image: linear-gradient(
|
||||
0deg,
|
||||
@@ -52,10 +52,13 @@
|
||||
width: 15%;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
aspect-ratio: 0.666;
|
||||
border-radius: $border-radius-default;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 0 15px rgb(0 0 0 / 0.4);
|
||||
&.Episode {
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0.25;
|
||||
}
|
||||
}
|
||||
&-icon-container {
|
||||
background: $clr-gradient-dark;
|
||||
@@ -73,6 +76,7 @@
|
||||
&-title-logo {
|
||||
filter: drop-shadow(0 0 10px rgb(0 0 0 /0.2));
|
||||
height: 100%;
|
||||
max-height: 5em;
|
||||
width: 45%;
|
||||
object-fit: contain;
|
||||
object-position: bottom;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @format */
|
||||
import { useState, useEffect } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { motion } from "framer-motion";
|
||||
import { useParams, useNavigate, Link } from "react-router-dom";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
@@ -30,7 +30,6 @@ 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";
|
||||
|
||||
@@ -386,7 +385,8 @@ const LibraryView = () => {
|
||||
queryFn: () => fetchLibItems(id),
|
||||
enabled: currentLib.isSuccess,
|
||||
networkMode: "always",
|
||||
keepPreviousData: true,
|
||||
keepPreviousData: false,
|
||||
cacheTime: 0,
|
||||
});
|
||||
|
||||
const handleCurrentViewType = (e) => {
|
||||
@@ -396,7 +396,6 @@ const LibraryView = () => {
|
||||
useEffect(() => {
|
||||
if (viewType.length != 0) {
|
||||
setCurrentViewType(viewType[0].value);
|
||||
console.log(viewType);
|
||||
}
|
||||
}, [viewType]);
|
||||
|
||||
@@ -441,6 +440,14 @@ const LibraryView = () => {
|
||||
items.refetch();
|
||||
};
|
||||
|
||||
const disablePaginationViews = [
|
||||
"MusicArtist",
|
||||
"Person",
|
||||
"Genre",
|
||||
"MusicGenre",
|
||||
"Studio",
|
||||
];
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -462,8 +469,8 @@ const LibraryView = () => {
|
||||
position="fixed"
|
||||
elevation={trigger ? 1 : 0}
|
||||
sx={{
|
||||
width: `calc(100vw - ${theme.spacing(7)})`,
|
||||
mt: 8,
|
||||
width: `calc(100vw - ${theme.spacing(7)} - 10px)`,
|
||||
top: `${8 * 8}px !important`,
|
||||
backdropFilter: trigger ? `blur(30px)` : "none",
|
||||
background: "transparent",
|
||||
backgroundColor: trigger
|
||||
@@ -927,6 +934,20 @@ const LibraryView = () => {
|
||||
xs={1}
|
||||
sm={1}
|
||||
md={1}
|
||||
component={motion.div}
|
||||
initial={{
|
||||
scale: 0.8,
|
||||
opacity: 0,
|
||||
}}
|
||||
animate={{
|
||||
scale: 1,
|
||||
opacity: 1,
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.25,
|
||||
ease: "easeInOut",
|
||||
delay: 0.02 * index,
|
||||
}}
|
||||
>
|
||||
<Card
|
||||
itemName={item.Name}
|
||||
@@ -934,7 +955,13 @@ const LibraryView = () => {
|
||||
imageTags={
|
||||
!!item.ImageTags.Primary
|
||||
}
|
||||
subText={item.ProductionYear}
|
||||
subText={
|
||||
item.Type.includes(
|
||||
"Music",
|
||||
)
|
||||
? item.AlbumArtist
|
||||
: item.ProductionYear
|
||||
}
|
||||
iconType={item.Type}
|
||||
playedPercent={
|
||||
!!item.UserData
|
||||
@@ -960,9 +987,8 @@ const LibraryView = () => {
|
||||
: false
|
||||
}
|
||||
watchedCount={
|
||||
!!item.UserData &&
|
||||
item.UserData
|
||||
.UnplayedItemCount
|
||||
?.UnplayedItemCount
|
||||
}
|
||||
blurhash={
|
||||
item.ImageBlurHashes ==
|
||||
@@ -984,6 +1010,9 @@ const LibraryView = () => {
|
||||
: ""
|
||||
}
|
||||
currentUser={user.data}
|
||||
favourite={
|
||||
item.UserData?.IsFavorite
|
||||
}
|
||||
></Card>
|
||||
</Grid2>
|
||||
);
|
||||
@@ -996,7 +1025,8 @@ const LibraryView = () => {
|
||||
{items.data.Items.map((item, index) => {
|
||||
return (
|
||||
<TableRow
|
||||
key={index}
|
||||
component={motion.div}
|
||||
key={item.Id}
|
||||
sx={{
|
||||
"& td,& th": {
|
||||
borderBottom:
|
||||
@@ -1009,6 +1039,19 @@ const LibraryView = () => {
|
||||
"rgb(255 255 255 / 0.05)",
|
||||
},
|
||||
}}
|
||||
initial={{
|
||||
scale: 0.8,
|
||||
opacity: 0,
|
||||
}}
|
||||
animate={{
|
||||
scale: 1,
|
||||
opacity: 1,
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.25,
|
||||
ease: "easeInOut",
|
||||
delay: 0.02 * index,
|
||||
}}
|
||||
>
|
||||
<TableCell width="4.5em">
|
||||
<Box className="library-list-image-container">
|
||||
@@ -1098,8 +1141,9 @@ const LibraryView = () => {
|
||||
)}
|
||||
|
||||
{!items.isFetching &&
|
||||
!disablePaginationViews.includes(currentViewType) &&
|
||||
items.isSuccess &&
|
||||
items.data.TotalRecordCount > 75 && (
|
||||
items.data.TotalRecordCount > maxDisplayItems && (
|
||||
<Stack
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
|
||||
+11
-25
@@ -1,14 +1,10 @@
|
||||
/** @format */
|
||||
|
||||
import { useState, useEffect, useMemo } from "react";
|
||||
import { useState } from "react";
|
||||
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";
|
||||
@@ -26,8 +22,6 @@ 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";
|
||||
@@ -35,21 +29,16 @@ import FormControlLabel from "@mui/material/FormControlLabel";
|
||||
import Checkbox from "@mui/material/Checkbox";
|
||||
|
||||
import { AvatarImage } from "../../components/avatar/avatar.jsx";
|
||||
import { CardScroller } from "../../components/cardScroller/cardScroller.jsx";
|
||||
import { Card } from "../../components/card/card.jsx";
|
||||
import { AppBarBackOnly } from "../../components/appBar/backOnly.jsx";
|
||||
|
||||
// import { jellyfin } from "../../jellyfin";
|
||||
// import getSystemApi from "@jellyfin/sdk";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
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({
|
||||
@@ -99,7 +88,6 @@ export const LoginWithImage = () => {
|
||||
}
|
||||
event.emit("set-api-accessToken", window.api.basePath);
|
||||
setLoading(false);
|
||||
dispatch(showSidemenu());
|
||||
navigate(`/home`);
|
||||
};
|
||||
|
||||
@@ -159,7 +147,7 @@ export const LoginWithImage = () => {
|
||||
{userName}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item minWidth="100%">
|
||||
<Grid minWidth="100%">
|
||||
<FormGroup>
|
||||
<FormControl variant="outlined" fullWidth>
|
||||
<InputLabel htmlFor="user-password">
|
||||
@@ -208,7 +196,7 @@ export const LoginWithImage = () => {
|
||||
/>
|
||||
</FormGroup>
|
||||
</Grid>
|
||||
<Grid item minWidth="100%">
|
||||
<Grid minWidth="100%">
|
||||
<LoadingButton
|
||||
variant="contained"
|
||||
endIcon={<MdiChevronRight />}
|
||||
@@ -241,9 +229,7 @@ export const UserLogin = () => {
|
||||
queryKey: ["login", "users"],
|
||||
queryFn: async () => {
|
||||
const users = await getUserApi(window.api).getPublicUsers();
|
||||
console.log(users.data);
|
||||
return users.data;
|
||||
// return {};
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
@@ -301,8 +287,8 @@ export const UserLogin = () => {
|
||||
imageTags={
|
||||
!!item.PrimaryImageTag
|
||||
}
|
||||
// cardType="sqaure"
|
||||
iconType="Person"
|
||||
disableOverlay
|
||||
iconType="User"
|
||||
cardOrientation="sqaure"
|
||||
onClickEvent={() =>
|
||||
navigate(
|
||||
@@ -345,7 +331,6 @@ export const UserLoginManual = () => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [rememberMe, setRememberMe] = useState(true);
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
@@ -439,14 +424,15 @@ export const UserLoginManual = () => {
|
||||
sx={{
|
||||
opacity: server.isLoading ? 0 : 1,
|
||||
transition: "opacity 200ms",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
<Grid item xl={5} md={6} sx={{ marginBottom: "1em" }}>
|
||||
<Grid sx={{ marginBottom: "1em" }}>
|
||||
<Typography variant="h3" color="textPrimary">
|
||||
Login
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid sx={{ width: "100%" }} item xl={5} md={6}>
|
||||
<Grid sx={{ width: "100%" }}>
|
||||
<FormControl
|
||||
sx={{ width: "100%" }}
|
||||
variant="outlined"
|
||||
@@ -464,7 +450,7 @@ export const UserLoginManual = () => {
|
||||
/>
|
||||
</FormControl>
|
||||
</Grid>
|
||||
<Grid sx={{ width: "100%" }} item xl={5} md={6}>
|
||||
<Grid sx={{ width: "100%" }}>
|
||||
<FormGroup>
|
||||
<FormControl
|
||||
sx={{ width: "100%" }}
|
||||
@@ -517,7 +503,7 @@ export const UserLoginManual = () => {
|
||||
/>
|
||||
</FormGroup>
|
||||
</Grid>
|
||||
<Grid item xl={5} md={6} sx={{ width: "100%" }}>
|
||||
<Grid sx={{ width: "100%" }}>
|
||||
<LoadingButton
|
||||
variant="contained"
|
||||
endIcon={<MdiChevronRight />}
|
||||
@@ -530,7 +516,7 @@ export const UserLoginManual = () => {
|
||||
Login
|
||||
</LoadingButton>
|
||||
</Grid>
|
||||
<Grid item xl={15} md={6} sx={{ width: "100%" }}>
|
||||
<Grid sx={{ width: "100%" }}>
|
||||
<Typography variant="subtitle2">
|
||||
{server.isSuccess &&
|
||||
server.data.LoginDisclaimer}
|
||||
|
||||
@@ -0,0 +1,574 @@
|
||||
/** @format */
|
||||
import { appWindow } from "@tauri-apps/api/window";
|
||||
|
||||
import AppBar from "@mui/material/AppBar";
|
||||
import Toolbar from "@mui/material/Toolbar";
|
||||
import Box from "@mui/material/Box";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Slider from "@mui/material/Slider";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Menu from "@mui/material/Menu";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import ListItem from "@mui/material/ListItem";
|
||||
import ListItemText from "@mui/material/ListItemText";
|
||||
import Backdrop from "@mui/material/Backdrop";
|
||||
|
||||
import ReactPlayer from "react-player";
|
||||
|
||||
import { usePlaybackStore } from "../../utils/store/playback";
|
||||
import { MdiArrowLeft } from "../../components/icons/mdiArrowLeft";
|
||||
import { MdiPlay } from "../../components/icons/mdiPlay";
|
||||
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
import { useRef, useState, useCallback, useEffect } from "react";
|
||||
import { secToTicks, ticksToSec } from "../../utils/date/time";
|
||||
|
||||
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
||||
|
||||
import "./videoPlayer.module.scss";
|
||||
import { MdiPause } from "../../components/icons/mdiPause";
|
||||
import { MdiFastForward } from "../../components/icons/mdiFastForward";
|
||||
import { MdiRewind } from "../../components/icons/mdiRewind";
|
||||
import { MdiFullscreen } from "../../components/icons/mdiFullscreen";
|
||||
import { MdiFullscreenExit } from "../../components/icons/mdiFullscreenExit";
|
||||
import { MdiPictureInPictureBottomRight } from "../../components/icons/mdiPictureInPictureBottomRight";
|
||||
import { MdiVolumeHigh } from "../../components/icons/mdiVolumeHigh";
|
||||
import { MdiVolumeOff } from "../../components/icons/mdiVolumeOff";
|
||||
import { MdiPlaySpeed } from "../../components/icons/mdiPlaySpeed";
|
||||
|
||||
import { endsAt } from "../../utils/date/time";
|
||||
|
||||
import useKeyPress from "../../utils/hooks/useKeyPress";
|
||||
import { MdiCog } from "../../components/icons/mdiCog";
|
||||
|
||||
export const VideoPlayer = () => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [settingsMenuEl, setSettingsMenuEl] = useState(null);
|
||||
const settingsMenuState = Boolean(settingsMenuEl);
|
||||
|
||||
const [speedMenuEl, setSpeedMenuEl] = useState(null);
|
||||
const [speed, setSpeed] = useState(3);
|
||||
const speedMenuState = Boolean(speedMenuEl);
|
||||
const availableSpeeds = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
|
||||
|
||||
const [
|
||||
url,
|
||||
startPosition,
|
||||
itemDuration,
|
||||
itemId,
|
||||
itemName,
|
||||
subtitleTracksStore,
|
||||
selectedSubtitleTrack,
|
||||
] = usePlaybackStore((state) => [
|
||||
state.url,
|
||||
state.startPosition,
|
||||
state.duration,
|
||||
state.itemId,
|
||||
state.itemName,
|
||||
state.subtitleTracks,
|
||||
state.selectedSubtitleTrack,
|
||||
]);
|
||||
const [currentSubtrack, setCurrentSubtrack] = useState(
|
||||
selectedSubtitleTrack,
|
||||
);
|
||||
|
||||
const [showControls, setShowControls] = useState(false);
|
||||
|
||||
const playerRef = useRef();
|
||||
const [isSeeking, setIsSeeking] = useState(false);
|
||||
const [isBuffering, setIsBuffering] = useState(true);
|
||||
const [isPlaying, setIsPlaying] = useState(true);
|
||||
const [isMuted, setIsMuted] = useState(false);
|
||||
const [isReady, setIsReady] = useState(false);
|
||||
const [isPIP, setIsPIP] = useState(false);
|
||||
const [volume, setVolume] = useState(0.8);
|
||||
|
||||
const [showVolume, setShowVolume] = useState(false);
|
||||
|
||||
const [duration, setDuration] = useState(0);
|
||||
const [progress, setProgress] = useState(0);
|
||||
const [currentTime, setCurrentTime] = useState(startPosition);
|
||||
|
||||
const onReady = useCallback(() => {
|
||||
if (!isReady) {
|
||||
const timeToStart = ticksToSec(startPosition);
|
||||
playerRef.current.seekTo(timeToStart, "seconds");
|
||||
setDuration(playerRef.current.getDuration());
|
||||
setIsReady(true);
|
||||
const player = playerRef.current.getInternalPlayer();
|
||||
console.log(player.config);
|
||||
}
|
||||
}, [isReady]);
|
||||
|
||||
const onProgress = async (e) => {
|
||||
if (!isSeeking) {
|
||||
setProgress(e.played);
|
||||
setCurrentTime(secToTicks(e.playedSeconds));
|
||||
}
|
||||
await getPlaystateApi(window.api).reportPlaybackProgress({
|
||||
playbackProgressInfo: {
|
||||
ItemId: itemId,
|
||||
IsMuted: isMuted,
|
||||
PositionTicks: secToTicks(e.playedSeconds),
|
||||
PlaybackStartTimeTicks: startPosition,
|
||||
VolumeLevel: volume * 100,
|
||||
IsPaused: !isPlaying,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const handleDisplayCurrentTime = () => {
|
||||
let time = ticksToSec(progress * itemDuration);
|
||||
let hr = Math.floor(time / 3600);
|
||||
time -= hr * 3600;
|
||||
let min = Math.floor(time / 60);
|
||||
time -= min * 60;
|
||||
return `${hr.toLocaleString([], {
|
||||
minimumIntegerDigits: 2,
|
||||
maximumFractionDigits: 0,
|
||||
})}:${min.toLocaleString([], {
|
||||
minimumIntegerDigits: 2,
|
||||
maximumFractionDigits: 0,
|
||||
})}:${time.toLocaleString([], {
|
||||
minimumIntegerDigits: 2,
|
||||
maximumFractionDigits: 0,
|
||||
})}`;
|
||||
};
|
||||
|
||||
const handleDisplayTime = (ticks) => {
|
||||
let time = ticksToSec(ticks);
|
||||
let hr = Math.floor(time / 3600);
|
||||
time -= hr * 3600;
|
||||
let min = Math.floor(time / 60);
|
||||
time -= min * 60;
|
||||
return `${hr.toLocaleString([], {
|
||||
minimumIntegerDigits: 2,
|
||||
maximumFractionDigits: 0,
|
||||
})}:${min.toLocaleString([], {
|
||||
minimumIntegerDigits: 2,
|
||||
maximumFractionDigits: 0,
|
||||
})}:${time.toLocaleString([], {
|
||||
minimumIntegerDigits: 2,
|
||||
maximumFractionDigits: 0,
|
||||
})}`;
|
||||
};
|
||||
|
||||
const [appFullscreen, setAppFullScreen] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
let timeout = null;
|
||||
if (showControls) {
|
||||
window.clearTimeout(timeout);
|
||||
timeout = setTimeout(() => {
|
||||
setShowControls(false);
|
||||
}, 5000);
|
||||
}
|
||||
}, [showControls]);
|
||||
|
||||
const handleKeyPress = useCallback((event) => {
|
||||
switch (event.key) {
|
||||
case "ArrowRight":
|
||||
playerRef.current.seekTo(
|
||||
playerRef.current.getCurrentTime() + 15,
|
||||
);
|
||||
break;
|
||||
case "ArrowLeft":
|
||||
playerRef.current.seekTo(
|
||||
playerRef.current.getCurrentTime() - 15,
|
||||
);
|
||||
break;
|
||||
case "p":
|
||||
setIsPlaying(!isPlaying);
|
||||
default:
|
||||
console.log(event.key);
|
||||
break;
|
||||
}
|
||||
}, []);
|
||||
|
||||
const [subs, setSubs] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
setSubs(
|
||||
subtitleTracksStore.map((sub, index) => {
|
||||
return {
|
||||
kind: "subtitles",
|
||||
src: `${window.api.basePath}/Videos/${itemId}/${itemId}/Subtitles/${sub.Index}/Stream.vtt?api_key=${window.api.accessToken}`,
|
||||
srcLang: sub?.Language,
|
||||
default: false,
|
||||
mode:
|
||||
sub.Index == currentSubtrack
|
||||
? "showing"
|
||||
: "hidden",
|
||||
};
|
||||
}),
|
||||
);
|
||||
}, [subtitleTracksStore]);
|
||||
|
||||
return (
|
||||
<Box
|
||||
className="video"
|
||||
sx={{ background: "black" }}
|
||||
onMouseMove={() => {
|
||||
setShowControls(true);
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
position: "absolute",
|
||||
inset: 0,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
opacity: isBuffering ? 1 : 0,
|
||||
transition: "opacity 250ms",
|
||||
}}
|
||||
>
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
<Backdrop
|
||||
className="video-osd"
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
zIndex: 100000,
|
||||
justifyContent: "space-between",
|
||||
background: "transparent",
|
||||
}}
|
||||
open={showControls}
|
||||
>
|
||||
<AppBar
|
||||
position="static"
|
||||
elevation={0}
|
||||
sx={{
|
||||
background:
|
||||
"linear-gradient(to bottom, rgb(0 0 0 / 0.75), transparent)",
|
||||
}}
|
||||
>
|
||||
<Toolbar>
|
||||
<IconButton onClick={() => navigate(-1)}>
|
||||
<MdiArrowLeft />
|
||||
</IconButton>
|
||||
<Typography ml={2} variant="h6">
|
||||
{itemName}
|
||||
</Typography>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
<Stack
|
||||
direction="column"
|
||||
padding={2}
|
||||
width="100%"
|
||||
sx={{
|
||||
background:
|
||||
"linear-gradient(to top, rgb(0 0 0 / 0.75), transparent)",
|
||||
}}
|
||||
>
|
||||
<Stack
|
||||
width="100%"
|
||||
direction="row"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
gap={2}
|
||||
>
|
||||
<Typography variant="h6">
|
||||
{handleDisplayCurrentTime()}
|
||||
</Typography>
|
||||
<Slider
|
||||
value={currentTime}
|
||||
step={0.01}
|
||||
max={itemDuration}
|
||||
onChange={(e, newVal) => {
|
||||
setIsSeeking(true);
|
||||
setCurrentTime(newVal);
|
||||
}}
|
||||
onChangeCommitted={(e, newVal) => {
|
||||
playerRef.current.seekTo(
|
||||
ticksToSec(newVal),
|
||||
);
|
||||
setCurrentTime(newVal);
|
||||
setIsSeeking(false);
|
||||
}}
|
||||
valueLabelDisplay="auto"
|
||||
valueLabelFormat={(value) =>
|
||||
handleDisplayTime(value)
|
||||
}
|
||||
sx={{
|
||||
"& .MuiSlider-valueLabel": {
|
||||
lineHeight: 1.2,
|
||||
fontSize: 24,
|
||||
background: "rgb(0 0 0 / 0.5)",
|
||||
backdropFilter: "blur(5px)",
|
||||
padding: 1,
|
||||
borderRadius: "10px",
|
||||
border: "1px solid rgb(255 255 255 / 0.15)",
|
||||
boxShadow:
|
||||
"0 0 10px rgb(0 0 0 / 0.4) ",
|
||||
transform:
|
||||
"translatey(-120%) scale(0)",
|
||||
"&:before": { display: "none" },
|
||||
"&.MuiSlider-valueLabelOpen": {
|
||||
transform:
|
||||
"translateY(-120%) scale(1)",
|
||||
},
|
||||
"& > *": {
|
||||
transform: "rotate(0deg)",
|
||||
},
|
||||
},
|
||||
}}
|
||||
/>
|
||||
<Typography variant="h6">
|
||||
{handleDisplayTime(itemDuration)}
|
||||
</Typography>
|
||||
</Stack>
|
||||
<Stack
|
||||
direction="row"
|
||||
justifyContent="space-between"
|
||||
alignItems="center"
|
||||
>
|
||||
<Stack
|
||||
direction="row"
|
||||
gap={1}
|
||||
justifyContent="center"
|
||||
alignItems="center"
|
||||
>
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
playerRef.current.seekTo(
|
||||
playerRef.current.getCurrentTime() -
|
||||
15,
|
||||
)
|
||||
}
|
||||
>
|
||||
<MdiRewind />
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() => setIsPlaying(!isPlaying)}
|
||||
>
|
||||
{isPlaying ? <MdiPause /> : <MdiPlay />}
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
playerRef.current.seekTo(
|
||||
playerRef.current.getCurrentTime() +
|
||||
15,
|
||||
)
|
||||
}
|
||||
>
|
||||
<MdiFastForward />
|
||||
</IconButton>
|
||||
<Typography variant="subtitle1">
|
||||
{endsAt(itemDuration - currentTime)}
|
||||
</Typography>
|
||||
</Stack>
|
||||
<Stack
|
||||
direction="row"
|
||||
gap={1}
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
>
|
||||
<Box>
|
||||
<Menu
|
||||
anchorEl={speedMenuEl}
|
||||
open={speedMenuState}
|
||||
onClose={() =>
|
||||
setSpeedMenuEl(null)
|
||||
}
|
||||
MenuListProps={{
|
||||
"aria-labelledby":
|
||||
"lock-button",
|
||||
role: "listbox",
|
||||
}}
|
||||
anchorOrigin={{
|
||||
vertical: "bottom",
|
||||
horizontal: "center",
|
||||
}}
|
||||
transformOrigin={{
|
||||
vertical: "bottom",
|
||||
horizontal: "center",
|
||||
}}
|
||||
sx={{
|
||||
mb: 20,
|
||||
}}
|
||||
>
|
||||
{availableSpeeds.map(
|
||||
(sspeed, index) => {
|
||||
return (
|
||||
<MenuItem
|
||||
key={sspeed}
|
||||
selected={
|
||||
index ===
|
||||
speed
|
||||
}
|
||||
onClick={() => {
|
||||
setSpeed(
|
||||
index,
|
||||
);
|
||||
setSpeedMenuEl(
|
||||
null,
|
||||
);
|
||||
}}
|
||||
sx={{
|
||||
width: 160,
|
||||
}}
|
||||
>
|
||||
{sspeed}x
|
||||
</MenuItem>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</Menu>
|
||||
<IconButton
|
||||
onClick={(e) =>
|
||||
setSpeedMenuEl(
|
||||
e.currentTarget,
|
||||
)
|
||||
}
|
||||
>
|
||||
<MdiPlaySpeed />
|
||||
</IconButton>
|
||||
</Box>
|
||||
<IconButton
|
||||
sx={{
|
||||
ml: 0.1,
|
||||
}}
|
||||
onClick={() => setIsMuted(!isMuted)}
|
||||
>
|
||||
{isMuted ? (
|
||||
<MdiVolumeOff />
|
||||
) : (
|
||||
<MdiVolumeHigh />
|
||||
)}
|
||||
</IconButton>
|
||||
<Slider
|
||||
value={isMuted ? 0 : volume * 100}
|
||||
step={1}
|
||||
max={100}
|
||||
onChange={(e, newVal) =>
|
||||
setVolume(newVal / 100)
|
||||
}
|
||||
valueLabelDisplay="auto"
|
||||
valueLabelFormat={(value) =>
|
||||
Math.floor(value)
|
||||
}
|
||||
sx={{
|
||||
mr: 1,
|
||||
ml: 1,
|
||||
width: "10em",
|
||||
"& .MuiSlider-valueLabel": {
|
||||
lineHeight: 1.2,
|
||||
fontSize: 24,
|
||||
background:
|
||||
"rgb(0 0 0 / 0.5)",
|
||||
backdropFilter: "blur(5px)",
|
||||
padding: 1,
|
||||
borderRadius: "10px",
|
||||
border: "1px solid rgb(255 255 255 / 0.15)",
|
||||
boxShadow:
|
||||
"0 0 10px rgb(0 0 0 / 0.4) ",
|
||||
transform:
|
||||
"translatey(-120%) scale(0)",
|
||||
"&:before": {
|
||||
display: "none",
|
||||
},
|
||||
"&.MuiSlider-valueLabelOpen":
|
||||
{
|
||||
transform:
|
||||
"translateY(-120%) scale(1)",
|
||||
},
|
||||
"& > *": {
|
||||
transform:
|
||||
"rotate(0deg)",
|
||||
},
|
||||
},
|
||||
}}
|
||||
/>
|
||||
<Box>
|
||||
<Menu
|
||||
anchorEl={settingsMenuEl}
|
||||
onClose={() => {
|
||||
setSettingsMenuEl(null);
|
||||
}}
|
||||
open={settingsMenuState}
|
||||
sx={{ padding: 2 }}
|
||||
>
|
||||
<Stack direction="row">
|
||||
<Typography variant="h6">
|
||||
Subtitle
|
||||
</Typography>
|
||||
</Stack>
|
||||
</Menu>
|
||||
<IconButton
|
||||
onClick={(e) =>
|
||||
setSettingsMenuEl(
|
||||
e.currentTarget,
|
||||
)
|
||||
}
|
||||
disabled
|
||||
>
|
||||
<MdiCog />
|
||||
</IconButton>
|
||||
</Box>
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
setIsPIP(!isPIP);
|
||||
}}
|
||||
>
|
||||
<MdiPictureInPictureBottomRight />
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={async () => {
|
||||
let fstate =
|
||||
await appWindow.isFullscreen();
|
||||
setAppFullScreen(!fstate);
|
||||
await appWindow.setFullscreen(
|
||||
!fstate,
|
||||
);
|
||||
}}
|
||||
>
|
||||
{appFullscreen ? (
|
||||
<MdiFullscreenExit />
|
||||
) : (
|
||||
<MdiFullscreen />
|
||||
)}
|
||||
</IconButton>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Backdrop>
|
||||
<ReactPlayer
|
||||
ref={playerRef}
|
||||
width="100vw"
|
||||
height="100vh"
|
||||
playing={isPlaying}
|
||||
url={url}
|
||||
onProgress={onProgress}
|
||||
onReady={onReady}
|
||||
muted={isMuted}
|
||||
pip={isPIP}
|
||||
volume={volume}
|
||||
onBuffer={() => setIsBuffering(true)}
|
||||
onBufferEnd={() => setIsBuffering(false)}
|
||||
config={{
|
||||
file: {
|
||||
attributes: {
|
||||
crossOrigin: "true",
|
||||
},
|
||||
tracks: [
|
||||
{
|
||||
kind: "subtitles",
|
||||
src: `${window.api.basePath}/Videos/${itemId}/${itemId}/Subtitles/${currentSubtrack}/Stream.vtt?api_key=${window.api.accessToken}`,
|
||||
srcLang: "",
|
||||
default: true,
|
||||
mode: "showing",
|
||||
},
|
||||
],
|
||||
},
|
||||
}}
|
||||
playbackRate={availableSpeeds[speed]}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
/** @format */
|
||||
|
||||
.video {
|
||||
&-osd {
|
||||
opacity: 0;
|
||||
transition: opacity 0.1s linear;
|
||||
}
|
||||
&-osd-visible &-osd {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
video {
|
||||
&::-webkit-media-text-track-display {
|
||||
overflow: visible !important;
|
||||
}
|
||||
&::cue {
|
||||
text-shadow: 0 2px 10px rgb(0 0 0 / 0.8);
|
||||
background: transparent;
|
||||
}
|
||||
&::cue(i) {
|
||||
text-shadow: 0 2px 10px rgb(0 0 0 / 0.8);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import axios from "axios";
|
||||
|
||||
import { EventEmitter as event } from "../../../eventEmitter.js";
|
||||
import { setServer } from "../../../utils/storage/servers.js";
|
||||
@@ -21,11 +21,17 @@ import { mdiChevronRight } from "@mdi/js";
|
||||
|
||||
import { useSnackbar } from "notistack";
|
||||
|
||||
// Svgs
|
||||
import { ReactComponent as JellyplayerLogo } from "../../../assets/logo.svg";
|
||||
import {
|
||||
Jellyfin,
|
||||
VersionOutdatedIssue,
|
||||
VersionUnsupportedIssue,
|
||||
} from "@jellyfin/sdk";
|
||||
import { version as appVer } from "../../../../package.json";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
// SCSS
|
||||
import "./server.module.scss";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
export const ServerList = () => {
|
||||
const [renderServerList, setRenderServerList] = useState(false);
|
||||
@@ -122,6 +128,17 @@ export const ServerList = () => {
|
||||
};
|
||||
|
||||
export const ServerSetup = (props) => {
|
||||
const sdk = new Jellyfin({
|
||||
clientInfo: {
|
||||
name: "JellyPlayer",
|
||||
version: appVer,
|
||||
},
|
||||
deviceInfo: {
|
||||
name: "JellyPlayer",
|
||||
id: uuidv4(),
|
||||
},
|
||||
});
|
||||
|
||||
const [serverIp, setServerIp] = useState("");
|
||||
const [checkingServer, setServerCheckState] = useState(false);
|
||||
|
||||
@@ -131,15 +148,7 @@ export const ServerSetup = (props) => {
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const usersAvailable = async () => {
|
||||
const users = await getUserApi(window.api).getPublicUsers();
|
||||
if (users.data.length >= 1) {
|
||||
console.log("Users => ", users.data);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
const usersAvailable = async () => {};
|
||||
const addServer = async () => {
|
||||
event.emit("create-jellyfin-api", serverIp);
|
||||
let sysInfo = await getSystemApi(window.api).getPublicSystemInfo();
|
||||
@@ -148,57 +157,75 @@ export const ServerSetup = (props) => {
|
||||
// Set Server Config to Tauri store
|
||||
sysInfo.Ip = serverIp;
|
||||
setServer(sysInfo);
|
||||
|
||||
const usersAvailablity = await usersAvailable();
|
||||
if (usersAvailablity == true) {
|
||||
console.log(usersAvailablity);
|
||||
navigate("/login/users");
|
||||
} else {
|
||||
navigate("/login/manual");
|
||||
};
|
||||
const checkServer = async () => {
|
||||
setServerCheckState(true);
|
||||
try {
|
||||
const result = await axios.get(`${serverIp}/System/Ping`);
|
||||
if (result.data == "Jellyfin Server") {
|
||||
event.emit("create-jellyfin-api", serverIp);
|
||||
let sysInfo = await getSystemApi(
|
||||
window.api,
|
||||
).getPublicSystemInfo();
|
||||
sysInfo = sysInfo.data;
|
||||
sysInfo.Ip = serverIp;
|
||||
setServer(sysInfo);
|
||||
const users = await getUserApi(window.api).getPublicUsers();
|
||||
if (users.data.length >= 1) {
|
||||
navigate("/login/users");
|
||||
} else {
|
||||
navigate("/login/manual");
|
||||
}
|
||||
} else {
|
||||
enqueueSnackbar(
|
||||
"The provided ip address doesn't seem point to a Jellyfin server.",
|
||||
{ variant: "error" },
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
enqueueSnackbar("Unable to verfiy server address.", {
|
||||
variant: "error",
|
||||
});
|
||||
}
|
||||
|
||||
setServerCheckState(false);
|
||||
return "";
|
||||
};
|
||||
|
||||
const handleAddServer = () => {
|
||||
setLoading(true);
|
||||
let data;
|
||||
fetch(`${serverIp}/System/Ping`, {
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
if (data == "Jellyfin Server") {
|
||||
addServer();
|
||||
setLoading(false);
|
||||
return true;
|
||||
} else {
|
||||
enqueueSnackbar(
|
||||
"The server address does not seem be a jellyfin server",
|
||||
{ variant: "error" },
|
||||
);
|
||||
setLoading(false);
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
setLoading(false);
|
||||
enqueueSnackbar(
|
||||
"Unable to verify whether the give address is a valid Jellyfin server",
|
||||
{ variant: "error" },
|
||||
);
|
||||
console.error(error);
|
||||
});
|
||||
// setLoading(true);
|
||||
// let data;
|
||||
// fetch(`${serverIp}/System/Ping`, {
|
||||
// body: JSON.stringify(data),
|
||||
// })
|
||||
// .then((res) => res.json())
|
||||
// .then((data) => {
|
||||
// if (data == "Jellyfin Server") {
|
||||
// addServer();
|
||||
// setLoading(false);
|
||||
// return true;
|
||||
// } else {
|
||||
// enqueueSnackbar(
|
||||
// "The server address does not seem be a jellyfin server",
|
||||
// { variant: "error" },
|
||||
// );
|
||||
// setLoading(false);
|
||||
// return false;
|
||||
// }
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// setLoading(false);
|
||||
// enqueueSnackbar(
|
||||
// "Unable to verify whether the give address is a valid Jellyfin server",
|
||||
// { variant: "error" },
|
||||
// );
|
||||
// console.error(error);
|
||||
// });
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Container
|
||||
maxWidth="sm"
|
||||
className={
|
||||
checkingServer
|
||||
? "centered serverContainer loading"
|
||||
: "centered serverContainer"
|
||||
}
|
||||
>
|
||||
<Container maxWidth="sm" className={"centered serverContainer"}>
|
||||
<Grid
|
||||
container
|
||||
spacing={2}
|
||||
@@ -216,22 +243,9 @@ export const ServerSetup = (props) => {
|
||||
variant="outlined"
|
||||
// inputRef={serverIp}
|
||||
onChange={(event) => {
|
||||
if (
|
||||
event.target.value.charAt(
|
||||
event.target.value.length - 1,
|
||||
) == "/"
|
||||
) {
|
||||
setServerIp(
|
||||
event.target.value.slice(
|
||||
0,
|
||||
-1,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
setServerIp(event.target.value);
|
||||
}
|
||||
setServerIp(event.target.value);
|
||||
}}
|
||||
helperText="Add your server adddress with https:// or http://"
|
||||
helperText="Add your server adddress with https:// or http://. Eg: https://demo.jellyfin.org"
|
||||
></TextField>
|
||||
</Grid>
|
||||
<Grid item xl={5} md={6} sx={{ width: "100%" }}>
|
||||
@@ -239,14 +253,14 @@ export const ServerSetup = (props) => {
|
||||
variant="contained"
|
||||
sx={{ width: "100%" }}
|
||||
size="large"
|
||||
loading={loading}
|
||||
loading={checkingServer}
|
||||
endIcon={
|
||||
<SvgIcon>
|
||||
<path d={mdiChevronRight}></path>
|
||||
</SvgIcon>
|
||||
}
|
||||
loadingPosition="end"
|
||||
onClick={handleAddServer}
|
||||
onClick={() => checkServer()}
|
||||
>
|
||||
Add Server
|
||||
</LoadingButton>
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
/** @format */
|
||||
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import sideBarReducer from "./utils/slice/sidemenu";
|
||||
export default configureStore({
|
||||
reducer: {
|
||||
sidebar: sideBarReducer,
|
||||
},
|
||||
});
|
||||
@@ -46,13 +46,9 @@ body {
|
||||
height: fit-content;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
overflow-y: visible;
|
||||
overflow-y: hidden;
|
||||
overflow-x: hidden;
|
||||
min-height: 100vh;
|
||||
// display: flex;
|
||||
// flex-direction: column;
|
||||
// justify-content: center;
|
||||
// align-items: center;
|
||||
}
|
||||
|
||||
.centered {
|
||||
|
||||
+18
-1
@@ -3,11 +3,28 @@
|
||||
* @param {number} ticks - C# ticks of a particular item
|
||||
* @return {number} Converted ticks to Milliseconds
|
||||
*/
|
||||
|
||||
const ticksToMs = (ticks) => {
|
||||
return Math.round(ticks / 10000);
|
||||
};
|
||||
|
||||
/**
|
||||
* @format
|
||||
* @param {number} ticks - C# ticks of a particular item
|
||||
* @return {number} Converted ticks to Seconds
|
||||
*/
|
||||
export const ticksToSec = (ticks) => {
|
||||
return Math.round(ticksToMs(ticks) / 1000);
|
||||
};
|
||||
|
||||
/**
|
||||
* @format
|
||||
* @param {number} sec - Sec of a particular item
|
||||
* @return {number} Converted Seconds to C# ticks
|
||||
*/
|
||||
export const secToTicks = (ticks) => {
|
||||
return Math.round(ticks * 10000000);
|
||||
};
|
||||
|
||||
/**
|
||||
* @format
|
||||
* @param {number} ticks - C# ticks of a particular item
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/** @format */
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
const useKeyPress = (targetKey) => {
|
||||
// State for keeping track of whether key is pressed
|
||||
const [keyPressed, setKeyPressed] = useState(false);
|
||||
// If pressed key is our target key then set to true
|
||||
function downHandler({ key }) {
|
||||
if (key === targetKey) {
|
||||
setKeyPressed(true);
|
||||
}
|
||||
}
|
||||
// If released key is our target key then set to false
|
||||
const upHandler = ({ key }) => {
|
||||
if (key === targetKey) {
|
||||
setKeyPressed(false);
|
||||
}
|
||||
};
|
||||
// Add event listeners
|
||||
useEffect(() => {
|
||||
window.addEventListener("keydown", downHandler);
|
||||
window.addEventListener("keyup", upHandler);
|
||||
// Remove event listeners on cleanup
|
||||
return () => {
|
||||
window.removeEventListener("keydown", downHandler);
|
||||
window.removeEventListener("keyup", upHandler);
|
||||
};
|
||||
}, []); // Empty array ensures that effect is only run on mount and unmount
|
||||
return keyPressed;
|
||||
};
|
||||
|
||||
export default useKeyPress;
|
||||
@@ -1,24 +0,0 @@
|
||||
/** @format */
|
||||
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
export const sideBarSlice = createSlice({
|
||||
name: "sidebar",
|
||||
initialState: {
|
||||
visible: false,
|
||||
backdrop: true,
|
||||
},
|
||||
reducers: {
|
||||
showSidemenu: (state) => {
|
||||
state.visible = true;
|
||||
},
|
||||
hideSidemenu: (state) => {
|
||||
state.visible = false;
|
||||
},
|
||||
setBackdrop: (state, action) => {
|
||||
state.backdrop = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { showSidemenu, hideSidemenu, setBackdrop } = sideBarSlice.actions;
|
||||
export default sideBarSlice.reducer;
|
||||
@@ -0,0 +1,8 @@
|
||||
/** @format */
|
||||
|
||||
import { create } from "zustand";
|
||||
|
||||
export const useDrawerStore = create((set) => ({
|
||||
open: false,
|
||||
setOpen: (sopen) => set((state) => ({ ...state, open: sopen })),
|
||||
}));
|
||||
@@ -0,0 +1,25 @@
|
||||
/** @format */
|
||||
|
||||
import { create } from "zustand";
|
||||
|
||||
export const usePlaybackStore = create((set) => ({
|
||||
url: "",
|
||||
startPosition: 0,
|
||||
duration: 0,
|
||||
itemId: "",
|
||||
itemName: "",
|
||||
subtitleTracks: [],
|
||||
selectedSubtitleTrack: 0,
|
||||
setUrl: (aurl) => set((state) => ({ ...state, url: aurl })),
|
||||
setPosition: (apos) => set((state) => ({ ...state, startPosition: apos })),
|
||||
setDuration: (adur) => set((state) => ({ ...state, duration: adur })),
|
||||
setItemId: (aid) => set((state) => ({ ...state, itemId: aid })),
|
||||
setItemName: (anm) => set((state) => ({ ...state, itemName: anm })),
|
||||
setSubtitleTracks: (asub) =>
|
||||
set((state) => ({
|
||||
...state,
|
||||
subtitleTracks: asub,
|
||||
})),
|
||||
setSelectedSubtitleTrack: (asub) =>
|
||||
set((state) => ({ ...state, selectedSubtitleTrack: asub })),
|
||||
}));
|
||||
Reference in new issue
Block a user