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

|

|
||||||
|
|
||||||
# :memo: Prerequisites:
|
# 📝 Prerequisites:
|
||||||
- Nodejs (≥19.1.0)
|
- Nodejs (≥19.1.0)
|
||||||
- Rust (≥1.66.1)
|
- Rust (≥1.66.1)
|
||||||
|
|
||||||
# :warning: Getting started:
|
# ℹ️ Getting started:
|
||||||
- Install Nodejs and Rust.
|
- Install Nodejs and Rust.
|
||||||
- install depencies using npm:
|
- install depencies using npm:
|
||||||
```shell
|
```shell
|
||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
# :information_source: Development:
|
# 🛠️ Development:
|
||||||
- Running the app:
|
- Running the app:
|
||||||
```shell
|
```shell
|
||||||
npm run tauri dev
|
npm run tauri dev
|
||||||
@@ -22,5 +22,11 @@
|
|||||||
```
|
```
|
||||||
- other commands can be found inside the `"scripts"` inside [package.json](https://github.com/prayag17/JellyPlayer/blob/main/package.json)
|
- other commands can be found inside the `"scripts"` inside [package.json](https://github.com/prayag17/JellyPlayer/blob/main/package.json)
|
||||||
|
|
||||||
# :sos: Help Wanted:
|
# 💻 Contribution:
|
||||||
- Home sections containing latest media.
|
- 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
|
||||||
@@ -10,6 +10,12 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<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>
|
<script type="module" src="/src/main.jsx"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
Generated
+1067
-936
File diff suppressed because it is too large.
Load diff
+17
-10
@@ -14,21 +14,28 @@
|
|||||||
"@emotion/styled": "^11.10.5",
|
"@emotion/styled": "^11.10.5",
|
||||||
"@fontsource/open-sans": "^4.5.13",
|
"@fontsource/open-sans": "^4.5.13",
|
||||||
"@jellyfin/sdk": "^0.7.0",
|
"@jellyfin/sdk": "^0.7.0",
|
||||||
"@mdi/js": "^7.1.96",
|
"@mdi/js": "^7.2.96",
|
||||||
"@mui/lab": "^5.0.0-alpha.110",
|
"@mui/lab": "^5.0.0-alpha.124",
|
||||||
"@mui/material": "^5.10.15",
|
"@mui/material": "^5.11.14",
|
||||||
|
"@reduxjs/toolkit": "^1.9.3",
|
||||||
|
"@tanstack/react-query": "^4.26.1",
|
||||||
|
"@tanstack/react-query-devtools": "^4.28.0",
|
||||||
|
"blurhash": "^2.0.5",
|
||||||
"events": "^3.3.0",
|
"events": "^3.3.0",
|
||||||
"framer-motion": "^7.10.2",
|
"framer-motion": "^10.10.0",
|
||||||
"localforage": "^1.10.0",
|
"localforage": "^1.10.0",
|
||||||
"match-sorter": "^6.3.1",
|
"match-sorter": "^6.3.1",
|
||||||
"mdi-material-ui": "^7.6.0",
|
"notistack": "^3.0.1",
|
||||||
"notistack": "^2.0.8",
|
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
|
"react-blurhash": "^0.3.0",
|
||||||
"react-cookie": "^4.1.1",
|
"react-cookie": "^4.1.1",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-material-ui-carousel": "^3.4.2",
|
"react-material-ui-carousel": "^3.4.2",
|
||||||
"react-multi-carousel": "^2.8.2",
|
"react-multi-carousel": "^2.8.2",
|
||||||
"react-router-dom": "^6.4.3",
|
"react-parallax": "^3.5.1",
|
||||||
|
"react-redux": "^8.0.5",
|
||||||
|
"react-router-dom": "^6.9.0",
|
||||||
|
"redux": "^4.2.1",
|
||||||
"sort-by": "^1.2.0",
|
"sort-by": "^1.2.0",
|
||||||
"tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store",
|
"tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store",
|
||||||
"uuid": "^9.0.0",
|
"uuid": "^9.0.0",
|
||||||
@@ -38,9 +45,9 @@
|
|||||||
"@tauri-apps/cli": "^1.2.2",
|
"@tauri-apps/cli": "^1.2.2",
|
||||||
"@types/react": "^18.0.24",
|
"@types/react": "^18.0.24",
|
||||||
"@types/react-dom": "^18.0.8",
|
"@types/react-dom": "^18.0.8",
|
||||||
"@vitejs/plugin-react": "^2.2.0",
|
"@vitejs/plugin-react": "^3.1.0",
|
||||||
"sass": "^1.56.1",
|
"sass": "^1.59.3",
|
||||||
"vite": "^3.2.3"
|
"vite": "^4.2.1"
|
||||||
},
|
},
|
||||||
"license": "GPL-3.0-only"
|
"license": "GPL-3.0-only"
|
||||||
}
|
}
|
||||||
+50
-15
@@ -1,13 +1,11 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
|
|
||||||
import { useState, useMemo } from "react";
|
import React, { useState } from "react";
|
||||||
import { ThemeProvider } from "@mui/material/styles";
|
import { ThemeProvider } from "@mui/material/styles";
|
||||||
import { SnackbarProvider } from "notistack";
|
import { SnackbarProvider } from "notistack";
|
||||||
import { useCookies, Cookies } from "react-cookie";
|
|
||||||
import {
|
import {
|
||||||
Routes,
|
Routes,
|
||||||
Route,
|
Route,
|
||||||
Navigate,
|
|
||||||
useNavigate,
|
useNavigate,
|
||||||
useLocation,
|
useLocation,
|
||||||
Outlet,
|
Outlet,
|
||||||
@@ -20,6 +18,9 @@ import { relaunch } from "@tauri-apps/api/process";
|
|||||||
|
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
|
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||||
|
|
||||||
// Theming
|
// Theming
|
||||||
import CssBaseline from "@mui/material/CssBaseline";
|
import CssBaseline from "@mui/material/CssBaseline";
|
||||||
import { theme } from "./theme";
|
import { theme } from "./theme";
|
||||||
@@ -37,12 +38,16 @@ import CircularProgress from "@mui/material/CircularProgress";
|
|||||||
|
|
||||||
// Routes
|
// Routes
|
||||||
import { ServerSetup, ServerList } from "./routes/setup/server/root";
|
import { ServerSetup, ServerList } from "./routes/setup/server/root";
|
||||||
import { Home } from "./routes/home/root";
|
import Home from "./routes/home/root";
|
||||||
import {
|
import {
|
||||||
UserLogin,
|
UserLogin,
|
||||||
LoginWithImage,
|
LoginWithImage,
|
||||||
UserLoginManual,
|
UserLoginManual,
|
||||||
} from "./routes/login/root";
|
} from "./routes/login/root";
|
||||||
|
import LibraryView from "./routes/library/root.jsx";
|
||||||
|
|
||||||
|
import { SideMenu } from "./components/menu/sidemenu.jsx";
|
||||||
|
import { AppBar } from "./components/appBar/appBar.jsx";
|
||||||
|
|
||||||
// Fonts
|
// Fonts
|
||||||
import "@fontsource/open-sans";
|
import "@fontsource/open-sans";
|
||||||
@@ -51,8 +56,8 @@ import "@fontsource/open-sans";
|
|||||||
import { Jellyfin } from "@jellyfin/sdk";
|
import { Jellyfin } from "@jellyfin/sdk";
|
||||||
import { version as appVer } from "../package.json";
|
import { version as appVer } from "../package.json";
|
||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
import { delServer, getServer } from "./utils/store/servers.js";
|
import { delServer, getServer } from "./utils/storage/servers.js";
|
||||||
import { getUser } from "./utils/store/user.js";
|
import { getUser } from "./utils/storage/user.js";
|
||||||
|
|
||||||
const jellyfin = new Jellyfin({
|
const jellyfin = new Jellyfin({
|
||||||
clientInfo: {
|
clientInfo: {
|
||||||
@@ -113,12 +118,16 @@ const AnimationWrapper = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const [userCookies] = useCookies(["user"]);
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [serverReachable, setServerReachable] = useState(true);
|
const [serverReachable, setServerReachable] = useState(true);
|
||||||
const [checkingServer, setChecking] = useState(false);
|
const [checkingServer, setChecking] = useState(false);
|
||||||
|
|
||||||
|
const createApi = async () => {
|
||||||
|
const server = await getServer();
|
||||||
|
event.emit("create-jellyfin-api", server.Ip);
|
||||||
|
};
|
||||||
|
|
||||||
const serverAvailable = async () => {
|
const serverAvailable = async () => {
|
||||||
const server = await getServer();
|
const server = await getServer();
|
||||||
|
|
||||||
@@ -126,10 +135,10 @@ function App() {
|
|||||||
console.log("server not found");
|
console.log("server not found");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (!window.api) {
|
// if (!window.api) {
|
||||||
console.log("Creating Jf api (without accessToken)");
|
// console.log("Creating Jf api (without accessToken)");
|
||||||
event.emit("create-jellyfin-api", server.Ip);
|
// event.emit("create-jellyfin-api", server.Ip);
|
||||||
}
|
// }
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -189,7 +198,7 @@ function App() {
|
|||||||
sessionStorage.setItem("accessToken", auth.data.AccessToken);
|
sessionStorage.setItem("accessToken", auth.data.AccessToken);
|
||||||
event.emit("set-api-accessToken", window.api.basePath);
|
event.emit("set-api-accessToken", window.api.basePath);
|
||||||
|
|
||||||
navigate("/home");
|
// navigate("/home");
|
||||||
};
|
};
|
||||||
|
|
||||||
const LogicalRoutes = () => {
|
const LogicalRoutes = () => {
|
||||||
@@ -199,7 +208,7 @@ function App() {
|
|||||||
if (serverReachable == true) {
|
if (serverReachable == true) {
|
||||||
userSaved().then((user_available) => {
|
userSaved().then((user_available) => {
|
||||||
if (user_available == true) {
|
if (user_available == true) {
|
||||||
userLogin();
|
navigate("/home");
|
||||||
} else {
|
} else {
|
||||||
usersAvailable().then(
|
usersAvailable().then(
|
||||||
(users_list_available) => {
|
(users_list_available) => {
|
||||||
@@ -239,6 +248,17 @@ function App() {
|
|||||||
};
|
};
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|
||||||
|
if (!window.api) {
|
||||||
|
console.log("WindowAPi not present");
|
||||||
|
createApi().then(
|
||||||
|
userSaved().then((userSavedBool) => {
|
||||||
|
if (userSavedBool) {
|
||||||
|
userLogin();
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SnackbarProvider maxSnack={5}>
|
<SnackbarProvider maxSnack={5}>
|
||||||
<ThemeProvider theme={theme}>
|
<ThemeProvider theme={theme}>
|
||||||
@@ -284,11 +304,20 @@ function App() {
|
|||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
<AnimatePresence>
|
<AnimatePresence>
|
||||||
|
<div style={{ display: "flex" }}>
|
||||||
<CssBaseline />
|
<CssBaseline />
|
||||||
<Routes key={location.pathname} location={location}>
|
<SideMenu />
|
||||||
|
<AppBar />
|
||||||
|
<Routes
|
||||||
|
key={location.pathname}
|
||||||
|
location={location}
|
||||||
|
>
|
||||||
<Route element={<AnimationWrapper />}>
|
<Route element={<AnimationWrapper />}>
|
||||||
{/* Main Routes */}
|
{/* Main Routes */}
|
||||||
<Route path="/home" element={<Home />} />
|
<Route
|
||||||
|
path="/home"
|
||||||
|
element={<Home />}
|
||||||
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/setup/server"
|
path="/setup/server"
|
||||||
element={<ServerSetup />}
|
element={<ServerSetup />}
|
||||||
@@ -311,6 +340,10 @@ function App() {
|
|||||||
path="/login/manual"
|
path="/login/manual"
|
||||||
element={<UserLoginManual />}
|
element={<UserLoginManual />}
|
||||||
/>
|
/>
|
||||||
|
<Route
|
||||||
|
path="/library/:id"
|
||||||
|
element={<LibraryView />}
|
||||||
|
/>
|
||||||
|
|
||||||
{/* Logical Routes */}
|
{/* Logical Routes */}
|
||||||
|
|
||||||
@@ -325,7 +358,9 @@ function App() {
|
|||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
</Routes>
|
</Routes>
|
||||||
|
</div>
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
|
<ReactQueryDevtools />
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
</SnackbarProvider>
|
</SnackbarProvider>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import MuiAppBar from "@mui/material/AppBar";
|
||||||
|
import TextField from "@mui/material/TextField";
|
||||||
|
import IconButton from "@mui/material/IconButton";
|
||||||
|
import InputAdornment from "@mui/material/InputAdornment";
|
||||||
|
import Toolbar from "@mui/material/Toolbar";
|
||||||
|
import Avatar from "@mui/material/Avatar";
|
||||||
|
import Box from "@mui/material/Box";
|
||||||
|
|
||||||
|
import { MdiMagnify } from "../icons/mdiMagnify";
|
||||||
|
import { theme } from "../../theme";
|
||||||
|
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
|
import { useQueryClient, useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
import "./appBar.module.scss";
|
||||||
|
import { MdiAccount } from "../icons/mdiAccount";
|
||||||
|
import { MdiHeartOutline } from "../icons/mdiHeartOutline";
|
||||||
|
|
||||||
|
export const AppBar = () => {
|
||||||
|
const visible = useSelector((state) => state.appBar.visible);
|
||||||
|
const backdropVisible = useSelector((state) => state.appBar.backdrop);
|
||||||
|
|
||||||
|
const user = useQuery({
|
||||||
|
queryKey: ["appBar", "user"],
|
||||||
|
queryFn: async () => {
|
||||||
|
let usr = await getUserApi(window.api).getCurrentUser();
|
||||||
|
return usr.data;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
visible && (
|
||||||
|
<MuiAppBar
|
||||||
|
sx={{
|
||||||
|
width: `calc(100vw - ${theme.spacing(7)} - 20px)`,
|
||||||
|
mr: "10px",
|
||||||
|
background: "transparent",
|
||||||
|
}}
|
||||||
|
className={
|
||||||
|
backdropVisible ? "appBar backdropVisible" : "appBar"
|
||||||
|
}
|
||||||
|
elevation={backdropVisible ? 6 : 0}
|
||||||
|
>
|
||||||
|
<Toolbar sx={{ justifyContent: "space-between" }}>
|
||||||
|
<Box sx={{ display: "flex", gap: 1 }}>
|
||||||
|
<TextField
|
||||||
|
variant="outlined"
|
||||||
|
placeholder="Search..."
|
||||||
|
size="small"
|
||||||
|
/>
|
||||||
|
<IconButton>
|
||||||
|
<MdiMagnify />
|
||||||
|
</IconButton>
|
||||||
|
</Box>
|
||||||
|
<Box sx={{ display: "flex", gap: 2 }}>
|
||||||
|
<IconButton>
|
||||||
|
<MdiHeartOutline />
|
||||||
|
</IconButton>
|
||||||
|
<IconButton sx={{ p: 0 }}>
|
||||||
|
{user.isSuccess &&
|
||||||
|
(user.data.PrimaryImageTag ==
|
||||||
|
undefined ? (
|
||||||
|
<Avatar
|
||||||
|
className="appBar-avatar"
|
||||||
|
alt={user.data.Name}
|
||||||
|
>
|
||||||
|
<MdiAccount className="appBar-avatar-icon" />
|
||||||
|
</Avatar>
|
||||||
|
) : (
|
||||||
|
<Avatar
|
||||||
|
className="appBar-avatar"
|
||||||
|
src={
|
||||||
|
window.api.basePath +
|
||||||
|
"/Users/" +
|
||||||
|
user.data.Id +
|
||||||
|
"/Images/Primary"
|
||||||
|
}
|
||||||
|
alt={user.data.Name}
|
||||||
|
>
|
||||||
|
<MdiAccount className="appBar-avatar-icon" />
|
||||||
|
</Avatar>
|
||||||
|
))}
|
||||||
|
</IconButton>
|
||||||
|
</Box>
|
||||||
|
</Toolbar>
|
||||||
|
</MuiAppBar>
|
||||||
|
)
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
.appBar {
|
||||||
|
transition: background $transition-time-default,
|
||||||
|
box-shadow $transition-time-default;
|
||||||
|
&.backdropVisible {
|
||||||
|
background: $clr-background-dark;
|
||||||
|
}
|
||||||
|
&-avatar {
|
||||||
|
background: $clr-gradient-dark;
|
||||||
|
&-icon {
|
||||||
|
fill: url(#clr-gradient-default) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,50 +4,14 @@ import PropTypes from "prop-types";
|
|||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import ButtonBase from "@mui/material/ButtonBase";
|
import ButtonBase from "@mui/material/ButtonBase";
|
||||||
|
|
||||||
import Account from "mdi-material-ui/Account";
|
import { MdiAccount } from "../icons/mdiAccount";
|
||||||
|
|
||||||
import "./avatar.module.scss";
|
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 (
|
return (
|
||||||
<div className="avatar-image-container">
|
<div className="avatar-image-container">
|
||||||
|
{!!userImageTags && (
|
||||||
<div
|
<div
|
||||||
className="avatar-image"
|
className="avatar-image"
|
||||||
style={{
|
style={{
|
||||||
@@ -59,9 +23,10 @@ export const AvatarImage = ({ userId }) => {
|
|||||||
"/Images/Primary')",
|
"/Images/Primary')",
|
||||||
}}
|
}}
|
||||||
></div>
|
></div>
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="avatar-image-icon-container">
|
<div className="avatar-image-icon-container">
|
||||||
<Account className="avatar-image-icon" />
|
<MdiAccount className="avatar-image-icon" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -71,12 +36,7 @@ export const AvatarSideMenu = ({ userName }) => {
|
|||||||
return <div></div>;
|
return <div></div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
AvatarCard.propType = {
|
|
||||||
userName: PropTypes.string.isRequired,
|
|
||||||
userId: PropTypes.string.isRequired,
|
|
||||||
userImageAvailable: PropTypes.bool.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
AvatarImage.propType = {
|
AvatarImage.propType = {
|
||||||
userId: PropTypes.string.isRequired,
|
userId: PropTypes.string.isRequired,
|
||||||
|
userImageTags: PropTypes.any,
|
||||||
};
|
};
|
||||||
@@ -1,44 +1,5 @@
|
|||||||
/** @format */
|
/** @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 {
|
.avatar-image {
|
||||||
aspect-ratio: 1;
|
aspect-ratio: 1;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -59,6 +20,6 @@
|
|||||||
padding: 0.2em;
|
padding: 0.2em;
|
||||||
background: $clr-accent-dark;
|
background: $clr-accent-dark;
|
||||||
color: $clr-accent-default;
|
color: $clr-accent-default;
|
||||||
font-size: 6em !important;
|
font-size: 2em !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+141
-76
@@ -2,109 +2,174 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
|
import Box from "@mui/material/Box";
|
||||||
|
import MuiCard from "@mui/material/Card";
|
||||||
|
import CardContent from "@mui/material/CardContent";
|
||||||
|
import CardMedia from "@mui/material/CardMedia";
|
||||||
|
import CardActionArea from "@mui/material/CardActionArea";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
import LinearProgress from "@mui/material/LinearProgress";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
MediaCollectionTypeIconCollectionCard,
|
MediaCollectionTypeIconCollectionCard,
|
||||||
MediaTypeIconCollectionCard,
|
TypeIconCollectionCard,
|
||||||
} from "../utils/iconsCollection";
|
} from "../utils/iconsCollection";
|
||||||
|
|
||||||
|
import { borderRadiusDefault } from "../../palette.module.scss";
|
||||||
import "./card.module.scss";
|
import "./card.module.scss";
|
||||||
|
|
||||||
export const CardLandscape = ({ itemName, itemId, imageTags, iconType }) => {
|
export const Card = ({
|
||||||
const imageAvailable = () => {
|
itemName,
|
||||||
console.log(imageTags);
|
itemId,
|
||||||
if (imageTags == undefined) {
|
imageTags,
|
||||||
console.log("hee");
|
iconType,
|
||||||
return false;
|
cardType = "",
|
||||||
} else {
|
subText = "",
|
||||||
return true;
|
playedPercent,
|
||||||
}
|
cardOrientation,
|
||||||
};
|
props,
|
||||||
|
}) => {
|
||||||
return (
|
return (
|
||||||
<div className="card landscape">
|
<MuiCard
|
||||||
<div className="card-image-container">
|
className={"card " + cardOrientation}
|
||||||
{imageAvailable ? (
|
sx={{
|
||||||
<div
|
background: "transparent",
|
||||||
className="card-image"
|
borderRadius: borderRadiusDefault,
|
||||||
style={{
|
mr: 1,
|
||||||
backgroundImage:
|
}}
|
||||||
"url('" +
|
elevation={0}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<CardActionArea>
|
||||||
|
<Box
|
||||||
|
className="card-media-container"
|
||||||
|
sx={{
|
||||||
|
position: "relative",
|
||||||
|
m: 1,
|
||||||
|
aspectRatio:
|
||||||
|
cardOrientation == "landscape"
|
||||||
|
? "1.777"
|
||||||
|
: cardOrientation == "portait"
|
||||||
|
? "0.666"
|
||||||
|
: "1",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{imageTags &&
|
||||||
|
(cardType == "thumb" ? (
|
||||||
|
<CardMedia
|
||||||
|
component="div"
|
||||||
|
image={
|
||||||
window.api.basePath +
|
window.api.basePath +
|
||||||
"/Items/" +
|
"/Items/" +
|
||||||
itemId +
|
itemId +
|
||||||
"/Images/Primary')",
|
"/Images/Backdrop?fillHeight=300&fillWidth=532&quality=96"
|
||||||
}}
|
|
||||||
></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>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const CardPotrait = ({ itemName, itemId, imageTags, iconType }) => {
|
|
||||||
const imageAvailable = () => {
|
|
||||||
console.log(imageTags);
|
|
||||||
if (imageTags == undefined) {
|
|
||||||
console.log("hee");
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
};
|
alt={itemName}
|
||||||
return (
|
sx={{
|
||||||
<div className="card portrait">
|
width: "100%",
|
||||||
<div className="card-image-container">
|
aspectRatio:
|
||||||
{imageAvailable ? (
|
cardOrientation == "landscape"
|
||||||
<div
|
? "1.777"
|
||||||
|
: cardOrientation ==
|
||||||
|
"portait"
|
||||||
|
? "0.666"
|
||||||
|
: "1",
|
||||||
|
}}
|
||||||
className="card-image"
|
className="card-image"
|
||||||
style={{
|
></CardMedia>
|
||||||
backgroundImage:
|
) : (
|
||||||
"url('" +
|
<CardMedia
|
||||||
|
component="div"
|
||||||
|
image={
|
||||||
window.api.basePath +
|
window.api.basePath +
|
||||||
"/Items/" +
|
"/Items/" +
|
||||||
itemId +
|
itemId +
|
||||||
"/Images/Primary?quality=95&fillHeight=350&fillWidth=243')",
|
"/Images/Primary"
|
||||||
|
}
|
||||||
|
alt={itemName}
|
||||||
|
sx={{
|
||||||
|
width: "100%",
|
||||||
|
aspectRatio:
|
||||||
|
cardOrientation == "landscape"
|
||||||
|
? "1.777"
|
||||||
|
: cardOrientation ==
|
||||||
|
"portait"
|
||||||
|
? "0.666"
|
||||||
|
: "1",
|
||||||
}}
|
}}
|
||||||
></div>
|
className="card-image"
|
||||||
) : (
|
></CardMedia>
|
||||||
<div className="card-image empty"></div>
|
))}
|
||||||
)}
|
|
||||||
<div className="card-image-icon-container">
|
<div className="card-image-icon-container">
|
||||||
{MediaTypeIconCollectionCard[iconType]}
|
{cardType == "lib"
|
||||||
</div>
|
? MediaCollectionTypeIconCollectionCard[
|
||||||
|
iconType
|
||||||
|
]
|
||||||
|
: TypeIconCollectionCard[iconType]}
|
||||||
</div>
|
</div>
|
||||||
|
{!!playedPercent && (
|
||||||
|
<LinearProgress
|
||||||
|
variant="determinate"
|
||||||
|
value={playedPercent}
|
||||||
|
sx={{
|
||||||
|
width: "90%",
|
||||||
|
position: "absolute",
|
||||||
|
left: "5%",
|
||||||
|
bottom: "5%",
|
||||||
|
borderRadius: "100px",
|
||||||
|
height: "5px",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
|
||||||
<div className="card-text-container">
|
<CardContent
|
||||||
<Typography variant="button" color="white">
|
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}
|
{itemName}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
<Typography
|
||||||
</div>
|
gutterBottom
|
||||||
|
variant="subtitle2"
|
||||||
|
component="div"
|
||||||
|
color="gray"
|
||||||
|
textAlign="left"
|
||||||
|
// textOverflow={}
|
||||||
|
// fontSize="0.85em"
|
||||||
|
width="fit-content"
|
||||||
|
maxWidth="100%"
|
||||||
|
noWrap
|
||||||
|
>
|
||||||
|
{subText}
|
||||||
|
</Typography>
|
||||||
|
</CardContent>
|
||||||
|
</CardActionArea>
|
||||||
|
</MuiCard>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
CardLandscape.propTypes = {
|
Card.propTypes = {
|
||||||
itemName: PropTypes.string.isRequired,
|
itemName: PropTypes.string.isRequired,
|
||||||
itemId: PropTypes.string.isRequired,
|
itemId: PropTypes.string.isRequired,
|
||||||
imageTags: PropTypes.object,
|
imageTags: PropTypes.bool,
|
||||||
iconType: PropTypes.string.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
CardPotrait.propTypes = {
|
|
||||||
itemName: PropTypes.string.isRequired,
|
|
||||||
itemId: PropTypes.string.isRequired,
|
|
||||||
imageTags: PropTypes.object,
|
|
||||||
iconType: PropTypes.string.isRequired,
|
iconType: PropTypes.string.isRequired,
|
||||||
|
cardType: PropTypes.string,
|
||||||
|
subText: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||||
|
playedPercent: PropTypes.number,
|
||||||
|
cardOrientation: PropTypes.string.isRequired,
|
||||||
};
|
};
|
||||||
@@ -1,21 +1,10 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
margin-right: 1em;
|
border-radius: $border-radius-default;
|
||||||
|
|
||||||
&.landscape {
|
|
||||||
--image-aspect-ratio: 1.77;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.portrait {
|
|
||||||
--image-aspect-ratio: 0.65;
|
|
||||||
}
|
|
||||||
|
|
||||||
&-image {
|
&-image {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
border-radius: $border-radius-default;
|
||||||
border-radius: 10px;
|
|
||||||
aspect-ratio: var(--image-aspect-ratio);
|
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
&-container {
|
&-container {
|
||||||
@@ -23,27 +12,26 @@
|
|||||||
}
|
}
|
||||||
&-icon {
|
&-icon {
|
||||||
font-size: 4.5em !important;
|
font-size: 4.5em !important;
|
||||||
|
fill: url(#clr-gradient-default) !important;
|
||||||
|
|
||||||
&-container {
|
&-container {
|
||||||
display: flex;
|
display: flex !important;
|
||||||
|
aspect-ratio: 1.777;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
width: 100% !important;
|
||||||
|
color: transparent;
|
||||||
|
background: $clr-gradient-dark;
|
||||||
|
border-radius: 10px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 100% !important;
|
height: 100%;
|
||||||
height: 100% !important;
|
z-index: -1;
|
||||||
border-radius: $border-radius-default;
|
|
||||||
color: $clr-accent-default;
|
|
||||||
background: $clr-accent-dark;
|
|
||||||
z-index: 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&-text-container {
|
&-text-container {
|
||||||
margin-top: 0.5em;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|||||||
@@ -1,53 +1,25 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
|
|
||||||
import { useRef, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
import Carousel from "react-multi-carousel";
|
import Carousel from "react-multi-carousel";
|
||||||
import "react-multi-carousel/lib/styles.css";
|
import "react-multi-carousel/lib/styles.css";
|
||||||
|
|
||||||
import ChevronLeft from "mdi-material-ui/ChevronLeft";
|
import { MdiChevronLeft } from "../icons/mdiChevronLeft";
|
||||||
import ChevronRight from "mdi-material-ui/ChevronRight";
|
import { MdiChevronRight } from "../icons/mdiChevronRight";
|
||||||
|
|
||||||
import { styled } from "@mui/material/styles";
|
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 ButtonGroup from "@mui/material/ButtonGroup";
|
||||||
|
|
||||||
import "./cardScroller.module.scss";
|
import "./cardScroller.module.scss";
|
||||||
|
export const CardScroller = ({ children, displayCards, title }) => {
|
||||||
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 }) => {
|
|
||||||
const responsive = {
|
const responsive = {
|
||||||
desktop: {
|
desktop: {
|
||||||
breakpoint: { max: 3000, min: 1024 },
|
breakpoint: { max: 3000, min: 1025 },
|
||||||
items: displayCards,
|
items: displayCards,
|
||||||
slidesToSlide: displayCards, // optional, default to 1.
|
slidesToSlide: displayCards, // optional, default to 1.
|
||||||
},
|
},
|
||||||
@@ -63,21 +35,51 @@ export const CardScroller = ({ children, displayCards }) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [carouselRef, setCarouselRef] = useState();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<Box className="card-scroller-container" sx={{ mb: 4 }}>
|
||||||
|
<Box sx={{ mb: 2 }} className="card-scroller-header-container">
|
||||||
|
<Typography
|
||||||
|
variant="h4"
|
||||||
|
color="textPrimary"
|
||||||
|
className="card-scroller-heading"
|
||||||
|
>
|
||||||
|
<div className="card-scroller-heading-decoration"></div>{" "}
|
||||||
|
{title}
|
||||||
|
</Typography>
|
||||||
|
<ButtonGroup className="card-scroller-button-group">
|
||||||
|
<IconButton
|
||||||
|
className="card-scroller-button"
|
||||||
|
onClick={() => carouselRef.previous()}
|
||||||
|
>
|
||||||
|
<MdiChevronLeft />
|
||||||
|
</IconButton>
|
||||||
|
<IconButton
|
||||||
|
className="card-scroller-button"
|
||||||
|
onClick={() => carouselRef.next()}
|
||||||
|
>
|
||||||
|
<MdiChevronRight />
|
||||||
|
</IconButton>
|
||||||
|
</ButtonGroup>
|
||||||
|
</Box>
|
||||||
<Carousel
|
<Carousel
|
||||||
swipeable={false}
|
swipeable={false}
|
||||||
draggable={false}
|
draggable={false}
|
||||||
responsive={responsive}
|
responsive={responsive}
|
||||||
arrows={true}
|
arrows={false}
|
||||||
customRightArrow={<SliderButtonRight />}
|
ref={(el) => setCarouselRef(el)}
|
||||||
customLeftArrow={<SliderButtonLeft />}
|
// customButtonGroup={<HomeSectionHeader />}
|
||||||
|
// renderButtonGroupOutside={true}
|
||||||
className="card-scroller"
|
className="card-scroller"
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</Carousel>
|
</Carousel>
|
||||||
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
CardScroller.propTypes = {
|
CardScroller.propTypes = {
|
||||||
displayCards: PropTypes.number.isRequired,
|
displayCards: PropTypes.number.isRequired,
|
||||||
|
title: PropTypes.string.isRequired,
|
||||||
};
|
};
|
||||||
@@ -7,23 +7,25 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
&-button {
|
&-button {
|
||||||
color: white;
|
aspect-ratio: 1;
|
||||||
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 {
|
&-header-container {
|
||||||
right: 0%;
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
&.left {
|
&-heading {
|
||||||
left: 0%;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
gap: 0.35em;
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 0.25em !important;
|
||||||
|
&-decoration {
|
||||||
|
width: 0.75em;
|
||||||
|
height: 3px;
|
||||||
|
background: white;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||||
|
import { Card } from "../../components/card/card";
|
||||||
|
import { CardsSkeleton } from "../skeleton/cards";
|
||||||
|
|
||||||
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
|
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||||
|
|
||||||
|
export const LatestMediaSection = ({ latestMediaLib }) => {
|
||||||
|
const user = useQuery({
|
||||||
|
queryKey: ["home", "user"],
|
||||||
|
queryFn: async () => {
|
||||||
|
let usr = await getUserApi(window.api).getCurrentUser();
|
||||||
|
return usr.data;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const fetchLatestMedia = async (library) => {
|
||||||
|
const media = await getUserLibraryApi(window.api).getLatestMedia({
|
||||||
|
userId: user.data.Id,
|
||||||
|
parentId: library,
|
||||||
|
limit: 16,
|
||||||
|
fields: ["PrimaryImageAspectRatio"],
|
||||||
|
});
|
||||||
|
return media.data;
|
||||||
|
};
|
||||||
|
const data = useQuery({
|
||||||
|
queryKey: ["homeSection, latestMedia", latestMediaLib],
|
||||||
|
queryFn: () => fetchLatestMedia(latestMediaLib[0]),
|
||||||
|
enabled: !!user.data,
|
||||||
|
});
|
||||||
|
if (data.isLoading) {
|
||||||
|
return <CardsSkeleton />;
|
||||||
|
}
|
||||||
|
if (data.isSuccess && data.data.length >= 1) {
|
||||||
|
return (
|
||||||
|
<CardScroller
|
||||||
|
displayCards={8}
|
||||||
|
title={"Latest " + latestMediaLib[1]}
|
||||||
|
>
|
||||||
|
{data.data.map((item, index) => {
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
key={index}
|
||||||
|
itemName={
|
||||||
|
!!item.SeriesId
|
||||||
|
? item.SeriesName
|
||||||
|
: item.Name
|
||||||
|
}
|
||||||
|
itemId={
|
||||||
|
!!item.SeriesId
|
||||||
|
? item.SeriesId
|
||||||
|
: item.Id
|
||||||
|
}
|
||||||
|
// imageTags={false}
|
||||||
|
imageTags={!!item.ImageTags.Primary}
|
||||||
|
iconType={item.Type}
|
||||||
|
subText={item.ProductionYear}
|
||||||
|
playedPercent={
|
||||||
|
item.UserData.PlayedPercentage
|
||||||
|
}
|
||||||
|
cardOrientation={
|
||||||
|
item.PrimaryImageAspectRatio == 1
|
||||||
|
? "sqaure"
|
||||||
|
: "portait"
|
||||||
|
}
|
||||||
|
></Card>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</CardScroller>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return <></>;
|
||||||
|
};
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import { MdiChevronLeft } from "./mdiChevronLeft";
|
||||||
|
/** @format */
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiAccount } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiAccount = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiAccount}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/** @format */
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiAccountMusic } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiAccountMusic = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiAccountMusic}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/** @format */
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiAccountTie } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiAccountTie = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiAccountTie}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/** @format */
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiAlbum } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiAlbum = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiAlbum}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -4,9 +4,9 @@ import SvgIcon from "@mui/material/SvgIcon";
|
|||||||
|
|
||||||
import { mdiArrowLeft } from "@mdi/js";
|
import { mdiArrowLeft } from "@mdi/js";
|
||||||
|
|
||||||
export const MdiArrowLeft = () => {
|
export const MdiArrowLeft = (props) => {
|
||||||
return (
|
return (
|
||||||
<SvgIcon>
|
<SvgIcon {...props}>
|
||||||
<path d={mdiArrowLeft}></path>
|
<path d={mdiArrowLeft}></path>
|
||||||
</SvgIcon>
|
</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,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";
|
import { mdiChevronRight } from "@mdi/js";
|
||||||
|
|
||||||
export const MdiChevronRight = () => {
|
export const MdiChevronRight = (props) => {
|
||||||
return (
|
return (
|
||||||
<SvgIcon>
|
<SvgIcon {...props}>
|
||||||
<path d={mdiChevronRight}></path>
|
<path d={mdiChevronRight}></path>
|
||||||
</SvgIcon>
|
</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>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -4,9 +4,9 @@ import SvgIcon from "@mui/material/SvgIcon";
|
|||||||
|
|
||||||
import { mdiEyeOffOutline } from "@mdi/js";
|
import { mdiEyeOffOutline } from "@mdi/js";
|
||||||
|
|
||||||
export const MdiEyeOffOutline = () => {
|
export const MdiEyeOffOutline = (props) => {
|
||||||
return (
|
return (
|
||||||
<SvgIcon>
|
<SvgIcon {...props}>
|
||||||
<path d={mdiEyeOffOutline}></path>
|
<path d={mdiEyeOffOutline}></path>
|
||||||
</SvgIcon>
|
</SvgIcon>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import SvgIcon from "@mui/material/SvgIcon";
|
|||||||
|
|
||||||
import { mdiEyeOutline } from "@mdi/js";
|
import { mdiEyeOutline } from "@mdi/js";
|
||||||
|
|
||||||
export const MdiEyeOutline = () => {
|
export const MdiEyeOutline = (props) => {
|
||||||
return (
|
return (
|
||||||
<SvgIcon>
|
<SvgIcon {...props}>
|
||||||
<path d={mdiEyeOutline}></path>
|
<path d={mdiEyeOutline}></path>
|
||||||
</SvgIcon>
|
</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 { 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 { mdiHeartOutline } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiHeartOutline = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiHeartOutline}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiHomeVariantOutline } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiHomeVariantOutline = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiHomeVariantOutline}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiImage } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiImage = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiImage}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiImageMultiple } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiImageMultiple = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiImageMultiple}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/** @format */
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiLogoutVariant } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiLogoutVariant = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiLogoutVariant}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/** @format */
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiMagnify } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiMagnify = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiMagnify}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/** @format */
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiMenu } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiMenu = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiMenu}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiMicrophone } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiMicrophone = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiMicrophone}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiMovieOutline } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiMovieOutline = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiMovieOutline}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiMultimedia } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiMultimedia = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiMultimedia}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/** @format */
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiMusic } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiMusic = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiMusic}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiMusicBoxMultipleOutline } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiMusicBoxMultipleOutline = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiMusicBoxMultipleOutline}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/** @format */
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiPlay } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiPlay = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiPlay}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/** @format */
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiPlayBoxMultiple } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiPlayBoxMultiple = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiPlayBoxMultiple}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/** @format */
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiPlayOutline } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiPlayOutline = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiPlayOutline}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiPlaylistMusicOutline } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiPlaylistMusicOutline = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiPlaylistMusicOutline}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,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,283 @@
|
|||||||
|
/** @format */
|
||||||
|
import { delUser } from "../../utils/storage/user";
|
||||||
|
|
||||||
|
import { useQueryClient, useQuery, QueryClient } from "@tanstack/react-query";
|
||||||
|
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||||
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
|
|
||||||
|
import { useNavigate, NavLink } from "react-router-dom";
|
||||||
|
|
||||||
|
import { theme } from "../../theme";
|
||||||
|
|
||||||
|
import { styled } from "@mui/material/styles";
|
||||||
|
import Skeleton from "@mui/material/Skeleton";
|
||||||
|
import Tooltip from "@mui/material/Tooltip";
|
||||||
|
import List from "@mui/material/List";
|
||||||
|
import ListItem from "@mui/material/ListItem";
|
||||||
|
import ListItemText from "@mui/material/ListItemText";
|
||||||
|
import ListItemIcon from "@mui/material/ListItemIcon";
|
||||||
|
import ListItemButton from "@mui/material/ListItemButton";
|
||||||
|
import IconButton from "@mui/material/IconButton";
|
||||||
|
import Divider from "@mui/material/Divider";
|
||||||
|
import MuiDrawer from "@mui/material/Drawer";
|
||||||
|
|
||||||
|
import { MdiMenu } from "../icons/mdiMenu";
|
||||||
|
import { MdiLogoutVariant } from "../icons/mdiLogoutVariant";
|
||||||
|
|
||||||
|
import { MediaCollectionTypeIconCollection } from "../../components/utils/iconsCollection.jsx";
|
||||||
|
|
||||||
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
|
import { hideSidemenu } from "../../utils/slice/sidemenu";
|
||||||
|
|
||||||
|
import { MdiHomeVariantOutline } from "../icons/mdiHomeVariantOutline";
|
||||||
|
|
||||||
|
import "./sidemenu.module.scss";
|
||||||
|
|
||||||
|
const drawerWidth = 320;
|
||||||
|
|
||||||
|
const DrawerHeader = styled("div")(({ theme }) => ({
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "flex-end",
|
||||||
|
padding: theme.spacing(0, 1),
|
||||||
|
// necessary for content to be below app bar
|
||||||
|
...theme.mixins.toolbar,
|
||||||
|
}));
|
||||||
|
|
||||||
|
const MiniDrawer = styled(MuiDrawer, {
|
||||||
|
shouldForwardProp: (prop) => prop !== "open",
|
||||||
|
})(({ theme }) => ({
|
||||||
|
flexShrink: 0,
|
||||||
|
whiteSpace: "nowrap",
|
||||||
|
boxSizing: "border-box",
|
||||||
|
backgroundColor: theme.palette.primary.background.dark,
|
||||||
|
overflowX: "hidden",
|
||||||
|
// width: `calc(${theme.spacing(7)} + 10px)`,
|
||||||
|
}));
|
||||||
|
|
||||||
|
export const SideMenu = ({}) => {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
const visible = useSelector((state) => state.sidebar.visible);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const user = useQuery({
|
||||||
|
queryKey: ["home", "user"],
|
||||||
|
queryFn: async () => {
|
||||||
|
let usr = await getUserApi(window.api).getCurrentUser();
|
||||||
|
return usr.data;
|
||||||
|
},
|
||||||
|
enabled: visible,
|
||||||
|
});
|
||||||
|
let libraries = useQuery({
|
||||||
|
queryKey: ["sidemenu", "libraries"],
|
||||||
|
queryFn: async () => {
|
||||||
|
let libs = await getUserViewsApi(window.api).getUserViews({
|
||||||
|
userId: user.data.Id,
|
||||||
|
});
|
||||||
|
return libs.data;
|
||||||
|
},
|
||||||
|
enabled: !!user.data,
|
||||||
|
});
|
||||||
|
const handleDrawerOpen = () => {};
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
const handleLogout = async () => {
|
||||||
|
console.log("Logging out user...");
|
||||||
|
await window.api.logout();
|
||||||
|
delUser();
|
||||||
|
dispatch(hideSidemenu());
|
||||||
|
navigate("/login");
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MiniDrawer
|
||||||
|
variant="permanent"
|
||||||
|
open={false}
|
||||||
|
PaperProps={{
|
||||||
|
sx: {
|
||||||
|
backgroundColor: "inherit",
|
||||||
|
border: "none",
|
||||||
|
width: visible
|
||||||
|
? `calc(${theme.spacing(7)} + 10px)`
|
||||||
|
: 0,
|
||||||
|
height: "100vh",
|
||||||
|
// display: visible ? "block" : "none",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
sx={{
|
||||||
|
width: visible ? `calc(${theme.spacing(7)} + 10px)` : 0,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<DrawerHeader
|
||||||
|
className="Mui-DrawerHeader"
|
||||||
|
sx={{
|
||||||
|
justifyContent: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{/* <div>
|
||||||
|
<Avatar src={""}/>
|
||||||
|
<Typography variant="h3">
|
||||||
|
{user["Name"]}
|
||||||
|
</Typography>
|
||||||
|
</div> */}
|
||||||
|
<IconButton
|
||||||
|
color="inherit"
|
||||||
|
aria-label="open drawer"
|
||||||
|
onClick={handleDrawerOpen}
|
||||||
|
>
|
||||||
|
<MdiMenu />
|
||||||
|
</IconButton>
|
||||||
|
</DrawerHeader>
|
||||||
|
<Divider />
|
||||||
|
{libraries.isLoading ? (
|
||||||
|
<>
|
||||||
|
<Skeleton
|
||||||
|
height="100%"
|
||||||
|
variant="rounded"
|
||||||
|
width="calc(100% - 10px )"
|
||||||
|
sx={{ margin: "5px" }}
|
||||||
|
></Skeleton>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<List sx={{ border: "none" }}>
|
||||||
|
{libraries.data.Items.map((library, index) => {
|
||||||
|
return (
|
||||||
|
<Tooltip
|
||||||
|
title={library.Name}
|
||||||
|
placement="right"
|
||||||
|
arrow
|
||||||
|
followCursor
|
||||||
|
key={index}
|
||||||
|
>
|
||||||
|
<ListItem
|
||||||
|
className="sidemenu-item-container"
|
||||||
|
disablePadding
|
||||||
|
>
|
||||||
|
<NavLink
|
||||||
|
to={
|
||||||
|
"/library/" +
|
||||||
|
library.Id
|
||||||
|
}
|
||||||
|
className={({
|
||||||
|
isActive,
|
||||||
|
isPending,
|
||||||
|
}) =>
|
||||||
|
isPending
|
||||||
|
? "sidemenu-item-pending sidemenu-item"
|
||||||
|
: isActive
|
||||||
|
? "sidemenu-item-active sidemenu-item"
|
||||||
|
: "sidemenu-item"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<ListItemButton
|
||||||
|
sx={{
|
||||||
|
minHeight: 48,
|
||||||
|
justifyContent:
|
||||||
|
"center",
|
||||||
|
px: 2.5,
|
||||||
|
}}
|
||||||
|
color="white"
|
||||||
|
>
|
||||||
|
<ListItemIcon
|
||||||
|
sx={{
|
||||||
|
minWidth: 0,
|
||||||
|
justifyContent:
|
||||||
|
"center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
MediaCollectionTypeIconCollection[
|
||||||
|
library
|
||||||
|
.CollectionType
|
||||||
|
]
|
||||||
|
}
|
||||||
|
</ListItemIcon>
|
||||||
|
</ListItemButton>
|
||||||
|
</NavLink>
|
||||||
|
</ListItem>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</List>
|
||||||
|
<List sx={{ marginTop: "auto" }}>
|
||||||
|
<Tooltip
|
||||||
|
title="Home"
|
||||||
|
placement="right"
|
||||||
|
followCursor
|
||||||
|
arrow
|
||||||
|
>
|
||||||
|
<ListItem
|
||||||
|
className="sidemenu-item-container"
|
||||||
|
disablePadding
|
||||||
|
>
|
||||||
|
<NavLink
|
||||||
|
to="/home"
|
||||||
|
className={({
|
||||||
|
isActive,
|
||||||
|
isPending,
|
||||||
|
}) =>
|
||||||
|
isPending
|
||||||
|
? "sidemenu-item-pending sidemenu-item"
|
||||||
|
: isActive
|
||||||
|
? "sidemenu-item-active sidemenu-item"
|
||||||
|
: "sidemenu-item"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<ListItemButton
|
||||||
|
sx={{
|
||||||
|
minHeight: 48,
|
||||||
|
justifyContent: "center",
|
||||||
|
px: 2.5,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ListItemIcon
|
||||||
|
sx={{
|
||||||
|
minWidth: 0,
|
||||||
|
justifyContent:
|
||||||
|
"center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<MdiHomeVariantOutline></MdiHomeVariantOutline>
|
||||||
|
</ListItemIcon>
|
||||||
|
</ListItemButton>
|
||||||
|
</NavLink>
|
||||||
|
</ListItem>
|
||||||
|
</Tooltip>
|
||||||
|
<Tooltip
|
||||||
|
title="Logout"
|
||||||
|
placement="right"
|
||||||
|
followCursor
|
||||||
|
arrow
|
||||||
|
>
|
||||||
|
<ListItem disablePadding>
|
||||||
|
<ListItemButton
|
||||||
|
sx={{
|
||||||
|
minHeight: 48,
|
||||||
|
justifyContent: "center",
|
||||||
|
px: 2.5,
|
||||||
|
}}
|
||||||
|
onClick={handleLogout}
|
||||||
|
>
|
||||||
|
<ListItemIcon
|
||||||
|
sx={{
|
||||||
|
minWidth: 0,
|
||||||
|
justifyContent: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<MdiLogoutVariant></MdiLogoutVariant>
|
||||||
|
</ListItemIcon>
|
||||||
|
</ListItemButton>
|
||||||
|
</ListItem>
|
||||||
|
</Tooltip>
|
||||||
|
</List>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</MiniDrawer>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// SideMenu.propTypes = {
|
||||||
|
// skeleton: PropTypes.bool.isRequired,
|
||||||
|
// data: PropTypes.array.isRequired,
|
||||||
|
// };
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
.sidemenu {
|
||||||
|
&-item {
|
||||||
|
position: relative;
|
||||||
|
&::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 15%;
|
||||||
|
bottom: 15%;
|
||||||
|
left: 7%;
|
||||||
|
width: 5px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: linear-gradient(
|
||||||
|
135deg,
|
||||||
|
$clr-accent-default,
|
||||||
|
$clr-secondary-default
|
||||||
|
);
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateX(-10px);
|
||||||
|
transition: transform $transition-time-default,
|
||||||
|
opacity $transition-time-default;
|
||||||
|
}
|
||||||
|
&-active::before {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import Skeleton from "@mui/material/Skeleton";
|
||||||
|
import Card from "@mui/material/Card";
|
||||||
|
import CardContent from "@mui/material/CardContent";
|
||||||
|
import CardMedia from "@mui/material/CardMedia";
|
||||||
|
import CardActionArea from "@mui/material/CardActionArea";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
import Box from "@mui/material/Box";
|
||||||
|
|
||||||
|
export const CardsSkeleton = () => {
|
||||||
|
return (
|
||||||
|
<Box sx={{ display: "flex", flexFlow: "column", mb: 4 }}>
|
||||||
|
<Typography variant="h4" sx={{ mb: "0.15em" }}>
|
||||||
|
<Skeleton width="35%" animation="wave" />
|
||||||
|
</Typography>
|
||||||
|
<Skeleton width="100%" variant="rounded" animation="wave">
|
||||||
|
<div style={{ paddingTop: "20%" }}></div>
|
||||||
|
</Skeleton>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/** @format */
|
||||||
|
import Skeleton from "@mui/material/Skeleton";
|
||||||
|
import Paper from "@mui/material/Paper";
|
||||||
|
import Box from "@mui/material/Box";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
import { theme } from "../../theme";
|
||||||
|
export const CarouselSkeleton = () => {
|
||||||
|
return (
|
||||||
|
<Paper
|
||||||
|
className="hero-carousel-slide"
|
||||||
|
sx={{
|
||||||
|
background: theme.palette.primary.background.dark,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className="hero-carousel-background">
|
||||||
|
<Skeleton
|
||||||
|
variant="rectangular"
|
||||||
|
height="100%"
|
||||||
|
animation="wave"
|
||||||
|
></Skeleton>
|
||||||
|
</div>
|
||||||
|
<Box className="hero-carousel-detail">
|
||||||
|
<Typography variant="h3" className="hero-carousel-text">
|
||||||
|
<Skeleton
|
||||||
|
variant="text"
|
||||||
|
sx={{ fontSize: "5rem" }}
|
||||||
|
width={300}
|
||||||
|
animation="wave"
|
||||||
|
></Skeleton>
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="p" className="hero-carousel-text">
|
||||||
|
<Skeleton
|
||||||
|
variant="text"
|
||||||
|
sx={{ fontSize: "3rem" }}
|
||||||
|
width={400}
|
||||||
|
animation="wave"
|
||||||
|
></Skeleton>
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
</Paper>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,61 +1,104 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
|
|
||||||
import MovieOutline from "mdi-material-ui/MovieOutline";
|
import { MdiMovieOutline } from "../icons/mdiMovieOutline";
|
||||||
import MusicBoxMultipleOutline from "mdi-material-ui/MusicBoxMultipleOutline";
|
import { MdiMusicBoxMultipleOutline } from "../icons/mdiMusicBoxMultipleOutline";
|
||||||
import PlaylistMusicOutline from "mdi-material-ui/PlaylistMusicOutline";
|
import { MdiPlaylistMusicOutline } from "../icons/mdiPlaylistMusicOutline";
|
||||||
import Television from "mdi-material-ui/Television";
|
import { MdiTelevision } from "../icons/mdiTelevision";
|
||||||
import FolderOutline from "mdi-material-ui/FolderOutline";
|
import { MdiFolderOutline } from "../icons/mdiFolderOutline";
|
||||||
import FolderMusicOutline from "mdi-material-ui/FolderMusicOutline";
|
import { MdiFolderMusicOutline } from "../icons/mdiFolderMusicOutline";
|
||||||
import Youtube from "mdi-material-ui/Youtube";
|
import { MdiYoutube } from "../icons/mdiYoutube";
|
||||||
import MultiMedia from "mdi-material-ui/Multimedia";
|
import { MdiMultimedia } from "../icons/mdiMultiMedia";
|
||||||
import BookMultiple from "mdi-material-ui/BookMultiple";
|
import { MdiBookMultiple } from "../icons/mdiBookMultiple";
|
||||||
import ImageMultiple from "mdi-material-ui/ImageMultiple";
|
import { MdiImageMultiple } from "../icons/mdiImageMultiple";
|
||||||
import TelevisionClassic from "mdi-material-ui/TelevisionClassic";
|
import { MdiTelevisionClassic } from "../icons/mdiTelevisionClassic";
|
||||||
import Filmstrip from "mdi-material-ui/Filmstrip";
|
import { MdiFilmstrip } from "../icons/mdiFilmstrip";
|
||||||
import Microphone from "mdi-material-ui/Microphone";
|
import { MdiMicrophone } from "../icons/mdiMicrophone";
|
||||||
import Image from "mdi-material-ui/Image";
|
import { MdiImage } from "../icons/mdiImage";
|
||||||
import Book from "mdi-material-ui/Book";
|
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 = {
|
export const MediaCollectionTypeIconCollection = {
|
||||||
universal: <MultiMedia />,
|
universal: <MdiMultimedia />,
|
||||||
movies: <MovieOutline />,
|
movies: <MdiMovieOutline />,
|
||||||
music: <MusicBoxMultipleOutline />,
|
music: <MdiMusicBoxMultipleOutline />,
|
||||||
playlists: <PlaylistMusicOutline />,
|
playlists: <MdiPlaylistMusicOutline />,
|
||||||
tvshows: <Television />,
|
tvshows: <MdiTelevision />,
|
||||||
boxsets: <MovieOutline />,
|
boxsets: <MdiMovieOutline />,
|
||||||
musicvideos: <FolderMusicOutline />,
|
musicvideos: <MdiFolderMusicOutline />,
|
||||||
trailers: <Youtube />,
|
trailers: <MdiYoutube />,
|
||||||
books: <BookMultiple />,
|
books: <MdiBookMultiple />,
|
||||||
photos: <ImageMultiple />,
|
photos: <MdiImageMultiple />,
|
||||||
livetv: <TelevisionClassic />,
|
livetv: <MdiTelevisionClassic />,
|
||||||
folder: <FolderOutline />,
|
folder: <MdiFolderOutline />,
|
||||||
|
logout: <MdiFolderOutline />,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MediaCollectionTypeIconCollectionCard = {
|
export const MediaCollectionTypeIconCollectionCard = {
|
||||||
universal: <MultiMedia className="card-image-icon" />,
|
universal: <MdiMultimedia className="card-image-icon" />,
|
||||||
movies: <MovieOutline className="card-image-icon" />,
|
movies: <MdiMovieOutline className="card-image-icon" />,
|
||||||
music: <MusicBoxMultipleOutline className="card-image-icon" />,
|
music: <MdiMusicBoxMultipleOutline className="card-image-icon" />,
|
||||||
playlists: <PlaylistMusicOutline className="card-image-icon" />,
|
playlists: <MdiPlaylistMusicOutline className="card-image-icon" />,
|
||||||
tvshows: <Television className="card-image-icon" />,
|
tvshows: <MdiTelevision className="card-image-icon" />,
|
||||||
boxsets: <MovieOutline className="card-image-icon" />,
|
boxsets: <MdiMovieOutline className="card-image-icon" />,
|
||||||
musicvideos: <FolderMusicOutline className="card-image-icon" />,
|
musicvideos: <MdiFolderMusicOutline className="card-image-icon" />,
|
||||||
trailers: <Youtube className="card-image-icon" />,
|
trailers: <MdiYoutube className="card-image-icon" />,
|
||||||
books: <BookMultiple className="card-image-icon" />,
|
books: <MdiBookMultiple className="card-image-icon" />,
|
||||||
photos: <ImageMultiple className="card-image-icon" />,
|
photos: <MdiImageMultiple className="card-image-icon" />,
|
||||||
livetv: <TelevisionClassic className="card-image-icon" />,
|
livetv: <MdiTelevisionClassic className="card-image-icon" />,
|
||||||
folder: <FolderOutline className="card-image-icon" />,
|
folder: <MdiFolderOutline className="card-image-icon" />,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MediaTypeIconCollection = {
|
export const MediaTypeIconCollection = {
|
||||||
Video: <Filmstrip className="hero-carousel-background-icon" />,
|
Movie: <MdiFilmstrip className="hero-carousel-background-icon" />,
|
||||||
Audio: <Microphone className="hero-carousel-background-icon" />,
|
Audio: <MdiMicrophone className="hero-carousel-background-icon" />,
|
||||||
Photo: <Image className="hero-carousel-background-icon" />,
|
Photo: <MdiImage className="hero-carousel-background-icon" />,
|
||||||
Book: <Book className="hero-carousel-background-icon" />,
|
Book: <MdiBook className="hero-carousel-background-icon" />,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MediaTypeIconCollectionCard = {
|
export const TypeIconCollectionCard = {
|
||||||
Video: <Filmstrip className="card-image-icon" />,
|
AggregateFolder: <MdiFolderMultiple className="card-image-icon" />,
|
||||||
Audio: <Microphone className="card-image-icon" />,
|
Audio: <MdiMicrophone className="card-image-icon" />,
|
||||||
Photo: <Image className="card-image-icon" />,
|
AudioBook: <MdiBookMusic className="card-image-icon" />,
|
||||||
Book: <Book 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" />,
|
||||||
};
|
};
|
||||||
+11
-3
@@ -4,19 +4,27 @@ import React from "react";
|
|||||||
import ReactDOM from "react-dom/client";
|
import ReactDOM from "react-dom/client";
|
||||||
|
|
||||||
import { BrowserRouter as Router } from "react-router-dom";
|
import { BrowserRouter as Router } from "react-router-dom";
|
||||||
import { CookiesProvider } from "react-cookie";
|
|
||||||
|
|
||||||
import { invoke } from "@tauri-apps/api/tauri";
|
import { invoke } from "@tauri-apps/api/tauri";
|
||||||
|
|
||||||
import App from "./App";
|
import App from "./App";
|
||||||
|
|
||||||
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
import store from "./store";
|
||||||
|
import { Provider } from "react-redux";
|
||||||
|
|
||||||
|
const queryClient = new QueryClient();
|
||||||
|
|
||||||
ReactDOM.createRoot(document.getElementById("root")).render(
|
ReactDOM.createRoot(document.getElementById("root")).render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<CookiesProvider>
|
<QueryClientProvider client={queryClient}>
|
||||||
|
<Provider store={store}>
|
||||||
<Router>
|
<Router>
|
||||||
<App />
|
<App />
|
||||||
</Router>
|
</Router>
|
||||||
</CookiesProvider>
|
</Provider>
|
||||||
|
</QueryClientProvider>
|
||||||
</React.StrictMode>,
|
</React.StrictMode>,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -10,4 +10,6 @@
|
|||||||
|
|
||||||
clrBackgroundDark: $clr-background-dark;
|
clrBackgroundDark: $clr-background-dark;
|
||||||
clrBackgroundLight: $clr-background-light;
|
clrBackgroundLight: $clr-background-light;
|
||||||
|
|
||||||
|
borderRadiusDefault: $border-radius-default;
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,12 @@
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
&-background {
|
&-background {
|
||||||
|
&-blurhash {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
&-container {
|
&-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
@@ -21,13 +27,12 @@
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
mask-image: linear-gradient(
|
mask-image: linear-gradient(
|
||||||
to right,
|
to right,
|
||||||
transparent 20%,
|
rgba(0, 0, 0, 0.1),
|
||||||
black 50%
|
black 90%
|
||||||
);
|
);
|
||||||
-webkit-mask-image: linear-gradient(
|
-webkit-mask-image: linear-gradient(
|
||||||
to right,
|
to right,
|
||||||
transparent 20%,
|
rgba(0, 0, 0, 0.1),
|
||||||
rgb(0 0 0 / 0.5) 50%,
|
|
||||||
black 90%
|
black 90%
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -39,6 +44,20 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
background-position: center;
|
||||||
|
opacity: 1;
|
||||||
|
mask-image: linear-gradient(
|
||||||
|
to right,
|
||||||
|
transparent 10%,
|
||||||
|
rgba(0, 0, 0, 0.5) 50%,
|
||||||
|
black 90%
|
||||||
|
);
|
||||||
|
-webkit-mask-image: linear-gradient(
|
||||||
|
to right,
|
||||||
|
transparent 10%,
|
||||||
|
rgba(0, 0, 0, 0.5) 50%,
|
||||||
|
black 90%
|
||||||
|
);
|
||||||
}
|
}
|
||||||
&-icon {
|
&-icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -46,11 +65,10 @@
|
|||||||
left: 70%;
|
left: 70%;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
color: $clr-accent-default;
|
fill: url(#clr-gradient-default) !important;
|
||||||
|
|
||||||
&-container {
|
&-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background: $clr-accent-dark;
|
background: $clr-gradient-dark;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
@@ -63,6 +81,13 @@
|
|||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
-webkit-line-clamp: 2;
|
-webkit-line-clamp: 2;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
&-logo {
|
||||||
|
max-width: 6em;
|
||||||
|
height: 2em;
|
||||||
|
object-fit: contain;
|
||||||
|
object-position: bottom;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
&-detail {
|
&-detail {
|
||||||
position: relative;
|
position: relative;
|
||||||
@@ -82,18 +107,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-section {
|
.backdropContainer {
|
||||||
&-heading {
|
background: linear-gradient(
|
||||||
display: flex;
|
45deg,
|
||||||
align-items: center;
|
$clr-background-default,
|
||||||
justify-content: flex-start;
|
$clr-background-light
|
||||||
gap: 0.35em;
|
);
|
||||||
position: relative;
|
|
||||||
margin-bottom: 0.25em !important;
|
|
||||||
&-decoration {
|
|
||||||
width: 0.75em;
|
|
||||||
height: 3px;
|
|
||||||
background: white;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+634
-450
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,9 @@
|
|||||||
|
/** @format */
|
||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
|
||||||
|
const LibraryView = () => {
|
||||||
|
const { id } = useParams();
|
||||||
|
return <h1>{id}</h1>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default LibraryView;
|
||||||
+52
-48
@@ -1,12 +1,12 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
|
|
||||||
import { useState, useEffect, useMemo } from "react";
|
import { useState, useEffect, useMemo } from "react";
|
||||||
import { Cookies, useCookies } from "react-cookie";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { useNavigate, useParams, Link } from "react-router-dom";
|
import { useNavigate, useParams, Link } from "react-router-dom";
|
||||||
import { EventEmitter as event } from "../../eventEmitter.js";
|
import { EventEmitter as event } from "../../eventEmitter.js";
|
||||||
|
|
||||||
import { getServer } from "../../utils/store/servers.js";
|
import { getServer } from "../../utils/storage/servers.js";
|
||||||
import { saveUser } from "../../utils/store/user.js";
|
import { saveUser } from "../../utils/storage/user.js";
|
||||||
|
|
||||||
// import Icon from "mdi-material-ui";
|
// import Icon from "mdi-material-ui";
|
||||||
import { MdiEyeOffOutline } from "../../components/icons/mdiEyeOffOutline";
|
import { MdiEyeOffOutline } from "../../components/icons/mdiEyeOffOutline";
|
||||||
@@ -28,14 +28,18 @@ import FormGroup from "@mui/material/FormGroup";
|
|||||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||||
import Checkbox from "@mui/material/Checkbox";
|
import Checkbox from "@mui/material/Checkbox";
|
||||||
|
|
||||||
import { AvatarCard, AvatarImage } from "../../components/avatar/avatar.jsx";
|
import { AvatarImage } from "../../components/avatar/avatar.jsx";
|
||||||
|
import { CardScroller } from "../../components/cardScroller/cardScroller.jsx";
|
||||||
|
import { Card } from "../../components/card/card.jsx";
|
||||||
import { AppBarBackOnly } from "../../components/appBar/backOnly.jsx";
|
import { AppBarBackOnly } from "../../components/appBar/backOnly.jsx";
|
||||||
|
|
||||||
// import { jellyfin } from "../../jellyfin";
|
// import { jellyfin } from "../../jellyfin";
|
||||||
// import getSystemApi from "@jellyfin/sdk";
|
// import getSystemApi from "@jellyfin/sdk";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
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 "./login.module.scss";
|
||||||
|
import { CardsSkeleton } from "../../components/skeleton/cards.jsx";
|
||||||
|
|
||||||
export const LoginWithImage = () => {
|
export const LoginWithImage = () => {
|
||||||
const { userName, userId } = useParams();
|
const { userName, userId } = useParams();
|
||||||
@@ -66,7 +70,7 @@ export const LoginWithImage = () => {
|
|||||||
|
|
||||||
const authUser = async () => {
|
const authUser = async () => {
|
||||||
try {
|
try {
|
||||||
const auth = await api.authenticateUserByName(
|
const auth = await window.api.authenticateUserByName(
|
||||||
userName,
|
userName,
|
||||||
password.password,
|
password.password,
|
||||||
);
|
);
|
||||||
@@ -86,7 +90,6 @@ export const LoginWithImage = () => {
|
|||||||
saveUser(userName, password.password);
|
saveUser(userName, password.password);
|
||||||
}
|
}
|
||||||
event.emit("set-api-accessToken", window.api.basePath);
|
event.emit("set-api-accessToken", window.api.basePath);
|
||||||
// setAccessToken(user.data.AccessToken)
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
navigate(`/home`);
|
navigate(`/home`);
|
||||||
};
|
};
|
||||||
@@ -215,44 +218,28 @@ export const UserLogin = () => {
|
|||||||
const handleManualLogin = () => {
|
const handleManualLogin = () => {
|
||||||
navigate("/login/manual");
|
navigate("/login/manual");
|
||||||
};
|
};
|
||||||
const getUsers = async () => {
|
const users = useQuery({
|
||||||
|
queryKey: ["login", "users"],
|
||||||
|
queryFn: async () => {
|
||||||
const users = await getUserApi(window.api).getPublicUsers();
|
const users = await getUserApi(window.api).getPublicUsers();
|
||||||
// console.log(users.data);
|
// console.log(users.data);
|
||||||
return users;
|
return users.data;
|
||||||
// return {};
|
// return {};
|
||||||
};
|
},
|
||||||
|
|
||||||
const createApi = async () => {
|
|
||||||
const server = await getServer();
|
|
||||||
event.emit("create-jellyfin-api", server.Ip);
|
|
||||||
};
|
|
||||||
|
|
||||||
useMemo(() => {
|
|
||||||
// TODO Implement a better way to check and create api object when page reloaded. Hint: Maybe use session api or something (*route - login*)
|
|
||||||
if (!window.api) {
|
|
||||||
createApi().then(() => {
|
|
||||||
getUsers().then((users) => {
|
|
||||||
setUsers(users.data);
|
|
||||||
console.log(userList);
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
} else {
|
|
||||||
getUsers().then((users) => {
|
|
||||||
setUsers(users.data);
|
|
||||||
console.log(userList);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AppBarBackOnly />
|
<AppBarBackOnly />
|
||||||
<Container maxWidth="md" className="centered">
|
<Container maxWidth="md" className="centered">
|
||||||
<Typography variant="h3" sx={{ marginBottom: "1em" }}>
|
{/* <Typography variant="h3" sx={{ marginBottom: "1em" }}>
|
||||||
Users
|
Users
|
||||||
</Typography>
|
</Typography> */}
|
||||||
<div className="userList">
|
{users.isLoading ? (
|
||||||
{userList.map((item, index) => {
|
<CardsSkeleton />
|
||||||
|
) : (
|
||||||
|
<CardScroller displayCards={5} title="Users">
|
||||||
|
{users.data.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
//
|
//
|
||||||
<Link
|
<Link
|
||||||
@@ -261,22 +248,22 @@ export const UserLogin = () => {
|
|||||||
className="userCard"
|
className="userCard"
|
||||||
index={index}
|
index={index}
|
||||||
>
|
>
|
||||||
{item.PrimaryImageTag ? (
|
<Card
|
||||||
<AvatarCard
|
key={index}
|
||||||
userName={item.Name}
|
itemName={item.Name}
|
||||||
userId={item.Id}
|
itemId={item.Id}
|
||||||
userImageAvailable={true}
|
imageTags={
|
||||||
></AvatarCard>
|
!!item.PrimaryImageTag
|
||||||
) : (
|
}
|
||||||
<AvatarCard
|
// cardType="sqaure"
|
||||||
userName={item.Name}
|
iconType="Person"
|
||||||
userImageAvailable={false}
|
cardOrientation="sqaure"
|
||||||
></AvatarCard>
|
/>
|
||||||
)}
|
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</CardScroller>
|
||||||
|
)}
|
||||||
<div className="buttons">
|
<div className="buttons">
|
||||||
<Button
|
<Button
|
||||||
color="secondary"
|
color="secondary"
|
||||||
@@ -311,6 +298,17 @@ export const UserLoginManual = () => {
|
|||||||
});
|
});
|
||||||
const [userName, setUserName] = useState("");
|
const [userName, setUserName] = useState("");
|
||||||
|
|
||||||
|
const server = useQuery({
|
||||||
|
queryKey: ["login, manual", "serverInfo"],
|
||||||
|
queryFn: async () => {
|
||||||
|
const result = await getBrandingApi(
|
||||||
|
window.api,
|
||||||
|
).getBrandingOptions();
|
||||||
|
return result.data;
|
||||||
|
},
|
||||||
|
enabled: !window.api,
|
||||||
|
});
|
||||||
|
|
||||||
const handleUsername = (event) => {
|
const handleUsername = (event) => {
|
||||||
setUserName(event.target.value);
|
setUserName(event.target.value);
|
||||||
};
|
};
|
||||||
@@ -331,7 +329,7 @@ export const UserLoginManual = () => {
|
|||||||
|
|
||||||
const authUser = async () => {
|
const authUser = async () => {
|
||||||
try {
|
try {
|
||||||
const auth = await api.authenticateUserByName(
|
const auth = await window.api.authenticateUserByName(
|
||||||
userName,
|
userName,
|
||||||
password.password,
|
password.password,
|
||||||
);
|
);
|
||||||
@@ -462,6 +460,12 @@ export const UserLoginManual = () => {
|
|||||||
Login
|
Login
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<Grid item xl={15} md={6} sx={{ width: "100%" }}>
|
||||||
|
<Typography variant="subtitle2">
|
||||||
|
{server.isSuccess &&
|
||||||
|
server.data.LoginDisclaimer}
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Container>
|
</Container>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { useNavigate } from "react-router-dom";
|
|||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
|
|
||||||
import { EventEmitter as event } from "../../../eventEmitter.js";
|
import { EventEmitter as event } from "../../../eventEmitter.js";
|
||||||
import { setServer } from "../../../utils/store/servers.js";
|
import { setServer } from "../../../utils/storage/servers.js";
|
||||||
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import { configureStore } from "@reduxjs/toolkit";
|
||||||
|
import sideBarReducer from "./utils/slice/sidemenu";
|
||||||
|
import appBarReducer from "./utils/slice/appBar";
|
||||||
|
export default configureStore({
|
||||||
|
reducer: {
|
||||||
|
sidebar: sideBarReducer,
|
||||||
|
appBar: appBarReducer,
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -1,4 +1,18 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
|
::-webkit-scrollbar {
|
||||||
|
width: 10px;
|
||||||
|
background: $clr-background-dark;
|
||||||
|
}
|
||||||
|
::-webkit-scrollbar-track {
|
||||||
|
background-color: transparent;
|
||||||
|
&:hover {
|
||||||
|
background: rgb(255 255 255 / 0.25);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
::-webkit-scrollbar-thumb {
|
||||||
|
background: rgb(255 255 255 / 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: "Open Sans";
|
font-family: "Open Sans";
|
||||||
background: $clr-background-default;
|
background: $clr-background-default;
|
||||||
|
|||||||
@@ -1,13 +1,25 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
|
|
||||||
$clr-accent-default: hsl(337, 96%, 56%);
|
$clr-accent-default: hsl(337, 96%, 56%);
|
||||||
$clr-accent-dark: hsl(337, 96%, 10%);
|
$clr-accent-dark: hsl(337, 96%, 20%);
|
||||||
$clr-secondary-default: hsl(273, 100%, 22%);
|
$clr-secondary-default: hsl(273, 100%, 36%);
|
||||||
|
$clr-secondary-dark: hsl(273, 100%, 12%);
|
||||||
$clr-background-default: hsl(256, 100%, 6%);
|
$clr-background-default: hsl(256, 100%, 6%);
|
||||||
|
|
||||||
$clr-background-dark: hsl(256, 100%, 4%);
|
$clr-background-dark: hsl(256, 100%, 4%);
|
||||||
$clr-background-light: hsl(256, 100%, 16%);
|
$clr-background-light: hsl(256, 100%, 16%);
|
||||||
|
|
||||||
|
$clr-gradient-default: linear-gradient(
|
||||||
|
135deg,
|
||||||
|
$clr-accent-default,
|
||||||
|
$clr-secondary-default
|
||||||
|
);
|
||||||
|
$clr-gradient-dark: linear-gradient(
|
||||||
|
135deg,
|
||||||
|
$clr-accent-dark,
|
||||||
|
$clr-secondary-dark
|
||||||
|
);
|
||||||
|
|
||||||
$border-radius-default: 10px;
|
$border-radius-default: 10px;
|
||||||
$border-radius-intensity-1: 5px;
|
$border-radius-intensity-1: 5px;
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ export const theme = createTheme({
|
|||||||
default: clrBackgroundDefault,
|
default: clrBackgroundDefault,
|
||||||
paper: clrBackgroundDark,
|
paper: clrBackgroundDark,
|
||||||
},
|
},
|
||||||
|
white: {
|
||||||
|
main: "#ffffff",
|
||||||
|
},
|
||||||
mode: "dark",
|
mode: "dark",
|
||||||
},
|
},
|
||||||
typography: {
|
typography: {
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* @format
|
||||||
|
* @param {string} date - Date from server
|
||||||
|
* @returns {string} Formated Date
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const formateDate = (date) => {
|
||||||
|
date = new Date(date);
|
||||||
|
date = new Intl.DateTimeFormat().format(date);
|
||||||
|
return date;
|
||||||
|
};
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* @format
|
||||||
|
* @param {number} ticks - C# ticks of a particular item
|
||||||
|
* @return {number} Converted ticks to Milliseconds
|
||||||
|
*/
|
||||||
|
|
||||||
|
const ticksToMs = (ticks) => {
|
||||||
|
return Math.round(ticks / 10000);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getRuntime = (ticks) => {
|
||||||
|
let time = ticksToMs(ticks);
|
||||||
|
let formatedTime = "";
|
||||||
|
let timeSec = Math.round(time / 1000);
|
||||||
|
let timeMin = Math.round(timeSec / 60);
|
||||||
|
if (timeMin > 60) {
|
||||||
|
let timeHr = Math.floor(timeMin / 60);
|
||||||
|
timeMin -= timeHr * 60;
|
||||||
|
formatedTime = `${timeHr}hr ${timeMin}min`;
|
||||||
|
} else {
|
||||||
|
formatedTime = `${timeMin}min`;
|
||||||
|
}
|
||||||
|
return formatedTime;
|
||||||
|
};
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import { createSlice } from "@reduxjs/toolkit";
|
||||||
|
export const appBarSlice = createSlice({
|
||||||
|
name: "appBar",
|
||||||
|
initialState: {
|
||||||
|
visible: false,
|
||||||
|
backdrop: false,
|
||||||
|
},
|
||||||
|
reducers: {
|
||||||
|
showAppBar: (state) => {
|
||||||
|
state.visible = true;
|
||||||
|
},
|
||||||
|
hideAppBar: (state) => {
|
||||||
|
state.visible = false;
|
||||||
|
},
|
||||||
|
setBackdrop: (state, action) => {
|
||||||
|
state.backdrop = action.payload;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const { showAppBar, hideAppBar, setBackdrop } = appBarSlice.actions;
|
||||||
|
export default appBarSlice.reducer;
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import { createSlice } from "@reduxjs/toolkit";
|
||||||
|
export const sideBarSlice = createSlice({
|
||||||
|
name: "sidebar",
|
||||||
|
initialState: {
|
||||||
|
visible: false,
|
||||||
|
},
|
||||||
|
reducers: {
|
||||||
|
showSidemenu: (state) => {
|
||||||
|
state.visible = true;
|
||||||
|
},
|
||||||
|
hideSidemenu: (state) => {
|
||||||
|
state.visible = false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const { showSidemenu, hideSidemenu } = sideBarSlice.actions;
|
||||||
|
export default sideBarSlice.reducer;
|
||||||
@@ -8,8 +8,9 @@ const servers = new Store(".servers.dat");
|
|||||||
* Set server in .servers.dat
|
* Set server in .servers.dat
|
||||||
* @param {object} data - Server info
|
* @param {object} data - Server info
|
||||||
*/
|
*/
|
||||||
const setServer = (data) => {
|
const setServer = async (data) => {
|
||||||
let server = servers.set("server", data);
|
let server = servers.set("server", data);
|
||||||
|
await servers.save();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,6 +27,7 @@ const getServer = async () => {
|
|||||||
*/
|
*/
|
||||||
const delServer = async () => {
|
const delServer = async () => {
|
||||||
await servers.delete("server");
|
await servers.delete("server");
|
||||||
|
await servers.save();
|
||||||
};
|
};
|
||||||
|
|
||||||
export { setServer, getServer, delServer };
|
export { setServer, getServer, delServer };
|
||||||
@@ -9,11 +9,12 @@ const user = new Store(".user.dat");
|
|||||||
* @param {string} userName - User's name
|
* @param {string} userName - User's name
|
||||||
* @param {string} userPassword - User's Password
|
* @param {string} userPassword - User's Password
|
||||||
*/
|
*/
|
||||||
const saveUser = (userName, userPassword) => {
|
const saveUser = async (userName, userPassword) => {
|
||||||
let details = user.set("user", {
|
let details = user.set("user", {
|
||||||
Name: userName,
|
Name: userName,
|
||||||
Password: userPassword,
|
Password: userPassword || "",
|
||||||
});
|
});
|
||||||
|
await user.save();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,4 +26,10 @@ const getUser = async () => {
|
|||||||
return details;
|
return details;
|
||||||
};
|
};
|
||||||
|
|
||||||
export { saveUser, getUser };
|
/**
|
||||||
|
* Delete user from storage
|
||||||
|
*/
|
||||||
|
const delUser = async () => {
|
||||||
|
await user.clear();
|
||||||
|
};
|
||||||
|
export { saveUser, getUser, delUser };
|
||||||
Reference in new issue
Block a user