refactor: code cleanup
This commit is contained in:
6 files changed
+52
-49
No files matched your search
@@ -47,6 +47,7 @@ function ListItemLink(props: ListItemLinkProps) {
|
||||
|
||||
return (
|
||||
<li>
|
||||
{/* @ts-ignore */}
|
||||
<ListItem
|
||||
component={Link}
|
||||
activeClassName="active"
|
||||
@@ -276,7 +277,10 @@ export const AppBar = () => {
|
||||
<ListItemLink
|
||||
key={library.Id}
|
||||
to={`/library/${library.Id}`}
|
||||
icon={getTypeIcon(library.CollectionType)}
|
||||
icon={
|
||||
library.CollectionType &&
|
||||
getTypeIcon(library.CollectionType)
|
||||
}
|
||||
primary={library.Name ?? "Library"}
|
||||
/>
|
||||
))}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import React, { memo } from "react";
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import React from "react";
|
||||
|
||||
import { motion } from "framer-motion";
|
||||
|
||||
@@ -67,14 +66,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||
const [animationDirection] = useCarouselStore((state) => [state.direction]);
|
||||
|
||||
return (
|
||||
<Paper
|
||||
className="hero-carousel-slide"
|
||||
sx={{
|
||||
background: "transparent",
|
||||
// px: 3,
|
||||
}}
|
||||
elevation={0}
|
||||
>
|
||||
<div className="hero-carousel-slide">
|
||||
<div className="hero-carousel-background-container">
|
||||
{item.BackdropImageTags?.length ? (
|
||||
<img
|
||||
@@ -369,7 +361,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||
</Stack>
|
||||
</Stack>
|
||||
</div>
|
||||
</Paper>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { LinearProgress } from "@mui/material";
|
||||
import { useNProgress } from "@tanem/react-nprogress";
|
||||
import type React from "react";
|
||||
import React from "react";
|
||||
|
||||
const NProgress: React.FC<{ isAnimating: boolean | number }> = ({
|
||||
isAnimating,
|
||||
|
||||
@@ -1,69 +1,76 @@
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import * as generatedClient from "@jellyfin/sdk/lib/generated-client";
|
||||
import React from "react";
|
||||
|
||||
export const getTypeIcon = (icon: BaseItemKind) => {
|
||||
export const getTypeIcon = (
|
||||
icon:
|
||||
| generatedClient.BaseItemKind
|
||||
| generatedClient.CollectionType
|
||||
| "Home"
|
||||
| "User"
|
||||
| "universal",
|
||||
) => {
|
||||
switch (icon) {
|
||||
case "Home":
|
||||
return <div className="material-symbols-rounded">home</div>;
|
||||
case BaseItemKind.Audio:
|
||||
case generatedClient.BaseItemKind.Audio:
|
||||
return <div className="material-symbols-rounded">mic</div>;
|
||||
case BaseItemKind.AudioBook:
|
||||
case generatedClient.BaseItemKind.AudioBook:
|
||||
return <div className="material-symbols-rounded">speech_to_text</div>;
|
||||
case BaseItemKind.Book:
|
||||
case generatedClient.BaseItemKind.Book:
|
||||
return <div className="material-symbols-rounded">book</div>;
|
||||
case "boxsets":
|
||||
case BaseItemKind.BoxSet:
|
||||
case generatedClient.BaseItemKind.BoxSet:
|
||||
return <div className="material-symbols-rounded">video_library</div>;
|
||||
case "livetv":
|
||||
case BaseItemKind.TvProgram:
|
||||
case BaseItemKind.TvChannel:
|
||||
case BaseItemKind.Program:
|
||||
case BaseItemKind.Recording:
|
||||
case BaseItemKind.LiveTvChannel:
|
||||
case BaseItemKind.LiveTvProgram:
|
||||
case BaseItemKind.ChannelFolderItem:
|
||||
case BaseItemKind.Channel:
|
||||
case generatedClient.BaseItemKind.TvProgram:
|
||||
case generatedClient.BaseItemKind.TvChannel:
|
||||
case generatedClient.BaseItemKind.Program:
|
||||
case generatedClient.BaseItemKind.Recording:
|
||||
case generatedClient.BaseItemKind.LiveTvChannel:
|
||||
case generatedClient.BaseItemKind.LiveTvProgram:
|
||||
case generatedClient.BaseItemKind.ChannelFolderItem:
|
||||
case generatedClient.BaseItemKind.Channel:
|
||||
return (
|
||||
<div className="material-symbols-rounded">settings_input_antenna</div>
|
||||
);
|
||||
case "tvshows":
|
||||
case BaseItemKind.Season:
|
||||
case BaseItemKind.Series:
|
||||
case BaseItemKind.Episode:
|
||||
case generatedClient.BaseItemKind.Season:
|
||||
case generatedClient.BaseItemKind.Series:
|
||||
case generatedClient.BaseItemKind.Episode:
|
||||
return <div className="material-symbols-rounded">tv_gen</div>;
|
||||
case "playlists":
|
||||
case BaseItemKind.Playlist:
|
||||
case BaseItemKind.PlaylistsFolder:
|
||||
case BaseItemKind.ManualPlaylistsFolder:
|
||||
case generatedClient.BaseItemKind.Playlist:
|
||||
case generatedClient.BaseItemKind.PlaylistsFolder:
|
||||
case generatedClient.BaseItemKind.ManualPlaylistsFolder:
|
||||
return <div className="material-symbols-rounded">queue_music</div>;
|
||||
case "movies":
|
||||
case BaseItemKind.Movie:
|
||||
case generatedClient.BaseItemKind.Movie:
|
||||
return <div className="material-symbols-rounded">movie</div>;
|
||||
case BaseItemKind.MusicAlbum:
|
||||
case generatedClient.BaseItemKind.MusicAlbum:
|
||||
return <div className="material-symbols-rounded">album</div>;
|
||||
case BaseItemKind.MusicArtist:
|
||||
case generatedClient.BaseItemKind.MusicArtist:
|
||||
return <div className="material-symbols-rounded">artist</div>;
|
||||
case BaseItemKind.Genre:
|
||||
case BaseItemKind.MusicGenre:
|
||||
case generatedClient.BaseItemKind.Genre:
|
||||
case generatedClient.BaseItemKind.MusicGenre:
|
||||
return <div className="material-symbols-rounded">domino_mask</div>;
|
||||
case "musicvideos":
|
||||
case BaseItemKind.MusicVideo:
|
||||
case generatedClient.BaseItemKind.MusicVideo:
|
||||
return <div className="material-symbols-rounded">music_video</div>;
|
||||
case "User":
|
||||
case BaseItemKind.Person:
|
||||
case generatedClient.BaseItemKind.Person:
|
||||
return <div className="material-symbols-rounded">person</div>;
|
||||
case BaseItemKind.Photo:
|
||||
case generatedClient.BaseItemKind.Photo:
|
||||
return <div className="material-symbols-rounded">image</div>;
|
||||
case "photos":
|
||||
case BaseItemKind.PhotoAlbum:
|
||||
case generatedClient.BaseItemKind.PhotoAlbum:
|
||||
return <div className="material-symbols-rounded">photo_library</div>;
|
||||
case "universal":
|
||||
case BaseItemKind.Studio:
|
||||
case generatedClient.BaseItemKind.Studio:
|
||||
return <div className="material-symbols-rounded">category</div>;
|
||||
case "trailers":
|
||||
case BaseItemKind.Trailer:
|
||||
case generatedClient.BaseItemKind.Trailer:
|
||||
return <div className="material-symbols-rounded">smart_display</div>;
|
||||
case BaseItemKind.Video:
|
||||
case generatedClient.BaseItemKind.Video:
|
||||
return <div className="material-symbols-rounded">theaters</div>;
|
||||
case "music":
|
||||
return <div className="material-symbols-rounded">library_music</div>;
|
||||
|
||||
@@ -112,7 +112,7 @@ export const Route = createRootRouteWithContext<ApiContext>()({
|
||||
? `show${(isQueryFetching ?? 1) * (isMutating ?? 1) * (routeIsLoading ?? 1)}`
|
||||
: "hide"
|
||||
}
|
||||
isAnimating={isQueryFetching || isMutating || routeIsLoading}
|
||||
isAnimating={isQueryFetching + isMutating + routeIsLoading}
|
||||
/>
|
||||
|
||||
{routeIsLoading && (
|
||||
@@ -265,8 +265,8 @@ export const Route = createRootRouteWithContext<ApiContext>()({
|
||||
<AppBar />
|
||||
<AudioPlayer />
|
||||
<Outlet />
|
||||
<ReactQueryDevtools />
|
||||
<TanStackRouterDevtools />
|
||||
{/* <ReactQueryDevtools /> */}
|
||||
{/* <TanStackRouterDevtools /> */}
|
||||
</SnackbarProvider>
|
||||
</ThemeProvider>
|
||||
</Suspense>
|
||||
|
||||
Reference in new issue
Block a user