34 files changed
+2910
-300
No files matched your search
@@ -15,16 +15,16 @@ import { CarouselSkeleton } from "@/components/skeleton/carousel";
|
||||
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
|
||||
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
|
||||
import { setBackdrop } from "@/utils/store/backdrop";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import {
|
||||
type BaseItemDto,
|
||||
BaseItemKind,
|
||||
@@ -32,7 +32,6 @@ import {
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { ErrorBoundary } from "react-error-boundary";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
|
||||
export const Route = createFileRoute("/_api/home/")({
|
||||
component: Home,
|
||||
@@ -67,6 +66,11 @@ function Home() {
|
||||
ItemFields.MediaStreams,
|
||||
ItemFields.MediaSources,
|
||||
],
|
||||
includeItemTypes: [
|
||||
BaseItemKind.Movie,
|
||||
BaseItemKind.Series,
|
||||
BaseItemKind.MusicAlbum,
|
||||
],
|
||||
enableUserData: true,
|
||||
enableImages: true,
|
||||
});
|
||||
@@ -131,6 +135,8 @@ function Home() {
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||
|
||||
const [excludeTypes] = useState(
|
||||
() => new Set(["boxsets", "playlists", "livetv", "channels"]),
|
||||
);
|
||||
@@ -139,7 +145,7 @@ function Home() {
|
||||
if (libraries.isSuccess) {
|
||||
const latestMediaLibsTemp = libraries.data.Items?.reduce(
|
||||
(filteredItems: BaseItemDto[], currentItem) => {
|
||||
if (!excludeTypes.has(currentItem.Type)) {
|
||||
if (currentItem.Type && !excludeTypes.has(currentItem.Type)) {
|
||||
filteredItems.push(currentItem);
|
||||
}
|
||||
return filteredItems;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
.photos {
|
||||
background: black;
|
||||
overflow: hidden;
|
||||
height: 100vh;
|
||||
&-currentPhoto {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
object-fit: contain;
|
||||
}
|
||||
&-overlay{
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
}
|
||||
&-preview {
|
||||
// width: 10vw;
|
||||
height: 10vh;
|
||||
object-fit: cover;
|
||||
border: 2px;
|
||||
border: 2px solid transparent;
|
||||
border-radius: 4px;
|
||||
transition: border $transition-time-default;
|
||||
&-container {
|
||||
width: 90vw;
|
||||
overflow-y: hidden;
|
||||
overflow-x: auto;
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
margin: 0 auto;
|
||||
bottom: 0;
|
||||
left: 5vw;
|
||||
}
|
||||
&.active {
|
||||
border-color: $clr-accent-default;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { usePhotosPlayback } from "@/utils/store/photosPlayback";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
||||
|
||||
import { AnimatePresence, motion } from "framer-motion";
|
||||
import brokenImage from "../../../../public/assetsStatic/broken-image.png";
|
||||
|
||||
import "./photos.scss";
|
||||
import { Button } from "@mui/material";
|
||||
|
||||
export const Route = createFileRoute("/_api/player/photos")({
|
||||
component: PhotosPlayer,
|
||||
});
|
||||
|
||||
function PhotosPlayer() {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const [photos, startIndex] = usePhotosPlayback((s) => [s.photos, s.index]);
|
||||
const [currentIndex, setCurrentIndex] = useState(startIndex);
|
||||
const currentPhoto = useMemo(
|
||||
() => photos?.[currentIndex],
|
||||
[photos, currentIndex],
|
||||
);
|
||||
const allPhotos = useMemo(
|
||||
() =>
|
||||
photos?.map((item, index) => (
|
||||
<div
|
||||
onClick={() => setCurrentIndex(index)}
|
||||
key={item?.Id ?? "noPhoto"}
|
||||
className={
|
||||
index === currentIndex ? "photos-preview active" : "photos-preview"
|
||||
}
|
||||
>
|
||||
<img
|
||||
src={
|
||||
item.Id
|
||||
? api.getItemImageUrl(item.Id, "Primary", {
|
||||
// width: 250,
|
||||
fillWidth: 250,
|
||||
quality: 70,
|
||||
})
|
||||
: brokenImage
|
||||
}
|
||||
style={{
|
||||
width: "auto",
|
||||
height: "100%",
|
||||
borderRadius: "2px",
|
||||
}}
|
||||
alt="Item"
|
||||
/>
|
||||
</div>
|
||||
)),
|
||||
[photos, currentIndex],
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="photos">
|
||||
<AnimatePresence mode="wait">
|
||||
<motion.img
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
key={currentPhoto?.Id ?? "noPhoto"}
|
||||
src={
|
||||
currentPhoto
|
||||
? `${api.basePath}/Items/${currentPhoto.Id}/Download?api_key=${api.accessToken}`
|
||||
: brokenImage
|
||||
}
|
||||
alt="Item"
|
||||
transition={{ duration: 0.1 }}
|
||||
className="photos-currentPhoto"
|
||||
/>
|
||||
</AnimatePresence>
|
||||
<motion.div
|
||||
className="photos-overlay"
|
||||
whileHover={{ opacity: 1, transform: "translateY(0)" }}
|
||||
style={{ opacity: 0.5, transform: "translateY(80%)" }}
|
||||
>
|
||||
<div className="photos-preview-container">{allPhotos}</div>
|
||||
</motion.div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -21,12 +21,15 @@ import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getPersonsApi } from "@jellyfin/sdk/lib/utils/api/persons-api";
|
||||
import { getSearchApi } from "@jellyfin/sdk/lib/utils/api/search-api";
|
||||
import "./search.scss";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { Dialog, Fab } from "@mui/material";
|
||||
import { Outlet, createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
|
||||
export const Route = createFileRoute("/_api/search/")({
|
||||
component: SearchPage,
|
||||
validateSearch: (search: Record<string, unknown>): { query: string } => {
|
||||
return { query: search.query as string };
|
||||
},
|
||||
});
|
||||
|
||||
function SearchPage() {
|
||||
Reference in new issue
Block a user