More updates to titlePage #26

This commit is contained in:
prayag17 committed 2023-04-09 12:09:35 +05:30
1 parent b8dc3828e8
commit fd8c6431d5
12 files changed
+556 -46

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ tauri-build = { version = "1.2.1", features = [] }
[dependencies] [dependencies]
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.2.2", features = [] } tauri = { version = "1.2.2", features = ["process-exit", "process-relaunch"] }
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
[features] [features]
+7 -1
View File
@@ -12,7 +12,13 @@
}, },
"tauri": { "tauri": {
"allowlist": { "allowlist": {
"all": false "all": false,
"process": {
"all": false,
"exit": true,
"relaunch": true,
"relaunchDangerousAllowSymlinkMacos": false
}
}, },
"bundle": { "bundle": {
"active": true, "active": true,
+9 -1
View File
@@ -46,6 +46,7 @@ import {
} from "./routes/login/root"; } from "./routes/login/root";
import LibraryView from "./routes/library/root.jsx"; import LibraryView from "./routes/library/root.jsx";
import ItemMovie from "./routes/item/Movie/root.jsx"; import ItemMovie from "./routes/item/Movie/root.jsx";
import ItemSeries from "./routes/item/Series/root.jsx";
import { SideMenu } from "./components/menu/sidemenu.jsx"; import { SideMenu } from "./components/menu/sidemenu.jsx";
import { AppBar } from "./components/appBar/appBar.jsx"; import { AppBar } from "./components/appBar/appBar.jsx";
@@ -246,11 +247,14 @@ function App() {
}; };
const handleRelaunch = async () => { const handleRelaunch = async () => {
await relaunch(); let result = await relaunch();
console.log(result);
}; };
const handleRemoveServer = async () => { const handleRemoveServer = async () => {
await delServer(); await delServer();
let result = await relaunch();
console.log(result);
}; };
const location = useLocation(); const location = useLocation();
@@ -354,6 +358,10 @@ function App() {
path="/item/Movie/:id" path="/item/Movie/:id"
element={<ItemMovie />} element={<ItemMovie />}
/> />
<Route
path="/item/Series/:id"
element={<ItemSeries />}
/>
{/* Logical Routes */} {/* Logical Routes */}
+7 -4
View File
@@ -28,7 +28,7 @@ import { MdiLogoutVariant } from "../icons/mdiLogoutVariant";
import { MediaCollectionTypeIconCollection } from "../../components/utils/iconsCollection.jsx"; import { MediaCollectionTypeIconCollection } from "../../components/utils/iconsCollection.jsx";
import { useSelector, useDispatch } from "react-redux"; import { useSelector, useDispatch } from "react-redux";
import { hideSidemenu } from "../../utils/slice/sidemenu"; import { hideSidemenu, setBackdrop } from "../../utils/slice/sidemenu";
import { MdiHomeVariantOutline } from "../icons/mdiHomeVariantOutline"; import { MdiHomeVariantOutline } from "../icons/mdiHomeVariantOutline";
@@ -62,6 +62,7 @@ export const SideMenu = ({}) => {
const [display, setDisplay] = useState(false); const [display, setDisplay] = useState(false);
const visible = useSelector((state) => state.sidebar.visible); const visible = useSelector((state) => state.sidebar.visible);
const backdrop = useSelector((state) => state.sidebar.backdrop);
const navigate = useNavigate(); const navigate = useNavigate();
const user = useQuery({ const user = useQuery({
queryKey: ["user"], queryKey: ["user"],
@@ -97,14 +98,12 @@ export const SideMenu = ({}) => {
}; };
useEffect(() => { useEffect(() => {
// console.log(());
if ( if (
getCurrentPathWithoutParam() != "/login" && getCurrentPathWithoutParam() != "/login" &&
getCurrentPathWithoutParam != "/setup/server" getCurrentPathWithoutParam() != "/setup/server"
) { ) {
setDisplay(true); setDisplay(true);
} }
console.log(location);
}, [location]); }, [location]);
if (!display) { if (!display) {
@@ -131,6 +130,10 @@ export const SideMenu = ({}) => {
width: visible width: visible
? `calc(${theme.spacing(7)} + 10px)` ? `calc(${theme.spacing(7)} + 10px)`
: 0, : 0,
background: backdrop
? theme.palette.background.paper
: "transparent",
borderLeft: "1px solid white",
}} }}
> >
<DrawerHeader <DrawerHeader
+1 -1
View File
@@ -61,7 +61,7 @@
} }
&-icon { &-icon {
position: absolute; position: absolute;
font-size: 10em !important; font-size: 15em !important;
left: 70%; left: 70%;
top: 50%; top: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
+4 -3
View File
@@ -5,7 +5,7 @@
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: inherit;
height: 100%; height: 100%;
z-index: -2; z-index: -2;
opacity: 0.1; opacity: 0.1;
@@ -18,13 +18,14 @@
position: relative; position: relative;
&-backdrop { &-backdrop {
position: absolute; position: absolute;
width: 100%; width: 100vw;
height: 150%; height: 150%;
top: -88px; top: -88px;
width: 100vw; width: 100vw;
right: 0;
left: -24px; left: -24px;
z-index: -1; z-index: -1;
filter: brightness(0.3); filter: brightness(0.5);
mask-image: linear-gradient(0deg, transparent, black); mask-image: linear-gradient(0deg, transparent, black);
-webkit-mask-image: linear-gradient(0deg, transparent, black); -webkit-mask-image: linear-gradient(0deg, transparent, black);
} }
+91 -32
View File
@@ -8,6 +8,8 @@ import Stack from "@mui/material/Stack";
import Chip from "@mui/material/Chip"; import Chip from "@mui/material/Chip";
import useScrollTrigger from "@mui/material/useScrollTrigger"; import useScrollTrigger from "@mui/material/useScrollTrigger";
import Divider from "@mui/material/Divider"; import Divider from "@mui/material/Divider";
import LinearProgress from "@mui/material/LinearProgress";
import MenuItem from "@mui/material/MenuItem";
import { Blurhash } from "react-blurhash"; import { Blurhash } from "react-blurhash";
import { import {
@@ -48,7 +50,6 @@ const ItemMovie = () => {
if (!appBarVisiblity) { if (!appBarVisiblity) {
dispatch(showAppBar()); dispatch(showAppBar());
} }
console.log(trigger);
dispatch(setBackdrop(trigger)); dispatch(setBackdrop(trigger));
dispatch(showBackButton()); dispatch(showBackButton());
}, [trigger]); }, [trigger]);
@@ -89,6 +90,26 @@ const ItemMovie = () => {
} }
if (item.isSuccess) { if (item.isSuccess) {
return ( return (
<>
<Box className="item-detail-backdrop">
{item.data.BackdropImageTags.length != 0 && (
<Blurhash
hash={
item.data.ImageBlurHashes.Backdrop[
item.data.BackdropImageTags[0]
]
}
width="100%"
height="100%"
resolutionX={64}
resolutionY={96}
style={{
aspectRatio: "0.666",
}}
className="item-detail-image-blurhash"
/>
)}
</Box>
<Box <Box
recomponent="main" recomponent="main"
className="scrollY" className="scrollY"
@@ -107,25 +128,6 @@ const ItemMovie = () => {
} }
}} }}
> >
<Box className="item-detail-backdrop">
{item.data.BackdropImageTags.length != 0 && (
<Blurhash
hash={
item.data.ImageBlurHashes.Backdrop[
item.data.BackdropImageTags[0]
]
}
width="100%"
height="100%"
resolutionX={64}
resolutionY={96}
style={{
aspectRatio: 0.666,
}}
className="card-image-blurhash"
/>
)}
</Box>
<Box className="item-detail-header"> <Box className="item-detail-header">
<Box className="item-detail-header-backdrop"> <Box className="item-detail-header-backdrop">
{item.data.BackdropImageTags.length != 0 && ( {item.data.BackdropImageTags.length != 0 && (
@@ -150,8 +152,10 @@ const ItemMovie = () => {
{item.data.BackdropImageTags.length != 0 && ( {item.data.BackdropImageTags.length != 0 && (
<Blurhash <Blurhash
hash={ hash={
item.data.ImageBlurHashes.Backdrop[ item.data.ImageBlurHashes
item.data.BackdropImageTags[0] .Backdrop[
item.data
.BackdropImageTags[0]
] ]
} }
width="100%" width="100%"
@@ -164,9 +168,12 @@ const ItemMovie = () => {
className="item-detail-image-blurhash" className="item-detail-image-blurhash"
/> />
)} )}
<div className="item-detail-image-icon-container"> <Box
sx={{ fontSize: "4em" }}
className="item-detail-image-icon-container"
>
{TypeIconCollectionCard[item.data.Type]} {TypeIconCollectionCard[item.data.Type]}
</div> </Box>
</Box> </Box>
<Box className="item-detail-image-container"> <Box className="item-detail-image-container">
{!!item.data.ImageTags.Primary && ( {!!item.data.ImageTags.Primary && (
@@ -191,8 +198,10 @@ const ItemMovie = () => {
{!!item.data.ImageBlurHashes.Primary && ( {!!item.data.ImageBlurHashes.Primary && (
<Blurhash <Blurhash
hash={ hash={
item.data.ImageBlurHashes.Primary[ item.data.ImageBlurHashes
item.data.ImageTags.Primary .Primary[
item.data.ImageTags
.Primary
] ]
} }
width="100%" width="100%"
@@ -210,10 +219,36 @@ const ItemMovie = () => {
</div> </div>
</Box> </Box>
<Box className="item-detail-info-container"> <Box className="item-detail-info-container">
<Box className="item-detail-title-name"> <Box
<Typography variant="h4"> className="item-detail-title-name"
sx={{ mb: 2 }}
>
<Typography variant="h3">
{item.data.Name} {item.data.Name}
</Typography> </Typography>
{!!item.data.UserData
.PlayedPercentage && (
<LinearProgress
variant="determinate"
value={
item.data.UserData
.PlayedPercentage
}
sx={{
borderRadius: 1000,
width: "75%",
mt: 1,
mb: 1,
}}
color="primary"
/>
)}
<Typography
variant="subtitle1"
color="gray"
>
{item.data.OriginalTitle}
</Typography>
</Box> </Box>
<Stack <Stack
direction="row" direction="row"
@@ -237,7 +272,8 @@ const ItemMovie = () => {
variant="outlined" variant="outlined"
label={ label={
!!item.data.OfficialRating !!item.data.OfficialRating
? item.data.OfficialRating ? item.data
.OfficialRating
: "Not Rated" : "Not Rated"
} }
/> />
@@ -267,15 +303,35 @@ const ItemMovie = () => {
)} )}
</Box> </Box>
<Typography variant="subtitle1"> <Typography variant="subtitle1">
{getRuntimeFull(item.data.RunTimeTicks)} {getRuntimeFull(
item.data.RunTimeTicks,
)}
</Typography> </Typography>
</Stack> </Stack>
</Box> </Box>
</Box> </Box>
<Box className="item-media-container">
<Stack
direction="row"
gap={1}
alignItems="center"
>
<Typography variant="h5">Genre</Typography>
{item.data.Genres.map((genre, index) => {
return (
<Chip
key={index}
variant="filled"
label={genre}
/>
);
})}
</Stack>
</Box>
<Typography variant="body1"> <Typography variant="body1">
{item.data.Overview} {item.data.Overview}
</Typography> </Typography>
<CardScroller displayCards={8} title="Actors"> <CardScroller displayCards={8} title="Cast">
{item.data.People.map((person, index) => { {item.data.People.map((person, index) => {
return ( return (
<Card <Card
@@ -283,7 +339,9 @@ const ItemMovie = () => {
itemName={person.Name} itemName={person.Name}
itemId={person.Id} itemId={person.Id}
// imageTags={false} // imageTags={false}
imageTags={!!person.PrimaryImageTag} imageTags={
!!person.PrimaryImageTag
}
iconType="Person" iconType="Person"
subText={person.Role} subText={person.Role}
cardOrientation="sqaure" cardOrientation="sqaure"
@@ -293,6 +351,7 @@ const ItemMovie = () => {
})} })}
</CardScroller> </CardScroller>
</Box> </Box>
</>
); );
} }
if (item.isError) { if (item.isError) {
+63
View File
@@ -0,0 +1,63 @@
/** @format */
.item-detail {
&-backdrop {
position: fixed;
top: 0;
left: 0;
width: inherit;
height: 100%;
z-index: -2;
opacity: 0.1;
}
&-header {
display: flex;
gap: 2em;
justify-content: flex-start;
align-items: flex-end;
position: relative;
&-backdrop {
position: absolute;
width: 100vw;
height: 150%;
top: -88px;
width: 100vw;
right: 0;
left: -24px;
z-index: -1;
filter: brightness(0.5);
mask-image: linear-gradient(0deg, transparent, black);
-webkit-mask-image: linear-gradient(0deg, transparent, black);
}
}
&-image {
width: 100%;
height: 100%;
object-fit: cover;
position: absolute;
transition: opacity $transition-time-default;
&-blurhash {
z-index: -1;
}
&-container {
width: 15%;
position: relative;
aspect-ratio: 0.666;
border-radius: $border-radius-default;
overflow: hidden;
box-shadow: 0 0 15px rgb(0 0 0 / 0.4);
}
&-icon-container {
background: $clr-gradient-dark;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
z-index: -2;
}
}
}
+362
View File
@@ -0,0 +1,362 @@
/** @format */
import { useState, useEffect } from "react";
import Box from "@mui/material/Box";
import CircularProgress from "@mui/material/CircularProgress";
import Typography from "@mui/material/Typography";
import Stack from "@mui/material/Stack";
import Chip from "@mui/material/Chip";
import useScrollTrigger from "@mui/material/useScrollTrigger";
import Divider from "@mui/material/Divider";
import LinearProgress from "@mui/material/LinearProgress";
import MenuItem from "@mui/material/MenuItem";
import { Blurhash } from "react-blurhash";
import {
setBackdrop,
showAppBar,
showBackButton,
} from "../../../utils/slice/appBar";
import { useDispatch, useSelector } from "react-redux";
import { useParams } from "react-router-dom";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
import { useQuery } from "@tanstack/react-query";
import { MdiStarHalfFull } from "../../../components/icons/mdiStarHalfFull";
import { getRuntimeFull } from "../../../utils/date/time";
import { TypeIconCollectionCard } from "../../../components/utils/iconsCollection";
import { Card } from "../../../components/card/card";
import { CardScroller } from "../../../components/cardScroller/cardScroller";
import "./Series.module.scss";
const ItemSeries = () => {
const { id } = useParams();
const dispatch = useDispatch();
const appBarVisiblity = useSelector((state) => state.appBar.visible);
const [scrollTarget, setScrollTarget] = useState(undefined);
const [primageImageLoaded, setPrimaryImageLoaded] = useState(false);
const [backdropImageLoaded, setBackdropImageLoaded] = useState(false);
const trigger = useScrollTrigger({
disableHysteresis: true,
threshold: 0,
target: scrollTarget,
});
useEffect(() => {
if (!appBarVisiblity) {
dispatch(showAppBar());
}
dispatch(setBackdrop(trigger));
dispatch(showBackButton());
}, [trigger]);
const user = useQuery({
queryKey: ["user"],
queryFn: async () => {
let usr = await getUserApi(window.api).getCurrentUser();
return usr.data;
},
});
const item = useQuery({
queryKey: ["item, Series", id],
queryFn: async () => {
const result = await getUserLibraryApi(window.api).getItem({
userId: user.data.Id,
itemId: id,
});
return result.data;
},
enabled: !!user.data,
});
if (item.isLoading) {
return (
<Box
sx={{
width: "100%",
height: "100%",
display: "flex",
alignItems: "center",
justifyContent: "center",
}}
>
<CircularProgress />
</Box>
);
}
if (item.isSuccess) {
return (
<>
<Box className="item-detail-backdrop">
{item.data.BackdropImageTags.length != 0 && (
<Blurhash
hash={
item.data.ImageBlurHashes.Backdrop[
item.data.BackdropImageTags[0]
]
}
width="100%"
height="100%"
resolutionX={64}
resolutionY={96}
style={{
aspectRatio: "0.666",
}}
className="item-detail-image-blurhash"
/>
)}
</Box>
<Box
recomponent="main"
className="scrollY"
sx={{
display: "flex",
pt: 11,
px: 3,
pb: 3,
position: "relative",
flexFlow: "column",
gap: 5,
}}
ref={(node) => {
if (node) {
setScrollTarget(node);
}
}}
>
<Box className="item-detail-header">
<Box className="item-detail-header-backdrop">
{item.data.BackdropImageTags.length != 0 && (
<img
src={
window.api.basePath +
"/Items/" +
item.data.Id +
"/Images/Backdrop"
}
style={{
opacity: backdropImageLoaded
? 1
: 0,
}}
className="item-detail-image"
onLoad={() =>
setBackdropImageLoaded(true)
}
/>
)}
{item.data.BackdropImageTags.length != 0 && (
<Blurhash
hash={
item.data.ImageBlurHashes
.Backdrop[
item.data
.BackdropImageTags[0]
]
}
width="100%"
height="100%"
resolutionX={64}
resolutionY={96}
style={{
aspectRatio: "0.666",
}}
className="item-detail-image-blurhash"
/>
)}
<Box
sx={{ fontSize: "4em" }}
className="item-detail-image-icon-container"
>
{TypeIconCollectionCard[item.data.Type]}
</Box>
</Box>
<Box className="item-detail-image-container">
{!!item.data.ImageTags.Primary && (
<img
src={
window.api.basePath +
"/Items/" +
item.data.Id +
"/Images/Primary"
}
style={{
opacity: primageImageLoaded
? 1
: 0,
}}
className="item-detail-image"
onLoad={() =>
setPrimaryImageLoaded(true)
}
/>
)}
{!!item.data.ImageBlurHashes.Primary && (
<Blurhash
hash={
item.data.ImageBlurHashes
.Primary[
item.data.ImageTags
.Primary
]
}
width="100%"
height="100%"
resolutionX={64}
resolutionY={96}
style={{
aspectRatio: 0.666,
}}
className="item-detail-image-blurhash"
/>
)}
<div className="item-detail-image-icon-container">
{TypeIconCollectionCard[item.data.Type]}
</div>
</Box>
<Box className="item-detail-info-container">
<Box
className="item-detail-title-name"
sx={{ mb: 2 }}
>
<Typography variant="h3">
{item.data.Name}
</Typography>
{!!item.data.UserData
.PlayedPercentage && (
<LinearProgress
variant="determinate"
value={
item.data.UserData
.PlayedPercentage
}
sx={{
borderRadius: 1000,
width: "75%",
mt: 1,
mb: 1,
}}
color="primary"
/>
)}
<Typography
variant="subtitle1"
color="gray"
>
{item.data.OriginalTitle}
</Typography>
</Box>
<Stack
direction="row"
gap={2}
divider={
<Divider
variant="middle"
flexItem
orientation="vertical"
/>
}
ex={{ alignItems: "center" }}
>
<Typography
sx={{ flexGrow: 0 }}
variant="subtitle1"
>
{item.data.ProductionYear}
</Typography>
<Chip
variant="outlined"
label={
!!item.data.OfficialRating
? item.data
.OfficialRating
: "Not Rated"
}
/>
<Box
sx={{
display: "flex",
gap: "0.25em",
alignItems: "center",
}}
className="item-detail-info-rating"
>
{!!item.data.CommunityRating ? (
<>
<MdiStarHalfFull />
<Typography variant="subtitle1">
{Math.round(
item.data
.CommunityRating *
10,
) / 10}
</Typography>
</>
) : (
<Typography variant="subtitle1">
No Community Rating
</Typography>
)}
</Box>
<Typography variant="subtitle1">
{getRuntimeFull(
item.data.RunTimeTicks,
)}
</Typography>
</Stack>
</Box>
</Box>
<Box className="item-media-container">
<Stack
direction="row"
gap={1}
alignItems="center"
>
<Typography variant="h5">Genre</Typography>
{item.data.Genres.map((genre, index) => {
return (
<Chip
key={index}
variant="filled"
label={genre}
/>
);
})}
</Stack>
</Box>
<Typography variant="body1">
{item.data.Overview}
</Typography>
<CardScroller displayCards={8} title="Cast">
{item.data.People.map((person, index) => {
return (
<Card
key={index}
itemName={person.Name}
itemId={person.Id}
// imageTags={false}
imageTags={
!!person.PrimaryImageTag
}
iconType="Person"
subText={person.Role}
cardOrientation="sqaure"
currentUser={user.data}
/>
);
})}
</CardScroller>
</Box>
</>
);
}
if (item.isError) {
return <h1>{"Something went wrong :("}</h1>;
}
};
export default ItemSeries;
+3 -1
View File
@@ -772,7 +772,9 @@ const LibraryView = () => {
item.Type == item.Type ==
"MusicAlbum" || "MusicAlbum" ||
item.Type == item.Type ==
"MusicGenre" "MusicGenre" ||
item.Type ==
"Playlist"
? "square" ? "square"
: "portait" : "portait"
} }
+3 -1
View File
@@ -29,8 +29,9 @@ body {
#root, #root,
.root-page { .root-page {
height: 100vh; height: 100vh;
width: 100vw; width: 100%;
overflow: hidden; overflow: hidden;
position: relative;
} }
.centered { .centered {
@@ -82,6 +83,7 @@ h1 {
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
height: 100vh; height: 100vh;
width: inherit;
box-sizing: border-box; box-sizing: border-box;
} }
+5 -1
View File
@@ -5,6 +5,7 @@ export const sideBarSlice = createSlice({
name: "sidebar", name: "sidebar",
initialState: { initialState: {
visible: false, visible: false,
backdrop: true,
}, },
reducers: { reducers: {
showSidemenu: (state) => { showSidemenu: (state) => {
@@ -13,8 +14,11 @@ export const sideBarSlice = createSlice({
hideSidemenu: (state) => { hideSidemenu: (state) => {
state.visible = false; state.visible = false;
}, },
setBackdrop: (state, action) => {
state.backdrop = action.payload;
},
}, },
}); });
export const { showSidemenu, hideSidemenu } = sideBarSlice.actions; export const { showSidemenu, hideSidemenu, setBackdrop } = sideBarSlice.actions;
export default sideBarSlice.reducer; export default sideBarSlice.reducer;