Fix 0 is not a fn in titlePage
This commit is contained in:
5 files changed
+307
-261
No files matched your search
Generated
+12
@@ -27,6 +27,7 @@
|
||||
"react": "^18.2.0",
|
||||
"react-blurhash": "^0.3.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-error-boundary": "^4.0.10",
|
||||
"react-konami-code": "^2.3.0",
|
||||
"react-material-ui-carousel": "^3.4.2",
|
||||
"react-multi-carousel": "^2.8.3",
|
||||
@@ -2789,6 +2790,17 @@
|
||||
"react": "^18.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/react-error-boundary": {
|
||||
"version": "4.0.10",
|
||||
"resolved": "https://registry.npmjs.org/react-error-boundary/-/react-error-boundary-4.0.10.tgz",
|
||||
"integrity": "sha512-pvVKdi77j2OoPHo+p3rorgE43OjDWiqFkaqkJz8sJKK6uf/u8xtzuaVfj5qJ2JnDLIgF1De3zY5AJDijp+LVPA==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.13.1"
|
||||
}
|
||||
},
|
||||
"node_modules/react-fast-compare": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.2.tgz",
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
"react": "^18.2.0",
|
||||
"react-blurhash": "^0.3.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-error-boundary": "^4.0.10",
|
||||
"react-konami-code": "^2.3.0",
|
||||
"react-material-ui-carousel": "^3.4.2",
|
||||
"react-multi-carousel": "^2.8.3",
|
||||
|
||||
@@ -397,6 +397,7 @@ function App() {
|
||||
</Routes>
|
||||
</div>
|
||||
</AnimatePresence>
|
||||
<ReactQueryDevtools />
|
||||
</ThemeProvider>
|
||||
</SnackbarProvider>
|
||||
);
|
||||
|
||||
+259
-235
@@ -49,6 +49,8 @@ import { useNavigate } from "react-router-dom";
|
||||
import { endsAt, getRuntime } from "../../utils/date/time";
|
||||
import { BaseItemKind, ItemFields } from "@jellyfin/sdk/lib/generated-client";
|
||||
|
||||
import { ErrorBoundary } from "react-error-boundary";
|
||||
|
||||
const Home = () => {
|
||||
const authUser = useQuery({
|
||||
queryKey: ["home", "authenticateUser"],
|
||||
@@ -249,267 +251,289 @@ const Home = () => {
|
||||
latestMedia.data.length != 0 &&
|
||||
latestMedia.data.map((item, index) => {
|
||||
return (
|
||||
<Paper
|
||||
className="hero-carousel-slide"
|
||||
sx={{
|
||||
background:
|
||||
theme.palette.primary
|
||||
.background.dark,
|
||||
}}
|
||||
key={index}
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
<div>
|
||||
Something went wrong in
|
||||
carousel slide for
|
||||
{" --- "}
|
||||
{item.Name}
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div className="hero-carousel-background-container">
|
||||
{item.Type ==
|
||||
BaseItemKind.MusicAlbum ? (
|
||||
!!item.ParentBackdropItemId && (
|
||||
<>
|
||||
<Blurhash
|
||||
hash={
|
||||
item
|
||||
.ImageBlurHashes
|
||||
.Backdrop[
|
||||
<Paper
|
||||
className="hero-carousel-slide"
|
||||
sx={{
|
||||
background:
|
||||
theme.palette
|
||||
.primary
|
||||
.background
|
||||
.dark,
|
||||
}}
|
||||
key={index}
|
||||
>
|
||||
<div className="hero-carousel-background-container">
|
||||
{item.Type ==
|
||||
BaseItemKind.MusicAlbum ? (
|
||||
!!item.ParentBackdropItemId && (
|
||||
<>
|
||||
<Blurhash
|
||||
hash={
|
||||
item
|
||||
.ParentBackdropImageTags[0]
|
||||
]
|
||||
}
|
||||
// hash="LEHV6nWB2yk8pyo0adR*.7kCMdnj"
|
||||
width="1080"
|
||||
height="720"
|
||||
resolutionX={
|
||||
64
|
||||
}
|
||||
resolutionY={
|
||||
96
|
||||
}
|
||||
className="hero-carousel-background-blurhash"
|
||||
punch={1}
|
||||
/>
|
||||
.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[2]
|
||||
]
|
||||
}
|
||||
// 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)`,
|
||||
backgroundImage: `url(${
|
||||
window
|
||||
.api
|
||||
.basePath +
|
||||
"/Items/" +
|
||||
item.Id +
|
||||
"/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={{
|
||||
backgroundImage: `url(${
|
||||
) : (
|
||||
<div className="hero-carousel-background-image empty"></div>
|
||||
)}
|
||||
<div className="hero-carousel-background-icon-container">
|
||||
{
|
||||
MediaTypeIconCollection[
|
||||
item.Type
|
||||
]
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<Box className="hero-carousel-detail">
|
||||
<Typography
|
||||
variant="h3"
|
||||
className="hero-carousel-text"
|
||||
sx={{
|
||||
mb: 2.5,
|
||||
}}
|
||||
>
|
||||
{!item.ImageTags
|
||||
.Logo ? (
|
||||
item.Name
|
||||
) : (
|
||||
<img
|
||||
className="hero-carousel-text-logo"
|
||||
src={
|
||||
window
|
||||
.api
|
||||
.basePath +
|
||||
"/Items/" +
|
||||
item.Id +
|
||||
"/Images/Backdrop"
|
||||
})`,
|
||||
}}
|
||||
></div>
|
||||
</>
|
||||
) : (
|
||||
<div className="hero-carousel-background-image empty"></div>
|
||||
)}
|
||||
<div className="hero-carousel-background-icon-container">
|
||||
{
|
||||
MediaTypeIconCollection[
|
||||
item.Type
|
||||
]
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<Box className="hero-carousel-detail">
|
||||
<Typography
|
||||
variant="h3"
|
||||
className="hero-carousel-text"
|
||||
sx={{
|
||||
mb: 2.5,
|
||||
}}
|
||||
>
|
||||
{!item.ImageTags.Logo ? (
|
||||
item.Name
|
||||
) : (
|
||||
<img
|
||||
className="hero-carousel-text-logo"
|
||||
src={
|
||||
window.api
|
||||
.basePath +
|
||||
"/Items/" +
|
||||
item.Id +
|
||||
"/Images/Logo?quality=80&tag=" +
|
||||
item
|
||||
.ImageTags
|
||||
.Logo
|
||||
"/Images/Logo?quality=80&tag=" +
|
||||
item
|
||||
.ImageTags
|
||||
.Logo
|
||||
}
|
||||
></img>
|
||||
)}
|
||||
</Typography>
|
||||
<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
|
||||
variant="subtitle1"
|
||||
// color="GrayText"
|
||||
>
|
||||
{!!item.ProductionYear
|
||||
? item.ProductionYear
|
||||
: "Unknown"}
|
||||
</Typography>
|
||||
<Chip
|
||||
variant="outlined"
|
||||
label={
|
||||
!!item.OfficialRating
|
||||
? item.OfficialRating
|
||||
: "Not Rated"
|
||||
}
|
||||
></img>
|
||||
)}
|
||||
</Typography>
|
||||
<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"
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
gap: "0.25em",
|
||||
alignItems:
|
||||
"center",
|
||||
}}
|
||||
className="hero-carousel-info-rating"
|
||||
>
|
||||
{!!item.CommunityRating ? (
|
||||
<>
|
||||
<MdiStar
|
||||
sx={{
|
||||
color: yellow[700],
|
||||
}}
|
||||
/>
|
||||
<Typography variant="subtitle1">
|
||||
{Math.round(
|
||||
item.CommunityRating *
|
||||
10,
|
||||
) /
|
||||
10}
|
||||
</Typography>
|
||||
</>
|
||||
) : (
|
||||
<Typography variant="subtitle1">
|
||||
No
|
||||
Community
|
||||
Rating
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
{!!item.RunTimeTicks && (
|
||||
<Typography variant="subtitle1">
|
||||
{getRuntime(
|
||||
item.RunTimeTicks,
|
||||
)}
|
||||
</Typography>
|
||||
)}
|
||||
{!!item.RunTimeTicks && (
|
||||
<Typography variant="subtitle1">
|
||||
{endsAt(
|
||||
item.RunTimeTicks,
|
||||
)}
|
||||
</Typography>
|
||||
)}
|
||||
</Stack>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
// color="GrayText"
|
||||
className="hero-carousel-text"
|
||||
sx={{
|
||||
display: "-webkit-box",
|
||||
maxWidth:
|
||||
"70%",
|
||||
maxHeight:
|
||||
"30%",
|
||||
textOverflow:
|
||||
"ellipsis",
|
||||
overflow:
|
||||
"hidden",
|
||||
WebkitLineClamp:
|
||||
"3",
|
||||
WebkitBoxOrient:
|
||||
"vertical",
|
||||
opacity: 0.7,
|
||||
}}
|
||||
>
|
||||
{!!item.ProductionYear
|
||||
? item.ProductionYear
|
||||
: "Unknown"}
|
||||
{item.Overview}
|
||||
</Typography>
|
||||
<Chip
|
||||
variant="outlined"
|
||||
label={
|
||||
!!item.OfficialRating
|
||||
? item.OfficialRating
|
||||
: "Not Rated"
|
||||
}
|
||||
/>
|
||||
{/* TODO Link PLay and More info buttons in carousel */}
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
gap: "0.25em",
|
||||
alignItems:
|
||||
"center",
|
||||
gap: 3,
|
||||
mt: 3,
|
||||
}}
|
||||
className="hero-carousel-info-rating"
|
||||
className="hero-carousel-button-container"
|
||||
>
|
||||
{!!item.CommunityRating ? (
|
||||
<>
|
||||
<MdiStar
|
||||
sx={{
|
||||
color: yellow[700],
|
||||
}}
|
||||
/>
|
||||
<Typography variant="subtitle1">
|
||||
{Math.round(
|
||||
item.CommunityRating *
|
||||
10,
|
||||
) /
|
||||
10}
|
||||
</Typography>
|
||||
</>
|
||||
) : (
|
||||
<Typography variant="subtitle1">
|
||||
No
|
||||
Community
|
||||
Rating
|
||||
</Typography>
|
||||
)}
|
||||
<Button
|
||||
variant="contained"
|
||||
endIcon={
|
||||
<MdiPlayOutline />
|
||||
}
|
||||
disabled
|
||||
>
|
||||
Play
|
||||
</Button>
|
||||
<Button
|
||||
color="white"
|
||||
variant="outlined"
|
||||
endIcon={
|
||||
<MdiChevronRight />
|
||||
}
|
||||
onClick={() =>
|
||||
navigate(
|
||||
`/item/${item.Id}`,
|
||||
)
|
||||
}
|
||||
>
|
||||
More info
|
||||
</Button>
|
||||
</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"
|
||||
sx={{
|
||||
display: "-webkit-box",
|
||||
maxWidth: "70%",
|
||||
maxHeight: "30%",
|
||||
textOverflow:
|
||||
"ellipsis",
|
||||
overflow: "hidden",
|
||||
WebkitLineClamp:
|
||||
"3",
|
||||
WebkitBoxOrient:
|
||||
"vertical",
|
||||
opacity: 0.7,
|
||||
}}
|
||||
>
|
||||
{item.Overview}
|
||||
</Typography>
|
||||
{/* TODO Link PLay and More info buttons in carousel */}
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
gap: 3,
|
||||
mt: 3,
|
||||
}}
|
||||
className="hero-carousel-button-container"
|
||||
>
|
||||
<Button
|
||||
variant="contained"
|
||||
endIcon={
|
||||
<MdiPlayOutline />
|
||||
}
|
||||
disabled
|
||||
>
|
||||
Play
|
||||
</Button>
|
||||
<Button
|
||||
color="white"
|
||||
variant="outlined"
|
||||
endIcon={
|
||||
<MdiChevronRight />
|
||||
}
|
||||
onClick={() =>
|
||||
navigate(
|
||||
`/item/${item.Id}`,
|
||||
)
|
||||
}
|
||||
>
|
||||
More info
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
</Paper>
|
||||
</Paper>
|
||||
</ErrorBoundary>
|
||||
);
|
||||
})
|
||||
)}
|
||||
|
||||
+34
-26
@@ -767,32 +767,40 @@ const ItemDetail = () => {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{!!item.data.ImageBlurHashes
|
||||
.Primary && (
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data.ImageBlurHashes
|
||||
.Primary[
|
||||
item.data.ImageTags
|
||||
.Primary
|
||||
]
|
||||
}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={12}
|
||||
resolutionY={8}
|
||||
style={{
|
||||
aspectRatio: `${
|
||||
!!item.data
|
||||
.PrimaryImageAspectRatio
|
||||
? item.data
|
||||
.PrimaryImageAspectRatio
|
||||
: 1
|
||||
}`,
|
||||
}}
|
||||
className="item-detail-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
{!!item.data.ImageTags.Primary &&
|
||||
Object.keys(
|
||||
item.data.ImageBlurHashes
|
||||
.Primary,
|
||||
).length != 0 && (
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data
|
||||
.ImageBlurHashes
|
||||
.Primary[
|
||||
Object.keys(
|
||||
item.data
|
||||
.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
]
|
||||
}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={12}
|
||||
resolutionY={8}
|
||||
style={{
|
||||
aspectRatio: `${
|
||||
!!item.data
|
||||
.PrimaryImageAspectRatio
|
||||
? item
|
||||
.data
|
||||
.PrimaryImageAspectRatio
|
||||
: 1
|
||||
}`,
|
||||
}}
|
||||
className="item-detail-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
<div className="item-detail-image-icon-container">
|
||||
{
|
||||
TypeIconCollectionCard[
|
||||
|
||||
Reference in new issue
Block a user