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