Update deps and code cleanup

This commit is contained in:
Prayag Prajapati committed 2023-12-11 21:45:34 +05:30
1 parent dc226da809
commit 5799031a34
9 files changed
+764 -965

No files matched your search

+17 -17
View File
@@ -13,21 +13,21 @@
"dependencies": { "dependencies": {
"@emotion/react": "^11.11.1", "@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0", "@emotion/styled": "^11.11.0",
"@fontsource-variable/jetbrains-mono": "^5.0.18", "@fontsource-variable/jetbrains-mono": "^5.0.19",
"@fontsource/noto-sans": "^5.0.17", "@fontsource/noto-sans": "^5.0.18",
"@jellyfin/sdk": "0.8.2", "@jellyfin/sdk": "0.8.2",
"@mdi/js": "^7.3.67", "@mdi/js": "^7.3.67",
"@mui/lab": "5.0.0-alpha.155", "@mui/lab": "5.0.0-alpha.155",
"@mui/material": "^5.14.15", "@mui/material": "^5.14.20",
"@tanstack/react-query": "^5.0.5", "@tanstack/react-query": "^5.13.4",
"@tanstack/react-query-devtools": "^5.4.2", "@tanstack/react-query-devtools": "^5.13.5",
"@tauri-apps/api": "^1.5.1", "@tauri-apps/api": "^1.5.1",
"axios": "^1.6.0", "axios": "^1.6.2",
"axios-tauri-api-adapter": "^0.2.0", "axios-tauri-api-adapter": "^0.2.0",
"blurhash": "^2.0.5", "blurhash": "^2.0.5",
"events": "^3.3.0", "events": "^3.3.0",
"framer-motion": "^10.16.4", "framer-motion": "^10.16.16",
"material-symbols": "^0.14.0", "material-symbols": "^0.14.2",
"notistack": "^3.0.1", "notistack": "^3.0.1",
"react": "^18.2.0", "react": "^18.2.0",
"react-blurhash": "^0.3.0", "react-blurhash": "^0.3.0",
@@ -35,24 +35,24 @@
"react-error-boundary": "^4.0.11", "react-error-boundary": "^4.0.11",
"react-multi-carousel": "^2.8.4", "react-multi-carousel": "^2.8.4",
"react-player": "^2.13.0", "react-player": "^2.13.0",
"react-router-dom": "^6.17.0", "react-router-dom": "^6.20.1",
"react-use-konami": "^1.1.0", "react-use-konami": "^1.1.0",
"tauri-plugin-log-api": "github:tauri-apps/tauri-plugin-log#v1", "tauri-plugin-log-api": "github:tauri-apps/tauri-plugin-log#v1",
"tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store", "tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store",
"uuid": "^9.0.1", "uuid": "^9.0.1",
"vite-plugin-svgr": "^4.1.0", "vite-plugin-svgr": "^4.2.0",
"wavesurfer.js": "^7.4.2", "wavesurfer.js": "^7.5.1",
"zustand": "^4.4.4" "zustand": "^4.4.7"
}, },
"devDependencies": { "devDependencies": {
"@tauri-apps/cli": "^1.5.6", "@tauri-apps/cli": "^1.5.7",
"@vitejs/plugin-react": "^4.1.0", "@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.52.0", "eslint": "^8.55.0",
"eslint-plugin-react": "^7.33.2", "eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-refresh": "^0.4.3", "eslint-plugin-react-refresh": "^0.4.5",
"prop-types": "^15.8.1", "prop-types": "^15.8.1",
"sass": "^1.69.5", "sass": "^1.69.5",
"vite": "^5.0.5", "vite": "^5.0.7",
"vite-plugin-compression": "^0.5.1" "vite-plugin-compression": "^0.5.1"
}, },
"license": "GPL-3.0-only" "license": "GPL-3.0-only"
+477 -646
View File
File diff suppressed because it is too large. Load diff
+138 -150
View File
@@ -243,7 +243,7 @@ function App() {
setUpdateDialog(true); setUpdateDialog(true);
// You could show a dialog asking the user if they want to install the update here. // You could show a dialog asking the user if they want to install the update here.
console.log( console.log(
`Installing update ${manifest?.version}, ${manifest?.date}, ${manifest?.body}`, `Update found : ${manifest?.version}, ${manifest?.date}`,
); );
// Install the update. This will also restart the app on Windows! // Install the update. This will also restart the app on Windows!
@@ -458,158 +458,146 @@ function App() {
<AppBar /> <AppBar />
<AudioPlayer key={audioPlayerVisible} /> <AudioPlayer key={audioPlayerVisible} />
<Routes location={location}> <Routes location={location}>
<Route {/* <Route
// key={location.key} // key={location.key}
element={<AnimationWrapper />} element={<AnimationWrapper />}
> > */}
<Route <Route
path="/" path="/"
exact exact
element={ element={<Navigate to={initialRoute} />}
<Navigate to={initialRoute} /> // element={<></>}
} />
// element={<></>} <Route
/> path="/error"
<Route element={
path="/error" <Dialog
element={ open
<Dialog onClose={handleRelaunch}
open aria-labelledby="alert-dialog-text"
onClose={handleRelaunch} aria-describedby="alert-dialog-desc"
aria-labelledby="alert-dialog-text" maxWidth="md"
aria-describedby="alert-dialog-desc" >
maxWidth="md" <DialogTitle id="alert-dialog-text">
> Unable to reach server
<DialogTitle id="alert-dialog-text"> </DialogTitle>
Unable to reach <DialogContent>
server <DialogContentText id="alert-dialog-desc">
</DialogTitle> Unable to connect to
<DialogContent> the jellyfin server.
<DialogContentText id="alert-dialog-desc"> </DialogContentText>
Unable to </DialogContent>
connect to the <DialogActions>
jellyfin <Button
server. onClick={() =>
</DialogContentText> navigate(
</DialogContent> "/servers/list",
<DialogActions> )
<Button }
onClick={() => >
navigate( Change Server
"/servers/list", </Button>
) <Button
} variant="outlined"
> onClick={
Change Server handleRelaunch
</Button> }
<Button >
variant="outlined" Restart JellyPlayer
onClick={ </Button>
handleRelaunch </DialogActions>
} </Dialog>
> }
Restart />
JellyPlayer <Route
</Button> path="/login/index"
</DialogActions> exact
</Dialog> element={<LoginRoute />}
} />
/>
<Route
path="/login/index"
exact
element={<LoginRoute />}
/>
<Route <Route path="/home" element={<Home />} />
path="/home" <Route
element={<Home />} path="/setup/server"
/> element={<ServerSetup />}
<Route />
path="/setup/server" <Route
element={<ServerSetup />} path="/servers/list"
/> element={<ServerList />}
<Route />
path="/servers/list" <Route
element={<ServerList />} path="/login/withImg/:userName/:userId/"
/> element={<LoginWithImage />}
<Route />
path="/login/withImg/:userName/:userId/" <Route
element={<LoginWithImage />} path="/login/users"
/> element={<UserLogin />}
<Route />
path="/login/users" <Route
element={<UserLogin />} path="/login/manual"
/> element={<UserLoginManual />}
<Route />
path="/login/manual" <Route
element={<UserLoginManual />} exact
/> path="/library/:id"
<Route element={<LibraryView />}
exact />
path="/library/:id" <Route
element={<LibraryView />} exact
/> path="/item/:id"
<Route element={<ItemDetail />}
exact />
path="/item/:id" <Route
element={<ItemDetail />} exact
/> path="/musicalbum/:id"
<Route element={<MusicAlbumTitlePage />}
exact />
path="/musicalbum/:id" <Route
element={<MusicAlbumTitlePage />} exact
/> path="/artist/:id"
<Route element={<ArtistTitlePage />}
exact />
path="/artist/:id" <Route
element={<ArtistTitlePage />} exact
/> path="/boxset/:id"
<Route element={<BoxSetTitlePage />}
exact />
path="/boxset/:id" <Route
element={<BoxSetTitlePage />} exact
/> path="/episode/:id"
<Route element={<EpisodeTitlePage />}
exact />
path="/episode/:id" <Route
element={<EpisodeTitlePage />} exact
/> path="/person/:id"
<Route element={<PersonTitlePage />}
exact />
path="/person/:id" <Route
element={<PersonTitlePage />} exact
/> path="/playlist/:id"
<Route element={<PlaylistTitlePage />}
exact />
path="/playlist/:id" <Route
element={<PlaylistTitlePage />} path="/series/:id"
/> element={<SeriesTitlePage />}
<Route />
path="/series/:id" <Route
element={<SeriesTitlePage />} path="/search"
/> element={<SearchPage />}
<Route />
path="/search" <Route
element={<SearchPage />} path="/favorite"
/> element={<FavoritePage />}
<Route />
path="/favorite" <Route
element={<FavoritePage />} path="/settings"
/> element={<Settings />}
<Route />
path="/settings" <Route path="/about" element={<About />} />
element={<Settings />} <Route
/> path="/player"
<Route element={<VideoPlayer />}
path="/about" />
element={<About />} {/* </Route> */}
/>
<Route
path="/player"
element={<VideoPlayer />}
/>
</Route>
</Routes> </Routes>
</div> </div>
<ReactQueryDevtools buttonPosition="bottom-left" /> <ReactQueryDevtools buttonPosition="bottom-left" />
+115 -122
View File
@@ -3,22 +3,18 @@ import React from "react";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import MuiCard from "@mui/material/Card";
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 LinearProgress from "@mui/material/LinearProgress";
import { Blurhash } from "react-blurhash";
import { getTypeIcon } from "../utils/iconsCollection"; import { getTypeIcon } from "../utils/iconsCollection";
import "./card.module.scss"; import "./card.module.scss";
import { MdiCheck } from "../icons/mdiCheck";
import LikeButton from "../buttons/likeButton"; import LikeButton from "../buttons/likeButton";
import MarkPlayedButton from "../buttons/markPlayedButton"; import MarkPlayedButton from "../buttons/markPlayedButton";
import PlayButton from "../buttons/playButton"; import PlayButton from "../buttons/playButton";
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client"; import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
import { useApi } from "../../utils/store/api"; import { useApi } from "../../utils/store/api";
import ErrorBoundary from "../errorBoundary";
const cardImageAspectRatios = { const cardImageAspectRatios = {
thumb: 1.777, thumb: 1.777,
@@ -63,7 +59,6 @@ export const Card = ({
cardTitle, cardTitle,
cardCaption, cardCaption,
imageType = "Primary", imageType = "Primary",
imageBlurhash,
cardType, cardType,
queryKey, queryKey,
userId, userId,
@@ -71,7 +66,6 @@ export const Card = ({
hideText, hideText,
onClick, onClick,
disableOverlay = false, disableOverlay = false,
disablePadding,
overrideIcon, overrideIcon,
}) => { }) => {
const [api] = useApi((state) => [state.api]); const [api] = useApi((state) => [state.api]);
@@ -94,47 +88,41 @@ export const Card = ({
tabIndex={0} tabIndex={0}
onClick={onClick ? onClick : defaultOnClick} onClick={onClick ? onClick : defaultOnClick}
> >
<div className="card-box"> <div
<div className="card-image-container"
className="card-image-container" style={{
style={{ aspectRatio: cardImageAspectRatios[cardType],
aspectRatio: cardImageAspectRatios[cardType], }}
}} >
> <ErrorBoundary fallback={<></>}>
{!!item.UserData && ( <div
<> className="card-indicator check"
<div style={{
className="card-indicator check" opacity: item.UserData?.Played ? 1 : 0,
style={{ }}
opacity: item.UserData?.Played >
? 1 <div className="material-symbols-rounded">
: 0, done
}} </div>
> </div>
<div className="material-symbols-rounded"> <div
done className={`card-indicator text`}
</div> style={{
</div> opacity: item.UserData?.UnplayedItemCount
<div ? 1
className={`card-indicator text`} : 0,
style={{ }}
opacity: item.UserData >
?.UnplayedItemCount <Typography
? 1 variant="subtitle2"
: 0, padding="0.1em 0.4em"
}} fontWeight={400}
> >
<Typography {item.UserData?.UnplayedItemCount}
variant="subtitle2" </Typography>
padding="0.1em 0.4em" </div>
fontWeight={400} </ErrorBoundary>
> {/* {!!imageBlurhash && (
{item.UserData?.UnplayedItemCount}
</Typography>
</div>
</>
)}
{/* {!!imageBlurhash && (
<Blurhash <Blurhash
hash={imageBlurhash} hash={imageBlurhash}
width={128} width={128}
@@ -144,40 +132,46 @@ export const Card = ({
className="card-image-blurhash" className="card-image-blurhash"
/> />
)} */} )} */}
<div className="card-image-icon-container"> <div className="card-image-icon-container">
{overrideIcon {overrideIcon
? getTypeIcon(overrideIcon) ? getTypeIcon(overrideIcon)
: getTypeIcon(item.Type)} : getTypeIcon(item.Type)}
</div> </div>
<img <img
src={ src={
overrideIcon == "User" overrideIcon == "User"
? `${api.basePath}/Users/${item.Id}/Images/Primary` ? `${api.basePath}/Users/${item.Id}/Images/Primary`
: api.getItemImageUrl( : api.getItemImageUrl(
seriesId seriesId
? item.SeriesId ? item.SeriesId
: item.AlbumId : item.AlbumId
? item.AlbumId ? item.AlbumId
: item.Id, : item.Id,
imageType, imageType,
{ {
quality: 85, quality: 90,
fillHeight: 462, fillHeight: 226,
fillWidth: 462, fillWidth: Math.floor(
}, 226 /
) cardImageAspectRatios[
} cardType
style={{ ],
height: "100%", ),
width: "100%", },
opacity: 0, )
}} }
loading="lazy" style={{
onLoad={(e) => (e.target.style.opacity = 1)} height: "100%",
className="card-image" width: "100%",
/> opacity: 0,
}}
loading="lazy"
onLoad={(e) => (e.target.style.opacity = 1)}
className="card-image"
/>
<div className="card-overlay">
{!disableOverlay && ( {!disableOverlay && (
<div className="card-overlay"> <>
<PlayButton <PlayButton
itemId={item.Id} itemId={item.Id}
userId={userId} userId={userId}
@@ -217,50 +211,49 @@ export const Card = ({
queryKey={queryKey} queryKey={queryKey}
userId={userId} userId={userId}
/> />
</div> </>
)}
{item.UserData?.PlaybackPositionTicks > 0 && (
<LinearProgress
variant="determinate"
value={item.UserData?.PlayedPercentage}
style={{
position: "absolute",
left: 0,
right: 0,
bottom: 0,
zIndex: 2,
height: "6px",
background:
"rgb(5 5 5 / 0.5) !important",
backdropFilter: "blur(5px)",
}}
color="primary"
/>
)} )}
</div> </div>
<div {item.UserData?.PlaybackPositionTicks > 0 && (
className="card-text-container" <LinearProgress
style={{ display: hideText ? "none" : "block" }} variant="determinate"
value={item.UserData?.PlayedPercentage}
style={{
position: "absolute",
left: 0,
right: 0,
bottom: 0,
zIndex: 2,
height: "6px",
background: "rgb(5 5 5 / 0.5) !important",
backdropFilter: "blur(5px)",
}}
color="primary"
/>
)}
</div>
<div
className="card-text-container"
style={{ display: hideText ? "none" : "block" }}
>
<Typography
variant="subtitle1"
fontWeight={500}
noWrap
textAlign="center"
style={{ opacity: 0.9 }}
> >
<Typography {cardTitle}
variant="subtitle1" </Typography>
fontWeight={500} <Typography
noWrap variant="subtitle2"
textAlign="center" noWrap
style={{ opacity: 0.9 }} textAlign="center"
> style={{ opacity: 0.6 }}
{cardTitle} lineHeight="auto"
</Typography> >
<Typography {cardCaption}
variant="subtitle2" </Typography>
noWrap
textAlign="center"
style={{ opacity: 0.6 }}
lineHeight="auto"
>
{cardCaption}
</Typography>
</div>
</div> </div>
</div> </div>
); );
+1 -8
View File
@@ -61,7 +61,6 @@
left: 0; left: 0;
width: 100% !important; width: 100% !important;
height: 100% !important; height: 100% !important;
border-radius: 8px;
overflow: hidden; overflow: hidden;
} }
} }
@@ -78,17 +77,11 @@
align-items: flex-end; align-items: flex-end;
justify-content: flex-end; justify-content: flex-end;
padding: 0.5em; padding: 0.5em;
border-radius: 8px; background: rgb(0 0 0 / 0.4);
} }
&:hover, &:hover,
&:focus, &:focus,
&:focus-within { &:focus-within {
.card-image {
filter: brightness(0.6);
}
.card-image-icon-container {
filter: brightness(0.6);
}
.card-overlay { .card-overlay {
opacity: 1; opacity: 1;
} }
+10 -18
View File
@@ -11,26 +11,18 @@ $maskPercentage: 40%;
flex-shrink: 0; flex-shrink: 0;
} }
&-backdrop { &-backdrop {
position: fixed; position: absolute;
background-attachment: fixed; background-attachment: scroll;
width: 100%; width: calc(100vw + 100px);
height: 100vh; height: calc(100vh + 100px);
top: 0; top: -50px;
left: 0; left: -50px;
z-index: -1; z-index: -1;
filter: brightness(0.4); filter: brightness(0.4);
mask-image: linear-gradient( mask-image: linear-gradient(to bottom, black 40%, transparent),
to bottom, linear-gradient(to left, black 40%, transparent);
black $maskPercentage, -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent),
transparent linear-gradient(to left, black 40%, transparent);
),
linear-gradient(to left, black $maskPercentage, transparent);
-webkit-mask-image: linear-gradient(
to bottom,
black $maskPercentage,
transparent
),
linear-gradient(to left, black $maskPercentage, transparent);
mask-composite: source-in; mask-composite: source-in;
-webkit-mask-composite: source-in; -webkit-mask-composite: source-in;
& > * { & > * {
+1
View File
@@ -31,6 +31,7 @@ import ErrorBoundary from "../../components/errorBoundary";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import CarouselSlideError from "../../components/errors/carousel"; import CarouselSlideError from "../../components/errors/carousel";
import { useApi } from "../../utils/store/api"; import { useApi } from "../../utils/store/api";
import { useSnackbar } from "notistack";
const Home = () => { const Home = () => {
const [api] = useApi((state) => [state.api]); const [api] = useApi((state) => [state.api]);
+1 -1
View File
@@ -117,7 +117,7 @@ const SeriesTitlePage = () => {
const result = await getTvShowsApi(api).getSeasons({ const result = await getTvShowsApi(api).getSeasons({
userId: user.data.Id, userId: user.data.Id,
seriesId: item.data.Id, seriesId: item.data.Id,
isSpecialSeason: false, // isSpecialSeason: false,
}); });
return result.data; return result.data;
}, },
+4 -3
View File
@@ -47,9 +47,9 @@ body {
width: calc(100% + 100px); width: calc(100% + 100px);
height: calc(100% + 100px); height: calc(100% + 100px);
position: absolute; position: absolute;
top: -100px; top: -50px;
left: -100px; left: -50px;
z-index: -1; z-index: -2;
filter: blur(120px) saturate(130%) contrast(140%); filter: blur(120px) saturate(130%) contrast(140%);
&-container { &-container {
position: fixed; position: fixed;
@@ -57,6 +57,7 @@ body {
height: 100vh; height: 100vh;
left: 0; left: 0;
top: 0; top: 0;
z-index: -1;
} }
} }