feat: add subtitle support #337

This commit is contained in:
Prayag Prajapati committed 2024-08-27 19:12:46 +05:30
1 parent 8106b714a1
commit cec17b270a
20 files changed
+4958 -4755

No files matched your search

+23 -23
View File
@@ -13,35 +13,35 @@
"tanstack-router-dev": "tsr watch" "tanstack-router-dev": "tsr watch"
}, },
"dependencies": { "dependencies": {
"@emotion/react": "^11.13.0", "@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0", "@emotion/styled": "^11.13.0",
"@fontsource-variable/jetbrains-mono": "^5.0.21", "@fontsource-variable/jetbrains-mono": "^5.0.22",
"@fontsource-variable/noto-sans": "^5.0.5", "@fontsource-variable/noto-sans": "^5.0.5",
"@jellyfin/sdk": "0.10.0", "@jellyfin/sdk": "0.10.0",
"@million/lint": "1.0.0-rc.84", "@million/lint": "1.0.0-rc.84",
"@mui/lab": "5.0.0-alpha.173", "@mui/lab": "6.0.0-beta.8",
"@mui/material": "6.0.0-alpha.14", "@mui/material": "6.0.0",
"@react-spring/web": "^9.7.4", "@react-spring/web": "^9.7.4",
"@tanem/react-nprogress": "^5.0.51", "@tanem/react-nprogress": "^5.0.51",
"@tanstack/react-query": "^5.51.15", "@tanstack/react-query": "^5.52.2",
"@tanstack/react-query-devtools": "^5.51.15", "@tanstack/react-query-devtools": "^5.52.2",
"@tanstack/react-router": "^1.45.11", "@tanstack/react-router": "^1.51.0",
"@tanstack/react-virtual": "^3.8.3", "@tanstack/react-virtual": "^3.10.4",
"@tauri-apps/api": "2.0.0-beta.15", "@tauri-apps/api": "2.0.0-beta.15",
"@tauri-apps/plugin-clipboard-manager": "2.1.0-beta.5", "@tauri-apps/plugin-clipboard-manager": "2.1.0-beta.5",
"@tauri-apps/plugin-process": "2.0.0-beta.7", "@tauri-apps/plugin-process": "2.0.0-rc.0",
"@tauri-apps/plugin-store": "github:tauri-apps/tauri-plugin-store#v2", "@tauri-apps/plugin-store": "github:tauri-apps/tauri-plugin-store#v2",
"@tauri-apps/plugin-updater": "2.0.0-beta.7", "@tauri-apps/plugin-updater": "2.0.0-rc.0",
"@types/node": "^22.0.0", "@types/node": "^22.5.0",
"@types/react": "^18.3.3", "@types/react": "^18.3.4",
"@types/react-dom": "^18.3.0", "@types/react-dom": "^18.3.0",
"axios": "^1.7.2", "axios": "^1.7.5",
"axios-tauri-api-adapter": "^0.2.1", "axios-tauri-api-adapter": "^0.2.2",
"blurhash": "^2.0.5", "blurhash": "^2.0.5",
"framer-motion": "^11.3.19", "framer-motion": "^11.3.30",
"jassub": "^1.7.16", "jassub": "^1.7.17",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"material-symbols": "^0.21.2", "material-symbols": "^0.22.2",
"million": "^3.1.11", "million": "^3.1.11",
"notistack": "^3.0.1", "notistack": "^3.0.1",
"react": "18.3.1", "react": "18.3.1",
@@ -57,21 +57,21 @@
"remark-gfm": "^4.0.0", "remark-gfm": "^4.0.0",
"typescript": "^5.5.4", "typescript": "^5.5.4",
"vite-plugin-svgr": "^4.2.0", "vite-plugin-svgr": "^4.2.0",
"wavesurfer.js": "^7.8.2", "wavesurfer.js": "^7.8.4",
"zustand": "^4.5.4" "zustand": "^4.5.5"
}, },
"devDependencies": { "devDependencies": {
"@babel/plugin-proposal-optional-chaining-assign": "^7.24.7", "@babel/plugin-proposal-optional-chaining-assign": "^7.24.7",
"@biomejs/biome": "^1.8.3", "@biomejs/biome": "^1.8.3",
"@tanstack/router-cli": "^1.45.8", "@tanstack/router-cli": "^1.51.0",
"@tanstack/router-devtools": "^1.45.11", "@tanstack/router-devtools": "^1.51.0",
"@tanstack/router-vite-plugin": "^1.45.8", "@tanstack/router-vite-plugin": "^1.51.0",
"@tauri-apps/cli": "2.0.0-beta.22", "@tauri-apps/cli": "2.0.0-beta.22",
"@types/lodash": "^4.17.7", "@types/lodash": "^4.17.7",
"@vitejs/plugin-react": "^4.3.1", "@vitejs/plugin-react": "^4.3.1",
"prop-types": "^15.8.1", "prop-types": "^15.8.1",
"sass": "^1.77.8", "sass": "^1.77.8",
"vite": "^5.3.5" "vite": "^5.4.2"
}, },
"license": "GPL-3.0-only" "license": "GPL-3.0-only"
} }
+651 -757
View File
File diff suppressed because it is too large. Load diff
+1 -3
View File
@@ -12,8 +12,6 @@
"store:allow-keys", "store:allow-keys",
"store:allow-load", "store:allow-load",
"updater:allow-check", "updater:allow-check",
"updater:allow-download-and-install", "updater:allow-download-and-install"
"window:default",
"window:allow-set-fullscreen"
] ]
} }
+14 -15
View File
@@ -1,17 +1,16 @@
{ {
"identifier": "migrated", "$schema": "../gen/schemas/desktop-schema.json",
"description": "permissions that were migrated from v1", "identifier": "migrated",
"local": true, "description": "permissions that were migrated from v1",
"windows": [ "local": true,
"main" "windows": ["main"],
], "permissions": [
"permissions": [ "core:path:default",
"path:default", "core:event:default",
"event:default", "core:window:default",
"window:default", "core:app:default",
"app:default", "core:resources:default",
"resources:default", "core:menu:default",
"menu:default", "core:tray:default"
"tray:default" ]
]
} }
+1 -1
View File
@@ -1 +1 @@
{"app":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-version","allow-name","allow-tauri-version"]},"permissions":{"allow-app-hide":{"identifier":"allow-app-hide","description":"Enables the app_hide command without any pre-configured scope.","commands":{"allow":["app_hide"],"deny":[]}},"allow-app-show":{"identifier":"allow-app-show","description":"Enables the app_show command without any pre-configured scope.","commands":{"allow":["app_show"],"deny":[]}},"allow-default-window-icon":{"identifier":"allow-default-window-icon","description":"Enables the default_window_icon command without any pre-configured scope.","commands":{"allow":["default_window_icon"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","commands":{"allow":["name"],"deny":[]}},"allow-tauri-version":{"identifier":"allow-tauri-version","description":"Enables the tauri_version command without any pre-configured scope.","commands":{"allow":["tauri_version"],"deny":[]}},"allow-version":{"identifier":"allow-version","description":"Enables the version command without any pre-configured scope.","commands":{"allow":["version"],"deny":[]}},"deny-app-hide":{"identifier":"deny-app-hide","description":"Denies the app_hide command without any pre-configured scope.","commands":{"allow":[],"deny":["app_hide"]}},"deny-app-show":{"identifier":"deny-app-show","description":"Denies the app_show command without any pre-configured scope.","commands":{"allow":[],"deny":["app_show"]}},"deny-default-window-icon":{"identifier":"deny-default-window-icon","description":"Denies the default_window_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["default_window_icon"]}},"deny-name":{"identifier":"deny-name","description":"Denies the name command without any pre-configured scope.","commands":{"allow":[],"deny":["name"]}},"deny-tauri-version":{"identifier":"deny-tauri-version","description":"Denies the tauri_version command without any pre-configured scope.","commands":{"allow":[],"deny":["tauri_version"]}},"deny-version":{"identifier":"deny-version","description":"Denies the version command without any pre-configured scope.","commands":{"allow":[],"deny":["version"]}}},"permission_sets":{},"global_scope_schema":null},"clipboard-manager":{"default_permission":{"identifier":"default","description":"No features are enabled by default, as we believe\nthe clipboard can be inherently dangerous and it is \napplication specific if read and/or write access is needed.\n\nClipboard interaction needs to be explicitly enabled.\n","permissions":[]},"permissions":{"allow-clear":{"identifier":"allow-clear","description":"Enables the clear command without any pre-configured scope.","commands":{"allow":["clear"],"deny":[]}},"allow-read-image":{"identifier":"allow-read-image","description":"Enables the read_image command without any pre-configured scope.","commands":{"allow":["read_image"],"deny":[]}},"allow-read-text":{"identifier":"allow-read-text","description":"Enables the read_text command without any pre-configured scope.","commands":{"allow":["read_text"],"deny":[]}},"allow-write-html":{"identifier":"allow-write-html","description":"Enables the write_html command without any pre-configured scope.","commands":{"allow":["write_html"],"deny":[]}},"allow-write-image":{"identifier":"allow-write-image","description":"Enables the write_image command without any pre-configured scope.","commands":{"allow":["write_image"],"deny":[]}},"allow-write-text":{"identifier":"allow-write-text","description":"Enables the write_text command without any pre-configured scope.","commands":{"allow":["write_text"],"deny":[]}},"deny-clear":{"identifier":"deny-clear","description":"Denies the clear command without any pre-configured scope.","commands":{"allow":[],"deny":["clear"]}},"deny-read-image":{"identifier":"deny-read-image","description":"Denies the read_image command without any pre-configured scope.","commands":{"allow":[],"deny":["read_image"]}},"deny-read-text":{"identifier":"deny-read-text","description":"Denies the read_text command without any pre-configured scope.","commands":{"allow":[],"deny":["read_text"]}},"deny-write-html":{"identifier":"deny-write-html","description":"Denies the write_html command without any pre-configured scope.","commands":{"allow":[],"deny":["write_html"]}},"deny-write-image":{"identifier":"deny-write-image","description":"Denies the write_image command without any pre-configured scope.","commands":{"allow":[],"deny":["write_image"]}},"deny-write-text":{"identifier":"deny-write-text","description":"Denies the write_text command without any pre-configured scope.","commands":{"allow":[],"deny":["write_text"]}}},"permission_sets":{},"global_scope_schema":null},"event":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-listen",Line truncated {"clipboard-manager":{"default_permission":{"identifier":"default","description":"No features are enabled by default, as we believe\nthe clipboard can be inherently dangerous and it is \napplication specific if read and/or write access is needed.\n\nClipboard interaction needs to be explicitly enabled.\n","permissions":[]},"permissions":{"allow-clear":{"identifier":"allow-clear","description":"Enables the clear command without any pre-configured scope.","commands":{"allow":["clear"],"deny":[]}},"allow-read-image":{"identifier":"allow-read-image","description":"Enables the read_image command without any pre-configured scope.","commands":{"allow":["read_image"],"deny":[]}},"allow-read-text":{"identifier":"allow-read-text","description":"Enables the read_text command without any pre-configured scope.","commands":{"allow":["read_text"],"deny":[]}},"allow-write-html":{"identifier":"allow-write-html","description":"Enables the write_html command without any pre-configured scope.","commands":{"allow":["write_html"],"deny":[]}},"allow-write-image":{"identifier":"allow-write-image","description":"Enables the write_image command without any pre-configured scope.","commands":{"allow":["write_image"],"deny":[]}},"allow-write-text":{"identifier":"allow-write-text","description":"Enables the write_text command without any pre-configured scope.","commands":{"allow":["write_text"],"deny":[]}},"deny-clear":{"identifier":"deny-clear","description":"Denies the clear command without any pre-configured scope.","commands":{"allow":[],"deny":["clear"]}},"deny-read-image":{"identifier":"deny-read-image","description":"Denies the read_image command without any pre-configured scope.","commands":{"allow":[],"deny":["read_image"]}},"deny-read-text":{"identifier":"deny-read-text","description":"Denies the read_text command without any pre-configured scope.","commands":{"allow":[],"deny":["read_text"]}},"deny-write-html":{"identifier":"deny-write-html","description":"Denies the write_html command without any pre-configured scope.","commands":{"allow":[],"deny":["write_html"]}},"deny-write-image":{"identifier":"deny-write-image","description":"Denies the write_image command without any pre-configured scope.","commands":{"allow":[],"deny":["write_image"]}},"deny-write-text":{"identifier":"deny-write-text","description":"Denies the write_text command without any pre-configured scope.","commands":{"allow":[],"deny":["write_text"]}}},"permission_sets":{},"global_scope_schema":null},"core:app":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-version","allow-name","allow-tauri-version"]},"permissions":{"allow-app-hide":{"identifier":"allow-app-hide","description":"Enables the app_hide command without any pre-configured scope.","commands":{"allow":["app_hide"],"deny":[]}},"allow-app-show":{"identifier":"allow-app-show","description":"Enables the app_show command without any pre-configured scope.","commands":{"allow":["app_show"],"deny":[]}},"allow-default-window-icon":{"identifier":"allow-default-window-icon","description":"Enables the default_window_icon command without any pre-configured scope.","commands":{"allow":["default_window_icon"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","commands":{"allow":["name"],"deny":[]}},"allow-tauri-version":{"identifier":"allow-tauri-version","description":"Enables the tauri_version command without any pre-configured scope.","commands":{"allow":["tauri_version"],"deny":[]}},"allow-version":{"identifier":"allow-version","description":"Enables the version command without any pre-configured scope.","commands":{"allow":["version"],"deny":[]}},"deny-app-hide":{"identifier":"deny-app-hide","description":"Denies the app_hide command without any pre-configured scope.","commands":{"allow":[],"deny":["app_hide"]}},"deny-app-show":{"identifier":"deny-app-show","description":"Denies the app_show command without any pre-configured scope.","commands":{"allow":[],"deny":["app_show"]}},"deny-default-window-icon":{"identifier":"deny-default-window-icon","description":"Denies the default_window_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["default_window_icon"]}},"deny-name":{"identifier":"deny-name","description":"Denies the name command without any pre-configured scope.","commands":{"allow":[],"deny":["name"]}},"deny-tauri-version":{"identifier":"deny-tauri-version","description":"Denies the tauri_version command without any pre-configured scope.","commands":{"allow":[],"deny":["tauri_version"]}},"deny-version":{"identifier":"deny-version","description":"Denies the version command without any pre-configured scope.","commands":{"allow":[],"deny":["version"]}}},"permission_sets":{},"global_scope_schema":null},"core:event":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["alloLine truncated
+1 -1
View File
@@ -1 +1 @@
{"main-capabilities":{"identifier":"main-capabilities","description":"Capability for desktop window","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","store:allow-clear","store:allow-delete","store:allow-keys","store:allow-load","updater:allow-check","updater:allow-download-and-install","window:default","window:allow-set-fullscreen"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["path:default","event:default","window:default","app:default","resources:default","menu:default","tray:default"]}} {"main-capabilities":{"identifier":"main-capabilities","description":"Capability for desktop window","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","store:allow-clear","store:allow-delete","store:allow-keys","store:allow-load","updater:allow-check","updater:allow-download-and-install"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default"]}}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -129,7 +129,7 @@ export const AppBar = () => {
location.pathname.includes("login") || location.pathname.includes("login") ||
location.pathname.includes("setup") || location.pathname.includes("setup") ||
location.pathname.includes("server") || location.pathname.includes("server") ||
location.pathname === "/player/" || location.pathname === "/player" ||
location.pathname.includes("error") || location.pathname.includes("error") ||
location.pathname === "/" location.pathname === "/"
) { ) {
+1 -1
View File
@@ -1,7 +1,7 @@
import Divider from "@mui/material/Divider"; import Divider from "@mui/material/Divider";
import Grid from "@mui/material/Grid2";
import Skeleton from "@mui/material/Skeleton"; import Skeleton from "@mui/material/Skeleton";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Grid from "@mui/material/Unstable_Grid2";
import EpisodeSkeleton from "./episode"; import EpisodeSkeleton from "./episode";
export const SeasonSelectorSkeleton = () => { export const SeasonSelectorSkeleton = () => {
+27 -7
View File
@@ -16,6 +16,7 @@ import { Route as IndexImport } from './routes/index'
import { Route as ErrorCodeImport } from './routes/error/$code' import { Route as ErrorCodeImport } from './routes/error/$code'
import { Route as ApiSearchImport } from './routes/_api/search' import { Route as ApiSearchImport } from './routes/_api/search'
import { Route as ApiLoginImport } from './routes/_api/login' import { Route as ApiLoginImport } from './routes/_api/login'
import { Route as ApiLibraryImport } from './routes/_api/library'
import { Route as ApiSearchIndexImport } from './routes/_api/search/index' import { Route as ApiSearchIndexImport } from './routes/_api/search/index'
import { Route as ApiPlayerIndexImport } from './routes/_api/player/index' import { Route as ApiPlayerIndexImport } from './routes/_api/player/index'
import { Route as ApiHomeIndexImport } from './routes/_api/home/index' import { Route as ApiHomeIndexImport } from './routes/_api/home/index'
@@ -64,6 +65,11 @@ const ApiLoginRoute = ApiLoginImport.update({
getParentRoute: () => ApiRoute, getParentRoute: () => ApiRoute,
} as any) } as any)
const ApiLibraryRoute = ApiLibraryImport.update({
path: '/library',
getParentRoute: () => ApiRoute,
} as any)
const ApiSearchIndexRoute = ApiSearchIndexImport.update({ const ApiSearchIndexRoute = ApiSearchIndexImport.update({
path: '/', path: '/',
getParentRoute: () => ApiSearchRoute, getParentRoute: () => ApiSearchRoute,
@@ -130,8 +136,8 @@ const ApiLoginListRoute = ApiLoginListImport.update({
} as any) } as any)
const ApiLibraryIdRoute = ApiLibraryIdImport.update({ const ApiLibraryIdRoute = ApiLibraryIdImport.update({
path: '/library/$id', path: '/$id',
getParentRoute: () => ApiRoute, getParentRoute: () => ApiLibraryRoute,
} as any) } as any)
const ApiItemIdRoute = ApiItemIdImport.update({ const ApiItemIdRoute = ApiItemIdImport.update({
@@ -182,6 +188,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof ApiImport preLoaderRoute: typeof ApiImport
parentRoute: typeof rootRoute parentRoute: typeof rootRoute
} }
'/_api/library': {
id: '/_api/library'
path: '/library'
fullPath: '/library'
preLoaderRoute: typeof ApiLibraryImport
parentRoute: typeof ApiImport
}
'/_api/login': { '/_api/login': {
id: '/_api/login' id: '/_api/login'
path: '/login' path: '/login'
@@ -240,10 +253,10 @@ declare module '@tanstack/react-router' {
} }
'/_api/library/$id': { '/_api/library/$id': {
id: '/_api/library/$id' id: '/_api/library/$id'
path: '/library/$id' path: '/$id'
fullPath: '/library/$id' fullPath: '/library/$id'
preLoaderRoute: typeof ApiLibraryIdImport preLoaderRoute: typeof ApiLibraryIdImport
parentRoute: typeof ApiImport parentRoute: typeof ApiLibraryImport
} }
'/_api/login/list': { '/_api/login/list': {
id: '/_api/login/list' id: '/_api/login/list'
@@ -351,6 +364,7 @@ declare module '@tanstack/react-router' {
export const routeTree = rootRoute.addChildren({ export const routeTree = rootRoute.addChildren({
IndexRoute, IndexRoute,
ApiRoute: ApiRoute.addChildren({ ApiRoute: ApiRoute.addChildren({
ApiLibraryRoute: ApiLibraryRoute.addChildren({ ApiLibraryIdRoute }),
ApiLoginRoute: ApiLoginRoute.addChildren({ ApiLoginRoute: ApiLoginRoute.addChildren({
ApiLoginListRoute, ApiLoginListRoute,
ApiLoginManualRoute, ApiLoginManualRoute,
@@ -362,7 +376,6 @@ export const routeTree = rootRoute.addChildren({
ApiBoxsetIdRoute, ApiBoxsetIdRoute,
ApiEpisodeIdRoute, ApiEpisodeIdRoute,
ApiItemIdRoute, ApiItemIdRoute,
ApiLibraryIdRoute,
ApiPersonIdRoute, ApiPersonIdRoute,
ApiPlayerAudioRoute, ApiPlayerAudioRoute,
ApiPlaylistIdRoute, ApiPlaylistIdRoute,
@@ -399,6 +412,7 @@ export const routeTree = rootRoute.addChildren({
"/_api": { "/_api": {
"filePath": "_api.tsx", "filePath": "_api.tsx",
"children": [ "children": [
"/_api/library",
"/_api/login", "/_api/login",
"/_api/search", "/_api/search",
"/_api/album/$id", "/_api/album/$id",
@@ -406,7 +420,6 @@ export const routeTree = rootRoute.addChildren({
"/_api/boxset/$id", "/_api/boxset/$id",
"/_api/episode/$id", "/_api/episode/$id",
"/_api/item/$id", "/_api/item/$id",
"/_api/library/$id",
"/_api/person/$id", "/_api/person/$id",
"/_api/player/audio", "/_api/player/audio",
"/_api/playlist/$id", "/_api/playlist/$id",
@@ -416,6 +429,13 @@ export const routeTree = rootRoute.addChildren({
"/_api/player/" "/_api/player/"
] ]
}, },
"/_api/library": {
"filePath": "_api/library.tsx",
"parent": "/_api",
"children": [
"/_api/library/$id"
]
},
"/_api/login": { "/_api/login": {
"filePath": "_api/login.tsx", "filePath": "_api/login.tsx",
"parent": "/_api", "parent": "/_api",
@@ -457,7 +477,7 @@ export const routeTree = rootRoute.addChildren({
}, },
"/_api/library/$id": { "/_api/library/$id": {
"filePath": "_api/library/$id.tsx", "filePath": "_api/library/$id.tsx",
"parent": "/_api" "parent": "/_api/library"
}, },
"/_api/login/list": { "/_api/login/list": {
"filePath": "_api/login/list.tsx", "filePath": "_api/login/list.tsx",
+1 -1
View File
@@ -264,7 +264,7 @@ export const Route = createRootRouteWithContext<ApiContext>()({
<AudioPlayer /> <AudioPlayer />
<Outlet /> <Outlet />
<ReactQueryDevtools /> <ReactQueryDevtools />
<TanStackRouterDevtools /> {/* <TanStackRouterDevtools /> */}
</SnackbarProvider> </SnackbarProvider>
</ThemeProvider> </ThemeProvider>
</Suspense> </Suspense>
+146 -140
View File
@@ -49,9 +49,9 @@ import {
import { useBackdropStore } from "@/utils/store/backdrop"; import { useBackdropStore } from "@/utils/store/backdrop";
import "./album.scss"; import "./album.scss";
import IconLink from "@/components/iconLink";
import TagChip from "@/components/tagChip"; import TagChip from "@/components/tagChip";
import { Link, createFileRoute } from "@tanstack/react-router"; import { Link, createFileRoute } from "@tanstack/react-router";
import lyricsIcon from "../../../assets/icons/lyrics.svg";
function TabPanel(props) { function TabPanel(props) {
const { children, value, index, ...other } = props; const { children, value, index, ...other } = props;
@@ -201,155 +201,161 @@ function MusicAlbumTitlePage() {
className="scrollY padded-top item item-album" className="scrollY padded-top item item-album"
ref={pageRef} ref={pageRef}
> >
<div className="item-info"> <div className="item-info-container">
<Typography className="item-info-name" variant="h3"> <div className="item-info">
{item.data.Name} <Typography className="item-info-name" variant="h3">
</Typography> {item.data.Name}
<div className="flex flex-align-center item-info-album-info">
<div className="flex flex-align-center">
<span
className="material-symbols-rounded"
style={{
opacity: 0.7,
}}
>
artist
</span>
<Typography ml={1}>{item.data.AlbumArtist}</Typography>
</div>
<Typography className="opacity-07">
{item.data.ProductionYear}
</Typography> </Typography>
<Typography className="opacity-07"> <div className="flex flex-align-center item-info-album-info">
{musicTracks.data?.TotalRecordCount > 1 <div className="flex flex-align-center">
? `${musicTracks.data?.TotalRecordCount} songs` <span
: `1 song`} className="material-symbols-rounded"
</Typography> style={{
<Typography className="opacity-07"> opacity: 0.7,
{getRuntimeCompact(item.data.CumulativeRunTimeTicks)} }}
</Typography> >
</div> artist
<div className="item-info-buttons"> </span>
<PlayButton <Typography ml={1}>{item.data.AlbumArtist}</Typography>
item={item}
audio
itemType={item.data.Type}
userId={user.data?.Id}
/>
<LikeButton
itemId={item.data.Id}
isFavorite={item.data.UserData?.IsFavorite}
queryKey={["item", "musicTracks"]}
userId={user.data?.Id}
itemName={item.data.Name}
/>
</div>
<div className="item-info-track-container">
<div className="item-info-track header">
<span className="material-symbols-rounded index">tag</span>
<Typography variant="subtitle1">Title</Typography>
<Typography variant="subtitle1">Duration</Typography>
</div>
{musicTracks.data?.Items?.map((track, index) => (
<div
className={
currentPlayingItem?.Id === track.Id
? "item-info-track playing"
: "item-info-track"
}
key={track.Id}
onClick={() =>
handlePlayback(index, track, musicTracks.data.Items)
}
>
<div className="index-container">
<span className="material-symbols-rounded fill ">
play_arrow
</span>
<Typography className="index">
{track.IndexNumber ?? "-"}
</Typography>
</div>
<div className="item-info-track-info">
<Typography className="item-info-track-info-name">
{track.Name}
</Typography>
<Typography
variant="subtitle2"
style={{
opacity: 0.6,
}}
fontWeight={300}
>
{track.Artists?.join(", ")}
</Typography>
</div>
<Typography>{getRuntimeMusic(track.RunTimeTicks)}</Typography>
<div className="flex flex-align-center">
<LikeButton
itemId={track.Id}
isFavorite={track.UserData?.IsFavorite}
queryKey={["item", "musicTracks"]}
userId={user.data?.Id}
itemName={track.Name}
/>
</div>
</div> </div>
))} <Typography className="opacity-07">
</div> {item.data.ProductionYear}
</div> </Typography>
<div className="item-info-sidebar"> <Typography className="opacity-07">
<div className="item-info-sidebar-image-container"> {musicTracks.data?.TotalRecordCount > 1
{item.data.ImageTags?.Primary ? ( ? `${musicTracks.data?.TotalRecordCount} songs`
<img : `1 song`}
className="item-info-sidebar-image" </Typography>
alt={item.data.Name ?? "Album"} <Typography className="opacity-07">
src={api.getItemImageUrl(item.data.Id, "Primary", { {getRuntimeCompact(item.data.CumulativeRunTimeTicks)}
tag: item.data.ImageTags.Primary, </Typography>
quality: 90, </div>
})} <div className="item-info-buttons">
<PlayButton
item={item}
audio
itemType={item.data.Type}
userId={user.data?.Id}
/> />
) : ( <LikeButton
<div className="item-info-sidebar-icon"> itemId={item.data.Id}
{getTypeIcon("MusicAlbum")} isFavorite={item.data.UserData?.IsFavorite}
queryKey={["item", "musicTracks"]}
userId={user.data?.Id}
itemName={item.data.Name}
/>
</div>
<div className="item-info-track-container">
<div className="item-info-track header">
<span className="material-symbols-rounded index">tag</span>
<Typography variant="subtitle1">Title</Typography>
<Typography variant="subtitle1">Duration</Typography>
</div> </div>
)} {musicTracks.data?.Items?.map((track, index) => (
</div> <div
<div className={
className="flex flex-align-center" currentPlayingItem?.Id === track.Id
style={{ gap: "1em", flexWrap: "wrap" }} ? "item-info-track playing"
> : "item-info-track"
{item.data.GenreItems?.map((genre) => ( }
<TagChip label={genre.Name} key={genre.Id} /> key={track.Id}
))} onClick={() =>
</div> handlePlayback(index, track, musicTracks.data.Items)
<div className="flex flex-column item-info-sidebar-artist-container"> }
{item.data.ArtistItems?.map((artist) => ( >
<Link <div className="index-container">
to="/artist/$id" <span className="material-symbols-rounded fill ">
params={{ id: artist.Id }} play_arrow
className="item-info-sidebar-artist" </span>
key={artist.Id} <Typography className="index">
> {track.IndexNumber ?? "-"}
<div className="item-info-sidebar-artist-image-container"> </Typography>
<img </div>
className="item-info-sidebar-artist-image" <div className="item-info-track-info">
alt={artist.Name ?? "Artist"} <Typography className="item-info-track-info-name">
src={api.getItemImageUrl(artist.Id, "Primary", { {track.Name}
quality: 90, </Typography>
})} <Typography
/> variant="subtitle2"
<span className="material-symbols-rounded">artist</span> style={{
opacity: 0.6,
display: "flex",
alignItems: "center",
gap: "0.6em",
}}
fontWeight={300}
>
{track.HasLyrics && <img src={lyricsIcon} alt="lyrics" />}
{track.Artists?.join(", ")}
</Typography>
</div>
<Typography>{getRuntimeMusic(track.RunTimeTicks)}</Typography>
<div className="flex flex-align-center">
<LikeButton
itemId={track.Id}
isFavorite={track.UserData?.IsFavorite}
queryKey={["item", "musicTracks"]}
userId={user.data?.Id}
itemName={track.Name}
/>
</div>
</div> </div>
<Typography>{artist.Name}</Typography> ))}
</Link> </div>
))} </div>
<div className="item-info-sidebar">
<div className="item-info-sidebar-image-container">
{item.data.ImageTags?.Primary ? (
<img
className="item-info-sidebar-image"
alt={item.data.Name ?? "Album"}
src={api.getItemImageUrl(item.data.Id, "Primary", {
tag: item.data.ImageTags.Primary,
quality: 90,
})}
/>
) : (
<div className="item-info-sidebar-icon">
{getTypeIcon("MusicAlbum")}
</div>
)}
</div>
<div
className="flex flex-align-center"
style={{ gap: "1em", flexWrap: "wrap" }}
>
{item.data.GenreItems?.map((genre) => (
<TagChip label={genre.Name} key={genre.Id} />
))}
</div>
<div className="flex flex-column item-info-sidebar-artist-container">
{item.data.ArtistItems?.map((artist) => (
<Link
to="/artist/$id"
params={{ id: artist.Id }}
className="item-info-sidebar-artist"
key={artist.Id}
>
<div className="item-info-sidebar-artist-image-container">
<img
className="item-info-sidebar-artist-image"
alt={artist.Name ?? "Artist"}
src={api.getItemImageUrl(artist.Id, "Primary", {
quality: 90,
})}
/>
<span className="material-symbols-rounded">artist</span>
</div>
<Typography>{artist.Name}</Typography>
</Link>
))}
</div>
</div> </div>
</div> </div>
{similarItems.data.TotalRecordCount > 0 && ( {similarItems.data.TotalRecordCount > 0 && (
<CardScroller <CardScroller
title="You might also like" title="You might also like"
displayCards={5} displayCards={7}
disableDecoration disableDecoration
> >
{similarItems.data.Items.map((similar) => { {similarItems.data.Items.map((similar) => {
+5 -3
View File
@@ -1,11 +1,13 @@
$border-radius: 20px; $border-radius: 20px;
.item-album { .item-album {
grid-template-columns: 1fr 25%;
display: grid;
gap: 3em;
.item-info { .item-info {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
&-container {
grid-template-columns: 1fr 25%;
display: grid;
gap: 3em;
}
gap: 1.2em; gap: 1.2em;
&-sidebar { &-sidebar {
display: flex; display: flex;
+41
View File
@@ -0,0 +1,41 @@
import type {
BaseItemKind,
ItemSortBy,
} from "@jellyfin/sdk/lib/generated-client";
import { createFileRoute } from "@tanstack/react-router";
type LibraryParamType = {
currentViewType: BaseItemKind;
sortAscending: boolean;
sortBy: ItemSortBy;
filters: {
isPlayed: boolean;
isUnPlayed: boolean;
isResumable: boolean;
isFavorite: boolean;
isLiked: boolean;
isUnliked: boolean;
hasSubtitles: boolean;
hasTrailer: boolean;
hasSpecialFeature: boolean;
hasThemeSong: boolean;
hasThemeVideo: boolean;
isBluRay: boolean;
isDVD: boolean;
isHD: undefined | boolean;
isSD: boolean;
is4K: boolean;
is3D: boolean;
};
};
export const Route = createFileRoute("/_api/library")({
validateSearch: (search: Record<string, any>): LibraryParamType => {
return {
currentViewType: search.viewType,
sortAscending: search.sortAscending,
sortBy: search.sortBy,
filters: search.filters,
};
},
});
+57 -12
View File
@@ -65,10 +65,10 @@ import { useWindowVirtualizer } from "@tanstack/react-virtual";
import type { AxiosResponse } from "axios"; import type { AxiosResponse } from "axios";
import "./library.scss"; import "./library.scss";
import LibraryItemsSkeleton from "@/components/skeleton/libraryItems"; import LibraryItemsSkeleton from "@/components/skeleton/libraryItems";
import { createFileRoute } from "@tanstack/react-router"; import { createFileRoute, useNavigate } from "@tanstack/react-router";
type SortByObject = { title: string; value: ItemSortBy }; type SortByObject = { title: string; value: ItemSortBy };
type ViewObject = { title: string; value: BaseItemKind }; type ViewObject = { title: string; value: BaseItemKind | "Artist" };
// type allowedFilters = ["movies", "tvshows", "music", "books"]; // type allowedFilters = ["movies", "tvshows", "music", "books"];
type allowedFilters = Partial<CollectionType>[]; type allowedFilters = Partial<CollectionType>[];
@@ -97,6 +97,7 @@ export const Route = createFileRoute("/_api/library/$id")({
function LibraryView() { function LibraryView() {
const api = Route.useRouteContext().api; const api = Route.useRouteContext().api;
const navigate = useNavigate();
const { id } = Route.useParams(); const { id } = Route.useParams();
@@ -123,7 +124,7 @@ function LibraryView() {
staleTime: 0, staleTime: 0,
}); });
const [currentViewType, setCurrentViewType] = useState<BaseItemKind>( const [currentViewType, setCurrentViewType] = useState<BaseItemKind | "Artist">(
undefined!, undefined!,
); );
const availableViewTypes: ViewObject[] = useMemo(() => { const availableViewTypes: ViewObject[] = useMemo(() => {
@@ -190,7 +191,19 @@ function LibraryView() {
default: default:
result = []; result = [];
} }
setCurrentViewType(result?.[0]?.value); if (
sessionStorage.getItem(
`library-${currentLib.data?.Id}-config_currentViewType`,
)
) {
setCurrentViewType(
sessionStorage.getItem(
`library-${currentLib.data?.Id}-config_currentViewType`,
) as BaseItemKind | "Artist",
);
} else {
setCurrentViewType(result?.[0]?.value);
}
return result; return result;
}, [currentLib.data?.CollectionType]); }, [currentLib.data?.CollectionType]);
@@ -205,6 +218,18 @@ function LibraryView() {
const [sortBy, setSortBy] = useState<ItemSortBy>("Name"); const [sortBy, setSortBy] = useState<ItemSortBy>("Name");
const [sortAscending, setSortAscending] = useState(true); const [sortAscending, setSortAscending] = useState(true);
useEffect(() => {
// I don't know why this works, don't ask...
const cachedVal = sessionStorage.getItem(
`library-${currentLib.data?.Id}-config_sort`,
) as unknown as {
sortAscending: boolean;
sortBy: ItemSortBy;
};
if (cachedVal) {
setSortAscending(cachedVal.sortAscending);
}
}, [currentLib.data?.Id]);
const sortByOptions: SortByObject[] = useMemo(() => { const sortByOptions: SortByObject[] = useMemo(() => {
let result: SortByObject[] = undefined!; let result: SortByObject[] = undefined!;
switch (currentViewType) { switch (currentViewType) {
@@ -414,10 +439,19 @@ function LibraryView() {
]; ];
break; break;
} }
setSortBy(result?.[0]?.value); // And they say typescript makes your code better :|
const cachedVal = JSON.parse(sessionStorage.getItem(`library-${currentLib.data?.Id}-config_sort`) as string);
// as {
// sortAscending: boolean;
// sortBy: ItemSortBy;
// }
if (cachedVal) {
setSortBy(cachedVal.sortBy);
} else {
setSortBy(result?.[0]?.value);
}
return result; return result;
}, [currentLib.data?.CollectionType, currentViewType]); }, [currentLib.data?.CollectionType, currentViewType]);
useLayoutEffect(() => {}, [sortByOptions]);
const [filters, setFilters] = useState<Record<string, undefined | boolean>>({ const [filters, setFilters] = useState<Record<string, undefined | boolean>>({
isPlayed: false, isPlayed: false,
@@ -775,9 +809,16 @@ function LibraryView() {
select select
value={sortBy ?? "Name"} value={sortBy ?? "Name"}
size="small" size="small"
onChange={(e: ChangeEvent<HTMLSelectElement>) => onChange={(e) => {
setSortBy(e.target.value) setSortBy(e.target.value);
} sessionStorage.setItem(
`library-${currentLib.data?.Id}-config_sort`,
JSON.stringify({
sortAscending,
sortBy: e.target.value,
}),
);
}}
> >
{sortByOptions.map((item) => ( {sortByOptions.map((item) => (
<MenuItem key={item.value} value={item.value}> <MenuItem key={item.value} value={item.value}>
@@ -792,9 +833,13 @@ function LibraryView() {
select select
value={currentViewType} value={currentViewType}
size="small" size="small"
onChange={(e: ChangeEvent<HTMLSelectElement>) => onChange={(e) => {
setCurrentViewType(e.target.value) setCurrentViewType(e.target.value);
} sessionStorage.setItem(
`library-${currentLib.data?.Id}-config_currentViewType`,
e.target.value,
);
}}
> >
{availableViewTypes.map((item) => ( {availableViewTypes.map((item) => (
<MenuItem key={item.value} value={item.value}> <MenuItem key={item.value} value={item.value}>
+45 -6
View File
@@ -1,5 +1,5 @@
.audio { .audio {
&-hidden{ &-hidden {
transform: translateY(-100%); transform: translateY(-100%);
} }
&-info { &-info {
@@ -43,29 +43,68 @@
gap: 1em; gap: 1em;
} }
} }
&-queue{ &-queue {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
align-items: center; align-items: center;
gap: 1em; gap: 1em;
margin-top: 2em; margin-top: 2em;
&-track{ &-track {
display: grid; display: grid;
grid-template-columns: 3em 1fr 6em; grid-template-columns: 3em 1fr 6em;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 100%; width: 100%;
gap: 1em; gap: 1em;
&-info-name{ &-info-name {
transition: $transition-time-fast; transition: $transition-time-fast;
} }
&.active{ &.active {
.audio-queue-track-info-name{ .audio-queue-track-info-name {
color: $clr-accent-default; color: $clr-accent-default;
font-weight: 500; font-weight: 500;
} }
} }
} }
} }
&-lyrics {
max-height: 40vh;
overflow:visible;
background: rgb(255 255 255 / 0.05);
// border: 1px solid rgb(255 255 255 / 0.2);
padding: 2em;
position: relative;
margin-bottom: 2em;
border-radius: 20px;
&-line {
width: fit-content;
white-space: wrap;
text-align: center;
font-size: 1.5em;
opacity: 0.5;
transform: scale(1);
transition: transform $transition-time-default;
&[data-active-lyric="true"] {
opacity: 1;
transform: scale(1.2);
}
}
&[data-has-synced-lyrics="false"] {
.audio-lyrics-line {
opacity: 1;
}
}
&-container {
display: flex;
flex-direction: column;
overflow-y: scroll;
height: calc(40vh - 4em);
width: 100%;
overflow-x: visible !important;
align-items: center;
position: relative;
top: 0;
}
}
} }
+174 -77
View File
@@ -3,7 +3,13 @@ import { useAudioPlayback } from "@/utils/store/audioPlayback";
import useQueue from "@/utils/store/queue"; import useQueue from "@/utils/store/queue";
import { Fab, IconButton, Slider, Typography } from "@mui/material"; import { Fab, IconButton, Slider, Typography } from "@mui/material";
import { createFileRoute } from "@tanstack/react-router"; import { createFileRoute } from "@tanstack/react-router";
import React, { useCallback, useEffect, useRef, useState } from "react"; import React, {
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from "react";
import "./audio.scss"; import "./audio.scss";
import LikeButton from "@/components/buttons/likeButton"; import LikeButton from "@/components/buttons/likeButton";
@@ -24,8 +30,10 @@ function AudioPlayerRoute() {
const api = useApiInContext((s) => s.api); const api = useApiInContext((s) => s.api);
const [queue, currentTrack] = useQueue((s) => [s.tracks, s.currentItemIndex]); const [queue, currentTrack] = useQueue((s) => [s.tracks, s.currentItemIndex]);
const [item] = useAudioPlayback((s) => [s.item]); const [item] = useAudioPlayback((s) => [s.item]);
const audioPlayer: HTMLAudioElement | null = const audioPlayer: HTMLAudioElement | null = useMemo(
document.querySelector("#audio-player"); () => document.querySelector("#audio-player"),
[item],
);
const [isScrubbing, setIsScrubbing] = useState(false); const [isScrubbing, setIsScrubbing] = useState(false);
const [sliderProgress, setSliderProgress] = useState<number | number[]>(0); // this state hold the slider scrubbing value allowing user to scrub track without changing current time const [sliderProgress, setSliderProgress] = useState<number | number[]>(0); // this state hold the slider scrubbing value allowing user to scrub track without changing current time
@@ -33,23 +41,44 @@ function AudioPlayerRoute() {
audioPlayer?.currentTime ?? 0, audioPlayer?.currentTime ?? 0,
); );
const [showLyrics, setShowLyrics] = useState(false);
const lyrics = useQuery({ const lyrics = useQuery({
queryKey: ["player", "audio", item?.Id, "lyrics"], queryKey: ["player", "audio", item?.Id, "lyrics"],
queryFn: async () => queryFn: async () =>
await getLyricsApi(api).getLyrics({ (
itemId: item?.Id, await getLyricsApi(api).searchRemoteLyrics({
}), itemId: item?.Id,
})
).data,
enabled: Boolean(item?.Id), enabled: Boolean(item?.Id),
}); });
useEffect(() => { useEffect(() => {
audioPlayer?.addEventListener("timeupdate", () => { audioPlayer?.addEventListener("timeupdate", () => {
setProgress(audioPlayer.currentTime); setProgress(audioPlayer.currentTime ?? 0);
}); });
}, [item?.Id]); console.log(audioPlayer);
}, [item?.Id, currentTrack]);
const lyricsContainer = useRef<HTMLDivElement | null>(null);
useEffect(() => {
if (showLyrics) {
const currentLyric = document.querySelector("[data-active-lyric='true']");
currentLyric?.scrollIntoView({
block: "nearest",
inline: "nearest",
behavior: "smooth",
});
}
}, [showLyrics, audioPlayer?.currentTime]);
return ( return (
<div className="scrollY padded-top flex flex-column" style={{ gap: "1em" }}> <div
className="scrollY padded-top flex flex-column"
style={{ gap: "1em" }}
key={queue[currentTrack]?.Id}
>
<div className="audio-info-container"> <div className="audio-info-container">
<div className="audio-info-image-container"> <div className="audio-info-image-container">
{item?.ImageTags?.Primary ? ( {item?.ImageTags?.Primary ? (
@@ -77,84 +106,152 @@ function AudioPlayerRoute() {
> >
by {item?.Artists?.join(", ")} by {item?.Artists?.join(", ")}
</Typography> </Typography>
<Slider <div
style={{ className="flex flex-row"
marginTop: "1.2em", style={{ gap: "1em", alignItems: "center" }}
}} >
value={isScrubbing ? sliderProgress : secToTicks(progress)} <Typography variant="subtitle2" className="opacity-07">
max={item?.RunTimeTicks ?? 1} {getRuntimeMusic(secToTicks(audioPlayer?.currentTime) ?? 0)}
step={1} </Typography>
onChange={(_, newVal) => { <Slider
setIsScrubbing(true); value={isScrubbing ? sliderProgress : secToTicks(progress)}
setSliderProgress(newVal); max={item?.RunTimeTicks ?? 1}
}} step={1}
onChangeCommitted={(_, newVal) => { onChange={(_, newVal) => {
setIsScrubbing(false); setIsScrubbing(true);
Array.isArray(newVal) setSliderProgress(newVal);
? setProgress(ticksToSec(newVal[0])) }}
: setProgress(ticksToSec(newVal)); onChangeCommitted={(_, newVal) => {
audioPlayer?.currentTime = Array.isArray(newVal) setIsScrubbing(false);
? ticksToSec(newVal[0]) Array.isArray(newVal)
: ticksToSec(newVal); ? setProgress(ticksToSec(newVal[0]))
}} : setProgress(ticksToSec(newVal));
sx={{ audioPlayer?.currentTime = Array.isArray(newVal)
"& .MuiSlider-thumb": { ? ticksToSec(newVal[0])
width: 14, : ticksToSec(newVal);
height: 14, }}
transition: "0.1s ease-in-out", sx={{
opacity: 0, "& .MuiSlider-thumb": {
"&.Mui-active": { width: 14,
width: 20, height: 14,
height: 20, transition: "0.1s ease-in-out",
opacity: 0,
"&.Mui-active": {
width: 20,
height: 20,
opacity: 1,
},
},
"&:hover .MuiSlider-thumb": {
opacity: 1, opacity: 1,
}, },
}, "& .MuiSlider-rail": {
"&:hover .MuiSlider-thumb": { opacity: 0.28,
opacity: 1, background: "white",
}, },
"& .MuiSlider-rail": {
opacity: 0.28,
background: "white",
},
}}
/>
<div className="audio-info-controls">
<PlayPreviousButton />
<IconButton
onClick={() => {
audioPlayer?.currentTime -= SEEK_AMOUNT;
}} }}
> />
<span className="material-symbols-rounded">fast_rewind</span> <Typography variant="subtitle2" className="opacity-07">
</IconButton> {getRuntimeMusic(item?.RunTimeTicks ?? 0)}
<Fab </Typography>
disabled={!audioPlayer?.readyState} </div>
color="white" <div
size="large" style={{
onClick={() => display: "flex",
audioPlayer?.paused ? audioPlayer.play() : audioPlayer?.pause() alignItems: "center",
} justifyContent: "center",
> width: "100%",
<span }}
className="fill material-symbols-rounded" >
style={{ <div className="audio-info-controls">
fontSize: "2.4em", <PlayPreviousButton />
<IconButton
onClick={() => {
audioPlayer?.currentTime -= SEEK_AMOUNT;
}} }}
> >
{audioPlayer?.paused ? "play_arrow" : "pause"} <span className="material-symbols-rounded">fast_rewind</span>
</IconButton>
<Fab
disabled={!audioPlayer?.readyState}
color="white"
size="large"
onClick={() =>
audioPlayer?.paused
? audioPlayer.play()
: audioPlayer?.pause()
}
>
<span
className="fill material-symbols-rounded"
style={{
fontSize: "2.4em",
}}
>
{audioPlayer?.paused ? "play_arrow" : "pause"}
</span>
</Fab>
<IconButton
onClick={() => {
audioPlayer?.currentTime += SEEK_AMOUNT;
}}
>
<span className="material-symbols-rounded">fast_forward</span>
</IconButton>
<PlayNextButton />
</div>
<IconButton onClick={() => setShowLyrics((s) => !s)}>
<span
className={
showLyrics
? "material-symbols-rounded fill"
: "material-symbols-rounded"
}
>
lyrics
</span> </span>
</Fab>
<IconButton
onClick={() => {
audioPlayer?.currentTime += SEEK_AMOUNT;
}}
>
<span className="material-symbols-rounded">fast_forward</span>
</IconButton> </IconButton>
<PlayNextButton />
</div> </div>
</div> </div>
</div> </div>
{showLyrics && (
<div
className="audio-lyrics"
data-has-synced-lyrics={Boolean(
lyrics.data?.[0]?.Lyrics?.Metadata?.IsSynced,
)}
>
<div className="audio-lyrics-container" ref={lyricsContainer}>
{lyrics.data?.[1]?.Lyrics?.Lyrics?.map((lyric, index) => (
<div
className="audio-lyrics-line"
key={`${lyric.Text}${index}`}
data-active-lyric={
secToTicks(audioPlayer?.currentTime) >= lyric.Start &&
secToTicks(audioPlayer?.currentTime) <
(lyrics.data?.[0]?.Lyrics?.Lyrics?.[index + 1]?.Start ?? 0)
}
>
{lyric.Text}
</div>
))}
</div>
{!lyrics.data?.[0]?.Lyrics?.Metadata?.IsSynced && (
<Typography
className="flex flex-align-center"
style={{
position: "absolute",
bottom: "-2em",
opacity: 0.7,
gap: "0.4em",
}}
>
<span className="material-symbols-rounded">info</span>
Synced subtitles no available
</Typography>
)}
</div>
)}
<div className="audio-queue-container"> <div className="audio-queue-container">
<Typography variant="h5">Queue:</Typography> <Typography variant="h5">Queue:</Typography>
<div className="audio-queue"> <div className="audio-queue">
+8
View File
@@ -40,6 +40,7 @@ import PlayNextButton from "@/components/buttons/playNextButton";
import PlayPreviousButton from "@/components/buttons/playPreviousButtom"; import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
import QueueButton from "@/components/buttons/queueButton"; import QueueButton from "@/components/buttons/queueButton";
import OutroCard from "@/components/outroCard"; import OutroCard from "@/components/outroCard";
import useQueue from "@/utils/store/queue";
import { createFileRoute, useRouter } from "@tanstack/react-router"; import { createFileRoute, useRouter } from "@tanstack/react-router";
import type { OnProgressProps } from "react-player/base"; import type { OnProgressProps } from "react-player/base";
import subtitleFont from "./Noto-Sans-Indosphere.ttf"; import subtitleFont from "./Noto-Sans-Indosphere.ttf";
@@ -98,6 +99,10 @@ function VideoPlayer() {
state.playsessionId, state.playsessionId,
state.intro, state.intro,
]); ]);
const [currentQueueItemIndex, queue] = useQueue((s) => [
s.currentItemIndex,
s.tracks,
]);
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [settingsMenu, setSettingsMenu] = useState(null); const [settingsMenu, setSettingsMenu] = useState(null);
@@ -330,6 +335,9 @@ function VideoPlayer() {
}, [progress]); }, [progress]);
const showUpNextCard = useMemo(() => { const showUpNextCard = useMemo(() => {
if (queue[currentQueueItemIndex]?.Id === queue[queue.length - 1]?.Id) {
return false; // Check if the current playing episode is last episode in queue
}
if (introInfo?.Credits) { if (introInfo?.Credits) {
if ( if (
ticksToSec(progress) >= introInfo?.Credits.ShowSkipPromptAt && ticksToSec(progress) >= introInfo?.Credits.ShowSkipPromptAt &&
+23 -53
View File
@@ -265,7 +265,7 @@ function SearchPage() {
)} )}
{episodes.isSuccess && episodes.data.TotalRecordCount > 0 && ( {episodes.isSuccess && episodes.data.TotalRecordCount > 0 && (
<CardScroller title="Episodes" displayCards={4} disableDecoration> <CardScroller title="Episodes" displayCards={4} disableDecoration>
{episodes.data.SearchHints.map((episode) => { {episodes.data.SearchHints?.map((episode) => {
return ( return (
<EpisodeCard <EpisodeCard
key={episode.Id} key={episode.Id}
@@ -280,9 +280,9 @@ function SearchPage() {
})} })}
</CardScroller> </CardScroller>
)} )}
{audio.isSuccess && audio.data.Items.length > 0 && ( {audio.isSuccess && audio.data.Items?.length > 0 && (
<CardScroller title="Audio" displayCards={8} disableDecoration> <CardScroller title="Audio" displayCards={8} disableDecoration>
{audio.data.Items.map((item, index) => ( {audio.data.Items?.map((item, index) => (
<Card <Card
key={item.Id} key={item.Id}
item={item} item={item}
@@ -291,20 +291,14 @@ function SearchPage() {
cardCaption={item.ProductionYear} cardCaption={item.ProductionYear}
cardType="square" cardType="square"
queryKey={["search", "items", "Audio", query]} queryKey={["search", "items", "Audio", query]}
userId={user.data.Id} userId={user.data?.Id}
imageBlurhash={
!!item.ImageBlurHashes?.Primary &&
item.ImageBlurHashes?.Primary[
Object.keys(item.ImageBlurHashes.Primary)[0]
]
}
/> />
))} ))}
</CardScroller> </CardScroller>
)} )}
{musicAlbum.isSuccess && musicAlbum.data.Items.length > 0 && ( {musicAlbum.isSuccess && musicAlbum.data.Items?.length > 0 && (
<CardScroller title="Albums" displayCards={8} disableDecoration> <CardScroller title="Albums" displayCards={8} disableDecoration>
{musicAlbum.data.Items.map((item, index) => ( {musicAlbum.data.Items?.map((item, index) => (
<Card <Card
key={item.Id} key={item.Id}
item={item} item={item}
@@ -314,20 +308,14 @@ function SearchPage() {
cardCaption={item.AlbumArtist} cardCaption={item.AlbumArtist}
cardType={"square"} cardType={"square"}
queryKey={["search", "items", "MusicAlbum", query]} queryKey={["search", "items", "MusicAlbum", query]}
userId={user.data.Id} userId={user.data?.Id}
imageBlurhash={
!!item.ImageBlurHashes?.Primary &&
item.ImageBlurHashes?.Primary[
Object.keys(item.ImageBlurHashes.Primary)[0]
]
}
/> />
))} ))}
</CardScroller> </CardScroller>
)} )}
{book.isSuccess && book.data.Items.length > 0 && ( {book.isSuccess && book.data.Items?.length > 0 && (
<CardScroller title="Books" displayCards={8} disableDecoration> <CardScroller title="Books" displayCards={8} disableDecoration>
{book.data.Items.map((item, index) => ( {book.data.Items?.map((item, index) => (
<Card <Card
key={item.Id} key={item.Id}
item={item} item={item}
@@ -337,20 +325,14 @@ function SearchPage() {
disableOverlay disableOverlay
cardType={"portrait"} cardType={"portrait"}
queryKey={["search", "items", "Book", query]} queryKey={["search", "items", "Book", query]}
userId={user.data.Id} userId={user.data?.Id}
imageBlurhash={
!!item.ImageBlurHashes?.Primary &&
item.ImageBlurHashes?.Primary[
Object.keys(item.ImageBlurHashes.Primary)[0]
]
}
/> />
))} ))}
</CardScroller> </CardScroller>
)} )}
{musicArtists.isSuccess && musicArtists.data.Items.length > 0 && ( {musicArtists.isSuccess && musicArtists.data.Items?.length > 0 && (
<CardScroller title="Artists" displayCards={8} disableDecoration> <CardScroller title="Artists" displayCards={8} disableDecoration>
{musicArtists.data.Items.map((item) => ( {musicArtists.data.Items?.map((item) => (
<Card <Card
key={item.Id} key={item.Id}
item={item} item={item}
@@ -359,20 +341,14 @@ function SearchPage() {
disableOverlay disableOverlay
cardType={"square"} cardType={"square"}
queryKey={["search", "items", "MusicArtists", query]} queryKey={["search", "items", "MusicArtists", query]}
userId={user.data.Id} userId={user.data?.Id}
imageBlurhash={
!!item.ImageBlurHashes?.Primary &&
item.ImageBlurHashes?.Primary[
Object.keys(item.ImageBlurHashes.Primary)[0]
]
}
/> />
))} ))}
</CardScroller> </CardScroller>
)} )}
{person.isSuccess && person.data.Items.length > 0 && ( {person.isSuccess && person.data.Items?.length > 0 && (
<CardScroller title="People" displayCards={8} disableDecoration> <CardScroller title="People" displayCards={8} disableDecoration>
{person.data.Items.map((item) => ( {person.data.Items?.map((item) => (
<Card <Card
key={item.Id} key={item.Id}
item={item} item={item}
@@ -381,13 +357,7 @@ function SearchPage() {
disableOverlay disableOverlay
cardType={"square"} cardType={"square"}
queryKey={["search", "items", "Person", query]} queryKey={["search", "items", "Person", query]}
userId={user.data.Id} userId={user.data?.Id}
imageBlurhash={
!!item.ImageBlurHashes?.Primary &&
item.ImageBlurHashes?.Primary[
Object.keys(item.ImageBlurHashes.Primary)[0]
]
}
/> />
))} ))}
</CardScroller> </CardScroller>
@@ -401,14 +371,14 @@ function SearchPage() {
book.isSuccess && book.isSuccess &&
musicArtists.isSuccess && musicArtists.isSuccess &&
person.isSuccess && person.isSuccess &&
movies.data.Items.length === 0 && movies.data.Items?.length === 0 &&
series.data.Items.length === 0 && series.data.Items?.length === 0 &&
audio.data.Items.length === 0 && audio.data.Items?.length === 0 &&
musicAlbum.data.Items.length === 0 && musicAlbum.data.Items?.length === 0 &&
book.data.Items.length === 0 && book.data.Items?.length === 0 &&
musicArtists.data.Items.length === 0 && musicArtists.data.Items?.length === 0 &&
person.data.Items?.length === 0 && person.data.Items?.length === 0 &&
episodes.data.SearchHints?.length === 0 && ( episodes.data?.SearchHints?.length === 0 && (
<div <div
style={{ style={{
height: "calc(100vh - 12em)", height: "calc(100vh - 12em)",