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