refactor: move to tanstack router
This commit is contained in:
1 parent
a4ea932153
commit
522621ed69
136 files changed
+7063
-6127
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import type React from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
import { relaunch } from "@tauri-apps/api/process";
|
||||
|
||||
@@ -19,28 +20,31 @@ import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||
import { red } from "@mui/material/colors";
|
||||
|
||||
import {
|
||||
NavLink as NavLinkBase,
|
||||
Link as RouterLink,
|
||||
type LinkProps as RouterLinkProps,
|
||||
Link,
|
||||
useLocation,
|
||||
useNavigate,
|
||||
} from "react-router-dom";
|
||||
useRouteContext,
|
||||
} from "@tanstack/react-router";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { delServer } from "../../utils/storage/servers";
|
||||
import { delUser } from "../../utils/storage/user";
|
||||
import { useDrawerStore } from "../../utils/store/drawer";
|
||||
import { delServer } from "@/utils/storage/servers";
|
||||
import { delUser } from "@/utils/storage/user";
|
||||
import { useDrawerStore } from "@/utils/store/drawer";
|
||||
import "./appBar.scss";
|
||||
|
||||
import { EventEmitter as event } from "../../eventEmitter";
|
||||
import { useApi } from "../../utils/store/api";
|
||||
import { EventEmitter as event } from "@/eventEmitter";
|
||||
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import useSettingsStore, {
|
||||
setSettingsDialogOpen,
|
||||
setSettingsTabValue,
|
||||
} from "@/utils/store/settings";
|
||||
import {
|
||||
Divider,
|
||||
Drawer,
|
||||
@@ -49,11 +53,6 @@ import {
|
||||
ListItemButton,
|
||||
ListItemText,
|
||||
} from "@mui/material";
|
||||
import logo from "../../assets/icon.svg";
|
||||
import useSettingsStore, {
|
||||
setSettingsDialogOpen,
|
||||
setSettingsTabValue,
|
||||
} from "../../utils/store/settings";
|
||||
|
||||
interface ListItemLinkProps {
|
||||
icon?: React.ReactElement;
|
||||
@@ -61,24 +60,13 @@ interface ListItemLinkProps {
|
||||
to: string;
|
||||
}
|
||||
|
||||
const NavLink = React.forwardRef((props, ref) => (
|
||||
<NavLinkBase
|
||||
ref={ref}
|
||||
{...props}
|
||||
style={{ textDecoration: "none" }}
|
||||
className={({ isActive }) =>
|
||||
`${props.className} ${isActive ? props.activeClassName : ""}`
|
||||
}
|
||||
/>
|
||||
));
|
||||
|
||||
function ListItemLink(props: ListItemLinkProps) {
|
||||
const { icon, primary, to } = props;
|
||||
|
||||
return (
|
||||
<li>
|
||||
<ListItem
|
||||
component={NavLink}
|
||||
component={Link}
|
||||
activeClassName="active"
|
||||
className="library-drawer-item"
|
||||
to={to}
|
||||
@@ -100,7 +88,7 @@ function ListItemLink(props: ListItemLinkProps) {
|
||||
}
|
||||
|
||||
export const AppBar = () => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [display, setDisplay] = useState(false);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import AppBar from "@mui/material/AppBar";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Toolbar from "@mui/material/Toolbar";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useRouter } from "@tanstack/react-router";
|
||||
|
||||
export const AppBarBackOnly = () => {
|
||||
const navigate = useNavigate();
|
||||
const { history } = useRouter();
|
||||
|
||||
const handleBack = () => {
|
||||
navigate(-1);
|
||||
history.go(-1);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -4,11 +4,10 @@ import React from "react";
|
||||
import Box from "@mui/material/Box";
|
||||
|
||||
import "./avatar.module.scss";
|
||||
|
||||
import { useApi } from "../../utils/store/api";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
|
||||
export const AvatarImage = ({ userId }) => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/_api" }).api;
|
||||
return (
|
||||
<Box className="avatar-image-container">
|
||||
<div
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { IconButton } from "@mui/material";
|
||||
import { useRouter } from "@tanstack/react-router";
|
||||
import React from "react";
|
||||
|
||||
export default function BackButton() {
|
||||
const { history } = useRouter();
|
||||
const handleClick = () => {
|
||||
history.back();
|
||||
};
|
||||
|
||||
return (
|
||||
<IconButton onClick={handleClick}>
|
||||
<span className="material-symbols-rounded">arrow_back</span>
|
||||
</IconButton>
|
||||
);
|
||||
}
|
||||
@@ -8,12 +8,11 @@ import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api"
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import { pink } from "@mui/material/colors";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
import { useSnackbar } from "notistack";
|
||||
|
||||
import { useApi } from "../../utils/store/api";
|
||||
|
||||
const LikeButton = ({ itemId, isFavorite, queryKey, userId, itemName }) => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
const queryClient = useQueryClient();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ import { green } from "@mui/material/colors";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
import { useSnackbar } from "notistack";
|
||||
import { useApi } from "../../utils/store/api";
|
||||
|
||||
const MarkPlayedButton = ({ itemId, isPlayed, queryKey, userId, itemName }) => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
|
||||
const queryClient = useQueryClient();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
@@ -9,6 +9,7 @@ import Fab from "@mui/material/Fab";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
import { playAudio } from "@/utils/store/audioPlayback";
|
||||
import {
|
||||
type BaseItemDto,
|
||||
type BaseItemDtoQueryResult,
|
||||
@@ -23,26 +24,19 @@ import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getPlaylistsApi } from "@jellyfin/sdk/lib/utils/api/playlists-api";
|
||||
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
||||
import { useSnackbar } from "notistack";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useApi } from "../../utils/store/api";
|
||||
import { useAudioPlayback } from "../../utils/store/audioPlayback";
|
||||
|
||||
import useQueue, { setQueue } from "../../utils/store/queue";
|
||||
import useQueue, { setQueue } from "@/utils/store/queue";
|
||||
|
||||
import {
|
||||
playItem,
|
||||
setItem,
|
||||
usePlaybackDataLoadStore,
|
||||
usePlaybackStore,
|
||||
} from "../../utils/store/playback";
|
||||
import { playItem, usePlaybackDataLoadStore } from "@/utils/store/playback";
|
||||
|
||||
import type PlayResult from "@//utils/types/playResult";
|
||||
import { getRuntimeCompact } from "@/utils/date/time";
|
||||
import playbackProfile from "@/utils/playback-profiles";
|
||||
import { getMediaInfoApi } from "@jellyfin/sdk/lib/utils/api/media-info-api";
|
||||
import type { SxProps } from "@mui/material";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import type PlayResult from "src/utils/types/playResult";
|
||||
import { getRuntimeCompact } from "../../utils/date/time";
|
||||
import playbackProfile from "../../utils/playback-profiles";
|
||||
|
||||
type PlayButtonProps = {
|
||||
item: BaseItemDto;
|
||||
@@ -83,53 +77,9 @@ const PlayButton = ({
|
||||
playlistItemId = "",
|
||||
trackIndex,
|
||||
}: PlayButtonProps) => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
|
||||
const navigate = useNavigate();
|
||||
// const [
|
||||
// setUrl,
|
||||
// setPosition,
|
||||
// setDuration,
|
||||
// setItemId,
|
||||
// setItemName,
|
||||
// setAudioStreamIndex,
|
||||
// setVideoStreamIndex,
|
||||
// setSubtitleStreamIndex,
|
||||
// setMediaSourceId,
|
||||
// setUserId,
|
||||
// setMediaContainer,
|
||||
// setSeriesId,
|
||||
// setEpisodeIndex,
|
||||
// ] = usePlaybackStore((state) => [
|
||||
// state.setUrl,
|
||||
// state.setPosition,
|
||||
// state.setDuration,
|
||||
// state.setItemId,
|
||||
// state.setItemName,
|
||||
// state.setAudioStreamIndex,
|
||||
// state.setVideoStreamIndex,
|
||||
// state.setSubtitleStreamIndex,
|
||||
// state.setMediaSourceId,
|
||||
// state.setUserId,
|
||||
// state.setMediaContainer,
|
||||
// state.setSeriesId,
|
||||
// state.setEpisodeIndex,
|
||||
// ]);
|
||||
const [
|
||||
setAudioUrl,
|
||||
setAudioDisplay,
|
||||
setAudioItem,
|
||||
setAudioTracks,
|
||||
setCurrentTrack,
|
||||
setPlaylistItemId,
|
||||
] = useAudioPlayback((state) => [
|
||||
state.setUrl,
|
||||
state.setDisplay,
|
||||
state.setItem,
|
||||
state.setTracks,
|
||||
state.setCurrentTrack,
|
||||
state.setPlaylistItemId,
|
||||
]);
|
||||
const setPlaybackDataLoading = usePlaybackDataLoadStore(
|
||||
(state) => state.setisPending,
|
||||
);
|
||||
@@ -255,24 +205,20 @@ const PlayButton = ({
|
||||
},
|
||||
onSuccess: (result: PlayResult | null) => {
|
||||
if (trackIndex) {
|
||||
setPlaylistItemId(playlistItemId);
|
||||
// setCurrentTrack(trackIndex);
|
||||
// setAudioTracks(result.Items);
|
||||
setAudioUrl(
|
||||
`${api.basePath}/Audio/${result.Items[trackIndex].Id}/universal?deviceId=${api.deviceInfo.id}&userId=${userId}&api_key=${api.accessToken}`,
|
||||
);
|
||||
setAudioItem(result.Items[trackIndex]);
|
||||
setAudioDisplay(true);
|
||||
|
||||
setQueue(result.Items, trackIndex);
|
||||
// Playlist Playback
|
||||
enqueueSnackbar("Playlist playback is WIP", { variant: "info" });
|
||||
} else if (audio) {
|
||||
setAudioItem(result.Items[0]);
|
||||
setAudioTracks(result.Items);
|
||||
setAudioUrl(
|
||||
`${api.basePath}/Audio/${result.Items[0].Id}/universal?deviceId=${api.deviceInfo.id}&userId=${userId}&api_key=${api.accessToken}`,
|
||||
);
|
||||
setAudioDisplay(true);
|
||||
setQueue(result.Items, 0);
|
||||
// Album/Individual audio track playback
|
||||
const urlOptions = {
|
||||
deviceId: api?.deviceInfo.id,
|
||||
userId,
|
||||
api_key: api?.accessToken,
|
||||
};
|
||||
const urlParams = new URLSearchParams(urlOptions).toString();
|
||||
|
||||
const playbackUrl = `${api.basePath}/Audio/${result?.item.Items[0].Id}/universal?${urlParams}`;
|
||||
playAudio(playbackUrl, result?.item.Items[0], undefined);
|
||||
setQueue(result?.item.Items ?? [], 0);
|
||||
} else {
|
||||
// Creates a queue containing all Episodes for a particular season(series) or collection of movies
|
||||
const queue = result?.item.Items;
|
||||
@@ -342,7 +288,7 @@ const PlayButton = ({
|
||||
result?.mediaSource.MediaSources[0].Id,
|
||||
result?.mediaSource.PlaySessionId,
|
||||
);
|
||||
navigate("/player");
|
||||
navigate({ to: "/player" });
|
||||
}
|
||||
},
|
||||
onSettled: () => {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { playItemFromQueue } from "@/utils/store/playback";
|
||||
import useQueue from "@/utils/store/queue";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { IconButton } from "@mui/material";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
import React from "react";
|
||||
import { useApi } from "src/utils/store/api";
|
||||
import { playItemFromQueue } from "src/utils/store/playback";
|
||||
import useQueue from "src/utils/store/queue";
|
||||
|
||||
const PlayNextButton = () => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { playItemFromQueue } from "@/utils/store/playback";
|
||||
import useQueue from "@/utils/store/queue";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { IconButton } from "@mui/material";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
import React from "react";
|
||||
import { useApi } from "src/utils/store/api";
|
||||
import { playItemFromQueue } from "src/utils/store/playback";
|
||||
import useQueue from "src/utils/store/queue";
|
||||
|
||||
const PlayPreviousButton = () => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
|
||||
@@ -7,25 +7,37 @@ $image-size: 5em;
|
||||
display: grid !important;
|
||||
opacity: 1 !important;
|
||||
gap: 1em;
|
||||
height: 5em;
|
||||
grid-template-columns: 3em $image-size 1fr;
|
||||
justify-items: center;
|
||||
align-items: center;
|
||||
&-image{
|
||||
max-height: $image-size;
|
||||
max-width: $image-size;
|
||||
max-height: 100%;
|
||||
max-width: 100%;
|
||||
object-fit: cover;
|
||||
border-radius: $border-radius_04;
|
||||
overflow: hidden;
|
||||
&-container {
|
||||
aspect-ratio: 1;
|
||||
overflow: hidden;
|
||||
width: $image-size;
|
||||
height: $image-size;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
}
|
||||
&-icon {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: rgb(255 255 255 / 0.2);
|
||||
border-radius: 10px;
|
||||
.material-symbols-rounded {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
&-info{
|
||||
display: flex;
|
||||
@@ -35,7 +47,7 @@ $image-size: 5em;
|
||||
}
|
||||
}
|
||||
&-item.Mui-disabled {
|
||||
.queue-item-image{
|
||||
.queue-item-image,.queue-item-image-icon{
|
||||
opacity: 0.5 !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { playItemFromQueue } from "@/utils/store/playback";
|
||||
import useQueue from "@/utils/store/queue";
|
||||
import {
|
||||
IconButton,
|
||||
Menu,
|
||||
@@ -5,18 +7,15 @@ import {
|
||||
MenuList,
|
||||
Typography,
|
||||
} from "@mui/material";
|
||||
import React, { useRef, useState } from "react";
|
||||
import { useApi } from "src/utils/store/api";
|
||||
import { playItemFromQueue } from "src/utils/store/playback";
|
||||
import useQueue from "src/utils/store/queue";
|
||||
import React, { useState } from "react";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { useVirtualizer } from "@tanstack/react-virtual";
|
||||
import "./queueButton.scss";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
const QueueButton = () => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
const [queueItems, currentItemIndex] = useQueue((state) => [
|
||||
state.tracks,
|
||||
state.currentItemIndex,
|
||||
@@ -45,14 +44,6 @@ const QueueButton = () => {
|
||||
},
|
||||
});
|
||||
|
||||
const menuRef = useRef(null);
|
||||
const virtualizer = useVirtualizer({
|
||||
count: queueItems.length,
|
||||
estimateSize: () => 86,
|
||||
getScrollElement: () => menuRef.current,
|
||||
overscan: 3,
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<Menu
|
||||
@@ -69,7 +60,6 @@ const QueueButton = () => {
|
||||
}}
|
||||
slotProps={{
|
||||
paper: {
|
||||
ref: menuRef,
|
||||
style: {
|
||||
maxHeight: "30em",
|
||||
overflowX: "hidden",
|
||||
@@ -80,32 +70,25 @@ const QueueButton = () => {
|
||||
>
|
||||
<MenuList
|
||||
style={{
|
||||
height: `${virtualizer.getTotalSize()}px`,
|
||||
height: "fit-content",
|
||||
width: " 32em",
|
||||
position: "relative",
|
||||
}}
|
||||
>
|
||||
{virtualizer.getVirtualItems().map((virtualItem) => {
|
||||
const index = virtualItem.index;
|
||||
const item = queueItems[index];
|
||||
{queueItems.map((item, index) => {
|
||||
return (
|
||||
<MenuItem
|
||||
className="queue-item"
|
||||
disabled={index === currentItemIndex}
|
||||
onClick={() => handlePlay.mutate({ index })}
|
||||
key={virtualItem.key}
|
||||
style={{
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
height: `${virtualItem.size}px`,
|
||||
transform: `translateY(${virtualItem.start}px)`,
|
||||
}}
|
||||
key={item.Id}
|
||||
>
|
||||
<Typography variant="subtitle2">
|
||||
{item.IndexNumberEnd
|
||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} / ${item.IndexNumberEnd}`
|
||||
: `S${item.ParentIndexNumber}:E${item.IndexNumber}`}
|
||||
{item.Type === "Audio"
|
||||
? item.IndexNumber ?? 0
|
||||
: item.IndexNumberEnd
|
||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} / ${item.IndexNumberEnd}`
|
||||
: `S${item.ParentIndexNumber}:E${item.IndexNumber}`}
|
||||
</Typography>
|
||||
<div className="queue-item-image-container">
|
||||
{item.ImageTags?.Primary ? (
|
||||
@@ -116,6 +99,14 @@ const QueueButton = () => {
|
||||
})}
|
||||
alt={item.Name}
|
||||
/>
|
||||
) : item.AlbumPrimaryImageTag?.length > 0 ? (
|
||||
<img
|
||||
className="queue-item-image"
|
||||
src={api?.getItemImageUrl(item?.AlbumId, "Primary", {
|
||||
tag: item.AlbumPrimaryImageTag[0],
|
||||
})}
|
||||
alt={item.Name}
|
||||
/>
|
||||
) : (
|
||||
<div className="queue-item-image-icon">
|
||||
{getTypeIcon(item.Type)}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MediaUrl } from "@jellyfin/sdk/lib/generated-client";
|
||||
import type { MediaUrl } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { Dialog, IconButton } from "@mui/material";
|
||||
import React, { useState } from "react";
|
||||
import ReactPlayer from "react-player";
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import React from "react";
|
||||
import { Component, useState } from "react";
|
||||
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
||||
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import Typography from "@mui/material/Typography";
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
type BaseItemDto,
|
||||
BaseItemKind,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { useApi } from "../../utils/store/api";
|
||||
import LikeButton from "../buttons/likeButton";
|
||||
import MarkPlayedButton from "../buttons/markPlayedButton";
|
||||
import PlayButton from "../buttons/playButton";
|
||||
@@ -57,21 +56,21 @@ export const Card = ({
|
||||
userId: string;
|
||||
seriesId: string | null;
|
||||
hideText: boolean;
|
||||
onClick: Function | null;
|
||||
onClick: () => null | null;
|
||||
disableOverlay: boolean;
|
||||
overrideIcon: any;
|
||||
}) => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
const navigate = useNavigate();
|
||||
const defaultOnClick = () => {
|
||||
if (availableSpecialRoutes.includes(item.Type)) {
|
||||
navigate(`/${item.Type.toLocaleLowerCase()}/${item.Id}`);
|
||||
navigate({ to: `/${item.Type.toLocaleLowerCase()}/${item.Id}` });
|
||||
} else if (!!item.Role || item.Type === BaseItemKind.Person) {
|
||||
navigate(`/person/${item.Id}`);
|
||||
navigate({ to: `/person/${item.Id}` });
|
||||
} else if (item.Type === BaseItemKind.MusicArtist) {
|
||||
navigate(`/artist/${item.Id}`);
|
||||
navigate({ to: `/artist/${item.Id}` });
|
||||
} else {
|
||||
navigate(`/item/${item.Id}`);
|
||||
navigate({ to: `/item/${item.Id}` });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import React from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
import MuiCard from "@mui/material/Card";
|
||||
import CardActionArea from "@mui/material/CardActionArea";
|
||||
@@ -10,8 +9,8 @@ import { Blurhash } from "react-blurhash";
|
||||
|
||||
import "./card.scss";
|
||||
|
||||
import { getRuntimeCompact } from "../../utils/date/time";
|
||||
import { useApi } from "../../utils/store/api";
|
||||
import { getRuntimeCompact } from "@/utils/date/time";
|
||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
||||
import LikeButton from "../buttons/likeButton";
|
||||
import MarkPlayedButton from "../buttons/markPlayedButton";
|
||||
import PlayButton from "../buttons/playButton";
|
||||
@@ -44,10 +43,10 @@ export const EpisodeCard = ({
|
||||
disableRunTime = false,
|
||||
onClick,
|
||||
}) => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
const navigate = useNavigate();
|
||||
const defaultOnClick = () => {
|
||||
navigate(`/episode/${item.Id}`);
|
||||
navigate({ to: `/episode/${item.Id}` });
|
||||
};
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -11,16 +11,15 @@ import Typography from "@mui/material/Typography";
|
||||
|
||||
import { yellow } from "@mui/material/colors";
|
||||
|
||||
import { endsAt, getRuntime } from "@/utils/date/time";
|
||||
import { green, red } from "@mui/material/colors";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { endsAt, getRuntime } from "../../utils/date/time";
|
||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
|
||||
import { useCarouselStore } from "@/utils/store/carousel";
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { useApi } from "../../utils/store/api";
|
||||
import { useCarouselStore } from "../../utils/store/carousel";
|
||||
import LikeButton from "../buttons/likeButton";
|
||||
import MarkPlayedButton from "../buttons/markPlayedButton";
|
||||
import PlayButton from "../buttons/playButton";
|
||||
@@ -42,7 +41,7 @@ const availableSpecialRoutes = [
|
||||
* @returns {React.Component}
|
||||
*/
|
||||
const CarouselSlide = ({ item }) => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
const navigate = useNavigate();
|
||||
|
||||
const user = useQuery({
|
||||
@@ -56,15 +55,18 @@ const CarouselSlide = ({ item }) => {
|
||||
|
||||
const handleMoreInfo = () => {
|
||||
if (availableSpecialRoutes.includes(item.Type)) {
|
||||
navigate(`/${item.Type.toLocaleLowerCase()}/${item.Id}`);
|
||||
navigate({
|
||||
to: `/${item.Type.toLocaleLowerCase()}/$id`,
|
||||
params: { id: item.Id },
|
||||
});
|
||||
} else if (!!item.Role || item.Type === BaseItemKind.Person) {
|
||||
navigate(`/person/${item.Id}`);
|
||||
navigate({ to: "/person/$id", params: { id: item.Id } });
|
||||
} else if (item.Type === BaseItemKind.MusicArtist) {
|
||||
navigate(`/artist/${item.Id}`);
|
||||
navigate({ to: "/artist/$id", params: { id: item.Id } });
|
||||
} else if (item.Type === BaseItemKind.Episode) {
|
||||
navigate(`/episode/${item.Id}`);
|
||||
navigate({ to: "/episode/$id", params: { id: item.Id } });
|
||||
} else {
|
||||
navigate(`/item/${item.Id}`);
|
||||
navigate({ to: "/item/$id", params: { id: item.Id } });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,24 +5,22 @@ import Paper from "@mui/material/Paper";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { getRuntimeMusic } from "../../../utils/date/time";
|
||||
|
||||
import { SortOrder } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { useApi } from "../../../utils/store/api";
|
||||
import { useAudioPlayback } from "../../../utils/store/audioPlayback";
|
||||
import LikeButton from "../../buttons/likeButton";
|
||||
import PlayButton from "../../buttons/playButton";
|
||||
|
||||
import TrackList from "../tracksList/index";
|
||||
import "./albumArtist.scss";
|
||||
import { Link, useRouteContext } from "@tanstack/react-router";
|
||||
|
||||
export const ArtistAlbum = ({ user, album, boxProps }) => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
const albumTracks = useQuery({
|
||||
queryKey: ["artist", "album", album.Id],
|
||||
queryFn: async () => {
|
||||
@@ -117,7 +115,7 @@ export const ArtistAlbum = ({ user, album, boxProps }) => {
|
||||
</Typography>
|
||||
<MuiLink
|
||||
component={Link}
|
||||
to={`/musicalbum/${album.Id}`}
|
||||
to="/album/$Id"
|
||||
variant="h2"
|
||||
color="inherit"
|
||||
underline="hover"
|
||||
|
||||
@@ -7,13 +7,13 @@ import { CardsSkeleton } from "../../skeleton/cards";
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { useApi } from "../../../utils/store/api";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
|
||||
/**
|
||||
* @description Latest Media Section
|
||||
*/
|
||||
export const LatestMediaSection = ({ latestMediaLib }) => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
|
||||
@@ -1,824 +0,0 @@
|
||||
import Chip from "@mui/material/Chip";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
// import { BaseItemDto } from "";
|
||||
// import { BaseItemPerson } from "@jellyfin/sdk/lib/generated-client/models/base-item-person";
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client/models/base-item-kind";
|
||||
import { MediaStreamType } from "@jellyfin/sdk/lib/generated-client/models/media-stream-type";
|
||||
|
||||
import { red, yellow } from "@mui/material/colors";
|
||||
import { endsAt, getRuntime, getRuntimeFull } from "../../../utils/date/time";
|
||||
import LikeButton from "../../buttons/likeButton";
|
||||
import MarkPlayedButton from "../../buttons/markPlayedButton";
|
||||
import PlayButton from "../../buttons/playButton";
|
||||
import { Card } from "../../card/card";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import TextLink from "../../textLink";
|
||||
import "./hero.scss";
|
||||
|
||||
import { ErrorBoundary } from "react-error-boundary";
|
||||
import { useApi } from "../../../utils/store/api";
|
||||
/**
|
||||
* @typedef {Object} Props
|
||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemDto} item
|
||||
* @property {Array} queryKey
|
||||
* @property {string} userId
|
||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemPerson[]} writers
|
||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemPerson[]} directors
|
||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemPerson[]} artists
|
||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").NameGuidPair[]} studios
|
||||
* @property {bool} disableInfoStrip
|
||||
* @property {bool} disablePlayButton
|
||||
* @property {bool} disableLikeButton
|
||||
* @property {bool} disableMarkAsPlayedButton
|
||||
* @property {string} albumBy
|
||||
* @property {bool} audioPlayButton
|
||||
* @property {bool} favourParentImg
|
||||
* @property {"portrait"| "thumb"| 'square'} cardType
|
||||
* @property {bool} enableVideoInfoStrip
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description Hero section for item pages
|
||||
* @param {Props}
|
||||
* @returns {React.Component}
|
||||
*/
|
||||
const Hero = ({
|
||||
item,
|
||||
queryKey,
|
||||
userId,
|
||||
writers = [],
|
||||
directors = [],
|
||||
artists = [],
|
||||
studios = [],
|
||||
disableInfoStrip,
|
||||
disablePlayButton,
|
||||
disableLikeButton,
|
||||
disableMarkAsPlayedButton,
|
||||
albumBy,
|
||||
audioPlayButton = false,
|
||||
favourParentImg = true,
|
||||
isEpisode = false,
|
||||
cardType = "portrait",
|
||||
enableVideoInfoStrip = false,
|
||||
}) => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
|
||||
const filterMediaStreamVideo = (source) => {
|
||||
if (source.Type === MediaStreamType.Video) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const filterMediaStreamAudio = (source) => {
|
||||
if (source.Type === MediaStreamType.Audio) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const filterMediaStreamSubtitle = (source) => {
|
||||
if (source.Type === MediaStreamType.Subtitle) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const videoTracks = item.MediaStreams?.filter(filterMediaStreamVideo);
|
||||
const audioTracks = item.MediaStreams?.filter(filterMediaStreamAudio);
|
||||
const subtitleTracks = item.MediaStreams?.filter(filterMediaStreamSubtitle);
|
||||
|
||||
const [currentVideoIndex, setCurrentVideoIndex] = useState(0);
|
||||
const [currentAudioIndex, setCurrentAudioIndex] = useState(0);
|
||||
const [currentSubtitleIndex, setCurrentSubtitleIndex] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
if (!!videoTracks && !!audioTracks & !!subtitleTracks) {
|
||||
setCurrentVideoIndex(videoTracks[0]?.Index);
|
||||
setCurrentAudioIndex(audioTracks[0]?.Index);
|
||||
setCurrentSubtitleIndex(subtitleTracks[0]?.Index);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const qualityLabel = () => {
|
||||
if (
|
||||
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("2160p") ||
|
||||
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("4k")
|
||||
) {
|
||||
return "4K";
|
||||
}
|
||||
if (
|
||||
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("1080p") ||
|
||||
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("hd")
|
||||
) {
|
||||
return "HD";
|
||||
}
|
||||
return "SD";
|
||||
};
|
||||
|
||||
const atmosLabel = () => {
|
||||
if (
|
||||
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("atmos") &&
|
||||
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("truehd")
|
||||
) {
|
||||
return "TrueHD | Atmos";
|
||||
}
|
||||
if (audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("atmos")) {
|
||||
return "Atmos";
|
||||
}
|
||||
if (audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("truehd")) {
|
||||
return "TrueHD";
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
||||
const surroundSoundLabel = () => {
|
||||
if (audioTracks[0]?.DisplayTitle.includes("7.1")) {
|
||||
return "7.1";
|
||||
}
|
||||
if (audioTracks[0].DisplayTitle.includes("5.1")) {
|
||||
return "5.1";
|
||||
}
|
||||
return "2.0";
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className="item-detail-hero hero"
|
||||
style={{
|
||||
marginBottom: "2em",
|
||||
}}
|
||||
>
|
||||
<div className="hero-backdrop">
|
||||
{!!item.ImageBlurHashes.Backdrop && (
|
||||
<>
|
||||
{Object.keys(item.ImageBlurHashes.Backdrop).length !== 0 && (
|
||||
<Blurhash
|
||||
hash={
|
||||
item.ImageBlurHashes.Backdrop[
|
||||
Object.keys(item.ImageBlurHashes.Backdrop)[0]
|
||||
]
|
||||
}
|
||||
width="1080"
|
||||
height="720"
|
||||
resolutionX={64}
|
||||
resolutionY={96}
|
||||
className="hero-backdrop-blurhash"
|
||||
punch={1}
|
||||
/>
|
||||
)}
|
||||
<img
|
||||
className="hero-backdrop-image"
|
||||
src={
|
||||
item.ParentBackdropItemId
|
||||
? `${api.basePath}/Items/${item.ParentBackdropItemId}/Images/Backdrop`
|
||||
: `${api.basePath}/Items/${item.Id}/Images/Backdrop`
|
||||
}
|
||||
style={{
|
||||
opacity: 0,
|
||||
}}
|
||||
onLoad={(e) => {
|
||||
e.target.style.opacity = 1;
|
||||
}}
|
||||
loading="eager"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<div className="hero-backdrop-icon-container" />
|
||||
</div>
|
||||
<div
|
||||
className="item-detail-hero-info-container"
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
<div>
|
||||
<div className="item-name">
|
||||
{isEpisode ? (
|
||||
<>
|
||||
<TextLink
|
||||
variant="h2"
|
||||
location={`/series/${item.SeriesId}`}
|
||||
otherProps={{
|
||||
fontWeight: 300,
|
||||
}}
|
||||
>
|
||||
{item.ParentLogoImageTag ? (
|
||||
<img
|
||||
src={`${api.basePath}/Items/${item.SeriesId}/Images/Logo`}
|
||||
className="hero-name-logo"
|
||||
onLoad={(e) => {
|
||||
e.target.style.opacity = 1;
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
item.SeriesName
|
||||
)}
|
||||
</TextLink>
|
||||
<Typography variant="h3" fontWeight={300}>
|
||||
{`S${item.ParentIndexNumber}:E${item.IndexNumber} ${item.Name}`}
|
||||
</Typography>
|
||||
</>
|
||||
) : (
|
||||
<Typography variant="h2" fontWeight={300}>
|
||||
{item.ImageTags.Logo ? (
|
||||
<img
|
||||
src={
|
||||
item.SeriesId
|
||||
? `${api.basePath}/Items/${item.SeriesId}/Images/Logo`
|
||||
: `${api.basePath}/Items/${item.Id}/Images/Logo`
|
||||
}
|
||||
className="hero-name-logo"
|
||||
onLoad={(e) => {
|
||||
e.target.style.opacity = 1;
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
item.Name
|
||||
)}
|
||||
</Typography>
|
||||
)}
|
||||
{!!albumBy && (
|
||||
<TextLink
|
||||
variant="h6"
|
||||
location={`/artist/${albumBy.Id}`}
|
||||
otherProps={{
|
||||
fontWeight: 400,
|
||||
style: {
|
||||
opacity: 0.8,
|
||||
},
|
||||
}}
|
||||
>
|
||||
By {albumBy.Name}
|
||||
</TextLink>
|
||||
)}
|
||||
</div>
|
||||
{enableVideoInfoStrip && (
|
||||
<Stack direction="row" gap={1} mb={2} mt={2}>
|
||||
{!!qualityLabel() && (
|
||||
<Chip
|
||||
variant="filled"
|
||||
label={
|
||||
<Typography
|
||||
variant="caption"
|
||||
fontWeight={600}
|
||||
// fontFamily="JetBrains Mono Variable"
|
||||
>
|
||||
{qualityLabel()}
|
||||
</Typography>
|
||||
}
|
||||
sx={{
|
||||
borderRadius: "8px !important",
|
||||
"& .MuiChip-label": {
|
||||
fontSize: "2.2em",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!!surroundSoundLabel() && (
|
||||
<Chip
|
||||
variant="filled"
|
||||
label={
|
||||
<Typography
|
||||
variant="caption"
|
||||
fontWeight={600}
|
||||
fontFamily="JetBrains Mono Variable"
|
||||
>
|
||||
{surroundSoundLabel()}
|
||||
</Typography>
|
||||
}
|
||||
sx={{
|
||||
borderRadius: "8px !important",
|
||||
"& .MuiChip-label": {
|
||||
fontSize: "2.2em",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!!videoTracks[0]?.VideoRangeType && (
|
||||
<Chip
|
||||
variant="filled"
|
||||
label={
|
||||
<Typography
|
||||
variant="caption"
|
||||
fontWeight={600}
|
||||
fontFamily="JetBrains Mono Variable"
|
||||
>
|
||||
{videoTracks[0].VideoRangeType}
|
||||
</Typography>
|
||||
}
|
||||
sx={{
|
||||
borderRadius: "8px !important",
|
||||
"& .MuiChip-label": {
|
||||
fontSize: "2.2em",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!!atmosLabel() && (
|
||||
<Chip
|
||||
variant="filled"
|
||||
label={
|
||||
<Typography
|
||||
variant="caption"
|
||||
fontWeight={600}
|
||||
fontFamily="JetBrains Mono Variable"
|
||||
>
|
||||
{atmosLabel()}
|
||||
</Typography>
|
||||
}
|
||||
sx={{
|
||||
borderRadius: "8px !important",
|
||||
"& .MuiChip-label": {
|
||||
fontSize: "2.2em",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!!subtitleTracks.length > 0 && (
|
||||
<Chip
|
||||
variant="filled"
|
||||
label={
|
||||
<Typography
|
||||
variant="caption"
|
||||
fontWeight={600}
|
||||
fontFamily="JetBrains Mono Variable"
|
||||
>
|
||||
CC
|
||||
</Typography>
|
||||
}
|
||||
sx={{
|
||||
borderRadius: "8px !important",
|
||||
"& .MuiChip-label": {
|
||||
fontSize: "2.2em",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Stack>
|
||||
)}
|
||||
{!disableInfoStrip && (
|
||||
<Stack
|
||||
direction="row"
|
||||
gap={2}
|
||||
className="hero-carousel-info"
|
||||
mt={1}
|
||||
justifyItems="flex-start"
|
||||
alignItems="center"
|
||||
>
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle1">
|
||||
{item.ProductionYear ? item.ProductionYear : "Unknown"}
|
||||
</Typography>
|
||||
<Chip
|
||||
variant="filled"
|
||||
label={item.OfficialRating ?? "Not Rated"}
|
||||
/>
|
||||
<ErrorBoundary fallback>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: "0.25em",
|
||||
alignItems: "center",
|
||||
}}
|
||||
className="hero-carousel-info-rating"
|
||||
>
|
||||
<div
|
||||
className="material-symbols-rounded "
|
||||
style={{
|
||||
// fontSize: "2.2em",
|
||||
color: yellow[400],
|
||||
fontVariationSettings:
|
||||
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
|
||||
}}
|
||||
>
|
||||
star
|
||||
</div>
|
||||
<Typography
|
||||
style={{
|
||||
opacity: "0.8",
|
||||
}}
|
||||
variant="subtitle1"
|
||||
>
|
||||
{Math.round(item.CommunityRating * 10) / 10}
|
||||
</Typography>
|
||||
</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 && (
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle1">
|
||||
{getRuntime(item.RunTimeTicks)}
|
||||
</Typography>
|
||||
)}
|
||||
{!!item.RunTimeTicks && (
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle1">
|
||||
{endsAt(item.RunTimeTicks)}
|
||||
</Typography>
|
||||
)}
|
||||
</Stack>
|
||||
)}
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle1" mt={1}>
|
||||
{item.Genres.join(", ")}
|
||||
</Typography>
|
||||
</div>
|
||||
{item.UserData?.PlaybackPositionTicks > 0 && (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: "0.5em",
|
||||
margin: " 1em 0 0 0",
|
||||
}}
|
||||
>
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={item.UserData?.PlayedPercentage}
|
||||
style={{
|
||||
width: "50%",
|
||||
borderRadius: "1em",
|
||||
}}
|
||||
color="white"
|
||||
/>
|
||||
<Typography variant="subtitle1" fontWeight={600}>
|
||||
{getRuntimeFull(
|
||||
item.RunTimeTicks - item.UserData.PlaybackPositionTicks,
|
||||
)}{" "}
|
||||
remaining
|
||||
</Typography>
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
style={{
|
||||
margin: "1em 0",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: "1em",
|
||||
}}
|
||||
className="item-button-container"
|
||||
>
|
||||
{!disablePlayButton && (
|
||||
<PlayButton
|
||||
itemId={item.Id}
|
||||
userId={userId}
|
||||
itemType={item.Type}
|
||||
currentVideoTrack={currentVideoIndex}
|
||||
currentAudioTrack={currentAudioIndex}
|
||||
currentSubTrack={currentSubtitleIndex}
|
||||
buttonProps={{
|
||||
size: "large",
|
||||
}}
|
||||
itemUserData={item.UserData}
|
||||
audio={audioPlayButton}
|
||||
playlistItemId={item.Type === BaseItemKind.Playlist && item.Id}
|
||||
/>
|
||||
)}
|
||||
{!disableLikeButton && (
|
||||
<LikeButton
|
||||
queryKey={["item", item.Id]}
|
||||
itemId={item.Id}
|
||||
itemName={item.Name}
|
||||
isFavorite={item.UserData?.IsFavorite}
|
||||
userId={userId}
|
||||
/>
|
||||
)}
|
||||
{!disableMarkAsPlayedButton && (
|
||||
<MarkPlayedButton
|
||||
queryKey={["item", item.Id]}
|
||||
itemId={item.Id}
|
||||
itemName={item.Name}
|
||||
isPlayed={item.UserData?.Played}
|
||||
userId={userId}
|
||||
/>
|
||||
)}{" "}
|
||||
</div>
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: "0.4em",
|
||||
maxWidth: "60%",
|
||||
}}
|
||||
>
|
||||
{Boolean(videoTracks?.length) && (
|
||||
<div className="hero-grid">
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{
|
||||
opacity: 0.6,
|
||||
}}
|
||||
noWrap
|
||||
>
|
||||
Video
|
||||
</Typography>
|
||||
<TextField
|
||||
size="small"
|
||||
value={currentVideoIndex}
|
||||
select
|
||||
onChange={(e) => setCurrentVideoIndex(e.target.value)}
|
||||
SelectProps={{
|
||||
MenuProps: {
|
||||
disableScrollLock: true,
|
||||
},
|
||||
}}
|
||||
>
|
||||
{videoTracks.map((track) => {
|
||||
return (
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
{track.DisplayTitle}
|
||||
</MenuItem>
|
||||
);
|
||||
})}
|
||||
</TextField>
|
||||
</div>
|
||||
)}
|
||||
{Boolean(audioTracks?.length) && (
|
||||
<div className="hero-grid">
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{
|
||||
opacity: 0.6,
|
||||
}}
|
||||
noWrap
|
||||
>
|
||||
Audio
|
||||
</Typography>
|
||||
<TextField
|
||||
size="small"
|
||||
value={currentAudioIndex}
|
||||
select
|
||||
onChange={(e) => setCurrentAudioIndex(e.target.value)}
|
||||
SelectProps={{
|
||||
MenuProps: {
|
||||
disableScrollLock: true,
|
||||
},
|
||||
}}
|
||||
>
|
||||
{audioTracks.map((track) => {
|
||||
return (
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
{track.DisplayTitle}
|
||||
</MenuItem>
|
||||
);
|
||||
})}
|
||||
</TextField>
|
||||
</div>
|
||||
)}
|
||||
{Boolean(subtitleTracks?.length) && (
|
||||
<div className="hero-grid">
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{
|
||||
opacity: 0.6,
|
||||
}}
|
||||
noWrap
|
||||
>
|
||||
Subtitle
|
||||
</Typography>
|
||||
<TextField
|
||||
size="small"
|
||||
value={currentSubtitleIndex}
|
||||
select
|
||||
onChange={(e) => {
|
||||
console.log(e.target.value);
|
||||
setCurrentSubtitleIndex(e.target.value);
|
||||
}}
|
||||
SelectProps={{
|
||||
MenuProps: {
|
||||
disableScrollLock: true,
|
||||
},
|
||||
}}
|
||||
>
|
||||
{subtitleTracks.map((track) => {
|
||||
return (
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
{track.DisplayTitle}
|
||||
</MenuItem>
|
||||
);
|
||||
})}
|
||||
</TextField>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
marginTop: "0.2em",
|
||||
}}
|
||||
>
|
||||
<Typography fontStyle="italic" variant="h5" mb={1} mt={1}>
|
||||
{item.Taglines[0]}
|
||||
</Typography>
|
||||
<Typography variant="subtitle1">{item.Overview}</Typography>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
marginTop: "2em",
|
||||
alignSelf: "flex-end",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
{writers.length > 0 && (
|
||||
<div className="hero-grid">
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{
|
||||
opacity: 0.6,
|
||||
}}
|
||||
noWrap
|
||||
>
|
||||
Written by
|
||||
</Typography>
|
||||
<div className="hero-text-container">
|
||||
{writers.map((writer, index) => (
|
||||
<>
|
||||
<TextLink
|
||||
key={writer.Id}
|
||||
variant={"subtitle1"}
|
||||
location={`/person/${writer.Id}`}
|
||||
>
|
||||
{writer.Name}
|
||||
</TextLink>
|
||||
{index !== writers.length - 1 && (
|
||||
<span
|
||||
style={{
|
||||
whiteSpace: "pre",
|
||||
}}
|
||||
>
|
||||
,{" "}
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{directors.length > 0 && (
|
||||
<div
|
||||
style={{
|
||||
marginTop: "0.5em",
|
||||
}}
|
||||
className="hero-grid"
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{
|
||||
opacity: 0.6,
|
||||
}}
|
||||
noWrap
|
||||
>
|
||||
Directed by
|
||||
</Typography>
|
||||
<div className="hero-text-container">
|
||||
{directors.map((director, index) => (
|
||||
<>
|
||||
<TextLink
|
||||
key={director.Id}
|
||||
variant={"subtitle1"}
|
||||
location={`/person/${director.Id}`}
|
||||
>
|
||||
{director.Name}
|
||||
</TextLink>
|
||||
{index !== directors.length - 1 && (
|
||||
<span
|
||||
style={{
|
||||
whiteSpace: "pre",
|
||||
}}
|
||||
>
|
||||
,{" "}
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{artists.length > 0 && (
|
||||
<div
|
||||
className="hero-grid"
|
||||
style={{
|
||||
marginTop: "0.5em",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{
|
||||
opacity: 0.6,
|
||||
}}
|
||||
noWrap
|
||||
>
|
||||
Artists
|
||||
</Typography>
|
||||
<div className="hero-text-container">
|
||||
{artists.map((artist, index) => (
|
||||
<>
|
||||
<TextLink
|
||||
key={artist.Id}
|
||||
variant={"subtitle1"}
|
||||
location={`/artist/${artist.Id}`}
|
||||
>
|
||||
{artist.Name}
|
||||
</TextLink>
|
||||
{index !== artists.length - 1 && (
|
||||
<span
|
||||
style={{
|
||||
whiteSpace: "pre",
|
||||
}}
|
||||
>
|
||||
,{" "}
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{studios.length > 0 && (
|
||||
<div
|
||||
className="hero-grid"
|
||||
style={{
|
||||
marginTop: "0.5em",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{
|
||||
opacity: 0.6,
|
||||
}}
|
||||
noWrap
|
||||
>
|
||||
Studios
|
||||
</Typography>
|
||||
<Typography variant="subtitle1">
|
||||
{studios.map((studio) => studio.Name).join(", ")}
|
||||
</Typography>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="item-detail-primaryImage">
|
||||
<Card
|
||||
item={item}
|
||||
seriesId={favourParentImg && item.SeriesId}
|
||||
imageType={"Primary"}
|
||||
cardType={cardType}
|
||||
queryKey={queryKey}
|
||||
userId={userId}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
hideText
|
||||
disablePadding
|
||||
disableOverlay
|
||||
onClick={() => {}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Hero;
|
||||
|
||||
Hero.defaultProps = {
|
||||
disableInfoStrip: false,
|
||||
disablePlayButton: false,
|
||||
disableLikeButton: false,
|
||||
disableMarkAsPlayedButton: false,
|
||||
};
|
||||
@@ -1,70 +0,0 @@
|
||||
$maskPercentage: 40%;
|
||||
.hero {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
gap: 2em;
|
||||
justify-content: space-between;
|
||||
padding-right: 1em;
|
||||
.item-detail-primaryImage {
|
||||
width: 26%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
&-backdrop {
|
||||
position: absolute;
|
||||
background-attachment: scroll;
|
||||
width: calc(100vw + 100px);
|
||||
height: calc(100vh + 100px);
|
||||
top: -50px;
|
||||
left: -50px;
|
||||
z-index: -1;
|
||||
filter: brightness(0.4);
|
||||
mask-image: linear-gradient(to bottom, black 40%, transparent),
|
||||
linear-gradient(to left, black 40%, transparent);
|
||||
-webkit-mask-image: linear-gradient(to bottom, black 40%, transparent),
|
||||
linear-gradient(to left, black 40%, transparent);
|
||||
mask-composite: source-in;
|
||||
-webkit-mask-composite: source-in;
|
||||
& > * {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
&-image {
|
||||
object-fit: cover;
|
||||
z-index: 1;
|
||||
}
|
||||
&-blurhash {
|
||||
z-index: 0;
|
||||
}
|
||||
&-icon {
|
||||
&-container {
|
||||
background: url(../../../assets/herobg.png);
|
||||
background-size: cover;
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
&-grid {
|
||||
display: grid;
|
||||
width: 100%;
|
||||
grid-template-columns: 1fr 85%;
|
||||
}
|
||||
|
||||
&-name-logo {
|
||||
width: 10.4em;
|
||||
max-height: 2.6em;
|
||||
object-fit: contain;
|
||||
object-position: left;
|
||||
opacity: 0;
|
||||
transition: opacity $transition-time-fast;
|
||||
filter: drop-shadow(0px 4px 10px rgb(0 0 0 / 0.5));
|
||||
}
|
||||
&-text-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,14 @@ import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
import React from "react";
|
||||
import { useApi } from "../../../../utils/store/api";
|
||||
import { Card } from "../../../card/card";
|
||||
import { CardScroller } from "../../../cardScroller/cardScroller";
|
||||
|
||||
const GenreView = ({ libraryId, genreId, genreName, userId }) => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
|
||||
const items = useQuery({
|
||||
queryKey: ["library", "genreItem", genreId],
|
||||
queryFn: async () => {
|
||||
|
||||
@@ -5,17 +5,17 @@ import React from "react";
|
||||
import type { BaseItemDto, UserDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
|
||||
import { getRuntimeMusic } from "../../../utils/date/time";
|
||||
import { useApi } from "../../../utils/store/api";
|
||||
import { useAudioPlayback } from "../../../utils/store/audioPlayback";
|
||||
import LikeButton from "../../buttons/likeButton";
|
||||
import "./tracksList.scss";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
|
||||
export default function TracksList({
|
||||
tracks,
|
||||
user,
|
||||
queryKey,
|
||||
}: { tracks: BaseItemDto[]; user: UserDto; queryKey: [] }) {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
|
||||
const [
|
||||
currentItem,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import Typography from "@mui/material/Typography";
|
||||
import React from "react";
|
||||
import { getRuntimeMusic } from "../../utils/date/time";
|
||||
import { useApi } from "../../utils/store/api";
|
||||
import { useAudioPlayback } from "../../utils/store/audioPlayback";
|
||||
import LikeButton from "../buttons/likeButton";
|
||||
import PlayButton from "../buttons/playButton";
|
||||
import TextLink from "../textLink";
|
||||
import "./musicTrack.scss";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
|
||||
/**
|
||||
* @typedef {Object} Props
|
||||
@@ -33,7 +33,7 @@ const MusicTrack = ({
|
||||
trackIndex,
|
||||
className = "",
|
||||
}) => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
const [currentTrackItem] = useAudioPlayback((state) => [state.item]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -4,8 +4,8 @@ import Typography from "@mui/material/Typography";
|
||||
import { red } from "@mui/material/colors";
|
||||
import React from "react";
|
||||
|
||||
export const ErrorNotice = ({ error, resetErrorBoundary }) => {
|
||||
console.error(error);
|
||||
export const ErrorNotice = ({ error }) => {
|
||||
console.log(error);
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -46,7 +46,7 @@ export const ErrorNotice = ({ error, resetErrorBoundary }) => {
|
||||
// opacity: 0.6,
|
||||
}}
|
||||
>
|
||||
{error.message}
|
||||
{JSON.stringify(error.message)}
|
||||
</Typography>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -4,19 +4,13 @@ $image-size: 4em;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
background: rgb(0 0 0 / 0.6);
|
||||
z-index: 10;
|
||||
display: grid;
|
||||
padding: 0.5em 1em;
|
||||
// margin: 1em;
|
||||
backdrop-filter: blur(10px);
|
||||
// border-radius: 10px;
|
||||
// overflow: hidden;
|
||||
padding: 0.5em 1.5em;
|
||||
gap: 1em;
|
||||
box-shadow: 0 0 20px rgb(0 0 0 / 0.25);
|
||||
border-top: 1.2px solid rgb(255 255 255 / 0.2);
|
||||
grid-template-columns: 25% 1fr 25%;
|
||||
|
||||
grid-template-columns: 30% 1fr 30%;
|
||||
background: rgb(0 0 0 / 0.8) !important;
|
||||
#waveform {
|
||||
width: 100%;
|
||||
transform: scaleY(0);
|
||||
@@ -35,7 +29,7 @@ $image-size: 4em;
|
||||
}
|
||||
&-info {
|
||||
display: grid;
|
||||
gap: 0.5em;
|
||||
gap: 1em;
|
||||
grid-template-columns: minmax(0, $image-size) minmax(0, 1fr);
|
||||
width: fit-content;
|
||||
align-items: center;
|
||||
@@ -53,14 +47,12 @@ $image-size: 4em;
|
||||
|
||||
position: relative;
|
||||
&-container {
|
||||
border-radius: 5px;
|
||||
border-radius: $border-radius_04;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
height: fit-content;
|
||||
aspect-ratio: 1;
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
|
||||
border: 1.2px solid rgb(255 255 255 / 0.1);
|
||||
}
|
||||
&-icon {
|
||||
position: absolute;
|
||||
|
||||
@@ -19,23 +19,24 @@ import Typography from "@mui/material/Typography";
|
||||
|
||||
import WaveSurfer from "wavesurfer.js";
|
||||
|
||||
import { useAudioPlayback } from "../../../utils/store/audioPlayback";
|
||||
import useQueue, { setTrackIndex } from "../../../utils/store/queue";
|
||||
import { useAudioPlayback } from "@/utils/store/audioPlayback";
|
||||
import useQueue from "@/utils/store/queue";
|
||||
|
||||
import { AnimatePresence } from "framer-motion";
|
||||
import "./audioPlayer.scss";
|
||||
|
||||
import { getRuntimeMusic, secToTicks } from "@/utils/date/time";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { getRuntimeMusic, secToTicks } from "../../../utils/date/time";
|
||||
|
||||
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
||||
import { theme } from "../../../theme";
|
||||
import { useApi } from "../../../utils/store/api";
|
||||
import MusicTrack from "../../musicTrack";
|
||||
import PlayNextButton from "@/components/buttons/playNextButton";
|
||||
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
||||
import QueueButton from "@/components/buttons/queueButton";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
|
||||
const AudioPlayer = () => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const [
|
||||
url,
|
||||
display,
|
||||
@@ -43,22 +44,10 @@ const AudioPlayer = () => {
|
||||
// tracks,
|
||||
// currentTrack,
|
||||
setCurrentTrack,
|
||||
setAudioUrl,
|
||||
setAudioItem,
|
||||
setAudioTracks,
|
||||
resetPlayer,
|
||||
playlistItemId,
|
||||
] = useAudioPlayback((state) => [
|
||||
state.url,
|
||||
state.display,
|
||||
state.item,
|
||||
// state.tracks,
|
||||
// state.currentTrack,
|
||||
state.setCurrentTrack,
|
||||
state.setUrl,
|
||||
state.setItem,
|
||||
state.setTracks,
|
||||
state.reset,
|
||||
state.playlistItemId,
|
||||
]);
|
||||
|
||||
@@ -91,11 +80,6 @@ const AudioPlayer = () => {
|
||||
|
||||
const [currentTime, setCurrentTime] = useState(0);
|
||||
|
||||
const [queueButton, setQueueButton] = useState(null);
|
||||
const handleOpenQueue = (event) => {
|
||||
setQueueButton(queueButton ? null : event.currentTarget);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (display) {
|
||||
const waveSurfer = WaveSurfer.create({
|
||||
@@ -170,43 +154,6 @@ const AudioPlayer = () => {
|
||||
waveSurferRef.current.playPause();
|
||||
};
|
||||
|
||||
const handleNext = () => {
|
||||
setPlaying(false);
|
||||
// setCurrentTrack(currentTrack + 1);
|
||||
setAudioUrl(
|
||||
`${api.basePath}/Audio/${
|
||||
tracks[currentTrack + 1].Id
|
||||
}/universal?deviceId=${api.deviceInfo.id}&userId=${
|
||||
user.data.Id
|
||||
}&api_key=${api.accessToken}`,
|
||||
);
|
||||
|
||||
setTrackIndex(currentTrack + 1);
|
||||
|
||||
// console.info(tracks[currentTrack + 1]);
|
||||
|
||||
console.log(currentTrack);
|
||||
// setAudioItem(tracks[currentTrack + 1]);
|
||||
setShowWaveform(false);
|
||||
};
|
||||
|
||||
const handlePrevious = () => {
|
||||
setPlaying(false);
|
||||
// setCurrentTrack(currentTrack - 1);
|
||||
setAudioUrl(
|
||||
`${api.basePath}/Audio/${
|
||||
tracks[currentTrack - 1].Id
|
||||
}/universal?deviceId=${api.deviceInfo.id}&userId=${
|
||||
user.data.Id
|
||||
}&api_key=${api.accessToken}`,
|
||||
);
|
||||
setTrackIndex(currentTrack - 1);
|
||||
// setAudioItem(tracks[currentTrack - 1]);
|
||||
setShowWaveform(false);
|
||||
};
|
||||
|
||||
console.log(tracks);
|
||||
|
||||
const info = useMemo(
|
||||
() => (
|
||||
<div
|
||||
@@ -225,10 +172,8 @@ const AudioPlayer = () => {
|
||||
<img
|
||||
alt={tracks[currentTrack]?.Name}
|
||||
className="audio-player-image"
|
||||
src={api.getItemImageUrl(
|
||||
Object.keys(tracks[currentTrack]?.ImageTags).length === 0
|
||||
? item.AlbumId
|
||||
: item.Id,
|
||||
src={api?.getItemImageUrl(
|
||||
!item?.ImageTags.Primary ? item?.AlbumId : item?.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 85,
|
||||
@@ -243,38 +188,32 @@ const AudioPlayer = () => {
|
||||
</div>
|
||||
<div className="audio-player-info-text">
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
width: "100%",
|
||||
}}
|
||||
fontWeight={500}
|
||||
>
|
||||
{tracks[currentTrack].IndexNumber
|
||||
? `${tracks[currentTrack].IndexNumber}. ${tracks[currentTrack].Name}`
|
||||
: tracks[currentTrack].Name}
|
||||
{item?.Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
variant="caption"
|
||||
style={{
|
||||
opacity: 0.5,
|
||||
}}
|
||||
noWrap
|
||||
fontWeight={400}
|
||||
>
|
||||
by {tracks[currentTrack].Artists.map((artist) => artist).join(",")}
|
||||
by {item?.Artists.map((artist) => artist).join(",")}
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
[currentTrack],
|
||||
[tracks[currentTrack]?.Id, currentTrack],
|
||||
);
|
||||
|
||||
const controls = useMemo(
|
||||
() => (
|
||||
<div style={{ display: "flex", gap: "1em" }}>
|
||||
<IconButton onClick={handlePrevious} disabled={currentTrack === 0}>
|
||||
<div className="material-symbols-rounded">skip_previous</div>
|
||||
</IconButton>
|
||||
<PlayPreviousButton />
|
||||
<div
|
||||
style={{
|
||||
display: "inline-flex",
|
||||
@@ -283,15 +222,6 @@ const AudioPlayer = () => {
|
||||
position: "relative",
|
||||
}}
|
||||
>
|
||||
<CircularProgress
|
||||
size={48}
|
||||
style={{
|
||||
position: "absolute",
|
||||
zIndex: 1,
|
||||
opacity: loading ? 1 : 0,
|
||||
transition: "opacity 500ms",
|
||||
}}
|
||||
/>
|
||||
<Fab size="small" onClick={handlePlayPause}>
|
||||
<div
|
||||
className="material-symbols-rounded"
|
||||
@@ -303,15 +233,10 @@ const AudioPlayer = () => {
|
||||
</div>
|
||||
</Fab>
|
||||
</div>
|
||||
<IconButton
|
||||
onClick={handleNext}
|
||||
disabled={tracks.length - 1 === currentTrack}
|
||||
>
|
||||
<div className="material-symbols-rounded">skip_next</div>
|
||||
</IconButton>
|
||||
<PlayNextButton />
|
||||
</div>
|
||||
),
|
||||
[currentTrack, loading, playing, tracks.length],
|
||||
[tracks[currentTrack]?.Id, loading, playing, tracks.length],
|
||||
);
|
||||
|
||||
const buttons = useMemo(
|
||||
@@ -323,130 +248,7 @@ const AudioPlayer = () => {
|
||||
justifyContent: "flex-end",
|
||||
}}
|
||||
>
|
||||
<Popper
|
||||
open={Boolean(queueButton)}
|
||||
anchorEl={queueButton}
|
||||
placement="top"
|
||||
style={{
|
||||
zIndex: 100,
|
||||
}}
|
||||
disablePortal
|
||||
modifiers={[
|
||||
{
|
||||
name: "flip",
|
||||
enabled: true,
|
||||
options: {
|
||||
altBoundary: true,
|
||||
rootBoundary: "document",
|
||||
padding: 8,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "preventOverflow",
|
||||
enabled: true,
|
||||
options: {
|
||||
altAxis: true,
|
||||
altBoundary: true,
|
||||
tether: true,
|
||||
rootBoundary: "document",
|
||||
padding: 8,
|
||||
},
|
||||
},
|
||||
]}
|
||||
transition
|
||||
>
|
||||
{({ TransitionProps }) => (
|
||||
<Grow
|
||||
{...TransitionProps}
|
||||
style={{
|
||||
transformOrigin: "50% 100% 0",
|
||||
}}
|
||||
timeout={250}
|
||||
>
|
||||
<Paper
|
||||
className="audio-player-playlist"
|
||||
style={{
|
||||
padding: "1em",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
width: "34em",
|
||||
maxHeight: "24em",
|
||||
overflowY: "auto",
|
||||
borderRadius: "20px",
|
||||
marginBottom: "2.4em",
|
||||
}}
|
||||
>
|
||||
{tracks.map((track, index) => {
|
||||
return (
|
||||
<div
|
||||
className={
|
||||
track.Id === tracks[currentTrack].Id
|
||||
? "audio-player-playlist-track active"
|
||||
: "audio-player-playlist-track"
|
||||
}
|
||||
onClick={() => setTrackIndex(index)}
|
||||
>
|
||||
<div className="audio-player-playlist-track-image">
|
||||
{Object.keys(track.ImageTags).includes("Primary") ? (
|
||||
<img
|
||||
alt={track.Name}
|
||||
src={api.getItemImageUrl(track.Id, "Primary", {
|
||||
quality: 80,
|
||||
tag: track.ImageTags["Primary"],
|
||||
fillWidth: 92,
|
||||
fillHeight: 92,
|
||||
})}
|
||||
style={{
|
||||
width: "inherit",
|
||||
height: "inherit",
|
||||
objectFit: "cover",
|
||||
}}
|
||||
/>
|
||||
) : track.AlbumPrimaryImageTag ? (
|
||||
<img
|
||||
alt={track.Name}
|
||||
src={api.getItemImageUrl(track.AlbumId, "Primary", {
|
||||
quality: 80,
|
||||
tag: track.AlbumPrimaryImageTag,
|
||||
fillWidth: 102,
|
||||
fillHeight: 102,
|
||||
})}
|
||||
style={{
|
||||
width: "inherit",
|
||||
height: "inherit",
|
||||
objectFit: "cover",
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</div>
|
||||
<div>
|
||||
<Typography variant="subtitle1">
|
||||
{track.Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="caption"
|
||||
style={{
|
||||
opacity: 0.5,
|
||||
}}
|
||||
>
|
||||
{track.Artists.join(", ")}
|
||||
</Typography>
|
||||
</div>
|
||||
<Typography variant="subtitle2">
|
||||
{getRuntimeMusic(track.RunTimeTicks)}
|
||||
</Typography>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</Paper>
|
||||
</Grow>
|
||||
)}
|
||||
</Popper>
|
||||
<IconButton onClick={handleOpenQueue}>
|
||||
<div className="material-symbols-rounded">queue_music</div>
|
||||
</IconButton>
|
||||
<QueueButton />
|
||||
<IconButton
|
||||
onClick={(e) => {
|
||||
setIsMuted(!isMuted);
|
||||
@@ -490,130 +292,79 @@ const AudioPlayer = () => {
|
||||
},
|
||||
}}
|
||||
/>
|
||||
<IconButton onClick={resetPlayer}>
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
useAudioPlayback.setState(useAudioPlayback.getInitialState());
|
||||
}}
|
||||
>
|
||||
<div className="material-symbols-rounded">close</div>
|
||||
</IconButton>
|
||||
</div>
|
||||
),
|
||||
[queueButton, volume, isMuted, currentTrack],
|
||||
[volume, isMuted, currentTrack],
|
||||
);
|
||||
|
||||
return (
|
||||
<AnimatePresence mode="sync">
|
||||
<motion.div
|
||||
initial={{
|
||||
transform: "translateY(100%)",
|
||||
}}
|
||||
animate={{ transform: "translateY(0)" }}
|
||||
exit={{
|
||||
transform: "translateY(100%)",
|
||||
}}
|
||||
style={{
|
||||
width: "100%",
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.2,
|
||||
ease: "easeInOut",
|
||||
}}
|
||||
className="audio-player"
|
||||
>
|
||||
{/* <motion.div
|
||||
initial={{
|
||||
filter: "opacity(0)",
|
||||
}}
|
||||
animate={{
|
||||
filter: "opacity(1)",
|
||||
}}
|
||||
exit={{
|
||||
filter: "opacity(0)",
|
||||
}}
|
||||
className="audio-player-info"
|
||||
>
|
||||
<div className="audio-player-image-container">
|
||||
<img
|
||||
alt={tracks[currentTrack].Name}
|
||||
className="audio-player-image"
|
||||
src={api.getItemImageUrl(
|
||||
Object.keys(tracks[currentTrack].ImageTags).length === 0
|
||||
? item.AlbumId
|
||||
: item.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 85,
|
||||
fillHeight: 462,
|
||||
fillWidth: 462,
|
||||
},
|
||||
)}
|
||||
/>
|
||||
<span className="material-symbols-rounded audio-player-image-icon">
|
||||
music_note
|
||||
</span>
|
||||
</div>
|
||||
<div className="audio-player-info-text">
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{
|
||||
width: "100%",
|
||||
}}
|
||||
fontWeight={500}
|
||||
>
|
||||
{tracks[currentTrack].IndexNumber
|
||||
? `${tracks[currentTrack].IndexNumber}. ${tracks[currentTrack].Name}`
|
||||
: tracks[currentTrack].Name}
|
||||
</Typography>
|
||||
{display && (
|
||||
<motion.div
|
||||
initial={{
|
||||
transform: "translateY(100%)",
|
||||
}}
|
||||
animate={{ transform: "translateY(0)" }}
|
||||
exit={{
|
||||
transform: "translateY(100%)",
|
||||
}}
|
||||
style={{
|
||||
width: "100%",
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.2,
|
||||
ease: "easeInOut",
|
||||
}}
|
||||
className="audio-player glass"
|
||||
>
|
||||
{info}
|
||||
|
||||
<div className="audio-player-controls">
|
||||
{controls}
|
||||
<div
|
||||
style={{
|
||||
width: "100%",
|
||||
display: "flex",
|
||||
gap: "1em",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
fontWeight={300}
|
||||
style={{
|
||||
opacity: 0.5,
|
||||
opacity: 0.8,
|
||||
}}
|
||||
noWrap
|
||||
fontWeight={400}
|
||||
>
|
||||
by{" "}
|
||||
{tracks[currentTrack].Artists.map((artist) => artist).join(",")}
|
||||
{getRuntimeMusic(secToTicks(currentTime))}
|
||||
</Typography>
|
||||
<div
|
||||
id="waveform"
|
||||
ref={waveSurferContainerRef}
|
||||
data-show={Boolean(showWaveform)}
|
||||
/>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
fontWeight={300}
|
||||
style={{
|
||||
opacity: 0.8,
|
||||
}}
|
||||
>
|
||||
{getRuntimeMusic(item?.RunTimeTicks ?? 0)}
|
||||
</Typography>
|
||||
</div>
|
||||
</motion.div> */}
|
||||
{info}
|
||||
|
||||
<div className="audio-player-controls">
|
||||
{controls}
|
||||
<div
|
||||
style={{
|
||||
width: "100%",
|
||||
display: "flex",
|
||||
gap: "1em",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
fontWeight={300}
|
||||
style={{
|
||||
opacity: 0.8,
|
||||
}}
|
||||
>
|
||||
{getRuntimeMusic(secToTicks(currentTime))}
|
||||
</Typography>
|
||||
<div
|
||||
id="waveform"
|
||||
ref={waveSurferContainerRef}
|
||||
data-show={Boolean(showWaveform)}
|
||||
/>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
fontWeight={300}
|
||||
style={{
|
||||
opacity: 0.8,
|
||||
}}
|
||||
>
|
||||
{getRuntimeMusic(tracks[currentTrack].RunTimeTicks)}
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
{buttons}
|
||||
</motion.div>
|
||||
{buttons}
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
);
|
||||
};
|
||||
|
||||
+114
-290
@@ -1,3 +1,7 @@
|
||||
import useSettingsStore, {
|
||||
setSettingsDialogOpen,
|
||||
setSettingsTabValue,
|
||||
} from "@/utils/store/settings";
|
||||
import {
|
||||
Button,
|
||||
Chip,
|
||||
@@ -21,34 +25,30 @@ import {
|
||||
} from "@mui/material";
|
||||
import { AnimatePresence, motion, transform } from "framer-motion";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import useSettingsStore, {
|
||||
setSettingsDialogOpen,
|
||||
setSettingsTabValue,
|
||||
} from "../../utils/store/settings";
|
||||
|
||||
import logo from "../../assets/logoBlack.png";
|
||||
import logo from "@/assets/logo.png";
|
||||
|
||||
import { createApi, jellyfin, useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { createApi, useApi } from "../../utils/store/api";
|
||||
import { useCentralStore } from "../../utils/store/central";
|
||||
import "./settings.scss";
|
||||
|
||||
import type { RecommendedServerInfo } from "@jellyfin/sdk";
|
||||
import { LoadingButton } from "@mui/lab";
|
||||
import { red, yellow } from "@mui/material/colors";
|
||||
import { relaunch } from "@tauri-apps/api/process";
|
||||
import { checkUpdate, installUpdate } from "@tauri-apps/api/updater";
|
||||
import { enqueueSnackbar, useSnackbar } from "notistack";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import {
|
||||
delServer,
|
||||
getAllServers,
|
||||
getDefaultServer,
|
||||
setDefaultServer,
|
||||
setServer,
|
||||
} from "../../utils/storage/servers";
|
||||
import { delUser } from "../../utils/storage/user";
|
||||
} from "@/utils/storage/servers";
|
||||
import { delUser } from "@/utils/storage/user";
|
||||
import type { RecommendedServerInfo } from "@jellyfin/sdk";
|
||||
import { LoadingButton } from "@mui/lab";
|
||||
import { red, yellow } from "@mui/material/colors";
|
||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
||||
import { relaunch } from "@tauri-apps/api/process";
|
||||
import { checkUpdate, installUpdate } from "@tauri-apps/api/updater";
|
||||
import { enqueueSnackbar, useSnackbar } from "notistack";
|
||||
|
||||
const motionConfig = {
|
||||
initial: {
|
||||
@@ -64,7 +64,8 @@ const Settings = () => {
|
||||
state.dialogOpen,
|
||||
state.tabValue,
|
||||
]);
|
||||
const [api, jellyfin] = useApi((state) => [state.api, state.jellyfin]);
|
||||
const api = useApiInContext((s) => s.api);
|
||||
|
||||
const systemInfo = useQuery({
|
||||
queryKey: ["about", "systemInfo"],
|
||||
queryFn: async () => {
|
||||
@@ -116,7 +117,7 @@ const Settings = () => {
|
||||
},
|
||||
onSuccess: async () => {
|
||||
setSettingsDialogOpen(false);
|
||||
navigate("/login/index");
|
||||
navigate({ to: "/login/index" });
|
||||
},
|
||||
onError: (error) => {
|
||||
console.error(error);
|
||||
@@ -139,12 +140,12 @@ const Settings = () => {
|
||||
setDefaultServer(serversOnDisk.data[0].id);
|
||||
createApi(serversOnDisk.data[0].address, null);
|
||||
} else {
|
||||
// Reset Api as no server is present on disk
|
||||
useApi.setState(useApi.getInitialState());
|
||||
// TODO: Reset api in context
|
||||
// useApi.setState(useApi.getInitialState());
|
||||
}
|
||||
setSettingsDialogOpen(false);
|
||||
await queryClient.removeQueries();
|
||||
navigate("/");
|
||||
navigate({ to: "/" });
|
||||
}
|
||||
enqueueSnackbar("Server deleted successfully!", { variant: "success" });
|
||||
await serversOnDisk.refetch();
|
||||
@@ -193,7 +194,9 @@ const Settings = () => {
|
||||
maxWidth="md"
|
||||
PaperProps={{
|
||||
className: "settings glass",
|
||||
elevation: 10,
|
||||
}}
|
||||
hideBackdrop
|
||||
onClose={() => setSettingsDialogOpen(false)}
|
||||
>
|
||||
<Tabs
|
||||
@@ -256,246 +259,28 @@ const Settings = () => {
|
||||
{/* General */}
|
||||
{tabValue === 1 && (
|
||||
<div className="settings-container">
|
||||
<FormControlLabel
|
||||
value="start"
|
||||
control={<Switch color="primary" />}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="h6" fontWeight={400}>
|
||||
Enable DiscordRPC
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" fontWeight={200}>
|
||||
this a test
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
labelPlacement="start"
|
||||
className="settings-option"
|
||||
/>
|
||||
<FormControlLabel
|
||||
value="start"
|
||||
control={<Switch color="primary" />}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="h6" fontWeight={400}>
|
||||
Enable DiscordRPC
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" fontWeight={200}>
|
||||
this a test
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
labelPlacement="start"
|
||||
className="settings-option"
|
||||
/>
|
||||
<FormControlLabel
|
||||
value="start"
|
||||
control={<Switch color="primary" />}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="h6" fontWeight={400}>
|
||||
Enable DiscordRPC
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" fontWeight={200}>
|
||||
this a test
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
labelPlacement="start"
|
||||
className="settings-option"
|
||||
/>
|
||||
<FormControlLabel
|
||||
value="start"
|
||||
control={<Switch color="primary" />}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="h6" fontWeight={400}>
|
||||
Enable DiscordRPC
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" fontWeight={200}>
|
||||
this a test
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
labelPlacement="start"
|
||||
className="settings-option"
|
||||
/>
|
||||
<FormControlLabel
|
||||
value="start"
|
||||
control={<Switch color="primary" />}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="h6" fontWeight={400}>
|
||||
Enable DiscordRPC
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" fontWeight={200}>
|
||||
this a test
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
labelPlacement="start"
|
||||
className="settings-option"
|
||||
/>
|
||||
<FormControlLabel
|
||||
value="start"
|
||||
control={<Switch color="primary" />}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="h6" fontWeight={400}>
|
||||
Enable DiscordRPC
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" fontWeight={200}>
|
||||
this a test
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
labelPlacement="start"
|
||||
className="settings-option"
|
||||
/>
|
||||
<FormControlLabel
|
||||
value="start"
|
||||
control={<Switch color="primary" />}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="h6" fontWeight={400}>
|
||||
Enable DiscordRPC
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" fontWeight={200}>
|
||||
this a test
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
labelPlacement="start"
|
||||
className="settings-option"
|
||||
/>
|
||||
<FormControlLabel
|
||||
value="start"
|
||||
control={<Switch color="primary" />}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="h6" fontWeight={400}>
|
||||
Enable DiscordRPC
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" fontWeight={200}>
|
||||
this a test
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
labelPlacement="start"
|
||||
className="settings-option"
|
||||
/>
|
||||
<FormControlLabel
|
||||
value="start"
|
||||
control={<Switch color="primary" />}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="h6" fontWeight={400}>
|
||||
Enable DiscordRPC
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" fontWeight={200}>
|
||||
this a test
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
labelPlacement="start"
|
||||
className="settings-option"
|
||||
/>
|
||||
<FormControlLabel
|
||||
value="start"
|
||||
control={<Switch color="primary" />}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="h6" fontWeight={400}>
|
||||
Enable DiscordRPC
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" fontWeight={200}>
|
||||
this a test
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
labelPlacement="start"
|
||||
className="settings-option"
|
||||
/>
|
||||
<FormControlLabel
|
||||
value="start"
|
||||
control={<Switch color="primary" />}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="h6" fontWeight={400}>
|
||||
Enable DiscordRPC
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" fontWeight={200}>
|
||||
this a test
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
labelPlacement="start"
|
||||
className="settings-option"
|
||||
/>
|
||||
<FormControlLabel
|
||||
value="start"
|
||||
control={<Switch color="primary" />}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="h6" fontWeight={400}>
|
||||
Enable DiscordRPC
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" fontWeight={200}>
|
||||
this a test
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
labelPlacement="start"
|
||||
className="settings-option"
|
||||
/>
|
||||
<FormControlLabel
|
||||
value="start"
|
||||
control={<Switch color="primary" />}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="h6" fontWeight={400}>
|
||||
Enable DiscordRPC
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" fontWeight={200}>
|
||||
this a test
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
labelPlacement="start"
|
||||
className="settings-option"
|
||||
/>
|
||||
<FormControlLabel
|
||||
value="start"
|
||||
control={<Switch color="primary" />}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="h6" fontWeight={400}>
|
||||
Enable DiscordRPC
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" fontWeight={200}>
|
||||
this a test
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
labelPlacement="start"
|
||||
className="settings-option"
|
||||
/>
|
||||
<FormControlLabel
|
||||
value="start"
|
||||
control={<Switch color="primary" />}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="h6" fontWeight={400}>
|
||||
Enable DiscordRPC
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" fontWeight={200}>
|
||||
this a test
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
labelPlacement="start"
|
||||
className="settings-option"
|
||||
/>
|
||||
{Array.from(new Array(10)).map((i) => (
|
||||
<FormControlLabel
|
||||
key={i}
|
||||
value="start"
|
||||
control={<Switch color="primary" />}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="subtitle1">
|
||||
Some dummy setting
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="caption"
|
||||
className="settings-option-info-caption"
|
||||
>
|
||||
this a test
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
labelPlacement="start"
|
||||
className="settings-option"
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -516,7 +301,7 @@ const Settings = () => {
|
||||
opacity: 0,
|
||||
}}
|
||||
animate={{ transform: "translateY(0px)", opacity: 1 }}
|
||||
exit={{ transform: "translateY(-10px)", opacity: 1 }}
|
||||
exit={{ transform: "translateY(-10px)", opacity: 0 }}
|
||||
transition={{
|
||||
delay: 0.1 * index,
|
||||
duration: 0.15,
|
||||
@@ -644,7 +429,7 @@ const Settings = () => {
|
||||
<div className="settings-grid">
|
||||
<div className="settings-info-container">
|
||||
<div className="settings-info">
|
||||
<Typography>Client Version:</Typography>
|
||||
<Typography variant="subtitle2">Client Version:</Typography>
|
||||
<Chip
|
||||
icon={
|
||||
<span className="material-symbols-rounded">
|
||||
@@ -654,27 +439,45 @@ const Settings = () => {
|
||||
</span>
|
||||
}
|
||||
label={
|
||||
<Typography variant="subtitle1">
|
||||
<Typography variant="subtitle2">
|
||||
{applicationVersion}
|
||||
</Typography>
|
||||
}
|
||||
color={
|
||||
updateInfo.data?.shouldUpdate ? "error" : "success"
|
||||
}
|
||||
size="medium"
|
||||
color={updateInfo.data?.shouldUpdate ? "error" : "info"}
|
||||
size="small"
|
||||
style={{
|
||||
width: "fit-content !important",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="settings-info">
|
||||
<Typography>Update Available:</Typography>
|
||||
<Typography>
|
||||
{updateInfo.isFetching
|
||||
? "Checking for new updates..."
|
||||
: updateInfo.data?.shouldUpdate
|
||||
? updateInfo.data.manifest?.version
|
||||
: "No update found."}
|
||||
<Typography variant="subtitle2">
|
||||
Update Available:
|
||||
</Typography>
|
||||
<Typography variant="subtitle2">
|
||||
{updateInfo.isFetching ? (
|
||||
"Checking for new updates..."
|
||||
) : updateInfo.data?.shouldUpdate ? (
|
||||
<Chip
|
||||
icon={
|
||||
<span className="material-symbols-rounded">
|
||||
update
|
||||
</span>
|
||||
}
|
||||
label={
|
||||
<Typography variant="subtitle2">
|
||||
{applicationVersion}
|
||||
</Typography>
|
||||
}
|
||||
color="success"
|
||||
size="small"
|
||||
style={{
|
||||
width: "fit-content !important",
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
"No update found."
|
||||
)}
|
||||
</Typography>
|
||||
</div>
|
||||
<LoadingButton
|
||||
@@ -709,22 +512,32 @@ const Settings = () => {
|
||||
{systemInfo.isSuccess ? (
|
||||
<div className="settings-info-container">
|
||||
<div className="settings-info">
|
||||
<Typography>Server:</Typography>
|
||||
<Typography>{systemInfo.data?.ServerName}</Typography>
|
||||
<Typography variant="subtitle2">Server:</Typography>
|
||||
<Typography variant="subtitle2">
|
||||
{systemInfo.data?.ServerName}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="settings-info">
|
||||
<Typography>Jellyfin Version:</Typography>
|
||||
<Typography>{systemInfo.data?.Version}</Typography>
|
||||
<Typography variant="subtitle2">
|
||||
Jellyfin Version:
|
||||
</Typography>
|
||||
<Typography variant="subtitle2">
|
||||
{systemInfo.data?.Version}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="settings-info">
|
||||
<Typography>Operating System:</Typography>
|
||||
<Typography>
|
||||
<Typography variant="subtitle2">
|
||||
Operating System:
|
||||
</Typography>
|
||||
<Typography variant="subtitle2">
|
||||
{systemInfo.data?.OperatingSystemDisplayName}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="settings-info">
|
||||
<Typography>Server Architecture:</Typography>
|
||||
<Typography>
|
||||
<Typography variant="subtitle2">
|
||||
Server Architecture:
|
||||
</Typography>
|
||||
<Typography variant="subtitle2">
|
||||
{systemInfo.data?.SystemArchitecture}
|
||||
</Typography>
|
||||
</div>
|
||||
@@ -745,10 +558,9 @@ const Settings = () => {
|
||||
background: "rgb(0 0 0 / 0.3)",
|
||||
padding: "1em",
|
||||
borderRadius: "10px",
|
||||
border: "1px solid rgb(255 255 255 / 0.1)",
|
||||
}}
|
||||
>
|
||||
<Typography variant="h6" fontWeight={300} mb={1}>
|
||||
<Typography variant="subtitle1" mb={1}>
|
||||
Links:
|
||||
</Typography>
|
||||
<div
|
||||
@@ -759,15 +571,22 @@ const Settings = () => {
|
||||
gap: "0.1em",
|
||||
}}
|
||||
>
|
||||
<Link
|
||||
<Typography
|
||||
component={Link}
|
||||
variant="subtitle2"
|
||||
target="_blank"
|
||||
href="https://github.com/prayag17/JellyPlayer"
|
||||
>
|
||||
https://github.com/prayag17/JellyPlayer
|
||||
</Link>
|
||||
<Link target="_blank" href="https://jellyfin.org">
|
||||
</Typography>
|
||||
<Typography
|
||||
component={Link}
|
||||
variant="subtitle2"
|
||||
target="_blank"
|
||||
href="https://jellyfin.org"
|
||||
>
|
||||
https://jellyfin.org
|
||||
</Link>
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -776,7 +595,12 @@ const Settings = () => {
|
||||
</AnimatePresence>
|
||||
|
||||
{/* Add Server */}
|
||||
<Dialog open={addServerDialog} fullWidth>
|
||||
<Dialog
|
||||
open={addServerDialog}
|
||||
fullWidth
|
||||
hideBackdrop
|
||||
disableScrollLock={true}
|
||||
>
|
||||
<DialogTitle>Add Server</DialogTitle>
|
||||
<DialogContent className="settings-server-add">
|
||||
<TextField
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
grid-template-columns: 20% 1fr;
|
||||
height: 60vh;
|
||||
overflow: hidden !important;
|
||||
|
||||
.MuiTabs-flexContainerVertical{
|
||||
height: 100%;
|
||||
}
|
||||
@@ -23,8 +22,8 @@
|
||||
}
|
||||
&-scroll{
|
||||
overflow-y: auto;
|
||||
mask-image: linear-gradient(to top, transparent, black 15px calc(100% - 15px), transparent);
|
||||
scrollbar-gutter:stable ;
|
||||
overscroll-behavior: contain;
|
||||
// Magic scrollbar
|
||||
&::-webkit-scrollbar {
|
||||
&-thumb {
|
||||
@@ -48,9 +47,11 @@
|
||||
&-logo{
|
||||
width: 100%;
|
||||
background: rgb(255 255 255 / 1);
|
||||
padding: 2em;
|
||||
padding: 0em;
|
||||
height: 10em;
|
||||
margin-bottom: 1em;
|
||||
border-radius: $border-radius-default;
|
||||
object-fit: contain;
|
||||
}
|
||||
&-info{
|
||||
display: grid;
|
||||
@@ -58,17 +59,24 @@
|
||||
gap: 1em;
|
||||
justify-items: start;
|
||||
align-items: center;
|
||||
|
||||
border-bottom: 1px solid rgb(255 255 255 / 0.1);
|
||||
padding-bottom: 0.5em;
|
||||
&-container{
|
||||
background: rgb(0 0 0 / 0.3);
|
||||
border: 1px solid rgb(255 255 255 / 0.1);
|
||||
padding: 1em;
|
||||
border-radius: $border-radius-default;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap:0.4em;
|
||||
gap:0.6em;
|
||||
width: 100%;
|
||||
}
|
||||
&:last-child {
|
||||
border: none;
|
||||
padding-bottom: 0em;
|
||||
}
|
||||
> :last-child {
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
|
||||
//settings
|
||||
@@ -78,7 +86,11 @@
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
padding: 0 !important;
|
||||
margin: 0 0 0.4em 0!important;
|
||||
margin: 0 !important;
|
||||
margin-bottom: 0.6em !important;
|
||||
&-info-caption{
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
//serverList
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
import "./textLink.scss";
|
||||
|
||||
const TextLink = ({ children, location, variant, otherProps }) => {
|
||||
const navigate = useNavigate();
|
||||
// const navigate = useNavigate();
|
||||
|
||||
return (
|
||||
<Typography
|
||||
variant={variant}
|
||||
className="link flex"
|
||||
onClick={() => navigate(location)}
|
||||
// onClick={() => navigate(location)}
|
||||
{...otherProps}
|
||||
>
|
||||
{children}
|
||||
|
||||
Reference in new issue
Block a user