Compare commits
35
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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
+857
-691
File diff suppressed because it is too large.
Load diff
+12
-14
@@ -15,39 +15,37 @@
|
||||
"@fontsource/open-sans": "^4.5.13",
|
||||
"@jellyfin/sdk": "^0.8.2",
|
||||
"@mdi/js": "^7.2.96",
|
||||
"@mui/lab": "^5.0.0-alpha.127",
|
||||
"@mui/lab": "^5.0.0-alpha.128",
|
||||
"@mui/material": "^5.11.16",
|
||||
"@reduxjs/toolkit": "^1.9.3",
|
||||
"@tanstack/react-query": "^4.26.1",
|
||||
"@tanstack/react-query-devtools": "^4.29.3",
|
||||
"@tauri-apps/api": "^1.2.0",
|
||||
"@videojs/http-streaming": "^3.0.2",
|
||||
"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",
|
||||
"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.11.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",
|
||||
"@types/react": "^18.2.0",
|
||||
"@types/react-dom": "^18.2.1",
|
||||
"@vitejs/plugin-react": "^4.0.0",
|
||||
"sass": "^1.61.0",
|
||||
"sass": "^1.62.1",
|
||||
"video.js": "^8.3.0",
|
||||
"vite": "^4.3.1"
|
||||
},
|
||||
"license": "GPL-3.0-only"
|
||||
|
||||
@@ -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 = ["api-all", "devtools"] }
|
||||
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": {
|
||||
|
||||
+49
-44
@@ -7,7 +7,7 @@ import Konami from "react-konami-code";
|
||||
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 +23,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 +46,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 +59,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 { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api.js";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { useDispatch } from "react-redux";
|
||||
import { showSidemenu } from "./utils/slice/sidemenu.js";
|
||||
import FavouritePage from "./routes/favourite/index.jsx";
|
||||
const jellyfin = new Jellyfin({
|
||||
clientInfo: {
|
||||
name: "JellyPlayer",
|
||||
@@ -90,12 +95,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 +128,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 +165,24 @@ 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",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const userLogin = async () => {
|
||||
@@ -193,8 +193,6 @@ function App() {
|
||||
);
|
||||
sessionStorage.setItem("accessToken", auth.data.AccessToken);
|
||||
event.emit("set-api-accessToken", window.api.basePath);
|
||||
|
||||
// navigate("/home");
|
||||
};
|
||||
|
||||
const LogicalRoutes = () => {
|
||||
@@ -227,7 +225,6 @@ function App() {
|
||||
});
|
||||
} else {
|
||||
navigate("/setup/server");
|
||||
setChecking(false);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -242,7 +239,10 @@ function App() {
|
||||
});
|
||||
};
|
||||
|
||||
const handleRelaunch = async () => {
|
||||
const handleRelaunch = async (event, reason) => {
|
||||
if (reason && reason == "backdropClick") {
|
||||
return;
|
||||
}
|
||||
let result = await relaunch();
|
||||
};
|
||||
|
||||
@@ -274,7 +274,7 @@ function App() {
|
||||
return (
|
||||
<SnackbarProvider maxSnack={5}>
|
||||
<ThemeProvider theme={theme}>
|
||||
{checkingServer && (
|
||||
{pingServer.isLoading && (
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
@@ -340,7 +340,11 @@ function App() {
|
||||
location={location}
|
||||
>
|
||||
<Route element={<AnimationWrapper />}>
|
||||
{/* Main Routes */}
|
||||
<Route
|
||||
path="/"
|
||||
element={<LogicalRoutes />}
|
||||
/>
|
||||
|
||||
<Route
|
||||
path="/home"
|
||||
element={<Home />}
|
||||
@@ -366,10 +370,12 @@ function App() {
|
||||
element={<UserLoginManual />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/library/:id"
|
||||
element={<LibraryView />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/item/:id"
|
||||
element={<ItemDetail />}
|
||||
/>
|
||||
@@ -385,13 +391,11 @@ function App() {
|
||||
path="/about"
|
||||
element={<About />}
|
||||
/>
|
||||
|
||||
{/* Logical Routes */}
|
||||
|
||||
<Route
|
||||
path="/"
|
||||
element={<LogicalRoutes />}
|
||||
path="/player"
|
||||
element={<VideoPlayer />}
|
||||
/>
|
||||
|
||||
<Route
|
||||
path="/login"
|
||||
element={<LoginLogicalRoutes />}
|
||||
@@ -400,6 +404,7 @@ function App() {
|
||||
</Routes>
|
||||
</div>
|
||||
</AnimatePresence>
|
||||
<ReactQueryDevtools />
|
||||
</ThemeProvider>
|
||||
</SnackbarProvider>
|
||||
);
|
||||
|
||||
@@ -15,11 +15,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";
|
||||
@@ -29,11 +28,10 @@ import { MdiCog } from "../icons/mdiCog";
|
||||
import { MdiInformation } from "../icons/mdiInformation";
|
||||
|
||||
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();
|
||||
|
||||
@@ -64,7 +62,9 @@ export const AppBar = () => {
|
||||
useEffect(() => {
|
||||
if (
|
||||
location.pathname.includes("login") ||
|
||||
location.pathname.includes("setup")
|
||||
location.pathname.includes("setup") ||
|
||||
location.pathname.includes("player") ||
|
||||
location.pathname === "/"
|
||||
) {
|
||||
setDisplay(false);
|
||||
} else {
|
||||
@@ -88,7 +88,6 @@ export const AppBar = () => {
|
||||
<MuiAppBar
|
||||
sx={{
|
||||
width: `calc(100vw - ${theme.spacing(7)})`,
|
||||
// mr: "10px",
|
||||
backgroundColor: "transparent",
|
||||
}}
|
||||
className={trigger ? "appBar backdropVisible" : "appBar"}
|
||||
|
||||
@@ -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: {
|
||||
@@ -50,7 +50,7 @@ export const CardScroller = ({
|
||||
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={
|
||||
|
||||
@@ -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 { mdiFastForward } from "@mdi/js";
|
||||
|
||||
export const MdiFastForward = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiFastForward}></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 { 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,11 @@
|
||||
/** @format */
|
||||
|
||||
.album {
|
||||
&-image-icon {
|
||||
fill: url(#clr-gradient-default) !important;
|
||||
|
||||
&-container {
|
||||
background: $clr-gradient-dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
/** @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 { MdiClockOutline } from "../../icons/mdiClockOutline";
|
||||
import { getRuntimeMusic } from "../../../utils/date/time";
|
||||
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.data.Id,
|
||||
itemId: track.Id,
|
||||
});
|
||||
} else if (!track.UserData.IsFavorite) {
|
||||
result = await getUserLibraryApi(window.api).markFavoriteItem({
|
||||
userId: user.data.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>
|
||||
);
|
||||
};
|
||||
@@ -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,8 +15,6 @@ 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";
|
||||
@@ -28,11 +26,10 @@ 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";
|
||||
|
||||
const drawerWidth = 320;
|
||||
@@ -42,7 +39,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 +50,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 +57,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 +64,7 @@ export const SideMenu = ({}) => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
enabled: !!window.api,
|
||||
enabled: display,
|
||||
networkMode: "always",
|
||||
});
|
||||
let libraries = useQuery({
|
||||
@@ -85,7 +79,6 @@ export const SideMenu = ({}) => {
|
||||
networkMode: "always",
|
||||
});
|
||||
const handleDrawerOpen = () => {};
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const handleLogout = async () => {
|
||||
console.log("Logging out user...");
|
||||
@@ -96,14 +89,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 {
|
||||
@@ -131,9 +122,7 @@ export const SideMenu = ({}) => {
|
||||
}}
|
||||
sx={{
|
||||
width: `calc(${theme.spacing(7)} + 10px)`,
|
||||
background: backdrop
|
||||
? theme.palette.background.paper
|
||||
: "transparent",
|
||||
background: theme.palette.background.paper,
|
||||
}}
|
||||
>
|
||||
<DrawerHeader
|
||||
@@ -248,7 +237,7 @@ export const SideMenu = ({}) => {
|
||||
"center",
|
||||
}}
|
||||
>
|
||||
<MdiHomeVariantOutline></MdiHomeVariantOutline>
|
||||
<MdiHomeVariantOutline />
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
@@ -287,8 +276,3 @@ export const SideMenu = ({}) => {
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
// SideMenu.propTypes = {
|
||||
// skeleton: PropTypes.bool.isRequired,
|
||||
// data: PropTypes.array.isRequired,
|
||||
// };
|
||||
@@ -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 />,
|
||||
@@ -97,6 +98,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: 10em;
|
||||
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;
|
||||
|
||||
+105
-59
@@ -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,7 +95,7 @@ const Home = () => {
|
||||
const media = await getUserLibraryApi(window.api).getLatestMedia(
|
||||
{
|
||||
userId: user.data.Id,
|
||||
fields: "Overview",
|
||||
fields: [ItemFields.Overview, ItemFields.ParentId],
|
||||
enableUserData: true,
|
||||
},
|
||||
);
|
||||
@@ -251,29 +253,72 @@ const Home = () => {
|
||||
key={index}
|
||||
>
|
||||
<div className="hero-carousel-background-container">
|
||||
{item.ImageBlurHashes
|
||||
.Backdrop ? (
|
||||
<>
|
||||
<Blurhash
|
||||
hash={
|
||||
item
|
||||
.ImageBlurHashes
|
||||
.Backdrop[
|
||||
{item.Type ==
|
||||
BaseItemKind.MusicAlbum ||
|
||||
item.Type ==
|
||||
BaseItemKind.Episode ? (
|
||||
item
|
||||
.ParentBackdropImageTags
|
||||
.length != 0 && (
|
||||
<>
|
||||
<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={{
|
||||
@@ -325,15 +370,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 +399,6 @@ const Home = () => {
|
||||
? item.ProductionYear
|
||||
: "Unknown"}
|
||||
</Typography>
|
||||
<Divider
|
||||
variant="middle"
|
||||
component="div"
|
||||
orientation="vertical"
|
||||
flexItem
|
||||
/>
|
||||
<Chip
|
||||
variant="outlined"
|
||||
label={
|
||||
@@ -358,12 +407,6 @@ const Home = () => {
|
||||
: "Not Rated"
|
||||
}
|
||||
/>
|
||||
<Divider
|
||||
variant="middle"
|
||||
component="div"
|
||||
orientation="vertical"
|
||||
flexItem
|
||||
/>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
@@ -375,7 +418,7 @@ const Home = () => {
|
||||
>
|
||||
{!!item.CommunityRating ? (
|
||||
<>
|
||||
<MdiStarHalfFull
|
||||
<MdiStar
|
||||
sx={{
|
||||
color: yellow[700],
|
||||
}}
|
||||
@@ -396,18 +439,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"
|
||||
|
||||
+1257
-295
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;
|
||||
|
||||
@@ -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,180 @@
|
||||
/** @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 ReactPlayer from "react-player";
|
||||
|
||||
import { usePlaybackStore } from "../../utils/store/playback";
|
||||
import { MdiArrowLeft } from "../../components/icons/mdiArrowLeft";
|
||||
import { MdiPlay } from "../../components/icons/mdiPlay";
|
||||
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useRef, useState, useCallback } 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";
|
||||
|
||||
export const VideoPlayer = () => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const playerRef = useRef();
|
||||
const [isPlaying, setIsPlaying] = useState(true);
|
||||
const [isMuted, setIsMuted] = useState(false);
|
||||
const [isReady, setIsReady] = useState(false);
|
||||
|
||||
const [duration, setDuration] = useState(0);
|
||||
const [progress, setProgress] = useState(0);
|
||||
const [currentTime, setCurrentTime] = useState(0);
|
||||
|
||||
const onReady = useCallback(() => {
|
||||
if (!isReady) {
|
||||
const timeToStart = ticksToSec(startPosition);
|
||||
playerRef.current.seekTo(timeToStart, "seconds");
|
||||
setDuration(playerRef.current.getDuration());
|
||||
setIsReady(true);
|
||||
}
|
||||
}, [isReady]);
|
||||
|
||||
const startTime = new Date(0);
|
||||
|
||||
const onProgress = async (e) => {
|
||||
await getPlaystateApi(window.api).reportPlaybackProgress({
|
||||
playbackProgressInfo: {
|
||||
ItemId: itemId,
|
||||
IsMuted: isMuted,
|
||||
PositionTicks: secToTicks(e.playedSeconds),
|
||||
PlaybackStartTimeTicks: startPosition,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const handleSeeking = useCallback((time, offset) => {
|
||||
playerRef.current.seekTo(time / 100);
|
||||
setCurrentTime(time / 100);
|
||||
}, []);
|
||||
|
||||
const [url, startPosition, itemId, itemName] = usePlaybackStore(
|
||||
(state) => [
|
||||
state.url,
|
||||
state.startPosition,
|
||||
state.itemId,
|
||||
state.itemName,
|
||||
],
|
||||
);
|
||||
|
||||
let timer;
|
||||
return (
|
||||
<Box
|
||||
className="video"
|
||||
sx={{ background: "black" }}
|
||||
onMouseMove={(e) => {
|
||||
let a = "he";
|
||||
clearTimeout(timer);
|
||||
e.currentTarget.classList.add("video-osd-visible");
|
||||
timer = setTimeout(() => {
|
||||
document
|
||||
.querySelector(".video")
|
||||
.classList.remove("video-osd-visible");
|
||||
}, 2000);
|
||||
}}
|
||||
>
|
||||
<Stack
|
||||
className="video-osd"
|
||||
sx={{
|
||||
position: "fixed",
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
}}
|
||||
alignItems="center"
|
||||
justifyContent="space-between"
|
||||
direction="column"
|
||||
zIndex="10000000"
|
||||
>
|
||||
<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%">
|
||||
<Stack width="100%">
|
||||
<Slider
|
||||
value={currentTime}
|
||||
step={0.01}
|
||||
max={100}
|
||||
onChange={(e, newVal) => {
|
||||
playerRef.current.seekTo(
|
||||
(newVal / 100) *
|
||||
playerRef.current.getDuration(),
|
||||
);
|
||||
setCurrentTime(newVal);
|
||||
}}
|
||||
/>
|
||||
</Stack>
|
||||
<Stack direction="row">
|
||||
<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>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Stack>
|
||||
<ReactPlayer
|
||||
ref={playerRef}
|
||||
width="100vw"
|
||||
height="100vh"
|
||||
playing={isPlaying}
|
||||
url={url}
|
||||
onProgress={onProgress}
|
||||
onReady={onReady}
|
||||
muted={isMuted}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
/** @format */
|
||||
|
||||
.video {
|
||||
&-osd {
|
||||
opacity: 0;
|
||||
transition: opacity 0.1s linear;
|
||||
}
|
||||
&-osd-visible &-osd {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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,14 @@
|
||||
/** @format */
|
||||
|
||||
import { create } from "zustand";
|
||||
|
||||
export const usePlaybackStore = create((set) => ({
|
||||
url: "",
|
||||
startPosition: 0,
|
||||
itemId: "",
|
||||
itemName: "",
|
||||
setUrl: (aurl) => set((state) => ({ ...state, url: aurl })),
|
||||
setPosition: (apos) => set((state) => ({ ...state, startPosition: apos })),
|
||||
setItemId: (aid) => set((state) => ({ ...state, itemId: aid })),
|
||||
setItemName: (anm) => set((state) => ({ ...state, itemName: anm })),
|
||||
}));
|
||||
Reference in new issue
Block a user