Compare commits

..
Author SHA1 Message Date
prayag17 092a1c74ab Fix Add Server menu does not recognize servers not using HTTPS or using the :8096 port. Fix #74 2023-05-11 14:47:22 +05:30
prayag17 fb7c86631d Fix Login page does not show each accounts profile picture, showing placeholder instead. Fix #75 2023-05-11 13:00:13 +05:30
prayag17 7137cbc13e Start implementing player Ui #10 2023-05-10 18:06:49 +05:30
prayag17 989542107f Use react-player instead of videojs #10 2023-05-10 14:37:40 +05:30
prayag17 97981c7d35 Send progress update to server when playing media #10 2023-05-09 21:16:29 +05:30
dependabot[bot] 797c80b8cd chore(package-update) NPM: bump vite-plugin-svgr from 2.4.0 to 3.2.0 (#67)
Bumps [vite-plugin-svgr](https://github.com/pd4d10/vite-plugin-svgr) from 2.4.0 to 3.2.0.
- [Release notes](https://github.com/pd4d10/vite-plugin-svgr/releases)
- [Commits](https://github.com/pd4d10/vite-plugin-svgr/compare/v2.4.0...v3.2.0)

---
updated-dependencies:
- dependency-name: vite-plugin-svgr
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-08 18:22:45 +05:30
prayag17 377f926fea Start adding video player #10 2023-05-08 18:11:33 +05:30
prayag17 dd4f5bab30 Implement Episode Page #58 2023-05-04 18:40:31 +05:30
prayag17 e47b7afd15 Add Appearances #64 #26, remove redux and clean up some code 2023-05-04 14:24:51 +05:30
prayag17 a16523118b Add songs to Artist #64 #26 2023-05-03 17:38:47 +05:30
prayag17 b2aaed792e Fix Carousel and Server connection err dialog 2023-05-03 13:54:51 +05:30
prayag17 117ddba9b6 Update package-lock.json 2023-05-02 20:52:31 +05:30
Prayag Prajapati 1a25bb20cb Update README.md 2023-05-02 20:51:54 +05:30
dependabot[bot] 8ba41979e2 chore(package-update) NPM: bump @types/react from 18.0.38 to 18.2.0 (#59)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 18.0.38 to 18.2.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

---
updated-dependencies:
- dependency-name: "@types/react"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-02 20:50:11 +05:30
dependabot[bot] 1bd295e0d4 chore(package-update) NPM: bump @mui/lab (#60)
Bumps [@mui/lab](https://github.com/mui/material-ui/tree/HEAD/packages/mui-lab) from 5.0.0-alpha.127 to 5.0.0-alpha.128.
- [Release notes](https://github.com/mui/material-ui/releases)
- [Changelog](https://github.com/mui/material-ui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mui/material-ui/commits/HEAD/packages/mui-lab)

---
updated-dependencies:
- dependency-name: "@mui/lab"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-02 20:49:39 +05:30
dependabot[bot] 479ae161b1 chore(package-update) NPM: bump react-router-dom from 6.10.0 to 6.11.0 (#61)
Bumps [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) from 6.10.0 to 6.11.0.
- [Release notes](https://github.com/remix-run/react-router/releases)
- [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/CHANGELOG.md)
- [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@6.11.0/packages/react-router-dom)

---
updated-dependencies:
- dependency-name: react-router-dom
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-02 20:49:30 +05:30
dependabot[bot] 6957641999 chore(package-update) NPM: bump sass from 1.62.0 to 1.62.1 (#62)
Bumps [sass](https://github.com/sass/dart-sass) from 1.62.0 to 1.62.1.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sass/dart-sass/compare/1.62.0...1.62.1)

---
updated-dependencies:
- dependency-name: sass
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-02 20:49:21 +05:30
dependabot[bot] 419c76d81c chore(package-update) NPM: bump @types/react-dom from 18.0.11 to 18.2.1 (#63)
Bumps [@types/react-dom](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-dom) from 18.0.11 to 18.2.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react-dom)

---
updated-dependencies:
- dependency-name: "@types/react-dom"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-02 20:49:12 +05:30
prayag17 bd5313ebf3 Complete Discography #64 2023-05-02 20:47:00 +05:30
prayag17 16dcff113d Update discography #64 2023-05-02 19:59:41 +05:30
prayag17 e2d50addc1 Start Adding album card to ArtistPage #64 2023-05-02 14:30:50 +05:30
prayag17 2ddaf61399 Update carousel 2023-05-02 13:05:52 +05:30
prayag17 2570c96f31 Fix carousel breaking homePage 2023-05-01 19:37:27 +05:30
prayag17 fbe31a190a Fix card overlay actin buttons going to item page 2023-05-01 14:08:58 +05:30
prayag17 7c1df32117 Add animations 2023-04-30 21:04:45 +05:30
prayag17 b690ff5b3e Fix keys in itemView #26 2023-04-30 09:53:23 +05:30
prayag17 a04e263ad5 Fix cardOverlay 2023-04-29 21:54:52 +05:30
prayag17 0e0833876b fix backbutton jumping in 2023-04-29 20:59:22 +05:30
prayag17 4d92a059d1 Fix nextup 2023-04-29 15:42:17 +05:30
prayag17 5c41bfeca1 Update episode list in title Page #26 2023-04-29 15:33:53 +05:30
prayag17 7df95a05ed Show endsAt in titlePage and Carousel 2023-04-27 18:09:05 +05:30
prayag17 3911459eed Update libView and titlePage #26 2023-04-27 17:59:04 +05:30
prayag17 b1c0704bac remove some unsed pkgs and display external urls #26 2023-04-27 14:30:51 +05:30
37 changed files with 3146 additions and 1390 deletions

No files matched your search

+1
View File
@@ -3,6 +3,7 @@
# 📝 Prerequisites:
- Nodejs (≥19.1.0)
- Rust (≥1.66.1)
- Visual Studio C++ Build tools
# ℹ️ Getting started:
- Install Nodejs and Rust.
+857 -691
View File
File diff suppressed because it is too large. Load diff
+12 -14
View File
@@ -15,39 +15,37 @@
"@fontsource/open-sans": "^4.5.13",
"@jellyfin/sdk": "^0.8.2",
"@mdi/js": "^7.2.96",
"@mui/lab": "^5.0.0-alpha.127",
"@mui/lab": "^5.0.0-alpha.128",
"@mui/material": "^5.11.16",
"@reduxjs/toolkit": "^1.9.3",
"@tanstack/react-query": "^4.26.1",
"@tanstack/react-query-devtools": "^4.29.3",
"@tauri-apps/api": "^1.2.0",
"@videojs/http-streaming": "^3.0.2",
"axios": "^1.4.0",
"blurhash": "^2.0.5",
"events": "^3.3.0",
"framer-motion": "^10.12.4",
"localforage": "^1.10.0",
"match-sorter": "^6.3.1",
"notistack": "^3.0.1",
"react": "^18.2.0",
"react-blurhash": "^0.3.0",
"react-cookie": "^4.1.1",
"react-dom": "^18.2.0",
"react-konami-code": "^2.3.0",
"react-material-ui-carousel": "^3.4.2",
"react-multi-carousel": "^2.8.3",
"react-parallax": "^3.5.1",
"react-redux": "^8.0.5",
"react-router-dom": "^6.10.0",
"redux": "^4.2.1",
"sort-by": "^1.2.0",
"react-player": "^2.12.0",
"react-router-dom": "^6.11.0",
"tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store",
"uuid": "^9.0.0",
"vite-plugin-svgr": "^2.2.2"
"vite-plugin-svgr": "^3.2.0",
"zustand": "^4.3.8"
},
"devDependencies": {
"@tauri-apps/cli": "^1.2.2",
"@types/react": "^18.0.38",
"@types/react-dom": "^18.0.8",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.1",
"@vitejs/plugin-react": "^4.0.0",
"sass": "^1.61.0",
"sass": "^1.62.1",
"video.js": "^8.3.0",
"vite": "^4.3.1"
},
"license": "GPL-3.0-only"
+1 -1
View File
@@ -17,7 +17,7 @@ tauri-build = { version = "1.2.1", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.2.2", features = ["process-exit", "process-relaunch"] }
tauri = { version = "1.2.2", features = ["process-exit", "process-relaunch", "shell-all", "window-set-fullscreen"] }
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
[features]
+6
View File
@@ -18,6 +18,12 @@
"exit": true,
"relaunch": true,
"relaunchDangerousAllowSymlinkMacos": false
},
"window": {
"setFullscreen": true
},
"shell": {
"all": true
}
},
"bundle": {
+86 -45
View File
@@ -7,7 +7,7 @@ import Konami from "react-konami-code";
const Kon = Konami.default ? Konami.default : Konami;
import { ThemeProvider } from "@mui/material/styles";
import { SnackbarProvider } from "notistack";
import { SnackbarProvider, useSnackbar } from "notistack";
import {
Routes,
Route,
@@ -23,8 +23,7 @@ import { relaunch } from "@tauri-apps/api/process";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { useQuery } from "@tanstack/react-query";
// import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
// Theming
import CssBaseline from "@mui/material/CssBaseline";
@@ -47,9 +46,12 @@ import Home from "./routes/home";
import { UserLogin, LoginWithImage, UserLoginManual } from "./routes/login";
import LibraryView from "./routes/library";
import ItemDetail from "./routes/item";
import FavouritePage from "./routes/favourite/index.jsx";
import Settings from "./routes/settings";
import About from "./routes/about";
import { VideoPlayer } from "./routes/player/videoPlayer.jsx";
import { SideMenu } from "./components/menu/sidemenu.jsx";
import { AppBar } from "./components/appBar/appBar.jsx";
@@ -57,15 +59,18 @@ import { AppBar } from "./components/appBar/appBar.jsx";
import "@fontsource/open-sans";
// Jellyfin SDK TypeScript
import { Jellyfin } from "@jellyfin/sdk";
import {
Jellyfin,
VersionOutdatedIssue,
VersionUnsupportedIssue,
} from "@jellyfin/sdk";
import { version as appVer } from "../package.json";
import { v4 as uuidv4 } from "uuid";
import { delServer, getServer } from "./utils/storage/servers.js";
import { delUser, getUser } from "./utils/storage/user.js";
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api.js";
import { useQuery } from "@tanstack/react-query";
import { useDispatch } from "react-redux";
import { showSidemenu } from "./utils/slice/sidemenu.js";
import FavouritePage from "./routes/favourite/index.jsx";
const jellyfin = new Jellyfin({
clientInfo: {
name: "JellyPlayer",
@@ -90,12 +95,15 @@ event.on("set-api-accessToken", (serverAddress) => {
const anim = {
initial: {
transform: "scale(0.99)",
opacity: 0,
},
animate: {
transform: "scale(1)",
opacity: 1,
},
exit: {
transform: "scale(0.99)",
opacity: 0,
},
};
@@ -120,15 +128,13 @@ const AnimationWrapper = () => {
function App() {
const navigate = useNavigate();
const dispatch = useDispatch();
const [serverReachable, setServerReachable] = useState(true);
const [checkingServer, setChecking] = useState(false);
const enqueueSnackbar = useSnackbar();
const createApi = async () => {
const server = await getServer();
event.emit("create-jellyfin-api", server.Ip);
dispatch(showSidemenu());
};
const serverAvailable = async () => {
@@ -159,31 +165,60 @@ function App() {
}
};
const pingServer = () => {
setChecking(true);
let data;
fetch(`${window.api.basePath}/System/Ping`, {
body: JSON.stringify(data),
})
.then((res) => res.json())
.then((data) => {
if (data == "Jellyfin Server") {
setServerReachable(true);
setChecking(false);
} else {
enqueueSnackbar(
"The server address does not seem be a jellyfin server",
{ variant: "error" },
);
const pingServer = useQuery({
queryKey: ["setup", "server"],
queryFn: async () => {
let serverUrl = window.api.basePath.replace(/\/$/, "").trim();
const candidates =
await jellyfin.discovery.getRecommendedServerCandidates(
serverUrl,
);
const best = jellyfin.discovery.findBestServer(candidates);
if (best) {
const issues = candidates.flatMap((s) => s.issues);
if (
issues.some(
(i) =>
i instanceof VersionOutdatedIssue ||
i instanceof VersionUnsupportedIssue,
)
) {
setServerReachable(false);
setChecking(false);
enqueueSnackbar(
"Please Update your server to latest Jellyfin version to use this client",
);
}
})
.catch((error) => {
try {
const api = sdk.createApi(best.address);
const { data } = await getSystemApi(
api,
).getPublicSystemInfo();
delete data.LocalAddress;
const serv = {
...data,
PublicAddress: best.address,
isDefault: false,
};
if (serv.StartupWizardCompleted) {
setServerReachable(true);
} else {
setServerReachable(false);
enqueueSnackbar(
"Server setup not complete. Please complete your server setup.",
);
}
} catch (error) {
console.error(error);
}
} else {
setServerReachable(false);
setChecking(false);
});
};
enqueueSnackbar("Server not found.", { variant: "error" });
}
return "";
},
// enabled: false,
refetchOnWindowFocus: false,
});
const userLogin = async () => {
const user = await getUser();
@@ -193,15 +228,13 @@ function App() {
);
sessionStorage.setItem("accessToken", auth.data.AccessToken);
event.emit("set-api-accessToken", window.api.basePath);
// navigate("/home");
};
const LogicalRoutes = () => {
serverAvailable().then(async (server) => {
if (server == true) {
createApi().then(() => {
pingServer();
pingServer.refetch();
if (serverReachable == true) {
userSaved().then((user_available) => {
if (user_available == true) {
@@ -227,7 +260,6 @@ function App() {
});
} else {
navigate("/setup/server");
setChecking(false);
}
});
};
@@ -242,7 +274,10 @@ function App() {
});
};
const handleRelaunch = async () => {
const handleRelaunch = async (event, reason) => {
if (reason && reason == "backdropClick") {
return;
}
let result = await relaunch();
};
@@ -274,7 +309,7 @@ function App() {
return (
<SnackbarProvider maxSnack={5}>
<ThemeProvider theme={theme}>
{checkingServer && (
{pingServer.isLoading && (
<Box
sx={{
display: "flex",
@@ -306,6 +341,7 @@ function App() {
<Dialog
open={!serverReachable}
onClose={handleRelaunch}
disableBa
aria-labelledby="alert-dialog-text"
aria-describedby="alert-dialog-desc"
maxWidth="md"
@@ -340,7 +376,11 @@ function App() {
location={location}
>
<Route element={<AnimationWrapper />}>
{/* Main Routes */}
<Route
path="/"
element={<LogicalRoutes />}
/>
<Route
path="/home"
element={<Home />}
@@ -366,10 +406,12 @@ function App() {
element={<UserLoginManual />}
/>
<Route
exact
path="/library/:id"
element={<LibraryView />}
/>
<Route
exact
path="/item/:id"
element={<ItemDetail />}
/>
@@ -385,13 +427,11 @@ function App() {
path="/about"
element={<About />}
/>
{/* Logical Routes */}
<Route
path="/"
element={<LogicalRoutes />}
path="/player"
element={<VideoPlayer />}
/>
<Route
path="/login"
element={<LoginLogicalRoutes />}
@@ -400,6 +440,7 @@ function App() {
</Routes>
</div>
</AnimatePresence>
<ReactQueryDevtools />
</ThemeProvider>
</SnackbarProvider>
);
+5 -6
View File
@@ -15,11 +15,10 @@ import useScrollTrigger from "@mui/material/useScrollTrigger";
import { MdiMagnify } from "../icons/mdiMagnify";
import { theme } from "../../theme";
import { useDispatch, useSelector } from "react-redux";
import { useLocation, useNavigate } from "react-router-dom";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { useQueryClient, useQuery } from "@tanstack/react-query";
import { useQuery } from "@tanstack/react-query";
import "./appBar.module.scss";
import { MdiAccount } from "../icons/mdiAccount";
@@ -29,11 +28,10 @@ import { MdiCog } from "../icons/mdiCog";
import { MdiInformation } from "../icons/mdiInformation";
export const AppBar = () => {
const dispatch = useDispatch();
const navigate = useNavigate();
const [display, setDisplay] = useState(false);
const [backButtonVisible, setBackButtonVisible] = useState(true);
const [backButtonVisible, setBackButtonVisible] = useState(false);
const location = useLocation();
@@ -64,7 +62,9 @@ export const AppBar = () => {
useEffect(() => {
if (
location.pathname.includes("login") ||
location.pathname.includes("setup")
location.pathname.includes("setup") ||
location.pathname.includes("player") ||
location.pathname === "/"
) {
setDisplay(false);
} else {
@@ -88,7 +88,6 @@ export const AppBar = () => {
<MuiAppBar
sx={{
width: `calc(100vw - ${theme.spacing(7)})`,
// mr: "10px",
backgroundColor: "transparent",
}}
className={trigger ? "appBar backdropVisible" : "appBar"}
+11 -15
View File
@@ -2,8 +2,6 @@
import PropTypes from "prop-types";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import ButtonBase from "@mui/material/ButtonBase";
import { MdiAccount } from "../icons/mdiAccount";
@@ -12,19 +10,17 @@ import "./avatar.module.scss";
export const AvatarImage = ({ userId, userImageTags }) => {
return (
<Box className="avatar-image-container">
{!!userImageTags && (
<div
className="avatar-image"
style={{
backgroundImage:
"url('" +
window.api.basePath +
"/Users/" +
userId +
"/Images/Primary')",
}}
></div>
)}
<div
className="avatar-image"
style={{
backgroundImage:
"url('" +
window.api.basePath +
"/Users/" +
userId +
"/Images/Primary')",
}}
></div>
<div className="avatar-image-icon-container">
<MdiAccount className="avatar-image-icon" />
+75 -54
View File
@@ -14,6 +14,7 @@ import LinearProgress from "@mui/material/LinearProgress";
import Chip from "@mui/material/Chip";
import ButtonGroup from "@mui/material/ButtonGroup";
import IconButton from "@mui/material/IconButton";
import { Blurhash } from "react-blurhash";
import { green, pink } from "@mui/material/colors";
@@ -47,6 +48,7 @@ export const Card = ({
blurhash,
currentUser,
favourite,
disableOverlay,
}) => {
const navigate = useNavigate();
const [imgLoading, setImgLoading] = useState(true);
@@ -92,8 +94,6 @@ export const Card = ({
"BoxSet",
"CollectionFolder",
"Movie",
"MusicAlbum",
"MusicVideo",
"Season",
"Series",
"Video",
@@ -176,6 +176,7 @@ export const Card = ({
<div
className="card-media-image-container"
style={{ opacity: imgLoading ? 0 : 1 }}
// style={{ opacity: 1 }}
>
{imageTags &&
(cardType == "thumb" ? (
@@ -211,10 +212,17 @@ export const Card = ({
<CardMedia
component="img"
image={
window.api.basePath +
"/Items/" +
itemId +
"/Images/Primary?fillHeight=532&fillWidth=300&quality=96"
iconType == "User"
? window.api
.basePath +
"/Users/" +
itemId +
"/Images/Primary?fillHeight=532&fillWidth=300&quality=96"
: window.api
.basePath +
"/Items/" +
itemId +
"/Images/Primary?fillHeight=532&fillWidth=300&quality=96"
}
alt={itemName}
sx={{
@@ -276,52 +284,66 @@ export const Card = ({
/>
)}
</>
<Box
className="card-media-overlay"
sx={{
display: "flex",
alignItems: "flex-end",
justifyContent: "flex-end",
p: 1,
}}
>
<ButtonGroup>
{availableMarkButtonTypes.includes(
iconType,
) && (
<IconButton
onClick={(e) => {
e.stopPropagation();
handleMarkAsPlayOrUnMarkAsPlay();
}}
>
<MdiCheck
sx={{
color: isWatched
? green[400]
: "white",
{!disableOverlay && (
<Box
className="card-media-overlay"
sx={{
display: "flex",
alignItems: "flex-end",
justifyContent: "flex-end",
p: 1,
}}
>
<ButtonGroup>
{availableMarkButtonTypes.includes(
iconType,
) && (
<IconButton
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
handleMarkAsPlayOrUnMarkAsPlay();
}}
/>
</IconButton>
)}
{allowedLikeButton.includes(iconType) && (
<IconButton
onClick={(e) => {
e.stopPropagation();
handleLiking();
}}
>
{isFavorite ? (
<MdiHeart
sx={{ color: pink[700] }}
onFocus={(e) =>
e.stopPropagation
}
>
<MdiCheck
sx={{
color: isWatched
? green[400]
: "white",
}}
/>
) : (
<MdiHeartOutline />
)}
</IconButton>
)}
</ButtonGroup>
</Box>
</IconButton>
)}
{allowedLikeButton.includes(
iconType,
) && (
<IconButton
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
handleLiking();
}}
onFocus={(e) =>
e.stopPropagation
}
>
{isFavorite ? (
<MdiHeart
sx={{
color: pink[700],
}}
/>
) : (
<MdiHeartOutline />
)}
</IconButton>
)}
</ButtonGroup>
</Box>
)}
</Box>
<CardContent
@@ -344,17 +366,16 @@ export const Card = ({
>
{itemName}
</Typography>
<Typography
gutterBottom
variant="subtitle2"
variant="subtitle1"
component="div"
color="gray"
textAlign="left"
// textOverflow={}
// fontSize="0.85em"
width="fit-content"
maxWidth="100%"
noWrap
sx={{ opacity: 0.5 }}
>
{subText}
</Typography>
+17 -11
View File
@@ -2,8 +2,7 @@
import React, { useState } from "react";
import PropTypes from "prop-types";
import { useNavigate, Link } from "react-router-dom";
// import Link from "@mui/material/Link";
import { useNavigate } from "react-router-dom";
import Divider from "@mui/material/Divider";
import Stack from "@mui/material/Stack";
@@ -20,10 +19,7 @@ import IconButton from "@mui/material/IconButton";
import { Blurhash } from "react-blurhash";
import { green, pink } from "@mui/material/colors";
import {
MediaCollectionTypeIconCollectionCard,
TypeIconCollectionCard,
} from "../utils/iconsCollection";
import { TypeIconCollectionCard } from "../utils/iconsCollection";
import { borderRadiusDefault } from "../../palette.module.scss";
import "./card.module.scss";
@@ -56,6 +52,7 @@ export const EpisodeCard = ({
parentId,
}) => {
const navigate = useNavigate();
const [imgLoaded, setImgLoaded] = useState(false);
const [isWatched, setIsWatched] = useState(watchedStatus);
const [isFavourite, setIsFavourite] = useState(favourite);
const handleMarkAsPlayOrUnMarkAsPlay = async () => {
@@ -130,10 +127,16 @@ export const EpisodeCard = ({
opacity: isWatched ? 1 : 0,
}}
/>
<Box className="card-media-image-container">
<Box
className="card-media-image-container"
sx={{
opacity: imgLoaded ? 1 : 0,
transition: "opacity 250ms",
}}
>
{imageTags && (
<CardMedia
component="div"
component="img"
image={
window.api.basePath +
"/Items/" +
@@ -148,6 +151,7 @@ export const EpisodeCard = ({
borderRadiusDefault,
overflow: "hidden",
}}
onLoad={() => setImgLoaded(true)}
className="card-image"
></CardMedia>
)}
@@ -195,8 +199,9 @@ export const EpisodeCard = ({
>
<ButtonGroup>
<IconButton
onClick={(e) => {
onMouseDown={(e) => {
e.stopPropagation();
e.preventDefault();
handleMarkAsPlayOrUnMarkAsPlay();
}}
>
@@ -209,8 +214,9 @@ export const EpisodeCard = ({
/>
</IconButton>
<IconButton
onClick={(e) => {
onMouseDown={(e) => {
e.stopPropagation();
e.preventDefault();
handleLiking();
}}
>
@@ -346,7 +352,7 @@ export const EpisodeCard = ({
mr: "0.25em",
}}
/>{" "}
{itemRating}
{Math.round(itemRating * 10) / 10}
</Typography>
)}
{!!itemTicks && (
+3 -3
View File
@@ -1,6 +1,6 @@
/** @format */
import { useState, useEffect } from "react";
import { useState } from "react";
import PropTypes from "prop-types";
import Carousel from "react-multi-carousel";
@@ -9,7 +9,6 @@ import "react-multi-carousel/lib/styles.css";
import { MdiChevronLeft } from "../icons/mdiChevronLeft";
import { MdiChevronRight } from "../icons/mdiChevronRight";
import { styled } from "@mui/material/styles";
import IconButton from "@mui/material/IconButton";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
@@ -22,6 +21,7 @@ export const CardScroller = ({
title,
headingProps,
disableDecoration = false,
boxProps,
}) => {
const responsive = {
superLargeDesktop: {
@@ -50,7 +50,7 @@ export const CardScroller = ({
const [carouselRef, setCarouselRef] = useState();
return (
<Box className="card-scroller-container" sx={{ mb: 4 }}>
<Box {...boxProps} className="card-scroller-container" mb={1}>
<Box
sx={{ mb: 1 }}
className={
+1 -1
View File
@@ -6,7 +6,7 @@ import { mdiCheck } from "@mdi/js";
export const MdiCheck = (props) => {
return (
<SvgIcon color="red" {...props}>
<SvgIcon {...props}>
<path d={mdiCheck}></path>
</SvgIcon>
);
+12
View File
@@ -0,0 +1,12 @@
/** @format */
import SvgIcon from "@mui/material/SvgIcon";
import { mdiFastForward } from "@mdi/js";
export const MdiFastForward = (props) => {
return (
<SvgIcon {...props}>
<path d={mdiFastForward}></path>
</SvgIcon>
);
};
+12
View File
@@ -0,0 +1,12 @@
/** @format */
import SvgIcon from "@mui/material/SvgIcon";
import { mdiPause } from "@mdi/js";
export const MdiPause = (props) => {
return (
<SvgIcon {...props}>
<path d={mdiPause}></path>
</SvgIcon>
);
};
+12
View File
@@ -0,0 +1,12 @@
/** @format */
import SvgIcon from "@mui/material/SvgIcon";
import { mdiRewind } from "@mdi/js";
export const MdiRewind = (props) => {
return (
<SvgIcon {...props}>
<path d={mdiRewind}></path>
</SvgIcon>
);
};
+13
View File
@@ -0,0 +1,13 @@
/** @format */
import SvgIcon from "@mui/material/SvgIcon";
import { mdiStar } from "@mdi/js";
export const MdiStar = (props) => {
return (
<SvgIcon {...props}>
<path d={mdiStar}></path>
</SvgIcon>
);
};
@@ -0,0 +1,11 @@
/** @format */
.album {
&-image-icon {
fill: url(#clr-gradient-default) !important;
&-container {
background: $clr-gradient-dark;
}
}
}
@@ -0,0 +1,234 @@
/** @format */
import { useState } from "react";
import PropTypes from "prop-types";
import Box from "@mui/material/Box";
import Paper from "@mui/material/Paper";
import TableContainer from "@mui/material/TableContainer";
import Table from "@mui/material/Table";
import TableBody from "@mui/material/TableBody";
import TableHead from "@mui/material/TableHead";
import TableRow from "@mui/material/TableRow";
import TableCell from "@mui/material/TableCell";
import Typography from "@mui/material/Typography";
import IconButton from "@mui/material/IconButton";
import Stack from "@mui/material/Stack";
import MuiLink from "@mui/material/Link";
import { Link } from "react-router-dom";
import { useQuery } from "@tanstack/react-query";
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
import { MdiClockOutline } from "../../icons/mdiClockOutline";
import { getRuntimeMusic } from "../../../utils/date/time";
import { MdiHeart } from "../../icons/mdiHeart";
import { MdiHeartOutline } from "../../icons/mdiHeartOutline";
import { MdiAlbum } from "../../icons/mdiAlbum";
import "./albumArtist.scss";
export const ArtistAlbum = ({ user, album, boxProps }) => {
const albumTracks = useQuery({
queryKey: ["artist", "album", album.Id],
queryFn: async () => {
const result = await getItemsApi(window.api).getItems({
userId: user.Id,
parentId: album.Id,
});
return result.data;
},
networkMode: "always",
});
const handleLikingTrack = async (track) => {
let result;
if (track.UserData.IsFavorite) {
result = await getUserLibraryApi(window.api).unmarkFavoriteItem({
userId: user.data.Id,
itemId: track.Id,
});
} else if (!track.UserData.IsFavorite) {
result = await getUserLibraryApi(window.api).markFavoriteItem({
userId: user.data.Id,
itemId: track.Id,
});
}
albumTracks.refetch();
};
const [imgLoaded, setImgLoaded] = useState(false);
return (
<Box sx={{ mb: 6 }} {...boxProps}>
<Stack direction="row" gap={3} mb={3}>
{!!album.ImageTags?.Primary && (
<Box
className="album-image"
sx={{
aspectRatio: 1,
borderRadius: "10px",
overflow: "hidden",
width: "12em",
boxShadow: "0 0 10px rgb(0 0 0 /0.2)",
position: "relative",
height: "12em",
}}
>
<img
src={`${window.api.basePath}/Items/${album.Id}/Images/Primary?fillHeight=532&fillWidth=532&quality=96`}
style={{
width: "100%",
height: "100%",
objectFit: "cover",
opacity: imgLoaded ? 1 : 0,
transition: "opacity 250ms",
position: "relative",
zIndex: 2,
}}
onLoad={() => setImgLoaded(true)}
/>
<Box
className="album-image-icon-container"
sx={{
position: "absolute",
width: "100%",
height: "100%",
top: 0,
left: 0,
display: "flex",
alignItems: "center",
justifyContent: "center",
zIndex: 1,
}}
>
<MdiAlbum
className="album-image-icon"
sx={{ fontSize: "6em" }}
/>
</Box>
</Box>
)}
<Stack>
<Typography
variant="h5"
sx={{ opacity: `0.7`, mb: 1 }}
>
{album.ProductionYear}
</Typography>
<MuiLink
component={Link}
to={`/item/${album.Id}`}
variant="h3"
color="inherit"
underline="hover"
>
{album.Name}
</MuiLink>
</Stack>
</Stack>
<TableContainer
component={Paper}
sx={{ mb: 2, borderRadius: "15px" }}
>
<Table>
<TableHead
sx={{
mb: 1,
}}
>
<TableRow>
<TableCell
sx={{
maxWidth: 120,
width: 20,
}}
>
<Typography variant="h6">#</Typography>
</TableCell>
<TableCell sx={{ width: 20 }}></TableCell>
<TableCell>
<Typography variant="h6">
Name
</Typography>
</TableCell>
<TableCell>
<Typography variant="h6" align="right">
<MdiClockOutline />
</Typography>
</TableCell>
</TableRow>
</TableHead>
<TableBody>
{albumTracks.isSuccess &&
albumTracks.data.Items.map(
(mitem, mindex) => {
return (
<TableRow
key={mindex}
sx={{
"&:last-child td, &:last-child th":
{
border: 0,
},
"&:hover": {
background:
"rgb(255 255 255 / 0.05)",
},
}}
>
<TableCell
sx={{
maxWidth: 120,
width: 20,
}}
>
<Typography variant="body1">
{
mitem.IndexNumber
}
</Typography>
</TableCell>
<TableCell
sx={{
width: 20,
}}
align="center"
>
<IconButton
onClick={() =>
handleLikingTrack(
mitem,
)
}
>
{mitem.UserData
.IsFavorite ? (
<MdiHeart />
) : (
<MdiHeartOutline />
)}
</IconButton>
</TableCell>
<TableCell>
<Typography variant="body1">
{mitem.Name}
</Typography>
</TableCell>
<TableCell align="right">
<Typography variant="body1">
{getRuntimeMusic(
mitem.RunTimeTicks,
)}
</Typography>
</TableCell>
</TableRow>
);
},
)}
</TableBody>
</Table>
</TableContainer>
</Box>
);
};
+9 -25
View File
@@ -2,7 +2,7 @@
import { useEffect, useState } from "react";
import { delUser } from "../../utils/storage/user";
import { useQueryClient, useQuery, QueryClient } from "@tanstack/react-query";
import { useQuery } from "@tanstack/react-query";
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
@@ -15,8 +15,6 @@ import Skeleton from "@mui/material/Skeleton";
import Tooltip from "@mui/material/Tooltip";
import List from "@mui/material/List";
import ListItem from "@mui/material/ListItem";
import Link from "@mui/material/Link";
import ListItemText from "@mui/material/ListItemText";
import ListItemIcon from "@mui/material/ListItemIcon";
import ListItemButton from "@mui/material/ListItemButton";
import IconButton from "@mui/material/IconButton";
@@ -28,11 +26,10 @@ import { MdiLogoutVariant } from "../icons/mdiLogoutVariant";
import { MediaCollectionTypeIconCollection } from "../../components/utils/iconsCollection.jsx";
import { useSelector, useDispatch } from "react-redux";
import { hideSidemenu, setBackdrop } from "../../utils/slice/sidemenu";
import { MdiHomeVariantOutline } from "../icons/mdiHomeVariantOutline";
import { EventEmitter as event } from "../../eventEmitter.js";
import "./sidemenu.module.scss";
const drawerWidth = 320;
@@ -42,7 +39,6 @@ const DrawerHeader = styled("div")(({ theme }) => ({
alignItems: "center",
justifyContent: "flex-end",
padding: theme.spacing(0, 1),
// necessary for content to be below app bar
...theme.mixins.toolbar,
}));
@@ -54,7 +50,6 @@ const MiniDrawer = styled(MuiDrawer, {
boxSizing: "border-box",
backgroundColor: theme.palette.primary.background.dark,
overflowX: "hidden",
// width: `calc(${theme.spacing(7)} + 10px)`,
}));
export const SideMenu = ({}) => {
@@ -62,7 +57,6 @@ export const SideMenu = ({}) => {
const [display, setDisplay] = useState(false);
const backdrop = useSelector((state) => state.sidebar.backdrop);
const navigate = useNavigate();
const user = useQuery({
queryKey: ["user"],
@@ -70,7 +64,7 @@ export const SideMenu = ({}) => {
let usr = await getUserApi(window.api).getCurrentUser();
return usr.data;
},
enabled: !!window.api,
enabled: display,
networkMode: "always",
});
let libraries = useQuery({
@@ -85,7 +79,6 @@ export const SideMenu = ({}) => {
networkMode: "always",
});
const handleDrawerOpen = () => {};
const dispatch = useDispatch();
const handleLogout = async () => {
console.log("Logging out user...");
@@ -96,14 +89,12 @@ export const SideMenu = ({}) => {
navigate("/login");
};
const getCurrentLocation = () => {
return location.pathname.slice(0, location.pathname.lastIndexOf("/"));
};
useEffect(() => {
if (
location.pathname.includes("login") ||
location.pathname.includes("setup")
location.pathname.includes("setup") ||
location.pathname.includes("player") ||
location.pathname === "/"
) {
setDisplay(false);
} else {
@@ -131,9 +122,7 @@ export const SideMenu = ({}) => {
}}
sx={{
width: `calc(${theme.spacing(7)} + 10px)`,
background: backdrop
? theme.palette.background.paper
: "transparent",
background: theme.palette.background.paper,
}}
>
<DrawerHeader
@@ -248,7 +237,7 @@ export const SideMenu = ({}) => {
"center",
}}
>
<MdiHomeVariantOutline></MdiHomeVariantOutline>
<MdiHomeVariantOutline />
</ListItemIcon>
</ListItemButton>
</ListItem>
@@ -287,8 +276,3 @@ export const SideMenu = ({}) => {
);
}
};
// SideMenu.propTypes = {
// skeleton: PropTypes.bool.isRequired,
// data: PropTypes.array.isRequired,
// };
-1
View File
@@ -4,7 +4,6 @@ import Card from "@mui/material/Card";
import CardMedia from "@mui/material/CardMedia";
import CardContent from "@mui/material/CardContent";
import Grid from "@mui/material/Unstable_Grid2";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import Skeleton from "@mui/material/Skeleton";
-5
View File
@@ -1,5 +0,0 @@
/** @format */
export const SplashScreen = () => {
return <h1>I am loading...</h1>;
};
+2
View File
@@ -23,6 +23,7 @@ import { MdiAccountMusic } from "../icons/mdiAccountMusic";
import { MdiDramaMasks } from "../icons/mdiDramaMasks";
import { MdiMusic } from "../icons/mdiMusic";
import { MdiAccountTie } from "../icons/mdiAccountTie";
import { MdiAccount } from "../icons/mdiAccount";
export const MediaCollectionTypeIconCollection = {
universal: <MdiMultimedia />,
@@ -97,6 +98,7 @@ export const TypeIconCollectionCard = {
Trailer: <MdiYoutube className="card-image-icon" />,
TvChannel: <MdiTelevisionClassic className="card-image-icon" />,
TvProgram: <MdiTelevisionClassic className="card-image-icon" />,
User: <MdiAccount className="card-image-icon" />,
UserRootFolder: <MdiFolderOutline className="card-image-icon" />,
UserView: <MdiMultimedia className="card-image-icon" />,
Video: <MdiFilmstrip className="card-image-icon" />,
+11 -10
View File
@@ -11,19 +11,20 @@ import App from "./App";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import store from "./store";
import { Provider } from "react-redux";
const queryClient = new QueryClient();
const queryClient = new QueryClient({
defaultOptions: {
queries: {
networkMode: "always",
},
},
});
ReactDOM.createRoot(document.getElementById("root")).render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<Provider store={store}>
<Router>
<App />
</Router>
</Provider>
<QueryClientProvider client={queryClient} option>
<Router>
<App />
</Router>
</QueryClientProvider>
</React.StrictMode>,
);
+8 -8
View File
@@ -48,15 +48,15 @@
opacity: 1;
mask-image: linear-gradient(
to right,
transparent 10%,
rgba(0, 0, 0, 0.5) 50%,
black 90%
transparent 2%,
rgba(0, 0, 0, 0.5) 20%,
black 70%
);
-webkit-mask-image: linear-gradient(
to right,
transparent 10%,
rgba(0, 0, 0, 0.5) 50%,
black 90%
transparent 2%,
rgba(0, 0, 0, 0.5) 20%,
black 70%
);
}
&-icon {
@@ -84,7 +84,7 @@
-webkit-line-clamp: 2;
margin-bottom: 0.5em;
&-logo {
max-width: 6em;
max-width: 10em;
height: 2em;
object-fit: contain;
object-position: bottom;
@@ -96,7 +96,7 @@
display: flex;
height: 70vh;
width: 70%;
padding: 0 2em 2em 2em;
padding: 2em;
flex-direction: column;
justify-content: center;
align-items: flex-start;
+105 -59
View File
@@ -19,6 +19,7 @@ import Paper from "@mui/material/Paper";
import Typography from "@mui/material/Typography";
import Chip from "@mui/material/Chip";
import Divider from "@mui/material/Divider";
import Stack from "@mui/material/Stack";
import { yellow } from "@mui/material/colors";
@@ -33,7 +34,7 @@ import { CardsSkeleton } from "../../components/skeleton/cards";
// Icons
import { MediaTypeIconCollection } from "../../components/utils/iconsCollection.jsx";
import { MdiStarHalfFull } from "../../components/icons/mdiStarHalfFull";
import { MdiStar } from "../../components/icons/mdiStar";
import { MdiPlayOutline } from "../../components/icons/mdiPlayOutline";
import { MdiChevronRight } from "../../components/icons/mdiChevronRight";
@@ -45,7 +46,8 @@ import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
import { useNavigate } from "react-router-dom";
import { getRuntime } from "../../utils/date/time";
import { endsAt, getRuntime } from "../../utils/date/time";
import { BaseItemKind, ItemFields } from "@jellyfin/sdk/lib/generated-client";
const Home = () => {
const authUser = useQuery({
@@ -93,7 +95,7 @@ const Home = () => {
const media = await getUserLibraryApi(window.api).getLatestMedia(
{
userId: user.data.Id,
fields: "Overview",
fields: [ItemFields.Overview, ItemFields.ParentId],
enableUserData: true,
},
);
@@ -251,29 +253,72 @@ const Home = () => {
key={index}
>
<div className="hero-carousel-background-container">
{item.ImageBlurHashes
.Backdrop ? (
<>
<Blurhash
hash={
item
.ImageBlurHashes
.Backdrop[
{item.Type ==
BaseItemKind.MusicAlbum ||
item.Type ==
BaseItemKind.Episode ? (
item
.ParentBackdropImageTags
.length != 0 && (
<>
<Blurhash
hash={
item
.BackdropImageTags[0]
]
}
// hash="LEHV6nWB2yk8pyo0adR*.7kCMdnj"
width="1080"
height="720"
resolutionX={
64
}
resolutionY={
96
}
className="hero-carousel-background-blurhash"
/>
.ImageBlurHashes
.Backdrop[
item
.ParentBackdropImageTags[0]
]
}
// hash="LEHV6nWB2yk8pyo0adR*.7kCMdnj"
width="1080"
height="720"
resolutionX={
64
}
resolutionY={
96
}
className="hero-carousel-background-blurhash"
punch={1}
/>
<div
className="hero-carousel-background-image"
style={{
backgroundImage: `url(${window.api.basePath}/Items/${item.ParentBackdropItemId}/Images/Backdrop)`,
}}
></div>
</>
)
) : item.ImageBlurHashes
.Backdrop ? (
<>
{item
.BackdropImageTags
.length !=
0 && (
<Blurhash
hash={
item
.ImageBlurHashes
.Backdrop[
item
.BackdropImageTags[0]
]
}
// hash="LEHV6nWB2yk8pyo0adR*.7kCMdnj"
width="1080"
height="720"
resolutionX={
64
}
resolutionY={
96
}
className="hero-carousel-background-blurhash"
punch={1}
/>
)}
<div
className="hero-carousel-background-image"
style={{
@@ -325,15 +370,25 @@ const Home = () => {
></img>
)}
</Typography>
<Box
sx={{
display: "flex",
alignItems:
"center",
width: "fit-content",
gap: "1em",
mb: 1.5,
}}
<Stack
// sx={{
// display: "flex",
// alignItems:
// "center",
// width: "fit-content",
// gap: "1em",
// mb: 1.5,
// }}
direction="row"
gap={1}
divider={
<Divider
variant="middle"
component="div"
orientation="vertical"
flexItem
/>
}
className="hero-carousel-info"
>
<Typography
@@ -344,12 +399,6 @@ const Home = () => {
? item.ProductionYear
: "Unknown"}
</Typography>
<Divider
variant="middle"
component="div"
orientation="vertical"
flexItem
/>
<Chip
variant="outlined"
label={
@@ -358,12 +407,6 @@ const Home = () => {
: "Not Rated"
}
/>
<Divider
variant="middle"
component="div"
orientation="vertical"
flexItem
/>
<Box
sx={{
display: "flex",
@@ -375,7 +418,7 @@ const Home = () => {
>
{!!item.CommunityRating ? (
<>
<MdiStarHalfFull
<MdiStar
sx={{
color: yellow[700],
}}
@@ -396,18 +439,21 @@ const Home = () => {
</Typography>
)}
</Box>
<Divider
variant="middle"
component="div"
orientation="vertical"
flexItem
/>
<Typography variant="subtitle1">
{getRuntime(
item.RunTimeTicks,
)}
</Typography>
</Box>
{!!item.RunTimeTicks && (
<Typography variant="subtitle1">
{getRuntime(
item.RunTimeTicks,
)}
</Typography>
)}
{!!item.RunTimeTicks && (
<Typography variant="subtitle1">
{endsAt(
item.RunTimeTicks,
)}
</Typography>
)}
</Stack>
<Typography
variant="subtitle1"
className="hero-carousel-text"
+1257 -295
View File
File diff suppressed because it is too large. Load diff
+6 -3
View File
@@ -23,13 +23,13 @@
&-backdrop {
position: absolute;
width: 100vw;
height: 135%;
height: 80vh;
top: -88px;
width: 100vw;
right: 0;
left: -24px;
z-index: -2;
filter: brightness(0.7);
filter: brightness(0.6);
mask-image: linear-gradient(0deg, transparent, black 75%);
-webkit-mask-image: linear-gradient(
0deg,
@@ -52,10 +52,13 @@
width: 15%;
flex-shrink: 0;
position: relative;
aspect-ratio: 0.666;
border-radius: $border-radius-default;
overflow: hidden;
box-shadow: 0 0 15px rgb(0 0 0 / 0.4);
&.Episode {
flex-shrink: 0;
flex-grow: 0.25;
}
}
&-icon-container {
background: $clr-gradient-dark;
+55 -11
View File
@@ -1,6 +1,6 @@
/** @format */
import { useState, useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { motion } from "framer-motion";
import { useParams, useNavigate, Link } from "react-router-dom";
import { useQuery } from "@tanstack/react-query";
@@ -30,7 +30,6 @@ import TableRow from "@mui/material/TableRow";
import TableCell from "@mui/material/TableCell";
import IconButton from "@mui/material/IconButton";
import Pagination from "@mui/material/Pagination";
import ButtonBase from "@mui/material/ButtonBase";
import { theme } from "../../theme";
@@ -386,7 +385,8 @@ const LibraryView = () => {
queryFn: () => fetchLibItems(id),
enabled: currentLib.isSuccess,
networkMode: "always",
keepPreviousData: true,
keepPreviousData: false,
cacheTime: 0,
});
const handleCurrentViewType = (e) => {
@@ -396,7 +396,6 @@ const LibraryView = () => {
useEffect(() => {
if (viewType.length != 0) {
setCurrentViewType(viewType[0].value);
console.log(viewType);
}
}, [viewType]);
@@ -441,6 +440,14 @@ const LibraryView = () => {
items.refetch();
};
const disablePaginationViews = [
"MusicArtist",
"Person",
"Genre",
"MusicGenre",
"Studio",
];
return (
<Box
sx={{
@@ -462,8 +469,8 @@ const LibraryView = () => {
position="fixed"
elevation={trigger ? 1 : 0}
sx={{
width: `calc(100vw - ${theme.spacing(7)})`,
mt: 8,
width: `calc(100vw - ${theme.spacing(7)} - 10px)`,
top: `${8 * 8}px !important`,
backdropFilter: trigger ? `blur(30px)` : "none",
background: "transparent",
backgroundColor: trigger
@@ -927,6 +934,20 @@ const LibraryView = () => {
xs={1}
sm={1}
md={1}
component={motion.div}
initial={{
scale: 0.8,
opacity: 0,
}}
animate={{
scale: 1,
opacity: 1,
}}
transition={{
duration: 0.25,
ease: "easeInOut",
delay: 0.02 * index,
}}
>
<Card
itemName={item.Name}
@@ -934,7 +955,13 @@ const LibraryView = () => {
imageTags={
!!item.ImageTags.Primary
}
subText={item.ProductionYear}
subText={
item.Type.includes(
"Music",
)
? item.AlbumArtist
: item.ProductionYear
}
iconType={item.Type}
playedPercent={
!!item.UserData
@@ -960,9 +987,8 @@ const LibraryView = () => {
: false
}
watchedCount={
!!item.UserData &&
item.UserData
.UnplayedItemCount
?.UnplayedItemCount
}
blurhash={
item.ImageBlurHashes ==
@@ -984,6 +1010,9 @@ const LibraryView = () => {
: ""
}
currentUser={user.data}
favourite={
item.UserData?.IsFavorite
}
></Card>
</Grid2>
);
@@ -996,7 +1025,8 @@ const LibraryView = () => {
{items.data.Items.map((item, index) => {
return (
<TableRow
key={index}
component={motion.div}
key={item.Id}
sx={{
"& td,& th": {
borderBottom:
@@ -1009,6 +1039,19 @@ const LibraryView = () => {
"rgb(255 255 255 / 0.05)",
},
}}
initial={{
scale: 0.8,
opacity: 0,
}}
animate={{
scale: 1,
opacity: 1,
}}
transition={{
duration: 0.25,
ease: "easeInOut",
delay: 0.02 * index,
}}
>
<TableCell width="4.5em">
<Box className="library-list-image-container">
@@ -1098,8 +1141,9 @@ const LibraryView = () => {
)}
{!items.isFetching &&
!disablePaginationViews.includes(currentViewType) &&
items.isSuccess &&
items.data.TotalRecordCount > 75 && (
items.data.TotalRecordCount > maxDisplayItems && (
<Stack
alignItems="center"
justifyContent="center"
+11 -25
View File
@@ -1,14 +1,10 @@
/** @format */
import { useState, useEffect, useMemo } from "react";
import { useState } from "react";
import { useQuery } from "@tanstack/react-query";
import { useNavigate, useParams, Link } from "react-router-dom";
import { EventEmitter as event } from "../../eventEmitter.js";
import { useDispatch } from "react-redux";
import { showSidemenu } from "../../utils/slice/sidemenu.js";
import { getServer } from "../../utils/storage/servers.js";
import { saveUser } from "../../utils/storage/user.js";
// import Icon from "mdi-material-ui";
@@ -26,8 +22,6 @@ import InputLabel from "@mui/material/InputLabel";
import IconButton from "@mui/material/IconButton";
import LoadingButton from "@mui/lab/LoadingButton";
import Button from "@mui/material/Button";
import Box from "@mui/material/Box";
import CircularProgress from "@mui/material/CircularProgress";
import LinearProgress from "@mui/material/LinearProgress";
import { useSnackbar } from "notistack";
import FormGroup from "@mui/material/FormGroup";
@@ -35,21 +29,16 @@ import FormControlLabel from "@mui/material/FormControlLabel";
import Checkbox from "@mui/material/Checkbox";
import { AvatarImage } from "../../components/avatar/avatar.jsx";
import { CardScroller } from "../../components/cardScroller/cardScroller.jsx";
import { Card } from "../../components/card/card.jsx";
import { AppBarBackOnly } from "../../components/appBar/backOnly.jsx";
// import { jellyfin } from "../../jellyfin";
// import getSystemApi from "@jellyfin/sdk";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { getBrandingApi } from "@jellyfin/sdk/lib/utils/api/branding-api";
import "./login.module.scss";
import { CardsSkeleton } from "../../components/skeleton/cards.jsx";
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice.jsx";
export const LoginWithImage = () => {
const dispatch = useDispatch();
const { userName, userId } = useParams();
const [password, setPassword] = useState({
@@ -99,7 +88,6 @@ export const LoginWithImage = () => {
}
event.emit("set-api-accessToken", window.api.basePath);
setLoading(false);
dispatch(showSidemenu());
navigate(`/home`);
};
@@ -159,7 +147,7 @@ export const LoginWithImage = () => {
{userName}
</Typography>
</Grid>
<Grid item minWidth="100%">
<Grid minWidth="100%">
<FormGroup>
<FormControl variant="outlined" fullWidth>
<InputLabel htmlFor="user-password">
@@ -208,7 +196,7 @@ export const LoginWithImage = () => {
/>
</FormGroup>
</Grid>
<Grid item minWidth="100%">
<Grid minWidth="100%">
<LoadingButton
variant="contained"
endIcon={<MdiChevronRight />}
@@ -241,9 +229,7 @@ export const UserLogin = () => {
queryKey: ["login", "users"],
queryFn: async () => {
const users = await getUserApi(window.api).getPublicUsers();
console.log(users.data);
return users.data;
// return {};
},
networkMode: "always",
});
@@ -301,8 +287,8 @@ export const UserLogin = () => {
imageTags={
!!item.PrimaryImageTag
}
// cardType="sqaure"
iconType="Person"
disableOverlay
iconType="User"
cardOrientation="sqaure"
onClickEvent={() =>
navigate(
@@ -345,7 +331,6 @@ export const UserLoginManual = () => {
const [loading, setLoading] = useState(false);
const [rememberMe, setRememberMe] = useState(true);
const dispatch = useDispatch();
const navigate = useNavigate();
const { enqueueSnackbar } = useSnackbar();
@@ -439,14 +424,15 @@ export const UserLoginManual = () => {
sx={{
opacity: server.isLoading ? 0 : 1,
transition: "opacity 200ms",
width: "100%",
}}
>
<Grid item xl={5} md={6} sx={{ marginBottom: "1em" }}>
<Grid sx={{ marginBottom: "1em" }}>
<Typography variant="h3" color="textPrimary">
Login
</Typography>
</Grid>
<Grid sx={{ width: "100%" }} item xl={5} md={6}>
<Grid sx={{ width: "100%" }}>
<FormControl
sx={{ width: "100%" }}
variant="outlined"
@@ -464,7 +450,7 @@ export const UserLoginManual = () => {
/>
</FormControl>
</Grid>
<Grid sx={{ width: "100%" }} item xl={5} md={6}>
<Grid sx={{ width: "100%" }}>
<FormGroup>
<FormControl
sx={{ width: "100%" }}
@@ -517,7 +503,7 @@ export const UserLoginManual = () => {
/>
</FormGroup>
</Grid>
<Grid item xl={5} md={6} sx={{ width: "100%" }}>
<Grid sx={{ width: "100%" }}>
<LoadingButton
variant="contained"
endIcon={<MdiChevronRight />}
@@ -530,7 +516,7 @@ export const UserLoginManual = () => {
Login
</LoadingButton>
</Grid>
<Grid item xl={15} md={6} sx={{ width: "100%" }}>
<Grid sx={{ width: "100%" }}>
<Typography variant="subtitle2">
{server.isSuccess &&
server.data.LoginDisclaimer}
+149
View File
@@ -0,0 +1,149 @@
/** @format */
import { appWindow } from "@tauri-apps/api/window";
import AppBar from "@mui/material/AppBar";
import Toolbar from "@mui/material/Toolbar";
import Box from "@mui/material/Box";
import Stack from "@mui/material/Stack";
import IconButton from "@mui/material/IconButton";
import Typography from "@mui/material/Typography";
import ReactPlayer from "react-player";
import { usePlaybackStore } from "../../utils/store/playback";
import { MdiArrowLeft } from "../../components/icons/mdiArrowLeft";
import { MdiPlay } from "../../components/icons/mdiPlay";
import { useNavigate } from "react-router-dom";
import { useRef, useState, useCallback } from "react";
import { secToTicks, ticksToSec } from "../../utils/date/time";
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
import "./videoPlayer.module.scss";
import { MdiPause } from "../../components/icons/mdiPause";
import { MdiFastForward } from "../../components/icons/mdiFastForward";
import { MdiRewind } from "../../components/icons/mdiRewind";
export const VideoPlayer = () => {
const navigate = useNavigate();
const playerRef = useRef();
const [isPlaying, setIsPlaying] = useState(true);
const [isMuted, setIsMuted] = useState(false);
const [isReady, setIsReady] = useState(false);
const onReady = useCallback(() => {
if (!isReady) {
const timeToStart = ticksToSec(startPosition);
playerRef.current.seekTo(timeToStart, "seconds");
setIsReady(true);
}
}, [isReady]);
const onProgress = async (e) => {
console.log(e);
await getPlaystateApi(window.api).reportPlaybackProgress({
playbackProgressInfo: {
ItemId: itemId,
IsMuted: isMuted,
PositionTicks: secToTicks(e.playedSeconds),
PlaybackStartTimeTicks: startPosition,
},
});
};
const [url, startPosition, itemId, itemName] = usePlaybackStore(
(state) => [
state.url,
state.startPosition,
state.itemId,
state.itemName,
],
);
let timer;
return (
<Box
className="video"
sx={{ background: "black" }}
onMouseMove={(e) => {
let a = "he";
clearTimeout(timer);
e.currentTarget.classList.add("video-osd-visible");
timer = setTimeout(() => {
document
.querySelector(".video")
.classList.remove("video-osd-visible");
}, 2000);
}}
>
<Stack
className="video-osd"
sx={{
position: "fixed",
top: 0,
left: 0,
right: 0,
bottom: 0,
}}
alignItems="center"
justifyContent="space-between"
direction="column"
zIndex="10000000"
>
<AppBar
position="static"
elevation={0}
sx={{
background:
"linear-gradient(to bottom, rgb(0 0 0 / 0.75), transparent)",
}}
>
<Toolbar>
<IconButton onClick={() => navigate(-1)}>
<MdiArrowLeft />
</IconButton>
<Typography ml={2} variant="h6">
{itemName}
</Typography>
</Toolbar>
</AppBar>
<Stack padding={2} direction="row">
<IconButton
onClick={() =>
playerRef.current.seekTo(
playerRef.current.getCurrentTime() - 15,
)
}
>
<MdiRewind />
</IconButton>
<IconButton onClick={() => setIsPlaying(!isPlaying)}>
{isPlaying ? <MdiPause /> : <MdiPlay />}
</IconButton>
<IconButton
onClick={() =>
playerRef.current.seekTo(
playerRef.current.getCurrentTime() + 15,
)
}
>
<MdiFastForward />
</IconButton>
</Stack>
</Stack>
<ReactPlayer
ref={playerRef}
width="100vw"
height="100vh"
playing={isPlaying}
url={url}
// controls={true}
onProgress={onProgress}
onReady={onReady}
muted={isMuted}
/>
</Box>
);
};
+11
View File
@@ -0,0 +1,11 @@
/** @format */
.video {
&-osd {
opacity: 0;
transition: opacity 0.1s linear;
}
&-osd-visible &-osd {
opacity: 1;
}
}
+120 -68
View File
@@ -2,7 +2,7 @@
import { useState, useEffect } from "react";
import { useNavigate } from "react-router-dom";
import { v4 as uuidv4 } from "uuid";
import axios from "axios";
import { EventEmitter as event } from "../../../eventEmitter.js";
import { setServer } from "../../../utils/storage/servers.js";
@@ -21,11 +21,17 @@ import { mdiChevronRight } from "@mdi/js";
import { useSnackbar } from "notistack";
// Svgs
import { ReactComponent as JellyplayerLogo } from "../../../assets/logo.svg";
import {
Jellyfin,
VersionOutdatedIssue,
VersionUnsupportedIssue,
} from "@jellyfin/sdk";
import { version as appVer } from "../../../../package.json";
import { v4 as uuidv4 } from "uuid";
// SCSS
import "./server.module.scss";
import { useQuery } from "@tanstack/react-query";
export const ServerList = () => {
const [renderServerList, setRenderServerList] = useState(false);
@@ -122,6 +128,17 @@ export const ServerList = () => {
};
export const ServerSetup = (props) => {
const sdk = new Jellyfin({
clientInfo: {
name: "JellyPlayer",
version: appVer,
},
deviceInfo: {
name: "JellyPlayer",
id: uuidv4(),
},
});
const [serverIp, setServerIp] = useState("");
const [checkingServer, setServerCheckState] = useState(false);
@@ -131,15 +148,7 @@ export const ServerSetup = (props) => {
const [loading, setLoading] = useState(false);
const usersAvailable = async () => {
const users = await getUserApi(window.api).getPublicUsers();
if (users.data.length >= 1) {
console.log("Users => ", users.data);
return true;
} else {
return false;
}
};
const usersAvailable = async () => {};
const addServer = async () => {
event.emit("create-jellyfin-api", serverIp);
let sysInfo = await getSystemApi(window.api).getPublicSystemInfo();
@@ -148,57 +157,113 @@ export const ServerSetup = (props) => {
// Set Server Config to Tauri store
sysInfo.Ip = serverIp;
setServer(sysInfo);
const usersAvailablity = await usersAvailable();
if (usersAvailablity == true) {
console.log(usersAvailablity);
navigate("/login/users");
} else {
navigate("/login/manual");
}
};
const handleAddServer = () => {
setLoading(true);
let data;
fetch(`${serverIp}/System/Ping`, {
body: JSON.stringify(data),
})
.then((res) => res.json())
.then((data) => {
if (data == "Jellyfin Server") {
addServer();
setLoading(false);
return true;
} else {
const checkServer = useQuery({
queryKey: ["setup", "server"],
queryFn: async () => {
let serverUrl = serverIp.replace(/\/$/, "").trim();
const candidates =
await sdk.discovery.getRecommendedServerCandidates(
serverUrl,
);
const best = sdk.discovery.findBestServer(candidates);
if (best) {
const issues = candidates.flatMap((s) => s.issues);
if (
issues.some(
(i) =>
i instanceof VersionOutdatedIssue ||
i instanceof VersionUnsupportedIssue,
)
) {
enqueueSnackbar(
"The server address does not seem be a jellyfin server",
{ variant: "error" },
"Please Update your server to latest Jellyfin version to use this client",
);
setLoading(false);
return false;
}
})
.catch((error) => {
setLoading(false);
try {
const api = sdk.createApi(best.address);
const { data } = await getSystemApi(
api,
).getPublicSystemInfo();
delete data.LocalAddress;
const serv = {
...data,
PublicAddress: best.address,
isDefault: false,
};
if (serv.StartupWizardCompleted) {
event.emit("create-jellyfin-api", serverIp);
data.Ip = serverIp;
setServer(data);
const users = await getUserApi(
window.api,
).getPublicUsers();
if (users.data.length >= 1) {
navigate("/login/users");
return true;
} else {
navigate("/login/manual");
return false;
}
} else {
enqueueSnackbar(
"Server setup not complete. Please complete your server setup.",
);
}
} catch (error) {
enqueueSnackbar("Something went wrong", {
variant: "error",
});
console.error(error);
}
} else {
enqueueSnackbar(
"Unable to verify whether the give address is a valid Jellyfin server",
"Server not found. Please check you entered address",
{ variant: "error" },
);
console.error(error);
});
}
return "";
},
enabled: false,
refetchOnWindowFocus: false,
});
const handleAddServer = () => {
// setLoading(true);
// let data;
// fetch(`${serverIp}/System/Ping`, {
// body: JSON.stringify(data),
// })
// .then((res) => res.json())
// .then((data) => {
// if (data == "Jellyfin Server") {
// addServer();
// setLoading(false);
// return true;
// } else {
// enqueueSnackbar(
// "The server address does not seem be a jellyfin server",
// { variant: "error" },
// );
// setLoading(false);
// return false;
// }
// })
// .catch((error) => {
// setLoading(false);
// enqueueSnackbar(
// "Unable to verify whether the give address is a valid Jellyfin server",
// { variant: "error" },
// );
// console.error(error);
// });
};
return (
<>
<Container
maxWidth="sm"
className={
checkingServer
? "centered serverContainer loading"
: "centered serverContainer"
}
>
<Container maxWidth="sm" className={"centered serverContainer"}>
<Grid
container
spacing={2}
@@ -216,22 +281,9 @@ export const ServerSetup = (props) => {
variant="outlined"
// inputRef={serverIp}
onChange={(event) => {
if (
event.target.value.charAt(
event.target.value.length - 1,
) == "/"
) {
setServerIp(
event.target.value.slice(
0,
-1,
),
);
} else {
setServerIp(event.target.value);
}
setServerIp(event.target.value);
}}
helperText="Add your server adddress with https:// or http://"
helperText="Add your server adddress with https:// or http://. Eg: https://demo.jellyfin.org"
></TextField>
</Grid>
<Grid item xl={5} md={6} sx={{ width: "100%" }}>
@@ -239,14 +291,14 @@ export const ServerSetup = (props) => {
variant="contained"
sx={{ width: "100%" }}
size="large"
loading={loading}
loading={checkServer.isFetching}
endIcon={
<SvgIcon>
<path d={mdiChevronRight}></path>
</SvgIcon>
}
loadingPosition="end"
onClick={handleAddServer}
onClick={() => checkServer.refetch()}
>
Add Server
</LoadingButton>
-9
View File
@@ -1,9 +0,0 @@
/** @format */
import { configureStore } from "@reduxjs/toolkit";
import sideBarReducer from "./utils/slice/sidemenu";
export default configureStore({
reducer: {
sidebar: sideBarReducer,
},
});
+1 -5
View File
@@ -46,13 +46,9 @@ body {
height: fit-content;
width: 100%;
position: relative;
overflow-y: visible;
overflow-y: hidden;
overflow-x: hidden;
min-height: 100vh;
// display: flex;
// flex-direction: column;
// justify-content: center;
// align-items: center;
}
.centered {
+18 -1
View File
@@ -3,11 +3,28 @@
* @param {number} ticks - C# ticks of a particular item
* @return {number} Converted ticks to Milliseconds
*/
const ticksToMs = (ticks) => {
return Math.round(ticks / 10000);
};
/**
* @format
* @param {number} ticks - C# ticks of a particular item
* @return {number} Converted ticks to Seconds
*/
export const ticksToSec = (ticks) => {
return Math.round(ticksToMs(ticks) / 1000);
};
/**
* @format
* @param {number} sec - Sec of a particular item
* @return {number} Converted Seconds to C# ticks
*/
export const secToTicks = (ticks) => {
return Math.round(ticks * 10000000);
};
/**
* @format
* @param {number} ticks - C# ticks of a particular item
-24
View File
@@ -1,24 +0,0 @@
/** @format */
import { createSlice } from "@reduxjs/toolkit";
export const sideBarSlice = createSlice({
name: "sidebar",
initialState: {
visible: false,
backdrop: true,
},
reducers: {
showSidemenu: (state) => {
state.visible = true;
},
hideSidemenu: (state) => {
state.visible = false;
},
setBackdrop: (state, action) => {
state.backdrop = action.payload;
},
},
});
export const { showSidemenu, hideSidemenu, setBackdrop } = sideBarSlice.actions;
export default sideBarSlice.reducer;
+14
View File
@@ -0,0 +1,14 @@
/** @format */
import { create } from "zustand";
export const usePlaybackStore = create((set) => ({
url: "",
startPosition: 0,
itemId: "",
itemName: "",
setUrl: (aurl) => set((state) => ({ ...state, url: aurl })),
setPosition: (apos) => set((state) => ({ ...state, startPosition: apos })),
setItemId: (aid) => set((state) => ({ ...state, itemId: aid })),
setItemName: (anm) => set((state) => ({ ...state, itemName: anm })),
}));