Update homepage carousel and add support for MD in updater

This commit is contained in:
Prayag Prajapati committed 2023-12-29 17:45:23 +05:30
1 parent afcc8cfd4d
commit 960538a9a6
10 files changed
+904 -149

No files matched your search

+1
View File
@@ -33,6 +33,7 @@
"react-blurhash": "^0.3.0", "react-blurhash": "^0.3.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-error-boundary": "^4.0.11", "react-error-boundary": "^4.0.11",
"react-markdown": "^9.0.1",
"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.20.1", "react-router-dom": "^6.20.1",
+675 -63
View File
File diff suppressed because it is too large. Load diff
+4 -1
View File
@@ -58,6 +58,7 @@ import About from "./routes/about";
import SearchPage from "./routes/search"; import SearchPage from "./routes/search";
import { VideoPlayer } from "./routes/player/videoPlayer.jsx"; import { VideoPlayer } from "./routes/player/videoPlayer.jsx";
import Markdown from "react-markdown";
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";
@@ -315,7 +316,9 @@ function App() {
</DialogTitle> </DialogTitle>
<DialogContent dividers> <DialogContent dividers>
<DialogContentText> <DialogContentText>
{updateInfo.body} <Markdown>
{updateInfo.body}
</Markdown>
</DialogContentText> </DialogContentText>
</DialogContent> </DialogContent>
<DialogActions <DialogActions
+11 -2
View File
@@ -200,23 +200,30 @@ export const AppBar = () => {
}} }}
> >
<NavLink to="/home" className="appBar-text"> <NavLink to="/home" className="appBar-text">
<Typography variant="subtitle1"> <Typography
variant="subtitle1"
fontWeight={600}
>
Home Home
</Typography> </Typography>
</NavLink> </NavLink>
<Typography <Typography
ref={librariesText} ref={librariesText}
variant="subtitle1" variant="subtitle1"
fontWeight={600}
onMouseEnter={popoverEnter}
onFocus={popoverEnter}
tabIndex={0}
className={ className={
isBrowsingLibrary isBrowsingLibrary
? "appBar-text active" ? "appBar-text active"
: "appBar-text" : "appBar-text"
} }
onMouseEnter={popoverEnter}
// onMouseLeave={popoverLeave} // onMouseLeave={popoverLeave}
> >
Libraries Libraries
</Typography> </Typography>
<Menu <Menu
open={Boolean(librariesPopover)} open={Boolean(librariesPopover)}
anchorEl={librariesPopover} anchorEl={librariesPopover}
@@ -237,6 +244,7 @@ export const AppBar = () => {
onMouseLeave: popoverLeave, onMouseLeave: popoverLeave,
}} }}
disableScrollLock disableScrollLock
hideBackdrop
> >
{libraries.isPending {libraries.isPending
? "loading..." ? "loading..."
@@ -254,6 +262,7 @@ export const AppBar = () => {
// `/library/${library.Id}`, // `/library/${library.Id}`,
// ) // )
// } // }
tabIndex={0}
className="appBar-library" className="appBar-library"
> >
<ListItemIcon> <ListItemIcon>
+3 -3
View File
@@ -2,7 +2,7 @@
.carousel { .carousel {
position: relative; position: relative;
height: 100vh; height: 80vh;
&-button { &-button {
position: absolute !important; position: absolute !important;
top: 50%; top: 50%;
@@ -12,7 +12,7 @@
right: 0.5em; right: 0.5em;
} }
&.left { &.left {
left: 0; left: 0.5em;
} }
} }
&-indicator { &-indicator {
@@ -30,7 +30,7 @@
display: flex; display: flex;
position: absolute; position: absolute;
bottom: 1em; bottom: 1em;
width: calc(100vw - 8em); width: calc(100vw - 3em);
left: 1em; left: 1em;
right: 1em; right: 1em;
gap: 1em; gap: 1em;
+1 -1
View File
@@ -72,7 +72,7 @@ const Carousel = ({ content, onChange }) => {
} }
}} }}
style={{ style={{
height: "100vh", height: "100%",
width: "100vw", width: "100vw",
position: "absolute", position: "absolute",
}} }}
+198 -67
View File
@@ -20,6 +20,7 @@ import { useNavigate } from "react-router-dom";
import { MediaTypeIconCollection, getTypeIcon } from "../utils/iconsCollection"; import { MediaTypeIconCollection, getTypeIcon } from "../utils/iconsCollection";
import { MdiChevronRight } from "../icons/mdiChevronRight"; import { MdiChevronRight } from "../icons/mdiChevronRight";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
import { red } from "@mui/material/colors";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api"; import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import LikeButton from "../buttons/likeButton"; import LikeButton from "../buttons/likeButton";
@@ -97,8 +98,8 @@ const CarouselSlide = ({ item }) => {
] ]
} }
// hash="LEHV6nWB2yk8pyo0adR*.7kCMdnj" // hash="LEHV6nWB2yk8pyo0adR*.7kCMdnj"
width="1080" width="108"
height="720" height="72"
resolutionX={64} resolutionX={64}
resolutionY={96} resolutionY={96}
className="hero-carousel-background-blurhash" className="hero-carousel-background-blurhash"
@@ -127,32 +128,56 @@ const CarouselSlide = ({ item }) => {
</div> </div>
</div> </div>
<motion.div <motion.div
initial={{ // initial={{
transform: // transform:
animationDirection == "right" // animationDirection == "right"
? "translateX(60px)" // ? "translateX(60px)"
: "translateX(-60px)", // : "translateX(-60px)",
opacity: 0, // opacity: 0,
}} // }}
animate={{ // animate={{
transform: "translateX(0px)", // transform: "translateX(0px)",
opacity: 1, // opacity: 1,
}} // }}
exit={{ // exit={{
transform: // transform:
animationDirection == "right" // animationDirection == "right"
? "translateX(-60px)" // ? "translateX(-60px)"
: "translateX(60px)", // : "translateX(60px)",
opacity: 0, // opacity: 0,
}} // }}
transition={{ // transition={{
duration: 0.25, // duration: 0.25,
ease: "easeInOut", // ease: "easeInOut",
}} // }}
className="hero-carousel-detail" className="hero-carousel-detail"
> >
<Typography <Typography
component={motion.div}
initial={{
transform:
animationDirection == "right"
? "translateX(60px)"
: "translateX(-60px)",
opacity: 0,
}}
animate={{
transform: "translateX(0px)",
opacity: 1,
}}
exit={{
transform:
animationDirection == "right"
? "translateX(-60px)"
: "translateX(60px)",
opacity: 0,
}}
transition={{
duration: 0.25,
ease: "easeInOut",
}}
key={item.Id} key={item.Id}
variant="h2" variant="h2"
className="hero-carousel-text" className="hero-carousel-text"
@@ -184,23 +209,41 @@ const CarouselSlide = ({ item }) => {
)} )}
</Typography> </Typography>
<Stack <Stack
component={motion.div}
initial={{
transform:
animationDirection == "right"
? "translateX(20px)"
: "translateX(-20px)",
opacity: 0,
}}
animate={{
transform: "translateX(0px)",
opacity: 1,
}}
exit={{
transform:
animationDirection == "right"
? "translateX(-20px)"
: "translateX(20px)",
opacity: 0,
}}
transition={{
duration: 0.25,
ease: "easeInOut",
}}
direction="row" direction="row"
gap={1} gap={2}
divider={
<div
style={{
width: "4px",
height: "4px",
background: "white",
alignSelf: "center",
aspectRatio: 1,
borderRadius: "10px",
}}
></div>
}
className="hero-carousel-info" className="hero-carousel-info"
mt={1}
justifyItems="flex-start"
alignItems="center"
> >
<Typography variant="subtitle1"> <Typography
style={{ opacity: "0.8" }}
variant="subtitle1"
>
{item.ProductionYear {item.ProductionYear
? item.ProductionYear ? item.ProductionYear
: "Unknown"} : "Unknown"}
@@ -209,46 +252,110 @@ const CarouselSlide = ({ item }) => {
variant="filled" variant="filled"
label={item.OfficialRating ?? "Not Rated"} label={item.OfficialRating ?? "Not Rated"}
/> />
<div <ErrorBoundary fallback={<></>}>
style={{ <div
display: "flex", style={{
gap: "0.25em", display: "flex",
alignItems: "center", gap: "0.25em",
}} alignItems: "center",
className="hero-carousel-info-rating" }}
> className="hero-carousel-info-rating"
{item.CommunityRating ? ( >
<> <div
<MdiStar className="material-symbols-rounded "
sx={{ style={{
color: yellow[700], // fontSize: "2.2em",
}} color: yellow[400],
/> fontVariationSettings:
<Typography variant="subtitle1"> '"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
{Math.round( }}
item.CommunityRating * >
10, star
) / 10} </div>
</Typography> <Typography
</> style={{
) : ( opacity: "0.8",
<Typography variant="subtitle1"> }}
No Community Rating variant="subtitle1"
>
{Math.round(
item.CommunityRating * 10,
) / 10}
</Typography> </Typography>
)} </div>
</div> </ErrorBoundary>
{Boolean(item.CriticRating) && (
<div
style={{
display: "flex",
gap: "0.25em",
alignItems: "center",
}}
className="hero-carousel-info-rating"
>
<div
className="material-symbols-rounded "
style={{
color: red[400],
fontVariationSettings:
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
}}
>
thumb_up
</div>
<Typography
style={{
opacity: "0.8",
}}
variant="subtitle1"
>
{item.CriticRating}
</Typography>
</div>
)}
{!!item.RunTimeTicks && ( {!!item.RunTimeTicks && (
<Typography variant="subtitle1"> <Typography
style={{ opacity: "0.8" }}
variant="subtitle1"
>
{getRuntime(item.RunTimeTicks)} {getRuntime(item.RunTimeTicks)}
</Typography> </Typography>
)} )}
{!!item.RunTimeTicks && ( {!!item.RunTimeTicks && (
<Typography variant="subtitle1"> <Typography
style={{ opacity: "0.8" }}
variant="subtitle1"
>
{endsAt(item.RunTimeTicks)} {endsAt(item.RunTimeTicks)}
</Typography> </Typography>
)} )}
</Stack> </Stack>
<Typography <Typography
component={motion.div}
initial={{
transform:
animationDirection == "right"
? "translateX(20px)"
: "translateX(-20px)",
opacity: 0,
}}
animate={{
transform: "translateX(0px)",
opacity: 1,
}}
exit={{
transform:
animationDirection == "right"
? "translateX(-20px)"
: "translateX(20px)",
opacity: 0,
}}
transition={{
duration: 0.25,
ease: "easeInOut",
}}
variant="subtitle1" variant="subtitle1"
className="hero-carousel-text" className="hero-carousel-text"
sx={{ sx={{
@@ -265,6 +372,30 @@ const CarouselSlide = ({ item }) => {
</Typography> </Typography>
<Stack <Stack
component={motion.div}
initial={{
transform:
animationDirection == "right"
? "translateX(20px)"
: "translateX(-20px)",
opacity: 0,
}}
animate={{
transform: "translateX(0px)",
opacity: 1,
}}
exit={{
transform:
animationDirection == "right"
? "translateX(-20px)"
: "translateX(20px)",
opacity: 0,
}}
transition={{
duration: 0.25,
ease: "easeInOut",
}}
mt={3} mt={3}
direction="row" direction="row"
gap={3} gap={3}
+6 -10
View File
@@ -42,17 +42,13 @@
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
opacity: 0.8; filter: brightness(0.5);
mask-image: linear-gradient(to bottom, black 40%, transparent), mask-image: linear-gradient(to bottom, black 40%, transparent);
linear-gradient(to left, black 40%, transparent);
-webkit-mask-image: linear-gradient( -webkit-mask-image: linear-gradient(
to bottom, to bottom,
black 40%, black 40%,
transparent transparent
), );
linear-gradient(to left, black 40%, transparent);
mask-composite: source-in;
-webkit-mask-composite: source-in;
} }
&-image { &-image {
position: absolute; position: absolute;
+3 -1
View File
@@ -213,8 +213,10 @@ const Home = () => {
<div <div
className="padded-container" className="padded-container"
style={{ style={{
padding: "1em", padding: "0 1.6em 1.6em",
scrollPadding: "4.4em",
}} }}
id="libraries"
> >
<ErrorBoundary <ErrorBoundary
fallback={ fallback={
+2 -1
View File
@@ -58,6 +58,7 @@ body {
left: 0; left: 0;
top: 0; top: 0;
z-index: -1; z-index: -1;
filter: brightness(0.4);
} }
} }
@@ -122,7 +123,7 @@ h1 {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
min-height: 100vh; min-height: 100vh;
padding: 0 1.2em; padding: 0 1.6em;
&.padded-top { &.padded-top {
padding-top: 4.4em; padding-top: 4.4em;
} }