Compare commits
139
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7137cbc13e | ||
|
|
989542107f | ||
|
|
97981c7d35 | ||
|
|
797c80b8cd | ||
|
|
377f926fea | ||
|
|
dd4f5bab30 | ||
|
|
e47b7afd15 | ||
|
|
a16523118b | ||
|
|
b2aaed792e | ||
|
|
117ddba9b6 | ||
|
|
1a25bb20cb | ||
|
|
8ba41979e2 | ||
|
|
1bd295e0d4 | ||
|
|
479ae161b1 | ||
|
|
6957641999 | ||
|
|
419c76d81c | ||
|
|
bd5313ebf3 | ||
|
|
16dcff113d | ||
|
|
e2d50addc1 | ||
|
|
2ddaf61399 | ||
|
|
2570c96f31 | ||
|
|
fbe31a190a | ||
|
|
7c1df32117 | ||
|
|
b690ff5b3e | ||
|
|
a04e263ad5 | ||
|
|
0e0833876b | ||
|
|
4d92a059d1 | ||
|
|
5c41bfeca1 | ||
|
|
7df95a05ed | ||
|
|
3911459eed | ||
|
|
b1c0704bac | ||
|
|
9022dc16ab | ||
|
|
a08c51a00c | ||
|
|
ccb2a628cf | ||
|
|
d3708bd83b | ||
|
|
41c4c333d1 | ||
|
|
1d31496854 | ||
|
|
9c4c1191d8 | ||
|
|
ddd6485a0b | ||
|
|
53f042a453 | ||
|
|
a507b0a0c9 | ||
|
|
ed1633fb21 | ||
|
|
cf59815089 | ||
|
|
58dfe935c6 | ||
|
|
aef5629343 | ||
|
|
864219c0fe | ||
|
|
d9a12e24e7 | ||
|
|
fa3b2c7e6b | ||
|
|
0035488770 | ||
|
|
ac565b65fe | ||
|
|
464a3ff5a2 | ||
|
|
e9cd7c4e27 | ||
|
|
a6b377208f | ||
|
|
8ef12225c6 | ||
|
|
ca9cb9e7d6 | ||
|
|
201bc0b092 | ||
|
|
3f92769b86 | ||
|
|
b1d1985a80 | ||
|
|
d73eade38a | ||
|
|
9ad438429f | ||
|
|
0d3b7c855c | ||
|
|
45655b7464 | ||
|
|
dbe719744a | ||
|
|
fadc3f7a70 | ||
|
|
3d12d416f7 | ||
|
|
cfe0361224 | ||
|
|
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,19 @@
|
||||

|
||||
|
||||
# :memo: Prerequisites:
|
||||
# 📝 Prerequisites:
|
||||
- Nodejs (≥19.1.0)
|
||||
- Rust (≥1.66.1)
|
||||
- Visual Studio C++ Build tools
|
||||
|
||||
# :warning: Getting started:
|
||||
# ℹ️ Getting started:
|
||||
- Install Nodejs and Rust.
|
||||
> **Note** : Install Rust from https://www.rust-lang.org/learn/get-started
|
||||
- install depencies using npm:
|
||||
```shell
|
||||
npm install
|
||||
```
|
||||
|
||||
# :information_source: Development:
|
||||
# 🛠️ Development:
|
||||
- Running the app:
|
||||
```shell
|
||||
npm run tauri dev
|
||||
@@ -22,5 +24,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
+1377
-3070
File diff suppressed because it is too large.
Load diff
+24
-19
@@ -13,34 +13,39 @@
|
||||
"@emotion/react": "^11.10.5",
|
||||
"@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",
|
||||
"@jellyfin/sdk": "^0.8.2",
|
||||
"@mdi/js": "^7.2.96",
|
||||
"@mui/lab": "^5.0.0-alpha.128",
|
||||
"@mui/material": "^5.11.16",
|
||||
"@tanstack/react-query": "^4.26.1",
|
||||
"@tanstack/react-query-devtools": "^4.29.3",
|
||||
"@tauri-apps/api": "^1.2.0",
|
||||
"@videojs/http-streaming": "^3.0.2",
|
||||
"blurhash": "^2.0.5",
|
||||
"events": "^3.3.0",
|
||||
"framer-motion": "^7.10.2",
|
||||
"localforage": "^1.10.0",
|
||||
"match-sorter": "^6.3.1",
|
||||
"mdi-material-ui": "^7.6.0",
|
||||
"notistack": "^2.0.8",
|
||||
"framer-motion": "^10.12.4",
|
||||
"notistack": "^3.0.1",
|
||||
"react": "^18.2.0",
|
||||
"react-cookie": "^4.1.1",
|
||||
"react-blurhash": "^0.3.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-konami-code": "^2.3.0",
|
||||
"react-material-ui-carousel": "^3.4.2",
|
||||
"react-multi-carousel": "^2.8.2",
|
||||
"react-router-dom": "^6.4.3",
|
||||
"sort-by": "^1.2.0",
|
||||
"react-multi-carousel": "^2.8.3",
|
||||
"react-player": "^2.12.0",
|
||||
"react-router-dom": "^6.11.0",
|
||||
"tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store",
|
||||
"uuid": "^9.0.0",
|
||||
"vite-plugin-svgr": "^2.2.2"
|
||||
"vite-plugin-svgr": "^3.2.0",
|
||||
"zustand": "^4.3.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^1.2.2",
|
||||
"@types/react": "^18.0.24",
|
||||
"@types/react-dom": "^18.0.8",
|
||||
"@vitejs/plugin-react": "^2.2.0",
|
||||
"sass": "^1.56.1",
|
||||
"vite": "^3.2.3"
|
||||
"@types/react": "^18.2.0",
|
||||
"@types/react-dom": "^18.2.1",
|
||||
"@vitejs/plugin-react": "^4.0.0",
|
||||
"sass": "^1.62.1",
|
||||
"video.js": "^8.3.0",
|
||||
"vite": "^4.3.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", "shell-all", "window-set-fullscreen"] }
|
||||
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||
|
||||
[features]
|
||||
|
||||
+13
-15
@@ -1,25 +1,23 @@
|
||||
#![cfg_attr(
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use tauri::Manager;
|
||||
|
||||
// Create the command:
|
||||
// This command must be async so that it doesn't run on the main thread.
|
||||
#[tauri::command]
|
||||
async fn close_splashscreen(window: tauri::Window) {
|
||||
// Close splashscreen
|
||||
if let Some(splashscreen) = window.get_window("splashscreen") {
|
||||
splashscreen.close().unwrap();
|
||||
}
|
||||
// Show main window
|
||||
window.get_window("main").unwrap().show().unwrap();
|
||||
// Close splashscreen
|
||||
if let Some(splashscreen) = window.get_window("splashscreen") {
|
||||
splashscreen.close().unwrap();
|
||||
}
|
||||
// Show main window
|
||||
window.get_window("main").unwrap().show().unwrap();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![close_splashscreen])
|
||||
.plugin(tauri_plugin_store::Builder::default().build())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![close_splashscreen])
|
||||
.plugin(tauri_plugin_store::Builder::default().build())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
@@ -8,11 +8,23 @@
|
||||
},
|
||||
"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
|
||||
},
|
||||
"window": {
|
||||
"setFullscreen": true
|
||||
},
|
||||
"shell": {
|
||||
"all": true
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
|
||||
+174
-91
@@ -1,13 +1,16 @@
|
||||
/** @format */
|
||||
|
||||
import { useState, useMemo } from "react";
|
||||
import React, { useState } from "react";
|
||||
|
||||
import Konami from "react-konami-code";
|
||||
// @ts-ignore
|
||||
const Kon = Konami.default ? Konami.default : Konami;
|
||||
|
||||
import { ThemeProvider } from "@mui/material/styles";
|
||||
import { SnackbarProvider } from "notistack";
|
||||
import { useCookies, Cookies } from "react-cookie";
|
||||
import {
|
||||
Routes,
|
||||
Route,
|
||||
Navigate,
|
||||
useNavigate,
|
||||
useLocation,
|
||||
Outlet,
|
||||
@@ -20,6 +23,8 @@ import { relaunch } from "@tauri-apps/api/process";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
|
||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||
|
||||
// Theming
|
||||
import CssBaseline from "@mui/material/CssBaseline";
|
||||
import { theme } from "./theme";
|
||||
@@ -36,13 +41,19 @@ import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
|
||||
// Routes
|
||||
import { ServerSetup, ServerList } from "./routes/setup/server/root";
|
||||
import { Home } from "./routes/home/root";
|
||||
import {
|
||||
UserLogin,
|
||||
LoginWithImage,
|
||||
UserLoginManual,
|
||||
} from "./routes/login/root";
|
||||
import { ServerSetup, ServerList } from "./routes/setup/server";
|
||||
import Home from "./routes/home";
|
||||
import { UserLogin, LoginWithImage, UserLoginManual } from "./routes/login";
|
||||
import LibraryView from "./routes/library";
|
||||
import ItemDetail from "./routes/item";
|
||||
import FavouritePage from "./routes/favourite/index.jsx";
|
||||
import Settings from "./routes/settings";
|
||||
import About from "./routes/about";
|
||||
|
||||
import { VideoPlayer } from "./routes/player/videoPlayer.jsx";
|
||||
|
||||
import { SideMenu } from "./components/menu/sidemenu.jsx";
|
||||
import { AppBar } from "./components/appBar/appBar.jsx";
|
||||
|
||||
// Fonts
|
||||
import "@fontsource/open-sans";
|
||||
@@ -51,8 +62,8 @@ 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 { delUser, getUser } from "./utils/storage/user.js";
|
||||
|
||||
const jellyfin = new Jellyfin({
|
||||
clientInfo: {
|
||||
@@ -66,10 +77,7 @@ const jellyfin = new Jellyfin({
|
||||
});
|
||||
|
||||
event.on("create-jellyfin-api", (serverAddress) => {
|
||||
window.api = jellyfin.createApi(
|
||||
serverAddress,
|
||||
sessionStorage.getItem("accessToken"),
|
||||
);
|
||||
window.api = jellyfin.createApi(serverAddress);
|
||||
// window.api = jellyfin.createApi(serverAddress);
|
||||
});
|
||||
event.on("set-api-accessToken", (serverAddress) => {
|
||||
@@ -81,16 +89,16 @@ event.on("set-api-accessToken", (serverAddress) => {
|
||||
|
||||
const anim = {
|
||||
initial: {
|
||||
transform: "scale(0.99)",
|
||||
opacity: 0,
|
||||
x: -50,
|
||||
},
|
||||
animate: {
|
||||
transform: "scale(1)",
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
},
|
||||
exit: {
|
||||
transform: "scale(0.99)",
|
||||
opacity: 0,
|
||||
x: 50,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -103,8 +111,7 @@ const AnimationWrapper = () => {
|
||||
animate="animate"
|
||||
exit="exit"
|
||||
transition={{
|
||||
duration: 0.3,
|
||||
ease: "easeInOut",
|
||||
duration: 0.35,
|
||||
}}
|
||||
>
|
||||
<Outlet />
|
||||
@@ -113,23 +120,22 @@ const AnimationWrapper = () => {
|
||||
};
|
||||
|
||||
function App() {
|
||||
const [userCookies] = useCookies(["user"]);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [serverReachable, setServerReachable] = useState(true);
|
||||
const [checkingServer, setChecking] = useState(false);
|
||||
|
||||
const createApi = async () => {
|
||||
const server = await getServer();
|
||||
event.emit("create-jellyfin-api", server.Ip);
|
||||
};
|
||||
|
||||
const serverAvailable = async () => {
|
||||
const server = await getServer();
|
||||
|
||||
if (server == null) {
|
||||
console.log("server not found");
|
||||
return false;
|
||||
} else {
|
||||
if (!window.api) {
|
||||
console.log("Creating Jf api (without accessToken)");
|
||||
event.emit("create-jellyfin-api", server.Ip);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -145,7 +151,6 @@ function App() {
|
||||
|
||||
const userSaved = async () => {
|
||||
const user = await getUser();
|
||||
console.log("User store => ", user);
|
||||
if (user == null) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -174,8 +179,10 @@ function App() {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
enqueueSnackbar("Unable to reach server", {
|
||||
variant: "error",
|
||||
});
|
||||
setServerReachable(false);
|
||||
console.error(error);
|
||||
setChecking(false);
|
||||
});
|
||||
};
|
||||
@@ -188,31 +195,36 @@ function App() {
|
||||
);
|
||||
sessionStorage.setItem("accessToken", auth.data.AccessToken);
|
||||
event.emit("set-api-accessToken", window.api.basePath);
|
||||
|
||||
navigate("/home");
|
||||
};
|
||||
|
||||
const LogicalRoutes = () => {
|
||||
serverAvailable().then(async (server) => {
|
||||
if (server == true) {
|
||||
pingServer();
|
||||
if (serverReachable == true) {
|
||||
userSaved().then((user_available) => {
|
||||
if (user_available == true) {
|
||||
userLogin();
|
||||
} else {
|
||||
usersAvailable().then(
|
||||
(users_list_available) => {
|
||||
if (users_list_available == true) {
|
||||
navigate("/login/users");
|
||||
} else {
|
||||
navigate("/login/manual");
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
createApi().then(() => {
|
||||
pingServer();
|
||||
if (serverReachable == true) {
|
||||
userSaved().then((user_available) => {
|
||||
if (user_available == true) {
|
||||
navigate("/home");
|
||||
} else {
|
||||
usersAvailable().then(
|
||||
(users_list_available) => {
|
||||
if (
|
||||
users_list_available ==
|
||||
true
|
||||
) {
|
||||
navigate("/login/users");
|
||||
} else {
|
||||
navigate(
|
||||
"/login/manual",
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
navigate("/setup/server");
|
||||
setChecking(false);
|
||||
@@ -230,15 +242,38 @@ function App() {
|
||||
});
|
||||
};
|
||||
|
||||
const handleRelaunch = async () => {
|
||||
await relaunch();
|
||||
const handleRelaunch = async (event, reason) => {
|
||||
if (reason && reason == "backdropClick") {
|
||||
return;
|
||||
}
|
||||
let result = await relaunch();
|
||||
};
|
||||
|
||||
const handleRemoveServer = async () => {
|
||||
await delServer();
|
||||
await delUser();
|
||||
let result = await relaunch();
|
||||
};
|
||||
const location = useLocation();
|
||||
|
||||
if (!window.api) {
|
||||
serverAvailable().then((available) => {
|
||||
if (available) {
|
||||
createApi().then(
|
||||
userSaved().then((userSavedBool) => {
|
||||
if (userSavedBool) {
|
||||
userLogin();
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
const [easterEgg, setEasterEgg] = useState(false);
|
||||
const sixtyNine = () => {
|
||||
setEasterEgg(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<SnackbarProvider maxSnack={5}>
|
||||
<ThemeProvider theme={theme}>
|
||||
@@ -247,7 +282,7 @@ function App() {
|
||||
sx={{
|
||||
display: "flex",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
height: "100vh",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
}}
|
||||
@@ -255,10 +290,26 @@ function App() {
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
)}
|
||||
|
||||
<Kon resetDelay={1000} action={sixtyNine}></Kon>
|
||||
<Dialog
|
||||
open={easterEgg}
|
||||
onClose={() => setEasterEgg(false)}
|
||||
>
|
||||
<iframe
|
||||
width="560"
|
||||
height="315"
|
||||
src="https://www.youtube.com/embed/dQw4w9WgXcQ?controls=0&autoplay=1"
|
||||
title="EasterEgg"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||
></iframe>
|
||||
</Dialog>
|
||||
{/* Show Dialog if server not reachable */}
|
||||
<Dialog
|
||||
open={!serverReachable}
|
||||
onClose={handleRelaunch}
|
||||
disableBa
|
||||
aria-labelledby="alert-dialog-text"
|
||||
aria-describedby="alert-dialog-desc"
|
||||
maxWidth="md"
|
||||
@@ -284,48 +335,80 @@ 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 />}>
|
||||
<Route
|
||||
path="/"
|
||||
element={<LogicalRoutes />}
|
||||
/>
|
||||
|
||||
{/* Logical Routes */}
|
||||
<Route
|
||||
path="/home"
|
||||
element={<Home />}
|
||||
/>
|
||||
<Route
|
||||
path="/setup/server"
|
||||
element={<ServerSetup />}
|
||||
/>
|
||||
<Route
|
||||
path="/servers/list"
|
||||
element={<ServerList />}
|
||||
/>
|
||||
<Route
|
||||
path="/login/withImg/:userName/:userId/"
|
||||
element={<LoginWithImage />}
|
||||
/>
|
||||
<Route
|
||||
path="/login/users"
|
||||
element={<UserLogin />}
|
||||
/>
|
||||
<Route
|
||||
path="/login/manual"
|
||||
element={<UserLoginManual />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/library/:id"
|
||||
element={<LibraryView />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/item/:id"
|
||||
element={<ItemDetail />}
|
||||
/>
|
||||
<Route
|
||||
path="/favourite"
|
||||
element={<FavouritePage />}
|
||||
/>
|
||||
<Route
|
||||
path="/settings"
|
||||
element={<Settings />}
|
||||
/>
|
||||
<Route
|
||||
path="/about"
|
||||
element={<About />}
|
||||
/>
|
||||
<Route
|
||||
path="/player"
|
||||
element={<VideoPlayer />}
|
||||
/>
|
||||
|
||||
<Route
|
||||
path="/"
|
||||
element={<LogicalRoutes />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/login"
|
||||
element={<LoginLogicalRoutes />}
|
||||
/>
|
||||
</Route>
|
||||
</Routes>
|
||||
<Route
|
||||
path="/login"
|
||||
element={<LoginLogicalRoutes />}
|
||||
/>
|
||||
</Route>
|
||||
</Routes>
|
||||
</div>
|
||||
</AnimatePresence>
|
||||
<ReactQueryDevtools />
|
||||
</ThemeProvider>
|
||||
</SnackbarProvider>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Part of the Jellyfin project (https://jellyfin.media)
|
||||
-
|
||||
- All copyright belongs to the Jellyfin contributors; a full list can
|
||||
- be found in the file CONTRIBUTORS.md
|
||||
-
|
||||
- This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||
- To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/.
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
<svg id="banner-dark" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1536 512">
|
||||
<defs>
|
||||
<linearGradient id="linear-gradient" x1="110.25" y1="213.3" x2="496.14" y2="436.09" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#aa5cc3"/>
|
||||
<stop offset="1" stop-color="#00a4dc"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<title>banner-dark</title>
|
||||
<g id="banner-dark">
|
||||
<g id="banner-dark-icon">
|
||||
<path id="inner-shape" d="M261.42,201.62c-20.44,0-86.24,119.29-76.2,139.43s142.48,19.92,152.4,0S281.86,201.63,261.42,201.62Z" fill="url(#linear-gradient)"/>
|
||||
<path id="outer-shape" d="M261.42,23.3C199.83,23.3,1.57,382.73,31.8,443.43s429.34,60,459.24,0S323,23.3,261.42,23.3ZM411.9,390.76c-19.59,39.33-281.08,39.77-300.9,0S221.1,115.48,261.45,115.48,431.49,351.42,411.9,390.76Z" fill="url(#linear-gradient)"/>
|
||||
</g>
|
||||
<g id="jellyfin-light-outlines" style="isolation:isolate" transform="translate(43.8)">
|
||||
<path d="M556.64,350.75a67,67,0,0,1-22.87-27.47,8.91,8.91,0,0,1-1.49-4.75,7.42,7.42,0,0,1,2.83-5.94,9.25,9.25,0,0,1,6.09-2.38c3.16,0,5.94,1.69,8.31,5.05a48.09,48.09,0,0,0,16.34,20.34,40.59,40.59,0,0,0,24,7.58q20.51,0,33.27-12.62t12.77-33.12V159a8.44,8.44,0,0,1,2.67-6.39,9.56,9.56,0,0,1,6.83-2.52,9,9,0,0,1,6.68,2.52,8.7,8.7,0,0,1,2.53,6.39v138.4a64.7,64.7,0,0,1-8.32,32.67,59,59,0,0,1-23,22.72Q608.62,361,589.9,361A57.21,57.21,0,0,1,556.64,350.75Z" fill="#fff"/>
|
||||
<path d="M831.66,279.47a8.77,8.77,0,0,1-6.24,2.53H713.16q0,17.82,7.27,31.92a54.91,54.91,0,0,0,20.79,22.28q13.51,8.18,31.93,8.17a54,54,0,0,0,25.54-5.94,52.7,52.7,0,0,0,18.12-15.15,10,10,0,0,1,6.24-2.67,8.14,8.14,0,0,1,7.72,7.72,8.81,8.81,0,0,1-3,6.24,74.7,74.7,0,0,1-23.91,19A65.56,65.56,0,0,1,773.45,361q-22.87,0-40.4-9.8a69.51,69.51,0,0,1-27.32-27.48q-9.79-17.66-9.8-40.83,0-24.36,9.65-42.62t25.69-27.92a65.2,65.2,0,0,1,34.16-9.65A70,70,0,0,1,798.84,211a65.78,65.78,0,0,1,25.39,24.36q9.81,16,10.1,38A8.07,8.07,0,0,1,831.66,279.47ZM733.5,231.8Q718.8,243.68,714.64,266H815.92v-2.38A46.91,46.91,0,0,0,807,240.27a48.47,48.47,0,0,0-18.56-15.15,54,54,0,0,0-23-5.2Q748.2,219.92,733.5,231.8Z" fill="#fff"/>
|
||||
<path d="M888.24,355.5a8.92,8.92,0,0,1-15.3-6.38v-202a8.91,8.91,0,1,1,17.82,0v202A8.65,8.65,0,0,1,888.24,355.5Z" fill="#fff"/>
|
||||
<path d="M956.55,355.5a8.92,8.92,0,0,1-15.3-6.38v-202a8.91,8.91,0,1,1,17.82,0v202A8.65,8.65,0,0,1,956.55,355.5Z" fill="#fff"/>
|
||||
<path d="M1122.86,206.11a8.7,8.7,0,0,1,2.53,6.39v131q0,23.44-9.21,40.09a61.58,61.58,0,0,1-25.54,25.25q-16.34,8.61-36.83,8.61a96.73,96.73,0,0,1-23.31-2.68,61.72,61.72,0,0,1-18-7.12q-6.24-3.87-6.24-8.62a17.94,17.94,0,0,1,.6-3,8.06,8.06,0,0,1,3-4.45,7.49,7.49,0,0,1,4.45-1.49,7.91,7.91,0,0,1,3.56.89q19,10.39,36.24,10.4,24.65,0,39.06-15.44t14.4-42.18V333.38a54.37,54.37,0,0,1-21.38,20,62.55,62.55,0,0,1-30.3,7.58q-25.83,0-39.2-15.45t-13.37-41.87V212.5a8.91,8.91,0,1,1,17.82,0V301q0,21.39,9.36,32.38t29.25,11a48,48,0,0,0,23.32-6.09,49.88,49.88,0,0,0,17.82-16,37.44,37.44,0,0,0,6.68-21.24V212.5a9,9,0,0,1,15.29-6.39Z" fill="#fff"/>
|
||||
<path d="M1210.18,161.41q-5.21,6.24-5.2,17.23v30.59h33.27a8.19,8.19,0,0,1,5.79,2.38,8.26,8.26,0,0,1,0,11.88,8.22,8.22,0,0,1-5.79,2.37H1205V349.12a8.91,8.91,0,1,1-17.82,0V225.86h-21.68a7.83,7.83,0,0,1-5.94-2.52,8.21,8.21,0,0,1-2.37-5.79,8,8,0,0,1,2.37-6.09,8.33,8.33,0,0,1,5.94-2.23h21.68V178.64q0-18.7,10.84-29t29-10.24a46.1,46.1,0,0,1,15.45,2.52q7.13,2.53,7.12,8.17a8.07,8.07,0,0,1-2.37,5.94,7.37,7.37,0,0,1-5.35,2.37,18.81,18.81,0,0,1-6.53-1.48,42,42,0,0,0-10.4-1.78Q1215.37,155.18,1210.18,161.41ZM1276,180.87c-2.19-1.88-3.27-4.61-3.27-8.17v-3q0-5.34,3.41-8.17t9.36-2.82q11.88,0,11.88,11v3c0,3.56-1,6.29-3.12,8.17s-5.1,2.82-9.06,2.82S1278.14,182.75,1276,180.87Zm15.59,174.63a8.92,8.92,0,0,1-15.3-6.38V212.5a8.91,8.91,0,1,1,17.82,0V349.12A8.65,8.65,0,0,1,1291.56,355.5Z" fill="#fff"/>
|
||||
<path d="M1452.53,218.88q12.92,16.2,12.92,42.92v87.32a8.4,8.4,0,0,1-2.67,6.38,8.8,8.8,0,0,1-6.24,2.53,8.64,8.64,0,0,1-8.91-8.91V262.69q0-19.31-9.65-31.33t-29.85-12a53.28,53.28,0,0,0-42.77,21.83,36.24,36.24,0,0,0-7.13,21.53v86.43a8.91,8.91,0,1,1-17.82,0V216.06a8.91,8.91,0,1,1,17.82,0V232.4q8-12.77,23-21.24A61.84,61.84,0,0,1,1412,202.7Q1439.61,202.7,1452.53,218.88Z" fill="#fff"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.7 KiB |
@@ -0,0 +1,184 @@
|
||||
/** @format */
|
||||
import { useEffect, useState } 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 ListItemIcon from "@mui/material/ListItemIcon";
|
||||
import Menu from "@mui/material/Menu";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||
|
||||
import { MdiMagnify } from "../icons/mdiMagnify";
|
||||
import { theme } from "../../theme";
|
||||
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import "./appBar.module.scss";
|
||||
import { MdiAccount } from "../icons/mdiAccount";
|
||||
import { MdiHeartOutline } from "../icons/mdiHeartOutline";
|
||||
import { MdiArrowLeft } from "../icons/mdiArrowLeft";
|
||||
import { MdiCog } from "../icons/mdiCog";
|
||||
import { MdiInformation } from "../icons/mdiInformation";
|
||||
|
||||
export const AppBar = () => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [display, setDisplay] = useState(false);
|
||||
const [backButtonVisible, setBackButtonVisible] = useState(false);
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
enabled: display,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const trigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 0,
|
||||
});
|
||||
|
||||
const [anchorEl, setAnchorEl] = useState(null);
|
||||
const openMenu = Boolean(anchorEl);
|
||||
const handleMenuOpen = (event) => {
|
||||
setAnchorEl(event.currentTarget);
|
||||
};
|
||||
const handleMenuClose = () => {
|
||||
setAnchorEl(null);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
location.pathname.includes("login") ||
|
||||
location.pathname.includes("setup") ||
|
||||
location.pathname.includes("player") ||
|
||||
location.pathname === "/"
|
||||
) {
|
||||
setDisplay(false);
|
||||
} else {
|
||||
setDisplay(true);
|
||||
}
|
||||
}, [location]);
|
||||
|
||||
useEffect(() => {
|
||||
if (location.pathname == "/home") {
|
||||
setBackButtonVisible(false);
|
||||
} else {
|
||||
setBackButtonVisible(true);
|
||||
}
|
||||
}, [location]);
|
||||
|
||||
if (!display) {
|
||||
return <></>;
|
||||
}
|
||||
if (display) {
|
||||
return (
|
||||
<MuiAppBar
|
||||
sx={{
|
||||
width: `calc(100vw - ${theme.spacing(7)})`,
|
||||
backgroundColor: "transparent",
|
||||
}}
|
||||
className={trigger ? "appBar backdropVisible" : "appBar"}
|
||||
elevation={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 }}
|
||||
onClick={handleMenuOpen}
|
||||
>
|
||||
{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>
|
||||
<Menu
|
||||
anchorEl={anchorEl}
|
||||
open={openMenu}
|
||||
onClose={handleMenuClose}
|
||||
sx={{ mt: 1 }}
|
||||
>
|
||||
<MenuItem
|
||||
onClick={() => navigate("/settings")}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<MdiCog />
|
||||
</ListItemIcon>
|
||||
Settings
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => navigate("/about")}>
|
||||
<ListItemIcon>
|
||||
<MdiInformation />
|
||||
</ListItemIcon>
|
||||
About
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</Box>
|
||||
</Toolbar>
|
||||
</MuiAppBar>
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
/** @format */
|
||||
|
||||
.appBar {
|
||||
transition: background-color $transition-time-fast,
|
||||
backdrop-filter $transition-time-fast,
|
||||
box-shadow $transition-time-default !important;
|
||||
&.backdropVisible {
|
||||
background-color: $clr-background-dark-opacity-0_8;
|
||||
backdrop-filter: blur(30px);
|
||||
}
|
||||
&-avatar {
|
||||
background: $clr-gradient-dark;
|
||||
&-icon {
|
||||
fill: url(#clr-gradient-default) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,69 +1,33 @@
|
||||
/** @format */
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Typography from "@mui/material/Typography";
|
||||
import ButtonBase from "@mui/material/ButtonBase";
|
||||
import Box from "@mui/material/Box";
|
||||
|
||||
import Account from "mdi-material-ui/Account";
|
||||
import { MdiAccount } from "../icons/mdiAccount";
|
||||
|
||||
import "./avatar.module.scss";
|
||||
|
||||
export const AvatarCard = ({ userName, userId, userImageAvailable }) => {
|
||||
export const AvatarImage = ({ userId, userImageTags }) => {
|
||||
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 }) => {
|
||||
return (
|
||||
<div className="avatar-image-container">
|
||||
<div
|
||||
className="avatar-image"
|
||||
style={{
|
||||
backgroundImage:
|
||||
"url('" +
|
||||
window.api.basePath +
|
||||
"/Users/" +
|
||||
userId +
|
||||
"/Images/Primary')",
|
||||
}}
|
||||
></div>
|
||||
<Box className="avatar-image-container">
|
||||
{!!userImageTags && (
|
||||
<div
|
||||
className="avatar-image"
|
||||
style={{
|
||||
backgroundImage:
|
||||
"url('" +
|
||||
window.api.basePath +
|
||||
"/Users/" +
|
||||
userId +
|
||||
"/Images/Primary')",
|
||||
}}
|
||||
></div>
|
||||
)}
|
||||
|
||||
<div className="avatar-image-icon-container">
|
||||
<Account className="avatar-image-icon" />
|
||||
<MdiAccount className="avatar-image-icon" />
|
||||
</div>
|
||||
</div>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -71,12 +35,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%;
|
||||
@@ -57,8 +18,8 @@
|
||||
&-icon {
|
||||
height: 100%;
|
||||
padding: 0.2em;
|
||||
background: $clr-accent-dark;
|
||||
color: $clr-accent-default;
|
||||
font-size: 6em !important;
|
||||
background: $clr-gradient-dark;
|
||||
fill: url(#clr-gradient-default) !important;
|
||||
font-size: 7em !important;
|
||||
}
|
||||
}
|
||||
+363
-89
@@ -1,110 +1,384 @@
|
||||
/** @format */
|
||||
import React from "react";
|
||||
import React, { useState } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import MuiCard from "@mui/material/Card";
|
||||
import CardContent from "@mui/material/CardContent";
|
||||
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 navigate = useNavigate();
|
||||
const [imgLoading, setImgLoading] = useState(true);
|
||||
const [isWatched, setIsWatched] = useState(watchedStatus);
|
||||
const [isFavorite, setisFavorite] = 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,
|
||||
});
|
||||
}
|
||||
setIsWatched(result.data.Played);
|
||||
setWatchedCountState(result.data.UnplayedItemCount);
|
||||
};
|
||||
const handleLiking = async () => {
|
||||
let result;
|
||||
if (isFavorite) {
|
||||
result = await getUserLibraryApi(window.api).unmarkFavoriteItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
} else if (!isFavorite) {
|
||||
result = await getUserLibraryApi(window.api).markFavoriteItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
}
|
||||
setisFavorite(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",
|
||||
"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
|
||||
sx={{ p: "1px" }}
|
||||
component={Box}
|
||||
onClick={
|
||||
!!onClickEvent
|
||||
? onClickEvent
|
||||
: () => {
|
||||
navigate(`/item/${itemId}`);
|
||||
}
|
||||
}
|
||||
className="cardBox"
|
||||
>
|
||||
<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?fillHeight=532&fillWidth=300&quality=96"
|
||||
}
|
||||
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={24}
|
||||
resolutionY={24}
|
||||
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.preventDefault();
|
||||
e.stopPropagation();
|
||||
handleMarkAsPlayOrUnMarkAsPlay();
|
||||
}}
|
||||
onFocus={(e) => e.stopPropagation}
|
||||
>
|
||||
<MdiCheck
|
||||
sx={{
|
||||
color: isWatched
|
||||
? green[400]
|
||||
: "white",
|
||||
}}
|
||||
/>
|
||||
</IconButton>
|
||||
)}
|
||||
{allowedLikeButton.includes(iconType) && (
|
||||
<IconButton
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
handleLiking();
|
||||
}}
|
||||
onFocus={(e) => e.stopPropagation}
|
||||
>
|
||||
{isFavorite ? (
|
||||
<MdiHeart
|
||||
sx={{ color: pink[700] }}
|
||||
/>
|
||||
) : (
|
||||
<MdiHeartOutline />
|
||||
)}
|
||||
</IconButton>
|
||||
)}
|
||||
</ButtonGroup>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<CardContent
|
||||
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="subtitle1"
|
||||
component="div"
|
||||
textAlign="left"
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
noWrap
|
||||
sx={{ opacity: 0.5 }}
|
||||
>
|
||||
{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,92 @@
|
||||
/** @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;
|
||||
box-shadow: 0 0 7px rgb(0 0 0 / 0.2);
|
||||
}
|
||||
&-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;
|
||||
&Box:hover .card-media-overlay,
|
||||
&Box:focus-within .card-media-overlay,
|
||||
&Box:focus .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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,421 @@
|
||||
/** @format */
|
||||
import React, { useState } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
import Divider from "@mui/material/Divider";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Box from "@mui/material/Box";
|
||||
import MuiCard from "@mui/material/Card";
|
||||
import CardContent from "@mui/material/CardContent";
|
||||
import CardMedia from "@mui/material/CardMedia";
|
||||
import CardActionArea from "@mui/material/CardActionArea";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import ButtonGroup from "@mui/material/ButtonGroup";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import { green, pink } from "@mui/material/colors";
|
||||
|
||||
import { TypeIconCollectionCard } from "../utils/iconsCollection";
|
||||
|
||||
import { borderRadiusDefault } from "../../palette.module.scss";
|
||||
import "./card.module.scss";
|
||||
import { MdiCheck } from "../icons/mdiCheck";
|
||||
|
||||
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { MdiHeartOutline } from "../icons/mdiHeartOutline";
|
||||
import { MdiHeart } from "../icons/mdiHeart";
|
||||
import { endsAt, getRuntime } from "../../utils/date/time";
|
||||
import { MdiStarHalfFull } from "../icons/mdiStarHalfFull";
|
||||
|
||||
export const EpisodeCard = ({
|
||||
itemName,
|
||||
itemRating,
|
||||
itemTicks,
|
||||
itemId,
|
||||
imageTags,
|
||||
subText = "",
|
||||
playedPercent,
|
||||
cardProps,
|
||||
onClickEvent,
|
||||
watchedStatus,
|
||||
blurhash,
|
||||
currentUser,
|
||||
favourite,
|
||||
showName,
|
||||
episodeLocation,
|
||||
centerAlignText = false,
|
||||
parentId,
|
||||
}) => {
|
||||
const navigate = useNavigate();
|
||||
const [imgLoaded, setImgLoaded] = useState(false);
|
||||
const [isWatched, setIsWatched] = useState(watchedStatus);
|
||||
const [isFavourite, setIsFavourite] = useState(favourite);
|
||||
const handleMarkAsPlayOrUnMarkAsPlay = async () => {
|
||||
let result;
|
||||
if (!isWatched) {
|
||||
result = await getPlaystateApi(window.api).markPlayedItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
} else if (isWatched) {
|
||||
result = await getPlaystateApi(window.api).markUnplayedItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
}
|
||||
setIsWatched(result.data.Played);
|
||||
};
|
||||
const handleLiking = async () => {
|
||||
let result;
|
||||
if (isFavourite) {
|
||||
result = await getUserLibraryApi(window.api).unmarkFavoriteItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
} else if (!isFavourite) {
|
||||
result = await getUserLibraryApi(window.api).markFavoriteItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
}
|
||||
setIsFavourite(result.data.IsFavorite);
|
||||
};
|
||||
|
||||
return (
|
||||
<MuiCard
|
||||
className="card landscape"
|
||||
sx={{
|
||||
background: "transparent",
|
||||
borderRadius: borderRadiusDefault,
|
||||
mr: 1,
|
||||
mb: 0.5,
|
||||
}}
|
||||
elevation={0}
|
||||
{...cardProps}
|
||||
>
|
||||
<CardActionArea
|
||||
sx={{ p: "1px" }}
|
||||
component="div"
|
||||
onClick={
|
||||
!!onClickEvent
|
||||
? onClickEvent
|
||||
: () => {
|
||||
navigate(`/item/${itemId}`);
|
||||
}
|
||||
}
|
||||
className="cardBox"
|
||||
>
|
||||
<Box
|
||||
className="card-media-container"
|
||||
sx={{
|
||||
position: "relative",
|
||||
m: 1,
|
||||
aspectRatio: "1.777",
|
||||
}}
|
||||
>
|
||||
<>
|
||||
<Chip
|
||||
className="card-indicator"
|
||||
label={<MdiCheck />}
|
||||
sx={{
|
||||
transition: "opacity 150ms",
|
||||
opacity: isWatched ? 1 : 0,
|
||||
}}
|
||||
/>
|
||||
<Box
|
||||
className="card-media-image-container"
|
||||
sx={{
|
||||
opacity: imgLoaded ? 1 : 0,
|
||||
transition: "opacity 250ms",
|
||||
}}
|
||||
>
|
||||
{imageTags && (
|
||||
<CardMedia
|
||||
component="img"
|
||||
image={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
itemId +
|
||||
"/Images/Primary?fillHeight=300&fillWidth=532&quality=96"
|
||||
}
|
||||
alt={itemName}
|
||||
sx={{
|
||||
width: "100%",
|
||||
aspectRatio: "1.777",
|
||||
borderRadius:
|
||||
borderRadiusDefault,
|
||||
overflow: "hidden",
|
||||
}}
|
||||
onLoad={() => setImgLoaded(true)}
|
||||
className="card-image"
|
||||
></CardMedia>
|
||||
)}
|
||||
</Box>
|
||||
{!!blurhash && (
|
||||
<Blurhash
|
||||
hash={blurhash}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={12}
|
||||
resolutionY={18}
|
||||
style={{
|
||||
aspectRatio: "1.777",
|
||||
}}
|
||||
className="card-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
<div className="card-image-icon-container">
|
||||
{TypeIconCollectionCard["Episode"]}
|
||||
</div>
|
||||
{!!playedPercent && (
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={playedPercent}
|
||||
sx={{
|
||||
width: "90%",
|
||||
position: "absolute",
|
||||
left: "5%",
|
||||
bottom: "5%",
|
||||
borderRadius: "100px",
|
||||
height: "5px",
|
||||
}}
|
||||
color="white"
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
<Box
|
||||
className="card-media-overlay"
|
||||
sx={{
|
||||
display: "flex",
|
||||
alignItems: "flex-end",
|
||||
justifyContent: "flex-end",
|
||||
p: 1,
|
||||
}}
|
||||
>
|
||||
<ButtonGroup>
|
||||
<IconButton
|
||||
onMouseDown={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleMarkAsPlayOrUnMarkAsPlay();
|
||||
}}
|
||||
>
|
||||
<MdiCheck
|
||||
sx={{
|
||||
color: isWatched
|
||||
? green[200]
|
||||
: "white",
|
||||
}}
|
||||
/>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onMouseDown={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleLiking();
|
||||
}}
|
||||
>
|
||||
{isFavourite ? (
|
||||
<MdiHeart
|
||||
sx={{ color: pink[700] }}
|
||||
/>
|
||||
) : (
|
||||
<MdiHeartOutline />
|
||||
)}
|
||||
</IconButton>
|
||||
</ButtonGroup>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<CardContent
|
||||
className="card-text-container"
|
||||
sx={{
|
||||
padding: "0 0.5em",
|
||||
alignItems: "flex-start",
|
||||
backgroundColor: "transparent",
|
||||
}}
|
||||
>
|
||||
{!!showName && (
|
||||
<>
|
||||
<Typography
|
||||
gutterBottom={false}
|
||||
variant="h5"
|
||||
component="div"
|
||||
color="white"
|
||||
fontWeight={500}
|
||||
textAlign="left"
|
||||
noWrap
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
navigate(`/item/${parentId}`);
|
||||
}}
|
||||
sx={{
|
||||
"&:hover": {
|
||||
textDecoration: "underline",
|
||||
},
|
||||
}}
|
||||
>
|
||||
{showName}
|
||||
{" - "}
|
||||
{episodeLocation}
|
||||
</Typography>
|
||||
</>
|
||||
)}
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
opacity: !!showName ? 0.75 : 1,
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
}}
|
||||
width="100%"
|
||||
mb={0.5}
|
||||
mt={0.5}
|
||||
>
|
||||
<Typography
|
||||
gutterBottom={false}
|
||||
variant="h6"
|
||||
component="div"
|
||||
color="white"
|
||||
fontWeight={500}
|
||||
textAlign={
|
||||
centerAlignText ? "center" : "left"
|
||||
}
|
||||
noWrap
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
>
|
||||
{itemName}
|
||||
</Typography>
|
||||
{!!itemTicks && (
|
||||
<Typography
|
||||
gutterBottom={false}
|
||||
variant="h6"
|
||||
component="div"
|
||||
color="white"
|
||||
fontWeight={300}
|
||||
textAlign="left"
|
||||
noWrap
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
sx={{
|
||||
opacity: 0.65,
|
||||
flexShrink: 0,
|
||||
}}
|
||||
>
|
||||
{getRuntime(itemTicks)}
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
<Stack
|
||||
alignItems="flex-start"
|
||||
width="100%"
|
||||
direction="row"
|
||||
gap={1}
|
||||
divider={
|
||||
<Divider
|
||||
flexItem
|
||||
orientation="vertical"
|
||||
variant="middle"
|
||||
/>
|
||||
}
|
||||
mb={1}
|
||||
>
|
||||
{!!itemRating && (
|
||||
<Typography
|
||||
gutterBottom={false}
|
||||
variant="subtitle1"
|
||||
component="div"
|
||||
color="white"
|
||||
fontWeight={300}
|
||||
textAlign="left"
|
||||
noWrap
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
sx={{
|
||||
opacity: 0.65,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "flex-start",
|
||||
}}
|
||||
>
|
||||
<MdiStarHalfFull
|
||||
sx={{
|
||||
fontSize: "1.2em",
|
||||
mr: "0.25em",
|
||||
}}
|
||||
/>{" "}
|
||||
{Math.round(itemRating * 10) / 10}
|
||||
</Typography>
|
||||
)}
|
||||
{!!itemTicks && (
|
||||
<Typography
|
||||
gutterBottom={false}
|
||||
variant="subtitle1"
|
||||
component="div"
|
||||
color="white"
|
||||
fontWeight={300}
|
||||
textAlign="left"
|
||||
noWrap
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
sx={{
|
||||
opacity: 0.65,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "flex-start",
|
||||
}}
|
||||
>
|
||||
{endsAt(itemTicks)}
|
||||
</Typography>
|
||||
)}
|
||||
</Stack>
|
||||
<Typography
|
||||
gutterBottom
|
||||
variant="body2"
|
||||
component="div"
|
||||
color="white"
|
||||
textAlign="left"
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
sx={{
|
||||
display: "-webkit-box",
|
||||
overflow: "hidden",
|
||||
WebkitBoxOrient: "vertical",
|
||||
WebkitLineClamp: 3,
|
||||
opacity: 0.45,
|
||||
}}
|
||||
>
|
||||
{subText}
|
||||
</Typography>
|
||||
</CardContent>
|
||||
</CardActionArea>
|
||||
</MuiCard>
|
||||
);
|
||||
};
|
||||
|
||||
EpisodeCard.propTypes = {
|
||||
itemName: PropTypes.string.isRequired,
|
||||
itemId: PropTypes.string.isRequired,
|
||||
imageTags: PropTypes.bool,
|
||||
subText: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
playedPercent: PropTypes.number,
|
||||
onClickEvent: PropTypes.func,
|
||||
watchedStatus: PropTypes.bool,
|
||||
blurhash: PropTypes.string,
|
||||
currentUser: PropTypes.object,
|
||||
favourite: PropTypes.bool,
|
||||
showName: PropTypes.string,
|
||||
episodeLocation: PropTypes.string,
|
||||
itemTicks: PropTypes.number,
|
||||
itemRating: PropTypes.number,
|
||||
centerAlignText: PropTypes.bool,
|
||||
parentId: PropTypes.any,
|
||||
};
|
||||
@@ -1,83 +1,106 @@
|
||||
/** @format */
|
||||
|
||||
import { useRef, useEffect } from "react";
|
||||
import { useState } 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,
|
||||
headingProps,
|
||||
disableDecoration = false,
|
||||
boxProps,
|
||||
}) => {
|
||||
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 {...boxProps} className="card-scroller-container" mb={1}>
|
||||
<Box
|
||||
sx={{ mb: 1 }}
|
||||
className={
|
||||
disableDecoration
|
||||
? `card-scroller-header-container hidden-decoration`
|
||||
: `card-scroller-header-container`
|
||||
}
|
||||
>
|
||||
<Typography
|
||||
variant="h4"
|
||||
color="textPrimary"
|
||||
className="card-scroller-heading"
|
||||
{...headingProps}
|
||||
>
|
||||
<div className="card-scroller-heading-decoration"></div>{" "}
|
||||
{title}
|
||||
</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,
|
||||
headingProps: PropTypes.any,
|
||||
};
|
||||
@@ -7,23 +7,31 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.hidden-decoration {
|
||||
.card-scroller-heading-decoration {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/** @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";
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
|
||||
export const LatestMediaSection = ({ latestMediaLib }) => {
|
||||
const user = useQuery({
|
||||
queryKey: ["home", "user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
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,
|
||||
networkMode: "always",
|
||||
});
|
||||
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.Type == BaseItemKind.Audio
|
||||
? false
|
||||
: 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>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiAlertDecagram } from "@mdi/js";
|
||||
|
||||
export const MdiAlertDecagram = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiAlertDecagram}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -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 {...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 { mdiClockOutline } from "@mdi/js";
|
||||
|
||||
export const MdiClockOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiClockOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
/** @format */
|
||||
|
||||
import { MdiChevronLeft } from "./mdiChevronLeft";
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiCog } from "@mdi/js";
|
||||
|
||||
export const MdiCog = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiCog}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { 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 { mdiEmoticonCry } from "@mdi/js";
|
||||
|
||||
export const MdiEmoticonCry = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiEmoticonCry}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiEmoticonCryOutline } from "@mdi/js";
|
||||
|
||||
export const MdiEmoticonCryOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiEmoticonCryOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiEmoticonDead } from "@mdi/js";
|
||||
|
||||
export const MdiEmoticonDead = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiEmoticonDead}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -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,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiFastForward } from "@mdi/js";
|
||||
|
||||
export const MdiFastForward = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiFastForward}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { 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,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiInformation } from "@mdi/js";
|
||||
|
||||
export const MdiInformation = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiInformation}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -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 { mdiPause } from "@mdi/js";
|
||||
|
||||
export const MdiPause = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiPause}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { 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 { mdiRewind } from "@mdi/js";
|
||||
|
||||
export const MdiRewind = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiRewind}></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 { mdiStar } from "@mdi/js";
|
||||
|
||||
export const MdiStar = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiStar}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { 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,11 @@
|
||||
/** @format */
|
||||
|
||||
.album {
|
||||
&-image-icon {
|
||||
fill: url(#clr-gradient-default) !important;
|
||||
|
||||
&-container {
|
||||
background: $clr-gradient-dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
/** @format */
|
||||
import { useState } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import TableContainer from "@mui/material/TableContainer";
|
||||
import Table from "@mui/material/Table";
|
||||
import TableBody from "@mui/material/TableBody";
|
||||
import TableHead from "@mui/material/TableHead";
|
||||
import TableRow from "@mui/material/TableRow";
|
||||
import TableCell from "@mui/material/TableCell";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import MuiLink from "@mui/material/Link";
|
||||
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { MdiClockOutline } from "../../icons/mdiClockOutline";
|
||||
import { getRuntimeMusic } from "../../../utils/date/time";
|
||||
import { MdiHeart } from "../../icons/mdiHeart";
|
||||
import { MdiHeartOutline } from "../../icons/mdiHeartOutline";
|
||||
import { MdiAlbum } from "../../icons/mdiAlbum";
|
||||
|
||||
import "./albumArtist.scss";
|
||||
|
||||
export const ArtistAlbum = ({ user, album, boxProps }) => {
|
||||
const albumTracks = useQuery({
|
||||
queryKey: ["artist", "album", album.Id],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(window.api).getItems({
|
||||
userId: user.Id,
|
||||
parentId: album.Id,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const handleLikingTrack = async (track) => {
|
||||
let result;
|
||||
if (track.UserData.IsFavorite) {
|
||||
result = await getUserLibraryApi(window.api).unmarkFavoriteItem({
|
||||
userId: user.data.Id,
|
||||
itemId: track.Id,
|
||||
});
|
||||
} else if (!track.UserData.IsFavorite) {
|
||||
result = await getUserLibraryApi(window.api).markFavoriteItem({
|
||||
userId: user.data.Id,
|
||||
itemId: track.Id,
|
||||
});
|
||||
}
|
||||
albumTracks.refetch();
|
||||
};
|
||||
|
||||
const [imgLoaded, setImgLoaded] = useState(false);
|
||||
|
||||
return (
|
||||
<Box sx={{ mb: 6 }} {...boxProps}>
|
||||
<Stack direction="row" gap={3} mb={3}>
|
||||
{!!album.ImageTags?.Primary && (
|
||||
<Box
|
||||
className="album-image"
|
||||
sx={{
|
||||
aspectRatio: 1,
|
||||
borderRadius: "10px",
|
||||
overflow: "hidden",
|
||||
width: "12em",
|
||||
boxShadow: "0 0 10px rgb(0 0 0 /0.2)",
|
||||
position: "relative",
|
||||
height: "12em",
|
||||
}}
|
||||
>
|
||||
<img
|
||||
src={`${window.api.basePath}/Items/${album.Id}/Images/Primary?fillHeight=532&fillWidth=532&quality=96`}
|
||||
style={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
objectFit: "cover",
|
||||
opacity: imgLoaded ? 1 : 0,
|
||||
transition: "opacity 250ms",
|
||||
position: "relative",
|
||||
zIndex: 2,
|
||||
}}
|
||||
onLoad={() => setImgLoaded(true)}
|
||||
/>
|
||||
<Box
|
||||
className="album-image-icon-container"
|
||||
sx={{
|
||||
position: "absolute",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
top: 0,
|
||||
left: 0,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
zIndex: 1,
|
||||
}}
|
||||
>
|
||||
<MdiAlbum
|
||||
className="album-image-icon"
|
||||
sx={{ fontSize: "6em" }}
|
||||
/>
|
||||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
<Stack>
|
||||
<Typography
|
||||
variant="h5"
|
||||
sx={{ opacity: `0.7`, mb: 1 }}
|
||||
>
|
||||
{album.ProductionYear}
|
||||
</Typography>
|
||||
<MuiLink
|
||||
component={Link}
|
||||
to={`/item/${album.Id}`}
|
||||
variant="h3"
|
||||
color="inherit"
|
||||
underline="hover"
|
||||
>
|
||||
{album.Name}
|
||||
</MuiLink>
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
<TableContainer
|
||||
component={Paper}
|
||||
sx={{ mb: 2, borderRadius: "15px" }}
|
||||
>
|
||||
<Table>
|
||||
<TableHead
|
||||
sx={{
|
||||
mb: 1,
|
||||
}}
|
||||
>
|
||||
<TableRow>
|
||||
<TableCell
|
||||
sx={{
|
||||
maxWidth: 120,
|
||||
width: 20,
|
||||
}}
|
||||
>
|
||||
<Typography variant="h6">#</Typography>
|
||||
</TableCell>
|
||||
<TableCell sx={{ width: 20 }}></TableCell>
|
||||
<TableCell>
|
||||
<Typography variant="h6">
|
||||
Name
|
||||
</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Typography variant="h6" align="right">
|
||||
<MdiClockOutline />
|
||||
</Typography>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{albumTracks.isSuccess &&
|
||||
albumTracks.data.Items.map(
|
||||
(mitem, mindex) => {
|
||||
return (
|
||||
<TableRow
|
||||
key={mindex}
|
||||
sx={{
|
||||
"&:last-child td, &:last-child th":
|
||||
{
|
||||
border: 0,
|
||||
},
|
||||
"&:hover": {
|
||||
background:
|
||||
"rgb(255 255 255 / 0.05)",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<TableCell
|
||||
sx={{
|
||||
maxWidth: 120,
|
||||
width: 20,
|
||||
}}
|
||||
>
|
||||
<Typography variant="body1">
|
||||
{
|
||||
mitem.IndexNumber
|
||||
}
|
||||
</Typography>
|
||||
</TableCell>
|
||||
<TableCell
|
||||
sx={{
|
||||
width: 20,
|
||||
}}
|
||||
align="center"
|
||||
>
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
handleLikingTrack(
|
||||
mitem,
|
||||
)
|
||||
}
|
||||
>
|
||||
{mitem.UserData
|
||||
.IsFavorite ? (
|
||||
<MdiHeart />
|
||||
) : (
|
||||
<MdiHeartOutline />
|
||||
)}
|
||||
</IconButton>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Typography variant="body1">
|
||||
{mitem.Name}
|
||||
</Typography>
|
||||
</TableCell>
|
||||
<TableCell align="right">
|
||||
<Typography variant="body1">
|
||||
{getRuntimeMusic(
|
||||
mitem.RunTimeTicks,
|
||||
)}
|
||||
</Typography>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,278 @@
|
||||
/** @format */
|
||||
import { useEffect, useState } from "react";
|
||||
import { delUser } from "../../utils/storage/user";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
|
||||
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 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 { MdiHomeVariantOutline } from "../icons/mdiHomeVariantOutline";
|
||||
|
||||
import { EventEmitter as event } from "../../eventEmitter.js";
|
||||
|
||||
import "./sidemenu.module.scss";
|
||||
|
||||
const drawerWidth = 320;
|
||||
|
||||
const DrawerHeader = styled("div")(({ theme }) => ({
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "flex-end",
|
||||
padding: theme.spacing(0, 1),
|
||||
...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",
|
||||
}));
|
||||
|
||||
export const SideMenu = ({}) => {
|
||||
const location = useLocation();
|
||||
|
||||
const [display, setDisplay] = useState(false);
|
||||
|
||||
const navigate = useNavigate();
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
enabled: display,
|
||||
networkMode: "always",
|
||||
});
|
||||
let libraries = useQuery({
|
||||
queryKey: ["libraries"],
|
||||
queryFn: async () => {
|
||||
let libs = await getUserViewsApi(window.api).getUserViews({
|
||||
userId: user.data.Id,
|
||||
});
|
||||
return libs.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
const handleDrawerOpen = () => {};
|
||||
|
||||
const handleLogout = async () => {
|
||||
console.log("Logging out user...");
|
||||
await window.api.logout();
|
||||
delUser();
|
||||
sessionStorage.removeItem("accessToken");
|
||||
event.emit("create-jellyfin-api", window.api.basePath);
|
||||
navigate("/login");
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
location.pathname.includes("login") ||
|
||||
location.pathname.includes("setup") ||
|
||||
location.pathname.includes("player") ||
|
||||
location.pathname === "/"
|
||||
) {
|
||||
setDisplay(false);
|
||||
} else {
|
||||
setDisplay(true);
|
||||
}
|
||||
}, [location]);
|
||||
|
||||
if (!display) {
|
||||
return <></>;
|
||||
}
|
||||
|
||||
if (display) {
|
||||
return (
|
||||
<MiniDrawer
|
||||
variant="permanent"
|
||||
open={false}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
backgroundColor: "inherit",
|
||||
border: "none",
|
||||
width: `calc(${theme.spacing(7)} + 10px)`,
|
||||
height: "100vh",
|
||||
// display: visible ? "block" : "none",
|
||||
},
|
||||
}}
|
||||
sx={{
|
||||
width: `calc(${theme.spacing(7)} + 10px)`,
|
||||
background: theme.palette.background.paper,
|
||||
}}
|
||||
>
|
||||
<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
|
||||
>
|
||||
<ListItemButton
|
||||
component={
|
||||
NavLink
|
||||
}
|
||||
to={
|
||||
"/library/" +
|
||||
library.Id
|
||||
}
|
||||
className="sidemenu-item"
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
"center",
|
||||
px: 2.5,
|
||||
}}
|
||||
>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
}}
|
||||
>
|
||||
{
|
||||
MediaCollectionTypeIconCollection[
|
||||
library
|
||||
.CollectionType
|
||||
]
|
||||
}
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</List>
|
||||
<List sx={{ marginTop: "auto" }}>
|
||||
<Tooltip
|
||||
title="Home"
|
||||
placement="right"
|
||||
followCursor
|
||||
arrow
|
||||
>
|
||||
<ListItem
|
||||
className="sidemenu-item-container"
|
||||
disablePadding
|
||||
>
|
||||
<ListItemButton
|
||||
component={NavLink}
|
||||
to="/home"
|
||||
className="sidemenu-item"
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent: "center",
|
||||
px: 2.5,
|
||||
}}
|
||||
>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
}}
|
||||
>
|
||||
<MdiHomeVariantOutline />
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
<Tooltip
|
||||
title="Logout"
|
||||
placement="right"
|
||||
followCursor
|
||||
arrow
|
||||
>
|
||||
<ListItem disablePadding>
|
||||
<ListItemButton
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent: "center",
|
||||
px: 2.5,
|
||||
}}
|
||||
onClick={handleLogout}
|
||||
>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
}}
|
||||
>
|
||||
<MdiLogoutVariant></MdiLogoutVariant>
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
</List>
|
||||
</>
|
||||
)}
|
||||
</MiniDrawer>
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -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,24 @@
|
||||
/** @format */
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import { MdiEmoticonCry } from "../../icons/mdiEmoticonCry";
|
||||
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,
|
||||
}}
|
||||
>
|
||||
<MdiEmoticonCry sx={{ fontSize: 200 }} />
|
||||
<Typography variant="h3">Nothing found</Typography>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
/** @format */
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { MdiEmoticonDead } from "../../icons/mdiEmoticonDead";
|
||||
|
||||
export const ErrorNotice = () => {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
flexFlow: "column",
|
||||
opacity: 0.2,
|
||||
}}
|
||||
>
|
||||
<MdiEmoticonDead sx={{ fontSize: 200 }} />
|
||||
<Typography variant="h3">Something went wrong</Typography>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,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>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,84 @@
|
||||
/** @format */
|
||||
|
||||
import Card from "@mui/material/Card";
|
||||
import CardMedia from "@mui/material/CardMedia";
|
||||
import CardContent from "@mui/material/CardContent";
|
||||
import Grid from "@mui/material/Unstable_Grid2";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Skeleton from "@mui/material/Skeleton";
|
||||
|
||||
import { borderRadiusDefault } from "../../palette.module.scss";
|
||||
|
||||
export const EpisodeCardsSkeleton = () => {
|
||||
return (
|
||||
<Grid
|
||||
container
|
||||
columns={{
|
||||
xs: 2,
|
||||
sm: 3,
|
||||
md: 4,
|
||||
}}
|
||||
sx={{ width: "100%" }}
|
||||
>
|
||||
{Array.from(new Array(4)).map((a, index) => {
|
||||
return (
|
||||
<Grid xs={1} sm={1} md={1} key={index}>
|
||||
<Card
|
||||
sx={{ background: "transparent" }}
|
||||
elevation={0}
|
||||
>
|
||||
<CardMedia>
|
||||
<Skeleton
|
||||
animation="wave"
|
||||
variant="rectangular"
|
||||
sx={{
|
||||
aspectRatio: "1.777",
|
||||
height: "auto",
|
||||
m: 1,
|
||||
borderRadius:
|
||||
borderRadiusDefault,
|
||||
}}
|
||||
/>
|
||||
</CardMedia>
|
||||
<CardContent
|
||||
sx={{
|
||||
padding: "0 0.5em",
|
||||
alignItems: "flex-start",
|
||||
backgroundColor: "transparent",
|
||||
}}
|
||||
>
|
||||
<Typography variant="h6">
|
||||
<Skeleton
|
||||
variant="text"
|
||||
animation="wave"
|
||||
/>
|
||||
</Typography>
|
||||
<Typography variant="subtitle1" mb={1}>
|
||||
<Skeleton
|
||||
variant="text"
|
||||
width="50%"
|
||||
animation="wave"
|
||||
/>
|
||||
</Typography>
|
||||
<Typography variant="body2">
|
||||
<Skeleton
|
||||
variant="text"
|
||||
animation="wave"
|
||||
/>
|
||||
<Skeleton
|
||||
variant="text"
|
||||
animation="wave"
|
||||
/>
|
||||
<Skeleton
|
||||
variant="text"
|
||||
animation="wave"
|
||||
/>
|
||||
</Typography>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Grid>
|
||||
);
|
||||
})}
|
||||
</Grid>
|
||||
);
|
||||
};
|
||||
@@ -1,5 +0,0 @@
|
||||
/** @format */
|
||||
|
||||
export const SplashScreen = () => {
|
||||
return <h1>I am loading...</h1>;
|
||||
};
|
||||
@@ -1,61 +1,105 @@
|
||||
/** @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" />,
|
||||
Genre: <MdiDramaMasks className="card-image-icon" />,
|
||||
};
|
||||
+6
-3
@@ -4,19 +4,22 @@ 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";
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
ReactDOM.createRoot(document.getElementById("root")).render(
|
||||
<React.StrictMode>
|
||||
<CookiesProvider>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<Router>
|
||||
<App />
|
||||
</Router>
|
||||
</CookiesProvider>
|
||||
</QueryClientProvider>
|
||||
</React.StrictMode>,
|
||||
);
|
||||
|
||||
|
||||
@@ -9,5 +9,8 @@
|
||||
clrBackgroundDefault: $clr-background-default;
|
||||
|
||||
clrBackgroundDark: $clr-background-dark;
|
||||
clrBackgroundDarkOpacity0_8: $clr-background-dark-opacity-0_8;
|
||||
clrBackgroundLight: $clr-background-light;
|
||||
|
||||
borderRadiusDefault: $border-radius-default;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/** @format */
|
||||
|
||||
.about {
|
||||
&-sections {
|
||||
&-container {
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
&-logo {
|
||||
width: 75% !important;
|
||||
max-width: 50vw;
|
||||
height: 15em;
|
||||
object-fit: contain;
|
||||
object-position: center;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
/** @format */
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import TableContainer from "@mui/material/TableContainer";
|
||||
import Table from "@mui/material/Table";
|
||||
import TableHead from "@mui/material/TableHead";
|
||||
import TableRow from "@mui/material/TableRow";
|
||||
import TableBody from "@mui/material/TableBody";
|
||||
import TableCell from "@mui/material/TableCell";
|
||||
import Link from "@mui/material/Link";
|
||||
|
||||
import logo from "../../assets/logo.svg";
|
||||
import jellyfinLogo from "../../assets/jellyfinLogo.svg";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
||||
|
||||
import { version } from "../../../package.json";
|
||||
|
||||
import "./about.module.scss";
|
||||
|
||||
const About = () => {
|
||||
const systemInfo = useQuery({
|
||||
queryKey: ["about", "systemInfo"],
|
||||
queryFn: async () => {
|
||||
const result = await getSystemApi(window.api).getSystemInfo();
|
||||
return result.data;
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<Box
|
||||
component="main"
|
||||
className="scrollY"
|
||||
sx={{
|
||||
flexGrow: 1,
|
||||
pt: 11,
|
||||
px: 3,
|
||||
pb: 3,
|
||||
position: "relative",
|
||||
}}
|
||||
>
|
||||
<Stack
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
className="about-sections"
|
||||
>
|
||||
<Link
|
||||
href="https://github.com/prayag17/JellyPlayer"
|
||||
className="about-logo"
|
||||
>
|
||||
<img width="100%" height="100%" src={logo} />
|
||||
</Link>
|
||||
<TableContainer
|
||||
component={Paper}
|
||||
sx={{ width: "50%", borderRadius: "15px" }}
|
||||
>
|
||||
<Table>
|
||||
<TableBody>
|
||||
<TableRow
|
||||
sx={{
|
||||
"&:last-child td, &:last-child th":
|
||||
{
|
||||
border: 0,
|
||||
},
|
||||
"&:hover": {
|
||||
background:
|
||||
"rgb(255 255 255 / 0.05)",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<TableCell>
|
||||
<Typography
|
||||
variant="h4"
|
||||
fontWeight={100}
|
||||
>
|
||||
Version
|
||||
</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Typography
|
||||
variant="h4"
|
||||
sx={{ opacity: 0.7 }}
|
||||
>
|
||||
{version}
|
||||
</Typography>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow
|
||||
sx={{
|
||||
"&:last-child td, &:last-child th":
|
||||
{
|
||||
border: 0,
|
||||
},
|
||||
"&:hover": {
|
||||
background:
|
||||
"rgb(255 255 255 / 0.05)",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<TableCell>
|
||||
<Typography
|
||||
variant="h4"
|
||||
fontWeight={100}
|
||||
>
|
||||
Jellyfin Version
|
||||
</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Typography
|
||||
variant="h4"
|
||||
sx={{ opacity: 0.7 }}
|
||||
>
|
||||
{systemInfo.isSuccess &&
|
||||
systemInfo.data.Version}
|
||||
</Typography>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow
|
||||
sx={{
|
||||
"&:last-child td, &:last-child th":
|
||||
{
|
||||
border: 0,
|
||||
},
|
||||
"&:hover": {
|
||||
background:
|
||||
"rgb(255 255 255 / 0.05)",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<TableCell>
|
||||
<Typography
|
||||
variant="h4"
|
||||
fontWeight={100}
|
||||
>
|
||||
Server OS
|
||||
</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Typography
|
||||
variant="h4"
|
||||
sx={{ opacity: 0.7 }}
|
||||
>
|
||||
{systemInfo.isSuccess &&
|
||||
systemInfo.data
|
||||
.OperatingSystemDisplayName}
|
||||
</Typography>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default About;
|
||||
@@ -0,0 +1,7 @@
|
||||
/** @format */
|
||||
|
||||
const FavouritePage = () => {
|
||||
return <></>;
|
||||
};
|
||||
|
||||
export default FavouritePage;
|
||||
@@ -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,32 @@
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-position: center;
|
||||
opacity: 1;
|
||||
mask-image: linear-gradient(
|
||||
to right,
|
||||
transparent 2%,
|
||||
rgba(0, 0, 0, 0.5) 20%,
|
||||
black 70%
|
||||
);
|
||||
-webkit-mask-image: linear-gradient(
|
||||
to right,
|
||||
transparent 2%,
|
||||
rgba(0, 0, 0, 0.5) 20%,
|
||||
black 70%
|
||||
);
|
||||
}
|
||||
&-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;
|
||||
// background: url("/public/assetsStatic//meshbackground.png");
|
||||
z-index: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
@@ -63,6 +82,13 @@
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
-webkit-line-clamp: 2;
|
||||
margin-bottom: 0.5em;
|
||||
&-logo {
|
||||
max-width: 10em;
|
||||
height: 2em;
|
||||
object-fit: contain;
|
||||
object-position: bottom;
|
||||
}
|
||||
}
|
||||
&-detail {
|
||||
position: relative;
|
||||
@@ -70,7 +96,7 @@
|
||||
display: flex;
|
||||
height: 70vh;
|
||||
width: 70%;
|
||||
padding: 0 2em 2em 2em;
|
||||
padding: 2em;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
@@ -82,18 +108,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
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,856 @@
|
||||
/** @format */
|
||||
|
||||
import { useState } from "react";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { EventEmitter as event } from "../../eventEmitter";
|
||||
import { getServer } from "../../utils/storage/servers";
|
||||
import { getUser, delUser } from "../../utils/storage/user";
|
||||
|
||||
import { theme } from "../../theme";
|
||||
import "./home.module.scss";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import Button from "@mui/material/Button";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import Stack from "@mui/material/Stack";
|
||||
|
||||
import { yellow } from "@mui/material/colors";
|
||||
|
||||
import Carousel from "react-material-ui-carousel";
|
||||
|
||||
// Custom Components
|
||||
import { Card } from "../../components/card/card";
|
||||
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||
import { LatestMediaSection } from "../../components/homeSection/latestMediaSection";
|
||||
import { CarouselSkeleton } from "../../components/skeleton/carousel";
|
||||
import { CardsSkeleton } from "../../components/skeleton/cards";
|
||||
|
||||
// Icons
|
||||
import { MediaTypeIconCollection } from "../../components/utils/iconsCollection.jsx";
|
||||
import { MdiStar } from "../../components/icons/mdiStar";
|
||||
import { MdiPlayOutline } from "../../components/icons/mdiPlayOutline";
|
||||
import { MdiChevronRight } from "../../components/icons/mdiChevronRight";
|
||||
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
import { endsAt, getRuntime } from "../../utils/date/time";
|
||||
import { BaseItemKind, ItemFields } from "@jellyfin/sdk/lib/generated-client";
|
||||
|
||||
const Home = () => {
|
||||
const authUser = useQuery({
|
||||
queryKey: ["home", "authenticateUser"],
|
||||
queryFn: async () => {
|
||||
const server = await getServer();
|
||||
const user = await getUser();
|
||||
event.emit("create-jellyfin-api", server.Ip);
|
||||
const auth = await window.api.authenticateUserByName(
|
||||
user.Name,
|
||||
user.Password,
|
||||
);
|
||||
sessionStorage.setItem("accessToken", auth.data.AccessToken);
|
||||
event.emit("set-api-accessToken", window.api.basePath);
|
||||
return true;
|
||||
},
|
||||
enabled: false,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const libraries = useQuery({
|
||||
queryKey: ["libraries"],
|
||||
queryFn: async () => {
|
||||
let libs = await getUserViewsApi(window.api).getUserViews({
|
||||
userId: user.data.Id,
|
||||
});
|
||||
return libs.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const latestMedia = useQuery({
|
||||
queryKey: ["home", "latestMedia"],
|
||||
queryFn: async () => {
|
||||
const media = await getUserLibraryApi(window.api).getLatestMedia(
|
||||
{
|
||||
userId: user.data.Id,
|
||||
fields: [ItemFields.Overview, ItemFields.ParentId],
|
||||
enableUserData: true,
|
||||
},
|
||||
);
|
||||
return media.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const resumeItemsVideo = useQuery({
|
||||
queryKey: ["home", "resume", "video"],
|
||||
queryFn: async () => {
|
||||
const resumeItems = await getItemsApi(window.api).getResumeItems(
|
||||
{
|
||||
userId: user.data.Id,
|
||||
limit: 16,
|
||||
mediaTypes: ["Video"],
|
||||
enableUserData: true,
|
||||
},
|
||||
);
|
||||
return resumeItems.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const resumeItemsAudio = useQuery({
|
||||
queryKey: ["home", "resume", "audio"],
|
||||
queryFn: async () => {
|
||||
const resumeItems = await getItemsApi(window.api).getResumeItems(
|
||||
{
|
||||
userId: user.data.Id,
|
||||
limit: 16,
|
||||
mediaTypes: ["Audio"],
|
||||
enableUserData: true,
|
||||
},
|
||||
);
|
||||
return resumeItems.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const upNextItems = useQuery({
|
||||
queryKey: ["home", "upNext"],
|
||||
queryFn: async () => {
|
||||
const upNext = await getTvShowsApi(window.api).getNextUp({
|
||||
userId: user.data.Id,
|
||||
limit: 16,
|
||||
});
|
||||
return upNext.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const [latestMediaLibs, setLatestMediaLibs] = useState([]);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const excludeTypes = ["boxsets", "playlists", "livetv", "channels"];
|
||||
|
||||
const handleLogout = async () => {
|
||||
console.log("Logging out user...");
|
||||
await window.api.logout();
|
||||
delUser();
|
||||
sessionStorage.removeItem("accessToken");
|
||||
event.emit("create-jellyfin-api", window.api.basePath);
|
||||
navigate("/login");
|
||||
};
|
||||
|
||||
let tempData = [];
|
||||
if (libraries.status == "success") {
|
||||
libraries.data.Items.map((lib) => {
|
||||
if (!excludeTypes.includes(lib.CollectionType)) {
|
||||
tempData = latestMediaLibs;
|
||||
if (
|
||||
!tempData.some(
|
||||
(el) =>
|
||||
JSON.stringify(el) ==
|
||||
JSON.stringify([lib.Id, lib.Name]),
|
||||
)
|
||||
) {
|
||||
tempData.push([lib.Id, lib.Name]);
|
||||
setLatestMediaLibs(tempData);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (user.isPaused) {
|
||||
user.refetch();
|
||||
console.log(user.isError);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box
|
||||
component="main"
|
||||
className="scrollY"
|
||||
sx={{
|
||||
flexGrow: 1,
|
||||
pt: 11,
|
||||
px: 3,
|
||||
pb: 3,
|
||||
position: "relative",
|
||||
}}
|
||||
>
|
||||
<Carousel
|
||||
className="hero-carousel"
|
||||
autoPlay={true}
|
||||
animation="fade"
|
||||
height="70vh"
|
||||
IndicatorIcon={
|
||||
<div className="hero-carousel-indicator"></div>
|
||||
}
|
||||
activeIndicatorIconButtonProps={{
|
||||
style: {
|
||||
background: "rgb(255 255 255)",
|
||||
},
|
||||
}}
|
||||
indicatorIconButtonProps={{
|
||||
style: {
|
||||
background: "rgb(255 255 255 / 0.3)",
|
||||
borderRadius: "2px",
|
||||
width: "100%",
|
||||
flexShrink: "1",
|
||||
},
|
||||
}}
|
||||
indicatorContainerProps={{
|
||||
style: {
|
||||
display: "flex",
|
||||
gap: "1em",
|
||||
},
|
||||
}}
|
||||
sx={{
|
||||
marginBottom: "1.5em",
|
||||
}}
|
||||
interval={10000}
|
||||
>
|
||||
{latestMedia.isLoading ? (
|
||||
<CarouselSkeleton />
|
||||
) : (
|
||||
// <></>
|
||||
latestMedia.data != null &&
|
||||
latestMedia.data.map((item, index) => {
|
||||
return (
|
||||
<Paper
|
||||
className="hero-carousel-slide"
|
||||
sx={{
|
||||
background:
|
||||
theme.palette.primary
|
||||
.background.dark,
|
||||
}}
|
||||
key={index}
|
||||
>
|
||||
<div className="hero-carousel-background-container">
|
||||
{item.Type ==
|
||||
BaseItemKind.MusicAlbum ||
|
||||
item.Type ==
|
||||
BaseItemKind.Episode ? (
|
||||
item
|
||||
.ParentBackdropImageTags
|
||||
.length != 0 && (
|
||||
<>
|
||||
<Blurhash
|
||||
hash={
|
||||
item
|
||||
.ImageBlurHashes
|
||||
.Backdrop[
|
||||
item
|
||||
.ParentBackdropImageTags[0]
|
||||
]
|
||||
}
|
||||
// hash="LEHV6nWB2yk8pyo0adR*.7kCMdnj"
|
||||
width="1080"
|
||||
height="720"
|
||||
resolutionX={
|
||||
64
|
||||
}
|
||||
resolutionY={
|
||||
96
|
||||
}
|
||||
className="hero-carousel-background-blurhash"
|
||||
punch={1}
|
||||
/>
|
||||
<div
|
||||
className="hero-carousel-background-image"
|
||||
style={{
|
||||
backgroundImage: `url(${window.api.basePath}/Items/${item.ParentBackdropItemId}/Images/Backdrop)`,
|
||||
}}
|
||||
></div>
|
||||
</>
|
||||
)
|
||||
) : item.ImageBlurHashes
|
||||
.Backdrop ? (
|
||||
<>
|
||||
{item
|
||||
.BackdropImageTags
|
||||
.length !=
|
||||
0 && (
|
||||
<Blurhash
|
||||
hash={
|
||||
item
|
||||
.ImageBlurHashes
|
||||
.Backdrop[
|
||||
item
|
||||
.BackdropImageTags[0]
|
||||
]
|
||||
}
|
||||
// hash="LEHV6nWB2yk8pyo0adR*.7kCMdnj"
|
||||
width="1080"
|
||||
height="720"
|
||||
resolutionX={
|
||||
64
|
||||
}
|
||||
resolutionY={
|
||||
96
|
||||
}
|
||||
className="hero-carousel-background-blurhash"
|
||||
punch={1}
|
||||
/>
|
||||
)}
|
||||
<div
|
||||
className="hero-carousel-background-image"
|
||||
style={{
|
||||
backgroundImage: `url(${
|
||||
window
|
||||
.api
|
||||
.basePath +
|
||||
"/Items/" +
|
||||
item.Id +
|
||||
"/Images/Backdrop"
|
||||
})`,
|
||||
}}
|
||||
></div>
|
||||
</>
|
||||
) : (
|
||||
<div className="hero-carousel-background-image empty"></div>
|
||||
)}
|
||||
<div className="hero-carousel-background-icon-container">
|
||||
{
|
||||
MediaTypeIconCollection[
|
||||
item.MediaType
|
||||
]
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<Box className="hero-carousel-detail">
|
||||
<Typography
|
||||
variant="h3"
|
||||
className="hero-carousel-text"
|
||||
sx={{
|
||||
mb: 2.5,
|
||||
}}
|
||||
>
|
||||
{!item.ImageTags.Logo ? (
|
||||
item.Name
|
||||
) : (
|
||||
<img
|
||||
className="hero-carousel-text-logo"
|
||||
src={
|
||||
window.api
|
||||
.basePath +
|
||||
"/Items/" +
|
||||
item.Id +
|
||||
"/Images/Logo?quality=80&tag=" +
|
||||
item
|
||||
.ImageTags
|
||||
.Logo
|
||||
}
|
||||
></img>
|
||||
)}
|
||||
</Typography>
|
||||
<Stack
|
||||
// sx={{
|
||||
// display: "flex",
|
||||
// alignItems:
|
||||
// "center",
|
||||
// width: "fit-content",
|
||||
// gap: "1em",
|
||||
// mb: 1.5,
|
||||
// }}
|
||||
direction="row"
|
||||
gap={1}
|
||||
divider={
|
||||
<Divider
|
||||
variant="middle"
|
||||
component="div"
|
||||
orientation="vertical"
|
||||
flexItem
|
||||
/>
|
||||
}
|
||||
className="hero-carousel-info"
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
// color="GrayText"
|
||||
>
|
||||
{!!item.ProductionYear
|
||||
? item.ProductionYear
|
||||
: "Unknown"}
|
||||
</Typography>
|
||||
<Chip
|
||||
variant="outlined"
|
||||
label={
|
||||
!!item.OfficialRating
|
||||
? item.OfficialRating
|
||||
: "Not Rated"
|
||||
}
|
||||
/>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
gap: "0.25em",
|
||||
alignItems:
|
||||
"center",
|
||||
}}
|
||||
className="hero-carousel-info-rating"
|
||||
>
|
||||
{!!item.CommunityRating ? (
|
||||
<>
|
||||
<MdiStar
|
||||
sx={{
|
||||
color: yellow[700],
|
||||
}}
|
||||
/>
|
||||
<Typography variant="subtitle1">
|
||||
{Math.round(
|
||||
item.CommunityRating *
|
||||
10,
|
||||
) /
|
||||
10}
|
||||
</Typography>
|
||||
</>
|
||||
) : (
|
||||
<Typography variant="subtitle1">
|
||||
No
|
||||
Community
|
||||
Rating
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
{!!item.RunTimeTicks && (
|
||||
<Typography variant="subtitle1">
|
||||
{getRuntime(
|
||||
item.RunTimeTicks,
|
||||
)}
|
||||
</Typography>
|
||||
)}
|
||||
{!!item.RunTimeTicks && (
|
||||
<Typography variant="subtitle1">
|
||||
{endsAt(
|
||||
item.RunTimeTicks,
|
||||
)}
|
||||
</Typography>
|
||||
)}
|
||||
</Stack>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
className="hero-carousel-text"
|
||||
sx={{
|
||||
display: "-webkit-box",
|
||||
maxWidth: "70%",
|
||||
maxHeight: "30%",
|
||||
textOverflow:
|
||||
"ellipsis",
|
||||
overflow: "hidden",
|
||||
WebkitLineClamp:
|
||||
"3",
|
||||
WebkitBoxOrient:
|
||||
"vertical",
|
||||
opacity: 0.7,
|
||||
}}
|
||||
>
|
||||
{item.Overview}
|
||||
</Typography>
|
||||
{/* TODO Link PLay and More info buttons in carousel */}
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
gap: 3,
|
||||
mt: 3,
|
||||
}}
|
||||
className="hero-carousel-button-container"
|
||||
>
|
||||
<Button
|
||||
variant="contained"
|
||||
endIcon={
|
||||
<MdiPlayOutline />
|
||||
}
|
||||
disabled
|
||||
>
|
||||
Play
|
||||
</Button>
|
||||
<Button
|
||||
color="white"
|
||||
variant="outlined"
|
||||
endIcon={
|
||||
<MdiChevronRight />
|
||||
}
|
||||
onClick={() =>
|
||||
navigate(
|
||||
`/item/${item.Id}`,
|
||||
)
|
||||
}
|
||||
>
|
||||
More info
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
</Paper>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</Carousel>
|
||||
{libraries.isLoading ? (
|
||||
<CardsSkeleton />
|
||||
) : (
|
||||
<CardScroller displayCards={4} title="Libraries">
|
||||
{libraries.status == "success" &&
|
||||
libraries.data.Items.map((item, index) => {
|
||||
return (
|
||||
<Card
|
||||
key={index}
|
||||
itemName={item.Name}
|
||||
itemId={item.Id}
|
||||
// imageTags={false}
|
||||
imageTags={
|
||||
!!item.ImageTags.Primary
|
||||
}
|
||||
cardType="lib"
|
||||
cardOrientation="landscape"
|
||||
iconType={item.CollectionType}
|
||||
onClickEvent={() => {
|
||||
navigate(
|
||||
`/library/${item.Id}`,
|
||||
);
|
||||
}}
|
||||
blurhash={
|
||||
item.ImageBlurHashes ==
|
||||
{}
|
||||
? ""
|
||||
: !!item.ImageTags
|
||||
.Primary
|
||||
? !!item
|
||||
.ImageBlurHashes
|
||||
.Primary
|
||||
? item
|
||||
.ImageBlurHashes
|
||||
.Primary[
|
||||
item
|
||||
.ImageTags
|
||||
.Primary
|
||||
]
|
||||
: ""
|
||||
: ""
|
||||
}
|
||||
currentUser={user.data}
|
||||
></Card>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
{upNextItems.isLoading ? (
|
||||
<CardsSkeleton />
|
||||
) : upNextItems.isSuccess &&
|
||||
upNextItems.data.Items.length == 0 ? (
|
||||
<></>
|
||||
) : (
|
||||
<CardScroller displayCards={4} title="Up Next">
|
||||
{upNextItems.data.Items.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
|
||||
}
|
||||
cardType="thumb"
|
||||
iconType={item.Type}
|
||||
subText={
|
||||
!!item.SeriesId
|
||||
? "S" +
|
||||
item.ParentIndexNumber +
|
||||
":E" +
|
||||
item.IndexNumber +
|
||||
" - " +
|
||||
item.Name
|
||||
: item.ProductionYear
|
||||
}
|
||||
cardOrientation="landscape"
|
||||
blurhash={
|
||||
item.ImageBlurHashes == {}
|
||||
? ""
|
||||
: !!item.ImageTags
|
||||
.Primary
|
||||
? !!item.ImageBlurHashes
|
||||
.Primary
|
||||
? item
|
||||
.ImageBlurHashes
|
||||
.Primary[
|
||||
item
|
||||
.ImageTags
|
||||
.Primary
|
||||
]
|
||||
: ""
|
||||
: ""
|
||||
}
|
||||
currentUser={user.data}
|
||||
favourite={
|
||||
item.UserData.IsFavorite
|
||||
}
|
||||
></Card>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
{resumeItemsVideo.isLoading ? (
|
||||
<CardsSkeleton />
|
||||
) : resumeItemsVideo.data.Items.length == 0 ? (
|
||||
<></>
|
||||
) : (
|
||||
<CardScroller
|
||||
displayCards={4}
|
||||
title="Continue Watching"
|
||||
>
|
||||
{resumeItemsVideo.data.Items.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.SeriesId
|
||||
? item
|
||||
.ParentBackdropImageTags
|
||||
.length !=
|
||||
0
|
||||
: item
|
||||
.BackdropImageTags
|
||||
.length !=
|
||||
0
|
||||
}
|
||||
cardType="thumb"
|
||||
iconType={item.Type}
|
||||
subText={
|
||||
!!item.SeriesId
|
||||
? "S" +
|
||||
item.ParentIndexNumber +
|
||||
":E" +
|
||||
item.IndexNumber +
|
||||
" - " +
|
||||
item.Name
|
||||
: item.ProductionYear
|
||||
}
|
||||
playedPercent={
|
||||
item.UserData
|
||||
.PlayedPercentage
|
||||
}
|
||||
cardOrientation="landscape"
|
||||
blurhash={
|
||||
item.ImageBlurHashes ==
|
||||
{}
|
||||
? ""
|
||||
: !!item.ImageTags
|
||||
.Backdrop
|
||||
? !!item
|
||||
.ImageBlurHashes
|
||||
.Backdrop
|
||||
? item
|
||||
.ImageBlurHashes
|
||||
.Backdrop[
|
||||
item
|
||||
.ImageTags
|
||||
.Backdrop
|
||||
]
|
||||
: ""
|
||||
: ""
|
||||
}
|
||||
currentUser={user.data}
|
||||
favourite={
|
||||
item.UserData.IsFavorite
|
||||
}
|
||||
></Card>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</CardScroller>
|
||||
)}
|
||||
{resumeItemsAudio.isLoading ? (
|
||||
<CardsSkeleton />
|
||||
) : resumeItemsAudio.data.Items.length == 0 ? (
|
||||
<></>
|
||||
) : (
|
||||
<CardScroller
|
||||
displayCards={4}
|
||||
title="Continue Listening"
|
||||
>
|
||||
{resumeItemsAudio.data.Items.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="sqaure"
|
||||
blurhash={
|
||||
item.ImageBlurHashes ==
|
||||
{}
|
||||
? ""
|
||||
: !!item.ImageTags
|
||||
.Primary
|
||||
? !!item
|
||||
.ImageBlurHashes
|
||||
.Primary
|
||||
? item
|
||||
.ImageBlurHashes
|
||||
.Primary[
|
||||
item
|
||||
.ImageTags
|
||||
.Primary
|
||||
]
|
||||
: ""
|
||||
: ""
|
||||
}
|
||||
currentUser={user.data}
|
||||
favourite={
|
||||
item.UserData.IsFavorite
|
||||
}
|
||||
></Card>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</CardScroller>
|
||||
)}
|
||||
{latestMediaLibs.map((lib, index) => {
|
||||
return (
|
||||
<LatestMediaSection
|
||||
key={lib[0]}
|
||||
latestMediaLib={lib}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
<Button variant="contained" onClick={handleLogout}>
|
||||
Logout
|
||||
</Button>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
/* <MuiDrawer
|
||||
anchor="left"
|
||||
open={drawerState}
|
||||
onClose={handleDrawerClose}
|
||||
>
|
||||
<DrawerHeader
|
||||
className="Mui-DrawerHeader"
|
||||
sx={{ position: "relative", height: "20vh" }}
|
||||
>
|
||||
<div>
|
||||
<Avatar src={""}/>
|
||||
<Typography variant="h3">
|
||||
{user["Name"]}
|
||||
</Typography>
|
||||
</div>
|
||||
<IconButton
|
||||
onClick={handleDrawerClose}
|
||||
sx={{
|
||||
position: "absolute",
|
||||
top: "10%",
|
||||
right: "5%",
|
||||
}}
|
||||
>
|
||||
<Close />
|
||||
</IconButton>
|
||||
</DrawerHeader>
|
||||
<Divider />
|
||||
<List sx={{ border: "none" }}>
|
||||
{userLibraries.map((library, index) => {
|
||||
return (
|
||||
<ListItem disablePadding key={index}>
|
||||
<ListItemButton
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
drawerState
|
||||
? "initial"
|
||||
: "center",
|
||||
px: 2.5,
|
||||
}}
|
||||
>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
mr: 3,
|
||||
justifyContent:
|
||||
"center",
|
||||
}}
|
||||
>
|
||||
{
|
||||
MediaCollectionTypeIconCollection[
|
||||
library
|
||||
.CollectionType
|
||||
]
|
||||
}
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
primary={library.Name}
|
||||
/>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
);
|
||||
})}
|
||||
</List>
|
||||
</MuiDrawer> */
|
||||
|
||||
export default Home;
|
||||
@@ -1,573 +0,0 @@
|
||||
/** @format */
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
import { EventEmitter as event } from "../../eventEmitter";
|
||||
import { getServer } from "../../utils/store/servers";
|
||||
import { getUser } from "../../utils/store/user";
|
||||
|
||||
import { theme } from "../../theme";
|
||||
import "./home.module.scss";
|
||||
|
||||
import { styled } from "@mui/material/styles";
|
||||
import Box from "@mui/material/Box";
|
||||
import Skeleton from "@mui/material/Skeleton";
|
||||
import Button from "@mui/material/Button";
|
||||
import MuiAppBar from "@mui/material/AppBar";
|
||||
import MuiDrawer from "@mui/material/Drawer";
|
||||
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 Toolbar from "@mui/material/Toolbar";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
|
||||
import Carousel from "react-material-ui-carousel";
|
||||
|
||||
// Custom Components
|
||||
import { CardLandscape, CardPotrait } from "../../components/card/card";
|
||||
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||
// Icons
|
||||
import {
|
||||
MediaCollectionTypeIconCollection,
|
||||
MediaTypeIconCollection,
|
||||
} from "../../components/utils/iconsCollection.jsx";
|
||||
import MenuIcon from "mdi-material-ui/Menu";
|
||||
import Close from "mdi-material-ui/Close";
|
||||
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
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)`,
|
||||
}));
|
||||
|
||||
const AppBar = styled(MuiAppBar, {
|
||||
shouldForwardProp: (prop) => prop !== "open",
|
||||
})(({ theme }) => ({
|
||||
zIndex: theme.zIndex.drawer + 1,
|
||||
transition: theme.transitions.create(["width", "margin"], {
|
||||
easing: theme.transitions.easing.sharp,
|
||||
duration: theme.transitions.duration.leavingScreen,
|
||||
}),
|
||||
backgroundColor: "transparent",
|
||||
backgroundImage: "none",
|
||||
}));
|
||||
|
||||
export const Home = () => {
|
||||
const [skeletonStateSideMenu, setSkeletonStateSideMenu] = useState(false);
|
||||
const [skeletonStateCarousel, setSkeletonStateCarousel] = useState(false);
|
||||
|
||||
const [userLibraries, setUserLibraries] = useState([]);
|
||||
const [latestMovies, setLatestMovies] = useState([]);
|
||||
const [user, setUser] = useState({
|
||||
Name: "",
|
||||
});
|
||||
|
||||
const navigate = useNavigate();
|
||||
const excludeTypes = ["boxsets", "playlists", "livetv", "channels"];
|
||||
|
||||
const [latestMedia, setLatestMedia] = useState([]);
|
||||
|
||||
const [drawerState, setDrawerState] = useState(false);
|
||||
|
||||
const scrollTrigger = useScrollTrigger({ threshold: 5 });
|
||||
|
||||
const handleDrawerOpen = () => {
|
||||
setDrawerState(true);
|
||||
};
|
||||
|
||||
const handleDrawerClose = () => {
|
||||
setDrawerState(false);
|
||||
};
|
||||
|
||||
const handleLogout = async () => {
|
||||
await window.api.logout();
|
||||
navigate("/login");
|
||||
console.log("logged out user");
|
||||
};
|
||||
|
||||
const currentUser = async () => {
|
||||
const user = await getUserApi(window.api).getCurrentUser();
|
||||
return user;
|
||||
};
|
||||
|
||||
const userLibs = async () => {
|
||||
const userLibs = await getLibraryApi(window.api).getMediaFolders();
|
||||
return userLibs;
|
||||
};
|
||||
|
||||
const getLatestMedia = async (user) => {
|
||||
const media = await getUserLibraryApi(window.api).getLatestMedia({
|
||||
userId: user.Id,
|
||||
fields: "Overview",
|
||||
enableUserData: true,
|
||||
});
|
||||
return media;
|
||||
};
|
||||
|
||||
const userViews = async (user) => {
|
||||
const userviews = await getUserViewsApi(window.api).getUserViews({
|
||||
userId: user.Id,
|
||||
});
|
||||
return userviews;
|
||||
};
|
||||
|
||||
const authUser = async () => {
|
||||
const server = await getServer();
|
||||
const user = await getUser();
|
||||
event.emit("create-jellyfin-api", server.Ip);
|
||||
const auth = await api.authenticateUserByName(
|
||||
user.Name,
|
||||
user.Password,
|
||||
);
|
||||
sessionStorage.setItem("accessToken", auth.data.AccessToken);
|
||||
event.emit("set-api-accessToken", window.api.basePath);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
// TODO Implement a better way to check and create api object when page reloaded. Hint: Maybe use session api or something (*route - home*)
|
||||
if (!window.api) {
|
||||
authUser().then(() => {
|
||||
currentUser().then((usr) => {
|
||||
setUser(usr.data);
|
||||
userLibs().then((libs) => {
|
||||
setUserLibraries(libs.data.Items);
|
||||
setSkeletonStateSideMenu(true);
|
||||
});
|
||||
getLatestMedia(usr.data).then((media) => {
|
||||
console.log("Using this");
|
||||
setLatestMedia(media.data);
|
||||
setSkeletonStateCarousel(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
currentUser().then((usr) => {
|
||||
setUser(usr.data);
|
||||
userLibs().then((libs) => {
|
||||
setUserLibraries(libs.data.Items);
|
||||
setSkeletonStateSideMenu(true);
|
||||
});
|
||||
getLatestMedia(usr.data).then((media) => {
|
||||
setLatestMedia(media.data);
|
||||
setSkeletonStateCarousel(true);
|
||||
});
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
}}
|
||||
>
|
||||
<AppBar
|
||||
position="fixed"
|
||||
open={drawerState}
|
||||
color="primary"
|
||||
elevation={0}
|
||||
>
|
||||
<Toolbar>
|
||||
<IconButton
|
||||
color="inherit"
|
||||
aria-label="open drawer"
|
||||
onClick={handleDrawerOpen}
|
||||
edge="start"
|
||||
sx={{
|
||||
marginRight: 5,
|
||||
...(drawerState && { display: "none" }),
|
||||
}}
|
||||
>
|
||||
<MenuIcon />
|
||||
</IconButton>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
|
||||
<MiniDrawer
|
||||
variant="permanent"
|
||||
open={false}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
backgroundColor: "inherit",
|
||||
border: "none",
|
||||
width: `calc(${theme.spacing(7)} + 10px)`,
|
||||
},
|
||||
}}
|
||||
>
|
||||
<DrawerHeader
|
||||
className="Mui-DrawerHeader"
|
||||
sx={{ position: "relative" }}
|
||||
>
|
||||
{/* <div>
|
||||
<Avatar src={""}/>
|
||||
<Typography variant="h3">
|
||||
{user["Name"]}
|
||||
</Typography>
|
||||
</div> */}
|
||||
<IconButton
|
||||
onClick={handleDrawerClose}
|
||||
sx={{
|
||||
position: "absolute",
|
||||
top: "10%",
|
||||
right: "5%",
|
||||
opacity: drawerState ? 1 : 0,
|
||||
}}
|
||||
>
|
||||
<Close />
|
||||
</IconButton>
|
||||
</DrawerHeader>
|
||||
<Divider />
|
||||
{skeletonStateSideMenu ? (
|
||||
<List sx={{ border: "none" }}>
|
||||
{userLibraries.map((library, index) => {
|
||||
return (
|
||||
<Tooltip
|
||||
title={library.Name}
|
||||
placement="right"
|
||||
arrow
|
||||
followCursor
|
||||
key={index}
|
||||
>
|
||||
<ListItem disablePadding>
|
||||
<ListItemButton
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
drawerState
|
||||
? "initial"
|
||||
: "center",
|
||||
px: 2.5,
|
||||
}}
|
||||
>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
mr: drawerState
|
||||
? 3
|
||||
: "auto",
|
||||
justifyContent:
|
||||
"center",
|
||||
}}
|
||||
>
|
||||
{
|
||||
MediaCollectionTypeIconCollection[
|
||||
library
|
||||
.CollectionType
|
||||
]
|
||||
}
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
);
|
||||
})}
|
||||
</List>
|
||||
) : (
|
||||
<>
|
||||
<Skeleton
|
||||
height="100%"
|
||||
variant="rounded"
|
||||
width="calc(100% - 10px )"
|
||||
sx={{ margin: "5px" }}
|
||||
></Skeleton>
|
||||
</>
|
||||
)}
|
||||
</MiniDrawer>
|
||||
|
||||
<MuiDrawer
|
||||
anchor="left"
|
||||
open={drawerState}
|
||||
onClose={handleDrawerClose}
|
||||
>
|
||||
<DrawerHeader
|
||||
className="Mui-DrawerHeader"
|
||||
sx={{ position: "relative", height: "20vh" }}
|
||||
>
|
||||
{/* <div>
|
||||
<Avatar src={""}/>
|
||||
<Typography variant="h3">
|
||||
{user["Name"]}
|
||||
</Typography>
|
||||
</div> */}
|
||||
<IconButton
|
||||
onClick={handleDrawerClose}
|
||||
sx={{
|
||||
position: "absolute",
|
||||
top: "10%",
|
||||
right: "5%",
|
||||
}}
|
||||
>
|
||||
<Close />
|
||||
</IconButton>
|
||||
</DrawerHeader>
|
||||
<Divider />
|
||||
<List sx={{ border: "none" }}>
|
||||
{userLibraries.map((library, index) => {
|
||||
return (
|
||||
<ListItem disablePadding key={index}>
|
||||
<ListItemButton
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
drawerState
|
||||
? "initial"
|
||||
: "center",
|
||||
px: 2.5,
|
||||
}}
|
||||
>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
mr: 3,
|
||||
justifyContent:
|
||||
"center",
|
||||
}}
|
||||
>
|
||||
{
|
||||
MediaCollectionTypeIconCollection[
|
||||
library
|
||||
.CollectionType
|
||||
]
|
||||
}
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
primary={library.Name}
|
||||
/>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
);
|
||||
})}
|
||||
</List>
|
||||
</MuiDrawer>
|
||||
{/* <h1>Hey {userId} this is WIP Home</h1> */}
|
||||
<Box
|
||||
component="main"
|
||||
className="scrollY"
|
||||
sx={{ flexGrow: 1, p: 3 }}
|
||||
>
|
||||
<DrawerHeader />
|
||||
<Carousel
|
||||
className="hero-carousel"
|
||||
autoPlay={true}
|
||||
animation="fade"
|
||||
height="70vh"
|
||||
IndicatorIcon={
|
||||
<div className="hero-carousel-indicator"></div>
|
||||
}
|
||||
activeIndicatorIconButtonProps={{
|
||||
style: {
|
||||
background: "rgb(255 255 255)",
|
||||
},
|
||||
}}
|
||||
indicatorIconButtonProps={{
|
||||
style: {
|
||||
background: "rgb(255 255 255 / 0.3)",
|
||||
borderRadius: "2px",
|
||||
width: "100%",
|
||||
flexShrink: "1",
|
||||
},
|
||||
}}
|
||||
indicatorContainerProps={{
|
||||
style: {
|
||||
display: "flex",
|
||||
gap: "1em",
|
||||
},
|
||||
}}
|
||||
sx={{
|
||||
marginBottom: "1.5em",
|
||||
}}
|
||||
interval={10000}
|
||||
>
|
||||
{skeletonStateCarousel ? (
|
||||
latestMedia.map((item, index) => {
|
||||
// console.log(item);
|
||||
return (
|
||||
<Paper
|
||||
className="hero-carousel-slide"
|
||||
sx={{
|
||||
background:
|
||||
theme.palette
|
||||
.primary
|
||||
.background
|
||||
.dark,
|
||||
}}
|
||||
key={index}
|
||||
>
|
||||
<div className="hero-carousel-background-container">
|
||||
{item.ImageBlurHashes
|
||||
.Backdrop ? (
|
||||
<div
|
||||
className="hero-carousel-background-image"
|
||||
style={{
|
||||
backgroundImage: `url(${
|
||||
window
|
||||
.api
|
||||
.basePath +
|
||||
"/Items/" +
|
||||
item.Id +
|
||||
"/Images/Backdrop"
|
||||
})`,
|
||||
}}
|
||||
></div>
|
||||
) : (
|
||||
<div className="hero-carousel-background-image empty"></div>
|
||||
)}
|
||||
<div className="hero-carousel-background-icon-container">
|
||||
{
|
||||
MediaTypeIconCollection[
|
||||
item
|
||||
.MediaType
|
||||
]
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<Box className="hero-carousel-detail">
|
||||
<Typography
|
||||
variant="h3"
|
||||
className="hero-carousel-text"
|
||||
>
|
||||
{item.Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
className="hero-carousel-text"
|
||||
>
|
||||
{item.Overview}
|
||||
</Typography>
|
||||
</Box>
|
||||
</Paper>
|
||||
);
|
||||
})
|
||||
) : (
|
||||
<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>
|
||||
)}
|
||||
</Carousel>
|
||||
|
||||
<Box className="home-section">
|
||||
<Typography
|
||||
variant="h4"
|
||||
color="textPrimary"
|
||||
className="home-section-heading"
|
||||
>
|
||||
<div className="home-section-heading-decoration"></div>{" "}
|
||||
Libraries
|
||||
</Typography>
|
||||
<CardScroller displayCards={4}>
|
||||
{userLibraries.map((library, index) => {
|
||||
// console.log(userLibraries);
|
||||
return (
|
||||
<CardLandscape
|
||||
key={index}
|
||||
itemName={library.Name}
|
||||
itemId={library.Id}
|
||||
imageTags={library.imageTags}
|
||||
iconType={
|
||||
library.CollectionType
|
||||
}
|
||||
></CardLandscape>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
</Box>
|
||||
|
||||
<Box className="home-section">
|
||||
<Typography
|
||||
variant="h4"
|
||||
color="textPrimary"
|
||||
className="home-section-heading"
|
||||
>
|
||||
<div className="home-section-heading-decoration"></div>{" "}
|
||||
Latest Movies
|
||||
</Typography>
|
||||
<CardScroller displayCards={7}>
|
||||
{latestMovies.map((movie, index) => {
|
||||
return (
|
||||
<CardPotrait
|
||||
key={index}
|
||||
itemName={movie.Name}
|
||||
itemId={movie.Id}
|
||||
imageTags={movie.imageTags}
|
||||
iconType={movie.MediaType}
|
||||
></CardPotrait>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
</Box>
|
||||
|
||||
<Button variant="contained" onClick={handleLogout}>
|
||||
Logout
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,83 @@
|
||||
/** @format */
|
||||
|
||||
.item-detail {
|
||||
&-heading {
|
||||
opacity: 0.85;
|
||||
}
|
||||
&-backdrop {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: inherit;
|
||||
height: 100%;
|
||||
z-index: -2;
|
||||
opacity: 0.2;
|
||||
}
|
||||
&-header {
|
||||
display: flex;
|
||||
gap: 1em;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-end;
|
||||
position: relative;
|
||||
flex-wrap: wrap;
|
||||
&-backdrop {
|
||||
position: absolute;
|
||||
width: 100vw;
|
||||
height: 80vh;
|
||||
top: -88px;
|
||||
width: 100vw;
|
||||
right: 0;
|
||||
left: -24px;
|
||||
z-index: -2;
|
||||
filter: brightness(0.6);
|
||||
mask-image: linear-gradient(0deg, transparent, black 75%);
|
||||
-webkit-mask-image: linear-gradient(
|
||||
0deg,
|
||||
transparent,
|
||||
black 75%
|
||||
);
|
||||
}
|
||||
}
|
||||
&-image {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
object-position: top;
|
||||
transition: opacity $transition-time-default;
|
||||
&-blurhash {
|
||||
z-index: -1;
|
||||
}
|
||||
&-container {
|
||||
width: 15%;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
border-radius: $border-radius-default;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 0 15px rgb(0 0 0 / 0.4);
|
||||
&.Episode {
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0.25;
|
||||
}
|
||||
}
|
||||
&-icon-container {
|
||||
background: $clr-gradient-dark;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: -2;
|
||||
}
|
||||
}
|
||||
&-title-logo {
|
||||
filter: drop-shadow(0 0 10px rgb(0 0 0 /0.2));
|
||||
height: 100%;
|
||||
width: 45%;
|
||||
object-fit: contain;
|
||||
object-position: bottom;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,36 @@
|
||||
/** @format */
|
||||
.library-list {
|
||||
&-image {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1;
|
||||
object-fit: cover;
|
||||
&-container {
|
||||
position: relative;
|
||||
width: 4.5em;
|
||||
height: 4.5em;
|
||||
aspect-ratio: 1;
|
||||
border-radius: $border-radius-intensity-1;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2px 7px rgb(0 0 0 / 0.2);
|
||||
}
|
||||
}
|
||||
&-icon {
|
||||
font-size: 3em;
|
||||
fill: url(#clr-gradient-default) !important;
|
||||
|
||||
&-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 0;
|
||||
background: $clr-gradient-dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,19 @@
|
||||
/** @format */
|
||||
|
||||
import { useState, useEffect, useMemo } from "react";
|
||||
import { Cookies, useCookies } from "react-cookie";
|
||||
import { useState } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useNavigate, useParams, Link } from "react-router-dom";
|
||||
import { EventEmitter as event } from "../../eventEmitter.js";
|
||||
|
||||
import { getServer } from "../../utils/store/servers.js";
|
||||
import { saveUser } from "../../utils/store/user.js";
|
||||
import { saveUser } from "../../utils/storage/user.js";
|
||||
|
||||
// import Icon from "mdi-material-ui";
|
||||
import { MdiEyeOffOutline } from "../../components/icons/mdiEyeOffOutline";
|
||||
import { MdiEyeOutline } from "../../components/icons/mdiEyeOutline";
|
||||
import { MdiChevronRight } from "../../components/icons/mdiChevronRight";
|
||||
import { MdiEyeOffOutline } from "../../components/icons/mdiEyeOffOutline.jsx";
|
||||
import { MdiEyeOutline } from "../../components/icons/mdiEyeOutline.jsx";
|
||||
import { MdiChevronRight } from "../../components/icons/mdiChevronRight.jsx";
|
||||
|
||||
import Container from "@mui/material/Container";
|
||||
import Grid from "@mui/material/Grid";
|
||||
import Grid from "@mui/material/Unstable_Grid2";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import OutlinedInput from "@mui/material/OutlinedInput";
|
||||
import FormControl from "@mui/material/FormControl";
|
||||
@@ -23,19 +22,21 @@ import InputLabel from "@mui/material/InputLabel";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import LoadingButton from "@mui/lab/LoadingButton";
|
||||
import Button from "@mui/material/Button";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import { useSnackbar } from "notistack";
|
||||
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 { 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 { ErrorNotice } from "../../components/notices/errorNotice/errorNotice.jsx";
|
||||
|
||||
export const LoginWithImage = () => {
|
||||
const { userName, userId } = useParams();
|
||||
@@ -66,7 +67,7 @@ export const LoginWithImage = () => {
|
||||
|
||||
const authUser = async () => {
|
||||
try {
|
||||
const auth = await api.authenticateUserByName(
|
||||
const auth = await window.api.authenticateUserByName(
|
||||
userName,
|
||||
password.password,
|
||||
);
|
||||
@@ -86,7 +87,6 @@ export const LoginWithImage = () => {
|
||||
saveUser(userName, password.password);
|
||||
}
|
||||
event.emit("set-api-accessToken", window.api.basePath);
|
||||
// setAccessToken(user.data.AccessToken)
|
||||
setLoading(false);
|
||||
navigate(`/home`);
|
||||
};
|
||||
@@ -98,13 +98,22 @@ export const LoginWithImage = () => {
|
||||
return (
|
||||
<>
|
||||
<AppBarBackOnly />
|
||||
<Container maxWidth="xs" className="centered">
|
||||
<Container
|
||||
maxWidth="xs"
|
||||
sx={{
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Grid
|
||||
container
|
||||
direction="column"
|
||||
justifyContent="center"
|
||||
alignItems="center"
|
||||
spacing={2}
|
||||
width="100%"
|
||||
>
|
||||
<Grid
|
||||
container
|
||||
@@ -117,9 +126,9 @@ export const LoginWithImage = () => {
|
||||
textAlign="center"
|
||||
variant="h3"
|
||||
color="textPrimary"
|
||||
mb={2}
|
||||
>
|
||||
Login
|
||||
<br />
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid
|
||||
@@ -127,6 +136,7 @@ export const LoginWithImage = () => {
|
||||
direction="column"
|
||||
justifyContent="center"
|
||||
alignItems="center"
|
||||
mb={1}
|
||||
>
|
||||
<AvatarImage userId={userId} />
|
||||
<Typography
|
||||
@@ -137,7 +147,7 @@ export const LoginWithImage = () => {
|
||||
{userName}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item minWidth="100%">
|
||||
<Grid minWidth="100%">
|
||||
<FormGroup>
|
||||
<FormControl variant="outlined" fullWidth>
|
||||
<InputLabel htmlFor="user-password">
|
||||
@@ -186,7 +196,7 @@ export const LoginWithImage = () => {
|
||||
/>
|
||||
</FormGroup>
|
||||
</Grid>
|
||||
<Grid item minWidth="100%">
|
||||
<Grid minWidth="100%">
|
||||
<LoadingButton
|
||||
variant="contained"
|
||||
endIcon={<MdiChevronRight />}
|
||||
@@ -215,88 +225,106 @@ 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 users = useQuery({
|
||||
queryKey: ["login", "users"],
|
||||
queryFn: async () => {
|
||||
const users = await getUserApi(window.api).getPublicUsers();
|
||||
return users.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const createApi = async () => {
|
||||
const server = await getServer();
|
||||
event.emit("create-jellyfin-api", server.Ip);
|
||||
};
|
||||
if (users.isLoading) {
|
||||
return <LinearProgress />;
|
||||
}
|
||||
if (users.isSuccess) {
|
||||
return (
|
||||
<>
|
||||
<AppBarBackOnly />
|
||||
<Container
|
||||
maxWidth="md"
|
||||
sx={{
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Typography variant="h3" mb={2}>
|
||||
Users
|
||||
</Typography>
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<AppBarBackOnly />
|
||||
<Container maxWidth="md" className="centered">
|
||||
<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>
|
||||
<div className="buttons">
|
||||
<Button
|
||||
color="secondary"
|
||||
variant="contained"
|
||||
className="userEventButton"
|
||||
onClick={handleChangeServer}
|
||||
<Grid
|
||||
container
|
||||
columns={{
|
||||
xs: 2,
|
||||
sm: 3,
|
||||
md: 4,
|
||||
}}
|
||||
wrap="nowrap"
|
||||
alignItems="center"
|
||||
overflow="auto"
|
||||
width="100%"
|
||||
mb={3}
|
||||
paddingBottom={2}
|
||||
className="roundedScrollbar"
|
||||
>
|
||||
Change Server
|
||||
</Button>
|
||||
<Button
|
||||
variant="contained"
|
||||
className="userEventButton"
|
||||
onClick={handleManualLogin}
|
||||
>
|
||||
Manual Login
|
||||
</Button>
|
||||
</div>
|
||||
</Container>
|
||||
</>
|
||||
);
|
||||
{users.data.map((item, index) => {
|
||||
return (
|
||||
<Grid
|
||||
key={index}
|
||||
flexShrink={0}
|
||||
flexGrow={1}
|
||||
xs={1}
|
||||
sm={1}
|
||||
md={1}
|
||||
>
|
||||
<Card
|
||||
key={index}
|
||||
itemName={item.Name}
|
||||
itemId={item.Id}
|
||||
imageTags={
|
||||
!!item.PrimaryImageTag
|
||||
}
|
||||
// cardType="sqaure"
|
||||
iconType="Person"
|
||||
cardOrientation="sqaure"
|
||||
onClickEvent={() =>
|
||||
navigate(
|
||||
`/login/withImg/${item.Name}/${item.Id}/`,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Grid>
|
||||
);
|
||||
})}
|
||||
</Grid>
|
||||
|
||||
<div className="buttons">
|
||||
<Button
|
||||
color="secondary"
|
||||
variant="contained"
|
||||
className="userEventButton"
|
||||
onClick={handleChangeServer}
|
||||
>
|
||||
Change Server
|
||||
</Button>
|
||||
<Button
|
||||
variant="contained"
|
||||
className="userEventButton"
|
||||
onClick={handleManualLogin}
|
||||
>
|
||||
Manual Login
|
||||
</Button>
|
||||
</div>
|
||||
</Container>
|
||||
</>
|
||||
);
|
||||
}
|
||||
if (users.isError) {
|
||||
return <ErrorNotice />;
|
||||
}
|
||||
};
|
||||
|
||||
export const UserLoginManual = () => {
|
||||
@@ -311,6 +339,18 @@ 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,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const handleUsername = (event) => {
|
||||
setUserName(event.target.value);
|
||||
};
|
||||
@@ -331,7 +371,7 @@ export const UserLoginManual = () => {
|
||||
|
||||
const authUser = async () => {
|
||||
try {
|
||||
const auth = await api.authenticateUserByName(
|
||||
const auth = await window.api.authenticateUserByName(
|
||||
userName,
|
||||
password.password,
|
||||
);
|
||||
@@ -364,21 +404,35 @@ export const UserLoginManual = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
{server.isLoading && <LinearProgress />}
|
||||
<AppBarBackOnly />
|
||||
<Container maxWidth="xs" className="centered">
|
||||
<Container
|
||||
maxWidth="xs"
|
||||
sx={{
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Grid
|
||||
container
|
||||
spacing={2}
|
||||
direction="column"
|
||||
justifyContent="center"
|
||||
alignItems="center"
|
||||
sx={{
|
||||
opacity: server.isLoading ? 0 : 1,
|
||||
transition: "opacity 200ms",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
<Grid item xl={5} md={6} sx={{ marginBottom: "1em" }}>
|
||||
<Grid sx={{ marginBottom: "1em" }}>
|
||||
<Typography variant="h3" color="textPrimary">
|
||||
Login
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid sx={{ width: "100%" }} item xl={5} md={6}>
|
||||
<Grid sx={{ width: "100%" }}>
|
||||
<FormControl
|
||||
sx={{ width: "100%" }}
|
||||
variant="outlined"
|
||||
@@ -396,7 +450,7 @@ export const UserLoginManual = () => {
|
||||
/>
|
||||
</FormControl>
|
||||
</Grid>
|
||||
<Grid sx={{ width: "100%" }} item xl={5} md={6}>
|
||||
<Grid sx={{ width: "100%" }}>
|
||||
<FormGroup>
|
||||
<FormControl
|
||||
sx={{ width: "100%" }}
|
||||
@@ -449,7 +503,7 @@ export const UserLoginManual = () => {
|
||||
/>
|
||||
</FormGroup>
|
||||
</Grid>
|
||||
<Grid item xl={5} md={6} sx={{ width: "100%" }}>
|
||||
<Grid sx={{ width: "100%" }}>
|
||||
<LoadingButton
|
||||
variant="contained"
|
||||
endIcon={<MdiChevronRight />}
|
||||
@@ -462,6 +516,12 @@ export const UserLoginManual = () => {
|
||||
Login
|
||||
</LoadingButton>
|
||||
</Grid>
|
||||
<Grid sx={{ width: "100%" }}>
|
||||
<Typography variant="subtitle2">
|
||||
{server.isSuccess &&
|
||||
server.data.LoginDisclaimer}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Container>
|
||||
</>
|
||||
Loaded 100 of 113 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user