Compare commits
73
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd8c6431d5 | ||
|
|
b8dc3828e8 | ||
|
|
909aead056 | ||
|
|
88474b494b | ||
|
|
3833f4d626 | ||
|
|
ef55f13d7b | ||
|
|
3db18e22a4 | ||
|
|
1e93fb1c29 | ||
|
|
18df836cf4 | ||
|
|
2bbe846184 | ||
|
|
50f8e1c0f1 | ||
|
|
fdbe279071 | ||
|
|
90094d9103 | ||
|
|
51647cdd0d | ||
|
|
628f90ef57 | ||
|
|
7cba5a39f6 | ||
|
|
ee524b57c7 | ||
|
|
9aea2e4750 | ||
|
|
c49f8d8c76 | ||
|
|
1158c38575 | ||
|
|
f08a3e8337 | ||
|
|
64cc9fa7ff | ||
|
|
fd2d8a1efd | ||
|
|
0febb68047 | ||
|
|
e51c2261c2 | ||
|
|
537cf61df5 | ||
|
|
62f7a6cd48 | ||
|
|
ee48de0f30 | ||
|
|
272f74473a | ||
|
|
b02b3a95d2 | ||
|
|
d6c7c29b46 | ||
|
|
f12d92f42c | ||
|
|
aebea6a3b2 | ||
|
|
7c19efa448 | ||
|
|
cb0fb0eef8 | ||
|
|
e21a12e36f | ||
|
|
dbc2243dd4 | ||
|
|
4372ecbb4e | ||
|
|
69d0b4558f | ||
|
|
fc685414be | ||
|
|
68a97196d2 | ||
|
|
1c55dd77ef | ||
|
|
112b2babc1 | ||
|
|
3d40912b6f | ||
|
|
8d00739199 | ||
|
|
b66130950b | ||
|
|
5212e2c497 | ||
|
|
221cd4722a | ||
|
|
c851201872 | ||
|
|
12d771c6c7 | ||
|
|
275a05a0a3 | ||
|
|
65205e5c4e | ||
|
|
1a59605e17 | ||
|
|
3782c79464 | ||
|
|
cceb97d0d6 | ||
|
|
2df503c48a | ||
|
|
03323d954e | ||
|
|
6cb5130b08 | ||
|
|
b1ab16220c | ||
|
|
8ca01ccc2b | ||
|
|
81afd14b55 | ||
|
|
95f5cdd481 | ||
|
|
e33b8ff266 | ||
|
|
42af75b79d | ||
|
|
4e71297f02 | ||
|
|
eca1bcb995 | ||
|
|
4f7d58fe1d | ||
|
|
23e892f45b | ||
|
|
664293d82b | ||
|
|
1e9438227c | ||
|
|
4604b4f103 | ||
|
|
e62e9384d8 | ||
|
|
301dc3dcc1 |
No files matched your search
@@ -0,0 +1,38 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
@@ -0,0 +1,19 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "npm" # See documentation for possible values
|
||||
directory: "/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
commit-message:
|
||||
prefix: "chore(package-update) NPM"
|
||||
- package-ecosystem: "cargo"
|
||||
directory: "/src-tauri"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
commit-message:
|
||||
prefix: "chore(package-update) CARGO"
|
||||
@@ -1,17 +1,17 @@
|
||||

|
||||
|
||||
# :memo: Prerequisites:
|
||||
# 📝 Prerequisites:
|
||||
- Nodejs (≥19.1.0)
|
||||
- Rust (≥1.66.1)
|
||||
|
||||
# :warning: Getting started:
|
||||
# ℹ️ Getting started:
|
||||
- Install Nodejs and Rust.
|
||||
- install depencies using npm:
|
||||
```shell
|
||||
npm install
|
||||
```
|
||||
|
||||
# :information_source: Development:
|
||||
# 🛠️ Development:
|
||||
- Running the app:
|
||||
```shell
|
||||
npm run tauri dev
|
||||
@@ -22,5 +22,16 @@
|
||||
```
|
||||
- other commands can be found inside the `"scripts"` inside [package.json](https://github.com/prayag17/JellyPlayer/blob/main/package.json)
|
||||
|
||||
# :sos: Help Wanted:
|
||||
- Home sections containing latest media.
|
||||
# 💻 Contribution:
|
||||
- Checkout `issues` to see currently worked on features and bugs
|
||||
- Add features or fix bugs
|
||||
- Create a pull request
|
||||
|
||||
# 📃 Roadmap:
|
||||
- Checkout [GitHub Project](https://github.com/users/prayag17/projects/3)
|
||||
> **Note** : There is no current due date for alpha 1 release
|
||||
|
||||
# 🎊 Special thanks to:
|
||||
- [@ferferga](https://github.com/ferferga) for helping in development behind the scenes.
|
||||
- All contributors of [jellyfin/jellyfin-vue](https://github.com/jellyfin/jellyfin-vue).
|
||||
- And also [@jellyfin](https://github.com/jellyfin/) for creating the main service
|
||||
+7
-1
@@ -10,7 +10,13 @@
|
||||
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<svg style="width:0;height:0;position:absolute;" aria-hidden="true" focusable="false">
|
||||
<linearGradient id="clr-gradient-default" x2="1" y2="1">
|
||||
<stop offset="0%" stop-color="hsl(337, 96%, 56%)" />
|
||||
<stop offset="100%" stop-color="hsl(273, 100%, 36%)" />
|
||||
</linearGradient>
|
||||
</svg>
|
||||
<script type="module" src="/src/main.jsx"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
Generated
+1137
-957
File diff suppressed because it is too large.
Load diff
+19
-12
@@ -14,21 +14,28 @@
|
||||
"@emotion/styled": "^11.10.5",
|
||||
"@fontsource/open-sans": "^4.5.13",
|
||||
"@jellyfin/sdk": "^0.7.0",
|
||||
"@mdi/js": "^7.1.96",
|
||||
"@mui/lab": "^5.0.0-alpha.110",
|
||||
"@mui/material": "^5.10.15",
|
||||
"@mdi/js": "^7.2.96",
|
||||
"@mui/lab": "^5.0.0-alpha.124",
|
||||
"@mui/material": "^5.11.15",
|
||||
"@reduxjs/toolkit": "^1.9.3",
|
||||
"@tanstack/react-query": "^4.26.1",
|
||||
"@tanstack/react-query-devtools": "^4.28.0",
|
||||
"blurhash": "^2.0.5",
|
||||
"events": "^3.3.0",
|
||||
"framer-motion": "^7.10.2",
|
||||
"framer-motion": "^10.10.0",
|
||||
"localforage": "^1.10.0",
|
||||
"match-sorter": "^6.3.1",
|
||||
"mdi-material-ui": "^7.6.0",
|
||||
"notistack": "^2.0.8",
|
||||
"notistack": "^3.0.1",
|
||||
"react": "^18.2.0",
|
||||
"react-blurhash": "^0.3.0",
|
||||
"react-cookie": "^4.1.1",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-material-ui-carousel": "^3.4.2",
|
||||
"react-multi-carousel": "^2.8.2",
|
||||
"react-router-dom": "^6.4.3",
|
||||
"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",
|
||||
"tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store",
|
||||
"uuid": "^9.0.0",
|
||||
@@ -36,11 +43,11 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^1.2.2",
|
||||
"@types/react": "^18.0.24",
|
||||
"@types/react": "^18.0.32",
|
||||
"@types/react-dom": "^18.0.8",
|
||||
"@vitejs/plugin-react": "^2.2.0",
|
||||
"sass": "^1.56.1",
|
||||
"vite": "^3.2.3"
|
||||
"@vitejs/plugin-react": "^3.1.0",
|
||||
"sass": "^1.60.0",
|
||||
"vite": "^4.2.1"
|
||||
},
|
||||
"license": "GPL-3.0-only"
|
||||
}
|
||||
@@ -17,7 +17,7 @@ tauri-build = { version = "1.2.1", features = [] }
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = { version = "1.2.2", features = [] }
|
||||
tauri = { version = "1.2.2", features = ["process-exit", "process-relaunch"] }
|
||||
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||
|
||||
[features]
|
||||
|
||||
@@ -8,11 +8,17 @@
|
||||
},
|
||||
"package": {
|
||||
"productName": "JellyPlayer",
|
||||
"version": "../package.json"
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"tauri": {
|
||||
"allowlist": {
|
||||
"all": false
|
||||
"all": false,
|
||||
"process": {
|
||||
"all": false,
|
||||
"exit": true,
|
||||
"relaunch": true,
|
||||
"relaunchDangerousAllowSymlinkMacos": false
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
|
||||
+106
-53
@@ -1,13 +1,11 @@
|
||||
/** @format */
|
||||
|
||||
import { useState, useMemo } from "react";
|
||||
import React, { useState } from "react";
|
||||
import { ThemeProvider } from "@mui/material/styles";
|
||||
import { SnackbarProvider } from "notistack";
|
||||
import { useCookies, Cookies } from "react-cookie";
|
||||
import {
|
||||
Routes,
|
||||
Route,
|
||||
Navigate,
|
||||
useNavigate,
|
||||
useLocation,
|
||||
Outlet,
|
||||
@@ -20,6 +18,9 @@ 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";
|
||||
|
||||
// Theming
|
||||
import CssBaseline from "@mui/material/CssBaseline";
|
||||
import { theme } from "./theme";
|
||||
@@ -37,12 +38,18 @@ import CircularProgress from "@mui/material/CircularProgress";
|
||||
|
||||
// Routes
|
||||
import { ServerSetup, ServerList } from "./routes/setup/server/root";
|
||||
import { Home } from "./routes/home/root";
|
||||
import Home from "./routes/home/root";
|
||||
import {
|
||||
UserLogin,
|
||||
LoginWithImage,
|
||||
UserLoginManual,
|
||||
} from "./routes/login/root";
|
||||
import LibraryView from "./routes/library/root.jsx";
|
||||
import ItemMovie from "./routes/item/Movie/root.jsx";
|
||||
import ItemSeries from "./routes/item/Series/root.jsx";
|
||||
|
||||
import { SideMenu } from "./components/menu/sidemenu.jsx";
|
||||
import { AppBar } from "./components/appBar/appBar.jsx";
|
||||
|
||||
// Fonts
|
||||
import "@fontsource/open-sans";
|
||||
@@ -51,9 +58,11 @@ import "@fontsource/open-sans";
|
||||
import { Jellyfin } from "@jellyfin/sdk";
|
||||
import { version as appVer } from "../package.json";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { delServer, getServer } from "./utils/store/servers.js";
|
||||
import { getUser } from "./utils/store/user.js";
|
||||
import { delServer, getServer } from "./utils/storage/servers.js";
|
||||
import { getUser } from "./utils/storage/user.js";
|
||||
|
||||
import { useDispatch } from "react-redux";
|
||||
import { showSidemenu } from "./utils/slice/sidemenu.js";
|
||||
const jellyfin = new Jellyfin({
|
||||
clientInfo: {
|
||||
name: "JellyPlayer",
|
||||
@@ -113,12 +122,19 @@ const AnimationWrapper = () => {
|
||||
};
|
||||
|
||||
function App() {
|
||||
const [userCookies] = useCookies(["user"]);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const [serverReachable, setServerReachable] = useState(true);
|
||||
const [checkingServer, setChecking] = useState(false);
|
||||
|
||||
const createApi = async () => {
|
||||
const server = await getServer();
|
||||
event.emit("create-jellyfin-api", server.Ip);
|
||||
dispatch(showSidemenu());
|
||||
};
|
||||
|
||||
const serverAvailable = async () => {
|
||||
const server = await getServer();
|
||||
|
||||
@@ -126,10 +142,10 @@ function App() {
|
||||
console.log("server not found");
|
||||
return false;
|
||||
} else {
|
||||
if (!window.api) {
|
||||
console.log("Creating Jf api (without accessToken)");
|
||||
event.emit("create-jellyfin-api", server.Ip);
|
||||
}
|
||||
// if (!window.api) {
|
||||
// console.log("Creating Jf api (without accessToken)");
|
||||
// event.emit("create-jellyfin-api", server.Ip);
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -189,7 +205,7 @@ function App() {
|
||||
sessionStorage.setItem("accessToken", auth.data.AccessToken);
|
||||
event.emit("set-api-accessToken", window.api.basePath);
|
||||
|
||||
navigate("/home");
|
||||
// navigate("/home");
|
||||
};
|
||||
|
||||
const LogicalRoutes = () => {
|
||||
@@ -199,7 +215,7 @@ function App() {
|
||||
if (serverReachable == true) {
|
||||
userSaved().then((user_available) => {
|
||||
if (user_available == true) {
|
||||
userLogin();
|
||||
navigate("/home");
|
||||
} else {
|
||||
usersAvailable().then(
|
||||
(users_list_available) => {
|
||||
@@ -231,14 +247,28 @@ function App() {
|
||||
};
|
||||
|
||||
const handleRelaunch = async () => {
|
||||
await relaunch();
|
||||
let result = await relaunch();
|
||||
console.log(result);
|
||||
};
|
||||
|
||||
const handleRemoveServer = async () => {
|
||||
await delServer();
|
||||
let result = await relaunch();
|
||||
console.log(result);
|
||||
};
|
||||
const location = useLocation();
|
||||
|
||||
if (!window.api) {
|
||||
console.log("WindowAPi not present");
|
||||
createApi().then(
|
||||
userSaved().then((userSavedBool) => {
|
||||
if (userSavedBool) {
|
||||
userLogin();
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<SnackbarProvider maxSnack={5}>
|
||||
<ThemeProvider theme={theme}>
|
||||
@@ -284,48 +314,71 @@ function App() {
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
<AnimatePresence>
|
||||
<CssBaseline />
|
||||
<Routes key={location.pathname} location={location}>
|
||||
<Route element={<AnimationWrapper />}>
|
||||
{/* Main Routes */}
|
||||
<Route path="/home" element={<Home />} />
|
||||
<Route
|
||||
path="/setup/server"
|
||||
element={<ServerSetup />}
|
||||
/>
|
||||
<Route
|
||||
path="/servers/list"
|
||||
element={<ServerList />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/login/withImg/:userName/:userId/"
|
||||
element={<LoginWithImage />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/login/users"
|
||||
element={<UserLogin />}
|
||||
/>
|
||||
<Route
|
||||
path="/login/manual"
|
||||
element={<UserLoginManual />}
|
||||
/>
|
||||
<div style={{ display: "flex" }}>
|
||||
<CssBaseline />
|
||||
<SideMenu />
|
||||
<AppBar />
|
||||
<Routes
|
||||
key={location.pathname}
|
||||
location={location}
|
||||
>
|
||||
<Route element={<AnimationWrapper />}>
|
||||
{/* Main Routes */}
|
||||
<Route
|
||||
path="/home"
|
||||
element={<Home />}
|
||||
/>
|
||||
<Route
|
||||
path="/setup/server"
|
||||
element={<ServerSetup />}
|
||||
/>
|
||||
<Route
|
||||
path="/servers/list"
|
||||
element={<ServerList />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/login/withImg/:userName/:userId/"
|
||||
element={<LoginWithImage />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/login/users"
|
||||
element={<UserLogin />}
|
||||
/>
|
||||
<Route
|
||||
path="/login/manual"
|
||||
element={<UserLoginManual />}
|
||||
/>
|
||||
<Route
|
||||
path="/library/:id"
|
||||
element={<LibraryView />}
|
||||
/>
|
||||
<Route
|
||||
path="/item/Movie/:id"
|
||||
element={<ItemMovie />}
|
||||
/>
|
||||
<Route
|
||||
path="/item/Series/:id"
|
||||
element={<ItemSeries />}
|
||||
/>
|
||||
|
||||
{/* Logical Routes */}
|
||||
{/* Logical Routes */}
|
||||
|
||||
<Route
|
||||
path="/"
|
||||
element={<LogicalRoutes />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/login"
|
||||
element={<LoginLogicalRoutes />}
|
||||
/>
|
||||
</Route>
|
||||
</Routes>
|
||||
<Route
|
||||
path="/"
|
||||
element={<LogicalRoutes />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/login"
|
||||
element={<LoginLogicalRoutes />}
|
||||
/>
|
||||
</Route>
|
||||
</Routes>
|
||||
</div>
|
||||
</AnimatePresence>
|
||||
<ReactQueryDevtools />
|
||||
</ThemeProvider>
|
||||
</SnackbarProvider>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
/** @format */
|
||||
import { useEffect } from "react";
|
||||
|
||||
import MuiAppBar from "@mui/material/AppBar";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Toolbar from "@mui/material/Toolbar";
|
||||
import Avatar from "@mui/material/Avatar";
|
||||
import Box from "@mui/material/Box";
|
||||
import Zoom from "@mui/material/Zoom";
|
||||
|
||||
import { MdiMagnify } from "../icons/mdiMagnify";
|
||||
import { theme } from "../../theme";
|
||||
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
import { hideBackButton } from "../../utils/slice/appBar";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { useQueryClient, useQuery } from "@tanstack/react-query";
|
||||
|
||||
import "./appBar.module.scss";
|
||||
import { MdiAccount } from "../icons/mdiAccount";
|
||||
import { MdiHeartOutline } from "../icons/mdiHeartOutline";
|
||||
import { MdiArrowLeft } from "../icons/mdiArrowLeft";
|
||||
|
||||
export const AppBar = () => {
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const visible = useSelector((state) => state.appBar.visible);
|
||||
const backButtonVisible = useSelector(
|
||||
(state) => state.appBar.backButtonVisible,
|
||||
);
|
||||
const backdropVisible = useSelector((state) => state.appBar.backdrop);
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (location.pathname == "/home") {
|
||||
dispatch(hideBackButton());
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
visible && (
|
||||
<MuiAppBar
|
||||
sx={{
|
||||
width: `calc(100vw - ${theme.spacing(7)} - 10px)`,
|
||||
// mr: "10px",
|
||||
background: "transparent",
|
||||
}}
|
||||
className={
|
||||
backdropVisible ? "appBar backdropVisible" : "appBar"
|
||||
}
|
||||
elevation={backdropVisible ? 6 : 0}
|
||||
>
|
||||
<Toolbar sx={{ justifyContent: "space-between" }}>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
gap: 1,
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<IconButton
|
||||
onClick={() => navigate(-1)}
|
||||
sx={{
|
||||
transition: "transform 0.2s",
|
||||
transform: backButtonVisible
|
||||
? "scale(1)"
|
||||
: "scale(0)",
|
||||
transformOrigin: "left",
|
||||
}}
|
||||
>
|
||||
<MdiArrowLeft />
|
||||
</IconButton>
|
||||
|
||||
<TextField
|
||||
variant="outlined"
|
||||
placeholder="Search..."
|
||||
size="small"
|
||||
/>
|
||||
<IconButton>
|
||||
<MdiMagnify />
|
||||
</IconButton>
|
||||
</Box>
|
||||
<Box sx={{ display: "flex", gap: 2 }}>
|
||||
<IconButton>
|
||||
<MdiHeartOutline />
|
||||
</IconButton>
|
||||
<IconButton sx={{ p: 0 }}>
|
||||
{user.isSuccess &&
|
||||
(user.data.PrimaryImageTag ==
|
||||
undefined ? (
|
||||
<Avatar
|
||||
className="appBar-avatar"
|
||||
alt={user.data.Name}
|
||||
>
|
||||
<MdiAccount className="appBar-avatar-icon" />
|
||||
</Avatar>
|
||||
) : (
|
||||
<Avatar
|
||||
className="appBar-avatar"
|
||||
src={
|
||||
window.api.basePath +
|
||||
"/Users/" +
|
||||
user.data.Id +
|
||||
"/Images/Primary"
|
||||
}
|
||||
alt={user.data.Name}
|
||||
>
|
||||
<MdiAccount className="appBar-avatar-icon" />
|
||||
</Avatar>
|
||||
))}
|
||||
</IconButton>
|
||||
</Box>
|
||||
</Toolbar>
|
||||
</MuiAppBar>
|
||||
)
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
/** @format */
|
||||
|
||||
.appBar {
|
||||
transition: background $transition-time-default,
|
||||
box-shadow $transition-time-default;
|
||||
&.backdropVisible {
|
||||
background: $clr-background-dark;
|
||||
}
|
||||
&-avatar {
|
||||
background: $clr-gradient-dark;
|
||||
&-icon {
|
||||
fill: url(#clr-gradient-default) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,64 +4,29 @@ import PropTypes from "prop-types";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import ButtonBase from "@mui/material/ButtonBase";
|
||||
|
||||
import Account from "mdi-material-ui/Account";
|
||||
import { MdiAccount } from "../icons/mdiAccount";
|
||||
|
||||
import "./avatar.module.scss";
|
||||
|
||||
export const AvatarCard = ({ userName, userId, userImageAvailable }) => {
|
||||
return (
|
||||
<ButtonBase className="card square" sx={{ borderRadius: "10px" }}>
|
||||
<div className="card-image-container">
|
||||
{userImageAvailable ? (
|
||||
<div
|
||||
className="card-image"
|
||||
style={{
|
||||
backgroundImage:
|
||||
"url('" +
|
||||
window.api.basePath +
|
||||
"/Users/" +
|
||||
userId +
|
||||
"/Images/Primary')",
|
||||
// http://localhost/Users/{userId}/Images/{imageType}
|
||||
}}
|
||||
></div>
|
||||
) : (
|
||||
<div className="card-image empty"></div>
|
||||
)}
|
||||
<div className="card-image-icon-container">
|
||||
<Account className="card-image-icon" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="card-text-container">
|
||||
<Typography
|
||||
variant="button"
|
||||
color="textPrimary"
|
||||
className="card-text"
|
||||
>
|
||||
{userName}
|
||||
</Typography>
|
||||
</div>
|
||||
</ButtonBase>
|
||||
);
|
||||
};
|
||||
|
||||
export const AvatarImage = ({ userId }) => {
|
||||
export const AvatarImage = ({ userId, userImageTags }) => {
|
||||
return (
|
||||
<div className="avatar-image-container">
|
||||
<div
|
||||
className="avatar-image"
|
||||
style={{
|
||||
backgroundImage:
|
||||
"url('" +
|
||||
window.api.basePath +
|
||||
"/Users/" +
|
||||
userId +
|
||||
"/Images/Primary')",
|
||||
}}
|
||||
></div>
|
||||
{!!userImageTags && (
|
||||
<div
|
||||
className="avatar-image"
|
||||
style={{
|
||||
backgroundImage:
|
||||
"url('" +
|
||||
window.api.basePath +
|
||||
"/Users/" +
|
||||
userId +
|
||||
"/Images/Primary')",
|
||||
}}
|
||||
></div>
|
||||
)}
|
||||
|
||||
<div className="avatar-image-icon-container">
|
||||
<Account className="avatar-image-icon" />
|
||||
<MdiAccount className="avatar-image-icon" />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -71,12 +36,7 @@ export const AvatarSideMenu = ({ userName }) => {
|
||||
return <div></div>;
|
||||
};
|
||||
|
||||
AvatarCard.propType = {
|
||||
userName: PropTypes.string.isRequired,
|
||||
userId: PropTypes.string.isRequired,
|
||||
userImageAvailable: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
AvatarImage.propType = {
|
||||
userId: PropTypes.string.isRequired,
|
||||
userImageTags: PropTypes.any,
|
||||
};
|
||||
@@ -1,44 +1,5 @@
|
||||
/** @format */
|
||||
|
||||
.userCard {
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
.card.square {
|
||||
width: fit-content;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
gap: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
overflow: hidden;
|
||||
.card-image {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
&-container {
|
||||
font-size: 5em;
|
||||
z-index: 0;
|
||||
}
|
||||
&-icon {
|
||||
font-size: 1.5em !important;
|
||||
&-container {
|
||||
position: static;
|
||||
width: 1.5em !important;
|
||||
height: 1.5em !important;
|
||||
aspect-ratio: 1;
|
||||
border-radius: $border-radius-default;
|
||||
color: $clr-accent-default;
|
||||
background: $clr-accent-dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
.card-text {
|
||||
margin: 0 !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.avatar-image {
|
||||
aspect-ratio: 1;
|
||||
height: 100%;
|
||||
@@ -59,6 +20,6 @@
|
||||
padding: 0.2em;
|
||||
background: $clr-accent-dark;
|
||||
color: $clr-accent-default;
|
||||
font-size: 6em !important;
|
||||
font-size: 2em !important;
|
||||
}
|
||||
}
|
||||
+351
-89
@@ -1,110 +1,372 @@
|
||||
/** @format */
|
||||
import React from "react";
|
||||
import React, { useState } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import MuiCard from "@mui/material/Card";
|
||||
import CardContent from "@mui/material/CardContent";
|
||||
import CardMedia from "@mui/material/CardMedia";
|
||||
import CardActionArea from "@mui/material/CardActionArea";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import ButtonGroup from "@mui/material/ButtonGroup";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import { green, pink } from "@mui/material/colors";
|
||||
|
||||
import {
|
||||
MediaCollectionTypeIconCollectionCard,
|
||||
MediaTypeIconCollectionCard,
|
||||
TypeIconCollectionCard,
|
||||
} from "../utils/iconsCollection";
|
||||
|
||||
import { borderRadiusDefault } from "../../palette.module.scss";
|
||||
import "./card.module.scss";
|
||||
import { MdiCheck } from "../icons/mdiCheck";
|
||||
|
||||
export const CardLandscape = ({ itemName, itemId, imageTags, iconType }) => {
|
||||
const imageAvailable = () => {
|
||||
console.log(imageTags);
|
||||
if (imageTags == undefined) {
|
||||
console.log("hee");
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { MdiHeartOutline } from "../icons/mdiHeartOutline";
|
||||
import { MdiHeart } from "../icons/mdiHeart";
|
||||
|
||||
export const Card = ({
|
||||
itemName,
|
||||
itemId,
|
||||
imageTags,
|
||||
iconType,
|
||||
cardType = "",
|
||||
subText = "",
|
||||
playedPercent,
|
||||
cardOrientation,
|
||||
cardProps,
|
||||
onClickEvent,
|
||||
watchedStatus,
|
||||
watchedCount,
|
||||
blurhash,
|
||||
currentUser,
|
||||
favourite,
|
||||
}) => {
|
||||
const [imgLoading, setImgLoading] = useState(true);
|
||||
const [isWatched, setIsWatched] = useState(watchedStatus);
|
||||
const [isFavourite, setIsFavourite] = useState(favourite);
|
||||
const [watchedCountState, setWatchedCountState] = useState(watchedCount);
|
||||
const handleMarkAsPlayOrUnMarkAsPlay = async () => {
|
||||
let result;
|
||||
if (!isWatched) {
|
||||
result = await getPlaystateApi(window.api).markPlayedItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
} else if (isWatched) {
|
||||
result = await getPlaystateApi(window.api).markUnplayedItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
}
|
||||
console.log(result.data);
|
||||
setIsWatched(result.data.Played);
|
||||
setWatchedCountState(result.data.UnplayedItemCount);
|
||||
};
|
||||
const handleLiking = async () => {
|
||||
let result;
|
||||
if (isFavourite) {
|
||||
result = await getUserLibraryApi(window.api).unmarkFavoriteItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
} else if (!isFavourite) {
|
||||
result = await getUserLibraryApi(window.api).markFavoriteItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
}
|
||||
console.log(result.data.IsFavorite);
|
||||
setIsFavourite(result.data.IsFavorite);
|
||||
};
|
||||
return (
|
||||
<div className="card landscape">
|
||||
<div className="card-image-container">
|
||||
{imageAvailable ? (
|
||||
<div
|
||||
className="card-image"
|
||||
style={{
|
||||
backgroundImage:
|
||||
"url('" +
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
itemId +
|
||||
"/Images/Primary')",
|
||||
}}
|
||||
></div>
|
||||
) : (
|
||||
<div className="card-image empty"></div>
|
||||
)}
|
||||
<div className="card-image-icon-container">
|
||||
{MediaCollectionTypeIconCollectionCard[iconType]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="card-text-container">
|
||||
<Typography variant="button" color="white">
|
||||
{itemName}
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
const availableMarkButtonTypes = [
|
||||
"Audio",
|
||||
"AudioBook",
|
||||
"Book",
|
||||
"BoxSet",
|
||||
"CollectionFolder",
|
||||
"Movie",
|
||||
"MusicAlbum",
|
||||
"MusicVideo",
|
||||
"Season",
|
||||
"Series",
|
||||
"Video",
|
||||
"Episode",
|
||||
];
|
||||
const allowedLikeButton = [
|
||||
"Audio",
|
||||
"AudioBook",
|
||||
"Book",
|
||||
"BoxSet",
|
||||
"CollectionFolder",
|
||||
"Movie",
|
||||
"MusicAlbum",
|
||||
"MusicVideo",
|
||||
"Season",
|
||||
"Series",
|
||||
"Video",
|
||||
"Channel",
|
||||
"MusicAlbum",
|
||||
"MusicArtist",
|
||||
"Person",
|
||||
"Photo",
|
||||
"Playlist",
|
||||
"Studio",
|
||||
"Episode",
|
||||
];
|
||||
|
||||
return (
|
||||
<MuiCard
|
||||
className={"card " + cardOrientation}
|
||||
sx={{
|
||||
background: "transparent",
|
||||
borderRadius: borderRadiusDefault,
|
||||
mr: 1,
|
||||
}}
|
||||
elevation={0}
|
||||
{...cardProps}
|
||||
>
|
||||
<CardActionArea
|
||||
onClick={!!onClickEvent ? onClickEvent : () => {}}
|
||||
>
|
||||
<Box
|
||||
className="card-media-container"
|
||||
sx={{
|
||||
position: "relative",
|
||||
m: 1,
|
||||
aspectRatio:
|
||||
cardOrientation == "landscape"
|
||||
? "1.777"
|
||||
: cardOrientation == "portait"
|
||||
? "0.666"
|
||||
: "1",
|
||||
}}
|
||||
>
|
||||
<>
|
||||
<Chip
|
||||
className="card-indicator"
|
||||
label={<MdiCheck />}
|
||||
sx={{
|
||||
transition: "opacity 150ms",
|
||||
opacity: isWatched ? 1 : 0,
|
||||
}}
|
||||
/>
|
||||
|
||||
{!!watchedCountState && (
|
||||
<Chip
|
||||
className="card-indicator card-indicator-text"
|
||||
label={watchedCountState}
|
||||
></Chip>
|
||||
)}
|
||||
<div
|
||||
className="card-media-image-container"
|
||||
style={{ opacity: imgLoading ? 0 : 1 }}
|
||||
>
|
||||
{imageTags &&
|
||||
(cardType == "thumb" ? (
|
||||
<CardMedia
|
||||
component="img"
|
||||
image={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
itemId +
|
||||
"/Images/Backdrop?fillHeight=300&fillWidth=532&quality=96"
|
||||
}
|
||||
alt={itemName}
|
||||
sx={{
|
||||
width: "100%",
|
||||
aspectRatio:
|
||||
cardOrientation ==
|
||||
"landscape"
|
||||
? "1.777"
|
||||
: cardOrientation ==
|
||||
"portait"
|
||||
? "0.666"
|
||||
: "1",
|
||||
borderRadius:
|
||||
borderRadiusDefault,
|
||||
overflow: "hidden",
|
||||
}}
|
||||
onLoad={() =>
|
||||
setImgLoading(false)
|
||||
}
|
||||
className="card-image"
|
||||
></CardMedia>
|
||||
) : (
|
||||
<CardMedia
|
||||
component="img"
|
||||
image={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
itemId +
|
||||
"/Images/Primary"
|
||||
}
|
||||
alt={itemName}
|
||||
sx={{
|
||||
width: "100%",
|
||||
aspectRatio:
|
||||
cardOrientation ==
|
||||
"landscape"
|
||||
? "1.777"
|
||||
: cardOrientation ==
|
||||
"portait"
|
||||
? "0.666"
|
||||
: "1",
|
||||
}}
|
||||
className="card-image"
|
||||
onLoad={() =>
|
||||
setImgLoading(false)
|
||||
}
|
||||
></CardMedia>
|
||||
))}
|
||||
</div>
|
||||
{!!blurhash && (
|
||||
<Blurhash
|
||||
hash={blurhash}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={64}
|
||||
resolutionY={64}
|
||||
style={{
|
||||
aspectRatio:
|
||||
cardOrientation == "landscape"
|
||||
? "1.777"
|
||||
: cardOrientation ==
|
||||
"portait"
|
||||
? "0.666"
|
||||
: "1",
|
||||
}}
|
||||
className="card-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
<div className="card-image-icon-container">
|
||||
{cardType == "lib"
|
||||
? MediaCollectionTypeIconCollectionCard[
|
||||
iconType
|
||||
]
|
||||
: TypeIconCollectionCard[iconType]}
|
||||
</div>
|
||||
{!!playedPercent && (
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={playedPercent}
|
||||
sx={{
|
||||
width: "90%",
|
||||
position: "absolute",
|
||||
left: "5%",
|
||||
bottom: "5%",
|
||||
borderRadius: "100px",
|
||||
height: "5px",
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
<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[200]
|
||||
: "white",
|
||||
}}
|
||||
/>
|
||||
</IconButton>
|
||||
)}
|
||||
{allowedLikeButton.includes(iconType) && (
|
||||
<IconButton
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
handleLiking();
|
||||
}}
|
||||
>
|
||||
{isFavourite ? (
|
||||
<MdiHeart
|
||||
sx={{ color: pink[700] }}
|
||||
/>
|
||||
) : (
|
||||
<MdiHeartOutline />
|
||||
)}
|
||||
</IconButton>
|
||||
)}
|
||||
</ButtonGroup>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<CardContent
|
||||
className="card-text-container"
|
||||
sx={{
|
||||
padding: "0 0.5em",
|
||||
backgroundColor: "transparent",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
gutterBottom={false}
|
||||
variant="h6"
|
||||
component="div"
|
||||
color="white"
|
||||
fontWeight={500}
|
||||
textAlign="left"
|
||||
noWrap
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
>
|
||||
{itemName}
|
||||
</Typography>
|
||||
<Typography
|
||||
gutterBottom
|
||||
variant="subtitle2"
|
||||
component="div"
|
||||
color="gray"
|
||||
textAlign="left"
|
||||
// textOverflow={}
|
||||
// fontSize="0.85em"
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
noWrap
|
||||
>
|
||||
{subText}
|
||||
</Typography>
|
||||
</CardContent>
|
||||
</CardActionArea>
|
||||
</MuiCard>
|
||||
);
|
||||
};
|
||||
|
||||
export const CardPotrait = ({ itemName, itemId, imageTags, iconType }) => {
|
||||
const imageAvailable = () => {
|
||||
console.log(imageTags);
|
||||
if (imageTags == undefined) {
|
||||
console.log("hee");
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
return (
|
||||
<div className="card portrait">
|
||||
<div className="card-image-container">
|
||||
{imageAvailable ? (
|
||||
<div
|
||||
className="card-image"
|
||||
style={{
|
||||
backgroundImage:
|
||||
"url('" +
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
itemId +
|
||||
"/Images/Primary?quality=95&fillHeight=350&fillWidth=243')",
|
||||
}}
|
||||
></div>
|
||||
) : (
|
||||
<div className="card-image empty"></div>
|
||||
)}
|
||||
<div className="card-image-icon-container">
|
||||
{MediaTypeIconCollectionCard[iconType]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="card-text-container">
|
||||
<Typography variant="button" color="white">
|
||||
{itemName}
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
CardLandscape.propTypes = {
|
||||
Card.propTypes = {
|
||||
itemName: PropTypes.string.isRequired,
|
||||
itemId: PropTypes.string.isRequired,
|
||||
imageTags: PropTypes.object,
|
||||
iconType: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
CardPotrait.propTypes = {
|
||||
itemName: PropTypes.string.isRequired,
|
||||
itemId: PropTypes.string.isRequired,
|
||||
imageTags: PropTypes.object,
|
||||
imageTags: PropTypes.bool,
|
||||
iconType: PropTypes.string.isRequired,
|
||||
cardType: PropTypes.string,
|
||||
subText: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
playedPercent: PropTypes.number,
|
||||
cardOrientation: PropTypes.string.isRequired,
|
||||
onClickEvent: PropTypes.func,
|
||||
watchedStatus: PropTypes.bool,
|
||||
watchedCount: PropTypes.number,
|
||||
blurhash: PropTypes.string,
|
||||
currentUser: PropTypes.object,
|
||||
favourite: PropTypes.bool,
|
||||
};
|
||||
@@ -1,52 +1,90 @@
|
||||
/** @format */
|
||||
|
||||
.card {
|
||||
margin-right: 1em;
|
||||
|
||||
&.landscape {
|
||||
--image-aspect-ratio: 1.77;
|
||||
border-radius: $border-radius-default;
|
||||
&-media {
|
||||
&-container {
|
||||
position: relative;
|
||||
border-radius: $border-radius-default;
|
||||
overflow: hidden;
|
||||
}
|
||||
&-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgb(0 0 0 / 0.6);
|
||||
opacity: 0;
|
||||
transition: opacity $transition-time-default;
|
||||
z-index: 10;
|
||||
}
|
||||
&-image-container {
|
||||
transition: opacity $transition-time-default;
|
||||
}
|
||||
}
|
||||
|
||||
&.portrait {
|
||||
--image-aspect-ratio: 0.65;
|
||||
&:hover .card-media-overlay {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
&-image {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
border-radius: 10px;
|
||||
aspect-ratio: var(--image-aspect-ratio);
|
||||
border-radius: $border-radius-default;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
&-container {
|
||||
position: relative;
|
||||
border-radius: $border-radius-default;
|
||||
overflow: hidden;
|
||||
}
|
||||
&-icon {
|
||||
font-size: 4.5em !important;
|
||||
fill: url(#clr-gradient-default) !important;
|
||||
|
||||
&-container {
|
||||
display: flex;
|
||||
display: flex !important;
|
||||
aspect-ratio: 1.777;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100% !important;
|
||||
color: transparent;
|
||||
background: $clr-gradient-dark;
|
||||
border-radius: 10px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
border-radius: $border-radius-default;
|
||||
color: $clr-accent-default;
|
||||
background: $clr-accent-dark;
|
||||
z-index: 0;
|
||||
height: 100%;
|
||||
z-index: -2;
|
||||
}
|
||||
}
|
||||
&-blurhash {
|
||||
position: absolute !important;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
border-radius: $border-radius-default;
|
||||
overflow: hidden;
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
&-text-container {
|
||||
margin-top: 0.5em;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
&-indicator {
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
top: 5px;
|
||||
// padding: 2px 10px;
|
||||
z-index: 10;
|
||||
// border-radius: 100px;
|
||||
background: $clr-gradient-default;
|
||||
box-shadow: 0 0 5px rgb(0 0 0 / 0.4);
|
||||
&-text {
|
||||
aspect-ratio: 1;
|
||||
padding: 5px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,83 +1,91 @@
|
||||
/** @format */
|
||||
|
||||
import { useRef, useEffect } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Carousel from "react-multi-carousel";
|
||||
import "react-multi-carousel/lib/styles.css";
|
||||
|
||||
import ChevronLeft from "mdi-material-ui/ChevronLeft";
|
||||
import ChevronRight from "mdi-material-ui/ChevronRight";
|
||||
import { MdiChevronLeft } from "../icons/mdiChevronLeft";
|
||||
import { MdiChevronRight } from "../icons/mdiChevronRight";
|
||||
|
||||
import { styled } from "@mui/material/styles";
|
||||
import Button from "@mui/material/Button";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import ButtonGroup from "@mui/material/ButtonGroup";
|
||||
|
||||
import "./cardScroller.module.scss";
|
||||
|
||||
const CarouselButton = styled(Button)(() => ({
|
||||
color: "white",
|
||||
height: "100%",
|
||||
}));
|
||||
|
||||
const SliderButtonRight = ({ onClick }) => {
|
||||
return (
|
||||
<CarouselButton
|
||||
onClick={() => onClick()}
|
||||
className="card-scroller-button right"
|
||||
variant="text"
|
||||
>
|
||||
<ChevronRight />
|
||||
</CarouselButton>
|
||||
);
|
||||
};
|
||||
|
||||
const SliderButtonLeft = ({ onClick }) => {
|
||||
return (
|
||||
<CarouselButton
|
||||
onClick={() => onClick()}
|
||||
className="card-scroller-button left"
|
||||
variant="text"
|
||||
>
|
||||
<ChevronLeft />
|
||||
</CarouselButton>
|
||||
);
|
||||
};
|
||||
|
||||
export const CardScroller = ({ children, displayCards }) => {
|
||||
export const CardScroller = ({ children, displayCards, title }) => {
|
||||
const responsive = {
|
||||
superLargeDesktop: {
|
||||
// the naming can be any, depends on you.
|
||||
breakpoint: { max: 4000, min: 3000 },
|
||||
items: displayCards + 1,
|
||||
slidesToSlide: displayCards + 1,
|
||||
},
|
||||
desktop: {
|
||||
breakpoint: { max: 3000, min: 1024 },
|
||||
breakpoint: { max: 3000, min: 1025 },
|
||||
items: displayCards,
|
||||
slidesToSlide: displayCards, // optional, default to 1.
|
||||
},
|
||||
tablet: {
|
||||
breakpoint: { max: 1024, min: 464 },
|
||||
items: displayCards - 1,
|
||||
slidesToSlide: displayCards - 1, // optional, default to 1.
|
||||
},
|
||||
mobile: {
|
||||
breakpoint: { max: 464, min: 0 },
|
||||
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.
|
||||
},
|
||||
};
|
||||
|
||||
const [carouselRef, setCarouselRef] = useState();
|
||||
|
||||
return (
|
||||
<Carousel
|
||||
swipeable={false}
|
||||
draggable={false}
|
||||
responsive={responsive}
|
||||
arrows={true}
|
||||
customRightArrow={<SliderButtonRight />}
|
||||
customLeftArrow={<SliderButtonLeft />}
|
||||
className="card-scroller"
|
||||
>
|
||||
{children}
|
||||
</Carousel>
|
||||
<Box className="card-scroller-container" sx={{ mb: 4 }}>
|
||||
<Box sx={{ mb: 2 }} className="card-scroller-header-container">
|
||||
<Typography
|
||||
variant="h4"
|
||||
color="textPrimary"
|
||||
className="card-scroller-heading"
|
||||
>
|
||||
<div className="card-scroller-heading-decoration"></div>{" "}
|
||||
{title}
|
||||
</Typography>
|
||||
<ButtonGroup className="card-scroller-button-group">
|
||||
<IconButton
|
||||
className="card-scroller-button"
|
||||
onClick={() => carouselRef.previous()}
|
||||
>
|
||||
<MdiChevronLeft />
|
||||
</IconButton>
|
||||
<IconButton
|
||||
className="card-scroller-button"
|
||||
onClick={() => carouselRef.next()}
|
||||
>
|
||||
<MdiChevronRight />
|
||||
</IconButton>
|
||||
</ButtonGroup>
|
||||
</Box>
|
||||
<Carousel
|
||||
swipeable={false}
|
||||
draggable={false}
|
||||
responsive={responsive}
|
||||
arrows={false}
|
||||
ref={(el) => setCarouselRef(el)}
|
||||
// customButtonGroup={<HomeSectionHeader />}
|
||||
// renderButtonGroupOutside={true}
|
||||
className="card-scroller"
|
||||
>
|
||||
{children}
|
||||
</Carousel>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
CardScroller.propTypes = {
|
||||
displayCards: PropTypes.number.isRequired,
|
||||
title: PropTypes.string.isRequired,
|
||||
};
|
||||
@@ -7,23 +7,25 @@
|
||||
display: flex;
|
||||
}
|
||||
&-button {
|
||||
color: white;
|
||||
position: absolute !important;
|
||||
top: 49%;
|
||||
transform: translateY(-50%);
|
||||
background-color: $clr-background-dark !important;
|
||||
border-radius: $border-radius-intensity-1 !important;
|
||||
opacity: 0;
|
||||
transition: opacity $transition-time-default !important;
|
||||
&:hover,
|
||||
&:focus {
|
||||
opacity: 1;
|
||||
}
|
||||
&.right {
|
||||
right: 0%;
|
||||
}
|
||||
&.left {
|
||||
left: 0%;
|
||||
aspect-ratio: 1;
|
||||
}
|
||||
&-header-container {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
&-heading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
gap: 0.35em;
|
||||
position: relative;
|
||||
margin-bottom: 0.25em !important;
|
||||
&-decoration {
|
||||
width: 0.75em;
|
||||
height: 3px;
|
||||
background: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/** @format */
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import { MdiEmoticonCryOutline } from "../icons/mdiEmoticonCryOutline";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
export const EmptyNotice = () => {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
flexFlow: "column",
|
||||
opacity: 0.2,
|
||||
}}
|
||||
>
|
||||
<MdiEmoticonCryOutline sx={{ fontSize: 200 }} />
|
||||
<Typography variant="h3">Nothing found</Typography>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,95 @@
|
||||
/** @format */
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||
import { Card } from "../../components/card/card";
|
||||
import { CardsSkeleton } from "../skeleton/cards";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
|
||||
export const LatestMediaSection = ({ latestMediaLib }) => {
|
||||
const user = useQuery({
|
||||
queryKey: ["home", "user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
});
|
||||
const fetchLatestMedia = async (library) => {
|
||||
const media = await getUserLibraryApi(window.api).getLatestMedia({
|
||||
userId: user.data.Id,
|
||||
parentId: library,
|
||||
limit: 16,
|
||||
fields: ["PrimaryImageAspectRatio"],
|
||||
});
|
||||
return media.data;
|
||||
};
|
||||
const data = useQuery({
|
||||
queryKey: ["homeSection, latestMedia", latestMediaLib],
|
||||
queryFn: () => fetchLatestMedia(latestMediaLib[0]),
|
||||
enabled: !!user.data,
|
||||
});
|
||||
if (data.isLoading) {
|
||||
return <CardsSkeleton />;
|
||||
}
|
||||
if (data.isSuccess && data.data.length >= 1) {
|
||||
return (
|
||||
<CardScroller
|
||||
displayCards={8}
|
||||
title={"Latest " + latestMediaLib[1]}
|
||||
>
|
||||
{data.data.map((item, index) => {
|
||||
return (
|
||||
<Card
|
||||
key={index}
|
||||
itemName={
|
||||
!!item.SeriesId
|
||||
? item.SeriesName
|
||||
: item.Name
|
||||
}
|
||||
itemId={
|
||||
!!item.SeriesId
|
||||
? item.SeriesId
|
||||
: item.Id
|
||||
}
|
||||
// imageTags={false}
|
||||
imageTags={!!item.ImageTags.Primary}
|
||||
iconType={item.Type}
|
||||
subText={item.ProductionYear}
|
||||
playedPercent={
|
||||
item.UserData.PlayedPercentage
|
||||
}
|
||||
cardOrientation={
|
||||
item.PrimaryImageAspectRatio == 1
|
||||
? "sqaure"
|
||||
: "portait"
|
||||
}
|
||||
watchedStatus={item.UserData.Played}
|
||||
watchedCount={
|
||||
item.UserData.UnplayedItemCount
|
||||
}
|
||||
blurhash={
|
||||
item.ImageBlurHashes == {}
|
||||
? ""
|
||||
: !!item.ImageTags.Primary
|
||||
? !!item.ImageBlurHashes.Primary
|
||||
? item.ImageBlurHashes
|
||||
.Primary[
|
||||
item.ImageTags
|
||||
.Primary
|
||||
]
|
||||
: ""
|
||||
: ""
|
||||
}
|
||||
currentUser={user.data}
|
||||
favourite={item.UserData.IsFavorite}
|
||||
></Card>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
);
|
||||
}
|
||||
|
||||
return <></>;
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
/** @format */
|
||||
|
||||
import { MdiChevronLeft } from "./mdiChevronLeft";
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiAccount } from "@mdi/js";
|
||||
|
||||
export const MdiAccount = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiAccount}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiAccountMusic } from "@mdi/js";
|
||||
|
||||
export const MdiAccountMusic = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiAccountMusic}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiAccountTie } from "@mdi/js";
|
||||
|
||||
export const MdiAccountTie = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiAccountTie}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiAlbum } from "@mdi/js";
|
||||
|
||||
export const MdiAlbum = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiAlbum}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -4,9 +4,9 @@ import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiArrowLeft } from "@mdi/js";
|
||||
|
||||
export const MdiArrowLeft = () => {
|
||||
export const MdiArrowLeft = (props) => {
|
||||
return (
|
||||
<SvgIcon>
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiArrowLeft}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiBook } from "@mdi/js";
|
||||
|
||||
export const MdiBook = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiBook}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiBookMultiple } from "@mdi/js";
|
||||
|
||||
export const MdiBookMultiple = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiBookMultiple}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiBookMusic } from "@mdi/js";
|
||||
|
||||
export const MdiBookMusic = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiBookMusic}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiCheck } from "@mdi/js";
|
||||
|
||||
export const MdiCheck = (props) => {
|
||||
return (
|
||||
<SvgIcon color="red" {...props}>
|
||||
<path d={mdiCheck}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiChevronDown } from "@mdi/js";
|
||||
|
||||
export const MdiChevronDown = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiChevronDown}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiChevronLeft } from "@mdi/js";
|
||||
|
||||
export const MdiChevronLeft = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiChevronLeft}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -4,9 +4,9 @@ import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiChevronRight } from "@mdi/js";
|
||||
|
||||
export const MdiChevronRight = () => {
|
||||
export const MdiChevronRight = (props) => {
|
||||
return (
|
||||
<SvgIcon>
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiChevronRight}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiDramaMasks } from "@mdi/js";
|
||||
|
||||
export const MdiDramaMasks = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiDramaMasks}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiEmoticonCryOutline } from "@mdi/js";
|
||||
|
||||
export const MdiEmoticonCryOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiEmoticonCryOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -4,9 +4,9 @@ import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiEyeOffOutline } from "@mdi/js";
|
||||
|
||||
export const MdiEyeOffOutline = () => {
|
||||
export const MdiEyeOffOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon>
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiEyeOffOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
|
||||
@@ -4,9 +4,9 @@ import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiEyeOutline } from "@mdi/js";
|
||||
|
||||
export const MdiEyeOutline = () => {
|
||||
export const MdiEyeOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon>
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiEyeOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiFilmstrip } from "@mdi/js";
|
||||
|
||||
export const MdiFilmstrip = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiFilmstrip}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiFilterOutline } from "@mdi/js";
|
||||
|
||||
export const MdiFilterOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiFilterOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiFolderMultiple } from "@mdi/js";
|
||||
|
||||
export const MdiFolderMultiple = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiFolderMultiple}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiFolderMusicOutline } from "@mdi/js";
|
||||
|
||||
export const MdiFolderMusicOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiFolderMusicOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiFolderOutline } from "@mdi/js";
|
||||
|
||||
export const MdiFolderOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiFolderOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiHeart } from "@mdi/js";
|
||||
|
||||
export const MdiHeart = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiHeart}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiHeartOutline } from "@mdi/js";
|
||||
|
||||
export const MdiHeartOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiHeartOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiHomeVariantOutline } from "@mdi/js";
|
||||
|
||||
export const MdiHomeVariantOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiHomeVariantOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiImage } from "@mdi/js";
|
||||
|
||||
export const MdiImage = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiImage}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiImageMultiple } from "@mdi/js";
|
||||
|
||||
export const MdiImageMultiple = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiImageMultiple}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiLogoutVariant } from "@mdi/js";
|
||||
|
||||
export const MdiLogoutVariant = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiLogoutVariant}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiMagnify } from "@mdi/js";
|
||||
|
||||
export const MdiMagnify = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiMagnify}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiMenu } from "@mdi/js";
|
||||
|
||||
export const MdiMenu = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiMenu}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiMicrophone } from "@mdi/js";
|
||||
|
||||
export const MdiMicrophone = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiMicrophone}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiMovieOutline } from "@mdi/js";
|
||||
|
||||
export const MdiMovieOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiMovieOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiMultimedia } from "@mdi/js";
|
||||
|
||||
export const MdiMultimedia = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiMultimedia}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiMusic } from "@mdi/js";
|
||||
|
||||
export const MdiMusic = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiMusic}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiMusicBoxMultipleOutline } from "@mdi/js";
|
||||
|
||||
export const MdiMusicBoxMultipleOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiMusicBoxMultipleOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiPlay } from "@mdi/js";
|
||||
|
||||
export const MdiPlay = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiPlay}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiPlayBoxMultiple } from "@mdi/js";
|
||||
|
||||
export const MdiPlayBoxMultiple = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiPlayBoxMultiple}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiPlayOutline } from "@mdi/js";
|
||||
|
||||
export const MdiPlayOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiPlayOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiPlaylistMusicOutline } from "@mdi/js";
|
||||
|
||||
export const MdiPlaylistMusicOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiPlaylistMusicOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiSortAscending } from "@mdi/js";
|
||||
|
||||
export const MdiSortAscending = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiSortAscending}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiSortDescending } from "@mdi/js";
|
||||
|
||||
export const MdiSortDescending = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiSortDescending}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiStarHalfFull } from "@mdi/js";
|
||||
|
||||
export const MdiStarHalfFull = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiStarHalfFull}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiTelevision } from "@mdi/js";
|
||||
|
||||
export const MdiTelevision = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiTelevision}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiTelevisionClassic } from "@mdi/js";
|
||||
|
||||
export const MdiTelevisionClassic = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiTelevisionClassic}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiYoutube } from "@mdi/js";
|
||||
|
||||
export const MdiYoutube = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiYoutube}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,316 @@
|
||||
/** @format */
|
||||
import { useEffect, useState } from "react";
|
||||
import { delUser } from "../../utils/storage/user";
|
||||
|
||||
import { useQueryClient, useQuery, QueryClient } 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";
|
||||
|
||||
import { useNavigate, NavLink, useLocation } from "react-router-dom";
|
||||
|
||||
import { theme } from "../../theme";
|
||||
|
||||
import { styled } from "@mui/material/styles";
|
||||
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 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 { MdiMenu } from "../icons/mdiMenu";
|
||||
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 "./sidemenu.module.scss";
|
||||
|
||||
const drawerWidth = 320;
|
||||
|
||||
const DrawerHeader = styled("div")(({ theme }) => ({
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "flex-end",
|
||||
padding: theme.spacing(0, 1),
|
||||
// necessary for content to be below app bar
|
||||
...theme.mixins.toolbar,
|
||||
}));
|
||||
|
||||
const MiniDrawer = styled(MuiDrawer, {
|
||||
shouldForwardProp: (prop) => prop !== "open",
|
||||
})(({ theme }) => ({
|
||||
flexShrink: 0,
|
||||
whiteSpace: "nowrap",
|
||||
boxSizing: "border-box",
|
||||
backgroundColor: theme.palette.primary.background.dark,
|
||||
overflowX: "hidden",
|
||||
// width: `calc(${theme.spacing(7)} + 10px)`,
|
||||
}));
|
||||
|
||||
export const SideMenu = ({}) => {
|
||||
const location = useLocation();
|
||||
|
||||
const [display, setDisplay] = useState(false);
|
||||
|
||||
const visible = useSelector((state) => state.sidebar.visible);
|
||||
const backdrop = useSelector((state) => state.sidebar.backdrop);
|
||||
const navigate = useNavigate();
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
enabled: false,
|
||||
});
|
||||
let libraries = useQuery({
|
||||
queryKey: ["libraries"],
|
||||
queryFn: async () => {
|
||||
let libs = await getUserViewsApi(window.api).getUserViews({
|
||||
userId: user.data.Id,
|
||||
});
|
||||
return libs.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
});
|
||||
const handleDrawerOpen = () => {};
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const handleLogout = async () => {
|
||||
console.log("Logging out user...");
|
||||
await window.api.logout();
|
||||
delUser();
|
||||
dispatch(hideSidemenu());
|
||||
navigate("/login");
|
||||
};
|
||||
|
||||
const getCurrentPathWithoutParam = () => {
|
||||
return location.pathname.slice(0, location.pathname.lastIndexOf("/"));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
getCurrentPathWithoutParam() != "/login" &&
|
||||
getCurrentPathWithoutParam() != "/setup/server"
|
||||
) {
|
||||
setDisplay(true);
|
||||
}
|
||||
}, [location]);
|
||||
|
||||
if (!display) {
|
||||
return <></>;
|
||||
}
|
||||
|
||||
if (display) {
|
||||
return (
|
||||
<MiniDrawer
|
||||
variant="permanent"
|
||||
open={false}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
backgroundColor: "inherit",
|
||||
border: "none",
|
||||
width: visible
|
||||
? `calc(${theme.spacing(7)} + 10px)`
|
||||
: 0,
|
||||
height: "100vh",
|
||||
// display: visible ? "block" : "none",
|
||||
},
|
||||
}}
|
||||
sx={{
|
||||
width: visible
|
||||
? `calc(${theme.spacing(7)} + 10px)`
|
||||
: 0,
|
||||
background: backdrop
|
||||
? theme.palette.background.paper
|
||||
: "transparent",
|
||||
borderLeft: "1px solid white",
|
||||
}}
|
||||
>
|
||||
<DrawerHeader
|
||||
className="Mui-DrawerHeader"
|
||||
sx={{
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
{/* <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
|
||||
>
|
||||
<NavLink
|
||||
to={
|
||||
"/library/" +
|
||||
library.Id
|
||||
}
|
||||
className={({
|
||||
isActive,
|
||||
isPending,
|
||||
}) =>
|
||||
isPending
|
||||
? "sidemenu-item-pending sidemenu-item"
|
||||
: isActive
|
||||
? "sidemenu-item-active sidemenu-item"
|
||||
: "sidemenu-item"
|
||||
}
|
||||
>
|
||||
<ListItemButton
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
"center",
|
||||
px: 2.5,
|
||||
}}
|
||||
color="white"
|
||||
>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
}}
|
||||
>
|
||||
{
|
||||
MediaCollectionTypeIconCollection[
|
||||
library
|
||||
.CollectionType
|
||||
]
|
||||
}
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</NavLink>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</List>
|
||||
<List sx={{ marginTop: "auto" }}>
|
||||
<Tooltip
|
||||
title="Home"
|
||||
placement="right"
|
||||
followCursor
|
||||
arrow
|
||||
>
|
||||
<ListItem
|
||||
className="sidemenu-item-container"
|
||||
disablePadding
|
||||
>
|
||||
<NavLink
|
||||
to="/home"
|
||||
className={({
|
||||
isActive,
|
||||
isPending,
|
||||
}) =>
|
||||
isPending
|
||||
? "sidemenu-item-pending sidemenu-item"
|
||||
: isActive
|
||||
? "sidemenu-item-active sidemenu-item"
|
||||
: "sidemenu-item"
|
||||
}
|
||||
>
|
||||
<ListItemButton
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
"center",
|
||||
px: 2.5,
|
||||
}}
|
||||
>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
}}
|
||||
>
|
||||
<MdiHomeVariantOutline></MdiHomeVariantOutline>
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</NavLink>
|
||||
</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",
|
||||
}}
|
||||
>
|
||||
<MdiLogoutVariant></MdiLogoutVariant>
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
</List>
|
||||
</>
|
||||
)}
|
||||
</MiniDrawer>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
// SideMenu.propTypes = {
|
||||
// skeleton: PropTypes.bool.isRequired,
|
||||
// data: PropTypes.array.isRequired,
|
||||
// };
|
||||
@@ -0,0 +1,29 @@
|
||||
/** @format */
|
||||
|
||||
.sidemenu {
|
||||
&-item {
|
||||
position: relative;
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 15%;
|
||||
bottom: 15%;
|
||||
left: 7%;
|
||||
width: 5px;
|
||||
border-radius: 10px;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
$clr-accent-default,
|
||||
$clr-secondary-default
|
||||
);
|
||||
opacity: 0;
|
||||
transform: translateX(-10px);
|
||||
transition: transform $transition-time-default,
|
||||
opacity $transition-time-default;
|
||||
}
|
||||
&-active::before {
|
||||
opacity: 1;
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/** @format */
|
||||
|
||||
import Skeleton from "@mui/material/Skeleton";
|
||||
import Card from "@mui/material/Card";
|
||||
import CardContent from "@mui/material/CardContent";
|
||||
import CardMedia from "@mui/material/CardMedia";
|
||||
import CardActionArea from "@mui/material/CardActionArea";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Box from "@mui/material/Box";
|
||||
|
||||
export const CardsSkeleton = () => {
|
||||
return (
|
||||
<Box sx={{ display: "flex", flexFlow: "column", mb: 4 }}>
|
||||
<Typography variant="h4" sx={{ mb: "0.15em" }}>
|
||||
<Skeleton width="35%" animation="wave" />
|
||||
</Typography>
|
||||
<Skeleton width="100%" variant="rounded" animation="wave">
|
||||
<div style={{ paddingTop: "20%" }}></div>
|
||||
</Skeleton>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
/** @format */
|
||||
import Skeleton from "@mui/material/Skeleton";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { theme } from "../../theme";
|
||||
export const CarouselSkeleton = () => {
|
||||
return (
|
||||
<Paper
|
||||
className="hero-carousel-slide"
|
||||
sx={{
|
||||
background: theme.palette.primary.background.dark,
|
||||
}}
|
||||
>
|
||||
<div className="hero-carousel-background">
|
||||
<Skeleton
|
||||
variant="rectangular"
|
||||
height="100%"
|
||||
animation="wave"
|
||||
></Skeleton>
|
||||
</div>
|
||||
<Box className="hero-carousel-detail">
|
||||
<Typography variant="h3" className="hero-carousel-text">
|
||||
<Skeleton
|
||||
variant="text"
|
||||
sx={{ fontSize: "5rem" }}
|
||||
width={300}
|
||||
animation="wave"
|
||||
></Skeleton>
|
||||
</Typography>
|
||||
<Typography variant="p" className="hero-carousel-text">
|
||||
<Skeleton
|
||||
variant="text"
|
||||
sx={{ fontSize: "3rem" }}
|
||||
width={400}
|
||||
animation="wave"
|
||||
></Skeleton>
|
||||
</Typography>
|
||||
</Box>
|
||||
</Paper>
|
||||
);
|
||||
};
|
||||
@@ -1,61 +1,104 @@
|
||||
/** @format */
|
||||
|
||||
import MovieOutline from "mdi-material-ui/MovieOutline";
|
||||
import MusicBoxMultipleOutline from "mdi-material-ui/MusicBoxMultipleOutline";
|
||||
import PlaylistMusicOutline from "mdi-material-ui/PlaylistMusicOutline";
|
||||
import Television from "mdi-material-ui/Television";
|
||||
import FolderOutline from "mdi-material-ui/FolderOutline";
|
||||
import FolderMusicOutline from "mdi-material-ui/FolderMusicOutline";
|
||||
import Youtube from "mdi-material-ui/Youtube";
|
||||
import MultiMedia from "mdi-material-ui/Multimedia";
|
||||
import BookMultiple from "mdi-material-ui/BookMultiple";
|
||||
import ImageMultiple from "mdi-material-ui/ImageMultiple";
|
||||
import TelevisionClassic from "mdi-material-ui/TelevisionClassic";
|
||||
import Filmstrip from "mdi-material-ui/Filmstrip";
|
||||
import Microphone from "mdi-material-ui/Microphone";
|
||||
import Image from "mdi-material-ui/Image";
|
||||
import Book from "mdi-material-ui/Book";
|
||||
import { MdiMovieOutline } from "../icons/mdiMovieOutline";
|
||||
import { MdiMusicBoxMultipleOutline } from "../icons/mdiMusicBoxMultipleOutline";
|
||||
import { MdiPlaylistMusicOutline } from "../icons/mdiPlaylistMusicOutline";
|
||||
import { MdiTelevision } from "../icons/mdiTelevision";
|
||||
import { MdiFolderOutline } from "../icons/mdiFolderOutline";
|
||||
import { MdiFolderMusicOutline } from "../icons/mdiFolderMusicOutline";
|
||||
import { MdiYoutube } from "../icons/mdiYoutube";
|
||||
import { MdiMultimedia } from "../icons/mdiMultimedia";
|
||||
import { MdiBookMultiple } from "../icons/mdiBookMultiple";
|
||||
import { MdiImageMultiple } from "../icons/mdiImageMultiple";
|
||||
import { MdiTelevisionClassic } from "../icons/mdiTelevisionClassic";
|
||||
import { MdiFilmstrip } from "../icons/mdiFilmstrip";
|
||||
import { MdiMicrophone } from "../icons/mdiMicrophone";
|
||||
import { MdiImage } from "../icons/mdiImage";
|
||||
import { MdiBook } from "../icons/mdiBook";
|
||||
import { MdiFolderMultiple } from "../icons/mdiFolderMultiple";
|
||||
import { MdiBookMusic } from "../icons/mdiBookMusic";
|
||||
import { MdiPlayBoxMultiple } from "../icons/mdiPlayBoxMultiple";
|
||||
import { MdiAlbum } from "../icons/mdiAlbum";
|
||||
import { MdiAccountMusic } from "../icons/mdiAccountMusic";
|
||||
import { MdiDramaMasks } from "../icons/mdiDramaMasks";
|
||||
import { MdiMusic } from "../icons/mdiMusic";
|
||||
import { MdiAccountTie } from "../icons/mdiAccountTie";
|
||||
|
||||
export const MediaCollectionTypeIconCollection = {
|
||||
universal: <MultiMedia />,
|
||||
movies: <MovieOutline />,
|
||||
music: <MusicBoxMultipleOutline />,
|
||||
playlists: <PlaylistMusicOutline />,
|
||||
tvshows: <Television />,
|
||||
boxsets: <MovieOutline />,
|
||||
musicvideos: <FolderMusicOutline />,
|
||||
trailers: <Youtube />,
|
||||
books: <BookMultiple />,
|
||||
photos: <ImageMultiple />,
|
||||
livetv: <TelevisionClassic />,
|
||||
folder: <FolderOutline />,
|
||||
universal: <MdiMultimedia />,
|
||||
movies: <MdiMovieOutline />,
|
||||
music: <MdiMusicBoxMultipleOutline />,
|
||||
playlists: <MdiPlaylistMusicOutline />,
|
||||
tvshows: <MdiTelevision />,
|
||||
boxsets: <MdiMovieOutline />,
|
||||
musicvideos: <MdiFolderMusicOutline />,
|
||||
trailers: <MdiYoutube />,
|
||||
books: <MdiBookMultiple />,
|
||||
photos: <MdiImageMultiple />,
|
||||
livetv: <MdiTelevisionClassic />,
|
||||
folder: <MdiFolderOutline />,
|
||||
logout: <MdiFolderOutline />,
|
||||
};
|
||||
|
||||
export const MediaCollectionTypeIconCollectionCard = {
|
||||
universal: <MultiMedia className="card-image-icon" />,
|
||||
movies: <MovieOutline className="card-image-icon" />,
|
||||
music: <MusicBoxMultipleOutline className="card-image-icon" />,
|
||||
playlists: <PlaylistMusicOutline className="card-image-icon" />,
|
||||
tvshows: <Television className="card-image-icon" />,
|
||||
boxsets: <MovieOutline className="card-image-icon" />,
|
||||
musicvideos: <FolderMusicOutline className="card-image-icon" />,
|
||||
trailers: <Youtube className="card-image-icon" />,
|
||||
books: <BookMultiple className="card-image-icon" />,
|
||||
photos: <ImageMultiple className="card-image-icon" />,
|
||||
livetv: <TelevisionClassic className="card-image-icon" />,
|
||||
folder: <FolderOutline className="card-image-icon" />,
|
||||
universal: <MdiMultimedia className="card-image-icon" />,
|
||||
movies: <MdiMovieOutline className="card-image-icon" />,
|
||||
music: <MdiMusicBoxMultipleOutline className="card-image-icon" />,
|
||||
playlists: <MdiPlaylistMusicOutline className="card-image-icon" />,
|
||||
tvshows: <MdiTelevision className="card-image-icon" />,
|
||||
boxsets: <MdiMovieOutline className="card-image-icon" />,
|
||||
musicvideos: <MdiFolderMusicOutline className="card-image-icon" />,
|
||||
trailers: <MdiYoutube className="card-image-icon" />,
|
||||
books: <MdiBookMultiple className="card-image-icon" />,
|
||||
photos: <MdiImageMultiple className="card-image-icon" />,
|
||||
livetv: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
folder: <MdiFolderOutline className="card-image-icon" />,
|
||||
};
|
||||
|
||||
export const MediaTypeIconCollection = {
|
||||
Video: <Filmstrip className="hero-carousel-background-icon" />,
|
||||
Audio: <Microphone className="hero-carousel-background-icon" />,
|
||||
Photo: <Image className="hero-carousel-background-icon" />,
|
||||
Book: <Book className="hero-carousel-background-icon" />,
|
||||
Movie: <MdiFilmstrip className="hero-carousel-background-icon" />,
|
||||
Audio: <MdiMicrophone className="hero-carousel-background-icon" />,
|
||||
Photo: <MdiImage className="hero-carousel-background-icon" />,
|
||||
Book: <MdiBook className="hero-carousel-background-icon" />,
|
||||
};
|
||||
|
||||
export const MediaTypeIconCollectionCard = {
|
||||
Video: <Filmstrip className="card-image-icon" />,
|
||||
Audio: <Microphone className="card-image-icon" />,
|
||||
Photo: <Image className="card-image-icon" />,
|
||||
Book: <Book className="card-image-icon" />,
|
||||
export const TypeIconCollectionCard = {
|
||||
AggregateFolder: <MdiFolderMultiple className="card-image-icon" />,
|
||||
Audio: <MdiMicrophone className="card-image-icon" />,
|
||||
AudioBook: <MdiBookMusic className="card-image-icon" />,
|
||||
BasePluginFolder: <MdiFolderOutline className="card-image-icon" />,
|
||||
Book: <MdiBook className="card-image-icon" />,
|
||||
BoxSet: <MdiPlayBoxMultiple className="card-image-icon" />,
|
||||
Channel: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
ChannelFolderItem: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
CollectionFolder: <MdiFolderOutline className="card-image-icon" />,
|
||||
Episode: <MdiTelevision className="card-image-icon" />,
|
||||
Folder: <MdiFolderOutline className="card-image-icon" />,
|
||||
LiveTvChannel: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
LiveTvProgram: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
ManualPlaylistsFolder: (
|
||||
<MdiPlaylistMusicOutline className="card-image-icon" />
|
||||
),
|
||||
Movie: <MdiFilmstrip className="card-image-icon" />,
|
||||
MusicAlbum: <MdiAlbum className="card-image-icon" />,
|
||||
MusicArtist: <MdiAccountMusic className="card-image-icon" />,
|
||||
MusicGenre: <MdiDramaMasks className="card-image-icon" />,
|
||||
MusicVideo: <MdiMusic className="card-image-icon" />,
|
||||
Person: <MdiAccountTie className="card-image-icon" />,
|
||||
Photo: <MdiImage className="card-image-icon" />,
|
||||
PhotoAlbum: <MdiImageMultiple className="card-image-icon" />,
|
||||
Playlist: <MdiPlaylistMusicOutline className="card-image-icon" />,
|
||||
PlaylistsFolder: <MdiPlaylistMusicOutline className="card-image-icon" />,
|
||||
Program: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
Recording: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
Season: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
Series: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
Studio: <MdiMultimedia className="card-image-icon" />,
|
||||
Trailer: <MdiYoutube className="card-image-icon" />,
|
||||
TvChannel: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
TvProgram: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
UserRootFolder: <MdiFolderOutline className="card-image-icon" />,
|
||||
UserView: <MdiMultimedia className="card-image-icon" />,
|
||||
Video: <MdiFilmstrip className="card-image-icon" />,
|
||||
Year: <MdiMultimedia className="card-image-icon" />,
|
||||
};
|
||||
+14
-6
@@ -4,19 +4,27 @@ import React from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
|
||||
import { BrowserRouter as Router } from "react-router-dom";
|
||||
import { CookiesProvider } from "react-cookie";
|
||||
|
||||
import { invoke } from "@tauri-apps/api/tauri";
|
||||
|
||||
import App from "./App";
|
||||
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
|
||||
import store from "./store";
|
||||
import { Provider } from "react-redux";
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
ReactDOM.createRoot(document.getElementById("root")).render(
|
||||
<React.StrictMode>
|
||||
<CookiesProvider>
|
||||
<Router>
|
||||
<App />
|
||||
</Router>
|
||||
</CookiesProvider>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<Provider store={store}>
|
||||
<Router>
|
||||
<App />
|
||||
</Router>
|
||||
</Provider>
|
||||
</QueryClientProvider>
|
||||
</React.StrictMode>,
|
||||
);
|
||||
|
||||
|
||||
@@ -10,4 +10,6 @@
|
||||
|
||||
clrBackgroundDark: $clr-background-dark;
|
||||
clrBackgroundLight: $clr-background-light;
|
||||
|
||||
borderRadiusDefault: $border-radius-default;
|
||||
}
|
||||
@@ -12,6 +12,12 @@
|
||||
margin: 0 auto;
|
||||
}
|
||||
&-background {
|
||||
&-blurhash {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
}
|
||||
&-container {
|
||||
position: absolute;
|
||||
z-index: 0;
|
||||
@@ -21,13 +27,12 @@
|
||||
bottom: 0;
|
||||
mask-image: linear-gradient(
|
||||
to right,
|
||||
transparent 20%,
|
||||
black 50%
|
||||
rgba(0, 0, 0, 0.1),
|
||||
black 90%
|
||||
);
|
||||
-webkit-mask-image: linear-gradient(
|
||||
to right,
|
||||
transparent 20%,
|
||||
rgb(0 0 0 / 0.5) 50%,
|
||||
rgba(0, 0, 0, 0.1),
|
||||
black 90%
|
||||
);
|
||||
}
|
||||
@@ -39,18 +44,31 @@
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-position: center;
|
||||
opacity: 1;
|
||||
mask-image: linear-gradient(
|
||||
to right,
|
||||
transparent 10%,
|
||||
rgba(0, 0, 0, 0.5) 50%,
|
||||
black 90%
|
||||
);
|
||||
-webkit-mask-image: linear-gradient(
|
||||
to right,
|
||||
transparent 10%,
|
||||
rgba(0, 0, 0, 0.5) 50%,
|
||||
black 90%
|
||||
);
|
||||
}
|
||||
&-icon {
|
||||
position: absolute;
|
||||
font-size: 10em !important;
|
||||
font-size: 15em !important;
|
||||
left: 70%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
color: $clr-accent-default;
|
||||
|
||||
fill: url(#clr-gradient-default) !important;
|
||||
&-container {
|
||||
position: absolute;
|
||||
background: $clr-accent-dark;
|
||||
background: $clr-gradient-dark;
|
||||
z-index: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
@@ -63,6 +81,13 @@
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
-webkit-line-clamp: 2;
|
||||
margin-bottom: 0.5em;
|
||||
&-logo {
|
||||
max-width: 6em;
|
||||
height: 2em;
|
||||
object-fit: contain;
|
||||
object-position: bottom;
|
||||
}
|
||||
}
|
||||
&-detail {
|
||||
position: relative;
|
||||
@@ -82,18 +107,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
.home-section {
|
||||
&-heading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
gap: 0.35em;
|
||||
position: relative;
|
||||
margin-bottom: 0.25em !important;
|
||||
&-decoration {
|
||||
width: 0.75em;
|
||||
height: 3px;
|
||||
background: white;
|
||||
}
|
||||
}
|
||||
.backdropContainer {
|
||||
background: linear-gradient(
|
||||
45deg,
|
||||
$clr-background-default,
|
||||
$clr-background-light
|
||||
);
|
||||
}
|
||||
+710
-455
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,63 @@
|
||||
/** @format */
|
||||
|
||||
.item-detail {
|
||||
&-backdrop {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: inherit;
|
||||
height: 100%;
|
||||
z-index: -2;
|
||||
opacity: 0.1;
|
||||
}
|
||||
&-header {
|
||||
display: flex;
|
||||
gap: 2em;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-end;
|
||||
position: relative;
|
||||
&-backdrop {
|
||||
position: absolute;
|
||||
width: 100vw;
|
||||
height: 150%;
|
||||
top: -88px;
|
||||
width: 100vw;
|
||||
right: 0;
|
||||
left: -24px;
|
||||
z-index: -1;
|
||||
filter: brightness(0.5);
|
||||
mask-image: linear-gradient(0deg, transparent, black);
|
||||
-webkit-mask-image: linear-gradient(0deg, transparent, black);
|
||||
}
|
||||
}
|
||||
&-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
position: absolute;
|
||||
transition: opacity $transition-time-default;
|
||||
&-blurhash {
|
||||
z-index: -1;
|
||||
}
|
||||
&-container {
|
||||
width: 15%;
|
||||
position: relative;
|
||||
aspect-ratio: 0.666;
|
||||
border-radius: $border-radius-default;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 0 15px rgb(0 0 0 / 0.4);
|
||||
}
|
||||
&-icon-container {
|
||||
background: $clr-gradient-dark;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,362 @@
|
||||
/** @format */
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import {
|
||||
setBackdrop,
|
||||
showAppBar,
|
||||
showBackButton,
|
||||
} from "../../../utils/slice/appBar";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useParams } from "react-router-dom";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { MdiStarHalfFull } from "../../../components/icons/mdiStarHalfFull";
|
||||
import { getRuntimeFull } from "../../../utils/date/time";
|
||||
import { TypeIconCollectionCard } from "../../../components/utils/iconsCollection";
|
||||
|
||||
import { Card } from "../../../components/card/card";
|
||||
import { CardScroller } from "../../../components/cardScroller/cardScroller";
|
||||
|
||||
import "./Movie.module.scss";
|
||||
|
||||
const ItemMovie = () => {
|
||||
const { id } = useParams();
|
||||
const dispatch = useDispatch();
|
||||
const appBarVisiblity = useSelector((state) => state.appBar.visible);
|
||||
const [scrollTarget, setScrollTarget] = useState(undefined);
|
||||
const [primageImageLoaded, setPrimaryImageLoaded] = useState(false);
|
||||
const [backdropImageLoaded, setBackdropImageLoaded] = useState(false);
|
||||
|
||||
const trigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 0,
|
||||
target: scrollTarget,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!appBarVisiblity) {
|
||||
dispatch(showAppBar());
|
||||
}
|
||||
dispatch(setBackdrop(trigger));
|
||||
dispatch(showBackButton());
|
||||
}, [trigger]);
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
});
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item,Movie", id],
|
||||
queryFn: async () => {
|
||||
const result = await getUserLibraryApi(window.api).getItem({
|
||||
userId: user.data.Id,
|
||||
itemId: id,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
});
|
||||
if (item.isLoading) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
if (item.isSuccess) {
|
||||
return (
|
||||
<>
|
||||
<Box className="item-detail-backdrop">
|
||||
{item.data.BackdropImageTags.length != 0 && (
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data.ImageBlurHashes.Backdrop[
|
||||
item.data.BackdropImageTags[0]
|
||||
]
|
||||
}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={64}
|
||||
resolutionY={96}
|
||||
style={{
|
||||
aspectRatio: "0.666",
|
||||
}}
|
||||
className="item-detail-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
<Box
|
||||
recomponent="main"
|
||||
className="scrollY"
|
||||
sx={{
|
||||
display: "flex",
|
||||
pt: 11,
|
||||
px: 3,
|
||||
pb: 3,
|
||||
position: "relative",
|
||||
flexFlow: "column",
|
||||
gap: 5,
|
||||
}}
|
||||
ref={(node) => {
|
||||
if (node) {
|
||||
setScrollTarget(node);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Box className="item-detail-header">
|
||||
<Box className="item-detail-header-backdrop">
|
||||
{item.data.BackdropImageTags.length != 0 && (
|
||||
<img
|
||||
src={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
item.data.Id +
|
||||
"/Images/Backdrop"
|
||||
}
|
||||
style={{
|
||||
opacity: backdropImageLoaded
|
||||
? 1
|
||||
: 0,
|
||||
}}
|
||||
className="item-detail-image"
|
||||
onLoad={() =>
|
||||
setBackdropImageLoaded(true)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{item.data.BackdropImageTags.length != 0 && (
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data.ImageBlurHashes
|
||||
.Backdrop[
|
||||
item.data
|
||||
.BackdropImageTags[0]
|
||||
]
|
||||
}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={64}
|
||||
resolutionY={96}
|
||||
style={{
|
||||
aspectRatio: "0.666",
|
||||
}}
|
||||
className="item-detail-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
<Box
|
||||
sx={{ fontSize: "4em" }}
|
||||
className="item-detail-image-icon-container"
|
||||
>
|
||||
{TypeIconCollectionCard[item.data.Type]}
|
||||
</Box>
|
||||
</Box>
|
||||
<Box className="item-detail-image-container">
|
||||
{!!item.data.ImageTags.Primary && (
|
||||
<img
|
||||
src={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
item.data.Id +
|
||||
"/Images/Primary"
|
||||
}
|
||||
style={{
|
||||
opacity: primageImageLoaded
|
||||
? 1
|
||||
: 0,
|
||||
}}
|
||||
className="item-detail-image"
|
||||
onLoad={() =>
|
||||
setPrimaryImageLoaded(true)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{!!item.data.ImageBlurHashes.Primary && (
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data.ImageBlurHashes
|
||||
.Primary[
|
||||
item.data.ImageTags
|
||||
.Primary
|
||||
]
|
||||
}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={64}
|
||||
resolutionY={96}
|
||||
style={{
|
||||
aspectRatio: 0.666,
|
||||
}}
|
||||
className="item-detail-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
<div className="item-detail-image-icon-container">
|
||||
{TypeIconCollectionCard[item.data.Type]}
|
||||
</div>
|
||||
</Box>
|
||||
<Box className="item-detail-info-container">
|
||||
<Box
|
||||
className="item-detail-title-name"
|
||||
sx={{ mb: 2 }}
|
||||
>
|
||||
<Typography variant="h3">
|
||||
{item.data.Name}
|
||||
</Typography>
|
||||
{!!item.data.UserData
|
||||
.PlayedPercentage && (
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={
|
||||
item.data.UserData
|
||||
.PlayedPercentage
|
||||
}
|
||||
sx={{
|
||||
borderRadius: 1000,
|
||||
width: "75%",
|
||||
mt: 1,
|
||||
mb: 1,
|
||||
}}
|
||||
color="primary"
|
||||
/>
|
||||
)}
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
color="gray"
|
||||
>
|
||||
{item.data.OriginalTitle}
|
||||
</Typography>
|
||||
</Box>
|
||||
<Stack
|
||||
direction="row"
|
||||
gap={2}
|
||||
divider={
|
||||
<Divider
|
||||
variant="middle"
|
||||
flexItem
|
||||
orientation="vertical"
|
||||
/>
|
||||
}
|
||||
ex={{ alignItems: "center" }}
|
||||
>
|
||||
<Typography
|
||||
sx={{ flexGrow: 0 }}
|
||||
variant="subtitle1"
|
||||
>
|
||||
{item.data.ProductionYear}
|
||||
</Typography>
|
||||
<Chip
|
||||
variant="outlined"
|
||||
label={
|
||||
!!item.data.OfficialRating
|
||||
? item.data
|
||||
.OfficialRating
|
||||
: "Not Rated"
|
||||
}
|
||||
/>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
gap: "0.25em",
|
||||
alignItems: "center",
|
||||
}}
|
||||
className="item-detail-info-rating"
|
||||
>
|
||||
{!!item.data.CommunityRating ? (
|
||||
<>
|
||||
<MdiStarHalfFull />
|
||||
<Typography variant="subtitle1">
|
||||
{Math.round(
|
||||
item.data
|
||||
.CommunityRating *
|
||||
10,
|
||||
) / 10}
|
||||
</Typography>
|
||||
</>
|
||||
) : (
|
||||
<Typography variant="subtitle1">
|
||||
No Community Rating
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
<Typography variant="subtitle1">
|
||||
{getRuntimeFull(
|
||||
item.data.RunTimeTicks,
|
||||
)}
|
||||
</Typography>
|
||||
</Stack>
|
||||
</Box>
|
||||
</Box>
|
||||
<Box className="item-media-container">
|
||||
<Stack
|
||||
direction="row"
|
||||
gap={1}
|
||||
alignItems="center"
|
||||
>
|
||||
<Typography variant="h5">Genre</Typography>
|
||||
{item.data.Genres.map((genre, index) => {
|
||||
return (
|
||||
<Chip
|
||||
key={index}
|
||||
variant="filled"
|
||||
label={genre}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</Stack>
|
||||
</Box>
|
||||
<Typography variant="body1">
|
||||
{item.data.Overview}
|
||||
</Typography>
|
||||
<CardScroller displayCards={8} title="Cast">
|
||||
{item.data.People.map((person, index) => {
|
||||
return (
|
||||
<Card
|
||||
key={index}
|
||||
itemName={person.Name}
|
||||
itemId={person.Id}
|
||||
// imageTags={false}
|
||||
imageTags={
|
||||
!!person.PrimaryImageTag
|
||||
}
|
||||
iconType="Person"
|
||||
subText={person.Role}
|
||||
cardOrientation="sqaure"
|
||||
currentUser={user.data}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
if (item.isError) {
|
||||
return <h1>{"Something went wrong :("}</h1>;
|
||||
}
|
||||
};
|
||||
|
||||
export default ItemMovie;
|
||||
@@ -0,0 +1,63 @@
|
||||
/** @format */
|
||||
|
||||
.item-detail {
|
||||
&-backdrop {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: inherit;
|
||||
height: 100%;
|
||||
z-index: -2;
|
||||
opacity: 0.1;
|
||||
}
|
||||
&-header {
|
||||
display: flex;
|
||||
gap: 2em;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-end;
|
||||
position: relative;
|
||||
&-backdrop {
|
||||
position: absolute;
|
||||
width: 100vw;
|
||||
height: 150%;
|
||||
top: -88px;
|
||||
width: 100vw;
|
||||
right: 0;
|
||||
left: -24px;
|
||||
z-index: -1;
|
||||
filter: brightness(0.5);
|
||||
mask-image: linear-gradient(0deg, transparent, black);
|
||||
-webkit-mask-image: linear-gradient(0deg, transparent, black);
|
||||
}
|
||||
}
|
||||
&-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
position: absolute;
|
||||
transition: opacity $transition-time-default;
|
||||
&-blurhash {
|
||||
z-index: -1;
|
||||
}
|
||||
&-container {
|
||||
width: 15%;
|
||||
position: relative;
|
||||
aspect-ratio: 0.666;
|
||||
border-radius: $border-radius-default;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 0 15px rgb(0 0 0 / 0.4);
|
||||
}
|
||||
&-icon-container {
|
||||
background: $clr-gradient-dark;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,362 @@
|
||||
/** @format */
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import {
|
||||
setBackdrop,
|
||||
showAppBar,
|
||||
showBackButton,
|
||||
} from "../../../utils/slice/appBar";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useParams } from "react-router-dom";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { MdiStarHalfFull } from "../../../components/icons/mdiStarHalfFull";
|
||||
import { getRuntimeFull } from "../../../utils/date/time";
|
||||
import { TypeIconCollectionCard } from "../../../components/utils/iconsCollection";
|
||||
|
||||
import { Card } from "../../../components/card/card";
|
||||
import { CardScroller } from "../../../components/cardScroller/cardScroller";
|
||||
|
||||
import "./Series.module.scss";
|
||||
|
||||
const ItemSeries = () => {
|
||||
const { id } = useParams();
|
||||
const dispatch = useDispatch();
|
||||
const appBarVisiblity = useSelector((state) => state.appBar.visible);
|
||||
const [scrollTarget, setScrollTarget] = useState(undefined);
|
||||
const [primageImageLoaded, setPrimaryImageLoaded] = useState(false);
|
||||
const [backdropImageLoaded, setBackdropImageLoaded] = useState(false);
|
||||
|
||||
const trigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 0,
|
||||
target: scrollTarget,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!appBarVisiblity) {
|
||||
dispatch(showAppBar());
|
||||
}
|
||||
dispatch(setBackdrop(trigger));
|
||||
dispatch(showBackButton());
|
||||
}, [trigger]);
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
});
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item, Series", id],
|
||||
queryFn: async () => {
|
||||
const result = await getUserLibraryApi(window.api).getItem({
|
||||
userId: user.data.Id,
|
||||
itemId: id,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
});
|
||||
if (item.isLoading) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
if (item.isSuccess) {
|
||||
return (
|
||||
<>
|
||||
<Box className="item-detail-backdrop">
|
||||
{item.data.BackdropImageTags.length != 0 && (
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data.ImageBlurHashes.Backdrop[
|
||||
item.data.BackdropImageTags[0]
|
||||
]
|
||||
}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={64}
|
||||
resolutionY={96}
|
||||
style={{
|
||||
aspectRatio: "0.666",
|
||||
}}
|
||||
className="item-detail-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
<Box
|
||||
recomponent="main"
|
||||
className="scrollY"
|
||||
sx={{
|
||||
display: "flex",
|
||||
pt: 11,
|
||||
px: 3,
|
||||
pb: 3,
|
||||
position: "relative",
|
||||
flexFlow: "column",
|
||||
gap: 5,
|
||||
}}
|
||||
ref={(node) => {
|
||||
if (node) {
|
||||
setScrollTarget(node);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Box className="item-detail-header">
|
||||
<Box className="item-detail-header-backdrop">
|
||||
{item.data.BackdropImageTags.length != 0 && (
|
||||
<img
|
||||
src={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
item.data.Id +
|
||||
"/Images/Backdrop"
|
||||
}
|
||||
style={{
|
||||
opacity: backdropImageLoaded
|
||||
? 1
|
||||
: 0,
|
||||
}}
|
||||
className="item-detail-image"
|
||||
onLoad={() =>
|
||||
setBackdropImageLoaded(true)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{item.data.BackdropImageTags.length != 0 && (
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data.ImageBlurHashes
|
||||
.Backdrop[
|
||||
item.data
|
||||
.BackdropImageTags[0]
|
||||
]
|
||||
}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={64}
|
||||
resolutionY={96}
|
||||
style={{
|
||||
aspectRatio: "0.666",
|
||||
}}
|
||||
className="item-detail-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
<Box
|
||||
sx={{ fontSize: "4em" }}
|
||||
className="item-detail-image-icon-container"
|
||||
>
|
||||
{TypeIconCollectionCard[item.data.Type]}
|
||||
</Box>
|
||||
</Box>
|
||||
<Box className="item-detail-image-container">
|
||||
{!!item.data.ImageTags.Primary && (
|
||||
<img
|
||||
src={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
item.data.Id +
|
||||
"/Images/Primary"
|
||||
}
|
||||
style={{
|
||||
opacity: primageImageLoaded
|
||||
? 1
|
||||
: 0,
|
||||
}}
|
||||
className="item-detail-image"
|
||||
onLoad={() =>
|
||||
setPrimaryImageLoaded(true)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{!!item.data.ImageBlurHashes.Primary && (
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data.ImageBlurHashes
|
||||
.Primary[
|
||||
item.data.ImageTags
|
||||
.Primary
|
||||
]
|
||||
}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={64}
|
||||
resolutionY={96}
|
||||
style={{
|
||||
aspectRatio: 0.666,
|
||||
}}
|
||||
className="item-detail-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
<div className="item-detail-image-icon-container">
|
||||
{TypeIconCollectionCard[item.data.Type]}
|
||||
</div>
|
||||
</Box>
|
||||
<Box className="item-detail-info-container">
|
||||
<Box
|
||||
className="item-detail-title-name"
|
||||
sx={{ mb: 2 }}
|
||||
>
|
||||
<Typography variant="h3">
|
||||
{item.data.Name}
|
||||
</Typography>
|
||||
{!!item.data.UserData
|
||||
.PlayedPercentage && (
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={
|
||||
item.data.UserData
|
||||
.PlayedPercentage
|
||||
}
|
||||
sx={{
|
||||
borderRadius: 1000,
|
||||
width: "75%",
|
||||
mt: 1,
|
||||
mb: 1,
|
||||
}}
|
||||
color="primary"
|
||||
/>
|
||||
)}
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
color="gray"
|
||||
>
|
||||
{item.data.OriginalTitle}
|
||||
</Typography>
|
||||
</Box>
|
||||
<Stack
|
||||
direction="row"
|
||||
gap={2}
|
||||
divider={
|
||||
<Divider
|
||||
variant="middle"
|
||||
flexItem
|
||||
orientation="vertical"
|
||||
/>
|
||||
}
|
||||
ex={{ alignItems: "center" }}
|
||||
>
|
||||
<Typography
|
||||
sx={{ flexGrow: 0 }}
|
||||
variant="subtitle1"
|
||||
>
|
||||
{item.data.ProductionYear}
|
||||
</Typography>
|
||||
<Chip
|
||||
variant="outlined"
|
||||
label={
|
||||
!!item.data.OfficialRating
|
||||
? item.data
|
||||
.OfficialRating
|
||||
: "Not Rated"
|
||||
}
|
||||
/>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
gap: "0.25em",
|
||||
alignItems: "center",
|
||||
}}
|
||||
className="item-detail-info-rating"
|
||||
>
|
||||
{!!item.data.CommunityRating ? (
|
||||
<>
|
||||
<MdiStarHalfFull />
|
||||
<Typography variant="subtitle1">
|
||||
{Math.round(
|
||||
item.data
|
||||
.CommunityRating *
|
||||
10,
|
||||
) / 10}
|
||||
</Typography>
|
||||
</>
|
||||
) : (
|
||||
<Typography variant="subtitle1">
|
||||
No Community Rating
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
<Typography variant="subtitle1">
|
||||
{getRuntimeFull(
|
||||
item.data.RunTimeTicks,
|
||||
)}
|
||||
</Typography>
|
||||
</Stack>
|
||||
</Box>
|
||||
</Box>
|
||||
<Box className="item-media-container">
|
||||
<Stack
|
||||
direction="row"
|
||||
gap={1}
|
||||
alignItems="center"
|
||||
>
|
||||
<Typography variant="h5">Genre</Typography>
|
||||
{item.data.Genres.map((genre, index) => {
|
||||
return (
|
||||
<Chip
|
||||
key={index}
|
||||
variant="filled"
|
||||
label={genre}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</Stack>
|
||||
</Box>
|
||||
<Typography variant="body1">
|
||||
{item.data.Overview}
|
||||
</Typography>
|
||||
<CardScroller displayCards={8} title="Cast">
|
||||
{item.data.People.map((person, index) => {
|
||||
return (
|
||||
<Card
|
||||
key={index}
|
||||
itemName={person.Name}
|
||||
itemId={person.Id}
|
||||
// imageTags={false}
|
||||
imageTags={
|
||||
!!person.PrimaryImageTag
|
||||
}
|
||||
iconType="Person"
|
||||
subText={person.Role}
|
||||
cardOrientation="sqaure"
|
||||
currentUser={user.data}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
if (item.isError) {
|
||||
return <h1>{"Something went wrong :("}</h1>;
|
||||
}
|
||||
};
|
||||
|
||||
export default ItemSeries;
|
||||
@@ -0,0 +1,829 @@
|
||||
/** @format */
|
||||
import { useState, useEffect } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import {
|
||||
showAppBar,
|
||||
setBackdrop,
|
||||
showBackButton,
|
||||
} from "../../utils/slice/appBar";
|
||||
import { useParams, useNavigate } from "react-router-dom";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import Grid2 from "@mui/material/Unstable_Grid2";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import AppBar from "@mui/material/AppBar";
|
||||
import Toolbar from "@mui/material/Toolbar";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import Checkbox from "@mui/material/Checkbox";
|
||||
import Menu from "@mui/material/Menu";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import Accordion from "@mui/material/Accordion";
|
||||
import AccordionSummary from "@mui/material/AccordionSummary";
|
||||
import AccordionDetails from "@mui/material/AccordionDetails";
|
||||
import Button from "@mui/material/Button";
|
||||
|
||||
import { theme } from "../../theme";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getArtistsApi } from "@jellyfin/sdk/lib/utils/api/artists-api";
|
||||
import { getGenresApi } from "@jellyfin/sdk/lib/utils/api/genres-api";
|
||||
import { getMusicGenresApi } from "@jellyfin/sdk/lib/utils/api/music-genres-api";
|
||||
import { getStudiosApi } from "@jellyfin/sdk/lib/utils/api/studios-api";
|
||||
import { getPersonsApi } from "@jellyfin/sdk/lib/utils/api/persons-api";
|
||||
|
||||
import { Card } from "../../components/card/card";
|
||||
import { EmptyNotice } from "../../components/emptyNotice/emptyNotice";
|
||||
|
||||
import { MdiSortDescending } from "../../components/icons/mdiSortDescending";
|
||||
import { MdiSortAscending } from "../../components/icons/mdiSortAscending";
|
||||
import { MdiChevronDown } from "../../components/icons/mdiChevronDown";
|
||||
import { MdiFilterOutline } from "../../components/icons/mdiFilterOutline";
|
||||
|
||||
const LibraryView = () => {
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
const appBarVisiblity = useSelector((state) => state.appBar.visible);
|
||||
|
||||
if (!appBarVisiblity) {
|
||||
dispatch(showAppBar());
|
||||
}
|
||||
const { id } = useParams();
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["libraryView", "user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
});
|
||||
|
||||
const [sortAscending, setSortAscending] = useState(false);
|
||||
const [sortBy, setSortBy] = useState("SortName");
|
||||
const [sortByData, setSortByData] = useState([
|
||||
{ title: "Name", value: "SortName" },
|
||||
{ title: "Rating", value: "CommunityRating" },
|
||||
{ title: "Release Date", value: "PremiereDate" },
|
||||
]);
|
||||
const handleSortChange = (e) => {
|
||||
setSortAscending(e.target.checked);
|
||||
};
|
||||
const handleSortBy = (e) => {
|
||||
setSortBy(e.target.value);
|
||||
};
|
||||
|
||||
const fetchLib = async (libraryId) => {
|
||||
const result = await getItemsApi(window.api).getItems({
|
||||
userId: user.data.Id,
|
||||
ids: [libraryId],
|
||||
});
|
||||
return result.data;
|
||||
};
|
||||
const currentLib = useQuery({
|
||||
queryKey: ["libraryView", "currentLib", id],
|
||||
queryFn: () => fetchLib(id),
|
||||
enabled: !!user.data,
|
||||
});
|
||||
|
||||
if (currentLib.isSuccess) {
|
||||
dispatch(showBackButton());
|
||||
}
|
||||
|
||||
const [isPlayed, setIsPlayed] = useState(false);
|
||||
const [isUnPlayed, setIsUnPlayed] = useState(false);
|
||||
const [isResumable, setIsResumable] = useState(false);
|
||||
const [isFavourite, setIsFavourite] = useState(false);
|
||||
const [isLiked, setIsLiked] = useState(false);
|
||||
const [isUnliked, setIsUnliked] = useState(false);
|
||||
const availableWatchStatus = [
|
||||
{
|
||||
title: "Played",
|
||||
value: false,
|
||||
state: (val) => setIsPlayed(val),
|
||||
},
|
||||
{
|
||||
title: "Unplayed",
|
||||
value: false,
|
||||
state: (val) => setIsUnPlayed(val),
|
||||
},
|
||||
{
|
||||
title: "Resumable",
|
||||
value: false,
|
||||
state: (val) => setIsResumable(val),
|
||||
},
|
||||
{
|
||||
title: "Favourite",
|
||||
value: false,
|
||||
state: (val) => setIsFavourite(val),
|
||||
},
|
||||
{
|
||||
title: "Liked",
|
||||
value: false,
|
||||
state: (val) => setIsLiked(val),
|
||||
},
|
||||
{
|
||||
title: "UnLiked",
|
||||
value: false,
|
||||
state: (val) => setIsUnliked(val),
|
||||
},
|
||||
];
|
||||
|
||||
const [hasSubtitles, setHasSubtitles] = useState(false);
|
||||
const [hasTrailer, setHasTrailer] = useState(false);
|
||||
const [hasSpecialFeature, setHasSpecialFeature] = useState(false);
|
||||
const [hasThemeSong, setHasThemeSong] = useState(false);
|
||||
const [hasThemeVideo, setHasThemeVideo] = useState(false);
|
||||
const availableFeatureFilters = [
|
||||
{
|
||||
title: "Subtitles",
|
||||
value: false,
|
||||
state: (val) => setHasSubtitles(val),
|
||||
},
|
||||
{
|
||||
title: "Trailer",
|
||||
value: false,
|
||||
state: (val) => setHasTrailer(val),
|
||||
},
|
||||
{
|
||||
title: "Special Feature",
|
||||
value: false,
|
||||
state: (val) => setHasSpecialFeature(val),
|
||||
},
|
||||
{
|
||||
title: "Theme Song",
|
||||
value: false,
|
||||
state: (val) => setHasThemeSong(val),
|
||||
},
|
||||
{
|
||||
title: "Theme Video",
|
||||
vslue: false,
|
||||
state: (val) => setHasThemeVideo(val),
|
||||
},
|
||||
];
|
||||
|
||||
const [isBluRay, setIsBluRay] = useState(false);
|
||||
const [isDVD, setIsDVD] = useState(false);
|
||||
const [isHD, setIsHD] = useState(false);
|
||||
const [is4K, setIs4K] = useState(false);
|
||||
const [is3D, setIs3D] = useState(false);
|
||||
const availableVideoTypeFilters = [
|
||||
{ title: "Blu-Ray", value: false, state: (val) => setIsBluRay(val) },
|
||||
{ title: "DVD", value: false, state: (val) => setIsDVD(val) },
|
||||
{ title: "HD", value: false, state: (val) => setIsHD(val) },
|
||||
{ title: "4K", value: false, state: (val) => setIs4K(val) },
|
||||
{ title: "3D", value: false, state: (val) => setIs3D(val) },
|
||||
];
|
||||
|
||||
const [currentViewType, setCurrentViewType] = useState(undefined);
|
||||
const [viewType, setViewType] = useState([]);
|
||||
useEffect(() => {
|
||||
if (currentLib.isSuccess) {
|
||||
if (currentLib.data.Items[0].CollectionType == "movies") {
|
||||
setViewType([
|
||||
{ title: "Movies", value: "Movie" },
|
||||
{ title: "Collections", value: "BoxSet" },
|
||||
{ title: "Actors", value: "Person" },
|
||||
{ title: "Genres", value: "Genre" },
|
||||
{ title: "Studios", value: "Studio" },
|
||||
]);
|
||||
} else if (currentLib.data.Items[0].CollectionType == "music") {
|
||||
setViewType([
|
||||
{ title: "Albums", value: "MusicAlbum" },
|
||||
{ title: "Artists", value: "MusicArtist" },
|
||||
{ title: "Genres", value: "MusicGenre" },
|
||||
]);
|
||||
} else if (
|
||||
currentLib.data.Items[0].CollectionType == "tvshows"
|
||||
) {
|
||||
setViewType([
|
||||
{ title: "Series", value: "Series" },
|
||||
{ title: "Actors", value: "Person" },
|
||||
{ title: "Genres", value: "Genre" },
|
||||
{ title: "Networks", value: "Studio" },
|
||||
]);
|
||||
} else {
|
||||
setViewType([]);
|
||||
}
|
||||
}
|
||||
}, [currentLib.isSuccess]);
|
||||
|
||||
const fetchLibItems = async (libraryId) => {
|
||||
let result;
|
||||
if (currentViewType == "MusicArtist") {
|
||||
result = await getArtistsApi(window.api).getAlbumArtists({
|
||||
userId: user.data.Id,
|
||||
parentId: libraryId,
|
||||
});
|
||||
} else if (currentViewType == "Person") {
|
||||
result = await getPersonsApi(window.api).getPersons({
|
||||
userId: user.data.Id,
|
||||
personTypes: ["Actor"],
|
||||
});
|
||||
} else if (currentViewType == "Genre") {
|
||||
result = await getGenresApi(window.api).getGenres({
|
||||
userId: user.data.Id,
|
||||
parentId: libraryId,
|
||||
});
|
||||
} else if (currentViewType == "MusicGenre") {
|
||||
result = await getMusicGenresApi(window.api).getMusicGenres({
|
||||
userId: user.data.Id,
|
||||
parentId: libraryId,
|
||||
});
|
||||
} else if (currentViewType == "Studio") {
|
||||
result = await getStudiosApi(window.api).getStudios({
|
||||
userId: user.data.Id,
|
||||
parentId: libraryId,
|
||||
});
|
||||
} else {
|
||||
result = await getItemsApi(window.api).getItems({
|
||||
userId: user.data.Id,
|
||||
parentId: libraryId,
|
||||
recursive: true,
|
||||
includeItemTypes: [currentViewType],
|
||||
sortOrder: [sortAscending ? "Ascending" : "Descending"],
|
||||
sortBy: sortBy,
|
||||
filters: [
|
||||
isPlayed && "IsPlayed",
|
||||
isUnPlayed && "IsUnplayed",
|
||||
isResumable && "IsResumable",
|
||||
isFavourite && "IsFavorite",
|
||||
isLiked && "IsFavoriteOrLikes",
|
||||
isUnliked && "Dislikes",
|
||||
],
|
||||
hasSubtitles: hasSubtitles ? true : undefined,
|
||||
hasTrailer: hasTrailer ? true : undefined,
|
||||
hasSpecialFeature: hasSpecialFeature ? true : undefined,
|
||||
hasThemeSong: hasThemeSong ? true : undefined,
|
||||
hasThemeVideo: hasThemeVideo ? true : undefined,
|
||||
videoTypes: [isBluRay && "BluRay", isDVD && "Dvd"],
|
||||
isHd: isHD ? true : undefined,
|
||||
is4K: is4K ? true : undefined,
|
||||
is3D: is3D ? true : undefined,
|
||||
});
|
||||
}
|
||||
return result.data;
|
||||
};
|
||||
|
||||
const items = useQuery({
|
||||
queryKey: [
|
||||
"libraryView",
|
||||
"currentLibItems",
|
||||
id,
|
||||
[
|
||||
currentViewType,
|
||||
sortAscending,
|
||||
sortBy,
|
||||
[
|
||||
isPlayed,
|
||||
isUnPlayed,
|
||||
isResumable,
|
||||
isFavourite,
|
||||
isLiked,
|
||||
isUnliked,
|
||||
],
|
||||
[
|
||||
hasSubtitles,
|
||||
hasTrailer,
|
||||
hasSpecialFeature,
|
||||
hasThemeSong,
|
||||
hasThemeVideo,
|
||||
],
|
||||
[isBluRay, isDVD, isHD, is4K, is3D],
|
||||
],
|
||||
],
|
||||
queryFn: () => fetchLibItems(id),
|
||||
enabled: !!user.data,
|
||||
});
|
||||
|
||||
dispatch(setBackdrop(true));
|
||||
|
||||
const handleCurrentViewType = (e) => {
|
||||
setCurrentViewType(e.target.value);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (viewType.length != 0) setCurrentViewType(viewType[0].value);
|
||||
}, [viewType]);
|
||||
|
||||
const allowedSortViews = ["Movie", "Series", "MusicAlbum"];
|
||||
const allowedFilterViews = ["movies", "tvshows", "music", "books"];
|
||||
const onlyStatusFilterViews = ["books", "music"];
|
||||
|
||||
const [filterButtonAnchorEl, setFilterButtonAnchorEl] = useState(null);
|
||||
const filterMenuOpen = Boolean(filterButtonAnchorEl);
|
||||
const openFiltersMenu = (event) => {
|
||||
setFilterButtonAnchorEl(event.currentTarget);
|
||||
};
|
||||
const closeFiltersMenu = () => {
|
||||
setFilterButtonAnchorEl(null);
|
||||
};
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
component="main"
|
||||
className="scrollY"
|
||||
sx={{
|
||||
flexGrow: 1,
|
||||
pt: 19,
|
||||
px: 3,
|
||||
pb: 3,
|
||||
position: "relative",
|
||||
}}
|
||||
>
|
||||
<AppBar
|
||||
position="fixed"
|
||||
elevation={0}
|
||||
sx={{
|
||||
width: `calc(100vw - ${theme.spacing(7)} - 10px)`,
|
||||
mt: 8,
|
||||
}}
|
||||
>
|
||||
<Divider />
|
||||
<Toolbar sx={{ justifyContent: "space-between" }}>
|
||||
<Stack alignItems="center" direction="row">
|
||||
<Typography
|
||||
variant="h5"
|
||||
sx={{ mr: 2, flexShrink: 0 }}
|
||||
noWrap
|
||||
>
|
||||
{currentLib.isLoading ? (
|
||||
<CircularProgress sx={{ p: 1 }} />
|
||||
) : (
|
||||
currentLib.data.Items[0].Name
|
||||
)}
|
||||
</Typography>
|
||||
<Chip
|
||||
label={
|
||||
items.isLoading ? (
|
||||
<CircularProgress
|
||||
sx={{ p: 1.5 }}
|
||||
/>
|
||||
) : (
|
||||
items.data.TotalRecordCount
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Stack>
|
||||
|
||||
{/* <InputLabel id="demo-simple-select-label">
|
||||
Age
|
||||
</InputLabel> */}
|
||||
<Stack
|
||||
direction="row"
|
||||
spacing={2}
|
||||
divider={
|
||||
<Divider
|
||||
orientation="vertical"
|
||||
flexItem
|
||||
variant="inset"
|
||||
/>
|
||||
}
|
||||
>
|
||||
{currentLib.isSuccess &&
|
||||
allowedFilterViews.includes(
|
||||
currentLib.data.Items[0]
|
||||
.CollectionType,
|
||||
) && (
|
||||
<>
|
||||
<Button
|
||||
id="basic-button"
|
||||
aria-controls={
|
||||
open
|
||||
? "basic-menu"
|
||||
: undefined
|
||||
}
|
||||
aria-haspopup="true"
|
||||
aria-expanded={
|
||||
open
|
||||
? "true"
|
||||
: undefined
|
||||
}
|
||||
startIcon={
|
||||
<MdiFilterOutline />
|
||||
}
|
||||
endIcon={
|
||||
<MdiChevronDown />
|
||||
}
|
||||
onClick={openFiltersMenu}
|
||||
color="white"
|
||||
// sx={{ p: 1 }}
|
||||
// size="small"
|
||||
>
|
||||
Filter
|
||||
</Button>
|
||||
<Menu
|
||||
id="basic-menu"
|
||||
anchorEl={
|
||||
filterButtonAnchorEl
|
||||
}
|
||||
open={filterMenuOpen}
|
||||
onClose={
|
||||
closeFiltersMenu
|
||||
}
|
||||
MenuListProps={{
|
||||
"aria-labelledby":
|
||||
"basic-button",
|
||||
sx: { p: 1 },
|
||||
}}
|
||||
anchorOrigin={{
|
||||
vertical: "bottom",
|
||||
horizontal:
|
||||
"center",
|
||||
}}
|
||||
transformOrigin={{
|
||||
vertical: "top",
|
||||
horizontal:
|
||||
"center",
|
||||
}}
|
||||
sx={{
|
||||
maxHeight: "55%",
|
||||
}}
|
||||
>
|
||||
<Accordion>
|
||||
<AccordionSummary
|
||||
expandIcon={
|
||||
<MdiChevronDown />
|
||||
}
|
||||
aria-controls="panel1bh-content"
|
||||
id="panel1bh-header"
|
||||
>
|
||||
<Typography
|
||||
sx={{
|
||||
width: "33%",
|
||||
flexShrink: 0,
|
||||
}}
|
||||
>
|
||||
Status
|
||||
</Typography>
|
||||
</AccordionSummary>
|
||||
<Divider />
|
||||
<AccordionDetails
|
||||
sx={{
|
||||
maxHeight:
|
||||
"15em",
|
||||
overflow:
|
||||
"auto",
|
||||
}}
|
||||
>
|
||||
<Stack>
|
||||
{availableWatchStatus.map(
|
||||
(
|
||||
item,
|
||||
index,
|
||||
) => {
|
||||
return (
|
||||
<MenuItem
|
||||
sx={{
|
||||
justifyContent:
|
||||
"space-between",
|
||||
}}
|
||||
key={
|
||||
index
|
||||
}
|
||||
>
|
||||
{
|
||||
item.title
|
||||
}
|
||||
<Checkbox
|
||||
value={
|
||||
item.value
|
||||
}
|
||||
onChange={(
|
||||
e,
|
||||
) =>
|
||||
item.state(
|
||||
e
|
||||
.target
|
||||
.checked,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</MenuItem>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</Stack>
|
||||
</AccordionDetails>
|
||||
</Accordion>
|
||||
{!onlyStatusFilterViews.includes(
|
||||
currentLib.data
|
||||
.Items[0]
|
||||
.CollectionType,
|
||||
) && (
|
||||
<Accordion>
|
||||
<AccordionSummary
|
||||
expandIcon={
|
||||
<MdiChevronDown />
|
||||
}
|
||||
aria-controls="panel1bh-content"
|
||||
id="panel1bh-header"
|
||||
>
|
||||
<Typography
|
||||
sx={{
|
||||
width: "33%",
|
||||
flexShrink: 0,
|
||||
}}
|
||||
>
|
||||
Features
|
||||
</Typography>
|
||||
</AccordionSummary>
|
||||
<Divider />
|
||||
<AccordionDetails
|
||||
sx={{
|
||||
maxHeight:
|
||||
"15em",
|
||||
overflow:
|
||||
"auto",
|
||||
}}
|
||||
>
|
||||
<Stack>
|
||||
{availableFeatureFilters.map(
|
||||
(
|
||||
item,
|
||||
index,
|
||||
) => {
|
||||
return (
|
||||
<MenuItem
|
||||
sx={{
|
||||
justifyContent:
|
||||
"space-between",
|
||||
}}
|
||||
key={
|
||||
index
|
||||
}
|
||||
>
|
||||
{
|
||||
item.title
|
||||
}
|
||||
<Checkbox
|
||||
value={
|
||||
item.value
|
||||
}
|
||||
onChange={(
|
||||
e,
|
||||
) =>
|
||||
item.state(
|
||||
e
|
||||
.target
|
||||
.checked,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</MenuItem>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</Stack>
|
||||
</AccordionDetails>
|
||||
</Accordion>
|
||||
)}
|
||||
{!onlyStatusFilterViews.includes(
|
||||
currentLib.data
|
||||
.Items[0]
|
||||
.CollectionType,
|
||||
) && (
|
||||
<Accordion>
|
||||
<AccordionSummary
|
||||
expandIcon={
|
||||
<MdiChevronDown />
|
||||
}
|
||||
aria-controls="panel1bh-content"
|
||||
id="panel1bh-header"
|
||||
>
|
||||
<Typography
|
||||
sx={{
|
||||
flexShrink: 0,
|
||||
}}
|
||||
noWrap
|
||||
>
|
||||
Video
|
||||
Type
|
||||
</Typography>
|
||||
</AccordionSummary>
|
||||
<Divider />
|
||||
<AccordionDetails
|
||||
sx={{
|
||||
maxHeight:
|
||||
"15em",
|
||||
overflow:
|
||||
"auto",
|
||||
}}
|
||||
>
|
||||
<Stack>
|
||||
{availableVideoTypeFilters.map(
|
||||
(
|
||||
item,
|
||||
index,
|
||||
) => {
|
||||
return (
|
||||
<MenuItem
|
||||
sx={{
|
||||
justifyContent:
|
||||
"space-between",
|
||||
}}
|
||||
key={
|
||||
index
|
||||
}
|
||||
>
|
||||
{
|
||||
item.title
|
||||
}
|
||||
<Checkbox
|
||||
value={
|
||||
item.value
|
||||
}
|
||||
onChange={(
|
||||
e,
|
||||
) =>
|
||||
item.state(
|
||||
e
|
||||
.target
|
||||
.checked,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</MenuItem>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</Stack>
|
||||
</AccordionDetails>
|
||||
</Accordion>
|
||||
)}
|
||||
</Menu>
|
||||
</>
|
||||
)}
|
||||
{allowedSortViews.includes(
|
||||
currentViewType,
|
||||
) && (
|
||||
<>
|
||||
<Checkbox
|
||||
icon={<MdiSortDescending />}
|
||||
checkedIcon={
|
||||
<MdiSortAscending />
|
||||
}
|
||||
color="white"
|
||||
onChange={handleSortChange}
|
||||
defaultValue={sortAscending}
|
||||
sx={{
|
||||
color: "white !important",
|
||||
}}
|
||||
/>
|
||||
<TextField
|
||||
select
|
||||
hiddenLabel
|
||||
defaultValue={
|
||||
sortByData[0].value
|
||||
}
|
||||
size="small"
|
||||
variant="filled"
|
||||
onChange={handleSortBy}
|
||||
>
|
||||
{sortByData.map(
|
||||
(item, index) => {
|
||||
return (
|
||||
<MenuItem
|
||||
key={
|
||||
item.value
|
||||
}
|
||||
value={
|
||||
item.value
|
||||
}
|
||||
>
|
||||
{`By ${item.title}`}
|
||||
</MenuItem>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</TextField>
|
||||
</>
|
||||
)}
|
||||
{viewType.length != 0 && (
|
||||
<TextField
|
||||
select
|
||||
hiddenLabel
|
||||
defaultValue={viewType[0].value}
|
||||
size="small"
|
||||
variant="filled"
|
||||
onChange={handleCurrentViewType}
|
||||
>
|
||||
{viewType.map((item, index) => {
|
||||
return (
|
||||
<MenuItem
|
||||
key={item.value}
|
||||
value={item.value}
|
||||
>
|
||||
{item.title}
|
||||
</MenuItem>
|
||||
);
|
||||
})}
|
||||
</TextField>
|
||||
)}
|
||||
</Stack>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
{items.isSuccess &&
|
||||
(items.data.TotalRecordCount == 0 ? (
|
||||
<EmptyNotice />
|
||||
) : (
|
||||
<Grid2
|
||||
container
|
||||
columns={{ xs: 3, sm: 5, md: 8 }}
|
||||
>
|
||||
{items.data.Items.map((item, index) => {
|
||||
return (
|
||||
<Grid2
|
||||
key={index}
|
||||
xs={1}
|
||||
sm={1}
|
||||
md={1}
|
||||
>
|
||||
<Card
|
||||
itemName={item.Name}
|
||||
itemId={item.Id}
|
||||
imageTags={
|
||||
!!item.ImageTags
|
||||
.Primary
|
||||
}
|
||||
subText={
|
||||
item.ProductionYear
|
||||
}
|
||||
iconType={item.Type}
|
||||
playedPercent={
|
||||
!!item.UserData
|
||||
? item.UserData
|
||||
.PlayedPercentage
|
||||
: 0
|
||||
}
|
||||
cardOrientation={
|
||||
item.Type ==
|
||||
"MusicArtist" ||
|
||||
item.Type ==
|
||||
"MusicAlbum" ||
|
||||
item.Type ==
|
||||
"MusicGenre" ||
|
||||
item.Type ==
|
||||
"Playlist"
|
||||
? "square"
|
||||
: "portait"
|
||||
}
|
||||
watchedStatus={
|
||||
!!item.UserData
|
||||
? item.UserData
|
||||
.Played
|
||||
: false
|
||||
}
|
||||
watchedCount={
|
||||
!!item.UserData &&
|
||||
item.UserData
|
||||
.UnplayedItemCount
|
||||
}
|
||||
blurhash={
|
||||
item.ImageBlurHashes ==
|
||||
{}
|
||||
? ""
|
||||
: !!item
|
||||
.ImageTags
|
||||
.Primary
|
||||
? !!item
|
||||
.ImageBlurHashes
|
||||
.Primary
|
||||
? item
|
||||
.ImageBlurHashes
|
||||
.Primary[
|
||||
item
|
||||
.ImageTags
|
||||
.Primary
|
||||
]
|
||||
: ""
|
||||
: ""
|
||||
}
|
||||
currentUser={user.data}
|
||||
onClickEvent={() => {
|
||||
navigate(
|
||||
`/item/${item.Type}/${item.Id}`,
|
||||
);
|
||||
}}
|
||||
></Card>
|
||||
</Grid2>
|
||||
);
|
||||
})}
|
||||
</Grid2>
|
||||
))}
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default LibraryView;
|
||||
+67
-63
@@ -1,12 +1,12 @@
|
||||
/** @format */
|
||||
|
||||
import { useState, useEffect, useMemo } from "react";
|
||||
import { Cookies, useCookies } from "react-cookie";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useNavigate, useParams, Link } from "react-router-dom";
|
||||
import { EventEmitter as event } from "../../eventEmitter.js";
|
||||
|
||||
import { getServer } from "../../utils/store/servers.js";
|
||||
import { saveUser } from "../../utils/store/user.js";
|
||||
import { getServer } from "../../utils/storage/servers.js";
|
||||
import { saveUser } from "../../utils/storage/user.js";
|
||||
|
||||
// import Icon from "mdi-material-ui";
|
||||
import { MdiEyeOffOutline } from "../../components/icons/mdiEyeOffOutline";
|
||||
@@ -28,14 +28,18 @@ import FormGroup from "@mui/material/FormGroup";
|
||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||
import Checkbox from "@mui/material/Checkbox";
|
||||
|
||||
import { AvatarCard, AvatarImage } from "../../components/avatar/avatar.jsx";
|
||||
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";
|
||||
|
||||
export const LoginWithImage = () => {
|
||||
const { userName, userId } = useParams();
|
||||
@@ -66,7 +70,7 @@ export const LoginWithImage = () => {
|
||||
|
||||
const authUser = async () => {
|
||||
try {
|
||||
const auth = await api.authenticateUserByName(
|
||||
const auth = await window.api.authenticateUserByName(
|
||||
userName,
|
||||
password.password,
|
||||
);
|
||||
@@ -86,7 +90,6 @@ export const LoginWithImage = () => {
|
||||
saveUser(userName, password.password);
|
||||
}
|
||||
event.emit("set-api-accessToken", window.api.basePath);
|
||||
// setAccessToken(user.data.AccessToken)
|
||||
setLoading(false);
|
||||
navigate(`/home`);
|
||||
};
|
||||
@@ -215,68 +218,52 @@ export const UserLogin = () => {
|
||||
const handleManualLogin = () => {
|
||||
navigate("/login/manual");
|
||||
};
|
||||
const getUsers = async () => {
|
||||
const users = await getUserApi(window.api).getPublicUsers();
|
||||
// console.log(users.data);
|
||||
return users;
|
||||
// return {};
|
||||
};
|
||||
|
||||
const createApi = async () => {
|
||||
const server = await getServer();
|
||||
event.emit("create-jellyfin-api", server.Ip);
|
||||
};
|
||||
|
||||
useMemo(() => {
|
||||
// TODO Implement a better way to check and create api object when page reloaded. Hint: Maybe use session api or something (*route - login*)
|
||||
if (!window.api) {
|
||||
createApi().then(() => {
|
||||
getUsers().then((users) => {
|
||||
setUsers(users.data);
|
||||
console.log(userList);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
getUsers().then((users) => {
|
||||
setUsers(users.data);
|
||||
console.log(userList);
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
const users = useQuery({
|
||||
queryKey: ["login", "users"],
|
||||
queryFn: async () => {
|
||||
const users = await getUserApi(window.api).getPublicUsers();
|
||||
// console.log(users.data);
|
||||
return users.data;
|
||||
// return {};
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<AppBarBackOnly />
|
||||
<Container maxWidth="md" className="centered">
|
||||
<Typography variant="h3" sx={{ marginBottom: "1em" }}>
|
||||
{/* <Typography variant="h3" sx={{ marginBottom: "1em" }}>
|
||||
Users
|
||||
</Typography>
|
||||
<div className="userList">
|
||||
{userList.map((item, index) => {
|
||||
return (
|
||||
//
|
||||
<Link
|
||||
to={`/login/withImg/${item.Name}/${item.Id}/`}
|
||||
key={item.Id}
|
||||
className="userCard"
|
||||
index={index}
|
||||
>
|
||||
{item.PrimaryImageTag ? (
|
||||
<AvatarCard
|
||||
userName={item.Name}
|
||||
userId={item.Id}
|
||||
userImageAvailable={true}
|
||||
></AvatarCard>
|
||||
) : (
|
||||
<AvatarCard
|
||||
userName={item.Name}
|
||||
userImageAvailable={false}
|
||||
></AvatarCard>
|
||||
)}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</Typography> */}
|
||||
{users.isLoading ? (
|
||||
<CardsSkeleton />
|
||||
) : (
|
||||
<CardScroller displayCards={5} title="Users">
|
||||
{users.data.map((item, index) => {
|
||||
return (
|
||||
//
|
||||
<Link
|
||||
to={`/login/withImg/${item.Name}/${item.Id}/`}
|
||||
key={item.Id}
|
||||
className="userCard"
|
||||
index={index}
|
||||
>
|
||||
<Card
|
||||
key={index}
|
||||
itemName={item.Name}
|
||||
itemId={item.Id}
|
||||
imageTags={
|
||||
!!item.PrimaryImageTag
|
||||
}
|
||||
// cardType="sqaure"
|
||||
iconType="Person"
|
||||
cardOrientation="sqaure"
|
||||
/>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
<div className="buttons">
|
||||
<Button
|
||||
color="secondary"
|
||||
@@ -311,6 +298,17 @@ export const UserLoginManual = () => {
|
||||
});
|
||||
const [userName, setUserName] = useState("");
|
||||
|
||||
const server = useQuery({
|
||||
queryKey: ["login, manual", "serverInfo"],
|
||||
queryFn: async () => {
|
||||
const result = await getBrandingApi(
|
||||
window.api,
|
||||
).getBrandingOptions();
|
||||
return result.data;
|
||||
},
|
||||
enabled: !window.api,
|
||||
});
|
||||
|
||||
const handleUsername = (event) => {
|
||||
setUserName(event.target.value);
|
||||
};
|
||||
@@ -331,7 +329,7 @@ export const UserLoginManual = () => {
|
||||
|
||||
const authUser = async () => {
|
||||
try {
|
||||
const auth = await api.authenticateUserByName(
|
||||
const auth = await window.api.authenticateUserByName(
|
||||
userName,
|
||||
password.password,
|
||||
);
|
||||
@@ -462,6 +460,12 @@ export const UserLoginManual = () => {
|
||||
Login
|
||||
</LoadingButton>
|
||||
</Grid>
|
||||
<Grid item xl={15} md={6} sx={{ width: "100%" }}>
|
||||
<Typography variant="subtitle2">
|
||||
{server.isSuccess &&
|
||||
server.data.LoginDisclaimer}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Container>
|
||||
</>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useNavigate } from "react-router-dom";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
import { EventEmitter as event } from "../../../eventEmitter.js";
|
||||
import { setServer } from "../../../utils/store/servers.js";
|
||||
import { setServer } from "../../../utils/storage/servers.js";
|
||||
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/** @format */
|
||||
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import sideBarReducer from "./utils/slice/sidemenu";
|
||||
import appBarReducer from "./utils/slice/appBar";
|
||||
export default configureStore({
|
||||
reducer: {
|
||||
sidebar: sideBarReducer,
|
||||
appBar: appBarReducer,
|
||||
},
|
||||
});
|
||||
+20
-1
@@ -1,4 +1,21 @@
|
||||
/** @format */
|
||||
::-webkit-scrollbar {
|
||||
z-index: 10000;
|
||||
width: 10px;
|
||||
background: $clr-background-dark;
|
||||
}
|
||||
::-webkit-scrollbar-track {
|
||||
z-index: 10000;
|
||||
background-color: transparent;
|
||||
&:hover {
|
||||
background: rgb(255 255 255 / 0.25);
|
||||
}
|
||||
}
|
||||
::-webkit-scrollbar-thumb {
|
||||
z-index: 10000;
|
||||
background: rgb(255 255 255 / 0.25);
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Open Sans";
|
||||
background: $clr-background-default;
|
||||
@@ -12,8 +29,9 @@ body {
|
||||
#root,
|
||||
.root-page {
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.centered {
|
||||
@@ -65,6 +83,7 @@ h1 {
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
height: 100vh;
|
||||
width: inherit;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
/** @format */
|
||||
|
||||
$clr-accent-default: hsl(337, 96%, 56%);
|
||||
$clr-accent-dark: hsl(337, 96%, 10%);
|
||||
$clr-secondary-default: hsl(273, 100%, 22%);
|
||||
$clr-accent-dark: hsl(337, 96%, 20%);
|
||||
$clr-secondary-default: hsl(273, 100%, 36%);
|
||||
$clr-secondary-dark: hsl(273, 100%, 12%);
|
||||
$clr-background-default: hsl(256, 100%, 6%);
|
||||
|
||||
$clr-background-dark: hsl(256, 100%, 4%);
|
||||
$clr-background-light: hsl(256, 100%, 16%);
|
||||
|
||||
$clr-gradient-default: linear-gradient(
|
||||
135deg,
|
||||
$clr-accent-default,
|
||||
$clr-secondary-default
|
||||
);
|
||||
$clr-gradient-dark: linear-gradient(
|
||||
135deg,
|
||||
$clr-accent-dark,
|
||||
$clr-secondary-dark
|
||||
);
|
||||
|
||||
$border-radius-default: 10px;
|
||||
$border-radius-intensity-1: 5px;
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@ export const theme = createTheme({
|
||||
default: clrBackgroundDefault,
|
||||
paper: clrBackgroundDark,
|
||||
},
|
||||
white: {
|
||||
main: "#ffffff",
|
||||
},
|
||||
mode: "dark",
|
||||
},
|
||||
typography: {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @format
|
||||
* @param {string} date - Date from server
|
||||
* @returns {string} Formated Date
|
||||
*/
|
||||
|
||||
export const formateDate = (date) => {
|
||||
date = new Date(date);
|
||||
date = new Intl.DateTimeFormat().format(date);
|
||||
return date;
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @format
|
||||
* @param {number} ticks - C# ticks of a particular item
|
||||
* @return {number} Converted ticks to Milliseconds
|
||||
*/
|
||||
|
||||
const ticksToMs = (ticks) => {
|
||||
return Math.round(ticks / 10000);
|
||||
};
|
||||
|
||||
export const getRuntime = (ticks) => {
|
||||
let time = ticksToMs(ticks);
|
||||
let formatedTime = "";
|
||||
let timeSec = Math.round(time / 1000);
|
||||
let timeMin = Math.round(timeSec / 60);
|
||||
if (timeMin > 60) {
|
||||
let timeHr = Math.floor(timeMin / 60);
|
||||
timeMin -= timeHr * 60;
|
||||
formatedTime = `${timeHr}hr ${timeMin}min`;
|
||||
} else {
|
||||
formatedTime = `${timeMin}min`;
|
||||
}
|
||||
return formatedTime;
|
||||
};
|
||||
|
||||
export const getRuntimeFull = (ticks) => {
|
||||
let time = ticksToMs(ticks);
|
||||
let formatedTime = "";
|
||||
let timeSec = Math.round(time / 1000);
|
||||
let timeMin = Math.round(timeSec / 60);
|
||||
if (timeMin > 60) {
|
||||
let timeHr = Math.floor(timeMin / 60);
|
||||
timeMin -= timeHr * 60;
|
||||
formatedTime = `${timeHr} hour ${timeMin} minutes`;
|
||||
} else {
|
||||
formatedTime = `${timeMin} minutes`;
|
||||
}
|
||||
return formatedTime;
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
/** @format */
|
||||
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
export const appBarSlice = createSlice({
|
||||
name: "appBar",
|
||||
initialState: {
|
||||
visible: false,
|
||||
backdrop: false,
|
||||
backButtonVisible: false,
|
||||
},
|
||||
reducers: {
|
||||
showAppBar: (state) => {
|
||||
state.visible = true;
|
||||
},
|
||||
hideAppBar: (state) => {
|
||||
state.visible = false;
|
||||
},
|
||||
setBackdrop: (state, action) => {
|
||||
state.backdrop = action.payload;
|
||||
},
|
||||
showBackButton: (state, action) => {
|
||||
state.backButtonVisible = true;
|
||||
},
|
||||
hideBackButton: (state) => {
|
||||
state.backButtonVisible = false;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const {
|
||||
showAppBar,
|
||||
hideAppBar,
|
||||
setBackdrop,
|
||||
showBackButton,
|
||||
hideBackButton,
|
||||
} = appBarSlice.actions;
|
||||
export default appBarSlice.reducer;
|
||||
@@ -0,0 +1,24 @@
|
||||
/** @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;
|
||||
@@ -8,8 +8,9 @@ const servers = new Store(".servers.dat");
|
||||
* Set server in .servers.dat
|
||||
* @param {object} data - Server info
|
||||
*/
|
||||
const setServer = (data) => {
|
||||
const setServer = async (data) => {
|
||||
let server = servers.set("server", data);
|
||||
await servers.save();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -26,6 +27,7 @@ const getServer = async () => {
|
||||
*/
|
||||
const delServer = async () => {
|
||||
await servers.delete("server");
|
||||
await servers.save();
|
||||
};
|
||||
|
||||
export { setServer, getServer, delServer };
|
||||
@@ -9,11 +9,12 @@ const user = new Store(".user.dat");
|
||||
* @param {string} userName - User's name
|
||||
* @param {string} userPassword - User's Password
|
||||
*/
|
||||
const saveUser = (userName, userPassword) => {
|
||||
const saveUser = async (userName, userPassword) => {
|
||||
let details = user.set("user", {
|
||||
Name: userName,
|
||||
Password: userPassword,
|
||||
Password: userPassword || "",
|
||||
});
|
||||
await user.save();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -25,4 +26,10 @@ const getUser = async () => {
|
||||
return details;
|
||||
};
|
||||
|
||||
export { saveUser, getUser };
|
||||
/**
|
||||
* Delete user from storage
|
||||
*/
|
||||
const delUser = async () => {
|
||||
await user.clear();
|
||||
};
|
||||
export { saveUser, getUser, delUser };
|
||||
Reference in new issue
Block a user