Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61ebc66127 | ||
|
|
c232c1bf12 | ||
|
|
2d5f49c32e | ||
|
|
0c50acddd9 | ||
|
|
56ba65d23e |
No files matched your search
@@ -42,3 +42,6 @@ target/
|
||||
generateBanner
|
||||
# Million Lint
|
||||
.million
|
||||
|
||||
# TypeScript incremental build cache
|
||||
*.tsbuildinfo
|
||||
+56
-56
@@ -19,80 +19,80 @@
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@emotion/react": "^11.14.0",
|
||||
"@emotion/styled": "^11.14.1",
|
||||
"@fontsource-variable/jetbrains-mono": "^5.2.8",
|
||||
"@fontsource-variable/noto-sans": "^5.2.10",
|
||||
"@fontsource-variable/plus-jakarta-sans": "^5.2.8",
|
||||
"@fontsource-variable/space-grotesk": "^5.2.10",
|
||||
"@jellyfin/sdk": "0.13.0",
|
||||
"@mui/lab": "7.0.1-beta.21",
|
||||
"@mui/material": "7.3.7",
|
||||
"@fontsource-variable/jetbrains-mono": "^5.3.0",
|
||||
"@fontsource-variable/noto-sans": "^5.3.0",
|
||||
"@fontsource-variable/plus-jakarta-sans": "^5.3.0",
|
||||
"@fontsource-variable/space-grotesk": "^5.3.0",
|
||||
"@jellyfin/sdk": "1.0.1",
|
||||
"@mui/lab": "9.0.0-beta.10",
|
||||
"@mui/material": "9.5.0",
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@react-spring/web": "^10.0.3",
|
||||
"@tanem/react-nprogress": "^5.0.59",
|
||||
"@tanstack/react-form": "^1.28.0",
|
||||
"@tanstack/react-query": "^5.90.20",
|
||||
"@tanstack/react-query-devtools": "^5.91.3",
|
||||
"@tanstack/react-router": "^1.158.4",
|
||||
"@tanstack/react-router-devtools": "^1.158.4",
|
||||
"@tanstack/react-virtual": "^3.13.18",
|
||||
"@tauri-apps/api": "2.10.1",
|
||||
"@tauri-apps/plugin-clipboard-manager": "2.3.2",
|
||||
"@tauri-apps/plugin-dialog": "2.6.0",
|
||||
"@tauri-apps/plugin-global-shortcut": "~2.3.1",
|
||||
"@tauri-apps/plugin-notification": "2.3.3",
|
||||
"@tauri-apps/plugin-process": "2.3.1",
|
||||
"@tauri-apps/plugin-shell": "~2.3.5",
|
||||
"@react-spring/web": "^10.1.2",
|
||||
"@tanem/react-nprogress": "^7.1.7",
|
||||
"@tanstack/react-devtools": "^0.10.13",
|
||||
"@tanstack/react-form": "^1.33.5",
|
||||
"@tanstack/react-query": "^5.104.4",
|
||||
"@tanstack/react-query-devtools": "^5.104.4",
|
||||
"@tanstack/react-router": "^1.170.45",
|
||||
"@tanstack/react-router-devtools": "^1.167.2",
|
||||
"@tanstack/react-virtual": "^3.14.21",
|
||||
"@tauri-apps/api": "2.12.4",
|
||||
"@tauri-apps/plugin-clipboard-manager": "2.5.0",
|
||||
"@tauri-apps/plugin-dialog": "2.8.3",
|
||||
"@tauri-apps/plugin-global-shortcut": "~2.4.1",
|
||||
"@tauri-apps/plugin-notification": "2.7.0",
|
||||
"@tauri-apps/plugin-process": "2.4.0",
|
||||
"@tauri-apps/plugin-shell": "~2.5.0",
|
||||
"@tauri-apps/plugin-store": "github:tauri-apps/tauri-plugin-store#v2",
|
||||
"@tauri-apps/plugin-updater": "2.10.0",
|
||||
"@tauri-apps/plugin-upload": "2.4.0",
|
||||
"@tauri-apps/plugin-window-state": "~2.4.1",
|
||||
"@types/node": "^25.2.1",
|
||||
"@types/react": "^19.2.13",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"axios": "^1.13.4",
|
||||
"@tauri-apps/plugin-updater": "2.14.0",
|
||||
"@tauri-apps/plugin-upload": "2.5.0",
|
||||
"@tauri-apps/plugin-window-state": "~2.5.0",
|
||||
"@types/node": "^26.6.5",
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"axios": "^1.20.0",
|
||||
"axios-tauri-api-adapter": "^2.0.6",
|
||||
"blurhash": "^2.0.5",
|
||||
"blurhash-wasm": "^0.2.0",
|
||||
"immer": "^11.1.3",
|
||||
"jassub": "^2.4.1",
|
||||
"libpgs": "^0.8.1",
|
||||
"lodash": "^4.17.23",
|
||||
"material-symbols": "^0.40.2",
|
||||
"motion": "^12.33.0",
|
||||
"immer": "^11.1.21",
|
||||
"jassub": "^2.5.22",
|
||||
"libpgs": "^0.9.0",
|
||||
"lodash": "^4.18.1",
|
||||
"material-symbols": "^0.48.0",
|
||||
"motion": "^14.4.0",
|
||||
"notistack": "^3.0.2",
|
||||
"react": "^19.2.4",
|
||||
"react": "^19.3.1",
|
||||
"react-blurhash": "^0.3.0",
|
||||
"react-dnd": "^16.0.1",
|
||||
"react-dnd-html5-backend": "^16.0.1",
|
||||
"react-dom": "^19.2.4",
|
||||
"react-error-boundary": "^6.1.0",
|
||||
"react-intersection-observer": "^10.0.2",
|
||||
"react-dom": "^19.3.1",
|
||||
"react-error-boundary": "^6.1.6",
|
||||
"react-intersection-observer": "^11.0.1",
|
||||
"react-markdown": "^10.1.0",
|
||||
"react-multi-carousel": "^2.8.6",
|
||||
"react-player": "^3.4.0",
|
||||
"remark-gfm": "^4.0.1",
|
||||
"typescript": "^5.9.3",
|
||||
"vite-plugin-svgr": "^4.5.0",
|
||||
"typescript": "^7.0.2",
|
||||
"vite-plugin-svgr": "^5.2.0",
|
||||
"vite-plugin-top-level-await": "^1.6.0",
|
||||
"wavesurfer.js": "^7.12.1",
|
||||
"zod": "^4.3.6",
|
||||
"zustand": "5.0.11"
|
||||
"wavesurfer.js": "^8.0.3",
|
||||
"zod": "^4.6.7",
|
||||
"zustand": "5.0.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/plugin-proposal-optional-chaining-assign": "^7.27.1",
|
||||
"@biomejs/biome": "^2.3.14",
|
||||
"@tanstack/router-cli": "^1.158.4",
|
||||
"@tanstack/router-devtools": "^1.158.4",
|
||||
"@tanstack/router-vite-plugin": "^1.158.4",
|
||||
"@tauri-apps/cli": "2.10.0",
|
||||
"@types/lodash": "^4.17.23",
|
||||
"@vitejs/plugin-react": "^5.1.3",
|
||||
"@babel/plugin-proposal-optional-chaining-assign": "^8.0.1",
|
||||
"@biomejs/biome": "^2.5.15",
|
||||
"@tanstack/router-cli": "^1.167.45",
|
||||
"@tanstack/router-vite-plugin": "^1.167.47",
|
||||
"@tauri-apps/cli": "2.12.3",
|
||||
"@types/lodash": "^4.17.26",
|
||||
"@vitejs/plugin-react": "^6.1.2",
|
||||
"babel-plugin-react-compiler": "19.1.0-rc.3",
|
||||
"eslint-plugin-react-hooks": "7.0.1",
|
||||
"eslint-plugin-react-hooks": "7.1.1",
|
||||
"prop-types": "^15.8.1",
|
||||
"sass": "^1.97.3",
|
||||
"vite": "^7.3.1",
|
||||
"vite-plugin-wasm": "^3.5.0"
|
||||
"sass": "^1.105.2",
|
||||
"vite": "^8.3.4",
|
||||
"vite-plugin-wasm": "^3.6.0"
|
||||
},
|
||||
"license": "GPL-3.0-only"
|
||||
}
|
||||
Generated
+2959
-2633
File diff suppressed because it is too large.
Load diff
+5
-4
@@ -1,4 +1,5 @@
|
||||
onlyBuiltDependencies:
|
||||
- '@parcel/watcher'
|
||||
- core-js
|
||||
- esbuild
|
||||
allowBuilds:
|
||||
'@parcel/watcher': true
|
||||
'@swc/core': true
|
||||
core-js: true
|
||||
lfa-ponyfill: true
|
||||
Generated
+1238
-1494
File diff suppressed because it is too large.
Load diff
@@ -1 +1 @@
|
||||
{"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":{"default_permission":{"identifier":"default","description":"Default core plugins set.","permissions":["core:path:default","core:event:default","core:window:default","core:webview:default","core:app:default","core:image:default","core:resources:default","core:menu:default","core:tray:default"]},"permissions":{},"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","allow-identifier","allow-bundle-type","allow-register-listener","allow-remove-listener"]},"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-bundle-type":{"identifier":"allow-bundle-type","description":"Enables the bundle_type command without any pre-configured scope.","commands":{"allow":["bundle_type"],"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-fetch-data-store-identifiers":{"identifier":"allow-fetch-data-store-identifiers","description":"Enables the fetch_data_store_identifiers command without any pre-configured scope.","commands":{"allow":["fetch_data_store_identifiers"],"deny":[]}},"allow-identifier":{"identifier":"allow-identifier","description":"Enables the identifier command without any pre-configured scope.","commands":{"allow":["identifier"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","commands":{"allow":["name"],"deny":[]}},"allow-register-listener":{"identifier":"allow-register-listener","description":"Enables the register_listener command without any pre-configured scope.","commands":{"allow":["register_listener"],"deny":[]}},"allow-remove-data-store":{"identifier":"allow-remove-data-store","description":"Enables the remove_data_store command without any pre-configured scope.","commands":{"allow":["remove_data_store"],"deny":[]}},"allow-remove-listener":{"identifier":"allow-remove-listener","description":"Enables the remove_listener commLine 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-secret":{"identifier":"allow-write-secret","description":"Enables the write_secret command without any pre-configured scope.","commands":{"allow":["write_secret"],"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-secret":{"identifier":"deny-write-secret","description":"Denies the write_secret command without any pre-configured scope.","commands":{"allow":[],"deny":["write_secret"]}},"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":{"default_permission":{"identifier":"default","description":"Default core plugins set.","permissions":["core:path:default","core:event:default","core:window:default","core:webview:default","core:app:default","core:image:default","core:resources:default","core:menu:default","core:tray:default"]},"permissions":{},"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","allow-identifier","allow-bundle-type","allow-register-listener","allow-remove-listener","allow-supports-multiple-windows"]},"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-bundle-type":{"identifier":"allow-bundle-type","description":"Enables the bundle_type command without any pre-configured scope.","commands":{"allow":["bundle_type"],"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-exit":{"identifier":"allow-exit","description":"Enables the exit command without any pre-configured scope.","commands":{"allow":["exit"],"deny":[]}},"allow-fetch-data-store-identifiers":{"identifier":"allow-fetch-data-store-identifiers","description":"Enables the fetch_data_store_identifiers command without any pre-configured scope.","commands":{"allow":["fetch_data_store_identifiers"],"deny":[]}},"allow-identifier":{"identifier":"allow-identifier","description":"Enables the identifier command without any pre-configured scope.","commands":{"allow":["identifier"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","coLine truncated
|
||||
@@ -422,6 +422,12 @@
|
||||
"const": "clipboard-manager:allow-write-image",
|
||||
"markdownDescription": "Enables the write_image command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the write_secret command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "clipboard-manager:allow-write-secret",
|
||||
"markdownDescription": "Enables the write_secret command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the write_text command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -458,6 +464,12 @@
|
||||
"const": "clipboard-manager:deny-write-image",
|
||||
"markdownDescription": "Denies the write_image command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the write_secret command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "clipboard-manager:deny-write-secret",
|
||||
"markdownDescription": "Denies the write_secret command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the write_text command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -471,10 +483,10 @@
|
||||
"markdownDescription": "Default core plugins set.\n#### This default permission set includes:\n\n- `core:path:default`\n- `core:event:default`\n- `core:window:default`\n- `core:webview:default`\n- `core:app:default`\n- `core:image:default`\n- `core:resources:default`\n- `core:menu:default`\n- `core:tray:default`"
|
||||
},
|
||||
{
|
||||
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`",
|
||||
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-supports-multiple-windows`",
|
||||
"type": "string",
|
||||
"const": "core:app:default",
|
||||
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`"
|
||||
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-supports-multiple-windows`"
|
||||
},
|
||||
{
|
||||
"description": "Enables the app_hide command without any pre-configured scope.",
|
||||
@@ -500,6 +512,12 @@
|
||||
"const": "core:app:allow-default-window-icon",
|
||||
"markdownDescription": "Enables the default_window_icon command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the exit command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:app:allow-exit",
|
||||
"markdownDescription": "Enables the exit command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the fetch_data_store_identifiers command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -548,6 +566,12 @@
|
||||
"const": "core:app:allow-set-dock-visibility",
|
||||
"markdownDescription": "Enables the set_dock_visibility command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the supports_multiple_windows command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:app:allow-supports-multiple-windows",
|
||||
"markdownDescription": "Enables the supports_multiple_windows command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the tauri_version command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -584,6 +608,12 @@
|
||||
"const": "core:app:deny-default-window-icon",
|
||||
"markdownDescription": "Denies the default_window_icon command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the exit command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:app:deny-exit",
|
||||
"markdownDescription": "Denies the exit command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the fetch_data_store_identifiers command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -632,6 +662,12 @@
|
||||
"const": "core:app:deny-set-dock-visibility",
|
||||
"markdownDescription": "Denies the set_dock_visibility command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the supports_multiple_windows command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:app:deny-supports-multiple-windows",
|
||||
"markdownDescription": "Denies the supports_multiple_windows command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the tauri_version command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -1155,10 +1191,10 @@
|
||||
"markdownDescription": "Denies the close command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-show-menu-on-left-click`",
|
||||
"description": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-icon-with-as-template`\n- `allow-set-show-menu-on-left-click`",
|
||||
"type": "string",
|
||||
"const": "core:tray:default",
|
||||
"markdownDescription": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-show-menu-on-left-click`"
|
||||
"markdownDescription": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-icon-with-as-template`\n- `allow-set-show-menu-on-left-click`"
|
||||
},
|
||||
{
|
||||
"description": "Enables the get_by_id command without any pre-configured scope.",
|
||||
@@ -1190,6 +1226,12 @@
|
||||
"const": "core:tray:allow-set-icon-as-template",
|
||||
"markdownDescription": "Enables the set_icon_as_template command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the set_icon_with_as_template command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:tray:allow-set-icon-with-as-template",
|
||||
"markdownDescription": "Enables the set_icon_with_as_template command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the set_menu command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -1256,6 +1298,12 @@
|
||||
"const": "core:tray:deny-set-icon-as-template",
|
||||
"markdownDescription": "Denies the set_icon_as_template command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the set_icon_with_as_template command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:tray:deny-set-icon-with-as-template",
|
||||
"markdownDescription": "Denies the set_icon_with_as_template command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the set_menu command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -1515,10 +1563,16 @@
|
||||
"markdownDescription": "Denies the webview_size command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-internal-toggle-maximize`",
|
||||
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-activity-name`\n- `allow-scene-identifier`\n- `allow-internal-toggle-maximize`",
|
||||
"type": "string",
|
||||
"const": "core:window:default",
|
||||
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-internal-toggle-maximize`"
|
||||
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-activity-name`\n- `allow-scene-identifier`\n- `allow-internal-toggle-maximize`"
|
||||
},
|
||||
{
|
||||
"description": "Enables the activity_name command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:window:allow-activity-name",
|
||||
"markdownDescription": "Enables the activity_name command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the available_monitors command without any pre-configured scope.",
|
||||
@@ -1712,6 +1766,12 @@
|
||||
"const": "core:window:allow-scale-factor",
|
||||
"markdownDescription": "Enables the scale_factor command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the scene_identifier command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:window:allow-scene-identifier",
|
||||
"markdownDescription": "Enables the scene_identifier command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the set_always_on_bottom command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -1814,6 +1874,12 @@
|
||||
"const": "core:window:allow-set-fullscreen",
|
||||
"markdownDescription": "Enables the set_fullscreen command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the set_fullscreen_on_monitor command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:window:allow-set-fullscreen-on-monitor",
|
||||
"markdownDescription": "Enables the set_fullscreen_on_monitor command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the set_icon command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -1976,6 +2042,12 @@
|
||||
"const": "core:window:allow-unminimize",
|
||||
"markdownDescription": "Enables the unminimize command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the activity_name command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:window:deny-activity-name",
|
||||
"markdownDescription": "Denies the activity_name command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the available_monitors command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -2168,6 +2240,12 @@
|
||||
"const": "core:window:deny-scale-factor",
|
||||
"markdownDescription": "Denies the scale_factor command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the scene_identifier command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:window:deny-scene-identifier",
|
||||
"markdownDescription": "Denies the scene_identifier command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the set_always_on_bottom command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -2270,6 +2348,12 @@
|
||||
"const": "core:window:deny-set-fullscreen",
|
||||
"markdownDescription": "Denies the set_fullscreen command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the set_fullscreen_on_monitor command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:window:deny-set-fullscreen-on-monitor",
|
||||
"markdownDescription": "Denies the set_fullscreen_on_monitor command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the set_icon command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -2433,22 +2517,22 @@
|
||||
"markdownDescription": "Denies the unminimize command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`",
|
||||
"description": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-message`\n- `allow-save`\n- `allow-open`",
|
||||
"type": "string",
|
||||
"const": "dialog:default",
|
||||
"markdownDescription": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`"
|
||||
"markdownDescription": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-message`\n- `allow-save`\n- `allow-open`"
|
||||
},
|
||||
{
|
||||
"description": "Enables the ask command without any pre-configured scope.",
|
||||
"description": "Enables the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)",
|
||||
"type": "string",
|
||||
"const": "dialog:allow-ask",
|
||||
"markdownDescription": "Enables the ask command without any pre-configured scope."
|
||||
"markdownDescription": "Enables the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)"
|
||||
},
|
||||
{
|
||||
"description": "Enables the confirm command without any pre-configured scope.",
|
||||
"description": "Enables the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)",
|
||||
"type": "string",
|
||||
"const": "dialog:allow-confirm",
|
||||
"markdownDescription": "Enables the confirm command without any pre-configured scope."
|
||||
"markdownDescription": "Enables the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)"
|
||||
},
|
||||
{
|
||||
"description": "Enables the message command without any pre-configured scope.",
|
||||
@@ -2469,16 +2553,16 @@
|
||||
"markdownDescription": "Enables the save command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the ask command without any pre-configured scope.",
|
||||
"description": "Denies the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)",
|
||||
"type": "string",
|
||||
"const": "dialog:deny-ask",
|
||||
"markdownDescription": "Denies the ask command without any pre-configured scope."
|
||||
"markdownDescription": "Denies the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)"
|
||||
},
|
||||
{
|
||||
"description": "Denies the confirm command without any pre-configured scope.",
|
||||
"description": "Denies the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)",
|
||||
"type": "string",
|
||||
"const": "dialog:deny-confirm",
|
||||
"markdownDescription": "Denies the confirm command without any pre-configured scope."
|
||||
"markdownDescription": "Denies the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)"
|
||||
},
|
||||
{
|
||||
"description": "Denies the message command without any pre-configured scope.",
|
||||
@@ -2583,10 +2667,10 @@
|
||||
"markdownDescription": "Denies the log command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`",
|
||||
"description": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`",
|
||||
"type": "string",
|
||||
"const": "notification:default",
|
||||
"markdownDescription": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`"
|
||||
"markdownDescription": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`"
|
||||
},
|
||||
{
|
||||
"description": "Enables the batch command without any pre-configured scope.",
|
||||
@@ -2672,6 +2756,12 @@
|
||||
"const": "notification:allow-remove-active",
|
||||
"markdownDescription": "Enables the remove_active command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the remove_listener command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-remove-listener",
|
||||
"markdownDescription": "Enables the remove_listener command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the request_permission command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -2768,6 +2858,12 @@
|
||||
"const": "notification:deny-remove-active",
|
||||
"markdownDescription": "Denies the remove_active command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the remove_listener command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-remove-listener",
|
||||
"markdownDescription": "Denies the remove_listener command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the request_permission command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
|
||||
@@ -422,6 +422,12 @@
|
||||
"const": "clipboard-manager:allow-write-image",
|
||||
"markdownDescription": "Enables the write_image command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the write_secret command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "clipboard-manager:allow-write-secret",
|
||||
"markdownDescription": "Enables the write_secret command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the write_text command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -458,6 +464,12 @@
|
||||
"const": "clipboard-manager:deny-write-image",
|
||||
"markdownDescription": "Denies the write_image command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the write_secret command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "clipboard-manager:deny-write-secret",
|
||||
"markdownDescription": "Denies the write_secret command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the write_text command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -471,10 +483,10 @@
|
||||
"markdownDescription": "Default core plugins set.\n#### This default permission set includes:\n\n- `core:path:default`\n- `core:event:default`\n- `core:window:default`\n- `core:webview:default`\n- `core:app:default`\n- `core:image:default`\n- `core:resources:default`\n- `core:menu:default`\n- `core:tray:default`"
|
||||
},
|
||||
{
|
||||
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`",
|
||||
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-supports-multiple-windows`",
|
||||
"type": "string",
|
||||
"const": "core:app:default",
|
||||
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`"
|
||||
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-supports-multiple-windows`"
|
||||
},
|
||||
{
|
||||
"description": "Enables the app_hide command without any pre-configured scope.",
|
||||
@@ -500,6 +512,12 @@
|
||||
"const": "core:app:allow-default-window-icon",
|
||||
"markdownDescription": "Enables the default_window_icon command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the exit command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:app:allow-exit",
|
||||
"markdownDescription": "Enables the exit command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the fetch_data_store_identifiers command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -548,6 +566,12 @@
|
||||
"const": "core:app:allow-set-dock-visibility",
|
||||
"markdownDescription": "Enables the set_dock_visibility command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the supports_multiple_windows command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:app:allow-supports-multiple-windows",
|
||||
"markdownDescription": "Enables the supports_multiple_windows command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the tauri_version command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -584,6 +608,12 @@
|
||||
"const": "core:app:deny-default-window-icon",
|
||||
"markdownDescription": "Denies the default_window_icon command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the exit command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:app:deny-exit",
|
||||
"markdownDescription": "Denies the exit command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the fetch_data_store_identifiers command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -632,6 +662,12 @@
|
||||
"const": "core:app:deny-set-dock-visibility",
|
||||
"markdownDescription": "Denies the set_dock_visibility command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the supports_multiple_windows command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:app:deny-supports-multiple-windows",
|
||||
"markdownDescription": "Denies the supports_multiple_windows command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the tauri_version command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -1155,10 +1191,10 @@
|
||||
"markdownDescription": "Denies the close command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-show-menu-on-left-click`",
|
||||
"description": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-icon-with-as-template`\n- `allow-set-show-menu-on-left-click`",
|
||||
"type": "string",
|
||||
"const": "core:tray:default",
|
||||
"markdownDescription": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-show-menu-on-left-click`"
|
||||
"markdownDescription": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-icon-with-as-template`\n- `allow-set-show-menu-on-left-click`"
|
||||
},
|
||||
{
|
||||
"description": "Enables the get_by_id command without any pre-configured scope.",
|
||||
@@ -1190,6 +1226,12 @@
|
||||
"const": "core:tray:allow-set-icon-as-template",
|
||||
"markdownDescription": "Enables the set_icon_as_template command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the set_icon_with_as_template command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:tray:allow-set-icon-with-as-template",
|
||||
"markdownDescription": "Enables the set_icon_with_as_template command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the set_menu command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -1256,6 +1298,12 @@
|
||||
"const": "core:tray:deny-set-icon-as-template",
|
||||
"markdownDescription": "Denies the set_icon_as_template command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the set_icon_with_as_template command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:tray:deny-set-icon-with-as-template",
|
||||
"markdownDescription": "Denies the set_icon_with_as_template command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the set_menu command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -1515,10 +1563,16 @@
|
||||
"markdownDescription": "Denies the webview_size command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-internal-toggle-maximize`",
|
||||
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-activity-name`\n- `allow-scene-identifier`\n- `allow-internal-toggle-maximize`",
|
||||
"type": "string",
|
||||
"const": "core:window:default",
|
||||
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-internal-toggle-maximize`"
|
||||
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-activity-name`\n- `allow-scene-identifier`\n- `allow-internal-toggle-maximize`"
|
||||
},
|
||||
{
|
||||
"description": "Enables the activity_name command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:window:allow-activity-name",
|
||||
"markdownDescription": "Enables the activity_name command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the available_monitors command without any pre-configured scope.",
|
||||
@@ -1712,6 +1766,12 @@
|
||||
"const": "core:window:allow-scale-factor",
|
||||
"markdownDescription": "Enables the scale_factor command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the scene_identifier command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:window:allow-scene-identifier",
|
||||
"markdownDescription": "Enables the scene_identifier command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the set_always_on_bottom command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -1814,6 +1874,12 @@
|
||||
"const": "core:window:allow-set-fullscreen",
|
||||
"markdownDescription": "Enables the set_fullscreen command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the set_fullscreen_on_monitor command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:window:allow-set-fullscreen-on-monitor",
|
||||
"markdownDescription": "Enables the set_fullscreen_on_monitor command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the set_icon command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -1976,6 +2042,12 @@
|
||||
"const": "core:window:allow-unminimize",
|
||||
"markdownDescription": "Enables the unminimize command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the activity_name command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:window:deny-activity-name",
|
||||
"markdownDescription": "Denies the activity_name command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the available_monitors command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -2168,6 +2240,12 @@
|
||||
"const": "core:window:deny-scale-factor",
|
||||
"markdownDescription": "Denies the scale_factor command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the scene_identifier command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:window:deny-scene-identifier",
|
||||
"markdownDescription": "Denies the scene_identifier command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the set_always_on_bottom command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -2270,6 +2348,12 @@
|
||||
"const": "core:window:deny-set-fullscreen",
|
||||
"markdownDescription": "Denies the set_fullscreen command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the set_fullscreen_on_monitor command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "core:window:deny-set-fullscreen-on-monitor",
|
||||
"markdownDescription": "Denies the set_fullscreen_on_monitor command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the set_icon command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -2433,22 +2517,22 @@
|
||||
"markdownDescription": "Denies the unminimize command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`",
|
||||
"description": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-message`\n- `allow-save`\n- `allow-open`",
|
||||
"type": "string",
|
||||
"const": "dialog:default",
|
||||
"markdownDescription": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`"
|
||||
"markdownDescription": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-message`\n- `allow-save`\n- `allow-open`"
|
||||
},
|
||||
{
|
||||
"description": "Enables the ask command without any pre-configured scope.",
|
||||
"description": "Enables the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)",
|
||||
"type": "string",
|
||||
"const": "dialog:allow-ask",
|
||||
"markdownDescription": "Enables the ask command without any pre-configured scope."
|
||||
"markdownDescription": "Enables the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)"
|
||||
},
|
||||
{
|
||||
"description": "Enables the confirm command without any pre-configured scope.",
|
||||
"description": "Enables the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)",
|
||||
"type": "string",
|
||||
"const": "dialog:allow-confirm",
|
||||
"markdownDescription": "Enables the confirm command without any pre-configured scope."
|
||||
"markdownDescription": "Enables the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)"
|
||||
},
|
||||
{
|
||||
"description": "Enables the message command without any pre-configured scope.",
|
||||
@@ -2469,16 +2553,16 @@
|
||||
"markdownDescription": "Enables the save command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the ask command without any pre-configured scope.",
|
||||
"description": "Denies the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)",
|
||||
"type": "string",
|
||||
"const": "dialog:deny-ask",
|
||||
"markdownDescription": "Denies the ask command without any pre-configured scope."
|
||||
"markdownDescription": "Denies the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)"
|
||||
},
|
||||
{
|
||||
"description": "Denies the confirm command without any pre-configured scope.",
|
||||
"description": "Denies the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)",
|
||||
"type": "string",
|
||||
"const": "dialog:deny-confirm",
|
||||
"markdownDescription": "Denies the confirm command without any pre-configured scope."
|
||||
"markdownDescription": "Denies the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)"
|
||||
},
|
||||
{
|
||||
"description": "Denies the message command without any pre-configured scope.",
|
||||
@@ -2583,10 +2667,10 @@
|
||||
"markdownDescription": "Denies the log command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`",
|
||||
"description": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`",
|
||||
"type": "string",
|
||||
"const": "notification:default",
|
||||
"markdownDescription": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`"
|
||||
"markdownDescription": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`"
|
||||
},
|
||||
{
|
||||
"description": "Enables the batch command without any pre-configured scope.",
|
||||
@@ -2672,6 +2756,12 @@
|
||||
"const": "notification:allow-remove-active",
|
||||
"markdownDescription": "Enables the remove_active command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the remove_listener command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-remove-listener",
|
||||
"markdownDescription": "Enables the remove_listener command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the request_permission command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
@@ -2768,6 +2858,12 @@
|
||||
"const": "notification:deny-remove-active",
|
||||
"markdownDescription": "Denies the remove_active command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the remove_listener command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-remove-listener",
|
||||
"markdownDescription": "Denies the remove_listener command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the request_permission command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
|
||||
@@ -69,7 +69,8 @@ export default function AddServerDialog(props: AddServerDialogProps) {
|
||||
fullWidth
|
||||
maxWidth="sm"
|
||||
disableScrollLock={true}
|
||||
PaperProps={{
|
||||
slotProps={{
|
||||
paper: {
|
||||
sx: {
|
||||
backgroundColor: "rgba(20, 20, 30, 0.7)",
|
||||
backdropFilter: "blur(24px) saturate(180%)",
|
||||
@@ -80,10 +81,21 @@ export default function AddServerDialog(props: AddServerDialogProps) {
|
||||
borderRadius: 4,
|
||||
overflow: "hidden",
|
||||
},
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Stack
|
||||
spacing={3}
|
||||
sx={{
|
||||
p: 4,
|
||||
}}
|
||||
>
|
||||
<Stack
|
||||
spacing={1}
|
||||
sx={{
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Stack p={4} spacing={3}>
|
||||
<Stack spacing={1} alignItems="center">
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{
|
||||
@@ -93,10 +105,22 @@ export default function AddServerDialog(props: AddServerDialogProps) {
|
||||
>
|
||||
add_to_queue
|
||||
</span>
|
||||
<Typography variant="h5" fontWeight="bold" textAlign="center">
|
||||
<Typography
|
||||
variant="h5"
|
||||
sx={{
|
||||
fontWeight: "bold",
|
||||
textAlign: "center",
|
||||
}}
|
||||
>
|
||||
Connect to Server
|
||||
</Typography>
|
||||
<Typography variant="body2" color="text.secondary" textAlign="center">
|
||||
<Typography
|
||||
variant="body2"
|
||||
sx={{
|
||||
color: "text.secondary",
|
||||
textAlign: "center",
|
||||
}}
|
||||
>
|
||||
Enter your Jellyfin server address to continue
|
||||
</Typography>
|
||||
</Stack>
|
||||
@@ -136,7 +160,14 @@ export default function AddServerDialog(props: AddServerDialogProps) {
|
||||
/>
|
||||
</Box>
|
||||
|
||||
<Stack direction="row" spacing={2} justifyContent="flex-end" pt={1}>
|
||||
<Stack
|
||||
direction="row"
|
||||
spacing={2}
|
||||
sx={{
|
||||
justifyContent: "flex-end",
|
||||
pt: 1,
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
onClick={() => setAddServerDialog(false)}
|
||||
color="inherit"
|
||||
|
||||
@@ -92,7 +92,9 @@ export default function AlbumMusicTrack(props: AlbumMusicTrackProps) {
|
||||
alignItems: "center",
|
||||
gap: "0.6em",
|
||||
}}
|
||||
fontWeight={300}
|
||||
sx={{
|
||||
fontWeight: 300,
|
||||
}}
|
||||
>
|
||||
{track.HasLyrics && <img src={lyricsIcon} alt="lyrics" />}
|
||||
{track.Artists?.join(", ")}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
import { getUserViewApi } from "@jellyfin/sdk/lib/utils/api/user-view-api";
|
||||
import { Divider, Drawer, List, ListItem, ListItemButton } from "@mui/material";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import React, { useMemo } from "react";
|
||||
@@ -22,7 +22,7 @@ export const NavigationDrawer = ({ open, onClose }: NavigationDrawerProps) => {
|
||||
if (!user?.Id || !api?.accessToken) {
|
||||
return;
|
||||
}
|
||||
const libs = await getUserViewsApi(api).getUserViews({
|
||||
const libs = await getUserViewApi(api).getUserViews({
|
||||
userId: user.Id,
|
||||
});
|
||||
return libs.data;
|
||||
@@ -70,8 +70,7 @@ export const NavigationDrawer = ({ open, onClose }: NavigationDrawerProps) => {
|
||||
to="/library/$id"
|
||||
params={{ id: library.Id ?? "" }}
|
||||
icon={
|
||||
library.CollectionType &&
|
||||
getTypeIcon(library.CollectionType)
|
||||
library.CollectionType && getTypeIcon(library.CollectionType)
|
||||
}
|
||||
primary={library.Name ?? "Library"}
|
||||
onClick={onClose}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { UserItemDataDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { getUserDataApi } from "@jellyfin/sdk/lib/utils/api/user-data-api";
|
||||
import { pink } from "@mui/material/colors";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
@@ -32,14 +32,14 @@ export default function LikeButton({
|
||||
if (!itemName) return;
|
||||
if (isFavorite) {
|
||||
result = (
|
||||
await getUserLibraryApi(api).unmarkFavoriteItem({
|
||||
await getUserDataApi(api).unmarkFavoriteItem({
|
||||
userId: userId,
|
||||
itemId: itemId,
|
||||
})
|
||||
).data;
|
||||
} else if (!isFavorite) {
|
||||
result = (
|
||||
await getUserLibraryApi(api).markFavoriteItem({
|
||||
await getUserDataApi(api).markFavoriteItem({
|
||||
userId: userId,
|
||||
itemId: itemId,
|
||||
})
|
||||
@@ -80,16 +80,14 @@ export default function LikeButton({
|
||||
className="material-symbols-rounded"
|
||||
style={
|
||||
isFavorite
|
||||
? {
|
||||
//@ts-expect-error
|
||||
? ({
|
||||
"--fill": mutation.isPending ? 0 : 1,
|
||||
color: mutation.isPending ? "white" : pink.A700,
|
||||
}
|
||||
: {
|
||||
//@ts-expect-error
|
||||
} as React.CSSProperties)
|
||||
: ({
|
||||
"--fill": mutation.isPending ? 1 : 0,
|
||||
color: mutation.isPending ? pink.A700 : "white",
|
||||
}
|
||||
} as React.CSSProperties)
|
||||
}
|
||||
>
|
||||
favorite
|
||||
|
||||
@@ -6,7 +6,7 @@ import { green } from "@mui/material/colors";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
||||
import { getUserDataApi } from "@jellyfin/sdk/lib/utils/api/user-data-api";
|
||||
import { useSnackbar } from "notistack";
|
||||
|
||||
export default function MarkPlayedButton({
|
||||
@@ -36,12 +36,12 @@ export default function MarkPlayedButton({
|
||||
if (!itemName) return;
|
||||
|
||||
if (!isPlayed) {
|
||||
result = await getPlaystateApi(api).markPlayedItem({
|
||||
result = await getUserDataApi(api).markPlayedItem({
|
||||
userId: userId,
|
||||
itemId: itemId,
|
||||
});
|
||||
} else if (isPlayed) {
|
||||
result = await getPlaystateApi(api).markUnplayedItem({
|
||||
result = await getUserDataApi(api).markUnplayedItem({
|
||||
userId: userId,
|
||||
itemId: itemId,
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
type BaseItemDto,
|
||||
BaseItemKind,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||
import { getShowApi } from "@jellyfin/sdk/lib/utils/api/show-api";
|
||||
import type { SxProps } from "@mui/material";
|
||||
import Button, { type ButtonProps } from "@mui/material/Button";
|
||||
import Fab from "@mui/material/Fab";
|
||||
@@ -213,7 +213,7 @@ const PlayButton = ({
|
||||
if (!item.Id) {
|
||||
throw new Error("Item ID is not available");
|
||||
}
|
||||
const seasons = await getTvShowsApi(api).getSeasons({
|
||||
const seasons = await getShowApi(api).getSeasons({
|
||||
seriesId: item.Id,
|
||||
userId: userId,
|
||||
enableUserData: true,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
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 React from "react";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { playItemFromQueue } from "@/utils/store/playback";
|
||||
import useQueue, { getNextTrackIndex } from "@/utils/store/queue";
|
||||
|
||||
const PlayNextButton = () => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
@@ -19,18 +19,18 @@ const PlayNextButton = () => {
|
||||
});
|
||||
const handlePlayNext = useMutation({
|
||||
mutationKey: ["playNextButton"],
|
||||
mutationFn: () => playItemFromQueue("next", user.data?.Id, api),
|
||||
mutationFn: async () => {
|
||||
const nextIndex = getNextTrackIndex();
|
||||
if (nextIndex === undefined) return;
|
||||
return playItemFromQueue(nextIndex, user.data?.Id, api);
|
||||
},
|
||||
onError: (error) => console.error(error),
|
||||
});
|
||||
const [queueItems, currentItemIndex] = useQueue((state) => [
|
||||
state.tracks,
|
||||
state.currentItemIndex,
|
||||
]);
|
||||
// Re-render when the queue position or repeat mode changes.
|
||||
useQueue((state) => [state.tracks, state.currentItemIndex, state.repeatMode]);
|
||||
const hasNext = getNextTrackIndex() !== undefined;
|
||||
return (
|
||||
<IconButton
|
||||
disabled={queueItems?.length === currentItemIndex + 1}
|
||||
onClick={() => handlePlayNext.mutate()}
|
||||
>
|
||||
<IconButton disabled={!hasNext} onClick={() => handlePlayNext.mutate()}>
|
||||
<span className="material-symbols-rounded">skip_next</span>
|
||||
</IconButton>
|
||||
);
|
||||
|
||||
@@ -1,380 +1,31 @@
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import {
|
||||
Box,
|
||||
Drawer,
|
||||
IconButton,
|
||||
List,
|
||||
Tooltip,
|
||||
Typography,
|
||||
} from "@mui/material";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import React, { useMemo, useState } from "react";
|
||||
import { playItemFromQueue } from "@/utils/store/playback";
|
||||
import useQueue, {
|
||||
clearUpcoming,
|
||||
removeFromQueue,
|
||||
reorderQueue,
|
||||
shuffleUpcoming,
|
||||
} from "@/utils/store/queue";
|
||||
import "./queueButton.scss";
|
||||
import {
|
||||
closestCenter,
|
||||
DndContext,
|
||||
type DragEndEvent,
|
||||
KeyboardSensor,
|
||||
PointerSensor,
|
||||
useSensor,
|
||||
useSensors,
|
||||
} from "@dnd-kit/core";
|
||||
import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
|
||||
import {
|
||||
arrayMove,
|
||||
SortableContext,
|
||||
sortableKeyboardCoordinates,
|
||||
useSortable,
|
||||
verticalListSortingStrategy,
|
||||
} from "@dnd-kit/sortable";
|
||||
import { CSS } from "@dnd-kit/utilities";
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import QueueListItem from "../queueListItem";
|
||||
|
||||
function SortableQueueItem({
|
||||
item,
|
||||
onDelete,
|
||||
onPlay,
|
||||
index,
|
||||
}: {
|
||||
item: BaseItemDto;
|
||||
onDelete: () => void;
|
||||
onPlay: () => void;
|
||||
index: number;
|
||||
}) {
|
||||
const {
|
||||
attributes,
|
||||
listeners,
|
||||
setNodeRef,
|
||||
transform,
|
||||
transition,
|
||||
isDragging,
|
||||
} = useSortable({ id: item.Id || "" });
|
||||
|
||||
const style = {
|
||||
transform: CSS.Transform.toString(transform),
|
||||
transition,
|
||||
opacity: isDragging ? 0.5 : 1,
|
||||
position: "relative" as const,
|
||||
zIndex: isDragging ? 2 : 1,
|
||||
};
|
||||
|
||||
return (
|
||||
<div ref={setNodeRef} style={style}>
|
||||
<QueueListItem
|
||||
queueItem={item}
|
||||
onDelete={onDelete}
|
||||
onPlay={onPlay}
|
||||
dragHandleProps={{ ...attributes, ...listeners }}
|
||||
isEpisode={item.Type === "Episode"}
|
||||
index={index}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
import Drawer from "@mui/material/Drawer";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import React, { useState } from "react";
|
||||
import QueueView from "@/components/queue/queueView";
|
||||
|
||||
/** Opens the play queue in a side drawer. */
|
||||
const QueueButton = () => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
|
||||
const [queueItems, currentItemIndex] = useQueue((state) => [
|
||||
state.tracks,
|
||||
state.currentItemIndex,
|
||||
]);
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["currentUser"],
|
||||
queryFn: async () => {
|
||||
if (!api) throw new Error("API not available");
|
||||
return (await getUserApi(api).getCurrentUser()).data;
|
||||
},
|
||||
enabled: !!api,
|
||||
});
|
||||
|
||||
const sensors = useSensors(
|
||||
useSensor(PointerSensor),
|
||||
useSensor(KeyboardSensor, {
|
||||
coordinateGetter: sortableKeyboardCoordinates,
|
||||
}),
|
||||
);
|
||||
|
||||
const upcomingItems = useMemo(() => {
|
||||
return queueItems ? queueItems.slice(currentItemIndex + 1) : [];
|
||||
}, [queueItems, currentItemIndex]);
|
||||
|
||||
const upcomingIds = useMemo(() => {
|
||||
return upcomingItems.map((item) => item.Id || "");
|
||||
}, [upcomingItems]);
|
||||
|
||||
const handleDragEnd = (event: DragEndEvent) => {
|
||||
const { active, over } = event;
|
||||
|
||||
if (active.id !== over?.id && queueItems) {
|
||||
const oldIndex = upcomingItems.findIndex(
|
||||
(item) => item.Id === active.id,
|
||||
);
|
||||
const newIndex = upcomingItems.findIndex(
|
||||
(item) => item.Id === over?.id,
|
||||
);
|
||||
|
||||
if (oldIndex !== -1 && newIndex !== -1) {
|
||||
const newUpcoming = arrayMove(upcomingItems, oldIndex, newIndex);
|
||||
const newQueue = [
|
||||
...queueItems.slice(0, currentItemIndex + 1),
|
||||
...newUpcoming,
|
||||
];
|
||||
reorderQueue(newQueue);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleDelete = (index: number) => {
|
||||
removeFromQueue(index);
|
||||
};
|
||||
|
||||
const handlePlay = (index: number) => {
|
||||
playItemFromQueue(index, user.data?.Id, api);
|
||||
};
|
||||
|
||||
const handleClear = () => {
|
||||
clearUpcoming();
|
||||
};
|
||||
|
||||
const handleShuffle = () => {
|
||||
shuffleUpcoming();
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Tooltip title="Queue">
|
||||
<IconButton onClick={() => setOpen(true)} aria-label="Open queue">
|
||||
<span className="material-symbols-rounded">queue_music</span>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Drawer
|
||||
anchor="right"
|
||||
open={open}
|
||||
onClose={() => setOpen(false)}
|
||||
PaperProps={{
|
||||
className: "glass",
|
||||
sx: {
|
||||
width: 450,
|
||||
maxWidth: "100%",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
borderLeft: "1px solid rgba(255, 255, 255, 0.08)",
|
||||
},
|
||||
}}
|
||||
ModalProps={{
|
||||
BackdropProps: {
|
||||
sx: {
|
||||
backgroundColor: "rgba(0, 0, 0, 0.2)",
|
||||
backdropFilter: "blur(4px)",
|
||||
},
|
||||
},
|
||||
slotProps={{
|
||||
backdrop: { sx: { backgroundColor: "rgb(0 0 0 / 0.3)" } },
|
||||
paper: { className: "queue-drawer-paper" },
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
p={3}
|
||||
display="flex"
|
||||
justifyContent="space-between"
|
||||
alignItems="center"
|
||||
sx={{
|
||||
position: "sticky",
|
||||
top: 0,
|
||||
zIndex: 20,
|
||||
borderBottom: "1px solid",
|
||||
borderColor: "rgba(255, 255, 255, 0.08)",
|
||||
backgroundColor: "rgba(20, 20, 30, 0.4)",
|
||||
backdropFilter: "blur(12px)",
|
||||
}}
|
||||
>
|
||||
<Box display="flex" alignItems="center" gap={1}>
|
||||
<Typography variant="h5" fontWeight="bold">
|
||||
Play Queue
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="caption"
|
||||
color="text.secondary"
|
||||
sx={{
|
||||
ml: 1,
|
||||
fontWeight: 600,
|
||||
bgcolor: "rgba(255, 255, 255, 0.08)",
|
||||
px: 1,
|
||||
py: 0.5,
|
||||
borderRadius: 2,
|
||||
}}
|
||||
>
|
||||
{queueItems?.length || 0}
|
||||
</Typography>
|
||||
</Box>
|
||||
<Box display="flex" gap={0.5}>
|
||||
<Tooltip title="Shuffle Upcoming">
|
||||
<span>
|
||||
<IconButton
|
||||
onClick={handleShuffle}
|
||||
size="small"
|
||||
disabled={upcomingItems.length < 2}
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
shuffle
|
||||
</span>
|
||||
</IconButton>
|
||||
</span>
|
||||
</Tooltip>
|
||||
<Tooltip title="Clear Upcoming">
|
||||
<span>
|
||||
<IconButton
|
||||
onClick={handleClear}
|
||||
size="small"
|
||||
disabled={upcomingItems.length === 0}
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
clear_all
|
||||
</span>
|
||||
</IconButton>
|
||||
</span>
|
||||
</Tooltip>
|
||||
<IconButton onClick={() => setOpen(false)} size="small">
|
||||
<span className="material-symbols-rounded">close</span>
|
||||
</IconButton>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
overflowY: "auto",
|
||||
flex: 1,
|
||||
p: 2,
|
||||
"&::-webkit-scrollbar": { width: 8 },
|
||||
"&::-webkit-scrollbar-track": { background: "transparent" },
|
||||
"&::-webkit-scrollbar-thumb": {
|
||||
background: "rgba(128,128,128,0.2)",
|
||||
borderRadius: 4,
|
||||
},
|
||||
"&::-webkit-scrollbar-thumb:hover": {
|
||||
background: "rgba(128,128,128,0.3)",
|
||||
},
|
||||
}}
|
||||
>
|
||||
{queueItems && queueItems.length > 0 ? (
|
||||
<List disablePadding>
|
||||
{/* Current Item */}
|
||||
{queueItems[currentItemIndex] && (
|
||||
<Box sx={{ mb: 4 }}>
|
||||
<Typography
|
||||
variant="overline"
|
||||
sx={{
|
||||
display: "block",
|
||||
opacity: 0.6,
|
||||
mb: 1,
|
||||
fontWeight: 600,
|
||||
letterSpacing: 1.2,
|
||||
}}
|
||||
>
|
||||
NOW PLAYING
|
||||
</Typography>
|
||||
<Box
|
||||
sx={{
|
||||
bgcolor: "background.paper",
|
||||
borderRadius: 3,
|
||||
overflow: "hidden",
|
||||
boxShadow: 4,
|
||||
border: "1px solid",
|
||||
borderColor: "divider",
|
||||
}}
|
||||
>
|
||||
<QueueListItem
|
||||
queueItem={queueItems[currentItemIndex]}
|
||||
active={true}
|
||||
isEpisode={
|
||||
queueItems[currentItemIndex].Type === "Episode"
|
||||
}
|
||||
index={currentItemIndex + 1}
|
||||
/>
|
||||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{/* Upcoming Items */}
|
||||
{upcomingItems.length > 0 && (
|
||||
<>
|
||||
<Typography
|
||||
variant="overline"
|
||||
sx={{
|
||||
display: "block",
|
||||
opacity: 0.6,
|
||||
mb: 1,
|
||||
fontWeight: 600,
|
||||
letterSpacing: 1.2,
|
||||
}}
|
||||
>
|
||||
NEXT UP
|
||||
</Typography>
|
||||
<DndContext
|
||||
sensors={sensors}
|
||||
collisionDetection={closestCenter}
|
||||
onDragEnd={handleDragEnd}
|
||||
modifiers={[restrictToVerticalAxis]}
|
||||
>
|
||||
<SortableContext
|
||||
items={upcomingIds}
|
||||
strategy={verticalListSortingStrategy}
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: 1,
|
||||
}}
|
||||
>
|
||||
{upcomingItems.map((item, index) => (
|
||||
<SortableQueueItem
|
||||
key={item.Id || index}
|
||||
item={item}
|
||||
onDelete={() =>
|
||||
handleDelete(currentItemIndex + 1 + index)
|
||||
}
|
||||
onPlay={() =>
|
||||
handlePlay(currentItemIndex + 1 + index)
|
||||
}
|
||||
index={currentItemIndex + 1 + index + 1}
|
||||
/>
|
||||
))}
|
||||
</Box>
|
||||
</SortableContext>
|
||||
</DndContext>
|
||||
</>
|
||||
)}
|
||||
</List>
|
||||
) : (
|
||||
<Box
|
||||
p={4}
|
||||
textAlign="center"
|
||||
display="flex"
|
||||
flexDirection="column"
|
||||
alignItems="center"
|
||||
gap={2}
|
||||
sx={{ opacity: 0.5 }}
|
||||
>
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{ fontSize: 48 }}
|
||||
>
|
||||
queue_music
|
||||
</span>
|
||||
<Typography>Your queue is empty</Typography>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
<QueueView variant="drawer" onClose={() => setOpen(false)} />
|
||||
</Drawer>
|
||||
<IconButton onClick={() => setOpen(true)}>
|
||||
<span className="material-symbols-rounded">playlist_play</span>
|
||||
</IconButton>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { getQuickConnectApi } from "@jellyfin/sdk/lib/utils/api/quick-connect-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getAuthenticationApi } from "@jellyfin/sdk/lib/utils/api/authentication-api";
|
||||
import { LoadingButton, type LoadingButtonProps } from "@mui/lab";
|
||||
import {
|
||||
Button,
|
||||
@@ -15,7 +14,7 @@ import {
|
||||
} from "@mui/material";
|
||||
import type { TransitionProps } from "@mui/material/transitions";
|
||||
import { skipToken, useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { useNavigate } from "@tanstack/react-router";
|
||||
import { useNavigate, useRouter } from "@tanstack/react-router";
|
||||
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
|
||||
import { useSnackbar } from "notistack";
|
||||
import React, { useCallback, useState } from "react";
|
||||
@@ -56,11 +55,12 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
|
||||
};
|
||||
|
||||
const navigate = useNavigate();
|
||||
const router = useRouter();
|
||||
|
||||
const quickConnectEnabled = useQuery({
|
||||
queryKey: ["quick-connect-button", "check-quick-connect-enabled"],
|
||||
queryFn: api
|
||||
? async () => await getQuickConnectApi(api).getQuickConnectEnabled()
|
||||
? async () => await getAuthenticationApi(api).getQuickConnectEnabled()
|
||||
: skipToken,
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
@@ -74,24 +74,26 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
|
||||
mutationKey: ["quick-connect-button", "authenticate-user"],
|
||||
mutationFn: async () => {
|
||||
if (api && quickConnectSecret) {
|
||||
return await getUserApi(api).authenticateWithQuickConnect(
|
||||
return await getAuthenticationApi(api).authenticateWithQuickConnect(
|
||||
{ quickConnectDto: { Secret: quickConnectSecret } },
|
||||
{ headers },
|
||||
);
|
||||
}
|
||||
},
|
||||
onSuccess: (result) => {
|
||||
if (api && result?.data?.AccessToken && result.data.User?.Name) {
|
||||
onSuccess: async (result) => {
|
||||
const { AccessToken, User } = result?.data ?? {};
|
||||
if (api && AccessToken && User?.Name && User.Id) {
|
||||
setCheckForQuickConnect(false);
|
||||
// saveUser({ username, password, rememberMe: rememberUser });
|
||||
enqueueSnackbar(`Logged in as ${result.data.User?.Name}!`, {
|
||||
enqueueSnackbar(`Logged in as ${User.Name}!`, {
|
||||
variant: "success",
|
||||
});
|
||||
createApi(api.basePath, result.data.AccessToken);
|
||||
createApi(api.basePath, AccessToken);
|
||||
if (rememberUser) {
|
||||
saveUser(result.data.User?.Name, result.data.AccessToken);
|
||||
await saveUser(User.Name, AccessToken, User.Id);
|
||||
}
|
||||
router.invalidate().finally(() => {
|
||||
navigate({ to: "/home", replace: true });
|
||||
});
|
||||
}
|
||||
},
|
||||
onError: (error) => {
|
||||
@@ -104,7 +106,7 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
|
||||
mutationFn: async (secret: string) =>
|
||||
api &&
|
||||
(
|
||||
await getQuickConnectApi(api).getQuickConnectState(
|
||||
await getAuthenticationApi(api).getQuickConnectState(
|
||||
{ secret },
|
||||
{ headers },
|
||||
)
|
||||
@@ -127,7 +129,9 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
|
||||
});
|
||||
}
|
||||
if (api) {
|
||||
return await getQuickConnectApi(api).initiateQuickConnect({ headers });
|
||||
return await getAuthenticationApi(api).initiateQuickConnect({
|
||||
headers,
|
||||
});
|
||||
}
|
||||
},
|
||||
onSuccess: (result) => {
|
||||
@@ -173,7 +177,7 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
|
||||
(quickConnectCode && !checkQuickConnectStatus.data?.Authenticated),
|
||||
)}
|
||||
variant={props.variant ?? "contained"}
|
||||
onClick={initQuickConnect.mutate}
|
||||
onClick={() => initQuickConnect.mutate()}
|
||||
>
|
||||
{quickConnectEnabled.data?.data
|
||||
? "Use Quick Connect"
|
||||
@@ -184,8 +188,12 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
|
||||
onClose={handleQuickConnectClose}
|
||||
fullWidth
|
||||
maxWidth="xs"
|
||||
TransitionComponent={Transition}
|
||||
PaperProps={{ className: "glass", sx: { borderRadius: "24px" } }}
|
||||
slots={{
|
||||
transition: Transition,
|
||||
}}
|
||||
slotProps={{
|
||||
paper: { className: "glass", sx: { borderRadius: "24px" } },
|
||||
}}
|
||||
>
|
||||
<DialogContent
|
||||
style={{
|
||||
@@ -196,10 +204,12 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
|
||||
>
|
||||
<Typography
|
||||
variant="h5"
|
||||
mb={2}
|
||||
style={{
|
||||
width: "100%",
|
||||
}}
|
||||
sx={{
|
||||
mb: 2,
|
||||
}}
|
||||
>
|
||||
Quick Connect Code:
|
||||
</Typography>
|
||||
@@ -214,14 +224,6 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
|
||||
<Typography
|
||||
variant="h3"
|
||||
color="textPrimary"
|
||||
textAlign="center"
|
||||
sx={{
|
||||
background: "rgb(255 255 255 / 0.1)",
|
||||
width: "fit-content",
|
||||
padding: "0.4em",
|
||||
borderRadius: "10px",
|
||||
cursor: "pointer",
|
||||
}}
|
||||
onClick={async () => {
|
||||
quickConnectCode && (await writeText(quickConnectCode));
|
||||
enqueueSnackbar("Quick Connect Code copied!", {
|
||||
@@ -229,6 +231,14 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
|
||||
key: "copiedText",
|
||||
});
|
||||
}}
|
||||
sx={{
|
||||
textAlign: "center",
|
||||
background: "rgb(255 255 255 / 0.1)",
|
||||
width: "fit-content",
|
||||
padding: "0.4em",
|
||||
borderRadius: "10px",
|
||||
cursor: "pointer",
|
||||
}}
|
||||
>
|
||||
{quickConnectCode}
|
||||
</Typography>
|
||||
|
||||
@@ -22,18 +22,20 @@ const TrailerButton = (props: TrailerButtonType) => {
|
||||
maxWidth="md"
|
||||
fullWidth
|
||||
open={dialog}
|
||||
PaperProps={{
|
||||
onClose={() => setDialog(false)}
|
||||
slotProps={{
|
||||
paper: {
|
||||
className: "glass",
|
||||
style: {
|
||||
overflow: "hidden",
|
||||
},
|
||||
},
|
||||
}}
|
||||
onClose={() => setDialog(false)}
|
||||
>
|
||||
{props.trailerItem[0]?.Url && (
|
||||
<ReactPlayer
|
||||
playing={false}
|
||||
url={props.trailerItem[0]?.Url}
|
||||
src={props.trailerItem[0]?.Url}
|
||||
width="100%"
|
||||
height="auto"
|
||||
style={{
|
||||
|
||||
@@ -16,6 +16,7 @@ import MarkPlayedButton from "../buttons/markPlayedButton";
|
||||
import PlayButton from "../buttons/playButton";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
import "./card.scss";
|
||||
import { getItemLinkOptions } from "@/utils/navigation/itemLink";
|
||||
|
||||
interface CardProps {
|
||||
item: BaseItemDto;
|
||||
@@ -57,32 +58,7 @@ const CardContent = ({
|
||||
|
||||
const defaultOnClick = useCallback(() => {
|
||||
if (item?.Id) {
|
||||
switch (item?.Type) {
|
||||
case BaseItemKind.BoxSet:
|
||||
navigate({ to: "/boxset/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Episode:
|
||||
navigate({ to: "/episode/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicAlbum:
|
||||
navigate({ to: "/album/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicArtist:
|
||||
navigate({ to: "/artist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Person:
|
||||
navigate({ to: "/person/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Series:
|
||||
navigate({ to: "/series/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Playlist:
|
||||
navigate({ to: "/playlist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
default:
|
||||
navigate({ to: "/item/$id", params: { id: item.Id } });
|
||||
break;
|
||||
}
|
||||
navigate(getItemLinkOptions(item.Id, item?.Type));
|
||||
}
|
||||
}, [item?.Id, item?.Type, navigate]);
|
||||
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
import React, { type ReactNode, useRef, useState } from "react";
|
||||
import Carousel from "react-multi-carousel";
|
||||
import CarouselModule from "react-multi-carousel";
|
||||
import "react-multi-carousel/lib/styles.css";
|
||||
|
||||
// react-multi-carousel is CJS with `exports.default`; Vite 8 hands default imports the whole
|
||||
// `module.exports`, so unwrap `.default` when present.
|
||||
const Carousel = ((
|
||||
CarouselModule as unknown as { default?: typeof CarouselModule }
|
||||
).default ?? CarouselModule) as typeof CarouselModule;
|
||||
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { green, red, yellow } from "@mui/material/colors";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { useNavigate } from "@tanstack/react-router";
|
||||
import { motion } from "motion/react";
|
||||
import { motion, type Variants } from "motion/react";
|
||||
import React from "react";
|
||||
import { endsAt, getRuntime } from "@/utils/date/time";
|
||||
|
||||
@@ -19,8 +19,12 @@ import LikeButton from "../buttons/likeButton";
|
||||
import MarkPlayedButton from "../buttons/markPlayedButton";
|
||||
import PlayButton from "../buttons/playButton";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
import { getItemLinkOptions } from "@/utils/navigation/itemLink";
|
||||
|
||||
const textVariants = {
|
||||
const MotionTypography = motion.create(Typography);
|
||||
const MotionStack = motion.create(Stack);
|
||||
|
||||
const textVariants: Variants = {
|
||||
initial: (direction: string) => ({
|
||||
x: direction === "right" ? 40 : -40,
|
||||
opacity: 0,
|
||||
@@ -30,7 +34,7 @@ const textVariants = {
|
||||
opacity: 1,
|
||||
transition: {
|
||||
duration: 0.35,
|
||||
ease: [0.2, 0, 0, 1],
|
||||
ease: [0.2, 0, 0, 1] as const,
|
||||
},
|
||||
},
|
||||
exit: (direction: string) => ({
|
||||
@@ -51,32 +55,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||
|
||||
const handleMoreInfo = () => {
|
||||
if (item.Id) {
|
||||
switch (item.Type) {
|
||||
case BaseItemKind.BoxSet:
|
||||
navigate({ to: "/boxset/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Episode:
|
||||
navigate({ to: "/episode/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicAlbum:
|
||||
navigate({ to: "/album/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicArtist:
|
||||
navigate({ to: "/artist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Person:
|
||||
navigate({ to: "/person/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Series:
|
||||
navigate({ to: "/series/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Playlist:
|
||||
navigate({ to: "/playlist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
default:
|
||||
navigate({ to: "/item/$id", params: { id: item.Id } });
|
||||
break;
|
||||
}
|
||||
navigate(getItemLinkOptions(item.Id, item.Type));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -134,19 +113,17 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||
},
|
||||
}}
|
||||
>
|
||||
{/* @ts-ignore */}
|
||||
<Typography
|
||||
component={motion.div}
|
||||
<MotionTypography
|
||||
custom={animationDirection}
|
||||
variants={textVariants}
|
||||
key={item.Id}
|
||||
variant="h2"
|
||||
className="hero-carousel-text"
|
||||
sx={{
|
||||
fontWeight: 600,
|
||||
overflow: "visible",
|
||||
mb: "5px",
|
||||
}}
|
||||
fontWeight={600}
|
||||
overflow="visible"
|
||||
>
|
||||
{!item.ImageTags?.Logo ? (
|
||||
item.Name
|
||||
@@ -165,18 +142,18 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Typography>
|
||||
{/* @ts-ignore */}
|
||||
<Stack
|
||||
component={motion.div}
|
||||
</MotionTypography>
|
||||
<MotionStack
|
||||
custom={animationDirection}
|
||||
variants={textVariants}
|
||||
direction="row"
|
||||
gap={2}
|
||||
className="hero-carousel-info"
|
||||
mt={1}
|
||||
justifyItems="flex-start"
|
||||
alignItems="center"
|
||||
sx={{
|
||||
gap: 2,
|
||||
mt: 1,
|
||||
justifyItems: "flex-start",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
{item.PremiereDate && (
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||
@@ -258,29 +235,29 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||
<Typography variant="subtitle2" style={{ opacity: 0.8 }}>
|
||||
{item.Genres?.slice(0, 4).join(" / ")}
|
||||
</Typography>
|
||||
</Stack>
|
||||
{/* @ts-ignore */}
|
||||
<Typography
|
||||
component={motion.div}
|
||||
</MotionStack>
|
||||
<MotionTypography
|
||||
custom={animationDirection}
|
||||
variants={textVariants}
|
||||
className="hero-carousel-overview"
|
||||
variant="body1"
|
||||
fontWeight={400}
|
||||
sx={{
|
||||
fontWeight: 400,
|
||||
}}
|
||||
>
|
||||
{item.Overview}
|
||||
</Typography>
|
||||
</MotionTypography>
|
||||
|
||||
{/* @ts-ignore */}
|
||||
<Stack
|
||||
<MotionStack
|
||||
direction="row"
|
||||
gap={2}
|
||||
width="100%"
|
||||
className="hero-carousel-button-container"
|
||||
alignItems="center"
|
||||
component={motion.div}
|
||||
custom={animationDirection}
|
||||
variants={textVariants}
|
||||
sx={{
|
||||
gap: 2,
|
||||
width: "100%",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<PlayButton
|
||||
item={item}
|
||||
@@ -318,7 +295,12 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||
>
|
||||
More info
|
||||
</Button>
|
||||
<Stack direction="row" gap={1}>
|
||||
<Stack
|
||||
direction="row"
|
||||
sx={{
|
||||
gap: 1,
|
||||
}}
|
||||
>
|
||||
<LikeButton
|
||||
itemId={item.Id}
|
||||
queryKey={["home", "latestMedia"]}
|
||||
@@ -334,7 +316,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||
itemName={item.Name}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</MotionStack>
|
||||
</motion.div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { getGenresApi } from "@jellyfin/sdk/lib/utils/api/genres-api";
|
||||
import { getMusicGenresApi } from "@jellyfin/sdk/lib/utils/api/music-genres-api";
|
||||
import { getGenreApi } from "@jellyfin/sdk/lib/utils/api/genre-api";
|
||||
import {
|
||||
Accordion,
|
||||
AccordionDetails,
|
||||
@@ -110,13 +109,13 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
|
||||
queryFn: async () => {
|
||||
if (!api || !user?.Id || !currentLibraryId) return { Items: [] } as any;
|
||||
if (String(collectionType || "").toLowerCase() === "music") {
|
||||
const res = await getMusicGenresApi(api).getMusicGenres({
|
||||
const res = await getGenreApi(api).getGenres({
|
||||
parentId: currentLibraryId,
|
||||
userId: user.Id,
|
||||
});
|
||||
return res.data;
|
||||
}
|
||||
const res = await getGenresApi(api).getGenres({
|
||||
const res = await getGenreApi(api).getGenres({
|
||||
parentId: currentLibraryId,
|
||||
userId: user.Id,
|
||||
});
|
||||
@@ -170,7 +169,9 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
|
||||
fullWidth
|
||||
maxWidth="sm"
|
||||
keepMounted
|
||||
PaperProps={{ className: "glass-dialog-paper" }}
|
||||
slotProps={{
|
||||
paper: { className: "glass-dialog-paper" },
|
||||
}}
|
||||
>
|
||||
<DialogTitle>Filters</DialogTitle>
|
||||
<DialogContent
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Link, Typography } from "@mui/material";
|
||||
import { Link, Tooltip } from "@mui/material";
|
||||
import React, { memo } from "react";
|
||||
|
||||
import anidbIcon from "../../assets/icons/anidb.png";
|
||||
@@ -12,54 +12,49 @@ import tmdbIcon from "../../assets/icons/themoviedatabase.svg";
|
||||
import traktIcon from "../../assets/icons/trakt.svg";
|
||||
import tvMazeIcon from "../../assets/icons/tvmaze.png";
|
||||
|
||||
const knownIcons = [
|
||||
"imdb",
|
||||
"themoviedb",
|
||||
"trakt",
|
||||
"musicbrainz",
|
||||
"thetvdb",
|
||||
"anidb",
|
||||
"anilist",
|
||||
"tvmaze",
|
||||
"theaudiodb",
|
||||
"kitsu",
|
||||
/**
|
||||
* Provider icons keyed by the start of the normalized link name, so variants like
|
||||
* "TMDB"/"TheMovieDb", "TVDB"/"TheTVDB" or "MusicBrainz Artist" all match.
|
||||
*/
|
||||
const providerIcons: [prefixes: string[], icon: string][] = [
|
||||
[["imdb"], imdbIcon],
|
||||
[["tmdb", "themoviedb"], tmdbIcon],
|
||||
[["tvdb", "thetvdb"], tvDbIcon],
|
||||
[["trakt"], traktIcon],
|
||||
[["musicbrainz"], musicBrainzIcon],
|
||||
[["anidb"], anidbIcon],
|
||||
[["anilist"], anilistIcon],
|
||||
[["tvmaze"], tvMazeIcon],
|
||||
[["theaudiodb", "audiodb"], audioDBIcon],
|
||||
[["kitsu"], kitsuIcon],
|
||||
];
|
||||
|
||||
const getProviderIcon = (name: string) => {
|
||||
const normalized = name.toLocaleLowerCase().replace(/[^a-z0-9]/g, "");
|
||||
return providerIcons.find(([prefixes]) =>
|
||||
prefixes.some((prefix) => normalized.startsWith(prefix)),
|
||||
)?.[1];
|
||||
};
|
||||
|
||||
const IconLink = memo(({ name, url }: { name: string; url: string }) => {
|
||||
const icon = getProviderIcon(name);
|
||||
return (
|
||||
<Link target="_blank" href={url} className="item-detail-link">
|
||||
{name.toLocaleLowerCase() === "imdb" && <img src={imdbIcon} alt="IMDb" />}
|
||||
{name.toLocaleLowerCase() === "themoviedb" && (
|
||||
<img src={tmdbIcon} alt="TheMovieDb" />
|
||||
)}
|
||||
{name.toLocaleLowerCase() === "trakt" && (
|
||||
<img src={traktIcon} alt="Trakt" />
|
||||
)}
|
||||
{name.toLocaleLowerCase() === "musicbrainz" && (
|
||||
<img src={musicBrainzIcon} alt="MusicBrainz" />
|
||||
)}
|
||||
{name.toLocaleLowerCase() === "thetvdb" && (
|
||||
<img src={tvDbIcon} alt="TheTVDB" />
|
||||
)}
|
||||
{name.toLocaleLowerCase() === "anidb" && (
|
||||
<img src={anidbIcon} alt="AniDB" />
|
||||
)}
|
||||
{name.toLocaleLowerCase() === "anilist" && (
|
||||
<img src={anilistIcon} alt="AniList" />
|
||||
)}
|
||||
{name.toLocaleLowerCase() === "tvmaze" && (
|
||||
<img src={tvMazeIcon} alt="TVMaze" />
|
||||
)}
|
||||
{name.toLocaleLowerCase() === "theaudiodb" && (
|
||||
<img src={audioDBIcon} alt="TheAudioDB" />
|
||||
)}
|
||||
{name.toLocaleLowerCase() === "kitsu" && (
|
||||
<img src={kitsuIcon} alt="Kitsu" />
|
||||
)}
|
||||
{!knownIcons.includes(name.toLocaleLowerCase()) && (
|
||||
<Typography>{name}</Typography>
|
||||
<Tooltip title={name}>
|
||||
<Link
|
||||
target="_blank"
|
||||
href={url}
|
||||
className="item-detail-link"
|
||||
aria-label={name}
|
||||
>
|
||||
{icon ? (
|
||||
<img src={icon} alt={name} />
|
||||
) : (
|
||||
<span className="material-symbols-rounded item-detail-link-generic">
|
||||
link
|
||||
</span>
|
||||
)}
|
||||
</Link>
|
||||
</Tooltip>
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
import type { Api } from "@jellyfin/sdk";
|
||||
import type { BaseItemPerson } from "@jellyfin/sdk/lib/generated-client";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { Link } from "@tanstack/react-router";
|
||||
import React, { useMemo } from "react";
|
||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
|
||||
const groups = [
|
||||
{ type: "Actor", title: "Actors" },
|
||||
{ type: "Writer", title: "Writers" },
|
||||
{ type: "Director", title: "Directors" },
|
||||
{ type: "Producer", title: "Producers" },
|
||||
] as const;
|
||||
|
||||
type CastAndCrewProps = {
|
||||
people: BaseItemPerson[] | null | undefined;
|
||||
api: Api | undefined;
|
||||
};
|
||||
|
||||
const CastAndCrew = ({ people, api }: CastAndCrewProps) => {
|
||||
const grouped = useMemo(
|
||||
() =>
|
||||
groups.map((group) => ({
|
||||
...group,
|
||||
people: people?.filter((person) => person.Type === group.type) ?? [],
|
||||
})),
|
||||
[people],
|
||||
);
|
||||
|
||||
if (!people?.length) return null;
|
||||
|
||||
return (
|
||||
<div className="item-detail-cast">
|
||||
<Typography variant="h5" sx={{ mb: 2 }}>
|
||||
Cast & Crew
|
||||
</Typography>
|
||||
{grouped.map(
|
||||
(group) =>
|
||||
group.people.length > 0 && (
|
||||
<div className="item-detail-cast-container" key={group.type}>
|
||||
<Typography variant="h6" className="item-detail-cast-title">
|
||||
{group.title}
|
||||
</Typography>
|
||||
<div className="item-detail-cast-grid">
|
||||
{group.people.map((person) => (
|
||||
<Link
|
||||
className="item-detail-cast-card"
|
||||
key={person.Id}
|
||||
to="/item/$id"
|
||||
params={{ id: person.Id ?? "" }}
|
||||
search={{ type: "Person" }}
|
||||
>
|
||||
{person.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={person.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
person.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)
|
||||
}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
<div className="item-detail-cast-card-icon">
|
||||
{getTypeIcon("Person")}
|
||||
</div>
|
||||
)}
|
||||
<div className="item-detail-cast-card-text">
|
||||
<Typography variant="subtitle1">{person.Name}</Typography>
|
||||
<Typography variant="subtitle2" style={{ opacity: 0.5 }}>
|
||||
{person.Role}
|
||||
</Typography>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default CastAndCrew;
|
||||
@@ -1,8 +1,10 @@
|
||||
$cardWidth: 18%;
|
||||
|
||||
.item-series.item {
|
||||
.item-detail-page.item {
|
||||
gap: 1em;
|
||||
|
||||
&.item-default {
|
||||
gap: 1.5em;
|
||||
}
|
||||
|
||||
.item-detail {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 35%;
|
||||
@@ -10,25 +12,11 @@ $cardWidth: 18%;
|
||||
align-items: start;
|
||||
gap: 3em;
|
||||
|
||||
&-nextUp {
|
||||
max-width: 23em;
|
||||
&.single {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
&-cast {
|
||||
max-height: 50vh;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
mask-image: linear-gradient(to top, transparent, black 1.2em);
|
||||
-webkit-mask-image: linear-gradient(to top, transparent, black 1.2em);
|
||||
&-title {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background: black;
|
||||
border:1px solid rgb(255 255 255 / 0.2) ;
|
||||
padding: 0.35em;
|
||||
border-radius: 10px;
|
||||
z-index: 1;
|
||||
}
|
||||
&-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -36,9 +24,9 @@ $cardWidth: 18%;
|
||||
}
|
||||
&-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
gap: 1em;
|
||||
margin-bottom: 1em;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
&-card {
|
||||
display: grid;
|
||||
@@ -81,6 +69,13 @@ $cardWidth: 18%;
|
||||
text-decoration-color: white;
|
||||
}
|
||||
}
|
||||
&-external-links {
|
||||
display: flex;
|
||||
gap: 0.6em;
|
||||
align-self: end;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
&-episode {
|
||||
display: grid;
|
||||
grid-template-columns: 3.2em 12em 1fr 6em;
|
||||
@@ -173,38 +168,76 @@ $cardWidth: 18%;
|
||||
gap: 1em;
|
||||
}
|
||||
|
||||
&:hover .item-detail-episode-image-overlay, &:focus-within .item-detail-episode-image-overlay{
|
||||
&:hover .item-detail-episode-image-overlay,
|
||||
&:focus-within .item-detail-episode-image-overlay {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1320px) {
|
||||
.item-series .item-detail {
|
||||
&-cast {
|
||||
&-grid {
|
||||
grid-template-columns: 1fr;
|
||||
&-person {
|
||||
&-container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
&-header {
|
||||
width: 100%;
|
||||
}
|
||||
&-cards {
|
||||
display: grid;
|
||||
align-items: start;
|
||||
&.col-7 {
|
||||
grid-template-columns: repeat(7, minmax(0, 1fr));
|
||||
}
|
||||
&.col-4 {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
&-episodes-container {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 830px) {
|
||||
.item-series .item-detail {
|
||||
&-episodes-container {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
// Global item-detail
|
||||
.item-detail-link {
|
||||
margin-top: 0.85em !important;
|
||||
&:hover > img {
|
||||
filter: brightness(1);
|
||||
}
|
||||
& > img {
|
||||
width: 2em;
|
||||
aspect-ratio: 1;
|
||||
filter: brightness(0.5);
|
||||
transition: filter $transition-time-default;
|
||||
}
|
||||
&-generic {
|
||||
display: block;
|
||||
font-size: 2em !important;
|
||||
color: white;
|
||||
opacity: 0.5;
|
||||
transition: opacity $transition-time-default;
|
||||
}
|
||||
&:hover > &-generic {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 564px) {
|
||||
.item-series .item-detail {
|
||||
&-episodes-container {
|
||||
grid-template-columns: repeat(1, minmax(0, 1fr));
|
||||
.item {
|
||||
gap: 1.5em;
|
||||
&-hero {
|
||||
&-image {
|
||||
box-sizing: border-box;
|
||||
&-container {
|
||||
box-sizing: content-box;
|
||||
box-shadow: 0px 10px 20px -10px rgb(0 0 0 / 0.5) !important;
|
||||
}
|
||||
}
|
||||
&-mediaInfo {
|
||||
margin-top: 1em;
|
||||
height: 1.1em;
|
||||
opacity: 0.8;
|
||||
&.badge {
|
||||
margin: 0;
|
||||
height: 1.2em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
import {
|
||||
type BaseItemDto,
|
||||
BaseItemKind,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { motion } from "motion/react";
|
||||
import React, { type ReactNode, useEffect, useRef } from "react";
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import MarkPlayedButton from "@/components/buttons/markPlayedButton";
|
||||
import TrailerButton from "@/components/buttons/trailerButton";
|
||||
import IconLink from "@/components/iconLink";
|
||||
import ItemHeader from "@/components/itemHeader";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
|
||||
|
||||
import "./itemDetail.scss";
|
||||
|
||||
export const ExternalLinks = ({ item }: { item: BaseItemDto }) => (
|
||||
<div className="item-detail-external-links">
|
||||
{item.ExternalUrls?.map(
|
||||
(url) =>
|
||||
url.Url &&
|
||||
url.Name && <IconLink key={url.Url} url={url.Url} name={url.Name} />,
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
const getDefaultBackdropHash = (item: BaseItemDto) => {
|
||||
const tag =
|
||||
item.Type === BaseItemKind.Episode
|
||||
? item.ParentBackdropImageTags?.[0]
|
||||
: item.BackdropImageTags?.[0];
|
||||
return (tag && item.ImageBlurHashes?.Backdrop?.[tag]) || "";
|
||||
};
|
||||
|
||||
type ItemDetailLayoutProps = {
|
||||
item: BaseItemDto;
|
||||
/** CSS modifier, rendered as `item-<variant>`. */
|
||||
variant: "default" | "episode" | "series" | "boxset" | "person";
|
||||
mediaQualityInfo?: MediaQualityInfo;
|
||||
backdropSrc?: string | null;
|
||||
/** Blurhash for the app backdrop; defaults to the item's (or an episode's series) backdrop. */
|
||||
backdropHash?: string;
|
||||
/** Play button area; omitted for items that can't be played (people). */
|
||||
playButton?: ReactNode;
|
||||
showTrailer?: boolean;
|
||||
showMarkPlayed?: boolean;
|
||||
/** Extra content under the overview in the main column. */
|
||||
main?: ReactNode;
|
||||
/** Right-hand column next to the overview. */
|
||||
aside?: ReactNode;
|
||||
/** Sections rendered below the overview. */
|
||||
children?: ReactNode;
|
||||
};
|
||||
|
||||
const ItemDetailLayout = ({
|
||||
item,
|
||||
variant,
|
||||
mediaQualityInfo,
|
||||
backdropSrc,
|
||||
backdropHash,
|
||||
playButton,
|
||||
showTrailer = true,
|
||||
showMarkPlayed = true,
|
||||
main,
|
||||
aside,
|
||||
children,
|
||||
}: ItemDetailLayoutProps) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const containerRef = useRef<HTMLDivElement | null>(null);
|
||||
const queryKey = ["item", item.Id ?? ""];
|
||||
|
||||
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||
const hash = backdropHash ?? getDefaultBackdropHash(item);
|
||||
useEffect(() => {
|
||||
setBackdrop(hash);
|
||||
}, [hash, setBackdrop]);
|
||||
|
||||
return (
|
||||
<motion.div
|
||||
key={item.Id}
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
transition={{ duration: 0.3, ease: "easeInOut" }}
|
||||
className={`scrollY padded-top flex flex-column item item-detail-page item-${variant}`}
|
||||
ref={containerRef}
|
||||
>
|
||||
<ItemHeader
|
||||
item={item}
|
||||
api={api}
|
||||
mediaQualityInfo={mediaQualityInfo}
|
||||
scrollTargetRef={containerRef}
|
||||
backdropSrc={backdropSrc}
|
||||
>
|
||||
<div className="item-hero-buttons-container">
|
||||
<div className="flex flex-row" style={{ width: "100%" }}>
|
||||
{playButton}
|
||||
</div>
|
||||
<div className="flex flex-row" style={{ gap: "1em" }}>
|
||||
{showTrailer && item.RemoteTrailers && (
|
||||
<TrailerButton
|
||||
trailerItem={item.RemoteTrailers}
|
||||
disabled={item.RemoteTrailers.length === 0}
|
||||
/>
|
||||
)}
|
||||
<LikeButton
|
||||
itemName={item.Name}
|
||||
itemId={item.Id}
|
||||
queryKey={queryKey}
|
||||
isFavorite={item.UserData?.IsFavorite}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
{showMarkPlayed && (
|
||||
<MarkPlayedButton
|
||||
itemName={item.Name}
|
||||
itemId={item.Id}
|
||||
queryKey={queryKey}
|
||||
isPlayed={item.UserData?.Played}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</ItemHeader>
|
||||
<div className={aside ? "item-detail" : "item-detail single"}>
|
||||
<div className="fullWidth">
|
||||
{(item.Taglines?.length ?? 0) > 0 && (
|
||||
<Typography variant="h5" sx={{ mb: 2, fontWeight: 300 }}>
|
||||
{item.Taglines?.[0]}
|
||||
</Typography>
|
||||
)}
|
||||
<ShowMoreText content={item.Overview ?? ""} collapsedLines={4} />
|
||||
{main}
|
||||
</div>
|
||||
{aside && <div className="fullWidth">{aside}</div>}
|
||||
</div>
|
||||
{children}
|
||||
</motion.div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ItemDetailLayout;
|
||||
@@ -0,0 +1,172 @@
|
||||
import {
|
||||
type BaseItemDto,
|
||||
type MediaStream,
|
||||
MediaStreamType,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import React, { useMemo, useState } from "react";
|
||||
import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
|
||||
|
||||
const titleIncludes = (stream: MediaStream, ...needles: string[]) => {
|
||||
const title = stream.DisplayTitle?.toLocaleLowerCase();
|
||||
return needles.some((needle) => title?.includes(needle));
|
||||
};
|
||||
|
||||
const getMediaQualityInfo = (
|
||||
videoTracks: MediaStream[],
|
||||
audioTracks: MediaStream[],
|
||||
): MediaQualityInfo => ({
|
||||
isAtmos: audioTracks.some((a) => titleIncludes(a, "atmos")),
|
||||
isDolbyVision: videoTracks.some(
|
||||
(v) =>
|
||||
titleIncludes(v, "dv", "dolby vision") ||
|
||||
!!v.VideoDoViTitle ||
|
||||
v.VideoRangeType === "DOVI",
|
||||
),
|
||||
isDts: audioTracks.some(
|
||||
(a) =>
|
||||
titleIncludes(a, "dts") && !titleIncludes(a, "dts-hd ma", "dts-hd.ma"),
|
||||
),
|
||||
isDtsHDMA: audioTracks.some((a) =>
|
||||
titleIncludes(a, "dts-hd ma", "dts-hd.ma"),
|
||||
),
|
||||
isDD: audioTracks.some(
|
||||
(a) =>
|
||||
(titleIncludes(a, "dd") && !titleIncludes(a, "ddp")) ||
|
||||
(titleIncludes(a, "dolby digital") &&
|
||||
!titleIncludes(a, "dolby digital+")),
|
||||
),
|
||||
isDDP: audioTracks.some((a) => titleIncludes(a, "ddp", "dolby digital+")),
|
||||
isUHD: videoTracks.some((v) => titleIncludes(v, "4k", "2160p", "uhd")),
|
||||
isHD: videoTracks.some(
|
||||
(v) =>
|
||||
(titleIncludes(v, "hd") && !titleIncludes(v, "hdr")) ||
|
||||
titleIncludes(v, "1080p", "fhd"),
|
||||
),
|
||||
isSD: videoTracks.some(
|
||||
(v) =>
|
||||
(titleIncludes(v, "sd") && !titleIncludes(v, "sdr")) ||
|
||||
titleIncludes(v, "720p"),
|
||||
),
|
||||
isSDR: videoTracks.some((v) => v.VideoRangeType === "SDR"),
|
||||
isHDR: videoTracks.some(
|
||||
(v) => v.VideoRange === "HDR" || titleIncludes(v, "dv"),
|
||||
),
|
||||
isHDR10: videoTracks.some(
|
||||
(v) => v.VideoRangeType === "HDR10" && !titleIncludes(v, "hdr10+"),
|
||||
),
|
||||
isHDR10Plus: videoTracks.some(
|
||||
(v) => v.VideoRangeType === "HDR10Plus" || titleIncludes(v, "hdr10+"),
|
||||
),
|
||||
isTrueHD: audioTracks.some((a) => titleIncludes(a, "truehd")),
|
||||
isIMAX: videoTracks.some((v) => titleIncludes(v, "imax")),
|
||||
});
|
||||
|
||||
/**
|
||||
* Splits an item's media streams into tracks, tracks the user's track selection
|
||||
* (reset whenever the item changes) and derives the media quality badges.
|
||||
*/
|
||||
export const useMediaTracks = (item: BaseItemDto) => {
|
||||
const tracks = useMemo(() => {
|
||||
const streams = item.MediaStreams ?? [];
|
||||
return {
|
||||
video: streams.filter((s) => s.Type === MediaStreamType.Video),
|
||||
audio: streams.filter((s) => s.Type === MediaStreamType.Audio),
|
||||
subtitle: streams.filter((s) => s.Type === MediaStreamType.Subtitle),
|
||||
};
|
||||
}, [item.MediaStreams]);
|
||||
|
||||
const defaults = {
|
||||
itemId: item.Id,
|
||||
video:
|
||||
tracks.video.find((track) => track.IsDefault)?.Index ??
|
||||
tracks.video[0]?.Index ??
|
||||
0,
|
||||
audio: item.MediaSources?.[0]?.DefaultAudioStreamIndex ?? 0,
|
||||
subtitle: item.MediaSources?.[0]?.DefaultSubtitleStreamIndex ?? -1,
|
||||
};
|
||||
const [selection, setSelection] = useState(defaults);
|
||||
if (selection.itemId !== item.Id) {
|
||||
setSelection(defaults);
|
||||
}
|
||||
|
||||
const mediaQualityInfo = useMemo(
|
||||
() => getMediaQualityInfo(tracks.video, tracks.audio),
|
||||
[tracks],
|
||||
);
|
||||
|
||||
return {
|
||||
tracks,
|
||||
selection,
|
||||
setSelection: (patch: Partial<Omit<typeof defaults, "itemId">>) =>
|
||||
setSelection((prev) => ({ ...prev, ...patch })),
|
||||
mediaQualityInfo,
|
||||
};
|
||||
};
|
||||
|
||||
type TrackSelectorsProps = Pick<
|
||||
ReturnType<typeof useMediaTracks>,
|
||||
"tracks" | "selection" | "setSelection"
|
||||
>;
|
||||
|
||||
export const TrackSelectors = ({
|
||||
tracks,
|
||||
selection,
|
||||
setSelection,
|
||||
}: TrackSelectorsProps) => (
|
||||
<>
|
||||
{tracks.video.length > 0 && (
|
||||
<TextField
|
||||
label="Video"
|
||||
select
|
||||
style={{ width: "100%", marginBottom: "1em" }}
|
||||
value={selection.video}
|
||||
variant="filled"
|
||||
onChange={(e) => setSelection({ video: Number(e.target.value) })}
|
||||
>
|
||||
{tracks.video.map((track) => (
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
{track.DisplayTitle}
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
)}
|
||||
{tracks.audio.length > 0 && (
|
||||
<TextField
|
||||
label="Audio"
|
||||
select
|
||||
style={{ width: "100%", marginBottom: "1em" }}
|
||||
value={selection.audio}
|
||||
variant="filled"
|
||||
onChange={(e) => setSelection({ audio: Number(e.target.value) })}
|
||||
>
|
||||
{tracks.audio.map((track) => (
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
{track.DisplayTitle}
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
)}
|
||||
{tracks.subtitle.length > 0 && (
|
||||
<TextField
|
||||
label="Subtitle"
|
||||
select
|
||||
style={{ width: "100%" }}
|
||||
value={selection.subtitle}
|
||||
variant="filled"
|
||||
slotProps={{ select: { MenuProps: { disablePortal: true } } }}
|
||||
onChange={(e) => setSelection({ subtitle: Number(e.target.value) })}
|
||||
>
|
||||
<MenuItem key={-1} value={-1}>
|
||||
No Subtitle
|
||||
</MenuItem>
|
||||
{tracks.subtitle.map((track) => (
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
{track.DisplayTitle}
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
@@ -0,0 +1,67 @@
|
||||
import {
|
||||
type BaseItemDto,
|
||||
BaseItemKind,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import React from "react";
|
||||
import { Card } from "@/components/card/card";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
import { getSimilarItemsQueryOptions } from "@/utils/queries/itemDetail";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
|
||||
export const getItemCardTitle = (item: BaseItemDto) =>
|
||||
item.Type === BaseItemKind.Episode ? item.SeriesName : item.Name;
|
||||
|
||||
export const getItemCardCaption = (item: BaseItemDto) => {
|
||||
if (item.Type === BaseItemKind.Episode) {
|
||||
return `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`;
|
||||
}
|
||||
if (item.Type === BaseItemKind.Series) {
|
||||
const end = item.EndDate
|
||||
? new Date(item.EndDate).toLocaleString([], { year: "numeric" })
|
||||
: "Present";
|
||||
return `${item.ProductionYear} - ${end}`;
|
||||
}
|
||||
return item.ProductionYear;
|
||||
};
|
||||
|
||||
const SimilarItems = ({ item }: { item: BaseItemDto }) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const id = item.Id ?? "";
|
||||
const similarItems = useQuery(
|
||||
getSimilarItemsQueryOptions(api, user?.Id, id, item.Type),
|
||||
);
|
||||
|
||||
if (!similarItems.data?.TotalRecordCount) return null;
|
||||
|
||||
return (
|
||||
<CardScroller
|
||||
title="You might also like"
|
||||
displayCards={7}
|
||||
disableDecoration
|
||||
>
|
||||
{similarItems.data.Items?.map((similar) => (
|
||||
<Card
|
||||
key={similar.Id}
|
||||
item={similar}
|
||||
seriesId={similar.SeriesId}
|
||||
cardTitle={getItemCardTitle(similar)}
|
||||
imageType="Primary"
|
||||
cardCaption={getItemCardCaption(similar)}
|
||||
cardType={
|
||||
similar.Type === BaseItemKind.MusicAlbum ||
|
||||
similar.Type === BaseItemKind.Audio
|
||||
? "square"
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
);
|
||||
};
|
||||
|
||||
export default SimilarItems;
|
||||
@@ -0,0 +1,58 @@
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import React from "react";
|
||||
import PlayButton from "@/components/buttons/playButton";
|
||||
import { Card } from "@/components/card/card";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
import { getCollectionItemsQueryOptions } from "@/utils/queries/itemDetail";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import ItemDetailLayout, { ExternalLinks } from "../itemDetailLayout";
|
||||
import SimilarItems, { getItemCardTitle } from "../similarItems";
|
||||
|
||||
const BoxSetView = ({ item }: { item: BaseItemDto }) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const id = item.Id ?? "";
|
||||
const collectionItems = useQuery(
|
||||
getCollectionItemsQueryOptions(api, user?.Id, id),
|
||||
);
|
||||
|
||||
return (
|
||||
<ItemDetailLayout
|
||||
item={item}
|
||||
variant="boxset"
|
||||
showTrailer={false}
|
||||
playButton={
|
||||
<PlayButton
|
||||
item={item}
|
||||
itemType={item.Type ?? "BoxSet"}
|
||||
userId={user?.Id}
|
||||
buttonProps={{ fullWidth: true }}
|
||||
/>
|
||||
}
|
||||
aside={<ExternalLinks item={item} />}
|
||||
>
|
||||
{(collectionItems.data?.TotalRecordCount ?? 0) > 0 && (
|
||||
<CardScroller title="" displayCards={7} disableDecoration>
|
||||
{collectionItems.data?.Items?.map((collectionItem) => (
|
||||
<Card
|
||||
key={collectionItem.Id}
|
||||
item={collectionItem}
|
||||
seriesId={collectionItem.SeriesId}
|
||||
cardTitle={getItemCardTitle(collectionItem)}
|
||||
imageType="Primary"
|
||||
cardCaption={collectionItem.ProductionYear}
|
||||
cardType="portrait"
|
||||
queryKey={["item", id]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
<SimilarItems item={item} />
|
||||
</ItemDetailLayout>
|
||||
);
|
||||
};
|
||||
|
||||
export default BoxSetView;
|
||||
@@ -0,0 +1,90 @@
|
||||
import {
|
||||
type BaseItemDto,
|
||||
BaseItemKind,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import React from "react";
|
||||
import PlayButton from "@/components/buttons/playButton";
|
||||
import { Card } from "@/components/card/card";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
import { getUpcomingEpisodesQueryOptions } from "@/utils/queries/itemDetail";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import CastAndCrew from "../castAndCrew";
|
||||
import ItemDetailLayout, { ExternalLinks } from "../itemDetailLayout";
|
||||
import { TrackSelectors, useMediaTracks } from "../mediaTracks";
|
||||
import SimilarItems from "../similarItems";
|
||||
|
||||
const UpcomingEpisodes = ({ episode }: { episode: BaseItemDto }) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const options = getUpcomingEpisodesQueryOptions(api, user?.Id, episode);
|
||||
const upcomingEpisodes = useQuery(options);
|
||||
|
||||
if (!upcomingEpisodes.data?.Items?.length) return null;
|
||||
|
||||
return (
|
||||
<CardScroller title="Upcoming Episodes" displayCards={4} disableDecoration>
|
||||
{upcomingEpisodes.data.Items.map((upcoming) => (
|
||||
<Card
|
||||
key={upcoming.Id}
|
||||
item={upcoming}
|
||||
cardTitle={upcoming.SeriesName}
|
||||
imageType="Primary"
|
||||
cardCaption={`S${upcoming.ParentIndexNumber}:E${upcoming.IndexNumber} - ${upcoming.Name}`}
|
||||
cardType="thumb"
|
||||
queryKey={options.queryKey as string[]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
);
|
||||
};
|
||||
|
||||
/** Movies, episodes, videos and any other playable item. */
|
||||
const DefaultView = ({ item }: { item: BaseItemDto }) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const { tracks, selection, setSelection, mediaQualityInfo } =
|
||||
useMediaTracks(item);
|
||||
const isEpisode = item.Type === BaseItemKind.Episode;
|
||||
|
||||
return (
|
||||
<ItemDetailLayout
|
||||
item={item}
|
||||
variant={isEpisode ? "episode" : "default"}
|
||||
mediaQualityInfo={mediaQualityInfo}
|
||||
playButton={
|
||||
<PlayButton
|
||||
item={item}
|
||||
itemType={item.Type ?? "Movie"}
|
||||
audio={item.Type === BaseItemKind.Audio}
|
||||
currentVideoTrack={selection.video}
|
||||
currentAudioTrack={selection.audio}
|
||||
currentSubTrack={selection.subtitle}
|
||||
userId={user?.Id}
|
||||
buttonProps={{ fullWidth: true }}
|
||||
/>
|
||||
}
|
||||
aside={
|
||||
<>
|
||||
<TrackSelectors
|
||||
tracks={tracks}
|
||||
selection={selection}
|
||||
setSelection={setSelection}
|
||||
/>
|
||||
<ExternalLinks item={item} />
|
||||
</>
|
||||
}
|
||||
>
|
||||
<CastAndCrew people={item.People} api={api} />
|
||||
{isEpisode ? (
|
||||
<UpcomingEpisodes episode={item} />
|
||||
) : (
|
||||
<SimilarItems item={item} />
|
||||
)}
|
||||
</ItemDetailLayout>
|
||||
);
|
||||
};
|
||||
|
||||
export default DefaultView;
|
||||
@@ -0,0 +1,145 @@
|
||||
import {
|
||||
type BaseItemDto,
|
||||
BaseItemKind,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import Tab from "@mui/material/Tab";
|
||||
import Tabs from "@mui/material/Tabs";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { useQueries } from "@tanstack/react-query";
|
||||
import { AnimatePresence, motion } from "motion/react";
|
||||
import React, { useState } from "react";
|
||||
import { Card } from "@/components/card/card";
|
||||
import {
|
||||
getPersonItemsQueryOptions,
|
||||
personTabs,
|
||||
} from "@/utils/queries/itemDetail";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import ItemDetailLayout, { ExternalLinks } from "../itemDetailLayout";
|
||||
import { getItemCardCaption, getItemCardTitle } from "../similarItems";
|
||||
|
||||
const PersonView = ({ item }: { item: BaseItemDto }) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const id = item.Id ?? "";
|
||||
|
||||
const tabQueries = useQueries({
|
||||
queries: personTabs.map((tab) =>
|
||||
getPersonItemsQueryOptions(api, user?.Id, id, tab),
|
||||
),
|
||||
});
|
||||
|
||||
// Until the user picks a tab, show the first one that has items.
|
||||
const [pickedTab, setPickedTab] = useState<number | null>(null);
|
||||
const allLoaded = tabQueries.every((query) => query.isSuccess);
|
||||
const firstNonEmptyTab = tabQueries.findIndex(
|
||||
(query) => (query.data?.TotalRecordCount ?? 0) > 0,
|
||||
);
|
||||
const activeTab =
|
||||
pickedTab ?? (allLoaded ? Math.max(firstNonEmptyTab, 0) : 0);
|
||||
const [animationDirection, setAnimationDirection] = useState<
|
||||
"forward" | "backwards"
|
||||
>("forward");
|
||||
|
||||
return (
|
||||
<ItemDetailLayout
|
||||
item={item}
|
||||
variant="person"
|
||||
showTrailer={false}
|
||||
showMarkPlayed={false}
|
||||
main={<ExternalLinks item={item} />}
|
||||
aside={
|
||||
<>
|
||||
{item.PremiereDate && (
|
||||
<div>
|
||||
<Typography variant="h6">Birth</Typography>
|
||||
<Typography variant="subtitle1" sx={{ opacity: 0.8 }}>
|
||||
{new Date(item.PremiereDate).toDateString()}
|
||||
</Typography>
|
||||
</div>
|
||||
)}
|
||||
{item.EndDate && (
|
||||
<div>
|
||||
<Typography variant="h6" sx={{ mt: 2 }}>
|
||||
Death
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" sx={{ opacity: 0.8 }}>
|
||||
{new Date(item.EndDate).toDateString()}
|
||||
</Typography>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
>
|
||||
<div className="item-detail-person-container">
|
||||
<div className="item-detail-person-header">
|
||||
<Tabs
|
||||
variant="scrollable"
|
||||
value={activeTab}
|
||||
onChange={(_, newTab: number) => {
|
||||
setAnimationDirection(
|
||||
newTab > activeTab ? "forward" : "backwards",
|
||||
);
|
||||
setPickedTab(newTab);
|
||||
}}
|
||||
>
|
||||
{personTabs.map((tab, index) => (
|
||||
<Tab
|
||||
key={tab.key}
|
||||
label={tab.title}
|
||||
disabled={tabQueries[index].data?.TotalRecordCount === 0}
|
||||
/>
|
||||
))}
|
||||
</Tabs>
|
||||
<Divider />
|
||||
</div>
|
||||
<AnimatePresence>
|
||||
{personTabs.map((tab, index) => {
|
||||
if (index !== activeTab) return null;
|
||||
const query = tabQueries[index];
|
||||
const isWide =
|
||||
tab.kind === BaseItemKind.Photo ||
|
||||
tab.kind === BaseItemKind.Episode;
|
||||
return (
|
||||
<motion.div
|
||||
role="tabpanel"
|
||||
style={{ marginTop: "1em" }}
|
||||
className={`item-detail-person-cards ${isWide ? "col-4" : "col-7"}`}
|
||||
key={tab.key}
|
||||
initial={{
|
||||
opacity: 0,
|
||||
transform:
|
||||
animationDirection === "forward"
|
||||
? "translate(30px)"
|
||||
: "translate(-30px)",
|
||||
}}
|
||||
animate={{ opacity: 1, transform: "translate(0px)" }}
|
||||
transition={{ duration: 0.2, ease: "anticipate" }}
|
||||
>
|
||||
{query.data?.Items?.map((tabItem) => (
|
||||
<Card
|
||||
key={tabItem.Id}
|
||||
item={tabItem}
|
||||
cardTitle={getItemCardTitle(tabItem)}
|
||||
imageType="Primary"
|
||||
cardCaption={getItemCardCaption(tabItem)}
|
||||
cardType={
|
||||
tabItem.Type === BaseItemKind.Episode
|
||||
? "thumb"
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={["item", id, tab.key]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</motion.div>
|
||||
);
|
||||
})}
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
</ItemDetailLayout>
|
||||
);
|
||||
};
|
||||
|
||||
export default PersonView;
|
||||
@@ -0,0 +1,367 @@
|
||||
import {
|
||||
type BaseItemDto,
|
||||
BaseItemKind,
|
||||
ItemFields,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import { getShowApi } from "@jellyfin/sdk/lib/utils/api/show-api";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useNavigate } from "@tanstack/react-router";
|
||||
import { motion } from "motion/react";
|
||||
import React from "react";
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import MarkPlayedButton from "@/components/buttons/markPlayedButton";
|
||||
import PlayButton from "@/components/buttons/playButton";
|
||||
import { Card } from "@/components/card/card";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
import EpisodeSkeleton from "@/components/skeleton/episode";
|
||||
import { SeasonSelectorSkeleton } from "@/components/skeleton/seasonSelector";
|
||||
import { getRuntimeCompact, getRuntimeMusic } from "@/utils/date/time";
|
||||
import useDefaultSeason from "@/utils/hooks/useDefaultSeason";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import {
|
||||
getSeasonsQueryOptions,
|
||||
getSpecialFeaturesQueryOptions,
|
||||
} from "@/utils/queries/itemDetail";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import CastAndCrew from "../castAndCrew";
|
||||
import ItemDetailLayout, { ExternalLinks } from "../itemDetailLayout";
|
||||
import SimilarItems from "../similarItems";
|
||||
|
||||
const getEpisodeDateString = (date: Date) =>
|
||||
new Intl.DateTimeFormat(navigator.language ?? "en-US", {
|
||||
dateStyle: "full",
|
||||
}).format(date);
|
||||
|
||||
const SeriesView = ({ item }: { item: BaseItemDto }) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const navigate = useNavigate();
|
||||
const id = item.Id ?? "";
|
||||
|
||||
const seasons = useQuery(getSeasonsQueryOptions(api, user?.Id, id));
|
||||
const specialFeatures = useQuery(
|
||||
getSpecialFeaturesQueryOptions(api, user?.Id, id),
|
||||
);
|
||||
|
||||
const [currentSeason, setCurrentSeason] = useDefaultSeason(seasons, id);
|
||||
const currentSeasonId = seasons.data?.Items?.[currentSeason]?.Id;
|
||||
|
||||
const currentSeasonItem = useQuery({
|
||||
queryKey: ["item", id, "season", currentSeason],
|
||||
queryFn: async () => {
|
||||
if (!api || !currentSeasonId) return null;
|
||||
const result = await getLibraryApi(api).getItem({
|
||||
userId: user?.Id,
|
||||
itemId: currentSeasonId,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: seasons.isSuccess,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
|
||||
const episodes = useQuery({
|
||||
queryKey: ["item", id, "season", currentSeason, "episodes"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getShowApi(api).getEpisodes({
|
||||
userId: user?.Id,
|
||||
seriesId: id,
|
||||
seasonId: currentSeasonId,
|
||||
fields: [ItemFields.Overview],
|
||||
isMissing: false,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: seasons.isSuccess,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
|
||||
// Prefer the selected season's backdrop over the series one.
|
||||
const season = currentSeasonItem.data;
|
||||
const backdropOwner = season?.BackdropImageTags?.length ? season : item;
|
||||
const backdropTag = backdropOwner.BackdropImageTags?.[0];
|
||||
const backdropSrc =
|
||||
api && backdropTag
|
||||
? getImageUrlsApi(api).getItemImageUrlById(
|
||||
backdropOwner.Id ?? "",
|
||||
"Backdrop",
|
||||
{ tag: backdropTag },
|
||||
)
|
||||
: undefined;
|
||||
const backdropHash =
|
||||
(backdropTag && backdropOwner.ImageBlurHashes?.Backdrop?.[backdropTag]) ||
|
||||
"";
|
||||
|
||||
return (
|
||||
<ItemDetailLayout
|
||||
item={item}
|
||||
variant="series"
|
||||
backdropSrc={backdropSrc}
|
||||
backdropHash={backdropHash}
|
||||
playButton={
|
||||
<PlayButton
|
||||
item={item}
|
||||
itemType={BaseItemKind.Series}
|
||||
userId={user?.Id}
|
||||
buttonProps={{ fullWidth: true }}
|
||||
/>
|
||||
}
|
||||
main={<ExternalLinks item={item} />}
|
||||
>
|
||||
{seasons.isPending ? (
|
||||
<SeasonSelectorSkeleton />
|
||||
) : (
|
||||
<div className="item-series-seasons-container">
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
width: "100%",
|
||||
alignItems: "center",
|
||||
justifyContent: "space-between",
|
||||
paddingBottom: " 0.5em",
|
||||
}}
|
||||
>
|
||||
<div style={{ display: "flex", gap: "1em" }}>
|
||||
<Typography variant="h5">
|
||||
{seasons.data?.Items?.[currentSeason]?.Name}
|
||||
</Typography>
|
||||
<Chip
|
||||
label={
|
||||
episodes.isPending ? (
|
||||
<CircularProgress
|
||||
size={20}
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
episodes.data?.TotalRecordCount
|
||||
)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div style={{ display: "flex", gap: "0.75em" }}>
|
||||
{season && (
|
||||
<>
|
||||
<LikeButton
|
||||
itemId={season.Id}
|
||||
isFavorite={season.UserData?.IsFavorite}
|
||||
queryKey={["item", id]}
|
||||
userId={user?.Id}
|
||||
itemName={season.Name}
|
||||
/>
|
||||
<MarkPlayedButton
|
||||
itemId={season.Id}
|
||||
isPlayed={season.UserData?.Played}
|
||||
queryKey={["item", id]}
|
||||
userId={user?.Id}
|
||||
itemName={season.Name}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<TextField
|
||||
value={currentSeason}
|
||||
onChange={(e) => {
|
||||
const seasonIndex = Number(e.target.value);
|
||||
if (Number.isFinite(seasonIndex)) {
|
||||
setCurrentSeason(seasonIndex);
|
||||
sessionStorage.setItem(
|
||||
`season-${id}`,
|
||||
seasonIndex.toString(),
|
||||
);
|
||||
}
|
||||
}}
|
||||
select
|
||||
slotProps={{
|
||||
select: { MenuProps: { disableScrollLock: true } },
|
||||
}}
|
||||
size="small"
|
||||
>
|
||||
{seasons.data?.Items?.map((seasonItem, index) => (
|
||||
<MenuItem key={seasonItem.Id} value={index}>
|
||||
{seasonItem.Name}
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
</div>
|
||||
</div>
|
||||
<Divider />
|
||||
<div className="item-detail-episode-container">
|
||||
{episodes.isPending ? (
|
||||
<EpisodeSkeleton />
|
||||
) : (
|
||||
episodes.data?.Items?.map((episode) => (
|
||||
<motion.div
|
||||
key={episode.Id}
|
||||
onClick={() =>
|
||||
navigate({
|
||||
to: "/item/$id",
|
||||
params: { id: episode.Id ?? "" },
|
||||
search: { type: BaseItemKind.Episode },
|
||||
})
|
||||
}
|
||||
initial={{ transform: "translateY(10px)", opacity: 0 }}
|
||||
whileInView={{ opacity: 1, transform: "translateY(0px)" }}
|
||||
viewport={{ once: true }}
|
||||
transition={{ duration: 0.2, ease: "backInOut" }}
|
||||
style={{ width: "100%" }}
|
||||
className="item-detail-episode"
|
||||
>
|
||||
<Typography variant="subtitle1" sx={{ textAlign: "center" }}>
|
||||
{episode.IndexNumberEnd
|
||||
? `${episode.IndexNumber} / ${episode.IndexNumberEnd}`
|
||||
: (episode.IndexNumber ?? 0)}
|
||||
</Typography>
|
||||
<div
|
||||
className={
|
||||
episode.UserData?.Played
|
||||
? "item-detail-episode-image-container watched"
|
||||
: "item-detail-episode-image-container"
|
||||
}
|
||||
>
|
||||
<div className="item-detail-episode-image-overlay">
|
||||
<PlayButton
|
||||
item={episode}
|
||||
itemType={BaseItemKind.Episode}
|
||||
userId={user?.Id}
|
||||
size="medium"
|
||||
buttonProps={{
|
||||
//@ts-expect-error
|
||||
color: "white",
|
||||
style: { color: "black " },
|
||||
}}
|
||||
iconOnly
|
||||
/>
|
||||
</div>
|
||||
<div className="item-detail-episode-image-icon-container">
|
||||
<span className="material-symbols-rounded item-detail-episode-image-icon">
|
||||
tv_gen
|
||||
</span>
|
||||
</div>
|
||||
<img
|
||||
alt={episode.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
episode.Id ?? "",
|
||||
"Primary",
|
||||
{ tag: episode.ImageTags?.Primary, fillHeight: 300 },
|
||||
)
|
||||
}
|
||||
className="item-detail-episode-image"
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = "1";
|
||||
}}
|
||||
/>
|
||||
{(episode.UserData?.PlaybackPositionTicks ?? 0) > 0 && (
|
||||
<div className="card-progress-container">
|
||||
<div
|
||||
className="card-progress"
|
||||
style={{
|
||||
width: `${episode.UserData?.PlayedPercentage}%`,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="item-detail-episode-info">
|
||||
<Typography variant="subtitle1">{episode.Name}</Typography>
|
||||
<div
|
||||
className="flex flex-row flex-align-center"
|
||||
style={{ gap: "0.5em" }}
|
||||
>
|
||||
{episode.PremiereDate && (
|
||||
<Chip
|
||||
variant="filled"
|
||||
label={getEpisodeDateString(
|
||||
new Date(episode.PremiereDate),
|
||||
)}
|
||||
size="small"
|
||||
/>
|
||||
)}
|
||||
<Typography variant="caption">
|
||||
{getRuntimeCompact(episode.RunTimeTicks ?? 0)}
|
||||
</Typography>
|
||||
</div>
|
||||
<Typography
|
||||
variant="caption"
|
||||
style={{
|
||||
display: "-webkit-box",
|
||||
textOverflow: "ellipsis",
|
||||
overflow: "hidden",
|
||||
WebkitLineClamp: 2,
|
||||
WebkitBoxOrient: "vertical",
|
||||
width: "100%",
|
||||
opacity: 0.7,
|
||||
}}
|
||||
>
|
||||
{episode.Overview}
|
||||
</Typography>
|
||||
</div>
|
||||
<div
|
||||
className="item-detail-episode-buttons"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<LikeButton
|
||||
itemId={episode.Id}
|
||||
itemName={episode.Name}
|
||||
isFavorite={episode.UserData?.IsFavorite}
|
||||
queryKey={["item", id]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
<MarkPlayedButton
|
||||
itemId={episode.Id}
|
||||
itemName={episode.Name}
|
||||
isPlayed={episode.UserData?.Played}
|
||||
queryKey={["item", id]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
</motion.div>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<CastAndCrew people={item.People} api={api} />
|
||||
{(specialFeatures.data?.length ?? 0) > 0 && (
|
||||
<CardScroller
|
||||
title="Special Features"
|
||||
displayCards={7}
|
||||
disableDecoration
|
||||
>
|
||||
{specialFeatures.data?.map((special) => (
|
||||
<Card
|
||||
key={special.Id}
|
||||
item={special}
|
||||
seriesId={special.SeriesId}
|
||||
cardTitle={special.Name}
|
||||
imageType="Primary"
|
||||
cardCaption={getRuntimeMusic(special.RunTimeTicks ?? 0)}
|
||||
cardType="portrait"
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user?.Id}
|
||||
onClick={() => {}}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
<SimilarItems item={item} />
|
||||
</ItemDetailLayout>
|
||||
);
|
||||
};
|
||||
|
||||
export default SeriesView;
|
||||
@@ -47,6 +47,8 @@ const ItemHeader = ({
|
||||
backdropSrc,
|
||||
}: ItemHeaderProps) => {
|
||||
const isEpisode = item.Type === "Episode";
|
||||
// A runtime / "ends at" is meaningless for people and artists (it sums their whole catalogue)
|
||||
const showRuntime = item.Type !== "MusicArtist" && item.Type !== "Person";
|
||||
const backdropTag =
|
||||
isEpisode && item.ParentBackdropImageTags?.length
|
||||
? item.ParentBackdropImageTags[0]
|
||||
@@ -63,8 +65,7 @@ const ItemHeader = ({
|
||||
const logoId =
|
||||
isEpisode && parentLogoImageTag ? (item.SeriesId ?? item.Id) : item.Id;
|
||||
|
||||
const logo =
|
||||
logoTag ? (
|
||||
const logo = logoTag ? (
|
||||
<img
|
||||
alt={item.Name ?? ""}
|
||||
src={
|
||||
@@ -82,7 +83,13 @@ const ItemHeader = ({
|
||||
className="item-hero-logo"
|
||||
/>
|
||||
) : (
|
||||
<Typography mb={2} fontWeight={200} variant="h2">
|
||||
<Typography
|
||||
variant="h2"
|
||||
sx={{
|
||||
mb: 2,
|
||||
fontWeight: 200,
|
||||
}}
|
||||
>
|
||||
{isEpisode ? item.SeriesName : item.Name}
|
||||
</Typography>
|
||||
);
|
||||
@@ -151,8 +158,9 @@ const ItemHeader = ({
|
||||
<div className="item-hero-detail flex flex-column">
|
||||
{isEpisode && logoId ? (
|
||||
<Link
|
||||
to="/series/$id"
|
||||
to="/item/$id"
|
||||
params={{ id: logoId }}
|
||||
search={{ type: "Series" }}
|
||||
style={{
|
||||
textDecoration: "none",
|
||||
color: "inherit",
|
||||
@@ -165,7 +173,13 @@ const ItemHeader = ({
|
||||
logo
|
||||
)}
|
||||
{isEpisode && (
|
||||
<Typography mb={2} fontWeight={200} variant="h4">
|
||||
<Typography
|
||||
variant="h4"
|
||||
sx={{
|
||||
mb: 2,
|
||||
fontWeight: 200,
|
||||
}}
|
||||
>
|
||||
{item.ParentIndexNumber !== undefined &&
|
||||
item.IndexNumber !== undefined
|
||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - `
|
||||
@@ -175,9 +189,11 @@ const ItemHeader = ({
|
||||
)}
|
||||
<Stack
|
||||
direction="row"
|
||||
gap={2}
|
||||
justifyItems="flex-start"
|
||||
alignItems="center"
|
||||
sx={{
|
||||
gap: 2,
|
||||
justifyItems: "flex-start",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
{mediaQualityInfo?.isUHD && (
|
||||
<img
|
||||
@@ -280,12 +296,12 @@ const ItemHeader = ({
|
||||
</div>
|
||||
)}
|
||||
|
||||
{item.RunTimeTicks && (
|
||||
{showRuntime && item.RunTimeTicks && (
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||
{getRuntime(item.RunTimeTicks)}
|
||||
</Typography>
|
||||
)}
|
||||
{item.RunTimeTicks && (
|
||||
{showRuntime && item.RunTimeTicks && (
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||
{endsAt(
|
||||
item.RunTimeTicks - (item.UserData?.PlaybackPositionTicks ?? 0),
|
||||
@@ -299,9 +315,11 @@ const ItemHeader = ({
|
||||
{mediaQualityInfo && (
|
||||
<Stack
|
||||
direction="row"
|
||||
gap={2}
|
||||
justifyItems="flex-start"
|
||||
alignItems="center"
|
||||
sx={{
|
||||
gap: 2,
|
||||
justifyItems: "flex-start",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
{mediaQualityInfo?.isHDR10Plus && (
|
||||
<img
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from "react";
|
||||
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import {
|
||||
@@ -30,7 +30,7 @@ export const ArtistAlbum = ({ user, album, boxProps }: ArtistAlbumProps) => {
|
||||
queryKey: ["artist", "album", album.Id],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
const result = await getLibraryApi(api).getItems({
|
||||
userId: user.Id,
|
||||
parentId: album.Id,
|
||||
sortOrder: [SortOrder.Ascending],
|
||||
@@ -91,13 +91,15 @@ export const ArtistAlbum = ({ user, album, boxProps }: ArtistAlbumProps) => {
|
||||
<div className="flex flex-column">
|
||||
<Typography
|
||||
variant="h5"
|
||||
fontWeight={300}
|
||||
style={{ opacity: "0.6" }}
|
||||
sx={{
|
||||
fontWeight: 300,
|
||||
}}
|
||||
>
|
||||
{album.ProductionYear}
|
||||
</Typography>
|
||||
<Link
|
||||
to="/album/$id"
|
||||
to="/music/album/$id"
|
||||
params={{ id: album.Id ?? "" }}
|
||||
style={{ color: "white", textDecoration: "none" }}
|
||||
>
|
||||
|
||||
@@ -10,32 +10,21 @@ import {
|
||||
type BaseItemDto,
|
||||
BaseItemKind,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { getLibraryLatestQueryOptions } from "@/utils/queries/items";
|
||||
|
||||
/**
|
||||
* @description Latest Media Section
|
||||
*/
|
||||
export const LatestMediaSection = ({
|
||||
latestMediaLib,
|
||||
}: { latestMediaLib: BaseItemDto }) => {
|
||||
}: {
|
||||
latestMediaLib: BaseItemDto;
|
||||
}) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const fetchLatestMedia = async (library: BaseItemDto) => {
|
||||
if (!api || !user?.Id) return null;
|
||||
const media = await getUserLibraryApi(api).getLatestMedia({
|
||||
userId: user.Id,
|
||||
parentId: library.Id,
|
||||
limit: 16,
|
||||
fields: ["PrimaryImageAspectRatio", "ParentId"],
|
||||
});
|
||||
return media.data;
|
||||
};
|
||||
const data = useQuery({
|
||||
queryKey: ["home", "latestMedia", latestMediaLib.Id],
|
||||
queryFn: () => fetchLatestMedia(latestMediaLib),
|
||||
enabled: !!user?.Id,
|
||||
refetchOnMount: true,
|
||||
});
|
||||
const data = useQuery(
|
||||
getLibraryLatestQueryOptions(api, user?.Id, latestMediaLib.Id),
|
||||
);
|
||||
if (data.isPending) {
|
||||
return <CardsSkeleton />;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { ItemSortBy, SortOrder } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import {
|
||||
AppBar,
|
||||
Chip,
|
||||
@@ -182,7 +182,7 @@ export const LibraryHeader = () => {
|
||||
await queryClient.prefetchQuery({
|
||||
queryKey: key,
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
const result = await getLibraryApi(api).getItems({
|
||||
userId: user.Id!,
|
||||
parentId: currentLibraryId,
|
||||
recursive: true,
|
||||
@@ -304,10 +304,10 @@ export const LibraryHeader = () => {
|
||||
size="small"
|
||||
value={String(normalizedViewType)}
|
||||
onChange={handleChangeViewType}
|
||||
SelectProps={{
|
||||
slotProps={{
|
||||
select: {
|
||||
MenuProps: {
|
||||
PaperProps: {
|
||||
className: "glass-menu-paper",
|
||||
slotProps: { paper: { className: "glass-menu-paper" } },
|
||||
},
|
||||
},
|
||||
}}
|
||||
@@ -342,10 +342,10 @@ export const LibraryHeader = () => {
|
||||
value={normalizedSortBy}
|
||||
onChange={handleChangeSortBy}
|
||||
disabled={disableSortOption}
|
||||
SelectProps={{
|
||||
slotProps={{
|
||||
select: {
|
||||
MenuProps: {
|
||||
PaperProps: {
|
||||
className: "glass-menu-paper",
|
||||
slotProps: { paper: { className: "glass-menu-paper" } },
|
||||
},
|
||||
},
|
||||
}}
|
||||
|
||||
@@ -20,7 +20,6 @@ import { useApiInContext } from "@/utils/store/api";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { useLibraryStateStore } from "@/utils/store/libraryState";
|
||||
// @ts-expect-error: Vite worker import
|
||||
import BackdropWorker from "@/utils/workers/backdrop.worker?worker";
|
||||
import { Card } from "../card/card";
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
import { getBrandingApi } from "@jellyfin/sdk/lib/utils/api/branding-api";
|
||||
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { Link } from "@tanstack/react-router";
|
||||
import React, { type ReactNode, useEffect } from "react";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
|
||||
import "./loginShell.scss";
|
||||
|
||||
type LoginShellProps = {
|
||||
title: ReactNode;
|
||||
subtitle?: ReactNode;
|
||||
/** Max width of the content column. */
|
||||
width?: "narrow" | "wide";
|
||||
children: ReactNode;
|
||||
footer?: ReactNode;
|
||||
};
|
||||
|
||||
/** Shared full-screen layout for the sign-in pages. */
|
||||
const LoginShell = ({
|
||||
title,
|
||||
subtitle,
|
||||
width = "narrow",
|
||||
children,
|
||||
footer,
|
||||
}: LoginShellProps) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
|
||||
const serverInfo = useQuery({
|
||||
queryKey: ["login", "serverInfo"],
|
||||
queryFn: async () =>
|
||||
api ? (await getSystemApi(api).getPublicSystemInfo()).data : null,
|
||||
enabled: Boolean(api),
|
||||
staleTime: 5 * 60_000,
|
||||
});
|
||||
const branding = useQuery({
|
||||
queryKey: ["login", "branding"],
|
||||
queryFn: async () =>
|
||||
api ? (await getBrandingApi(api).getBrandingOptions()).data : null,
|
||||
enabled: Boolean(api),
|
||||
staleTime: 5 * 60_000,
|
||||
});
|
||||
|
||||
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||
useEffect(() => {
|
||||
setBackdrop("");
|
||||
}, [setBackdrop]);
|
||||
|
||||
const serverName = serverInfo.data?.ServerName;
|
||||
const serverHost = api?.basePath.replace(/^https?:\/\//, "");
|
||||
|
||||
return (
|
||||
<div className="login-shell scrollY">
|
||||
<div className={`login-shell-content login-shell-${width}`}>
|
||||
{serverHost && (
|
||||
<div className="login-shell-server">
|
||||
<span className="material-symbols-rounded">dns</span>
|
||||
<span className="login-shell-server-name" title={serverHost}>
|
||||
{serverName ?? serverHost}
|
||||
</span>
|
||||
<Link to="/setup/server/list" className="login-shell-server-change">
|
||||
Change
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<header className="login-shell-header">
|
||||
<h1 className="login-shell-title">{title}</h1>
|
||||
{subtitle && <p className="login-shell-subtitle">{subtitle}</p>}
|
||||
</header>
|
||||
|
||||
<main className="login-shell-body">{children}</main>
|
||||
|
||||
{footer && <footer className="login-shell-footer">{footer}</footer>}
|
||||
|
||||
{branding.data?.LoginDisclaimer && (
|
||||
<aside className="login-shell-disclaimer">
|
||||
<span className="material-symbols-rounded">info</span>
|
||||
<p>{branding.data.LoginDisclaimer}</p>
|
||||
</aside>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default LoginShell;
|
||||
@@ -0,0 +1,278 @@
|
||||
.login-shell {
|
||||
// In normal flow (not fixed) so the app bar above stays clickable
|
||||
position: relative;
|
||||
min-height: 100vh;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 5rem 1.5rem 3rem;
|
||||
box-sizing: border-box;
|
||||
color: white;
|
||||
// Soft accent glow instead of a boxed card
|
||||
background:
|
||||
radial-gradient(ellipse 60% 45% at 50% 0%, rgb(255 41 128 / 0.14), transparent 70%),
|
||||
radial-gradient(ellipse 50% 40% at 50% 100%, rgb(110 0 184 / 0.18), transparent 70%);
|
||||
|
||||
&-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
margin: auto 0;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
&-narrow {
|
||||
max-width: 380px;
|
||||
}
|
||||
&-wide {
|
||||
max-width: 880px;
|
||||
}
|
||||
|
||||
&-server {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
max-width: 100%;
|
||||
padding: 0.35rem 0.5rem 0.35rem 0.75rem;
|
||||
border-radius: 999px;
|
||||
background: rgb(255 255 255 / 0.06);
|
||||
border: 1px solid rgb(255 255 255 / 0.08);
|
||||
font-size: 0.85rem;
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.1rem;
|
||||
opacity: 0.6;
|
||||
}
|
||||
&-name {
|
||||
opacity: 0.85;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
&-change {
|
||||
flex-shrink: 0;
|
||||
padding: 0.15rem 0.6rem;
|
||||
border-radius: 999px;
|
||||
color: white;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
background: rgb(255 255 255 / 0.08);
|
||||
transition: background 0.15s ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
background: rgb(255 255 255 / 0.16);
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-header {
|
||||
text-align: center;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
&-title {
|
||||
margin: 0;
|
||||
font-size: clamp(1.75rem, 4vw, 2.5rem);
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.02em;
|
||||
line-height: 1.15;
|
||||
}
|
||||
&-subtitle {
|
||||
margin: 0.5rem 0 0;
|
||||
opacity: 0.65;
|
||||
}
|
||||
|
||||
&-body {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&-footer {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 0.5rem 1rem;
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
&-disclaimer {
|
||||
display: flex;
|
||||
gap: 0.6rem;
|
||||
max-width: 480px;
|
||||
padding: 0.9rem 1rem;
|
||||
border-radius: 0.75rem;
|
||||
background: rgb(255 255 255 / 0.04);
|
||||
border: 1px solid rgb(255 255 255 / 0.08);
|
||||
font-size: 0.85rem;
|
||||
line-height: 1.5;
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.2rem;
|
||||
opacity: 0.6;
|
||||
}
|
||||
p {
|
||||
margin: 0;
|
||||
opacity: 0.75;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Text-style secondary action used in login footers
|
||||
.login-link {
|
||||
all: unset;
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
padding: 0.4rem 0.75rem;
|
||||
border-radius: 999px;
|
||||
font-size: 0.9rem;
|
||||
color: rgb(255 255 255 / 0.75);
|
||||
text-decoration: none;
|
||||
transition: background 0.15s ease, color 0.15s ease;
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.15rem;
|
||||
}
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
color: white;
|
||||
background: rgb(255 255 255 / 0.08);
|
||||
}
|
||||
}
|
||||
|
||||
// Profile picker
|
||||
.profile-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(128px, 148px));
|
||||
justify-content: center;
|
||||
gap: 1.5rem 1rem;
|
||||
}
|
||||
|
||||
.profile {
|
||||
all: unset;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.75rem 0.5rem;
|
||||
border-radius: 1rem;
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
|
||||
&-avatar {
|
||||
position: relative;
|
||||
width: 112px;
|
||||
height: 112px;
|
||||
border-radius: 50%;
|
||||
// Ring that lights up on hover / focus
|
||||
box-shadow: 0 0 0 3px transparent, 0 10px 24px rgb(0 0 0 / 0.4);
|
||||
transition: box-shadow 0.2s ease, transform 0.2s ease;
|
||||
|
||||
img,
|
||||
.profile-avatar-fallback {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
}
|
||||
&-fallback {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 2.75rem;
|
||||
font-weight: 700;
|
||||
background: linear-gradient(135deg, $clr-accent-default, $clr-secondary-default);
|
||||
}
|
||||
&-add {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgb(255 255 255 / 0.06);
|
||||
border: 2px dashed rgb(255 255 255 / 0.25);
|
||||
box-sizing: border-box;
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 2.5rem;
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-lock {
|
||||
position: absolute;
|
||||
right: 2px;
|
||||
bottom: 2px;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgb(18 18 24);
|
||||
border: 2px solid rgb(18 18 24);
|
||||
box-sizing: border-box;
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1rem;
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
|
||||
&-name {
|
||||
max-width: 100%;
|
||||
font-weight: 600;
|
||||
opacity: 0.8;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
.profile-avatar {
|
||||
transform: translateY(-3px);
|
||||
box-shadow: 0 0 0 3px $clr-accent-default, 0 14px 30px rgb(0 0 0 / 0.5);
|
||||
}
|
||||
.profile-name {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Password / manual sign-in form
|
||||
.login-form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
width: 100%;
|
||||
|
||||
&-avatar {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: 0.25rem;
|
||||
|
||||
.profile-avatar {
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
}
|
||||
}
|
||||
|
||||
&-options {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin: -0.25rem 0;
|
||||
}
|
||||
|
||||
&-submit.MuiButton-root {
|
||||
height: 48px;
|
||||
border-radius: 12px;
|
||||
font-weight: 700;
|
||||
text-transform: none;
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import type { Api } from "@jellyfin/sdk";
|
||||
import type { UserDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { queryOptions } from "@tanstack/react-query";
|
||||
import React, { useState } from "react";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
|
||||
/** Public (listed) users of the current server; shared by the login pages. */
|
||||
export const getPublicUsersQueryOptions = (api: Api | null | undefined) =>
|
||||
queryOptions({
|
||||
queryKey: ["login", "public-users"],
|
||||
queryFn: async () =>
|
||||
api ? (await getUserApi(api).getPublicUsers()).data : [],
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
|
||||
type ProfileAvatarProps = {
|
||||
userId: string;
|
||||
name: string;
|
||||
imageTag?: string | null;
|
||||
/** Shows a lock badge for password-protected profiles. */
|
||||
locked?: boolean;
|
||||
};
|
||||
|
||||
/** Round profile picture, falling back to the user's initial. */
|
||||
export const ProfileAvatar = ({
|
||||
userId,
|
||||
name,
|
||||
imageTag,
|
||||
locked,
|
||||
}: ProfileAvatarProps) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const [failed, setFailed] = useState(false);
|
||||
const showImage = api && imageTag && !failed;
|
||||
|
||||
return (
|
||||
<span className="profile-avatar">
|
||||
{showImage ? (
|
||||
<img
|
||||
alt=""
|
||||
src={`${api.basePath}/Users/${userId}/Images/Primary?quality=85&fillWidth=224&fillHeight=224&tag=${imageTag}`}
|
||||
onError={() => setFailed(true)}
|
||||
/>
|
||||
) : (
|
||||
<span className="profile-avatar-fallback" aria-hidden>
|
||||
{name.trim().charAt(0).toUpperCase() || "?"}
|
||||
</span>
|
||||
)}
|
||||
{locked && (
|
||||
<span className="profile-lock" title="Password protected">
|
||||
<span className="material-symbols-rounded">lock</span>
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
export const isPasswordProtected = (user: UserDto | undefined) =>
|
||||
user?.HasPassword !== false;
|
||||
@@ -116,14 +116,16 @@ const MusicTrack = ({
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
fontWeight="400"
|
||||
style={{
|
||||
textDecoration: "none",
|
||||
}}
|
||||
sx={{
|
||||
fontWeight: "400",
|
||||
}}
|
||||
>
|
||||
<Link
|
||||
style={{ textDecoration: "none", color: "white" }}
|
||||
to="/artist/$id"
|
||||
to="/music/artist/$id"
|
||||
params={{ id: artist.Id ?? "" }}
|
||||
>
|
||||
{artist.Name}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { yellow } from "@mui/material/colors";
|
||||
@@ -29,10 +28,21 @@ export const EmptyNotice = ({ extraMsg }: { extraMsg?: string }) => {
|
||||
>
|
||||
sentiment_dissatisfied
|
||||
</div>
|
||||
<Typography variant="h4" fontWeight={300}>
|
||||
<Typography
|
||||
variant="h4"
|
||||
sx={{
|
||||
fontWeight: 300,
|
||||
}}
|
||||
>
|
||||
No results found
|
||||
</Typography>
|
||||
<Typography variant="subtitle1" fontWeight={300} style={{ opacity: 0.5 }}>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{ opacity: 0.5 }}
|
||||
sx={{
|
||||
fontWeight: 300,
|
||||
}}
|
||||
>
|
||||
{extraMsg}
|
||||
</Typography>
|
||||
</Box>
|
||||
|
||||
@@ -29,13 +29,18 @@ export const ErrorNotice = ({ error }: { error?: Error }) => {
|
||||
>
|
||||
error
|
||||
</div>
|
||||
<Typography variant="h3" color="white" fontWeight={300}>
|
||||
<Typography
|
||||
variant="h3"
|
||||
sx={{
|
||||
color: "white",
|
||||
fontWeight: 300,
|
||||
}}
|
||||
>
|
||||
Something went wrong.
|
||||
</Typography>
|
||||
<Typography
|
||||
fontFamily="JetBrains Mono Variable"
|
||||
fontWeight={100}
|
||||
variant="h5"
|
||||
variant="body2"
|
||||
component="pre"
|
||||
style={{
|
||||
padding: "0.5em",
|
||||
background: "rgb(0 0 0 / 1)",
|
||||
@@ -45,11 +50,16 @@ export const ErrorNotice = ({ error }: { error?: Error }) => {
|
||||
maxHeight: "20em",
|
||||
overflow: "auto",
|
||||
marginTop: "1em",
|
||||
// opacity: 0.6,
|
||||
whiteSpace: "pre-wrap",
|
||||
}}
|
||||
sx={{
|
||||
color: "grey.400",
|
||||
fontFamily: "JetBrains Mono Variable",
|
||||
}}
|
||||
color="gray"
|
||||
>
|
||||
{JSON.stringify(error?.stack)}
|
||||
{error
|
||||
? error.stack || `${error.name}: ${error.message}`
|
||||
: "Unknown error"}
|
||||
</Typography>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -57,7 +57,7 @@ const OutroCard = (props: { handleShowCredits: () => void }) => {
|
||||
</Typography>
|
||||
<div className="outro-card-content-buttons">
|
||||
<Button
|
||||
onClick={handlePlayNext.mutate}
|
||||
onClick={() => handlePlayNext.mutate()}
|
||||
//@ts-ignore
|
||||
color="white"
|
||||
variant="contained"
|
||||
|
||||
@@ -1,140 +1,228 @@
|
||||
$image-size: 4em;
|
||||
$art-size: 48px;
|
||||
|
||||
.audio-player {
|
||||
position: fixed;
|
||||
bottom: 1rem;
|
||||
bottom: 0.75rem;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 95%;
|
||||
max-width: 1200px;
|
||||
width: min(1100px, calc(100% - 1.5rem));
|
||||
height: 80px;
|
||||
box-sizing: border-box;
|
||||
z-index: 100;
|
||||
|
||||
display: grid;
|
||||
padding: 0.75em 1.5em;
|
||||
gap: 1.5em;
|
||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
|
||||
grid-template-columns: 25% 1fr 25%;
|
||||
@include glass-effect($blur: 12px, $bg-color: rgba(18, 18, 18, 0.85));
|
||||
// background: rgba(18, 18, 18, 0.85) !important;
|
||||
// backdrop-filter: blur(12px);
|
||||
// -webkit-backdrop-filter: blur(12px);
|
||||
// border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border-radius: 1rem;
|
||||
// Equal side columns keep the transport truly centred
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 540px) minmax(0, 1fr);
|
||||
align-items: center;
|
||||
gap: 1.5rem;
|
||||
padding: 0 0.75rem 0 1rem;
|
||||
|
||||
@media (max-width: 900px) {
|
||||
grid-template-columns: 1fr auto;
|
||||
padding: 0.5em 1em;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
border-radius: 0;
|
||||
border-bottom: none;
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
color: white;
|
||||
background: rgb(18 18 24 / 0.92);
|
||||
backdrop-filter: blur(16px);
|
||||
-webkit-backdrop-filter: blur(16px);
|
||||
border: 1px solid rgb(255 255 255 / 0.08);
|
||||
border-radius: 14px;
|
||||
box-shadow: 0 12px 40px rgb(0 0 0 / 0.45);
|
||||
|
||||
.audio-player-controls {
|
||||
display: none; // Hide controls on mobile for now or adjust
|
||||
}
|
||||
}
|
||||
|
||||
#waveform {
|
||||
width: 100%;
|
||||
transform: scaleY(0);
|
||||
transition: transform $transition-time-default;
|
||||
&[data-show="true"] {
|
||||
transform: scaleY(1) !important;
|
||||
}
|
||||
}
|
||||
&-controls {
|
||||
&-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5em;
|
||||
padding: 0.5em 0;
|
||||
flex-flow: column;
|
||||
gap: 0.75rem;
|
||||
min-width: 0;
|
||||
|
||||
> .MuiIconButton-root {
|
||||
flex-shrink: 0;
|
||||
color: rgb(255 255 255 / 0.75);
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
}
|
||||
&-info {
|
||||
display: grid;
|
||||
gap: 1em;
|
||||
grid-template-columns: minmax(0, $image-size) minmax(0, 1fr);
|
||||
width: fit-content;
|
||||
align-items: center;
|
||||
flex-grow: 1;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
|
||||
&-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&-title {
|
||||
all: unset;
|
||||
cursor: pointer;
|
||||
font-weight: 600 !important;
|
||||
line-height: 1.25 !important;
|
||||
// Wrap long titles onto a second line before truncating
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
overflow-wrap: anywhere;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
&-artist {
|
||||
opacity: 0.6;
|
||||
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-image {
|
||||
width: $image-size;
|
||||
aspect-ratio: 1;
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
z-index: 1;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 1;
|
||||
|
||||
position: relative;
|
||||
&-container {
|
||||
border-radius: $border-radius_04;
|
||||
all: unset;
|
||||
position: relative;
|
||||
flex-shrink: 0;
|
||||
width: $art-size;
|
||||
height: $art-size;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
height: fit-content;
|
||||
aspect-ratio: 1;
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
cursor: pointer;
|
||||
background: rgb(255 255 255 / 0.08);
|
||||
|
||||
&:hover .audio-player-image-expand,
|
||||
&:focus-visible .audio-player-image-expand {
|
||||
opacity: 1;
|
||||
}
|
||||
&-icon {
|
||||
}
|
||||
|
||||
&-icon,
|
||||
&-expand {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
font-size: 2em !important;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
&-icon {
|
||||
font-size: 1.5rem !important;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
// "Open player" affordance shown over the art on hover
|
||||
&-expand {
|
||||
z-index: 2;
|
||||
inset: 0;
|
||||
transform: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgb(0 0 0 / 0.5);
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s ease;
|
||||
}
|
||||
}
|
||||
&-track {
|
||||
grid-template-columns: $image-size 60% 0.5fr 0.5fr !important;
|
||||
}
|
||||
&-playlist{
|
||||
background: $clr-background-dark !important;
|
||||
border: 1.2px solid rgb(255 255 255 / 0.2);
|
||||
|
||||
// Transport on top, compact seek row underneath
|
||||
&-center {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
// Magic scrollbar
|
||||
&::-webkit-scrollbar {
|
||||
&-thumb {
|
||||
height: 150px;
|
||||
max-height: 33%;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
min-width: 0;
|
||||
|
||||
.player-controls {
|
||||
gap: 0.5rem !important;
|
||||
|
||||
.MuiFab-root {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
min-height: 36px;
|
||||
box-shadow: none;
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.6rem !important;
|
||||
}
|
||||
}
|
||||
&-track {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
background: transparent !important;
|
||||
}
|
||||
}
|
||||
|
||||
&-track{
|
||||
display: grid;
|
||||
gap: 1em;
|
||||
grid-template-columns: 4em 1fr 4em;
|
||||
cursor: pointer;
|
||||
&.active{
|
||||
color: $clr-accent-default;
|
||||
&-progress {
|
||||
gap: 0.6rem !important;
|
||||
|
||||
.MuiTypography-root {
|
||||
min-width: 2.75em !important;
|
||||
font-size: 0.7rem;
|
||||
opacity: 0.6 !important;
|
||||
}
|
||||
&-image{
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
border: 1.2px solid rgb(255 255 255 / 0.1);
|
||||
overflow: hidden;
|
||||
border-radius:5px;
|
||||
width: 100%;
|
||||
aspect-ratio: 1;
|
||||
height: 4em;
|
||||
|
||||
.MuiSlider-root {
|
||||
padding: 8px 0;
|
||||
}
|
||||
.MuiSlider-thumb {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s ease;
|
||||
}
|
||||
&:hover .MuiSlider-thumb,
|
||||
.MuiSlider-root.Mui-active .MuiSlider-thumb {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 0.25rem;
|
||||
min-width: 0;
|
||||
|
||||
.MuiIconButton-root {
|
||||
color: rgb(255 255 255 / 0.75);
|
||||
&:hover {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-volume {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
|
||||
// Secondary control: neutral and compact
|
||||
.MuiSlider-root {
|
||||
width: 5.5rem !important;
|
||||
color: rgb(255 255 255 / 0.85);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.audio-player-volume,
|
||||
.audio-player-progress .MuiTypography-root {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
grid-template-columns: minmax(0, 1fr) auto auto;
|
||||
gap: 0.5rem;
|
||||
bottom: 0.5rem;
|
||||
width: calc(100% - 1rem);
|
||||
height: 64px;
|
||||
|
||||
.audio-player-center .player-controls > :not(:has(.MuiFab-root)),
|
||||
.audio-player-progress {
|
||||
display: none;
|
||||
}
|
||||
.audio-player-actions > :not(:last-child) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +1,47 @@
|
||||
import type { Api } from "@jellyfin/sdk";
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getLyricsApi } from "@jellyfin/sdk/lib/utils/api/lyrics-api";
|
||||
import { getLyricApi } from "@jellyfin/sdk/lib/utils/api/lyric-api";
|
||||
import { Typography } from "@mui/material";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import { queryOptions, useQuery } from "@tanstack/react-query";
|
||||
import React, { useEffect, useRef } from "react";
|
||||
import { secToTicks } from "@/utils/date/time";
|
||||
|
||||
interface LyricsPanelProps {
|
||||
item: BaseItemDto | undefined | null;
|
||||
api: Api | undefined;
|
||||
currentTime: number;
|
||||
}
|
||||
|
||||
const LyricsPanel = ({ item, api, currentTime }: LyricsPanelProps) => {
|
||||
const lyricsContainer = useRef<HTMLDivElement | null>(null);
|
||||
|
||||
const lyrics = useQuery({
|
||||
export const getLyricsQueryOptions = (
|
||||
item: BaseItemDto | undefined | null,
|
||||
api: Api | undefined,
|
||||
) =>
|
||||
queryOptions({
|
||||
queryKey: ["player", "audio", item?.Id, "lyrics"],
|
||||
queryFn: async () => {
|
||||
if (!item?.Id || !api) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
const response = await getLyricsApi(api).getLyrics({
|
||||
itemId: item?.Id,
|
||||
const response = await getLyricApi(api).getLyrics({
|
||||
itemId: item.Id,
|
||||
});
|
||||
return response.data;
|
||||
} catch (e) {
|
||||
console.error("Failed to fetch lyrics", e);
|
||||
} catch {
|
||||
// Items without lyrics return 404
|
||||
return null;
|
||||
}
|
||||
},
|
||||
enabled: Boolean(item?.Id) && Boolean(api),
|
||||
});
|
||||
|
||||
interface LyricsPanelProps {
|
||||
item: BaseItemDto | undefined | null;
|
||||
api: Api | undefined;
|
||||
currentTime: number;
|
||||
/** Seeks playback to a position in ticks; enables clicking synced lines. */
|
||||
onSeek?: (ticks: number) => void;
|
||||
}
|
||||
|
||||
const LyricsPanel = ({ item, api, currentTime, onSeek }: LyricsPanelProps) => {
|
||||
const lyricsContainer = useRef<HTMLDivElement | null>(null);
|
||||
|
||||
const lyrics = useQuery(getLyricsQueryOptions(item, api));
|
||||
|
||||
useEffect(() => {
|
||||
if (lyrics.data && lyricsContainer.current) {
|
||||
const currentLyric = lyricsContainer.current.querySelector(
|
||||
@@ -78,6 +86,11 @@ const LyricsPanel = ({ item, api, currentTime }: LyricsPanelProps) => {
|
||||
(lyrics.data?.Lyrics?.[index + 1]?.Start ??
|
||||
Number.POSITIVE_INFINITY);
|
||||
|
||||
const canSeek = hasSyncedLyrics && onSeek && lyric.Start != null;
|
||||
const seek = () => {
|
||||
if (canSeek) onSeek(lyric.Start ?? 0);
|
||||
};
|
||||
|
||||
return (
|
||||
<Typography
|
||||
variant="body1"
|
||||
@@ -85,6 +98,18 @@ const LyricsPanel = ({ item, api, currentTime }: LyricsPanelProps) => {
|
||||
className={`audio-lyrics-line ${isActive ? "active" : ""}`}
|
||||
key={`${lyric.Text}-${index}`}
|
||||
data-active-lyric={isActive}
|
||||
{...(canSeek && {
|
||||
role: "button",
|
||||
tabIndex: 0,
|
||||
"data-seekable": true,
|
||||
onClick: seek,
|
||||
onKeyDown: (e: React.KeyboardEvent) => {
|
||||
if (e.key === "Enter" || e.key === " ") {
|
||||
e.preventDefault();
|
||||
seek();
|
||||
}
|
||||
},
|
||||
})}
|
||||
>
|
||||
{lyric.Text}
|
||||
</Typography>
|
||||
|
||||
@@ -1,35 +1,31 @@
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import type { ReactNode } from "react";
|
||||
import React from "react";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import React, { type ReactNode } from "react";
|
||||
import QueueButton from "@/components/buttons/queueButton";
|
||||
|
||||
interface PlayerActionsProps {
|
||||
onNavigate: () => void;
|
||||
/** Opens the full-screen player. */
|
||||
onExpand: () => void;
|
||||
onClose: () => void;
|
||||
/** Volume control, rendered between the queue and expand buttons. */
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
const PlayerActions = ({
|
||||
onNavigate,
|
||||
onClose,
|
||||
children,
|
||||
}: PlayerActionsProps) => {
|
||||
const PlayerActions = ({ onExpand, onClose, children }: PlayerActionsProps) => {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "flex-end",
|
||||
}}
|
||||
>
|
||||
<IconButton onClick={onNavigate}>
|
||||
<span className="material-symbols-rounded">info</span>
|
||||
</IconButton>
|
||||
<div className="audio-player-actions">
|
||||
<QueueButton />
|
||||
{children}
|
||||
<IconButton onClick={onClose}>
|
||||
<div className="material-symbols-rounded">close</div>
|
||||
<div className="audio-player-volume">{children}</div>
|
||||
<Tooltip title="Open player">
|
||||
<IconButton onClick={onExpand} aria-label="Open player">
|
||||
<span className="material-symbols-rounded">open_in_full</span>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Tooltip title="Stop and close">
|
||||
<IconButton onClick={onClose} aria-label="Stop and close">
|
||||
<span className="material-symbols-rounded">close</span>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -20,7 +20,10 @@ const PlayerControls = ({
|
||||
onForward,
|
||||
}: PlayerControlsProps) => {
|
||||
return (
|
||||
<div style={{ display: "flex", gap: "1em", alignItems: "center" }}>
|
||||
<div
|
||||
className="player-controls"
|
||||
style={{ display: "flex", gap: "1em", alignItems: "center" }}
|
||||
>
|
||||
<PlayPreviousButton />
|
||||
{onRewind && (
|
||||
<IconButton onClick={onRewind}>
|
||||
|
||||
@@ -1,58 +1,97 @@
|
||||
import type { Api } from "@jellyfin/sdk";
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { Link } from "@tanstack/react-router";
|
||||
import React from "react";
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { getItemQueryOptions } from "@/utils/queries/items";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
|
||||
interface PlayerInfoProps {
|
||||
item: BaseItemDto | undefined | null;
|
||||
api: Api | undefined;
|
||||
trackName?: string;
|
||||
/** Opens the full-screen player. */
|
||||
onOpen: () => void;
|
||||
}
|
||||
|
||||
const PlayerInfo = ({ item, api, trackName }: PlayerInfoProps) => {
|
||||
const PlayerInfo = ({ item, api, onOpen }: PlayerInfoProps) => {
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
// Fresh user data so the like button reflects changes immediately.
|
||||
const itemDetails = useQuery({
|
||||
...getItemQueryOptions(item?.Id ?? "", api, user?.Id),
|
||||
enabled: Boolean(item?.Id && api && user?.Id),
|
||||
});
|
||||
|
||||
if (!api || !item) return null;
|
||||
|
||||
const artists = item.ArtistItems?.length
|
||||
? item.ArtistItems
|
||||
: (item.AlbumArtists ?? []);
|
||||
|
||||
return (
|
||||
<div className="audio-player-info">
|
||||
<div className="audio-player-image-container">
|
||||
<img
|
||||
alt={trackName ?? "track"}
|
||||
className="audio-player-image"
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
(!item?.ImageTags?.Primary ? item?.AlbumId : item.Id) ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 85,
|
||||
fillHeight: 462,
|
||||
fillWidth: 462,
|
||||
},
|
||||
)}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
className="audio-player-image-container"
|
||||
onClick={onOpen}
|
||||
aria-label="Open player"
|
||||
>
|
||||
<span className="material-symbols-rounded audio-player-image-icon">
|
||||
music_note
|
||||
</span>
|
||||
</div>
|
||||
<img
|
||||
alt=""
|
||||
className="audio-player-image"
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
(!item.ImageTags?.Primary ? item.AlbumId : item.Id) ?? "",
|
||||
"Primary",
|
||||
{ quality: 85, fillHeight: 120, fillWidth: 120 },
|
||||
)}
|
||||
/>
|
||||
<span className="material-symbols-rounded audio-player-image-expand">
|
||||
expand_less
|
||||
</span>
|
||||
</button>
|
||||
<div className="audio-player-info-text">
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
width: "100%",
|
||||
}}
|
||||
noWrap
|
||||
component="button"
|
||||
className="audio-player-info-title"
|
||||
title={item.Name ?? undefined}
|
||||
onClick={onOpen}
|
||||
>
|
||||
{item?.Name}
|
||||
{item.Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="caption"
|
||||
style={{
|
||||
opacity: 0.5,
|
||||
}}
|
||||
noWrap
|
||||
className="audio-player-info-artist"
|
||||
>
|
||||
by {item?.Artists?.map((artist) => artist).join(",")}
|
||||
{artists.map((artist, index) => (
|
||||
<React.Fragment key={artist.Id ?? artist.Name}>
|
||||
{index > 0 && ", "}
|
||||
{artist.Id ? (
|
||||
<Link to="/music/artist/$id" params={{ id: artist.Id }}>
|
||||
{artist.Name}
|
||||
</Link>
|
||||
) : (
|
||||
artist.Name
|
||||
)}
|
||||
</React.Fragment>
|
||||
))}
|
||||
</Typography>
|
||||
</div>
|
||||
<LikeButton
|
||||
itemId={item.Id ?? undefined}
|
||||
itemName={item.Name}
|
||||
isFavorite={
|
||||
itemDetails.data?.UserData?.IsFavorite ?? item.UserData?.IsFavorite
|
||||
}
|
||||
queryKey={["item", item.Id ?? ""]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -8,6 +8,12 @@ interface PlayerProgressProps {
|
||||
duration: number;
|
||||
onSeek?: (value: number) => void;
|
||||
onSeekCommit: (value: number) => void;
|
||||
/**
|
||||
* "inline" puts the times beside the bar, "stacked" puts them underneath,
|
||||
* "bare" renders only the slider.
|
||||
*/
|
||||
layout?: "inline" | "stacked" | "bare";
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const PlayerProgress = ({
|
||||
@@ -15,6 +21,8 @@ const PlayerProgress = ({
|
||||
duration,
|
||||
onSeek,
|
||||
onSeekCommit,
|
||||
layout = "inline",
|
||||
className,
|
||||
}: PlayerProgressProps) => {
|
||||
const [isScrubbing, setIsScrubbing] = useState(false);
|
||||
const [sliderValue, setSliderValue] = useState(progress);
|
||||
@@ -38,8 +46,44 @@ const PlayerProgress = ({
|
||||
onSeekCommit(newValue);
|
||||
};
|
||||
|
||||
if (layout === "bare") {
|
||||
return (
|
||||
<Slider
|
||||
className={className}
|
||||
value={sliderValue}
|
||||
step={1}
|
||||
size="small"
|
||||
max={duration}
|
||||
onChange={handleChange}
|
||||
onChangeCommitted={handleChangeCommitted}
|
||||
aria-label="Seek"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (layout === "stacked") {
|
||||
return (
|
||||
<div className="player-progress-stacked">
|
||||
<Slider
|
||||
value={sliderValue}
|
||||
step={1}
|
||||
size="small"
|
||||
max={duration}
|
||||
onChange={handleChange}
|
||||
onChangeCommitted={handleChangeCommitted}
|
||||
aria-label="Seek"
|
||||
/>
|
||||
<div className="player-progress-stacked-times">
|
||||
<span>{getRuntimeMusic(sliderValue)}</span>
|
||||
<span>-{getRuntimeMusic(Math.max(duration - sliderValue, 0))}</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={className}
|
||||
style={{
|
||||
width: "100%",
|
||||
display: "flex",
|
||||
@@ -50,13 +94,15 @@ const PlayerProgress = ({
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
fontWeight={300}
|
||||
style={{
|
||||
opacity: 0.8,
|
||||
minWidth: "3.5em",
|
||||
textAlign: "right",
|
||||
fontVariantNumeric: "tabular-nums",
|
||||
}}
|
||||
sx={{
|
||||
fontWeight: 300,
|
||||
}}
|
||||
>
|
||||
{getRuntimeMusic(sliderValue)}
|
||||
</Typography>
|
||||
@@ -70,13 +116,15 @@ const PlayerProgress = ({
|
||||
/>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
fontWeight={300}
|
||||
style={{
|
||||
opacity: 0.8,
|
||||
minWidth: "3.5em",
|
||||
textAlign: "left",
|
||||
fontVariantNumeric: "tabular-nums",
|
||||
}}
|
||||
sx={{
|
||||
fontWeight: 300,
|
||||
}}
|
||||
>
|
||||
{getRuntimeMusic(duration)}
|
||||
</Typography>
|
||||
|
||||
@@ -45,20 +45,25 @@ const PlayerVolume = ({
|
||||
ml: 1,
|
||||
width: "10em",
|
||||
"& .MuiSlider-valueLabel": {
|
||||
// Compact pill hugging the thumb; above the play FAB (zIndex.fab)
|
||||
zIndex: (theme) => theme.zIndex.tooltip,
|
||||
lineHeight: 1.2,
|
||||
fontSize: 24,
|
||||
background: "rgb(0 0 0 / 0.5)",
|
||||
backdropFilter: "blur(5px)",
|
||||
padding: 1,
|
||||
borderRadius: "10px",
|
||||
fontSize: "0.75rem",
|
||||
fontWeight: 600,
|
||||
fontVariantNumeric: "tabular-nums",
|
||||
minWidth: "2.25em",
|
||||
background: "rgb(0 0 0 / 0.75)",
|
||||
padding: "2px 6px",
|
||||
borderRadius: "6px",
|
||||
border: "1px solid rgb(255 255 255 / 0.15)",
|
||||
boxShadow: "0 0 10px rgb(0 0 0 / 0.4) ",
|
||||
transform: "translatey(-120%) scale(0)",
|
||||
boxShadow: "0 2px 8px rgb(0 0 0 / 0.4)",
|
||||
top: -6,
|
||||
transform: "translatey(-100%) scale(0)",
|
||||
"&:before": {
|
||||
display: "none",
|
||||
},
|
||||
"&.MuiSlider-valueLabelOpen": {
|
||||
transform: "translateY(-120%) scale(1)",
|
||||
transform: "translateY(-100%) scale(1)",
|
||||
},
|
||||
"& > *": {
|
||||
transform: "rotate(0deg)",
|
||||
|
||||
@@ -1,297 +0,0 @@
|
||||
import {
|
||||
closestCenter,
|
||||
DndContext,
|
||||
type DragEndEvent,
|
||||
DragOverlay,
|
||||
type DragStartEvent,
|
||||
type DropAnimation,
|
||||
defaultDropAnimationSideEffects,
|
||||
KeyboardSensor,
|
||||
PointerSensor,
|
||||
useSensor,
|
||||
useSensors,
|
||||
} from "@dnd-kit/core";
|
||||
import {
|
||||
restrictToVerticalAxis,
|
||||
restrictToWindowEdges,
|
||||
} from "@dnd-kit/modifiers";
|
||||
import {
|
||||
arrayMove,
|
||||
SortableContext,
|
||||
sortableKeyboardCoordinates,
|
||||
useSortable,
|
||||
verticalListSortingStrategy,
|
||||
} from "@dnd-kit/sortable";
|
||||
import { CSS } from "@dnd-kit/utilities";
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import {
|
||||
Box,
|
||||
IconButton,
|
||||
Menu,
|
||||
MenuItem,
|
||||
Tooltip,
|
||||
Typography,
|
||||
} from "@mui/material";
|
||||
import React, { useMemo, useState } from "react";
|
||||
import QueueListItem from "@/components/queueListItem";
|
||||
import { stopPlayback } from "@/utils/store/audioPlayback";
|
||||
import useQueue, {
|
||||
clearQueue,
|
||||
removeFromQueue,
|
||||
setQueue,
|
||||
shuffleUpcoming,
|
||||
} from "@/utils/store/queue";
|
||||
|
||||
interface QueuePanelProps {
|
||||
queue: BaseItemDto[];
|
||||
currentTrackIndex: number;
|
||||
}
|
||||
|
||||
const dropAnimation: DropAnimation = {
|
||||
sideEffects: defaultDropAnimationSideEffects({
|
||||
styles: {
|
||||
active: {
|
||||
opacity: "0.5",
|
||||
},
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
function SortableQueueItem({
|
||||
item,
|
||||
onDelete,
|
||||
index,
|
||||
isActive,
|
||||
}: {
|
||||
item: BaseItemDto;
|
||||
onDelete: () => void;
|
||||
index: number;
|
||||
isActive: boolean;
|
||||
}) {
|
||||
const {
|
||||
attributes,
|
||||
listeners,
|
||||
setNodeRef,
|
||||
transform,
|
||||
transition,
|
||||
isDragging,
|
||||
} = useSortable({ id: item.Id || "" });
|
||||
|
||||
const style = {
|
||||
transform: CSS.Translate.toString(transform),
|
||||
transition,
|
||||
opacity: isDragging ? 0.3 : 1,
|
||||
position: "relative" as const,
|
||||
zIndex: isDragging ? 999 : "auto",
|
||||
};
|
||||
|
||||
return (
|
||||
<div ref={setNodeRef} style={style} className="sortable-queue-item">
|
||||
<QueueListItem
|
||||
queueItem={item}
|
||||
onDelete={onDelete}
|
||||
dragHandleProps={{ ...attributes, ...listeners }}
|
||||
isEpisode={item.Type === "Episode"}
|
||||
index={index}
|
||||
className={isActive ? "active" : ""}
|
||||
sx={{
|
||||
bgcolor: isActive
|
||||
? "rgba(255, 255, 255, 0.1) !important"
|
||||
: "transparent",
|
||||
borderRadius: 2,
|
||||
mb: 1,
|
||||
transition: "background-color 0.2s",
|
||||
"&:hover": {
|
||||
bgcolor: "rgba(255, 255, 255, 0.05)",
|
||||
},
|
||||
".MuiListItemText-primary": {
|
||||
color: isActive ? "var(--primary-color, #90caf9)" : "inherit",
|
||||
fontWeight: isActive ? 600 : 500,
|
||||
fontSize: "1rem",
|
||||
},
|
||||
".MuiListItemText-secondary": {
|
||||
fontSize: "0.85rem",
|
||||
opacity: 0.7,
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const QueuePanel = ({ queue, currentTrackIndex }: QueuePanelProps) => {
|
||||
const [activeId, setActiveId] = useState<string | null>(null);
|
||||
|
||||
const sensors = useSensors(
|
||||
useSensor(PointerSensor, {
|
||||
activationConstraint: {
|
||||
distance: 8,
|
||||
},
|
||||
}),
|
||||
useSensor(KeyboardSensor, {
|
||||
coordinateGetter: sortableKeyboardCoordinates,
|
||||
}),
|
||||
);
|
||||
|
||||
const activeItem = useMemo(
|
||||
() => queue.find((item) => item.Id === activeId),
|
||||
[queue, activeId],
|
||||
);
|
||||
|
||||
const handleDragStart = (event: DragStartEvent) => {
|
||||
setActiveId(String(event.active.id));
|
||||
};
|
||||
|
||||
const handleDragEnd = (event: DragEndEvent) => {
|
||||
const { active, over } = event;
|
||||
setActiveId(null);
|
||||
|
||||
if (active.id !== over?.id) {
|
||||
const oldIndex = queue.map((item) => item.Id).indexOf(String(active.id));
|
||||
const newIndex = queue.map((item) => item.Id).indexOf(String(over?.id));
|
||||
|
||||
if (oldIndex !== -1 && newIndex !== -1) {
|
||||
const newQueue = arrayMove(queue, oldIndex, newIndex);
|
||||
const currentTrackId = queue[currentTrackIndex]?.Id;
|
||||
const newCurrentTrackIndex = newQueue.findIndex(
|
||||
(item) => item.Id === currentTrackId,
|
||||
);
|
||||
|
||||
setQueue(
|
||||
newQueue,
|
||||
newCurrentTrackIndex !== -1 ? newCurrentTrackIndex : 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
||||
const open = Boolean(anchorEl);
|
||||
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
||||
setAnchorEl(event.currentTarget);
|
||||
};
|
||||
const handleClose = () => {
|
||||
setAnchorEl(null);
|
||||
};
|
||||
|
||||
const handleClearQueue = () => {
|
||||
stopPlayback();
|
||||
clearQueue();
|
||||
handleClose();
|
||||
};
|
||||
|
||||
return (
|
||||
<DndContext
|
||||
sensors={sensors}
|
||||
collisionDetection={closestCenter}
|
||||
onDragStart={handleDragStart}
|
||||
onDragEnd={handleDragEnd}
|
||||
modifiers={[restrictToVerticalAxis, restrictToWindowEdges]}
|
||||
>
|
||||
<div
|
||||
className="audio-queue-container"
|
||||
style={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
mb: 2,
|
||||
px: 1,
|
||||
}}
|
||||
>
|
||||
<Typography variant="h6" fontWeight={700}>
|
||||
Queue
|
||||
</Typography>
|
||||
<Box sx={{ display: "flex", gap: 1 }}>
|
||||
<Tooltip title="Shuffle Upcoming">
|
||||
<IconButton onClick={() => shuffleUpcoming()} size="small">
|
||||
<span className="material-symbols-rounded">shuffle</span>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<IconButton onClick={handleClick} size="small">
|
||||
<span className="material-symbols-rounded">more_vert</span>
|
||||
</IconButton>
|
||||
</Box>
|
||||
<Menu
|
||||
anchorEl={anchorEl}
|
||||
open={open}
|
||||
onClose={handleClose}
|
||||
transformOrigin={{ horizontal: "right", vertical: "top" }}
|
||||
anchorOrigin={{ horizontal: "right", vertical: "bottom" }}
|
||||
>
|
||||
<MenuItem onClick={handleClearQueue}>
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{ marginRight: "0.5em", fontSize: "1.2em" }}
|
||||
>
|
||||
clear_all
|
||||
</span>
|
||||
Clear Queue
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</Box>
|
||||
|
||||
<SortableContext
|
||||
items={queue.map((track) => track.Id ?? "")}
|
||||
strategy={verticalListSortingStrategy}
|
||||
>
|
||||
<div
|
||||
className="audio-queue"
|
||||
style={{ display: "flex", flexDirection: "column", gap: "0px" }}
|
||||
>
|
||||
{queue.map((track, index) => (
|
||||
<SortableQueueItem
|
||||
key={track.Id}
|
||||
item={track}
|
||||
index={index}
|
||||
onDelete={() => removeFromQueue(index)}
|
||||
isActive={currentTrackIndex === index}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</SortableContext>
|
||||
|
||||
<DragOverlay
|
||||
dropAnimation={dropAnimation}
|
||||
style={{
|
||||
left: "1.5rem",
|
||||
}}
|
||||
>
|
||||
{activeItem ? (
|
||||
<QueueListItem
|
||||
queueItem={activeItem}
|
||||
isEpisode={activeItem.Type === "Episode"}
|
||||
dragHandleProps={{}} // Pass empty object to render handle
|
||||
onDelete={() => {}} // Pass empty function to render delete button space
|
||||
sx={{
|
||||
bgcolor: "rgba(40, 40, 40, 0.9)",
|
||||
backdropFilter: "blur(10px)",
|
||||
borderRadius: 2,
|
||||
boxShadow: "0 8px 32px rgba(0,0,0,0.5)",
|
||||
outline: "1px solid rgba(255, 255, 255, 0.1)",
|
||||
mb: 1,
|
||||
".MuiListItemText-primary": {
|
||||
fontWeight: 500,
|
||||
fontSize: "1rem",
|
||||
},
|
||||
".MuiListItemText-secondary": {
|
||||
fontSize: "0.85rem",
|
||||
opacity: 0.7,
|
||||
},
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
</DragOverlay>
|
||||
</div>
|
||||
</DndContext>
|
||||
);
|
||||
};
|
||||
|
||||
export default React.memo(QueuePanel);
|
||||
@@ -4,7 +4,7 @@ import React, { useEffect, useState } from "react";
|
||||
|
||||
interface StatsPanelProps {
|
||||
item: BaseItemDto | undefined | null;
|
||||
audioRef: React.RefObject<HTMLAudioElement> | null;
|
||||
audioRef: React.RefObject<HTMLAudioElement | null> | null;
|
||||
}
|
||||
|
||||
const StatRow = ({
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
} from "@/utils/store/audioPlayback";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { playItemFromQueue } from "@/utils/store/playback";
|
||||
import useQueue from "@/utils/store/queue";
|
||||
import useQueue, { getNextTrackIndex } from "@/utils/store/queue";
|
||||
import PlayerActions from "./components/PlayerActions";
|
||||
import PlayerControls from "./components/PlayerControls";
|
||||
import PlayerInfo from "./components/PlayerInfo";
|
||||
@@ -104,8 +104,9 @@ const AudioPlayer = () => {
|
||||
}
|
||||
});
|
||||
navigator.mediaSession.setActionHandler("nexttrack", () => {
|
||||
if (user?.Id && api) {
|
||||
playItemFromQueue("next", user.Id, api);
|
||||
const nextIndex = getNextTrackIndex();
|
||||
if (nextIndex !== undefined && user?.Id && api) {
|
||||
playItemFromQueue(nextIndex, user.Id, api);
|
||||
}
|
||||
});
|
||||
navigator.mediaSession.setActionHandler("seekto", (details) => {
|
||||
@@ -151,9 +152,15 @@ const AudioPlayer = () => {
|
||||
};
|
||||
|
||||
const handleEnded = () => {
|
||||
if (useQueue.getState().repeatMode === "one" && audioRef.current) {
|
||||
audioRef.current.currentTime = 0;
|
||||
audioRef.current.play();
|
||||
return;
|
||||
}
|
||||
setPlaying(false);
|
||||
if (tracks?.[currentTrack + 1]?.Id && api && user?.Id) {
|
||||
playItemFromQueue("next", user.Id, api);
|
||||
const nextIndex = getNextTrackIndex();
|
||||
if (nextIndex !== undefined && api && user?.Id) {
|
||||
playItemFromQueue(nextIndex, user.Id, api);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -210,13 +217,9 @@ const AudioPlayer = () => {
|
||||
}}
|
||||
exit={{ transform: "translate(-50%, 150%)" }}
|
||||
transition={{ duration: 0.3, ease: "circOut" }}
|
||||
className="audio-player glass"
|
||||
className="audio-player"
|
||||
>
|
||||
<PlayerInfo
|
||||
item={item}
|
||||
api={api}
|
||||
trackName={tracks?.[currentTrack]?.Name ?? "Unknown Track"}
|
||||
/>
|
||||
<PlayerInfo item={item} api={api} onOpen={handleNavigate} />
|
||||
|
||||
<audio
|
||||
autoPlay
|
||||
@@ -232,16 +235,17 @@ const AudioPlayer = () => {
|
||||
id="audio-player"
|
||||
/>
|
||||
|
||||
<div className="audio-player-controls">
|
||||
<div className="audio-player-center">
|
||||
<PlayerControls playing={playing} onPlayPause={handlePlayPause} />
|
||||
<PlayerProgress
|
||||
className="audio-player-progress"
|
||||
progress={progress}
|
||||
duration={item?.RunTimeTicks ?? 1}
|
||||
onSeekCommit={handleSeekCommit}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<PlayerActions onNavigate={handleNavigate} onClose={handleClose}>
|
||||
<PlayerActions onExpand={handleNavigate} onClose={handleClose}>
|
||||
<PlayerVolume
|
||||
volume={volume}
|
||||
isMuted={isMuted}
|
||||
|
||||
@@ -109,7 +109,12 @@ const StatsForNerds = ({ playerRef }: StatsForNerdsProps) => {
|
||||
marginBottom: "0.5em",
|
||||
}}
|
||||
>
|
||||
<Typography variant="subtitle2" fontWeight="bold">
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
sx={{
|
||||
fontWeight: "bold",
|
||||
}}
|
||||
>
|
||||
Stats for Nerds
|
||||
</Typography>
|
||||
<IconButton
|
||||
@@ -136,8 +141,7 @@ const StatsForNerds = ({ playerRef }: StatsForNerdsProps) => {
|
||||
<span>Video ID:</span> <span>{itemId}</span>
|
||||
<span>Media Source ID:</span> <span>{mediaSourceId}</span>
|
||||
<span>Play Session ID:</span> <span>{playsessionId}</span>
|
||||
<span>Playback Method:</span>{" "}
|
||||
<span>{mediaSource.playMethod}</span>
|
||||
<span>Playback Method:</span> <span>{mediaSource.playMethod}</span>
|
||||
<span>Container:</span> <span>{mediaSource.container}</span>
|
||||
<span>Video Codec:</span> <span>{mediaSource.videoCodec}</span>
|
||||
<span>Audio Codec:</span> <span>{mediaSource.audioCodec}</span>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { TrickplayInfo } from "@jellyfin/sdk/lib/generated-client";
|
||||
import type { TrickplayInfoDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { Slider, Tooltip, Typography } from "@mui/material";
|
||||
import type { Instance } from "@popperjs/core";
|
||||
import React, {
|
||||
@@ -143,7 +143,7 @@ const BubbleSlider = () => {
|
||||
return false;
|
||||
});
|
||||
|
||||
let trickplayResolution: TrickplayInfo | undefined;
|
||||
let trickplayResolution: TrickplayInfoDto | undefined;
|
||||
const trickplayResolutions = mediaSource.id
|
||||
? itemTrickplay?.[mediaSource.id]
|
||||
: null;
|
||||
@@ -190,7 +190,7 @@ const BubbleSlider = () => {
|
||||
const backgroundOffsetY = -(imageOffsetY * trickplayResolution?.Height);
|
||||
|
||||
const imgUrlParamsObject: Record<string, string> = {
|
||||
api_key: String(api?.accessToken),
|
||||
ApiKey: String(api?.accessToken),
|
||||
MediaSourceId: mediaSource.id ?? "",
|
||||
};
|
||||
const imgUrlParams = new URLSearchParams(imgUrlParamsObject).toString();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
||||
import { getSessionApi } from "@jellyfin/sdk/lib/utils/api/session-api";
|
||||
import { IconButton, Slider, Typography } from "@mui/material";
|
||||
import { WebviewWindow as appWindow } from "@tauri-apps/api/webviewWindow";
|
||||
import { AnimatePresence, motion } from "motion/react";
|
||||
@@ -156,7 +156,7 @@ const VideoPlayerControls = ({
|
||||
throw Error("API is not available, cannot report playback stopped.");
|
||||
}
|
||||
// Report Jellyfin server: Playback has ended/stopped
|
||||
getPlaystateApi(api).reportPlaybackStopped({
|
||||
getSessionApi(api).reportPlaybackStopped({
|
||||
playbackStopInfo: {
|
||||
Failed: false,
|
||||
ItemId: itemId,
|
||||
@@ -219,11 +219,23 @@ const VideoPlayerControls = ({
|
||||
</div>
|
||||
<div className="video-player-osd-info">
|
||||
<div>
|
||||
<Typography variant="h4" fontWeight={500} mb={2}>
|
||||
<Typography
|
||||
variant="h4"
|
||||
sx={{
|
||||
fontWeight: 500,
|
||||
mb: 2,
|
||||
}}
|
||||
>
|
||||
{String(itemName)}
|
||||
</Typography>
|
||||
{episodeTitle && (
|
||||
<Typography variant="h6" fontWeight={300} mt={1}>
|
||||
<Typography
|
||||
variant="h6"
|
||||
sx={{
|
||||
fontWeight: 300,
|
||||
mt: 1,
|
||||
}}
|
||||
>
|
||||
{String(episodeTitle)}
|
||||
</Typography>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
MenuItem,
|
||||
MenuList,
|
||||
Popover,
|
||||
Switch,
|
||||
TextField,
|
||||
@@ -144,10 +145,18 @@ const VideoPlayerSettingsMenu = ({
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
<MenuList disablePadding>
|
||||
<MenuItem onClick={toggleShowStatsForNerds}>
|
||||
<Typography flexGrow={1}>Stats for Nerds</Typography>
|
||||
<Typography
|
||||
sx={{
|
||||
flexGrow: 1,
|
||||
}}
|
||||
>
|
||||
Stats for Nerds
|
||||
</Typography>
|
||||
<Switch checked={showStatsForNerds} />
|
||||
</MenuItem>
|
||||
</MenuList>
|
||||
</Popover>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -158,8 +158,8 @@ const UpNextFlyout = () => {
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="body2"
|
||||
color="text.secondary"
|
||||
sx={{
|
||||
color: "text.secondary",
|
||||
mb: 2,
|
||||
display: "-webkit-box",
|
||||
WebkitLineClamp: 1,
|
||||
|
||||
@@ -0,0 +1,325 @@
|
||||
.queue {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
color: white;
|
||||
|
||||
&-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
padding-bottom: 0.75rem;
|
||||
|
||||
&-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.125rem;
|
||||
flex-shrink: 0;
|
||||
|
||||
.MuiIconButton-root {
|
||||
color: rgb(255 255 255 / 0.75);
|
||||
&:hover {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-title {
|
||||
margin: 0;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
&-summary {
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
&-body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.25rem;
|
||||
// Room so focus rings and the dragged row aren't clipped
|
||||
padding: 2px 2px 1rem;
|
||||
margin: 0 -2px;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: rgb(255 255 255 / 0.2);
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
&-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
|
||||
&-label {
|
||||
margin: 0;
|
||||
font-size: 0.7rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
&-toggle {
|
||||
all: unset;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
cursor: pointer;
|
||||
padding: 0.25rem 0.5rem;
|
||||
margin: 0 -0.5rem;
|
||||
border-radius: 0.5rem;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
background: rgb(255 255 255 / 0.05);
|
||||
}
|
||||
.material-symbols-rounded {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
&-hint {
|
||||
margin: 0.25rem 0 0;
|
||||
font-size: 0.75rem;
|
||||
opacity: 0.4;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
padding: 2rem 1rem;
|
||||
text-align: center;
|
||||
border: 1px dashed rgb(255 255 255 / 0.12);
|
||||
border-radius: 0.75rem;
|
||||
|
||||
&-icon {
|
||||
font-size: 2.25rem;
|
||||
opacity: 0.4;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
&-title {
|
||||
font-weight: 600;
|
||||
}
|
||||
&-text {
|
||||
font-size: 0.85rem;
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.queue-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.4rem 0.5rem;
|
||||
border-radius: 0.6rem;
|
||||
outline: none;
|
||||
background: transparent;
|
||||
transition: background-color 0.15s ease;
|
||||
|
||||
&[role="button"] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:focus-visible,
|
||||
&.is-dragging {
|
||||
background: rgb(255 255 255 / 0.07);
|
||||
}
|
||||
&:focus-visible {
|
||||
box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.4);
|
||||
}
|
||||
&.is-dragging {
|
||||
box-shadow: 0 8px 24px rgb(0 0 0 / 0.45);
|
||||
background: rgb(40 40 50 / 0.95);
|
||||
}
|
||||
|
||||
&-current {
|
||||
background: rgb(255 255 255 / 0.08);
|
||||
|
||||
.queue-row-title {
|
||||
color: $clr-accent-default;
|
||||
}
|
||||
}
|
||||
|
||||
&-history {
|
||||
opacity: 0.6;
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&-handle {
|
||||
all: unset;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 1.25rem;
|
||||
margin-right: -0.25rem;
|
||||
cursor: grab;
|
||||
touch-action: none;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s ease;
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
&:active {
|
||||
cursor: grabbing;
|
||||
}
|
||||
&:focus-visible {
|
||||
opacity: 1;
|
||||
outline: 2px solid rgb(255 255 255 / 0.4);
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
&-art {
|
||||
position: relative;
|
||||
flex-shrink: 0;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
background: rgb(255 255 255 / 0.08);
|
||||
|
||||
img {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
&-fallback,
|
||||
&-overlay,
|
||||
&-play {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
&-fallback {
|
||||
opacity: 0.4;
|
||||
font-size: 1.25rem !important;
|
||||
}
|
||||
&-overlay,
|
||||
&-play {
|
||||
background: rgb(0 0 0 / 0.55);
|
||||
z-index: 1;
|
||||
}
|
||||
&-overlay {
|
||||
color: $clr-accent-default;
|
||||
}
|
||||
&-play {
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s ease;
|
||||
}
|
||||
}
|
||||
|
||||
&-text {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1px;
|
||||
}
|
||||
|
||||
&-title {
|
||||
font-size: 0.9rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.25;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
&-subtitle {
|
||||
font-size: 0.78rem;
|
||||
opacity: 0.6;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
&-duration {
|
||||
flex-shrink: 0;
|
||||
font-size: 0.78rem;
|
||||
opacity: 0.55;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
&-remove.MuiIconButton-root {
|
||||
flex-shrink: 0;
|
||||
color: rgb(255 255 255 / 0.7);
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s ease;
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
}
|
||||
|
||||
// Reveal row controls on hover / keyboard focus; always shown on touch screens
|
||||
&:hover,
|
||||
&:focus-within {
|
||||
.queue-row-handle,
|
||||
.queue-row-remove {
|
||||
opacity: 1;
|
||||
}
|
||||
.queue-row-art-play {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@media (hover: none) {
|
||||
.queue-row-handle,
|
||||
.queue-row-remove {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Queue drawer (mini player / video player)
|
||||
.queue-drawer-paper.MuiPaper-root {
|
||||
width: 420px;
|
||||
max-width: 100%;
|
||||
padding: 1.25rem 1rem 0 1.25rem;
|
||||
box-sizing: border-box;
|
||||
background: rgb(18 18 24 / 0.97);
|
||||
border-left: 1px solid rgb(255 255 255 / 0.08);
|
||||
background-image: none;
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
import { useSortable } from "@dnd-kit/sortable";
|
||||
import { CSS } from "@dnd-kit/utilities";
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import React from "react";
|
||||
import { getRuntimeMusic } from "@/utils/date/time";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
|
||||
export const getQueueItemText = (item: BaseItemDto) => {
|
||||
if (item.Type === "Episode") {
|
||||
const episode = item.IndexNumberEnd
|
||||
? `E${item.IndexNumber}-${item.IndexNumberEnd}`
|
||||
: `E${item.IndexNumber}`;
|
||||
return {
|
||||
title: item.Name ?? "Unknown episode",
|
||||
subtitle: [item.SeriesName, `S${item.ParentIndexNumber}:${episode}`]
|
||||
.filter(Boolean)
|
||||
.join(" · "),
|
||||
};
|
||||
}
|
||||
return {
|
||||
title: item.Name ?? "Unknown track",
|
||||
subtitle: item.Artists?.join(", ") || item.AlbumArtist || "",
|
||||
};
|
||||
};
|
||||
|
||||
const useQueueItemImage = (item: BaseItemDto) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
if (!api || !item.Id) return undefined;
|
||||
const size = { fillWidth: 96, fillHeight: 96, quality: 85 };
|
||||
if (item.ImageTags?.Primary) {
|
||||
return getImageUrlsApi(api).getItemImageUrlById(item.Id, "Primary", {
|
||||
...size,
|
||||
tag: item.ImageTags.Primary,
|
||||
});
|
||||
}
|
||||
if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
||||
return getImageUrlsApi(api).getItemImageUrlById(item.AlbumId, "Primary", {
|
||||
...size,
|
||||
tag: item.AlbumPrimaryImageTag,
|
||||
});
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
type QueueRowProps = {
|
||||
item: BaseItemDto;
|
||||
variant: "current" | "upcoming" | "history";
|
||||
onPlay?: () => void;
|
||||
onRemove?: () => void;
|
||||
/** Drag handle props from useSortable (upcoming rows only). */
|
||||
dragHandle?: React.HTMLAttributes<HTMLButtonElement>;
|
||||
isDragging?: boolean;
|
||||
};
|
||||
|
||||
export const QueueRow = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
QueueRowProps & { style?: React.CSSProperties }
|
||||
>(({ item, variant, onPlay, onRemove, dragHandle, isDragging, style }, ref) => {
|
||||
const imageUrl = useQueueItemImage(item);
|
||||
const { title, subtitle } = getQueueItemText(item);
|
||||
const isCurrent = variant === "current";
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
style={style}
|
||||
className={`queue-row queue-row-${variant} ${isDragging ? "is-dragging" : ""}`}
|
||||
{...(onPlay && {
|
||||
role: "button",
|
||||
tabIndex: 0,
|
||||
"aria-label": `Play ${title}`,
|
||||
})}
|
||||
onClick={onPlay}
|
||||
onKeyDown={(e) => {
|
||||
if (e.target !== e.currentTarget) return;
|
||||
if (onPlay && (e.key === "Enter" || e.key === " ")) {
|
||||
e.preventDefault();
|
||||
onPlay();
|
||||
} else if (onRemove && (e.key === "Delete" || e.key === "Backspace")) {
|
||||
e.preventDefault();
|
||||
onRemove();
|
||||
}
|
||||
}}
|
||||
>
|
||||
{dragHandle && (
|
||||
<button
|
||||
type="button"
|
||||
className="queue-row-handle"
|
||||
aria-label={`Reorder ${title}`}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
{...dragHandle}
|
||||
>
|
||||
<span className="material-symbols-rounded">drag_indicator</span>
|
||||
</button>
|
||||
)}
|
||||
<div className="queue-row-art">
|
||||
<span className="material-symbols-rounded queue-row-art-fallback">
|
||||
{item.Type === "Episode" ? "tv_gen" : "music_note"}
|
||||
</span>
|
||||
{imageUrl && <img src={imageUrl} alt="" loading="lazy" />}
|
||||
{isCurrent && (
|
||||
<span className="queue-row-art-overlay material-symbols-rounded">
|
||||
graphic_eq
|
||||
</span>
|
||||
)}
|
||||
{onPlay && (
|
||||
<span className="queue-row-art-play material-symbols-rounded">
|
||||
play_arrow
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="queue-row-text">
|
||||
<span className="queue-row-title" title={title}>
|
||||
{title}
|
||||
</span>
|
||||
{subtitle && <span className="queue-row-subtitle">{subtitle}</span>}
|
||||
</div>
|
||||
<span className="queue-row-duration">
|
||||
{item.RunTimeTicks ? getRuntimeMusic(item.RunTimeTicks) : ""}
|
||||
</span>
|
||||
{onRemove && (
|
||||
<Tooltip title="Remove from queue">
|
||||
<IconButton
|
||||
size="small"
|
||||
className="queue-row-remove"
|
||||
aria-label={`Remove ${title} from queue`}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onRemove();
|
||||
}}
|
||||
>
|
||||
<span className="material-symbols-rounded">close</span>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
/** An upcoming row that can be dragged to reorder. */
|
||||
export const SortableQueueRow = (
|
||||
props: Omit<QueueRowProps, "dragHandle" | "isDragging" | "variant">,
|
||||
) => {
|
||||
const {
|
||||
attributes,
|
||||
listeners,
|
||||
setNodeRef,
|
||||
setActivatorNodeRef,
|
||||
transform,
|
||||
transition,
|
||||
isDragging,
|
||||
} = useSortable({ id: props.item.Id ?? "" });
|
||||
|
||||
return (
|
||||
<QueueRow
|
||||
{...props}
|
||||
ref={setNodeRef}
|
||||
variant="upcoming"
|
||||
isDragging={isDragging}
|
||||
style={{
|
||||
transform: CSS.Translate.toString(transform),
|
||||
transition,
|
||||
zIndex: isDragging ? 2 : undefined,
|
||||
position: "relative",
|
||||
}}
|
||||
dragHandle={
|
||||
{
|
||||
...attributes,
|
||||
...listeners,
|
||||
ref: setActivatorNodeRef,
|
||||
} as React.HTMLAttributes<HTMLButtonElement>
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,273 @@
|
||||
import {
|
||||
closestCenter,
|
||||
DndContext,
|
||||
type DragEndEvent,
|
||||
KeyboardSensor,
|
||||
PointerSensor,
|
||||
useSensor,
|
||||
useSensors,
|
||||
} from "@dnd-kit/core";
|
||||
import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
|
||||
import {
|
||||
arrayMove,
|
||||
SortableContext,
|
||||
sortableKeyboardCoordinates,
|
||||
verticalListSortingStrategy,
|
||||
} from "@dnd-kit/sortable";
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import Button from "@mui/material/Button";
|
||||
import Collapse from "@mui/material/Collapse";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import { useSnackbar } from "notistack";
|
||||
import React, { useMemo, useState } from "react";
|
||||
import { getRuntimeCompact } from "@/utils/date/time";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { playItemFromQueue } from "@/utils/store/playback";
|
||||
import useQueue, {
|
||||
clearUpcoming,
|
||||
insertIntoQueue,
|
||||
removeFromQueue,
|
||||
reorderQueue,
|
||||
shuffleUpcoming,
|
||||
} from "@/utils/store/queue";
|
||||
import { getQueueItemText, QueueRow, SortableQueueRow } from "./queueRow";
|
||||
|
||||
import "./queue.scss";
|
||||
|
||||
type QueueViewProps = {
|
||||
/**
|
||||
* "drawer": standalone queue with the now playing row and a close button.
|
||||
* "panel": embedded next to a full player that already shows the current track.
|
||||
*/
|
||||
variant: "drawer" | "panel";
|
||||
onClose?: () => void;
|
||||
};
|
||||
|
||||
const QueueView = ({ variant, onClose }: QueueViewProps) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const userId = useCentralStore((s) => s.currentUser?.Id ?? undefined);
|
||||
const { enqueueSnackbar, closeSnackbar } = useSnackbar();
|
||||
const [tracks, currentIndex] = useQueue((s) => [
|
||||
s.tracks,
|
||||
s.currentItemIndex,
|
||||
]);
|
||||
const [showHistory, setShowHistory] = useState(false);
|
||||
|
||||
const queue = tracks ?? [];
|
||||
const current = queue[currentIndex];
|
||||
const history = queue.slice(0, currentIndex);
|
||||
const upcoming = useMemo(
|
||||
() => queue.slice(currentIndex + 1),
|
||||
[queue, currentIndex],
|
||||
);
|
||||
const upcomingTicks = upcoming.reduce(
|
||||
(total, item) => total + (item.RunTimeTicks ?? 0),
|
||||
0,
|
||||
);
|
||||
|
||||
const sensors = useSensors(
|
||||
useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),
|
||||
useSensor(KeyboardSensor, {
|
||||
coordinateGetter: sortableKeyboardCoordinates,
|
||||
}),
|
||||
);
|
||||
|
||||
const play = (index: number) => {
|
||||
playItemFromQueue(index, userId, api);
|
||||
};
|
||||
|
||||
const remove = (item: BaseItemDto, index: number) => {
|
||||
removeFromQueue(index);
|
||||
const { title } = getQueueItemText(item);
|
||||
enqueueSnackbar(`Removed "${title}"`, {
|
||||
variant: "default",
|
||||
action: (key) => (
|
||||
<Button
|
||||
color="inherit"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
insertIntoQueue(item, index);
|
||||
closeSnackbar(key);
|
||||
}}
|
||||
>
|
||||
Undo
|
||||
</Button>
|
||||
),
|
||||
});
|
||||
};
|
||||
|
||||
const clearAll = () => {
|
||||
const removed = upcoming;
|
||||
clearUpcoming();
|
||||
enqueueSnackbar(`Cleared ${removed.length} tracks from up next`, {
|
||||
action: (key) => (
|
||||
<Button
|
||||
color="inherit"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
const state = useQueue.getState();
|
||||
reorderQueue([
|
||||
...(state.tracks ?? []).slice(0, state.currentItemIndex + 1),
|
||||
...removed,
|
||||
]);
|
||||
closeSnackbar(key);
|
||||
}}
|
||||
>
|
||||
Undo
|
||||
</Button>
|
||||
),
|
||||
});
|
||||
};
|
||||
|
||||
const handleDragEnd = ({ active, over }: DragEndEvent) => {
|
||||
if (!over || active.id === over.id) return;
|
||||
const from = upcoming.findIndex((item) => item.Id === active.id);
|
||||
const to = upcoming.findIndex((item) => item.Id === over.id);
|
||||
if (from === -1 || to === -1) return;
|
||||
reorderQueue([
|
||||
...queue.slice(0, currentIndex + 1),
|
||||
...arrayMove(upcoming, from, to),
|
||||
]);
|
||||
};
|
||||
|
||||
const summary =
|
||||
upcoming.length > 0
|
||||
? `${upcoming.length} ${upcoming.length === 1 ? "track" : "tracks"} · ${getRuntimeCompact(upcomingTicks)}`
|
||||
: "Nothing queued";
|
||||
|
||||
return (
|
||||
<div className={`queue queue-${variant}`}>
|
||||
<header className="queue-header">
|
||||
<div className="queue-header-text">
|
||||
<h2 className="queue-title">
|
||||
{variant === "drawer" ? "Queue" : "Up next"}
|
||||
</h2>
|
||||
<span className="queue-summary">{summary}</span>
|
||||
</div>
|
||||
<div className="queue-header-actions">
|
||||
<Tooltip title="Shuffle up next">
|
||||
<span>
|
||||
<IconButton
|
||||
onClick={shuffleUpcoming}
|
||||
disabled={upcoming.length < 2}
|
||||
aria-label="Shuffle up next"
|
||||
>
|
||||
<span className="material-symbols-rounded">shuffle</span>
|
||||
</IconButton>
|
||||
</span>
|
||||
</Tooltip>
|
||||
<Tooltip title="Clear up next">
|
||||
<span>
|
||||
<IconButton
|
||||
onClick={clearAll}
|
||||
disabled={upcoming.length === 0}
|
||||
aria-label="Clear up next"
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
playlist_remove
|
||||
</span>
|
||||
</IconButton>
|
||||
</span>
|
||||
</Tooltip>
|
||||
{onClose && (
|
||||
<IconButton onClick={onClose} aria-label="Close queue">
|
||||
<span className="material-symbols-rounded">close</span>
|
||||
</IconButton>
|
||||
)}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div className="queue-body">
|
||||
{variant === "drawer" && current && (
|
||||
<section className="queue-section">
|
||||
<h3 className="queue-section-label">Now playing</h3>
|
||||
<QueueRow item={current} variant="current" />
|
||||
</section>
|
||||
)}
|
||||
|
||||
<section className="queue-section">
|
||||
{variant === "drawer" && (
|
||||
<h3 className="queue-section-label">Up next</h3>
|
||||
)}
|
||||
{upcoming.length > 0 ? (
|
||||
<>
|
||||
<DndContext
|
||||
sensors={sensors}
|
||||
collisionDetection={closestCenter}
|
||||
onDragEnd={handleDragEnd}
|
||||
modifiers={[restrictToVerticalAxis]}
|
||||
>
|
||||
<SortableContext
|
||||
items={upcoming.map((item) => item.Id ?? "")}
|
||||
strategy={verticalListSortingStrategy}
|
||||
>
|
||||
<div className="queue-list">
|
||||
{upcoming.map((item, offset) => {
|
||||
const index = currentIndex + 1 + offset;
|
||||
return (
|
||||
<SortableQueueRow
|
||||
key={item.Id ?? index}
|
||||
item={item}
|
||||
onPlay={() => play(index)}
|
||||
onRemove={() => remove(item, index)}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</SortableContext>
|
||||
</DndContext>
|
||||
<p className="queue-hint">
|
||||
Click a track to play it now · drag to reorder
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
<div className="queue-empty">
|
||||
<span className="material-symbols-rounded queue-empty-icon">
|
||||
queue_music
|
||||
</span>
|
||||
<span className="queue-empty-title">Nothing up next</span>
|
||||
<span className="queue-empty-text">
|
||||
Play an album, playlist or artist to fill the queue.
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
|
||||
{history.length > 0 && (
|
||||
<section className="queue-section">
|
||||
<button
|
||||
type="button"
|
||||
className="queue-section-toggle"
|
||||
onClick={() => setShowHistory((open) => !open)}
|
||||
aria-expanded={showHistory}
|
||||
>
|
||||
<span className="queue-section-label">
|
||||
Previously played · {history.length}
|
||||
</span>
|
||||
<span className="material-symbols-rounded">
|
||||
{showHistory ? "expand_less" : "expand_more"}
|
||||
</span>
|
||||
</button>
|
||||
<Collapse in={showHistory} unmountOnExit>
|
||||
<div className="queue-list">
|
||||
{history.map((item, index) => (
|
||||
<QueueRow
|
||||
key={item.Id ?? index}
|
||||
item={item}
|
||||
variant="history"
|
||||
onPlay={() => play(index)}
|
||||
onRemove={() => remove(item, index)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</Collapse>
|
||||
</section>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default QueueView;
|
||||
@@ -1,237 +0,0 @@
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import {
|
||||
Box,
|
||||
IconButton,
|
||||
ListItem,
|
||||
ListItemAvatar,
|
||||
ListItemText,
|
||||
} from "@mui/material";
|
||||
import React from "react";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
|
||||
type QueueListItemProps = {
|
||||
queueItem: BaseItemDto;
|
||||
active?: boolean;
|
||||
onDelete?: () => void;
|
||||
onPlay?: () => void;
|
||||
dragHandleProps?: any;
|
||||
isEpisode?: boolean;
|
||||
index?: number;
|
||||
className?: string;
|
||||
sx?: any;
|
||||
};
|
||||
|
||||
const QueueListItem = ({
|
||||
queueItem,
|
||||
active,
|
||||
onDelete,
|
||||
onPlay,
|
||||
dragHandleProps,
|
||||
isEpisode,
|
||||
className,
|
||||
sx,
|
||||
}: QueueListItemProps) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
|
||||
const imageUrl =
|
||||
api &&
|
||||
queueItem.Id &&
|
||||
(queueItem.ImageTags?.Primary
|
||||
? getImageUrlsApi(api).getItemImageUrlById(queueItem.Id, "Primary", {
|
||||
tag: queueItem.ImageTags.Primary,
|
||||
})
|
||||
: queueItem.AlbumPrimaryImageTag?.[0]
|
||||
? getImageUrlsApi(api).getItemImageUrlById(
|
||||
queueItem.AlbumId || "",
|
||||
"Primary",
|
||||
{ tag: queueItem.AlbumPrimaryImageTag[0] },
|
||||
)
|
||||
: null);
|
||||
|
||||
const primaryText = queueItem.SeriesName || queueItem.Name;
|
||||
|
||||
let secondaryText = "";
|
||||
if (isEpisode) {
|
||||
const season = queueItem.ParentIndexNumber;
|
||||
const episode = queueItem.IndexNumber;
|
||||
const episodeEnd = queueItem.IndexNumberEnd;
|
||||
const episodeString = episodeEnd
|
||||
? `S${season}:E${episode}-${episodeEnd}`
|
||||
: `S${season}:E${episode}`;
|
||||
|
||||
secondaryText = `${episodeString} - ${queueItem.Name}`;
|
||||
} else {
|
||||
secondaryText = queueItem.Artists?.join(", ") || "";
|
||||
}
|
||||
|
||||
return (
|
||||
<ListItem
|
||||
component="div"
|
||||
className={className}
|
||||
secondaryAction={
|
||||
onDelete && (
|
||||
<IconButton
|
||||
edge="end"
|
||||
aria-label="delete"
|
||||
onClick={onDelete}
|
||||
size="small"
|
||||
sx={{
|
||||
opacity: 0,
|
||||
transition: "opacity 0.2s",
|
||||
".MuiListItem-root:hover &": { opacity: 0.7 },
|
||||
"&:hover": { opacity: "1 !important", bgcolor: "action.hover" },
|
||||
}}
|
||||
>
|
||||
<span className="material-symbols-rounded" style={{ fontSize: 20 }}>
|
||||
close
|
||||
</span>
|
||||
</IconButton>
|
||||
)
|
||||
}
|
||||
sx={{
|
||||
opacity: active ? 1 : 1,
|
||||
bgcolor: active ? "rgba(255, 255, 255, 0.1)" : "rgba(0,0,0,0.2)",
|
||||
borderRadius: 3,
|
||||
mb: 0,
|
||||
transition: "all 0.2s ease",
|
||||
border: "1px solid",
|
||||
borderColor: active
|
||||
? "rgba(255, 255, 255, 0.2)"
|
||||
: "rgba(255,255,255,0.05)",
|
||||
"&:hover": {
|
||||
bgcolor: active
|
||||
? "rgba(255, 255, 255, 0.15)"
|
||||
: "rgba(255,255,255,0.05)",
|
||||
transform: active ? "none" : "translateY(-2px)",
|
||||
borderColor: active
|
||||
? "rgba(255, 255, 255, 0.3)"
|
||||
: "rgba(255,255,255,0.2)",
|
||||
boxShadow: active ? "none" : "0 4px 12px rgba(0,0,0,0.2)",
|
||||
},
|
||||
pr: onDelete ? 6 : 2,
|
||||
...sx,
|
||||
}}
|
||||
>
|
||||
{dragHandleProps && (
|
||||
<div
|
||||
{...dragHandleProps}
|
||||
style={{
|
||||
cursor: "grab",
|
||||
marginRight: 12,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
opacity: 0.5,
|
||||
transition: "opacity 0.2s",
|
||||
}}
|
||||
className="drag-handle"
|
||||
>
|
||||
<span className="material-symbols-rounded">drag_indicator</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<ListItemAvatar sx={{ minWidth: 64 }}>
|
||||
<Box
|
||||
onClick={onPlay}
|
||||
sx={{
|
||||
width: 48,
|
||||
height: 48,
|
||||
borderRadius: 2,
|
||||
overflow: "hidden",
|
||||
position: "relative",
|
||||
boxShadow: "0 2px 8px rgba(0,0,0,0.2)",
|
||||
cursor: onPlay ? "pointer" : "default",
|
||||
"&:hover .play-overlay": {
|
||||
opacity: 1,
|
||||
},
|
||||
}}
|
||||
>
|
||||
{imageUrl ? (
|
||||
<img
|
||||
src={imageUrl}
|
||||
alt={queueItem.Name || ""}
|
||||
style={{ width: "100%", height: "100%", objectFit: "cover" }}
|
||||
/>
|
||||
) : (
|
||||
<div
|
||||
style={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
background: "#2a2a2a",
|
||||
}}
|
||||
>
|
||||
{queueItem.Type && getTypeIcon(queueItem.Type)}
|
||||
</div>
|
||||
)}
|
||||
{active && (
|
||||
<div
|
||||
style={{
|
||||
position: "absolute",
|
||||
inset: 0,
|
||||
background: "rgba(0,0,0,0.4)",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
backdropFilter: "blur(2px)",
|
||||
}}
|
||||
>
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{ fontSize: "1.5rem", color: "white" }}
|
||||
>
|
||||
equalizer
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
{!active && onPlay && (
|
||||
<Box
|
||||
className="play-overlay"
|
||||
sx={{
|
||||
position: "absolute",
|
||||
inset: 0,
|
||||
background: "rgba(0,0,0,0.4)",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
opacity: 0,
|
||||
transition: "opacity 0.2s",
|
||||
backdropFilter: "blur(1px)",
|
||||
}}
|
||||
>
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{ fontSize: "2rem", color: "white" }}
|
||||
>
|
||||
play_arrow
|
||||
</span>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
</ListItemAvatar>
|
||||
|
||||
<ListItemText
|
||||
primary={primaryText}
|
||||
secondary={secondaryText}
|
||||
slotProps={{
|
||||
primary: {
|
||||
noWrap: true,
|
||||
variant: "body2",
|
||||
fontWeight: active ? 700 : 500,
|
||||
sx: { mb: 0.5 },
|
||||
},
|
||||
secondary: {
|
||||
noWrap: true,
|
||||
variant: "caption",
|
||||
sx: { opacity: 0.7 },
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
);
|
||||
};
|
||||
|
||||
export default QueueListItem;
|
||||
@@ -43,7 +43,13 @@ const QueueTrack = (props: Props) => {
|
||||
<Typography className="audio-queue-track-info-name">
|
||||
{track.Name}
|
||||
</Typography>
|
||||
<Typography fontWeight={300} className="opacity-07" variant="subtitle2">
|
||||
<Typography
|
||||
className="opacity-07"
|
||||
variant="subtitle2"
|
||||
sx={{
|
||||
fontWeight: 300,
|
||||
}}
|
||||
>
|
||||
{track.Artists?.join(", ")}
|
||||
</Typography>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ItemSortBy } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import { getSearchApi } from "@jellyfin/sdk/lib/utils/api/search-api";
|
||||
import {
|
||||
Box,
|
||||
@@ -58,7 +58,7 @@ const Search = () => {
|
||||
queryFn: async () =>
|
||||
api &&
|
||||
(
|
||||
await getItemsApi(api).getItems({
|
||||
await getLibraryApi(api).getItems({
|
||||
userId: userId,
|
||||
limit: 5,
|
||||
sortBy: [ItemSortBy.IsFavoriteOrLiked, ItemSortBy.Random],
|
||||
@@ -166,9 +166,9 @@ const Search = () => {
|
||||
<Box sx={{ position: "relative" }}>
|
||||
<Stack
|
||||
direction="row"
|
||||
alignItems="center"
|
||||
spacing={1.5}
|
||||
sx={{
|
||||
alignItems: "center",
|
||||
p: "16px 24px",
|
||||
}}
|
||||
>
|
||||
@@ -272,8 +272,8 @@ const Search = () => {
|
||||
<Box>
|
||||
<Typography
|
||||
variant="caption"
|
||||
fontWeight={600}
|
||||
sx={{
|
||||
fontWeight: 600,
|
||||
px: 2,
|
||||
py: 1.5,
|
||||
color: "text.secondary",
|
||||
@@ -315,8 +315,8 @@ const Search = () => {
|
||||
<Box>
|
||||
<Typography
|
||||
variant="caption"
|
||||
fontWeight={600}
|
||||
sx={{
|
||||
fontWeight: 600,
|
||||
px: 2,
|
||||
py: 1.5,
|
||||
color: "text.secondary",
|
||||
@@ -356,9 +356,9 @@ const Search = () => {
|
||||
{searchResults.isSuccess &&
|
||||
searchResults.data?.SearchHints?.length === 0 && (
|
||||
<Stack
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
sx={{
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
height: "100%",
|
||||
minHeight: "200px",
|
||||
color: "text.secondary",
|
||||
@@ -380,10 +380,11 @@ const Search = () => {
|
||||
|
||||
<Stack
|
||||
direction="row"
|
||||
justifyContent="flex-end"
|
||||
sx={{
|
||||
justifyContent: "flex-end",
|
||||
p: 1.5,
|
||||
mt: 1,
|
||||
|
||||
backgroundImage:
|
||||
"linear-gradient(to top, rgba(0,0,0,0.2), transparent)",
|
||||
}}
|
||||
|
||||
@@ -5,6 +5,7 @@ import React from "react";
|
||||
import { useShallow } from "zustand/react/shallow";
|
||||
import useSearchStore from "@/utils/store/search";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
import { getItemLinkOptions } from "@/utils/navigation/itemLink";
|
||||
|
||||
type SearchItemProps = {
|
||||
itemName: string;
|
||||
@@ -22,32 +23,7 @@ const SearchItem = (props: SearchItemProps) => {
|
||||
const navigate = useNavigate();
|
||||
const handleOnClick = () => {
|
||||
toggleSearchDialog();
|
||||
switch (itemType) {
|
||||
case BaseItemKind.BoxSet:
|
||||
navigate({ to: "/boxset/$id", params: { id: itemId } });
|
||||
break;
|
||||
case BaseItemKind.Episode:
|
||||
navigate({ to: "/episode/$id", params: { id: itemId } });
|
||||
break;
|
||||
case BaseItemKind.MusicAlbum:
|
||||
navigate({ to: "/album/$id", params: { id: itemId } });
|
||||
break;
|
||||
case BaseItemKind.MusicArtist:
|
||||
navigate({ to: "/artist/$id", params: { id: itemId } });
|
||||
break;
|
||||
case BaseItemKind.Person:
|
||||
navigate({ to: "/person/$id", params: { id: itemId } });
|
||||
break;
|
||||
case BaseItemKind.Series:
|
||||
navigate({ to: "/series/$id", params: { id: itemId } });
|
||||
break;
|
||||
case BaseItemKind.Playlist:
|
||||
navigate({ to: "/playlist/$id", params: { id: itemId } });
|
||||
break;
|
||||
default:
|
||||
navigate({ to: "/item/$id", params: { id: itemId } });
|
||||
break;
|
||||
}
|
||||
navigate(getItemLinkOptions(itemId, itemType));
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -104,22 +80,49 @@ const SearchItem = (props: SearchItemProps) => {
|
||||
)}
|
||||
</Box>
|
||||
<Stack sx={{ minWidth: 0, flex: 1 }}>
|
||||
<Typography variant="body1" noWrap fontWeight={500}>
|
||||
<Typography
|
||||
variant="body1"
|
||||
noWrap
|
||||
sx={{
|
||||
fontWeight: 500,
|
||||
}}
|
||||
>
|
||||
{itemName}
|
||||
</Typography>
|
||||
<Stack direction="row" spacing={1} alignItems="center">
|
||||
<Stack
|
||||
direction="row"
|
||||
spacing={1}
|
||||
sx={{
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
{itemYear && (
|
||||
<Typography variant="caption" color="text.secondary">
|
||||
<Typography
|
||||
variant="caption"
|
||||
sx={{
|
||||
color: "text.secondary",
|
||||
}}
|
||||
>
|
||||
{itemYear}
|
||||
</Typography>
|
||||
)}
|
||||
{itemYear && itemType && (
|
||||
<Typography variant="caption" color="text.secondary">
|
||||
<Typography
|
||||
variant="caption"
|
||||
sx={{
|
||||
color: "text.secondary",
|
||||
}}
|
||||
>
|
||||
•
|
||||
</Typography>
|
||||
)}
|
||||
{itemType && (
|
||||
<Typography variant="caption" color="text.secondary">
|
||||
<Typography
|
||||
variant="caption"
|
||||
sx={{
|
||||
color: "text.secondary",
|
||||
}}
|
||||
>
|
||||
{itemType}
|
||||
</Typography>
|
||||
)}
|
||||
|
||||
@@ -5,7 +5,9 @@ import React, { useState } from "react";
|
||||
|
||||
const SettingOption = ({
|
||||
setting,
|
||||
}: { setting: { key: string; name: string; description: string } }) => {
|
||||
}: {
|
||||
setting: { key: string; name: string; description: string };
|
||||
}) => {
|
||||
const initValue = useQuery({
|
||||
queryKey: ["setting", setting.key],
|
||||
queryFn: async () => {
|
||||
@@ -30,7 +32,12 @@ const SettingOption = ({
|
||||
}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="subtitle1" fontWeight={400}>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
sx={{
|
||||
fontWeight: 400,
|
||||
}}
|
||||
>
|
||||
{setting.name}
|
||||
</Typography>
|
||||
<Typography
|
||||
|
||||
@@ -39,7 +39,12 @@ const SettingOptionSelect = ({
|
||||
}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="subtitle1" fontWeight={400}>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
sx={{
|
||||
fontWeight: 400,
|
||||
}}
|
||||
>
|
||||
{setting.name}
|
||||
</Typography>
|
||||
<Typography
|
||||
|
||||
@@ -48,7 +48,9 @@ const ShowMoreText = ({
|
||||
width: "100%",
|
||||
}}
|
||||
variant="subtitle2"
|
||||
fontWeight={300}
|
||||
sx={{
|
||||
fontWeight: 300,
|
||||
}}
|
||||
>
|
||||
{content}
|
||||
</Typography>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { motion } from "motion/react";
|
||||
const ItemSkeleton = () => {
|
||||
return (
|
||||
<motion.div
|
||||
className="item item-default scrollY padded-top flex flex-column"
|
||||
className="item item-detail-page item-default scrollY padded-top flex flex-column"
|
||||
style={{
|
||||
width: "100vw",
|
||||
}}
|
||||
|
||||
@@ -7,10 +7,18 @@ import "./tagChip.scss";
|
||||
const TagChip = ({
|
||||
label,
|
||||
linkProps,
|
||||
}: { label: string; linkProps?: LinkProps }) => {
|
||||
}: {
|
||||
label: string;
|
||||
linkProps?: LinkProps;
|
||||
}) => {
|
||||
return (
|
||||
<Link className="tag" to="/search" search={{ query: label }} {...linkProps}>
|
||||
<Typography variant="subtitle2" fontWeight={300}>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
sx={{
|
||||
fontWeight: 300,
|
||||
}}
|
||||
>
|
||||
{label}
|
||||
</Typography>
|
||||
</Link>
|
||||
|
||||
@@ -112,7 +112,12 @@ export default function Updater() {
|
||||
<DialogContent
|
||||
sx={{ position: "relative", zIndex: 1, pt: 5, pb: 3, px: 3 }}
|
||||
>
|
||||
<Stack alignItems="center" spacing={3}>
|
||||
<Stack
|
||||
spacing={3}
|
||||
sx={{
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
width: 72,
|
||||
@@ -136,13 +141,20 @@ export default function Updater() {
|
||||
</span>
|
||||
</Box>
|
||||
|
||||
<Stack spacing={1} textAlign="center">
|
||||
<Stack
|
||||
spacing={1}
|
||||
sx={{
|
||||
textAlign: "center",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
variant="h5"
|
||||
fontWeight="900"
|
||||
sx={{
|
||||
fontWeight: "900",
|
||||
|
||||
background: (theme) =>
|
||||
`linear-gradient(135deg, ${theme.palette.primary.light} 0%, ${theme.palette.secondary.light} 100%)`,
|
||||
|
||||
backgroundClip: "text",
|
||||
WebkitBackgroundClip: "text",
|
||||
color: "transparent",
|
||||
@@ -152,8 +164,10 @@ export default function Updater() {
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="body2"
|
||||
color="text.secondary"
|
||||
sx={{ maxWidth: "25ch" }}
|
||||
sx={{
|
||||
color: "text.secondary",
|
||||
maxWidth: "25ch",
|
||||
}}
|
||||
>
|
||||
A new version of Blink is ready for you.
|
||||
</Typography>
|
||||
@@ -161,9 +175,9 @@ export default function Updater() {
|
||||
|
||||
<Stack
|
||||
direction="row"
|
||||
alignItems="center"
|
||||
justifyContent="space-between"
|
||||
sx={{
|
||||
alignItems: "center",
|
||||
justifyContent: "space-between",
|
||||
width: "100%",
|
||||
bgcolor: "rgba(255,255,255,0.03)",
|
||||
borderRadius: 4,
|
||||
@@ -174,12 +188,19 @@ export default function Updater() {
|
||||
<Stack>
|
||||
<Typography
|
||||
variant="caption"
|
||||
color="text.secondary"
|
||||
sx={{ mb: 0.5 }}
|
||||
sx={{
|
||||
color: "text.secondary",
|
||||
mb: 0.5,
|
||||
}}
|
||||
>
|
||||
Current
|
||||
</Typography>
|
||||
<Typography variant="subtitle1" fontWeight="bold">
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
sx={{
|
||||
fontWeight: "bold",
|
||||
}}
|
||||
>
|
||||
v{updateInfo.currentVersion}
|
||||
</Typography>
|
||||
</Stack>
|
||||
@@ -206,18 +227,26 @@ export default function Updater() {
|
||||
</span>
|
||||
</Box>
|
||||
|
||||
<Stack alignItems="flex-end">
|
||||
<Stack
|
||||
sx={{
|
||||
alignItems: "flex-end",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
variant="caption"
|
||||
color="primary.main"
|
||||
sx={{ mb: 0.5 }}
|
||||
sx={{
|
||||
color: "primary.main",
|
||||
mb: 0.5,
|
||||
}}
|
||||
>
|
||||
New Version
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
fontWeight="bold"
|
||||
color="primary.main"
|
||||
sx={{
|
||||
fontWeight: "bold",
|
||||
color: "primary.main",
|
||||
}}
|
||||
>
|
||||
v{updateInfo.version}
|
||||
</Typography>
|
||||
|
||||
@@ -87,7 +87,7 @@ export const UserAvatarMenu = () => {
|
||||
onClose={handleMenuClose}
|
||||
sx={menuStyle}
|
||||
disableScrollLock
|
||||
PaperProps={{ className: "glass" }}
|
||||
slotProps={{ paper: { className: "glass" } }}
|
||||
>
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
|
||||
+237
-321
@@ -9,68 +9,59 @@
|
||||
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
|
||||
|
||||
import { Route as rootRouteImport } from './routes/__root'
|
||||
import { Route as ApiRouteImport } from './routes/_api'
|
||||
import { Route as IndexRouteImport } from './routes/index'
|
||||
import { Route as ErrorCodeRouteImport } from './routes/error/$code'
|
||||
import { Route as ApiSettingsRouteImport } from './routes/_api/settings'
|
||||
import { Route as ApiRouteImport } from './routes/_api'
|
||||
import { Route as ApiLoginRouteImport } from './routes/_api/login'
|
||||
import { Route as ApiSearchIndexRouteImport } from './routes/_api/search/index'
|
||||
import { Route as ApiPlayerIndexRouteImport } from './routes/_api/player/index'
|
||||
import { Route as ApiHomeIndexRouteImport } from './routes/_api/home/index'
|
||||
import { Route as ApiSettingsRouteImport } from './routes/_api/settings'
|
||||
import { Route as ErrorCodeRouteImport } from './routes/error/$code'
|
||||
import { Route as ApiFavoriteIndexRouteImport } from './routes/_api/favorite/index'
|
||||
import { Route as SetupServerListRouteImport } from './routes/setup/server.list'
|
||||
import { Route as SetupServerErrorRouteImport } from './routes/setup/server.error'
|
||||
import { Route as SetupServerAddRouteImport } from './routes/setup/server.add'
|
||||
import { Route as ApiSettingsPreferencesRouteImport } from './routes/_api/settings/preferences'
|
||||
import { Route as ApiSettingsAboutRouteImport } from './routes/_api/settings/about'
|
||||
import { Route as ApiSeriesIdRouteImport } from './routes/_api/series/$id'
|
||||
import { Route as ApiPlaylistIdRouteImport } from './routes/_api/playlist/$id'
|
||||
import { Route as ApiPlayerPhotosRouteImport } from './routes/_api/player/photos'
|
||||
import { Route as ApiPlayerAudioRouteImport } from './routes/_api/player/audio'
|
||||
import { Route as ApiPersonIdRouteImport } from './routes/_api/person/$id'
|
||||
import { Route as ApiLoginManualRouteImport } from './routes/_api/login/manual'
|
||||
import { Route as ApiLoginListRouteImport } from './routes/_api/login/list'
|
||||
import { Route as ApiLibraryIdRouteImport } from './routes/_api/library/$id'
|
||||
import { Route as ApiHomeIndexRouteImport } from './routes/_api/home/index'
|
||||
import { Route as ApiItemIdRouteImport } from './routes/_api/item/$id'
|
||||
import { Route as ApiEpisodeIdRouteImport } from './routes/_api/episode/$id'
|
||||
import { Route as ApiBoxsetIdRouteImport } from './routes/_api/boxset/$id'
|
||||
import { Route as ApiArtistIdRouteImport } from './routes/_api/artist/$id'
|
||||
import { Route as ApiAlbumIdRouteImport } from './routes/_api/album/$id'
|
||||
import { Route as ApiSettingsChangeServerIndexRouteImport } from './routes/_api/settings/changeServer/index'
|
||||
import { Route as ApiLibraryIdRouteImport } from './routes/_api/library/$id'
|
||||
import { Route as ApiLoginListRouteImport } from './routes/_api/login/list'
|
||||
import { Route as ApiLoginManualRouteImport } from './routes/_api/login/manual'
|
||||
import { Route as ApiPlayerIndexRouteImport } from './routes/_api/player/index'
|
||||
import { Route as ApiPlayerAudioRouteImport } from './routes/_api/player/audio'
|
||||
import { Route as ApiPlayerPhotosRouteImport } from './routes/_api/player/photos'
|
||||
import { Route as ApiSearchIndexRouteImport } from './routes/_api/search/index'
|
||||
import { Route as ApiSettingsAboutRouteImport } from './routes/_api/settings/about'
|
||||
import { Route as ApiSettingsPreferencesRouteImport } from './routes/_api/settings/preferences'
|
||||
import { Route as SetupServerAddRouteImport } from './routes/setup/server.add'
|
||||
import { Route as SetupServerErrorRouteImport } from './routes/setup/server.error'
|
||||
import { Route as SetupServerListRouteImport } from './routes/setup/server.list'
|
||||
import { Route as ApiLoginUserIdUserNameRouteImport } from './routes/_api/login/$userId.$userName'
|
||||
import { Route as ApiMusicAlbumIdRouteImport } from './routes/_api/music/album/$id'
|
||||
import { Route as ApiMusicArtistIdRouteImport } from './routes/_api/music/artist/$id'
|
||||
import { Route as ApiMusicPlaylistIdRouteImport } from './routes/_api/music/playlist/$id'
|
||||
import { Route as ApiSettingsChangeServerIndexRouteImport } from './routes/_api/settings/changeServer/index'
|
||||
|
||||
const ApiRoute = ApiRouteImport.update({
|
||||
id: '/_api',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const IndexRoute = IndexRouteImport.update({
|
||||
id: '/',
|
||||
path: '/',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const ErrorCodeRoute = ErrorCodeRouteImport.update({
|
||||
id: '/error/$code',
|
||||
path: '/error/$code',
|
||||
const ApiRoute = ApiRouteImport.update({
|
||||
id: '/_api',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const ApiSettingsRoute = ApiSettingsRouteImport.update({
|
||||
id: '/settings',
|
||||
path: '/settings',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const ApiLoginRoute = ApiLoginRouteImport.update({
|
||||
id: '/login',
|
||||
path: '/login',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const ApiSearchIndexRoute = ApiSearchIndexRouteImport.update({
|
||||
id: '/search/',
|
||||
path: '/search/',
|
||||
const ApiSettingsRoute = ApiSettingsRouteImport.update({
|
||||
id: '/settings',
|
||||
path: '/settings',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const ApiPlayerIndexRoute = ApiPlayerIndexRouteImport.update({
|
||||
id: '/player/',
|
||||
path: '/player/',
|
||||
const ErrorCodeRoute = ErrorCodeRouteImport.update({
|
||||
id: '/error/$code',
|
||||
path: '/error/$code',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const ApiFavoriteIndexRoute = ApiFavoriteIndexRouteImport.update({
|
||||
id: '/favorite/',
|
||||
path: '/favorite/',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const ApiHomeIndexRoute = ApiHomeIndexRouteImport.update({
|
||||
@@ -78,49 +69,29 @@ const ApiHomeIndexRoute = ApiHomeIndexRouteImport.update({
|
||||
path: '/home/',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const ApiFavoriteIndexRoute = ApiFavoriteIndexRouteImport.update({
|
||||
id: '/favorite/',
|
||||
path: '/favorite/',
|
||||
const ApiItemIdRoute = ApiItemIdRouteImport.update({
|
||||
id: '/item/$id',
|
||||
path: '/item/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const SetupServerListRoute = SetupServerListRouteImport.update({
|
||||
id: '/setup/server/list',
|
||||
path: '/setup/server/list',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const SetupServerErrorRoute = SetupServerErrorRouteImport.update({
|
||||
id: '/setup/server/error',
|
||||
path: '/setup/server/error',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const SetupServerAddRoute = SetupServerAddRouteImport.update({
|
||||
id: '/setup/server/add',
|
||||
path: '/setup/server/add',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const ApiSettingsPreferencesRoute = ApiSettingsPreferencesRouteImport.update({
|
||||
id: '/preferences',
|
||||
path: '/preferences',
|
||||
getParentRoute: () => ApiSettingsRoute,
|
||||
} as any)
|
||||
const ApiSettingsAboutRoute = ApiSettingsAboutRouteImport.update({
|
||||
id: '/about',
|
||||
path: '/about',
|
||||
getParentRoute: () => ApiSettingsRoute,
|
||||
} as any)
|
||||
const ApiSeriesIdRoute = ApiSeriesIdRouteImport.update({
|
||||
id: '/series/$id',
|
||||
path: '/series/$id',
|
||||
const ApiLibraryIdRoute = ApiLibraryIdRouteImport.update({
|
||||
id: '/library/$id',
|
||||
path: '/library/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const ApiPlaylistIdRoute = ApiPlaylistIdRouteImport.update({
|
||||
id: '/playlist/$id',
|
||||
path: '/playlist/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
const ApiLoginListRoute = ApiLoginListRouteImport.update({
|
||||
id: '/list',
|
||||
path: '/list',
|
||||
getParentRoute: () => ApiLoginRoute,
|
||||
} as any)
|
||||
const ApiPlayerPhotosRoute = ApiPlayerPhotosRouteImport.update({
|
||||
id: '/player/photos',
|
||||
path: '/player/photos',
|
||||
const ApiLoginManualRoute = ApiLoginManualRouteImport.update({
|
||||
id: '/manual',
|
||||
path: '/manual',
|
||||
getParentRoute: () => ApiLoginRoute,
|
||||
} as any)
|
||||
const ApiPlayerIndexRoute = ApiPlayerIndexRouteImport.update({
|
||||
id: '/player/',
|
||||
path: '/player/',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const ApiPlayerAudioRoute = ApiPlayerAudioRouteImport.update({
|
||||
@@ -128,49 +99,59 @@ const ApiPlayerAudioRoute = ApiPlayerAudioRouteImport.update({
|
||||
path: '/player/audio',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const ApiPersonIdRoute = ApiPersonIdRouteImport.update({
|
||||
id: '/person/$id',
|
||||
path: '/person/$id',
|
||||
const ApiPlayerPhotosRoute = ApiPlayerPhotosRouteImport.update({
|
||||
id: '/player/photos',
|
||||
path: '/player/photos',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const ApiLoginManualRoute = ApiLoginManualRouteImport.update({
|
||||
id: '/manual',
|
||||
path: '/manual',
|
||||
const ApiSearchIndexRoute = ApiSearchIndexRouteImport.update({
|
||||
id: '/search/',
|
||||
path: '/search/',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const ApiSettingsAboutRoute = ApiSettingsAboutRouteImport.update({
|
||||
id: '/about',
|
||||
path: '/about',
|
||||
getParentRoute: () => ApiSettingsRoute,
|
||||
} as any)
|
||||
const ApiSettingsPreferencesRoute = ApiSettingsPreferencesRouteImport.update({
|
||||
id: '/preferences',
|
||||
path: '/preferences',
|
||||
getParentRoute: () => ApiSettingsRoute,
|
||||
} as any)
|
||||
const SetupServerAddRoute = SetupServerAddRouteImport.update({
|
||||
id: '/setup/server/add',
|
||||
path: '/setup/server/add',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const SetupServerErrorRoute = SetupServerErrorRouteImport.update({
|
||||
id: '/setup/server/error',
|
||||
path: '/setup/server/error',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const SetupServerListRoute = SetupServerListRouteImport.update({
|
||||
id: '/setup/server/list',
|
||||
path: '/setup/server/list',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const ApiLoginUserIdUserNameRoute = ApiLoginUserIdUserNameRouteImport.update({
|
||||
id: '/$userId/$userName',
|
||||
path: '/$userId/$userName',
|
||||
getParentRoute: () => ApiLoginRoute,
|
||||
} as any)
|
||||
const ApiLoginListRoute = ApiLoginListRouteImport.update({
|
||||
id: '/list',
|
||||
path: '/list',
|
||||
getParentRoute: () => ApiLoginRoute,
|
||||
} as any)
|
||||
const ApiLibraryIdRoute = ApiLibraryIdRouteImport.update({
|
||||
id: '/library/$id',
|
||||
path: '/library/$id',
|
||||
const ApiMusicAlbumIdRoute = ApiMusicAlbumIdRouteImport.update({
|
||||
id: '/music/album/$id',
|
||||
path: '/music/album/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const ApiItemIdRoute = ApiItemIdRouteImport.update({
|
||||
id: '/item/$id',
|
||||
path: '/item/$id',
|
||||
const ApiMusicArtistIdRoute = ApiMusicArtistIdRouteImport.update({
|
||||
id: '/music/artist/$id',
|
||||
path: '/music/artist/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const ApiEpisodeIdRoute = ApiEpisodeIdRouteImport.update({
|
||||
id: '/episode/$id',
|
||||
path: '/episode/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const ApiBoxsetIdRoute = ApiBoxsetIdRouteImport.update({
|
||||
id: '/boxset/$id',
|
||||
path: '/boxset/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const ApiArtistIdRoute = ApiArtistIdRouteImport.update({
|
||||
id: '/artist/$id',
|
||||
path: '/artist/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const ApiAlbumIdRoute = ApiAlbumIdRouteImport.update({
|
||||
id: '/album/$id',
|
||||
path: '/album/$id',
|
||||
const ApiMusicPlaylistIdRoute = ApiMusicPlaylistIdRouteImport.update({
|
||||
id: '/music/playlist/$id',
|
||||
path: '/music/playlist/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
const ApiSettingsChangeServerIndexRoute =
|
||||
@@ -179,30 +160,18 @@ const ApiSettingsChangeServerIndexRoute =
|
||||
path: '/changeServer/',
|
||||
getParentRoute: () => ApiSettingsRoute,
|
||||
} as any)
|
||||
const ApiLoginUserIdUserNameRoute = ApiLoginUserIdUserNameRouteImport.update({
|
||||
id: '/$userId/$userName',
|
||||
path: '/$userId/$userName',
|
||||
getParentRoute: () => ApiLoginRoute,
|
||||
} as any)
|
||||
|
||||
export interface FileRoutesByFullPath {
|
||||
'/': typeof IndexRoute
|
||||
'/login': typeof ApiLoginRouteWithChildren
|
||||
'/settings': typeof ApiSettingsRouteWithChildren
|
||||
'/error/$code': typeof ErrorCodeRoute
|
||||
'/album/$id': typeof ApiAlbumIdRoute
|
||||
'/artist/$id': typeof ApiArtistIdRoute
|
||||
'/boxset/$id': typeof ApiBoxsetIdRoute
|
||||
'/episode/$id': typeof ApiEpisodeIdRoute
|
||||
'/item/$id': typeof ApiItemIdRoute
|
||||
'/library/$id': typeof ApiLibraryIdRoute
|
||||
'/login/list': typeof ApiLoginListRoute
|
||||
'/login/manual': typeof ApiLoginManualRoute
|
||||
'/person/$id': typeof ApiPersonIdRoute
|
||||
'/player/audio': typeof ApiPlayerAudioRoute
|
||||
'/player/photos': typeof ApiPlayerPhotosRoute
|
||||
'/playlist/$id': typeof ApiPlaylistIdRoute
|
||||
'/series/$id': typeof ApiSeriesIdRoute
|
||||
'/settings/about': typeof ApiSettingsAboutRoute
|
||||
'/settings/preferences': typeof ApiSettingsPreferencesRoute
|
||||
'/setup/server/add': typeof SetupServerAddRoute
|
||||
@@ -213,6 +182,9 @@ export interface FileRoutesByFullPath {
|
||||
'/player/': typeof ApiPlayerIndexRoute
|
||||
'/search/': typeof ApiSearchIndexRoute
|
||||
'/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
||||
'/music/album/$id': typeof ApiMusicAlbumIdRoute
|
||||
'/music/artist/$id': typeof ApiMusicArtistIdRoute
|
||||
'/music/playlist/$id': typeof ApiMusicPlaylistIdRoute
|
||||
'/settings/changeServer/': typeof ApiSettingsChangeServerIndexRoute
|
||||
}
|
||||
export interface FileRoutesByTo {
|
||||
@@ -220,19 +192,12 @@ export interface FileRoutesByTo {
|
||||
'/login': typeof ApiLoginRouteWithChildren
|
||||
'/settings': typeof ApiSettingsRouteWithChildren
|
||||
'/error/$code': typeof ErrorCodeRoute
|
||||
'/album/$id': typeof ApiAlbumIdRoute
|
||||
'/artist/$id': typeof ApiArtistIdRoute
|
||||
'/boxset/$id': typeof ApiBoxsetIdRoute
|
||||
'/episode/$id': typeof ApiEpisodeIdRoute
|
||||
'/item/$id': typeof ApiItemIdRoute
|
||||
'/library/$id': typeof ApiLibraryIdRoute
|
||||
'/login/list': typeof ApiLoginListRoute
|
||||
'/login/manual': typeof ApiLoginManualRoute
|
||||
'/person/$id': typeof ApiPersonIdRoute
|
||||
'/player/audio': typeof ApiPlayerAudioRoute
|
||||
'/player/photos': typeof ApiPlayerPhotosRoute
|
||||
'/playlist/$id': typeof ApiPlaylistIdRoute
|
||||
'/series/$id': typeof ApiSeriesIdRoute
|
||||
'/settings/about': typeof ApiSettingsAboutRoute
|
||||
'/settings/preferences': typeof ApiSettingsPreferencesRoute
|
||||
'/setup/server/add': typeof SetupServerAddRoute
|
||||
@@ -243,6 +208,9 @@ export interface FileRoutesByTo {
|
||||
'/player': typeof ApiPlayerIndexRoute
|
||||
'/search': typeof ApiSearchIndexRoute
|
||||
'/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
||||
'/music/album/$id': typeof ApiMusicAlbumIdRoute
|
||||
'/music/artist/$id': typeof ApiMusicArtistIdRoute
|
||||
'/music/playlist/$id': typeof ApiMusicPlaylistIdRoute
|
||||
'/settings/changeServer': typeof ApiSettingsChangeServerIndexRoute
|
||||
}
|
||||
export interface FileRoutesById {
|
||||
@@ -252,19 +220,12 @@ export interface FileRoutesById {
|
||||
'/_api/login': typeof ApiLoginRouteWithChildren
|
||||
'/_api/settings': typeof ApiSettingsRouteWithChildren
|
||||
'/error/$code': typeof ErrorCodeRoute
|
||||
'/_api/album/$id': typeof ApiAlbumIdRoute
|
||||
'/_api/artist/$id': typeof ApiArtistIdRoute
|
||||
'/_api/boxset/$id': typeof ApiBoxsetIdRoute
|
||||
'/_api/episode/$id': typeof ApiEpisodeIdRoute
|
||||
'/_api/item/$id': typeof ApiItemIdRoute
|
||||
'/_api/library/$id': typeof ApiLibraryIdRoute
|
||||
'/_api/login/list': typeof ApiLoginListRoute
|
||||
'/_api/login/manual': typeof ApiLoginManualRoute
|
||||
'/_api/person/$id': typeof ApiPersonIdRoute
|
||||
'/_api/player/audio': typeof ApiPlayerAudioRoute
|
||||
'/_api/player/photos': typeof ApiPlayerPhotosRoute
|
||||
'/_api/playlist/$id': typeof ApiPlaylistIdRoute
|
||||
'/_api/series/$id': typeof ApiSeriesIdRoute
|
||||
'/_api/settings/about': typeof ApiSettingsAboutRoute
|
||||
'/_api/settings/preferences': typeof ApiSettingsPreferencesRoute
|
||||
'/setup/server/add': typeof SetupServerAddRoute
|
||||
@@ -275,6 +236,9 @@ export interface FileRoutesById {
|
||||
'/_api/player/': typeof ApiPlayerIndexRoute
|
||||
'/_api/search/': typeof ApiSearchIndexRoute
|
||||
'/_api/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
||||
'/_api/music/album/$id': typeof ApiMusicAlbumIdRoute
|
||||
'/_api/music/artist/$id': typeof ApiMusicArtistIdRoute
|
||||
'/_api/music/playlist/$id': typeof ApiMusicPlaylistIdRoute
|
||||
'/_api/settings/changeServer/': typeof ApiSettingsChangeServerIndexRoute
|
||||
}
|
||||
export interface FileRouteTypes {
|
||||
@@ -284,19 +248,12 @@ export interface FileRouteTypes {
|
||||
| '/login'
|
||||
| '/settings'
|
||||
| '/error/$code'
|
||||
| '/album/$id'
|
||||
| '/artist/$id'
|
||||
| '/boxset/$id'
|
||||
| '/episode/$id'
|
||||
| '/item/$id'
|
||||
| '/library/$id'
|
||||
| '/login/list'
|
||||
| '/login/manual'
|
||||
| '/person/$id'
|
||||
| '/player/audio'
|
||||
| '/player/photos'
|
||||
| '/playlist/$id'
|
||||
| '/series/$id'
|
||||
| '/settings/about'
|
||||
| '/settings/preferences'
|
||||
| '/setup/server/add'
|
||||
@@ -307,6 +264,9 @@ export interface FileRouteTypes {
|
||||
| '/player/'
|
||||
| '/search/'
|
||||
| '/login/$userId/$userName'
|
||||
| '/music/album/$id'
|
||||
| '/music/artist/$id'
|
||||
| '/music/playlist/$id'
|
||||
| '/settings/changeServer/'
|
||||
fileRoutesByTo: FileRoutesByTo
|
||||
to:
|
||||
@@ -314,19 +274,12 @@ export interface FileRouteTypes {
|
||||
| '/login'
|
||||
| '/settings'
|
||||
| '/error/$code'
|
||||
| '/album/$id'
|
||||
| '/artist/$id'
|
||||
| '/boxset/$id'
|
||||
| '/episode/$id'
|
||||
| '/item/$id'
|
||||
| '/library/$id'
|
||||
| '/login/list'
|
||||
| '/login/manual'
|
||||
| '/person/$id'
|
||||
| '/player/audio'
|
||||
| '/player/photos'
|
||||
| '/playlist/$id'
|
||||
| '/series/$id'
|
||||
| '/settings/about'
|
||||
| '/settings/preferences'
|
||||
| '/setup/server/add'
|
||||
@@ -337,6 +290,9 @@ export interface FileRouteTypes {
|
||||
| '/player'
|
||||
| '/search'
|
||||
| '/login/$userId/$userName'
|
||||
| '/music/album/$id'
|
||||
| '/music/artist/$id'
|
||||
| '/music/playlist/$id'
|
||||
| '/settings/changeServer'
|
||||
id:
|
||||
| '__root__'
|
||||
@@ -345,19 +301,12 @@ export interface FileRouteTypes {
|
||||
| '/_api/login'
|
||||
| '/_api/settings'
|
||||
| '/error/$code'
|
||||
| '/_api/album/$id'
|
||||
| '/_api/artist/$id'
|
||||
| '/_api/boxset/$id'
|
||||
| '/_api/episode/$id'
|
||||
| '/_api/item/$id'
|
||||
| '/_api/library/$id'
|
||||
| '/_api/login/list'
|
||||
| '/_api/login/manual'
|
||||
| '/_api/person/$id'
|
||||
| '/_api/player/audio'
|
||||
| '/_api/player/photos'
|
||||
| '/_api/playlist/$id'
|
||||
| '/_api/series/$id'
|
||||
| '/_api/settings/about'
|
||||
| '/_api/settings/preferences'
|
||||
| '/setup/server/add'
|
||||
@@ -368,6 +317,9 @@ export interface FileRouteTypes {
|
||||
| '/_api/player/'
|
||||
| '/_api/search/'
|
||||
| '/_api/login/$userId/$userName'
|
||||
| '/_api/music/album/$id'
|
||||
| '/_api/music/artist/$id'
|
||||
| '/_api/music/playlist/$id'
|
||||
| '/_api/settings/changeServer/'
|
||||
fileRoutesById: FileRoutesById
|
||||
}
|
||||
@@ -382,13 +334,6 @@ export interface RootRouteChildren {
|
||||
|
||||
declare module '@tanstack/react-router' {
|
||||
interface FileRoutesByPath {
|
||||
'/_api': {
|
||||
id: '/_api'
|
||||
path: ''
|
||||
fullPath: '/'
|
||||
preLoaderRoute: typeof ApiRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/': {
|
||||
id: '/'
|
||||
path: '/'
|
||||
@@ -396,20 +341,13 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof IndexRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/error/$code': {
|
||||
id: '/error/$code'
|
||||
path: '/error/$code'
|
||||
fullPath: '/error/$code'
|
||||
preLoaderRoute: typeof ErrorCodeRouteImport
|
||||
'/_api': {
|
||||
id: '/_api'
|
||||
path: ''
|
||||
fullPath: '/'
|
||||
preLoaderRoute: typeof ApiRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/_api/settings': {
|
||||
id: '/_api/settings'
|
||||
path: '/settings'
|
||||
fullPath: '/settings'
|
||||
preLoaderRoute: typeof ApiSettingsRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/_api/login': {
|
||||
id: '/_api/login'
|
||||
path: '/login'
|
||||
@@ -417,18 +355,25 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof ApiLoginRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/_api/search/': {
|
||||
id: '/_api/search/'
|
||||
path: '/search'
|
||||
fullPath: '/search/'
|
||||
preLoaderRoute: typeof ApiSearchIndexRouteImport
|
||||
'/_api/settings': {
|
||||
id: '/_api/settings'
|
||||
path: '/settings'
|
||||
fullPath: '/settings'
|
||||
preLoaderRoute: typeof ApiSettingsRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/_api/player/': {
|
||||
id: '/_api/player/'
|
||||
path: '/player'
|
||||
fullPath: '/player/'
|
||||
preLoaderRoute: typeof ApiPlayerIndexRouteImport
|
||||
'/error/$code': {
|
||||
id: '/error/$code'
|
||||
path: '/error/$code'
|
||||
fullPath: '/error/$code'
|
||||
preLoaderRoute: typeof ErrorCodeRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/_api/favorite/': {
|
||||
id: '/_api/favorite/'
|
||||
path: '/favorite'
|
||||
fullPath: '/favorite/'
|
||||
preLoaderRoute: typeof ApiFavoriteIndexRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/_api/home/': {
|
||||
@@ -438,67 +383,39 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof ApiHomeIndexRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/_api/favorite/': {
|
||||
id: '/_api/favorite/'
|
||||
path: '/favorite'
|
||||
fullPath: '/favorite/'
|
||||
preLoaderRoute: typeof ApiFavoriteIndexRouteImport
|
||||
'/_api/item/$id': {
|
||||
id: '/_api/item/$id'
|
||||
path: '/item/$id'
|
||||
fullPath: '/item/$id'
|
||||
preLoaderRoute: typeof ApiItemIdRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/setup/server/list': {
|
||||
id: '/setup/server/list'
|
||||
path: '/setup/server/list'
|
||||
fullPath: '/setup/server/list'
|
||||
preLoaderRoute: typeof SetupServerListRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/setup/server/error': {
|
||||
id: '/setup/server/error'
|
||||
path: '/setup/server/error'
|
||||
fullPath: '/setup/server/error'
|
||||
preLoaderRoute: typeof SetupServerErrorRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/setup/server/add': {
|
||||
id: '/setup/server/add'
|
||||
path: '/setup/server/add'
|
||||
fullPath: '/setup/server/add'
|
||||
preLoaderRoute: typeof SetupServerAddRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/_api/settings/preferences': {
|
||||
id: '/_api/settings/preferences'
|
||||
path: '/preferences'
|
||||
fullPath: '/settings/preferences'
|
||||
preLoaderRoute: typeof ApiSettingsPreferencesRouteImport
|
||||
parentRoute: typeof ApiSettingsRoute
|
||||
}
|
||||
'/_api/settings/about': {
|
||||
id: '/_api/settings/about'
|
||||
path: '/about'
|
||||
fullPath: '/settings/about'
|
||||
preLoaderRoute: typeof ApiSettingsAboutRouteImport
|
||||
parentRoute: typeof ApiSettingsRoute
|
||||
}
|
||||
'/_api/series/$id': {
|
||||
id: '/_api/series/$id'
|
||||
path: '/series/$id'
|
||||
fullPath: '/series/$id'
|
||||
preLoaderRoute: typeof ApiSeriesIdRouteImport
|
||||
'/_api/library/$id': {
|
||||
id: '/_api/library/$id'
|
||||
path: '/library/$id'
|
||||
fullPath: '/library/$id'
|
||||
preLoaderRoute: typeof ApiLibraryIdRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/_api/playlist/$id': {
|
||||
id: '/_api/playlist/$id'
|
||||
path: '/playlist/$id'
|
||||
fullPath: '/playlist/$id'
|
||||
preLoaderRoute: typeof ApiPlaylistIdRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
'/_api/login/list': {
|
||||
id: '/_api/login/list'
|
||||
path: '/list'
|
||||
fullPath: '/login/list'
|
||||
preLoaderRoute: typeof ApiLoginListRouteImport
|
||||
parentRoute: typeof ApiLoginRoute
|
||||
}
|
||||
'/_api/player/photos': {
|
||||
id: '/_api/player/photos'
|
||||
path: '/player/photos'
|
||||
fullPath: '/player/photos'
|
||||
preLoaderRoute: typeof ApiPlayerPhotosRouteImport
|
||||
'/_api/login/manual': {
|
||||
id: '/_api/login/manual'
|
||||
path: '/manual'
|
||||
fullPath: '/login/manual'
|
||||
preLoaderRoute: typeof ApiLoginManualRouteImport
|
||||
parentRoute: typeof ApiLoginRoute
|
||||
}
|
||||
'/_api/player/': {
|
||||
id: '/_api/player/'
|
||||
path: '/player'
|
||||
fullPath: '/player/'
|
||||
preLoaderRoute: typeof ApiPlayerIndexRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/_api/player/audio': {
|
||||
@@ -508,67 +425,81 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof ApiPlayerAudioRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/_api/person/$id': {
|
||||
id: '/_api/person/$id'
|
||||
path: '/person/$id'
|
||||
fullPath: '/person/$id'
|
||||
preLoaderRoute: typeof ApiPersonIdRouteImport
|
||||
'/_api/player/photos': {
|
||||
id: '/_api/player/photos'
|
||||
path: '/player/photos'
|
||||
fullPath: '/player/photos'
|
||||
preLoaderRoute: typeof ApiPlayerPhotosRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/_api/login/manual': {
|
||||
id: '/_api/login/manual'
|
||||
path: '/manual'
|
||||
fullPath: '/login/manual'
|
||||
preLoaderRoute: typeof ApiLoginManualRouteImport
|
||||
'/_api/search/': {
|
||||
id: '/_api/search/'
|
||||
path: '/search'
|
||||
fullPath: '/search/'
|
||||
preLoaderRoute: typeof ApiSearchIndexRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/_api/settings/about': {
|
||||
id: '/_api/settings/about'
|
||||
path: '/about'
|
||||
fullPath: '/settings/about'
|
||||
preLoaderRoute: typeof ApiSettingsAboutRouteImport
|
||||
parentRoute: typeof ApiSettingsRoute
|
||||
}
|
||||
'/_api/settings/preferences': {
|
||||
id: '/_api/settings/preferences'
|
||||
path: '/preferences'
|
||||
fullPath: '/settings/preferences'
|
||||
preLoaderRoute: typeof ApiSettingsPreferencesRouteImport
|
||||
parentRoute: typeof ApiSettingsRoute
|
||||
}
|
||||
'/setup/server/add': {
|
||||
id: '/setup/server/add'
|
||||
path: '/setup/server/add'
|
||||
fullPath: '/setup/server/add'
|
||||
preLoaderRoute: typeof SetupServerAddRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/setup/server/error': {
|
||||
id: '/setup/server/error'
|
||||
path: '/setup/server/error'
|
||||
fullPath: '/setup/server/error'
|
||||
preLoaderRoute: typeof SetupServerErrorRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/setup/server/list': {
|
||||
id: '/setup/server/list'
|
||||
path: '/setup/server/list'
|
||||
fullPath: '/setup/server/list'
|
||||
preLoaderRoute: typeof SetupServerListRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/_api/login/$userId/$userName': {
|
||||
id: '/_api/login/$userId/$userName'
|
||||
path: '/$userId/$userName'
|
||||
fullPath: '/login/$userId/$userName'
|
||||
preLoaderRoute: typeof ApiLoginUserIdUserNameRouteImport
|
||||
parentRoute: typeof ApiLoginRoute
|
||||
}
|
||||
'/_api/login/list': {
|
||||
id: '/_api/login/list'
|
||||
path: '/list'
|
||||
fullPath: '/login/list'
|
||||
preLoaderRoute: typeof ApiLoginListRouteImport
|
||||
parentRoute: typeof ApiLoginRoute
|
||||
}
|
||||
'/_api/library/$id': {
|
||||
id: '/_api/library/$id'
|
||||
path: '/library/$id'
|
||||
fullPath: '/library/$id'
|
||||
preLoaderRoute: typeof ApiLibraryIdRouteImport
|
||||
'/_api/music/album/$id': {
|
||||
id: '/_api/music/album/$id'
|
||||
path: '/music/album/$id'
|
||||
fullPath: '/music/album/$id'
|
||||
preLoaderRoute: typeof ApiMusicAlbumIdRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/_api/item/$id': {
|
||||
id: '/_api/item/$id'
|
||||
path: '/item/$id'
|
||||
fullPath: '/item/$id'
|
||||
preLoaderRoute: typeof ApiItemIdRouteImport
|
||||
'/_api/music/artist/$id': {
|
||||
id: '/_api/music/artist/$id'
|
||||
path: '/music/artist/$id'
|
||||
fullPath: '/music/artist/$id'
|
||||
preLoaderRoute: typeof ApiMusicArtistIdRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/_api/episode/$id': {
|
||||
id: '/_api/episode/$id'
|
||||
path: '/episode/$id'
|
||||
fullPath: '/episode/$id'
|
||||
preLoaderRoute: typeof ApiEpisodeIdRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/_api/boxset/$id': {
|
||||
id: '/_api/boxset/$id'
|
||||
path: '/boxset/$id'
|
||||
fullPath: '/boxset/$id'
|
||||
preLoaderRoute: typeof ApiBoxsetIdRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/_api/artist/$id': {
|
||||
id: '/_api/artist/$id'
|
||||
path: '/artist/$id'
|
||||
fullPath: '/artist/$id'
|
||||
preLoaderRoute: typeof ApiArtistIdRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/_api/album/$id': {
|
||||
id: '/_api/album/$id'
|
||||
path: '/album/$id'
|
||||
fullPath: '/album/$id'
|
||||
preLoaderRoute: typeof ApiAlbumIdRouteImport
|
||||
'/_api/music/playlist/$id': {
|
||||
id: '/_api/music/playlist/$id'
|
||||
path: '/music/playlist/$id'
|
||||
fullPath: '/music/playlist/$id'
|
||||
preLoaderRoute: typeof ApiMusicPlaylistIdRouteImport
|
||||
parentRoute: typeof ApiRoute
|
||||
}
|
||||
'/_api/settings/changeServer/': {
|
||||
@@ -578,13 +509,6 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof ApiSettingsChangeServerIndexRouteImport
|
||||
parentRoute: typeof ApiSettingsRoute
|
||||
}
|
||||
'/_api/login/$userId/$userName': {
|
||||
id: '/_api/login/$userId/$userName'
|
||||
path: '/$userId/$userName'
|
||||
fullPath: '/login/$userId/$userName'
|
||||
preLoaderRoute: typeof ApiLoginUserIdUserNameRouteImport
|
||||
parentRoute: typeof ApiLoginRoute
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -623,41 +547,33 @@ const ApiSettingsRouteWithChildren = ApiSettingsRoute._addFileChildren(
|
||||
interface ApiRouteChildren {
|
||||
ApiLoginRoute: typeof ApiLoginRouteWithChildren
|
||||
ApiSettingsRoute: typeof ApiSettingsRouteWithChildren
|
||||
ApiAlbumIdRoute: typeof ApiAlbumIdRoute
|
||||
ApiArtistIdRoute: typeof ApiArtistIdRoute
|
||||
ApiBoxsetIdRoute: typeof ApiBoxsetIdRoute
|
||||
ApiEpisodeIdRoute: typeof ApiEpisodeIdRoute
|
||||
ApiItemIdRoute: typeof ApiItemIdRoute
|
||||
ApiLibraryIdRoute: typeof ApiLibraryIdRoute
|
||||
ApiPersonIdRoute: typeof ApiPersonIdRoute
|
||||
ApiPlayerAudioRoute: typeof ApiPlayerAudioRoute
|
||||
ApiPlayerPhotosRoute: typeof ApiPlayerPhotosRoute
|
||||
ApiPlaylistIdRoute: typeof ApiPlaylistIdRoute
|
||||
ApiSeriesIdRoute: typeof ApiSeriesIdRoute
|
||||
ApiFavoriteIndexRoute: typeof ApiFavoriteIndexRoute
|
||||
ApiHomeIndexRoute: typeof ApiHomeIndexRoute
|
||||
ApiPlayerIndexRoute: typeof ApiPlayerIndexRoute
|
||||
ApiSearchIndexRoute: typeof ApiSearchIndexRoute
|
||||
ApiMusicAlbumIdRoute: typeof ApiMusicAlbumIdRoute
|
||||
ApiMusicArtistIdRoute: typeof ApiMusicArtistIdRoute
|
||||
ApiMusicPlaylistIdRoute: typeof ApiMusicPlaylistIdRoute
|
||||
}
|
||||
|
||||
const ApiRouteChildren: ApiRouteChildren = {
|
||||
ApiLoginRoute: ApiLoginRouteWithChildren,
|
||||
ApiSettingsRoute: ApiSettingsRouteWithChildren,
|
||||
ApiAlbumIdRoute: ApiAlbumIdRoute,
|
||||
ApiArtistIdRoute: ApiArtistIdRoute,
|
||||
ApiBoxsetIdRoute: ApiBoxsetIdRoute,
|
||||
ApiEpisodeIdRoute: ApiEpisodeIdRoute,
|
||||
ApiItemIdRoute: ApiItemIdRoute,
|
||||
ApiLibraryIdRoute: ApiLibraryIdRoute,
|
||||
ApiPersonIdRoute: ApiPersonIdRoute,
|
||||
ApiPlayerAudioRoute: ApiPlayerAudioRoute,
|
||||
ApiPlayerPhotosRoute: ApiPlayerPhotosRoute,
|
||||
ApiPlaylistIdRoute: ApiPlaylistIdRoute,
|
||||
ApiSeriesIdRoute: ApiSeriesIdRoute,
|
||||
ApiFavoriteIndexRoute: ApiFavoriteIndexRoute,
|
||||
ApiHomeIndexRoute: ApiHomeIndexRoute,
|
||||
ApiPlayerIndexRoute: ApiPlayerIndexRoute,
|
||||
ApiSearchIndexRoute: ApiSearchIndexRoute,
|
||||
ApiMusicAlbumIdRoute: ApiMusicAlbumIdRoute,
|
||||
ApiMusicArtistIdRoute: ApiMusicArtistIdRoute,
|
||||
ApiMusicPlaylistIdRoute: ApiMusicPlaylistIdRoute,
|
||||
}
|
||||
|
||||
const ApiRouteWithChildren = ApiRoute._addFileChildren(ApiRouteChildren)
|
||||
|
||||
+12
-5
@@ -20,9 +20,9 @@ import "material-symbols/rounded.scss";
|
||||
import type { Api, Jellyfin } from "@jellyfin/sdk";
|
||||
import type { UserDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import type { QueryClient } from "@tanstack/react-query";
|
||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||
import { TanStackRouterDevtools } from "@tanstack/react-router-devtools";
|
||||
// import { TanStackRouterDevtools } from "@tanstack/react-router-devtools";
|
||||
import { TanStackDevtools } from "@tanstack/react-devtools";
|
||||
import { ReactQueryDevtoolsPanel } from "@tanstack/react-query-devtools";
|
||||
import { TanStackRouterDevtoolsPanel } from "@tanstack/react-router-devtools";
|
||||
import { DndProvider } from "react-dnd";
|
||||
import { HTML5Backend } from "react-dnd-html5-backend";
|
||||
import Backdrop from "@/components/backdrop";
|
||||
@@ -59,8 +59,15 @@ export const Route = createRootRouteWithContext<ApiContext>()({
|
||||
<AppBar />
|
||||
<AudioPlayer />
|
||||
<Outlet />
|
||||
<ReactQueryDevtools />
|
||||
<TanStackRouterDevtools />
|
||||
<TanStackDevtools
|
||||
plugins={[
|
||||
{ name: "TanStack Query", render: <ReactQueryDevtoolsPanel /> },
|
||||
{
|
||||
name: "TanStack Router",
|
||||
render: <TanStackRouterDevtoolsPanel />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</SnackbarProvider>
|
||||
</ThemeProvider>
|
||||
</DndProvider>
|
||||
|
||||
@@ -1,279 +0,0 @@
|
||||
import {
|
||||
BaseItemKind,
|
||||
ItemFields,
|
||||
LocationType,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { motion } from "motion/react";
|
||||
import React, { useLayoutEffect, useRef } from "react";
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import MarkPlayedButton from "@/components/buttons/markPlayedButton";
|
||||
import PlayButton from "@/components/buttons/playButton";
|
||||
import { Card } from "@/components/card/card";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
import ItemHeader from "@/components/itemHeader";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import "./boxset.scss";
|
||||
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import IconLink from "@/components/iconLink";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
|
||||
export const Route = createFileRoute("/_api/boxset/$id")({
|
||||
component: BoxSetTitlePage,
|
||||
});
|
||||
|
||||
function BoxSetTitlePage() {
|
||||
const { id } = Route.useParams();
|
||||
const api = Route.useRouteContext().api;
|
||||
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user?.Id,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
|
||||
const collectionItems = useQuery({
|
||||
queryKey: ["item", id, "collection"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
parentId: id,
|
||||
fields: [ItemFields.SeasonUserData, ItemFields.Overview],
|
||||
excludeLocationTypes: [LocationType.Virtual],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
|
||||
const similarItems = useQuery({
|
||||
queryKey: ["item", "similarItem", id],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getLibraryApi(api).getSimilarItems({
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
limit: 16,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
|
||||
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (api && item.isSuccess) {
|
||||
if (item.data?.BackdropImageTags?.length) {
|
||||
setBackdrop(
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id ?? "",
|
||||
"Backdrop",
|
||||
{
|
||||
tag: item.data.BackdropImageTags[0],
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
setBackdrop("");
|
||||
}
|
||||
}
|
||||
}, [item.isSuccess]);
|
||||
|
||||
const scrollTargetRef = useRef<HTMLDivElement | null>(null);
|
||||
|
||||
if (item.isPending || similarItems.isPending) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
if (item.isSuccess && item.data && similarItems.isSuccess) {
|
||||
return (
|
||||
<motion.div
|
||||
key={id}
|
||||
initial={{
|
||||
opacity: 0,
|
||||
}}
|
||||
animate={{
|
||||
opacity: 1,
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.25,
|
||||
ease: "easeInOut",
|
||||
}}
|
||||
className="scrollY item item-boxset padded-top"
|
||||
>
|
||||
<div ref={scrollTargetRef} />
|
||||
<ItemHeader
|
||||
item={item.data}
|
||||
api={api}
|
||||
scrollTargetRef={scrollTargetRef}
|
||||
>
|
||||
<div className="item-hero-buttons-container flex flex-row">
|
||||
<div className="flex flex-row fullWidth">
|
||||
<PlayButton
|
||||
item={item.data}
|
||||
itemType={item.data.Type ?? "BoxSet"}
|
||||
userId={user?.Id}
|
||||
buttonProps={{
|
||||
fullWidth: true,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-row" style={{ gap: "1em" }}>
|
||||
<LikeButton
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isFavorite={item.data.UserData?.IsFavorite}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
<MarkPlayedButton
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isPlayed={item.data.UserData?.Played}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</ItemHeader>
|
||||
<div
|
||||
className="item-detail"
|
||||
style={{
|
||||
marginBottom: "2em",
|
||||
}}
|
||||
>
|
||||
<ShowMoreText content={item.data.Overview ?? ""} collapsedLines={4} />
|
||||
<div
|
||||
style={{
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: "0.6em",
|
||||
alignSelf: "end",
|
||||
marginTop: "1em",
|
||||
}}
|
||||
>
|
||||
{item.data.ExternalUrls?.map((url) => (
|
||||
<IconLink
|
||||
url={url.Url ?? ""}
|
||||
name={url.Name ?? ""}
|
||||
key={url.Url}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{(collectionItems.data?.TotalRecordCount ?? 0) > 0 && (
|
||||
<CardScroller title="" displayCards={7} disableDecoration>
|
||||
{collectionItems.data?.Items?.map((similar) => {
|
||||
return (
|
||||
<Card
|
||||
key={similar.Id}
|
||||
item={similar}
|
||||
seriesId={similar.SeriesId}
|
||||
cardTitle={
|
||||
similar.Type === BaseItemKind.Episode
|
||||
? similar.SeriesName
|
||||
: similar.Name
|
||||
}
|
||||
imageType={"Primary"}
|
||||
cardCaption={similar.ProductionYear}
|
||||
cardType={"portrait"}
|
||||
queryKey={["item", id]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
{similarItems.data?.TotalRecordCount && (
|
||||
<CardScroller
|
||||
title="You might also like"
|
||||
displayCards={7}
|
||||
disableDecoration
|
||||
>
|
||||
{similarItems.data?.Items?.map((similar) => {
|
||||
return (
|
||||
<Card
|
||||
key={similar.Id}
|
||||
item={similar}
|
||||
seriesId={similar.SeriesId}
|
||||
cardTitle={
|
||||
similar.Type === BaseItemKind.Episode
|
||||
? similar.SeriesName
|
||||
: similar.Name
|
||||
}
|
||||
imageType={"Primary"}
|
||||
cardCaption={
|
||||
similar.Type === BaseItemKind.Episode
|
||||
? `S${similar.ParentIndexNumber}:E${similar.IndexNumber} - ${similar.Name}`
|
||||
: similar.Type === BaseItemKind.Series
|
||||
? `${similar.ProductionYear} - ${
|
||||
similar.EndDate
|
||||
? new Date(similar.EndDate).toLocaleString([], {
|
||||
year: "numeric",
|
||||
})
|
||||
: "Present"
|
||||
}`
|
||||
: similar.ProductionYear
|
||||
}
|
||||
cardType={
|
||||
similar.Type === BaseItemKind.MusicAlbum ||
|
||||
similar.Type === BaseItemKind.Audio
|
||||
? "square"
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
if (item.isError || similarItems.isError) {
|
||||
return <ErrorNotice />;
|
||||
}
|
||||
}
|
||||
|
||||
export default BoxSetTitlePage;
|
||||
@@ -1,66 +0,0 @@
|
||||
$cardWidth: 18%;
|
||||
.item-boxset.item {
|
||||
gap: 1em;
|
||||
|
||||
.item-detail {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 35%;
|
||||
justify-items: center;
|
||||
align-items: start;
|
||||
gap: 3em;
|
||||
|
||||
&-cast {
|
||||
&-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
}
|
||||
&-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
gap: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
&-card {
|
||||
display: grid;
|
||||
grid-template-columns: 6em 1fr;
|
||||
gap: 0.5em;
|
||||
align-items: center;
|
||||
color: white !important;
|
||||
text-decoration: none;
|
||||
padding: 0.5em;
|
||||
background: rgb(255 255 255 / 0);
|
||||
transition: background $transition-time-default;
|
||||
border-radius: $border-radius-default;
|
||||
&:hover {
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
}
|
||||
&-image,
|
||||
&-icon {
|
||||
width: 6em;
|
||||
height: 6em;
|
||||
object-fit: cover;
|
||||
border-radius: 100%;
|
||||
box-shadow: $shadow-card-image;
|
||||
}
|
||||
&-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1em;
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
.material-symbols-rounded {
|
||||
font-size: 3em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&-link {
|
||||
color: white;
|
||||
text-decoration-color: rgb(255 255 255 / 0.5);
|
||||
&:hover {
|
||||
text-decoration-color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,653 +0,0 @@
|
||||
import {
|
||||
BaseItemKind,
|
||||
MediaStreamType,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { motion } from "motion/react";
|
||||
import React, { useEffect, useMemo, useRef, useState } from "react";
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import MarkPlayedButton from "@/components/buttons/markPlayedButton";
|
||||
import PlayButton from "@/components/buttons/playButton";
|
||||
import TrailerButton from "@/components/buttons/trailerButton";
|
||||
// import useParallax from "@/utils/hooks/useParallax";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import "./episode.scss";
|
||||
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { createFileRoute, Link } from "@tanstack/react-router";
|
||||
import { Card } from "@/components/card/card";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
import IconLink from "@/components/iconLink";
|
||||
import ItemHeader from "@/components/itemHeader";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
|
||||
|
||||
export const Route = createFileRoute("/_api/episode/$id")({
|
||||
component: EpisodeTitlePage,
|
||||
});
|
||||
|
||||
function EpisodeTitlePage() {
|
||||
const { id } = Route.useParams();
|
||||
const api = Route.useRouteContext().api;
|
||||
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user?.Id,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
|
||||
const upcomingEpisodes = useQuery({
|
||||
queryKey: ["item", id, "episode", "upcomingEpisodes"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
parentId: item.data?.ParentId ?? "",
|
||||
startIndex: item.data?.IndexNumber ?? 0,
|
||||
excludeLocationTypes: ["Virtual"],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data?.Type === BaseItemKind.Episode,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const setBackdrop = useBackdropStore((state) => state.setBackdrop);
|
||||
|
||||
const [selectedVideoTrack, setSelectedVideoTrack] = useState(0);
|
||||
const [selectedAudioTrack, setSelectedAudioTrack] = useState(0);
|
||||
const [selectedSubtitleTrack, setSelectedSubtitleTrack] = useState(0);
|
||||
|
||||
const videoTracks = useMemo(() => {
|
||||
const result = item.data?.MediaStreams?.filter((source) => {
|
||||
if (source.Type === MediaStreamType.Video) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
setSelectedVideoTrack(result?.find((track) => track.IsDefault)?.Index ?? 0);
|
||||
return result ?? [];
|
||||
}, [item.data?.Id]);
|
||||
const audioTracks = useMemo(() => {
|
||||
const result = item.data?.MediaStreams?.filter((source) => {
|
||||
if (source.Type === MediaStreamType.Audio) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
setSelectedAudioTrack(
|
||||
item.data?.MediaSources?.[0].DefaultAudioStreamIndex ?? 0,
|
||||
);
|
||||
return result ?? [];
|
||||
}, [item.data?.Id]);
|
||||
const subtitleTracks = useMemo(() => {
|
||||
const result = item.data?.MediaStreams?.filter((source) => {
|
||||
if (source.Type === MediaStreamType.Subtitle) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
setSelectedSubtitleTrack(
|
||||
result?.find((track) => track.IsDefault)?.Index ?? -1,
|
||||
);
|
||||
return result ?? [];
|
||||
}, [item.data?.Id]);
|
||||
|
||||
const directors = useMemo(() => {
|
||||
return item.data?.People?.filter((itm) => itm.Type === "Director") ?? [];
|
||||
}, [item.data?.Id]);
|
||||
const writers = useMemo(() => {
|
||||
return item.data?.People?.filter((itm) => itm.Type === "Writer") ?? [];
|
||||
}, [item.data?.Id]);
|
||||
const actors = useMemo(() => {
|
||||
return item.data?.People?.filter((itm) => itm.Type === "Actor") ?? [];
|
||||
}, [item.data?.Id]);
|
||||
const producers = useMemo(() => {
|
||||
return item.data?.People?.filter((itm) => itm.Type === "Producer") ?? [];
|
||||
}, [item.data?.Id]);
|
||||
|
||||
const mediaQualityInfo = useMemo<MediaQualityInfo>(() => {
|
||||
const checkAtmos = audioTracks.filter((audio) =>
|
||||
audio.DisplayTitle?.toLocaleLowerCase().includes("atmos"),
|
||||
);
|
||||
const checkDolbyVision = videoTracks.filter(
|
||||
(video) =>
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("dv") ||
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("dolby vision") ||
|
||||
!!video.VideoDoViTitle ||
|
||||
video.VideoRangeType === "DOVI",
|
||||
);
|
||||
const checkDD = audioTracks.filter(
|
||||
(audio) =>
|
||||
(audio.DisplayTitle?.toLocaleLowerCase().includes("dd") &&
|
||||
!audio.DisplayTitle?.toLocaleLowerCase().includes("ddp")) ||
|
||||
(audio.DisplayTitle?.toLocaleLowerCase().includes("dolby digital") &&
|
||||
!audio.DisplayTitle?.toLocaleLowerCase().includes("dolby digital+")),
|
||||
);
|
||||
const checkDDP = audioTracks.filter(
|
||||
(audio) =>
|
||||
audio.DisplayTitle?.toLocaleLowerCase().includes("ddp") ||
|
||||
audio.DisplayTitle?.toLocaleLowerCase().includes("dolby digital+"),
|
||||
);
|
||||
const checkDts = audioTracks.filter(
|
||||
(audio) =>
|
||||
audio.DisplayTitle?.toLocaleLowerCase().includes("dts") &&
|
||||
!audio.DisplayTitle?.toLocaleLowerCase().includes("dts-hd ma") &&
|
||||
!audio.DisplayTitle?.toLocaleLowerCase().includes("dts-hd.ma"),
|
||||
);
|
||||
const checkDtsHDMA = audioTracks.filter(
|
||||
(audio) =>
|
||||
audio.DisplayTitle?.toLocaleLowerCase().includes("dts-hd ma") ||
|
||||
audio.DisplayTitle?.toLocaleLowerCase().includes("dts-hd.ma"),
|
||||
);
|
||||
const checkUHD = videoTracks.filter(
|
||||
(video) =>
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("4k") ||
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("2160p") ||
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("uhd"),
|
||||
);
|
||||
const checkHD = videoTracks.filter(
|
||||
(video) =>
|
||||
(video.DisplayTitle?.toLocaleLowerCase().includes("hd") &&
|
||||
!video.DisplayTitle?.toLocaleLowerCase().includes("hdr")) ||
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("1080p") ||
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("fhd"),
|
||||
);
|
||||
const checkSD = videoTracks.filter(
|
||||
(video) =>
|
||||
(video.DisplayTitle?.toLocaleLowerCase().includes("sd") &&
|
||||
!video.DisplayTitle?.toLocaleLowerCase().includes("sdr")) ||
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("720p"),
|
||||
);
|
||||
const checkSDR = videoTracks.filter(
|
||||
(video) => video.VideoRangeType === "SDR",
|
||||
);
|
||||
const checkHDR = videoTracks.filter(
|
||||
(video) =>
|
||||
video.VideoRange === "HDR" ||
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("dv"),
|
||||
);
|
||||
const checkHDR10 = videoTracks.filter(
|
||||
(video) =>
|
||||
video.VideoRangeType === "HDR10" &&
|
||||
!video.DisplayTitle?.toLocaleLowerCase().includes("hdr10+"),
|
||||
);
|
||||
const checkHDR10Plus = videoTracks.filter(
|
||||
(video) =>
|
||||
video.VideoRangeType === "HDR10Plus" ||
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("hdr10+"),
|
||||
);
|
||||
const checkTrueHD = audioTracks.filter((audio) =>
|
||||
audio.DisplayTitle?.toLocaleLowerCase().includes("truehd"),
|
||||
);
|
||||
const checkIMAX = videoTracks.filter((video) =>
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("imax"),
|
||||
);
|
||||
return {
|
||||
isAtmos: checkAtmos.length > 0,
|
||||
isDolbyVision: checkDolbyVision.length > 0,
|
||||
isDts: checkDts.length > 0,
|
||||
isDtsHDMA: checkDtsHDMA.length > 0,
|
||||
isDD: checkDD.length > 0,
|
||||
isDDP: checkDDP.length > 0,
|
||||
isUHD: checkUHD.length > 0,
|
||||
isHD: checkHD.length > 0,
|
||||
isSD: checkSD.length > 0,
|
||||
isSDR: checkSDR.length > 0,
|
||||
isHDR: checkHDR.length > 0,
|
||||
isHDR10: checkHDR10.length > 0,
|
||||
isHDR10Plus: checkHDR10Plus.length > 0,
|
||||
isTrueHD: checkTrueHD.length > 0,
|
||||
isIMAX: checkIMAX.length > 0,
|
||||
};
|
||||
}, [item.data?.Id]);
|
||||
|
||||
const lastBackdropRef = useRef<string | undefined>(undefined);
|
||||
useEffect(() => {
|
||||
if (!api || !item.isSuccess || !item.data) return;
|
||||
const tag = item.data.ParentBackdropImageTags?.[0];
|
||||
// Prefer blurhash if available; fallback to URL
|
||||
const hash = item.data.ImageBlurHashes?.Backdrop?.[tag ?? ""];
|
||||
|
||||
if (hash && lastBackdropRef.current !== hash) {
|
||||
lastBackdropRef.current = hash;
|
||||
setBackdrop(hash);
|
||||
}
|
||||
}, [api, item.isSuccess, item.data, setBackdrop]);
|
||||
|
||||
const containerRef = useRef<HTMLDivElement | null>(null);
|
||||
|
||||
if (item.isPending) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
if (item.isSuccess && item.data) {
|
||||
return (
|
||||
<motion.div
|
||||
key={id}
|
||||
initial={{
|
||||
opacity: 0,
|
||||
}}
|
||||
animate={{
|
||||
opacity: 1,
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.25,
|
||||
ease: "easeInOut",
|
||||
}}
|
||||
className="scrollY padded-top flex flex-column item item-episode"
|
||||
ref={containerRef}
|
||||
>
|
||||
<ItemHeader
|
||||
item={item.data}
|
||||
api={api}
|
||||
mediaQualityInfo={mediaQualityInfo}
|
||||
scrollTargetRef={containerRef}
|
||||
>
|
||||
<div className="item-hero-buttons-container">
|
||||
<div className="flex flex-row">
|
||||
<PlayButton
|
||||
item={item.data}
|
||||
itemType="Episode"
|
||||
currentVideoTrack={selectedVideoTrack ?? 0}
|
||||
currentAudioTrack={selectedAudioTrack ?? 0}
|
||||
currentSubTrack={selectedSubtitleTrack ?? "nosub"}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-row" style={{ gap: "1em" }}>
|
||||
{item.data.RemoteTrailers && (
|
||||
<TrailerButton
|
||||
trailerItem={item.data.RemoteTrailers}
|
||||
disabled={item.data.RemoteTrailers?.length === 0}
|
||||
/>
|
||||
)}
|
||||
<LikeButton
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isFavorite={item.data.UserData?.IsFavorite}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
<MarkPlayedButton
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isPlayed={item.data.UserData?.Played}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</ItemHeader>
|
||||
<div className="item-detail">
|
||||
<div className="fullWidth">
|
||||
<ShowMoreText
|
||||
content={item.data.Overview ?? ""}
|
||||
collapsedLines={4}
|
||||
/>
|
||||
</div>
|
||||
<div className="fullWidth">
|
||||
{videoTracks.length > 0 && (
|
||||
<TextField
|
||||
label="Video"
|
||||
select
|
||||
style={{
|
||||
width: "100%",
|
||||
marginBottom: "1em",
|
||||
}}
|
||||
value={selectedVideoTrack}
|
||||
variant="filled"
|
||||
onChange={(e) => setSelectedVideoTrack(Number(e.target.value))}
|
||||
>
|
||||
{videoTracks.map((track) => (
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
{track.DisplayTitle}
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
)}
|
||||
{audioTracks.length > 0 && (
|
||||
<TextField
|
||||
label="Audio"
|
||||
select
|
||||
style={{
|
||||
width: "100%",
|
||||
marginBottom: "1em",
|
||||
}}
|
||||
value={selectedAudioTrack}
|
||||
variant="filled"
|
||||
onChange={(e) => setSelectedAudioTrack(Number(e.target.value))}
|
||||
>
|
||||
{audioTracks.map((track) => (
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
{track.DisplayTitle}
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
)}
|
||||
{subtitleTracks.length > 0 && (
|
||||
<TextField
|
||||
label="Subtitle"
|
||||
select
|
||||
style={{
|
||||
width: "100%",
|
||||
}}
|
||||
value={selectedSubtitleTrack}
|
||||
variant="filled"
|
||||
onChange={(e) =>
|
||||
setSelectedSubtitleTrack(Number(e.target.value))
|
||||
}
|
||||
>
|
||||
<MenuItem key={-1} value={-1}>
|
||||
No Subtitle
|
||||
</MenuItem>
|
||||
{subtitleTracks.map((track) => (
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
{track.DisplayTitle}
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
)}
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: "0.6em",
|
||||
alignSelf: "end",
|
||||
marginTop: "1em",
|
||||
}}
|
||||
>
|
||||
{item.data.ExternalUrls?.map((url) => (
|
||||
<IconLink
|
||||
key={url.Url}
|
||||
url={url.Url ?? ""}
|
||||
name={url.Name ?? ""}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{(item.data.People?.length ?? 0) > 0 && (
|
||||
<div className="item-detail-cast">
|
||||
<Typography variant="h5" mb={2}>
|
||||
Cast & Crew
|
||||
</Typography>
|
||||
{actors.length > 0 && (
|
||||
<div className="item-detail-cast-container">
|
||||
<Typography variant="h6">Actors</Typography>
|
||||
<div className="item-detail-cast-grid">
|
||||
{actors.map((actor) => (
|
||||
<Link
|
||||
className="item-detail-cast-card"
|
||||
key={actor.Id}
|
||||
to="/person/$id"
|
||||
params={{
|
||||
id: actor.Id ?? "",
|
||||
}}
|
||||
>
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)
|
||||
}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
<div className="item-detail-cast-card-icon">
|
||||
{getTypeIcon("Person")}
|
||||
</div>
|
||||
)}
|
||||
<div className="item-detail-cast-card-text">
|
||||
<Typography variant="subtitle1">
|
||||
{actor.Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
opacity: 0.5,
|
||||
}}
|
||||
>
|
||||
{actor.Role}
|
||||
</Typography>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{writers.length > 0 && (
|
||||
<div className="item-detail-cast-container">
|
||||
<Typography variant="h6">Writers</Typography>
|
||||
<div className="item-detail-cast-grid">
|
||||
{writers.map((actor) => (
|
||||
<Link
|
||||
className="item-detail-cast-card"
|
||||
key={actor.Id}
|
||||
to="/person/$id"
|
||||
params={{
|
||||
id: actor.Id ?? "",
|
||||
}}
|
||||
>
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)
|
||||
}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
<div className="item-detail-cast-card-icon">
|
||||
{getTypeIcon("Person")}
|
||||
</div>
|
||||
)}
|
||||
<div className="item-detail-cast-card-text">
|
||||
<Typography variant="subtitle1">
|
||||
{actor.Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
opacity: 0.5,
|
||||
}}
|
||||
>
|
||||
{actor.Role}
|
||||
</Typography>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{directors.length > 0 && (
|
||||
<div className="item-detail-cast-container">
|
||||
<Typography variant="h6">Directors</Typography>
|
||||
<div className="item-detail-cast-grid">
|
||||
{directors.map((actor) => (
|
||||
<Link
|
||||
className="item-detail-cast-card"
|
||||
key={actor.Id}
|
||||
to="/person/$id"
|
||||
params={{
|
||||
id: actor.Id ?? "",
|
||||
}}
|
||||
>
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)
|
||||
}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
<div className="item-detail-cast-card-icon">
|
||||
{getTypeIcon("Person")}
|
||||
</div>
|
||||
)}
|
||||
<div className="item-detail-cast-card-text">
|
||||
<Typography variant="subtitle1">
|
||||
{actor.Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
opacity: 0.5,
|
||||
}}
|
||||
>
|
||||
{actor.Role}
|
||||
</Typography>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{producers.length > 0 && (
|
||||
<div className="item-detail-cast-container">
|
||||
<Typography variant="h6">Producers</Typography>
|
||||
<div className="item-detail-cast-grid">
|
||||
{producers.map((actor) => (
|
||||
<Link
|
||||
className="item-detail-cast-card"
|
||||
key={actor.Id}
|
||||
to="/person/$id"
|
||||
params={{
|
||||
id: actor.Id ?? "",
|
||||
}}
|
||||
>
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)
|
||||
}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
<div className="item-detail-cast-card-icon">
|
||||
{getTypeIcon("Person")}
|
||||
</div>
|
||||
)}
|
||||
<div className="item-detail-cast-card-text">
|
||||
<Typography variant="subtitle1">
|
||||
{actor.Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
opacity: 0.5,
|
||||
}}
|
||||
>
|
||||
{actor.Role}
|
||||
</Typography>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{upcomingEpisodes.isSuccess &&
|
||||
(upcomingEpisodes.data?.Items?.length ?? 0) > 0 && (
|
||||
<CardScroller
|
||||
title="Upcoming Episodes"
|
||||
displayCards={4}
|
||||
disableDecoration
|
||||
>
|
||||
{upcomingEpisodes.data?.Items?.map((episode) => {
|
||||
return (
|
||||
<Card
|
||||
key={episode.Id}
|
||||
item={episode}
|
||||
cardTitle={episode.SeriesName}
|
||||
imageType="Primary"
|
||||
cardCaption={`S${episode.ParentIndexNumber}:E${episode.IndexNumber} - ${episode.Name}`}
|
||||
cardType="thumb"
|
||||
queryKey={["item", id, "episode", "upcomingEpisodes"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
if (item.isError) {
|
||||
return <ErrorNotice />;
|
||||
}
|
||||
}
|
||||
|
||||
export default EpisodeTitlePage;
|
||||
@@ -1,66 +0,0 @@
|
||||
$cardWidth: 30%;
|
||||
.item-episode.item {
|
||||
gap: 1em;
|
||||
|
||||
.item-detail {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 35%;
|
||||
justify-items: center;
|
||||
align-items: start;
|
||||
gap: 3em;
|
||||
|
||||
&-cast {
|
||||
&-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
}
|
||||
&-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
gap: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
&-card {
|
||||
display: grid;
|
||||
grid-template-columns: 6em 1fr;
|
||||
gap: 0.5em;
|
||||
align-items: center;
|
||||
color: white !important;
|
||||
text-decoration: none;
|
||||
padding: 0.5em;
|
||||
background: rgb(255 255 255 / 0);
|
||||
transition: background $transition-time-default;
|
||||
border-radius: $border-radius-default;
|
||||
&:hover {
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
}
|
||||
&-image,
|
||||
&-icon {
|
||||
width: 6em;
|
||||
height: 6em;
|
||||
object-fit: cover;
|
||||
border-radius: 100%;
|
||||
box-shadow: $shadow-card-image;
|
||||
}
|
||||
&-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1em;
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
.material-symbols-rounded {
|
||||
font-size: 3em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&-link {
|
||||
color: white;
|
||||
text-decoration-color: rgb(255 255 255 / 0.5);
|
||||
&:hover {
|
||||
text-decoration-color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,15 +32,16 @@
|
||||
|
||||
.MuiTabs-root {
|
||||
min-height: 40px;
|
||||
margin-left: -12px;
|
||||
margin-top: 1em;
|
||||
// Negative margins cancel the scroller padding below, so the layout is unchanged
|
||||
margin: calc(1em - 8px) 0 -16px -12px;
|
||||
|
||||
.MuiTabs-indicator {
|
||||
display: none; // Hide default indicator
|
||||
}
|
||||
|
||||
// Tabs clip their content; pad the scroller so the selected pill's shadow fits
|
||||
.MuiTabs-scroller {
|
||||
overflow: visible !important; // Allow shadows/glows to show
|
||||
padding: 8px 0 16px;
|
||||
}
|
||||
|
||||
.MuiTab-root {
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
type BaseItemDto,
|
||||
BaseItemKind,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import { Fade, Tab, Tabs, Typography } from "@mui/material";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import { useShallow } from "zustand/react/shallow";
|
||||
@@ -32,7 +32,7 @@ function FavoritePage() {
|
||||
queryKey: ["favorite", "movies"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
const result = await getLibraryApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.Movie],
|
||||
@@ -47,7 +47,7 @@ function FavoritePage() {
|
||||
queryKey: ["favorite", "series"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
const result = await getLibraryApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.Series],
|
||||
@@ -61,7 +61,7 @@ function FavoritePage() {
|
||||
queryKey: ["favorite", "musicAlbum"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
const result = await getLibraryApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.MusicAlbum],
|
||||
@@ -75,7 +75,7 @@ function FavoritePage() {
|
||||
queryKey: ["favorite", "audio"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
const result = await getLibraryApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.Audio],
|
||||
@@ -89,7 +89,7 @@ function FavoritePage() {
|
||||
queryKey: ["favorite", "book"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
const result = await getLibraryApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.Book],
|
||||
@@ -103,7 +103,7 @@ function FavoritePage() {
|
||||
queryKey: ["favorite", "musicArtist"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
const result = await getLibraryApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.MusicArtist],
|
||||
@@ -117,7 +117,7 @@ function FavoritePage() {
|
||||
queryKey: ["favorite", "person"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
const result = await getLibraryApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.Person],
|
||||
|
||||
@@ -10,9 +10,9 @@ import {
|
||||
ItemFields,
|
||||
type UserDto,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import { getShowApi } from "@jellyfin/sdk/lib/utils/api/show-api";
|
||||
import { getUserViewApi } from "@jellyfin/sdk/lib/utils/api/user-view-api";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
import { ErrorBoundary } from "react-error-boundary";
|
||||
@@ -53,7 +53,7 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
|
||||
const libraries = useSuspenseQuery({
|
||||
queryKey: ["libraries"],
|
||||
queryFn: async () => {
|
||||
const libs = await getUserViewsApi(api).getUserViews({
|
||||
const libs = await getUserViewApi(api).getUserViews({
|
||||
userId: user.Id,
|
||||
});
|
||||
return libs.data;
|
||||
@@ -68,7 +68,7 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
|
||||
const resumeItemsVideo = useSuspenseQuery({
|
||||
queryKey: ["home", "resume", "video"],
|
||||
queryFn: async () => {
|
||||
const resumeItems = await getItemsApi(api).getResumeItems({
|
||||
const resumeItems = await getLibraryApi(api).getResumeItems({
|
||||
userId: user.Id,
|
||||
limit: 10,
|
||||
mediaTypes: ["Video"],
|
||||
@@ -82,7 +82,7 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
|
||||
const resumeItemsAudio = useSuspenseQuery({
|
||||
queryKey: ["home", "resume", "audio"],
|
||||
queryFn: async () => {
|
||||
const resumeItems = await getItemsApi(api).getResumeItems({
|
||||
const resumeItems = await getLibraryApi(api).getResumeItems({
|
||||
userId: user.Id,
|
||||
limit: 10,
|
||||
mediaTypes: ["Audio"],
|
||||
@@ -96,7 +96,7 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
|
||||
const upNextItems = useSuspenseQuery({
|
||||
queryKey: ["home", "upNext"],
|
||||
queryFn: async () => {
|
||||
const upNext = await getTvShowsApi(api).getNextUp({
|
||||
const upNext = await getShowApi(api).getNextUp({
|
||||
userId: user.Id,
|
||||
fields: [
|
||||
ItemFields.PrimaryImageAspectRatio,
|
||||
@@ -106,7 +106,6 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
|
||||
],
|
||||
enableResumable: false,
|
||||
enableRewatching: false,
|
||||
disableFirstEpisode: false,
|
||||
limit: 10,
|
||||
});
|
||||
return upNext.data;
|
||||
@@ -128,6 +127,15 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
|
||||
}
|
||||
}, [libraries.data?.Items?.length]);
|
||||
|
||||
const heroItems = useMemo(
|
||||
() =>
|
||||
latestMedia.data?.filter(
|
||||
(item) =>
|
||||
item.Type === BaseItemKind.Movie || item.Type === BaseItemKind.Series,
|
||||
) ?? [],
|
||||
[latestMedia.data],
|
||||
);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const setBackdrop = useBackdropStore(useShallow((s) => s.setBackdrop));
|
||||
@@ -153,16 +161,10 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
|
||||
|
||||
const handleOnChangeCarousel = useCallback(
|
||||
(now: number) => {
|
||||
if (api && latestMedia.isSuccess && (latestMedia.data?.length ?? 0) > 0) {
|
||||
const currentItem = latestMedia.data?.[now];
|
||||
if (!currentItem) return;
|
||||
|
||||
// Extract this logic to a separate function
|
||||
setBackdropForItem(currentItem);
|
||||
}
|
||||
const currentItem = heroItems[now];
|
||||
if (currentItem) setBackdropForItem(currentItem);
|
||||
},
|
||||
// Only depend on what you need
|
||||
[latestMedia.isSuccess, api, setBackdrop],
|
||||
[heroItems, setBackdropForItem],
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -174,11 +176,8 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
|
||||
}}
|
||||
>
|
||||
<ErrorBoundary FallbackComponent={ErrorNotice}>
|
||||
{latestMedia.data?.length && (
|
||||
<Carousel
|
||||
content={latestMedia.data}
|
||||
onChange={handleOnChangeCarousel}
|
||||
/>
|
||||
{heroItems.length > 0 && (
|
||||
<Carousel content={heroItems} onChange={handleOnChangeCarousel} />
|
||||
)}
|
||||
</ErrorBoundary>
|
||||
|
||||
|
||||
+63
-670
@@ -1,686 +1,79 @@
|
||||
import {
|
||||
BaseItemKind,
|
||||
MediaStreamType,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
||||
import { motion } from "motion/react";
|
||||
import React, { useLayoutEffect, useMemo, useRef, useState } from "react";
|
||||
import { Card } from "@/components/card/card";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
import ItemHeader from "@/components/itemHeader";
|
||||
|
||||
import "./item.scss";
|
||||
|
||||
import { createFileRoute, Link } from "@tanstack/react-router";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import MarkPlayedButton from "@/components/buttons/markPlayedButton";
|
||||
import PlayButton from "@/components/buttons/playButton";
|
||||
import TrailerButton from "@/components/buttons/trailerButton";
|
||||
import IconLink from "@/components/iconLink";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { useSuspenseQuery } from "@tanstack/react-query";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import React from "react";
|
||||
import BoxSetView from "@/components/itemDetail/views/boxSetView";
|
||||
import DefaultView from "@/components/itemDetail/views/defaultView";
|
||||
import PersonView from "@/components/itemDetail/views/personView";
|
||||
import SeriesView from "@/components/itemDetail/views/seriesView";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import ItemSkeleton from "@/components/skeleton/item";
|
||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import {
|
||||
getUpcomingEpisodesQueryOptions,
|
||||
prefetchItemDetail,
|
||||
} from "@/utils/queries/itemDetail";
|
||||
import { getItemQueryOptions } from "@/utils/queries/items";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
|
||||
|
||||
type ItemSearch = {
|
||||
/** Item type hint from the link, used to prefetch type-specific data in parallel. */
|
||||
type?: BaseItemKind;
|
||||
};
|
||||
|
||||
const itemKinds = new Set<string>(Object.values(BaseItemKind));
|
||||
|
||||
export const Route = createFileRoute("/_api/item/$id")({
|
||||
component: ItemDetail,
|
||||
pendingComponent: () => <ItemSkeleton />,
|
||||
// pendingMs: 5000,
|
||||
loader: async ({ context: { queryClient, api, user }, params }) => {
|
||||
if (!api || !user?.Id) return null;
|
||||
validateSearch: (search: Record<string, unknown>): ItemSearch => ({
|
||||
type:
|
||||
typeof search.type === "string" && itemKinds.has(search.type)
|
||||
? (search.type as BaseItemKind)
|
||||
: undefined,
|
||||
}),
|
||||
loaderDeps: ({ search }) => ({ type: search.type }),
|
||||
loader: async ({
|
||||
context: { queryClient, api, user },
|
||||
params,
|
||||
deps: { type },
|
||||
}) => {
|
||||
if (!api || !user?.Id) return;
|
||||
const itemPromise = queryClient.ensureQueryData(
|
||||
getItemQueryOptions(params.id, api, user?.Id),
|
||||
getItemQueryOptions(params.id, api, user.Id),
|
||||
);
|
||||
queryClient.prefetchQuery({
|
||||
queryKey: ["item", params.id, "similarItem"],
|
||||
queryFn: async () =>
|
||||
(
|
||||
await getLibraryApi(api).getSimilarItems({
|
||||
userId: user?.Id,
|
||||
itemId: params.id,
|
||||
limit: 16,
|
||||
})
|
||||
).data,
|
||||
});
|
||||
await itemPromise;
|
||||
if (type) {
|
||||
prefetchItemDetail(queryClient, api, user.Id, params.id, type);
|
||||
}
|
||||
const item = await itemPromise;
|
||||
if (item.Type !== type) {
|
||||
// No (or wrong) hint, e.g. a deep link: prefetch now that the type is known.
|
||||
prefetchItemDetail(queryClient, api, user.Id, params.id, item.Type);
|
||||
}
|
||||
if (item.Type === BaseItemKind.Episode) {
|
||||
queryClient.prefetchQuery(
|
||||
getUpcomingEpisodesQueryOptions(api, user.Id, item),
|
||||
);
|
||||
}
|
||||
},
|
||||
component: ItemPage,
|
||||
pendingComponent: () => <ItemSkeleton />,
|
||||
errorComponent: () => <ErrorNotice />,
|
||||
});
|
||||
|
||||
function ItemDetail() {
|
||||
function ItemPage() {
|
||||
const { id } = Route.useParams();
|
||||
|
||||
const api = Route.useRouteContext().api;
|
||||
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const { data: item } = useSuspenseQuery(
|
||||
getItemQueryOptions(id, api, user?.Id),
|
||||
);
|
||||
|
||||
const item = useSuspenseQuery(getItemQueryOptions(id, api, user?.Id));
|
||||
|
||||
const similarItems = useQuery({
|
||||
queryKey: ["item", id, "similarItem"],
|
||||
queryFn: async () => {
|
||||
if (!api || !user?.Id) return null;
|
||||
return (
|
||||
await getLibraryApi(api).getSimilarItems({
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
limit: 16,
|
||||
})
|
||||
).data;
|
||||
},
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
|
||||
const [selectedVideoTrack, setSelectedVideoTrack] = useState(0);
|
||||
const [selectedAudioTrack, setSelectedAudioTrack] = useState(0);
|
||||
const [selectedSubtitleTrack, setSelectedSubtitleTrack] = useState(0);
|
||||
|
||||
const videoTracks = useMemo(() => {
|
||||
const result = item.data?.MediaStreams?.filter((source) => {
|
||||
if (source.Type === MediaStreamType.Video) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
setSelectedVideoTrack(
|
||||
result?.find((track) => track.IsDefault)?.Index ??
|
||||
result?.[0]?.Index ??
|
||||
0,
|
||||
);
|
||||
return result ?? [];
|
||||
}, [item.data?.Id]);
|
||||
const audioTracks = useMemo(() => {
|
||||
const result = item.data?.MediaStreams?.filter((source) => {
|
||||
if (source.Type === MediaStreamType.Audio) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
setSelectedAudioTrack(item.data.MediaSources?.[0].DefaultAudioStreamIndex ?? 0);
|
||||
return result ?? [];
|
||||
}, [item.data?.Id]);
|
||||
const subtitleTracks = useMemo(() => {
|
||||
const result = item.data.MediaStreams?.filter((source) => {
|
||||
if (source.Type === MediaStreamType.Subtitle) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
setSelectedSubtitleTrack(
|
||||
item.data.MediaSources?.[0].DefaultSubtitleStreamIndex ?? -1,
|
||||
);
|
||||
return result ?? [];
|
||||
}, [item.data?.Id]);
|
||||
|
||||
const directors = useMemo(() => {
|
||||
return item.data?.People?.filter((itm) => itm.Type === "Director") ?? [];
|
||||
}, [item.data?.Id]);
|
||||
const writers = useMemo(() => {
|
||||
return item.data?.People?.filter((itm) => itm.Type === "Writer") ?? [];
|
||||
}, [item.data?.Id]);
|
||||
const actors = useMemo(() => {
|
||||
return item.data?.People?.filter((itm) => itm.Type === "Actor") ?? [];
|
||||
}, [item.data?.Id]);
|
||||
const producers = useMemo(() => {
|
||||
return item.data?.People?.filter((itm) => itm.Type === "Producer") ?? [];
|
||||
}, [item.data?.Id]);
|
||||
|
||||
const mediaQualityInfo = useMemo<MediaQualityInfo>(() => {
|
||||
const checkAtmos = audioTracks.filter((audio) =>
|
||||
audio.DisplayTitle?.toLocaleLowerCase().includes("atmos"),
|
||||
);
|
||||
const checkDolbyVision = videoTracks.filter(
|
||||
(video) =>
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("dv") ||
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("dolby vision") ||
|
||||
!!video.VideoDoViTitle ||
|
||||
video.VideoRangeType === "DOVI",
|
||||
);
|
||||
const checkDD = audioTracks.filter(
|
||||
(audio) =>
|
||||
(audio.DisplayTitle?.toLocaleLowerCase().includes("dd") &&
|
||||
!audio.DisplayTitle?.toLocaleLowerCase().includes("ddp")) ||
|
||||
(audio.DisplayTitle?.toLocaleLowerCase().includes("dolby digital") &&
|
||||
!audio.DisplayTitle?.toLocaleLowerCase().includes("dolby digital+")),
|
||||
);
|
||||
const checkDDP = audioTracks.filter(
|
||||
(audio) =>
|
||||
audio.DisplayTitle?.toLocaleLowerCase().includes("ddp") ||
|
||||
audio.DisplayTitle?.toLocaleLowerCase().includes("dolby digital+"),
|
||||
);
|
||||
const checkDts = audioTracks.filter(
|
||||
(audio) =>
|
||||
audio.DisplayTitle?.toLocaleLowerCase().includes("dts") &&
|
||||
!audio.DisplayTitle?.toLocaleLowerCase().includes("dts-hd ma") &&
|
||||
!audio.DisplayTitle?.toLocaleLowerCase().includes("dts-hd.ma"),
|
||||
);
|
||||
const checkDtsHDMA = audioTracks.filter(
|
||||
(audio) =>
|
||||
audio.DisplayTitle?.toLocaleLowerCase().includes("dts-hd ma") ||
|
||||
audio.DisplayTitle?.toLocaleLowerCase().includes("dts-hd.ma"),
|
||||
);
|
||||
const checkUHD = videoTracks.filter(
|
||||
(video) =>
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("4k") ||
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("2160p") ||
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("uhd"),
|
||||
);
|
||||
const checkHD = videoTracks.filter(
|
||||
(video) =>
|
||||
(video.DisplayTitle?.toLocaleLowerCase().includes("hd") &&
|
||||
!video.DisplayTitle?.toLocaleLowerCase().includes("hdr")) ||
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("1080p") ||
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("fhd"),
|
||||
);
|
||||
const checkSD = videoTracks.filter(
|
||||
(video) =>
|
||||
(video.DisplayTitle?.toLocaleLowerCase().includes("sd") &&
|
||||
!video.DisplayTitle?.toLocaleLowerCase().includes("sdr")) ||
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("720p"),
|
||||
);
|
||||
const checkSDR = videoTracks.filter(
|
||||
(video) => video.VideoRangeType === "SDR",
|
||||
);
|
||||
const checkHDR = videoTracks.filter(
|
||||
(video) =>
|
||||
video.VideoRange === "HDR" ||
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("dv"),
|
||||
);
|
||||
const checkHDR10 = videoTracks.filter(
|
||||
(video) =>
|
||||
video.VideoRangeType === "HDR10" &&
|
||||
!video.DisplayTitle?.toLocaleLowerCase().includes("hdr10+"),
|
||||
);
|
||||
const checkHDR10Plus = videoTracks.filter(
|
||||
(video) =>
|
||||
video.VideoRangeType === "HDR10Plus" ||
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("hdr10+"),
|
||||
);
|
||||
const checkTrueHD = audioTracks.filter((audio) =>
|
||||
audio.DisplayTitle?.toLocaleLowerCase().includes("truehd"),
|
||||
);
|
||||
const checkIMAX = videoTracks.filter((video) =>
|
||||
video.DisplayTitle?.toLocaleLowerCase().includes("imax"),
|
||||
);
|
||||
return {
|
||||
isAtmos: checkAtmos.length > 0,
|
||||
isDolbyVision: checkDolbyVision.length > 0,
|
||||
isDts: checkDts.length > 0,
|
||||
isDtsHDMA: checkDtsHDMA.length > 0,
|
||||
isDD: checkDD.length > 0,
|
||||
isDDP: checkDDP.length > 0,
|
||||
isUHD: checkUHD.length > 0,
|
||||
isHD: checkHD.length > 0,
|
||||
isSD: checkSD.length > 0,
|
||||
isSDR: checkSDR.length > 0,
|
||||
isHDR: checkHDR.length > 0,
|
||||
isHDR10: checkHDR10.length > 0,
|
||||
isHDR10Plus: checkHDR10Plus.length > 0,
|
||||
isTrueHD: checkTrueHD.length > 0,
|
||||
isIMAX: checkIMAX.length > 0,
|
||||
};
|
||||
}, [item.data?.Id]);
|
||||
|
||||
const setBackdrop = useBackdropStore(useShallow((state) => state.setBackdrop));
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (api && item.data) {
|
||||
if (item.data?.BackdropImageTags?.length) {
|
||||
setBackdrop(
|
||||
item.data.ImageBlurHashes?.Backdrop?.[
|
||||
item.data.BackdropImageTags?.[0]
|
||||
],
|
||||
);
|
||||
} else {
|
||||
setBackdrop("");
|
||||
switch (item.Type) {
|
||||
case BaseItemKind.Series:
|
||||
return <SeriesView key={id} item={item} />;
|
||||
case BaseItemKind.BoxSet:
|
||||
return <BoxSetView key={id} item={item} />;
|
||||
case BaseItemKind.Person:
|
||||
return <PersonView key={id} item={item} />;
|
||||
default:
|
||||
return <DefaultView key={id} item={item} />;
|
||||
}
|
||||
}
|
||||
}, [item.data.Id]);
|
||||
|
||||
// Provide a scroll target ref to the backdrop component.
|
||||
const scrollTargetRef = useRef<HTMLDivElement | null>(null);
|
||||
|
||||
return (
|
||||
<motion.div
|
||||
key={id}
|
||||
initial={{
|
||||
opacity: 0,
|
||||
}}
|
||||
animate={{
|
||||
opacity: 1,
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.35,
|
||||
ease: "easeInOut",
|
||||
}}
|
||||
className="scrollY padded-top flex flex-column item item-default"
|
||||
ref={scrollTargetRef}
|
||||
>
|
||||
<ItemHeader
|
||||
item={item.data}
|
||||
api={api}
|
||||
mediaQualityInfo={mediaQualityInfo}
|
||||
scrollTargetRef={scrollTargetRef}
|
||||
>
|
||||
<div className="item-hero-buttons-container">
|
||||
<div
|
||||
className="flex flex-row"
|
||||
style={{
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
<PlayButton
|
||||
item={item.data}
|
||||
itemType={item.data.Type ?? "Movie"}
|
||||
audio={item.data.Type === "Audio"}
|
||||
currentVideoTrack={selectedVideoTrack}
|
||||
currentAudioTrack={selectedAudioTrack}
|
||||
currentSubTrack={selectedSubtitleTrack}
|
||||
userId={user?.Id}
|
||||
buttonProps={{
|
||||
fullWidth: true,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-row" style={{ gap: "1em" }}>
|
||||
{item.data.RemoteTrailers && (
|
||||
<TrailerButton
|
||||
trailerItem={item.data.RemoteTrailers}
|
||||
disabled={item.data.RemoteTrailers?.length === 0}
|
||||
/>
|
||||
)}
|
||||
<LikeButton
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isFavorite={item.data.UserData?.IsFavorite}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
<MarkPlayedButton
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isPlayed={item.data.UserData?.Played}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</ItemHeader>
|
||||
<div className="item-detail">
|
||||
<div style={{ width: "100%" }}>
|
||||
{(item.data.Taglines?.length ?? 0) > 0 && (
|
||||
<Typography variant="h5" mb={2} fontWeight={300}>
|
||||
{item.data.Taglines?.[0]}
|
||||
</Typography>
|
||||
)}
|
||||
<ShowMoreText
|
||||
content={item.data.Overview ?? ""}
|
||||
collapsedLines={4}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
{videoTracks.length > 0 && (
|
||||
<TextField
|
||||
label="Video"
|
||||
select
|
||||
style={{
|
||||
width: "100%",
|
||||
marginBottom: "1em",
|
||||
}}
|
||||
value={selectedVideoTrack}
|
||||
variant="filled"
|
||||
onChange={(e) => setSelectedVideoTrack(Number(e.target.value))}
|
||||
>
|
||||
{videoTracks.map((track) => (
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
{track.DisplayTitle}
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
)}
|
||||
{audioTracks.length > 0 && (
|
||||
<TextField
|
||||
label="Audio"
|
||||
select
|
||||
style={{
|
||||
width: "100%",
|
||||
marginBottom: "1em",
|
||||
}}
|
||||
value={selectedAudioTrack}
|
||||
variant="filled"
|
||||
onChange={(e) => setSelectedAudioTrack(Number(e.target.value))}
|
||||
>
|
||||
{audioTracks.map((track) => (
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
{track.DisplayTitle}
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
)}
|
||||
{subtitleTracks.length > 0 && (
|
||||
<TextField
|
||||
label="Subtitle"
|
||||
select
|
||||
style={{
|
||||
width: "100%",
|
||||
}}
|
||||
value={selectedSubtitleTrack}
|
||||
variant="filled"
|
||||
SelectProps={{
|
||||
MenuProps: {
|
||||
disablePortal: true,
|
||||
},
|
||||
}}
|
||||
onChange={(e) =>
|
||||
setSelectedSubtitleTrack(Number(e.target.value))
|
||||
}
|
||||
>
|
||||
<MenuItem key={-1} value={-1}>
|
||||
No Subtitle
|
||||
</MenuItem>
|
||||
{subtitleTracks.map((track) => (
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
{track.DisplayTitle}
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
)}
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: "0.6em",
|
||||
alignSelf: "end",
|
||||
marginTop: "1em",
|
||||
}}
|
||||
>
|
||||
{item.data.ExternalUrls?.map(
|
||||
(url) =>
|
||||
url.Url &&
|
||||
url.Name && (
|
||||
<IconLink key={url.Name} url={url.Url} name={url.Name} />
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{(item.data.People?.length ?? 0) > 0 && (
|
||||
<div className="item-detail-cast">
|
||||
<Typography variant="h5" mb={2}>
|
||||
Cast & Crew
|
||||
</Typography>
|
||||
{actors.length > 0 && (
|
||||
<div className="item-detail-cast-container">
|
||||
<Typography variant="h6">Actors</Typography>
|
||||
<div className="item-detail-cast-grid">
|
||||
{actors.map((actor) => (
|
||||
<Link
|
||||
className="item-detail-cast-card"
|
||||
key={actor.Id}
|
||||
to="/person/$id"
|
||||
params={{
|
||||
id: actor.Id ?? "",
|
||||
}}
|
||||
>
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)
|
||||
}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
<div className="item-detail-cast-card-icon">
|
||||
{getTypeIcon("Person")}
|
||||
</div>
|
||||
)}
|
||||
<div className="item-detail-cast-card-text">
|
||||
<Typography variant="subtitle1">
|
||||
{actor.Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
opacity: 0.5,
|
||||
}}
|
||||
>
|
||||
{actor.Role}
|
||||
</Typography>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{writers.length > 0 && (
|
||||
<div className="item-detail-cast-container">
|
||||
<Typography variant="h6">Writers</Typography>
|
||||
<div className="item-detail-cast-grid">
|
||||
{writers.map((actor) => (
|
||||
<Link
|
||||
className="item-detail-cast-card"
|
||||
key={actor.Id}
|
||||
to="/person/$id"
|
||||
params={{
|
||||
id: actor.Id ?? "",
|
||||
}}
|
||||
>
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)
|
||||
}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
<div className="item-detail-cast-card-icon">
|
||||
{getTypeIcon("Person")}
|
||||
</div>
|
||||
)}
|
||||
<div className="item-detail-cast-card-text">
|
||||
<Typography variant="subtitle1">
|
||||
{actor.Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
opacity: 0.5,
|
||||
}}
|
||||
>
|
||||
{actor.Role}
|
||||
</Typography>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{directors.length > 0 && (
|
||||
<div className="item-detail-cast-container">
|
||||
<Typography variant="h6">Directors</Typography>
|
||||
<div className="item-detail-cast-grid">
|
||||
{directors.map((actor) => (
|
||||
<Link
|
||||
className="item-detail-cast-card"
|
||||
to="/person/$id"
|
||||
key={actor.Id}
|
||||
params={{
|
||||
id: actor.Id ?? "",
|
||||
}}
|
||||
>
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)
|
||||
}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
<div className="item-detail-cast-card-icon">
|
||||
{getTypeIcon("Person")}
|
||||
</div>
|
||||
)}
|
||||
<div className="item-detail-cast-card-text">
|
||||
<Typography variant="subtitle1">
|
||||
{actor.Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
opacity: 0.5,
|
||||
}}
|
||||
>
|
||||
{actor.Role}
|
||||
</Typography>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{producers.length > 0 && (
|
||||
<div className="item-detail-cast-container">
|
||||
<Typography variant="h6">Producers</Typography>
|
||||
<div className="item-detail-cast-grid">
|
||||
{producers.map((actor) => (
|
||||
<Link
|
||||
className="item-detail-cast-card"
|
||||
key={actor.Id}
|
||||
to="/person/$id"
|
||||
params={{
|
||||
id: actor.Id ?? "",
|
||||
}}
|
||||
>
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)
|
||||
}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
<div className="item-detail-cast-card-icon">
|
||||
{getTypeIcon("Person")}
|
||||
</div>
|
||||
)}
|
||||
<div className="item-detail-cast-card-text">
|
||||
<Typography variant="subtitle1">
|
||||
{actor.Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
opacity: 0.5,
|
||||
}}
|
||||
>
|
||||
{actor.Role}
|
||||
</Typography>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{(similarItems.data?.TotalRecordCount ?? 0) > 0 && (
|
||||
<CardScroller
|
||||
title="You might also like"
|
||||
displayCards={7}
|
||||
disableDecoration
|
||||
>
|
||||
{similarItems.data?.Items?.map((similar) => {
|
||||
return (
|
||||
<Card
|
||||
key={similar.Id}
|
||||
item={similar}
|
||||
seriesId={similar.SeriesId}
|
||||
cardTitle={
|
||||
similar.Type === BaseItemKind.Episode
|
||||
? similar.SeriesName
|
||||
: similar.Name
|
||||
}
|
||||
imageType={"Primary"}
|
||||
cardCaption={
|
||||
similar.Type === BaseItemKind.Episode
|
||||
? `S${similar.ParentIndexNumber}:E${similar.IndexNumber} - ${similar.Name}`
|
||||
: similar.Type === BaseItemKind.Series
|
||||
? `${similar.ProductionYear} - ${
|
||||
similar.EndDate
|
||||
? new Date(similar.EndDate).toLocaleString([], {
|
||||
year: "numeric",
|
||||
})
|
||||
: "Present"
|
||||
}`
|
||||
: similar.ProductionYear
|
||||
}
|
||||
cardType={
|
||||
similar.Type === BaseItemKind.MusicAlbum ||
|
||||
similar.Type === BaseItemKind.Audio
|
||||
? "square"
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ItemDetail;
|
||||
@@ -1,103 +0,0 @@
|
||||
$cardWidth: 18%;
|
||||
|
||||
.item-default.item {
|
||||
|
||||
.item-detail {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 35%;
|
||||
justify-items: center;
|
||||
align-items: start;
|
||||
gap: 3em;
|
||||
|
||||
&-cast {
|
||||
&-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
}
|
||||
&-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
gap: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
&-card {
|
||||
display: grid;
|
||||
grid-template-columns: 6em 1fr;
|
||||
gap: 0.5em;
|
||||
align-items: center;
|
||||
color: white !important;
|
||||
text-decoration: none;
|
||||
padding: 0.5em;
|
||||
background: rgb(255 255 255 / 0);
|
||||
transition: background $transition-time-default;
|
||||
border-radius: $border-radius-default;
|
||||
&:hover {
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
}
|
||||
&-image,
|
||||
&-icon {
|
||||
width: 6em;
|
||||
height: 6em;
|
||||
object-fit: cover;
|
||||
border-radius: 100%;
|
||||
box-shadow: $shadow-card-image;
|
||||
}
|
||||
&-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1em;
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
.material-symbols-rounded {
|
||||
font-size: 3em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&-link {
|
||||
color: white;
|
||||
text-decoration-color: rgb(255 255 255 / 0.5);
|
||||
&:hover {
|
||||
text-decoration-color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Global item-detail
|
||||
.item-detail-link{
|
||||
margin-top: 0.85em !important;
|
||||
&:hover > img{
|
||||
filter: brightness(1);
|
||||
}
|
||||
& > img {
|
||||
width: 2em;
|
||||
aspect-ratio: 1;
|
||||
filter: brightness(0.5);
|
||||
transition: filter $transition-time-default;
|
||||
}
|
||||
}
|
||||
|
||||
.item {
|
||||
gap: 1.5em;
|
||||
&-hero{
|
||||
// margin-bottom: 1em;
|
||||
&-image{
|
||||
box-sizing: border-box;
|
||||
&-container{
|
||||
box-sizing: content-box;
|
||||
box-shadow: 0px 10px 20px -10px rgb(0 0 0 / 0.5) !important;
|
||||
}
|
||||
}
|
||||
&-mediaInfo{
|
||||
margin-top: 1em;
|
||||
height: 1.1em;
|
||||
opacity: 0.8;
|
||||
&.badge{
|
||||
margin: 0;
|
||||
height: 1.2em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,108 +1,57 @@
|
||||
import LoadingButton from "@mui/lab/LoadingButton";
|
||||
import { Paper, TextField, Typography } from "@mui/material";
|
||||
import Button from "@mui/material/Button";
|
||||
import Checkbox from "@mui/material/Checkbox";
|
||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import InputAdornment from "@mui/material/InputAdornment";
|
||||
|
||||
import { useSnackbar } from "notistack";
|
||||
|
||||
import { AvatarImage } from "@/components/avatar/avatar.jsx";
|
||||
import "./login.scss";
|
||||
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import {
|
||||
createFileRoute,
|
||||
Link,
|
||||
useNavigate,
|
||||
useRouter,
|
||||
} from "@tanstack/react-router";
|
||||
import React, {
|
||||
type ChangeEvent,
|
||||
type FormEvent,
|
||||
useEffect,
|
||||
useState,
|
||||
} from "react";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
import React, { type FormEvent, useState } from "react";
|
||||
import LoginShell from "@/components/loginShell";
|
||||
import {
|
||||
getPublicUsersQueryOptions,
|
||||
isPasswordProtected,
|
||||
ProfileAvatar,
|
||||
} from "@/components/loginShell/profileAvatar";
|
||||
import { saveUser } from "@/utils/storage/user";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop.js";
|
||||
|
||||
export const Route = createFileRoute("/_api/login/$userId/$userName")({
|
||||
component: LoginUser,
|
||||
});
|
||||
|
||||
type PasswordState = {
|
||||
showpass: boolean;
|
||||
password: string | undefined;
|
||||
};
|
||||
|
||||
function LoginUser() {
|
||||
const { userName, userId } = Route.useParams();
|
||||
|
||||
const router = useRouter();
|
||||
const navigate = useNavigate({ from: "/login/$userId/$userName" });
|
||||
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const createApi = useApiInContext((s) => s.createApi);
|
||||
|
||||
const [password, setPassword] = useState<PasswordState>({
|
||||
showpass: false,
|
||||
password: undefined,
|
||||
});
|
||||
const [password, setPassword] = useState("");
|
||||
const [showPassword, setShowPassword] = useState(false);
|
||||
const [rememberMe, setRememberMe] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const navigate = useNavigate({ from: "/login/$userId/$userName" });
|
||||
// Profile details (image, whether a password is needed) from the public user list
|
||||
const users = useQuery(getPublicUsersQueryOptions(api));
|
||||
const user = users.data?.find((u) => u.Id === userId);
|
||||
const needsPassword = isPasswordProtected(user);
|
||||
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
const handlePassword =
|
||||
(prop: "password" | "showPassord") =>
|
||||
(event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
||||
setPassword({
|
||||
...password,
|
||||
[prop]: event.target.value,
|
||||
});
|
||||
};
|
||||
|
||||
const handleShowPassword = () => {
|
||||
setPassword({
|
||||
...password,
|
||||
showpass: !password.showpass,
|
||||
});
|
||||
};
|
||||
|
||||
const setBackdrop = useBackdropStore(
|
||||
useShallow((state) => state.setBackdrop),
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!api) {
|
||||
return;
|
||||
}
|
||||
setBackdrop("");
|
||||
}, []);
|
||||
|
||||
const handleCheckRememberMe = (
|
||||
_: ChangeEvent<HTMLInputElement>,
|
||||
checked: boolean,
|
||||
) => {
|
||||
setRememberMe(checked);
|
||||
};
|
||||
|
||||
const handleLoginFn = async (event: FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
try {
|
||||
if (!api) {
|
||||
throw new Error("API not initialized");
|
||||
}
|
||||
const authenticate = await api.authenticateUserByName(
|
||||
userName,
|
||||
password.password,
|
||||
);
|
||||
const handleLogin = useMutation({
|
||||
mutationKey: ["login", "authenticate"],
|
||||
mutationFn: async () => {
|
||||
if (!api) throw new Error("API not initialized");
|
||||
const authenticate = await api.authenticateUserByName(userName, password);
|
||||
if (!authenticate.data.AccessToken) {
|
||||
throw new Error("No access token received");
|
||||
}
|
||||
createApi(api.basePath, authenticate.data?.AccessToken);
|
||||
|
||||
createApi(api.basePath, authenticate.data.AccessToken);
|
||||
if (authenticate.data.SessionInfo?.UserId && rememberMe) {
|
||||
await saveUser(
|
||||
userName,
|
||||
@@ -110,150 +59,118 @@ function LoginUser() {
|
||||
authenticate.data.SessionInfo.UserId,
|
||||
);
|
||||
}
|
||||
|
||||
},
|
||||
onSuccess: () => {
|
||||
router.invalidate().finally(() => {
|
||||
navigate({ to: "/home", replace: true });
|
||||
});
|
||||
} catch (err) {
|
||||
},
|
||||
onError: (err) => {
|
||||
console.error(err);
|
||||
enqueueSnackbar("Unable to authenticate! Please check your password", {
|
||||
variant: "error",
|
||||
setError(
|
||||
needsPassword
|
||||
? "Incorrect password. Please try again."
|
||||
: "Couldn't sign in. Please try again.",
|
||||
);
|
||||
setPassword("");
|
||||
},
|
||||
});
|
||||
}
|
||||
return;
|
||||
|
||||
const handleSubmit = (event: FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
setError(null);
|
||||
handleLogin.mutate();
|
||||
};
|
||||
|
||||
const handleLogin = useMutation({
|
||||
mutationKey: ["login", "authenticate"],
|
||||
mutationFn: handleLoginFn,
|
||||
});
|
||||
|
||||
return (
|
||||
<div
|
||||
className="login flex flex-center flex-column centered"
|
||||
style={{ marginTop: 0 }}
|
||||
<LoginShell
|
||||
title={`Welcome back, ${userName}`}
|
||||
subtitle={
|
||||
needsPassword
|
||||
? "Enter your password to continue"
|
||||
: "This profile doesn't need a password"
|
||||
}
|
||||
footer={
|
||||
<Link to="/login/list" className="login-link">
|
||||
<span className="material-symbols-rounded">switch_account</span>
|
||||
Not you? Switch user
|
||||
</Link>
|
||||
}
|
||||
>
|
||||
<Paper
|
||||
sx={{
|
||||
p: 4,
|
||||
width: "100%",
|
||||
maxWidth: "600px",
|
||||
backgroundColor: "rgba(20, 20, 30, 0.7)",
|
||||
backdropFilter: "blur(24px) saturate(180%)",
|
||||
backgroundImage:
|
||||
"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0))",
|
||||
border: "1px solid rgba(255, 255, 255, 0.08)",
|
||||
boxShadow: "0 20px 50px rgba(0,0,0,0.5)",
|
||||
borderRadius: 4,
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
marginBottom: "2em",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
gap: "1em",
|
||||
}}
|
||||
>
|
||||
<AvatarImage userId={userId} />
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Typography variant="body1" sx={{ opacity: 0.7 }}>
|
||||
Login as
|
||||
</Typography>
|
||||
<Typography variant="h5" fontWeight={700} className="gradient-text">
|
||||
{userName}
|
||||
</Typography>
|
||||
</div>
|
||||
<form className="login-form" onSubmit={handleSubmit}>
|
||||
<div className="login-form-avatar">
|
||||
<ProfileAvatar
|
||||
userId={userId}
|
||||
name={userName}
|
||||
imageTag={user?.PrimaryImageTag}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<form
|
||||
onSubmit={(e) => handleLogin.mutate(e)}
|
||||
style={{
|
||||
width: "100%",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: "1.5rem",
|
||||
}}
|
||||
>
|
||||
{needsPassword && (
|
||||
<TextField
|
||||
fullWidth
|
||||
type={password.showpass ? "text" : "password"}
|
||||
onChange={handlePassword("password")}
|
||||
autoFocus
|
||||
label="Password"
|
||||
variant="outlined"
|
||||
autoFocus
|
||||
InputProps={{
|
||||
startAdornment: (
|
||||
<InputAdornment position="start">
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{ opacity: 0.5 }}
|
||||
>
|
||||
key
|
||||
</span>
|
||||
</InputAdornment>
|
||||
),
|
||||
type={showPassword ? "text" : "password"}
|
||||
autoComplete="current-password"
|
||||
value={password}
|
||||
onChange={(e) => {
|
||||
setPassword(e.target.value);
|
||||
setError(null);
|
||||
}}
|
||||
error={Boolean(error)}
|
||||
helperText={error}
|
||||
slotProps={{
|
||||
input: {
|
||||
endAdornment: (
|
||||
<InputAdornment position="end">
|
||||
<IconButton onClick={handleShowPassword} edge="end">
|
||||
{password.showpass ? (
|
||||
<IconButton
|
||||
onClick={() => setShowPassword((show) => !show)}
|
||||
edge="end"
|
||||
aria-label={
|
||||
showPassword ? "Hide password" : "Show password"
|
||||
}
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
visibility
|
||||
{showPassword ? "visibility_off" : "visibility"}
|
||||
</span>
|
||||
) : (
|
||||
<span className="material-symbols-rounded">
|
||||
visibility_off
|
||||
</span>
|
||||
)}
|
||||
</IconButton>
|
||||
</InputAdornment>
|
||||
),
|
||||
},
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!needsPassword && error && (
|
||||
<p className="login-shell-subtitle" role="alert">
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<div className="login-form-options">
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
checked={rememberMe}
|
||||
onChange={handleCheckRememberMe}
|
||||
onChange={(_, checked) => setRememberMe(checked)}
|
||||
/>
|
||||
}
|
||||
label="Remember me"
|
||||
sx={{ m: 0 }}
|
||||
label="Keep me signed in"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<LoadingButton
|
||||
<Button
|
||||
className="login-form-submit"
|
||||
variant="contained"
|
||||
endIcon={<span className="material-symbols-rounded">login</span>}
|
||||
type="submit"
|
||||
loading={handleLogin.isPending}
|
||||
loadingPosition="end"
|
||||
size="large"
|
||||
fullWidth
|
||||
sx={{ borderRadius: 2, height: 48 }}
|
||||
loading={handleLogin.isPending || handleLogin.isSuccess}
|
||||
>
|
||||
Login
|
||||
</LoadingButton>
|
||||
Sign in
|
||||
</Button>
|
||||
</form>
|
||||
</Paper>
|
||||
</div>
|
||||
</LoginShell>
|
||||
);
|
||||
}
|
||||
+60
-172
@@ -1,188 +1,76 @@
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { Box, Chip, Typography } from "@mui/material";
|
||||
import Skeleton from "@mui/material/Skeleton";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import React, { useEffect } from "react";
|
||||
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice.jsx";
|
||||
import "./login.scss";
|
||||
|
||||
import type { UserDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { Paper } from "@mui/material";
|
||||
import { createFileRoute, Link } from "@tanstack/react-router";
|
||||
import React from "react";
|
||||
import LoginShell from "@/components/loginShell";
|
||||
import {
|
||||
getPublicUsersQueryOptions,
|
||||
isPasswordProtected,
|
||||
ProfileAvatar,
|
||||
} from "@/components/loginShell/profileAvatar";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop.js";
|
||||
import avatar from "../../../assets/icons/avatar.png";
|
||||
|
||||
export const Route = createFileRoute("/_api/login/list")({
|
||||
component: LoginPublicUsersList,
|
||||
});
|
||||
|
||||
const UserCard = ({ user }: { user: UserDto }) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
return (
|
||||
<Link
|
||||
to="/login/$userId/$userName"
|
||||
params={{ userId: user.Id ?? "", userName: user.Name ?? "" }}
|
||||
className="user-list-item user-card"
|
||||
style={{ textDecoration: "none", display: "block" }}
|
||||
>
|
||||
<Paper
|
||||
elevation={0}
|
||||
sx={{
|
||||
p: 2,
|
||||
bgcolor: "rgba(255,255,255,0.03)",
|
||||
"&:hover": {
|
||||
bgcolor: "rgba(255,255,255,0.1)",
|
||||
transform: "translateY(-4px)",
|
||||
boxShadow: "0 8px 20px rgba(0,0,0,0.3)",
|
||||
},
|
||||
transition: "all 0.3s ease",
|
||||
borderRadius: 4,
|
||||
border: "1px solid rgba(255,255,255,0.05)",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
width: "160px",
|
||||
height: "100%",
|
||||
cursor: "pointer",
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="user-card-image-container"
|
||||
style={{
|
||||
width: "100px",
|
||||
height: "100px",
|
||||
borderRadius: "50%",
|
||||
overflow: "hidden",
|
||||
boxShadow: "0 8px 16px rgba(0,0,0,0.3)",
|
||||
}}
|
||||
>
|
||||
{user.PrimaryImageTag ? (
|
||||
<img
|
||||
className="user-card-image"
|
||||
alt={"user"}
|
||||
src={`${api?.basePath}/Users/${user.Id}/Images/Primary?quality=80&tag=${user.PrimaryImageTag}`}
|
||||
style={{ width: "100%", height: "100%", objectFit: "cover" }}
|
||||
/>
|
||||
) : (
|
||||
<img
|
||||
className="user-card-image"
|
||||
alt="user"
|
||||
src={avatar}
|
||||
style={{ width: "100%", height: "100%", objectFit: "cover" }}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<Typography
|
||||
mt={2}
|
||||
align="center"
|
||||
variant="subtitle1"
|
||||
fontWeight="bold"
|
||||
noWrap
|
||||
sx={{ width: "100%", color: "text.primary" }}
|
||||
>
|
||||
{user.Name}
|
||||
</Typography>
|
||||
</Paper>
|
||||
</Link>
|
||||
);
|
||||
};
|
||||
|
||||
function LoginPublicUsersList() {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const users = useQuery(getPublicUsersQueryOptions(api));
|
||||
|
||||
const users = useQuery({
|
||||
queryKey: ["login", "public-users"],
|
||||
queryFn: async () => {
|
||||
if (!api) return [];
|
||||
const result = await getUserApi(api).getPublicUsers();
|
||||
return result.data;
|
||||
},
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
|
||||
const setBackdrop = useBackdropStore((state) => state.setBackdrop);
|
||||
useEffect(() => {
|
||||
setBackdrop("");
|
||||
}, []);
|
||||
|
||||
if (users.isSuccess) {
|
||||
return (
|
||||
<div className="login-container scrollY flex flex-column flex-center">
|
||||
<Paper
|
||||
sx={{
|
||||
p: 4,
|
||||
maxWidth: "800px",
|
||||
width: "90%",
|
||||
backgroundColor: "rgba(20, 20, 30, 0.7)",
|
||||
backdropFilter: "blur(24px) saturate(180%)",
|
||||
backgroundImage:
|
||||
"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0))",
|
||||
border: "1px solid rgba(255, 255, 255, 0.08)",
|
||||
boxShadow: "0 20px 50px rgba(0,0,0,0.5)",
|
||||
borderRadius: 4,
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
gap: 3,
|
||||
}}
|
||||
<LoginShell
|
||||
width="wide"
|
||||
title="Who's watching?"
|
||||
subtitle="Choose your profile to sign in"
|
||||
>
|
||||
<Typography variant="h4" align="center" fontWeight="bold">
|
||||
Select User
|
||||
</Typography>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexWrap: "wrap",
|
||||
gap: 3,
|
||||
justifyContent: "center",
|
||||
width: "100%",
|
||||
maxHeight: "60vh",
|
||||
overflowY: "auto",
|
||||
py: 2,
|
||||
"&::-webkit-scrollbar": { display: "none" },
|
||||
scrollbarWidth: "none",
|
||||
}}
|
||||
>
|
||||
{users.data.map((item) => {
|
||||
return <UserCard user={item} key={item.Id} />;
|
||||
})}
|
||||
</Box>
|
||||
|
||||
<Chip
|
||||
label={
|
||||
<Typography variant="body2" align="center">
|
||||
Don't see your user? Try using{" "}
|
||||
<Link
|
||||
to="/login/manual"
|
||||
style={{ color: "inherit", fontWeight: "bold" }}
|
||||
>
|
||||
Manual Login
|
||||
</Link>{" "}
|
||||
or{" "}
|
||||
<Link
|
||||
to="/setup/server/list"
|
||||
style={{ color: "inherit", fontWeight: "bold" }}
|
||||
>
|
||||
Changing Server
|
||||
</Link>
|
||||
</Typography>
|
||||
}
|
||||
sx={{
|
||||
bgcolor: "rgba(255,255,255,0.05)",
|
||||
p: 1,
|
||||
height: "auto",
|
||||
"& .MuiChip-label": {
|
||||
padding: "8px 12px",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</Paper>
|
||||
<div className="profile-grid">
|
||||
{users.isPending &&
|
||||
[0, 1, 2].map((key) => (
|
||||
<div className="profile" key={key} aria-hidden>
|
||||
<Skeleton variant="circular" width={112} height={112} />
|
||||
<Skeleton variant="text" width={72} />
|
||||
</div>
|
||||
))}
|
||||
|
||||
{users.data?.map((user) => (
|
||||
<Link
|
||||
key={user.Id}
|
||||
className="profile"
|
||||
to="/login/$userId/$userName"
|
||||
params={{ userId: user.Id ?? "", userName: user.Name ?? "" }}
|
||||
aria-label={`Sign in as ${user.Name}`}
|
||||
>
|
||||
<ProfileAvatar
|
||||
userId={user.Id ?? ""}
|
||||
name={user.Name ?? ""}
|
||||
imageTag={user.PrimaryImageTag}
|
||||
locked={isPasswordProtected(user)}
|
||||
/>
|
||||
<span className="profile-name">{user.Name}</span>
|
||||
</Link>
|
||||
))}
|
||||
|
||||
{!users.isPending && (
|
||||
<Link
|
||||
className="profile"
|
||||
to="/login/manual"
|
||||
aria-label="Sign in with a username"
|
||||
>
|
||||
<span className="profile-avatar profile-avatar-add">
|
||||
<span className="material-symbols-rounded">person_add</span>
|
||||
</span>
|
||||
<span className="profile-name">Other user</span>
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{users.isError && (
|
||||
<p className="login-shell-subtitle" style={{ textAlign: "center" }}>
|
||||
Couldn't load profiles from this server. Use "Other user" to sign in
|
||||
with your username.
|
||||
</p>
|
||||
)}
|
||||
</LoginShell>
|
||||
);
|
||||
}
|
||||
if (users.isError) {
|
||||
return <ErrorNotice />;
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
|
||||
.user {
|
||||
&-list {
|
||||
&-container {
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
gap: 1em;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 30em;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
scroll-snap-type: y mandatory;
|
||||
margin: 2em 0;
|
||||
}
|
||||
}
|
||||
&-card {
|
||||
width: fit-content;
|
||||
scroll-snap-align: start;
|
||||
text-decoration: none !important;
|
||||
color: white !important;
|
||||
&-image{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
&-container{
|
||||
aspect-ratio: 1;
|
||||
width: 8em;
|
||||
overflow: hidden;
|
||||
border-radius: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
&Icon {
|
||||
font-size: 5em;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: $clr-accent-dark;
|
||||
}
|
||||
}
|
||||
|
||||
.buttons {
|
||||
display: flex;
|
||||
gap: 1em;
|
||||
width: 100%;
|
||||
>* {
|
||||
flex: 1 1 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.login {
|
||||
// width: 50em;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
&-container{
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
margin: auto;
|
||||
padding-top: 4em;
|
||||
padding-bottom: 4em;
|
||||
}
|
||||
|
||||
&-form {
|
||||
width: 24em;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: stretch;
|
||||
gap:1em;
|
||||
&-container{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap:2em;
|
||||
background: rgb(255 255 255 / 0.05);
|
||||
padding: 2em;
|
||||
border-radius: 20px;
|
||||
// border: 1px solid rgb(255 255 255 / 0.1);
|
||||
&.padded-top {
|
||||
margin-top: 25vh;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +1,20 @@
|
||||
import { getBrandingApi } from "@jellyfin/sdk/lib/utils/api/branding-api";
|
||||
import LoadingButton from "@mui/lab/LoadingButton";
|
||||
import { Paper, TextField, Typography } from "@mui/material";
|
||||
import Button from "@mui/material/Button";
|
||||
import Checkbox from "@mui/material/Checkbox";
|
||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import InputAdornment from "@mui/material/InputAdornment";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { useSnackbar } from "notistack";
|
||||
import React, {
|
||||
type ChangeEvent,
|
||||
type FormEvent,
|
||||
useEffect,
|
||||
useState,
|
||||
} from "react";
|
||||
import { saveUser } from "@/utils/storage/user.js";
|
||||
import { useApiInContext } from "@/utils/store/api.js";
|
||||
import "./login.scss";
|
||||
|
||||
import { blue } from "@mui/material/colors";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import {
|
||||
createFileRoute,
|
||||
Link,
|
||||
useNavigate,
|
||||
useRouter,
|
||||
} from "@tanstack/react-router";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop.js";
|
||||
import React, { type FormEvent, useState } from "react";
|
||||
import LoginShell from "@/components/loginShell";
|
||||
import { saveUser } from "@/utils/storage/user";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
|
||||
export const Route = createFileRoute("/_api/login/manual")({
|
||||
component: UserLoginManual,
|
||||
@@ -35,269 +24,142 @@ export const Route = createFileRoute("/_api/login/manual")({
|
||||
});
|
||||
|
||||
function UserLoginManual() {
|
||||
const [rememberMe, setRememberMe] = useState(true);
|
||||
// console.log(Route.useRouteContext());
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const createApi = useApiInContext((s) => s.createApi);
|
||||
const router = useRouter();
|
||||
const navigate = useNavigate();
|
||||
const searchParams = Route.useSearch();
|
||||
|
||||
const server = useQuery({
|
||||
queryKey: ["login", "manual", "serverInfo"],
|
||||
queryFn: async () =>
|
||||
api ? (await getBrandingApi(api).getBrandingOptions()).data : null,
|
||||
});
|
||||
|
||||
const navigate = useNavigate();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
const [username, setUsername] = useState("");
|
||||
const [password, setPassword] = useState<{
|
||||
password: string | undefined;
|
||||
showpass: boolean;
|
||||
}>({
|
||||
showpass: false,
|
||||
password: "",
|
||||
});
|
||||
const [password, setPassword] = useState("");
|
||||
const [showPassword, setShowPassword] = useState(false);
|
||||
const [rememberMe, setRememberMe] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const handlePassword =
|
||||
(prop: "password" | "showpass") =>
|
||||
(event: ChangeEvent<HTMLInputElement>) => {
|
||||
setPassword({
|
||||
...password,
|
||||
[prop]: event.target.value,
|
||||
});
|
||||
};
|
||||
|
||||
const handleShowPassword = () => {
|
||||
setPassword({
|
||||
...password,
|
||||
showpass: !password.showpass,
|
||||
});
|
||||
};
|
||||
|
||||
const handleLoginFn = async (event: FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
try {
|
||||
if (!api) {
|
||||
throw new Error("Api is not available");
|
||||
}
|
||||
const handleLogin = useMutation({
|
||||
mutationKey: ["login", "authenticate"],
|
||||
mutationFn: async () => {
|
||||
if (!api) throw new Error("Api is not available");
|
||||
const authenticate = await api.authenticateUserByName(
|
||||
username,
|
||||
password.password,
|
||||
username.trim(),
|
||||
password,
|
||||
);
|
||||
if (!authenticate.data?.AccessToken) {
|
||||
throw new Error("Access token not available");
|
||||
}
|
||||
createApi(api.basePath, authenticate.data?.AccessToken);
|
||||
|
||||
if (rememberMe)
|
||||
createApi(api.basePath, authenticate.data.AccessToken);
|
||||
if (rememberMe) {
|
||||
await saveUser(
|
||||
username,
|
||||
username.trim(),
|
||||
authenticate.data.AccessToken,
|
||||
authenticate.data.User?.Id ?? "",
|
||||
);
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
router.invalidate().finally(() => {
|
||||
navigate({ to: searchParams.redirect || "/home", replace: true });
|
||||
});
|
||||
} catch (err) {
|
||||
},
|
||||
onError: (err) => {
|
||||
console.error(err);
|
||||
enqueueSnackbar(
|
||||
"Unable to authenticate. Please check your username and password",
|
||||
{ variant: "error" },
|
||||
);
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
const handleLogin = useMutation({
|
||||
mutationKey: ["login", "authenticate"],
|
||||
mutationFn: handleLoginFn,
|
||||
setError("Incorrect username or password.");
|
||||
setPassword("");
|
||||
},
|
||||
});
|
||||
|
||||
const handleCheckRememberMe = (
|
||||
_: ChangeEvent<HTMLInputElement>,
|
||||
checked: boolean,
|
||||
) => {
|
||||
setRememberMe(checked);
|
||||
const handleSubmit = (event: FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
if (!username.trim()) {
|
||||
setError("Enter your username.");
|
||||
return;
|
||||
}
|
||||
setError(null);
|
||||
handleLogin.mutate();
|
||||
};
|
||||
|
||||
const setBackdrop = useBackdropStore(
|
||||
useShallow((state) => state.setBackdrop),
|
||||
);
|
||||
useEffect(() => {
|
||||
setBackdrop("");
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="login scrollY flex flex-center flex-column">
|
||||
<Paper
|
||||
sx={{
|
||||
p: 4,
|
||||
width: "100%",
|
||||
maxWidth: "600px",
|
||||
backgroundColor: "rgba(20, 20, 30, 0.7)",
|
||||
backdropFilter: "blur(24px) saturate(180%)",
|
||||
backgroundImage:
|
||||
"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0))",
|
||||
border: "1px solid rgba(255, 255, 255, 0.08)",
|
||||
boxShadow: "0 20px 50px rgba(0,0,0,0.5)",
|
||||
borderRadius: 4,
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: 3,
|
||||
mb: 3,
|
||||
}}
|
||||
>
|
||||
<Typography variant="h4" fontWeight="bold" align="center">
|
||||
Login
|
||||
</Typography>
|
||||
<form
|
||||
className="flex flex-column"
|
||||
style={{ gap: "1.5em", width: "100%" }}
|
||||
onSubmit={(e) => handleLogin.mutate(e)}
|
||||
<LoginShell
|
||||
title="Sign in"
|
||||
subtitle="Use your username and password"
|
||||
footer={
|
||||
<Link to="/login/list" className="login-link">
|
||||
<span className="material-symbols-rounded">group</span>
|
||||
Choose a profile instead
|
||||
</Link>
|
||||
}
|
||||
>
|
||||
<form className="login-form" onSubmit={handleSubmit} noValidate>
|
||||
<TextField
|
||||
variant="outlined"
|
||||
label="Username" // Label helps accessibility, theme handles style
|
||||
fullWidth
|
||||
onChange={(e) => setUsername(e.currentTarget.value)}
|
||||
InputProps={{
|
||||
startAdornment: (
|
||||
<InputAdornment position="start">
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{ opacity: 0.5 }}
|
||||
>
|
||||
person
|
||||
</span>
|
||||
</InputAdornment>
|
||||
),
|
||||
autoFocus
|
||||
label="Username"
|
||||
variant="outlined"
|
||||
autoComplete="username"
|
||||
value={username}
|
||||
onChange={(e) => {
|
||||
setUsername(e.target.value);
|
||||
setError(null);
|
||||
}}
|
||||
error={Boolean(error) && !username.trim()}
|
||||
/>
|
||||
<TextField
|
||||
fullWidth
|
||||
type={password.showpass ? "text" : "password"}
|
||||
onChange={handlePassword("password")}
|
||||
label="Password"
|
||||
variant="outlined"
|
||||
InputProps={{
|
||||
startAdornment: (
|
||||
<InputAdornment position="start">
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{ opacity: 0.5 }}
|
||||
>
|
||||
key
|
||||
</span>
|
||||
</InputAdornment>
|
||||
),
|
||||
type={showPassword ? "text" : "password"}
|
||||
autoComplete="current-password"
|
||||
value={password}
|
||||
onChange={(e) => {
|
||||
setPassword(e.target.value);
|
||||
setError(null);
|
||||
}}
|
||||
error={Boolean(error) && Boolean(username.trim())}
|
||||
helperText={error ?? "Leave blank if your account has no password"}
|
||||
slotProps={{
|
||||
input: {
|
||||
endAdornment: (
|
||||
<InputAdornment position="end">
|
||||
<IconButton
|
||||
onClick={handleShowPassword}
|
||||
onClick={() => setShowPassword((show) => !show)}
|
||||
edge="end"
|
||||
sx={{
|
||||
color: "rgba(255,255,255,0.7)",
|
||||
"&:hover": { color: "#fff" },
|
||||
}}
|
||||
aria-label={
|
||||
showPassword ? "Hide password" : "Show password"
|
||||
}
|
||||
>
|
||||
{password.showpass ? (
|
||||
<span className="material-symbols-rounded">
|
||||
visibility
|
||||
{showPassword ? "visibility_off" : "visibility"}
|
||||
</span>
|
||||
) : (
|
||||
<span className="material-symbols-rounded">
|
||||
visibility_off
|
||||
</span>
|
||||
)}
|
||||
</IconButton>
|
||||
</InputAdornment>
|
||||
),
|
||||
},
|
||||
}}
|
||||
/>
|
||||
|
||||
<div className="login-form-options">
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
checked={rememberMe}
|
||||
onChange={handleCheckRememberMe}
|
||||
sx={{
|
||||
color: "rgba(255,255,255,0.5)",
|
||||
"&.Mui-checked": {
|
||||
color: "primary.main",
|
||||
},
|
||||
}}
|
||||
onChange={(_, checked) => setRememberMe(checked)}
|
||||
/>
|
||||
}
|
||||
label={
|
||||
<Typography variant="body2" sx={{ opacity: 0.7 }}>
|
||||
Remember me
|
||||
</Typography>
|
||||
}
|
||||
label="Keep me signed in"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-column" style={{ gap: "1em" }}>
|
||||
<LoadingButton
|
||||
<Button
|
||||
className="login-form-submit"
|
||||
variant="contained"
|
||||
type="submit"
|
||||
loading={handleLogin.isPending}
|
||||
sx={{ width: "100%", height: 48, borderRadius: 2 }}
|
||||
size="large"
|
||||
fullWidth
|
||||
loading={handleLogin.isPending || handleLogin.isSuccess}
|
||||
>
|
||||
Login
|
||||
</LoadingButton>
|
||||
<Button
|
||||
color="inherit"
|
||||
variant="text"
|
||||
sx={{
|
||||
width: "100%",
|
||||
color: "rgba(255,255,255,0.5)",
|
||||
"&:hover": {
|
||||
color: "white",
|
||||
bgcolor: "rgba(255,255,255,0.05)",
|
||||
},
|
||||
}}
|
||||
onClick={() => navigate({ to: "/setup/server/list" })}
|
||||
>
|
||||
Change Server
|
||||
Sign in
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Paper>
|
||||
{server.isSuccess && server.data?.LoginDisclaimer && (
|
||||
<Paper
|
||||
elevation={0}
|
||||
sx={{
|
||||
padding: "1.5em",
|
||||
borderRadius: "16px",
|
||||
width: "100%",
|
||||
maxWidth: "450px",
|
||||
backgroundColor: "rgba(33, 150, 243, 0.1)",
|
||||
border: "1px solid rgba(33, 150, 243, 0.2)",
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="flex flex-row flex-align-center"
|
||||
style={{ gap: "0.5em", marginBottom: "0.5em" }}
|
||||
>
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{
|
||||
color: blue[400],
|
||||
}}
|
||||
>
|
||||
info
|
||||
</span>
|
||||
<Typography variant="subtitle1" fontWeight="bold">
|
||||
Notice
|
||||
</Typography>
|
||||
</div>
|
||||
<Typography variant="body2" style={{ opacity: 0.8, lineHeight: 1.6 }}>
|
||||
{server.data.LoginDisclaimer}
|
||||
</Typography>
|
||||
</Paper>
|
||||
)}
|
||||
</div>
|
||||
</LoginShell>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
import { BaseItemKind, SortOrder } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Typography from "@mui/material/Typography";
|
||||
@@ -27,7 +25,7 @@ import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
|
||||
export const Route = createFileRoute("/_api/album/$id")({
|
||||
export const Route = createFileRoute("/_api/music/album/$id")({
|
||||
component: MusicAlbumTitlePage,
|
||||
});
|
||||
|
||||
@@ -41,7 +39,7 @@ function MusicAlbumTitlePage() {
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
const result = await getLibraryApi(api).getItem({
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
});
|
||||
@@ -74,7 +72,7 @@ function MusicAlbumTitlePage() {
|
||||
queryKey: ["item", "musicTracks", id],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
const result = await getLibraryApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
parentId: item.data?.Id,
|
||||
sortOrder: [SortOrder.Ascending],
|
||||
@@ -146,7 +144,7 @@ function MusicAlbumTitlePage() {
|
||||
<div className="flex flex-align-center item-info-album-info">
|
||||
{/* @ts-ignore - Using Link as component */}
|
||||
<Link
|
||||
to="/artist/$id"
|
||||
to="/music/artist/$id"
|
||||
params={{ id: item.data.AlbumArtists?.[0].Id ?? "" }}
|
||||
>
|
||||
<Chip
|
||||
File renamed without changes.
@@ -3,8 +3,7 @@ import {
|
||||
ItemFields,
|
||||
SortOrder,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Divider from "@mui/material/Divider";
|
||||
@@ -12,7 +11,7 @@ import Tab from "@mui/material/Tab";
|
||||
import Tabs from "@mui/material/Tabs";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { AnimatePresence, motion, useScroll } from "motion/react";
|
||||
import { AnimatePresence, motion } from "motion/react";
|
||||
import React, {
|
||||
type ReactNode,
|
||||
useEffect,
|
||||
@@ -22,20 +21,40 @@ import React, {
|
||||
} from "react";
|
||||
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import PlayButton from "@/components/buttons/playButton";
|
||||
import { Card } from "@/components/card/card";
|
||||
import ItemHeader from "@/components/itemHeader";
|
||||
import { ArtistAlbum } from "@/components/layouts/artist/artistAlbum";
|
||||
import MusicTrack from "@/components/musicTrack";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
import useParallax from "@/utils/hooks/useParallax";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import "./artist.scss";
|
||||
|
||||
import type { Api } from "@jellyfin/sdk";
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import IconLink from "@/components/iconLink";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { playItemFromQueue } from "@/utils/store/playback";
|
||||
import { setQueue } from "@/utils/store/queue";
|
||||
|
||||
/** Queues the given tracks in random order and starts playing. */
|
||||
const shuffleAndPlay = (
|
||||
tracks: BaseItemDto[],
|
||||
userId: string | undefined,
|
||||
api: Api | undefined,
|
||||
) => {
|
||||
const shuffled = [...tracks];
|
||||
for (let i = shuffled.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
|
||||
}
|
||||
setQueue(shuffled, 0);
|
||||
playItemFromQueue(0, userId, api);
|
||||
};
|
||||
|
||||
type TabPanelProp = {
|
||||
children: ReactNode;
|
||||
@@ -60,7 +79,7 @@ function TabPanel(props: TabPanelProp) {
|
||||
);
|
||||
}
|
||||
|
||||
export const Route = createFileRoute("/_api/artist/$id")({
|
||||
export const Route = createFileRoute("/_api/music/artist/$id")({
|
||||
component: ArtistTitlePage,
|
||||
});
|
||||
|
||||
@@ -74,7 +93,7 @@ function ArtistTitlePage() {
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
const result = await getLibraryApi(api).getItem({
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
});
|
||||
@@ -89,7 +108,7 @@ function ArtistTitlePage() {
|
||||
queryKey: ["item", id, "artist", "discography"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
const result = await getLibraryApi(api).getItems({
|
||||
albumArtistIds: [id],
|
||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||
sortOrder: [SortOrder.Descending],
|
||||
@@ -107,7 +126,7 @@ function ArtistTitlePage() {
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
|
||||
const result = await getItemsApi(api).getItems({
|
||||
const result = await getLibraryApi(api).getItems({
|
||||
artistIds: [id],
|
||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||
sortOrder: [SortOrder.Ascending],
|
||||
@@ -124,7 +143,7 @@ function ArtistTitlePage() {
|
||||
queryKey: ["item", id, "artist", "appearences"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
const result = await getLibraryApi(api).getItems({
|
||||
contributingArtistIds: [id],
|
||||
excludeItemIds: [id],
|
||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||
@@ -169,15 +188,29 @@ function ArtistTitlePage() {
|
||||
|
||||
const [animationDirection, setAnimationDirection] = useState("forward");
|
||||
|
||||
const { setBackdrop } = useBackdropStore();
|
||||
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||
const backdropTag = item.data?.BackdropImageTags?.[0];
|
||||
const backdropHash =
|
||||
(backdropTag && item.data?.ImageBlurHashes?.Backdrop?.[backdropTag]) || "";
|
||||
useEffect(() => {
|
||||
if (item.isSuccess && item.data) {
|
||||
setBackdrop(`${api?.basePath}/Items/${item.data.Id}/Images/Backdrop`);
|
||||
}
|
||||
}, [item.isSuccess]);
|
||||
setBackdrop(backdropHash);
|
||||
}, [backdropHash, setBackdrop]);
|
||||
|
||||
const scrollTargetRef = useRef<HTMLDivElement | null>(null);
|
||||
|
||||
const pluralize = (count: number, word: string) =>
|
||||
`${count} ${count === 1 ? word : `${word}s`}`;
|
||||
const catalogueSummary = [
|
||||
artistDiscography.data?.TotalRecordCount
|
||||
? pluralize(artistDiscography.data.TotalRecordCount, "album")
|
||||
: null,
|
||||
artistSongs.data?.TotalRecordCount
|
||||
? pluralize(artistSongs.data.TotalRecordCount, "song")
|
||||
: null,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" · ");
|
||||
|
||||
if (item.isPending) {
|
||||
return (
|
||||
<Box
|
||||
@@ -216,6 +249,33 @@ function ArtistTitlePage() {
|
||||
scrollTargetRef={scrollTargetRef}
|
||||
>
|
||||
<div className="item-hero-buttons-container">
|
||||
<div className="flex flex-row" style={{ width: "100%" }}>
|
||||
<PlayButton
|
||||
item={item.data}
|
||||
itemType={BaseItemKind.MusicArtist}
|
||||
userId={user?.Id}
|
||||
audio
|
||||
buttonProps={{ fullWidth: true }}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-row" style={{ gap: "1em" }}>
|
||||
<Tooltip title="Shuffle">
|
||||
<span>
|
||||
<IconButton
|
||||
aria-label="Shuffle"
|
||||
disabled={!artistSongs.data?.Items?.length}
|
||||
onClick={() =>
|
||||
shuffleAndPlay(
|
||||
artistSongs.data?.Items ?? [],
|
||||
user?.Id,
|
||||
api,
|
||||
)
|
||||
}
|
||||
>
|
||||
<span className="material-symbols-rounded">shuffle</span>
|
||||
</IconButton>
|
||||
</span>
|
||||
</Tooltip>
|
||||
<LikeButton
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
@@ -224,9 +284,15 @@ function ArtistTitlePage() {
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</ItemHeader>
|
||||
<div className="item-detail">
|
||||
<div style={{ width: "100%", overflow: "hidden" }}>
|
||||
{catalogueSummary && (
|
||||
<Typography sx={{ opacity: 0.8, mb: 1.5 }}>
|
||||
{catalogueSummary}
|
||||
</Typography>
|
||||
)}
|
||||
<ShowMoreText
|
||||
content={item.data.Overview ?? ""}
|
||||
collapsedLines={4}
|
||||
@@ -263,7 +329,12 @@ function ArtistTitlePage() {
|
||||
)}
|
||||
{item.data.EndDate && (
|
||||
<div>
|
||||
<Typography variant="h5" mt={2}>
|
||||
<Typography
|
||||
variant="h5"
|
||||
sx={{
|
||||
mt: 2,
|
||||
}}
|
||||
>
|
||||
Death
|
||||
</Typography>
|
||||
<Typography sx={{ opacity: 0.8 }}>
|
||||
@@ -6,7 +6,7 @@ $cardWidth: 22%;
|
||||
.item-detail {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 35%;
|
||||
justify-items: center;
|
||||
justify-items: start;
|
||||
align-items: start;
|
||||
gap: 3em;
|
||||
|
||||
@@ -5,8 +5,7 @@ import CircularProgress from "@mui/material/CircularProgress";
|
||||
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import { getPlaylistsApi } from "@jellyfin/sdk/lib/utils/api/playlists-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { getPlaylistApi } from "@jellyfin/sdk/lib/utils/api/playlist-api";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
@@ -28,7 +27,7 @@ import { Typography } from "@mui/material";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import { createPortal } from "react-dom";
|
||||
|
||||
export const Route = createFileRoute("/_api/playlist/$id")({
|
||||
export const Route = createFileRoute("/_api/music/playlist/$id")({
|
||||
component: PlaylistTitlePage,
|
||||
});
|
||||
|
||||
@@ -42,7 +41,7 @@ function PlaylistTitlePage() {
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
const result = await getLibraryApi(api).getItem({
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
});
|
||||
@@ -75,7 +74,7 @@ function PlaylistTitlePage() {
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
if (!item.data?.Id) return null;
|
||||
const result = await getPlaylistsApi(api).getPlaylistItems({
|
||||
const result = await getPlaylistApi(api).getPlaylistItems({
|
||||
userId: user?.Id,
|
||||
playlistId: item.data.Id,
|
||||
});
|
||||
File renamed without changes.
@@ -1,429 +0,0 @@
|
||||
import { BaseItemKind, LocationType } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import Tab from "@mui/material/Tab";
|
||||
import Tabs from "@mui/material/Tabs";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { AnimatePresence, motion } from "motion/react";
|
||||
import React, {
|
||||
type ReactNode,
|
||||
useLayoutEffect,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import { Card } from "@/components/card/card";
|
||||
import ItemHeader from "@/components/itemHeader";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import "./person.scss";
|
||||
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import IconLink from "@/components/iconLink";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
|
||||
type TabPanelProps = {
|
||||
children: ReactNode;
|
||||
index: number;
|
||||
value: number;
|
||||
};
|
||||
|
||||
function TabPanel(props: TabPanelProps) {
|
||||
const { children, value, index, ...other } = props;
|
||||
|
||||
return (
|
||||
<div
|
||||
role="tabpanel"
|
||||
hidden={value !== index}
|
||||
id={`full-width-tabpanel-${index}`}
|
||||
aria-labelledby={`full-width-tab-${index}`}
|
||||
{...other}
|
||||
style={{ marginTop: "1em" }}
|
||||
>
|
||||
{value === index && <div>{children}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export const Route = createFileRoute("/_api/person/$id")({
|
||||
component: PersonTitlePage,
|
||||
});
|
||||
|
||||
function PersonTitlePage() {
|
||||
const { id } = Route.useParams();
|
||||
const api = useApiInContext((s) => s.api);
|
||||
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user?.Id,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
|
||||
const personMovies = useQuery({
|
||||
queryKey: ["item", id, "personMovies"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
personIds: [id],
|
||||
includeItemTypes: [BaseItemKind.Movie],
|
||||
recursive: true,
|
||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||
sortOrder: ["Descending"],
|
||||
excludeLocationTypes: [LocationType.Virtual],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
const personShows = useQuery({
|
||||
queryKey: ["item", id, "personShows"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
personIds: [id],
|
||||
includeItemTypes: [BaseItemKind.Series],
|
||||
recursive: true,
|
||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||
sortOrder: ["Descending"],
|
||||
excludeLocationTypes: [LocationType.Virtual],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
const personBooks = useQuery({
|
||||
queryKey: ["item", id, "personBooks"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
personIds: [id],
|
||||
includeItemTypes: [BaseItemKind.Book],
|
||||
recursive: true,
|
||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||
sortOrder: ["Descending"],
|
||||
excludeLocationTypes: [LocationType.Virtual],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
const personPhotos = useQuery({
|
||||
queryKey: ["item", id, "personPhotos"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
personIds: [id],
|
||||
includeItemTypes: [BaseItemKind.Photo],
|
||||
recursive: true,
|
||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||
excludeLocationTypes: [LocationType.Virtual],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
const personEpisodes = useQuery({
|
||||
queryKey: ["item", id, "personEpisodes"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
personIds: [id],
|
||||
includeItemTypes: [BaseItemKind.Episode],
|
||||
recursive: true,
|
||||
fields: ["SeasonUserData", "Overview"],
|
||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||
excludeLocationTypes: [LocationType.Virtual],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const [activePersonTab, setActivePersonTab] = useState(0);
|
||||
|
||||
const personTabs = [
|
||||
{
|
||||
title: "Movies",
|
||||
data: personMovies,
|
||||
queryKey: ["item", id, "personMovies"],
|
||||
},
|
||||
{
|
||||
title: "TV Shows",
|
||||
data: personShows,
|
||||
queryKey: ["item", id, "personShows"],
|
||||
},
|
||||
{
|
||||
title: "Books",
|
||||
data: personBooks,
|
||||
queryKey: ["item", id, "personBooks"],
|
||||
},
|
||||
{
|
||||
title: "Photos",
|
||||
data: personPhotos,
|
||||
queryKey: ["item", id, "personPhotos"],
|
||||
},
|
||||
{
|
||||
title: "Episodes",
|
||||
data: personEpisodes,
|
||||
queryKey: ["item", id, "personEpisodes"],
|
||||
},
|
||||
];
|
||||
|
||||
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (
|
||||
personMovies.isSuccess &&
|
||||
personShows.isSuccess &&
|
||||
personBooks.isSuccess &&
|
||||
personPhotos.isSuccess &&
|
||||
personEpisodes.isSuccess
|
||||
) {
|
||||
if (personMovies.data?.TotalRecordCount !== 0) {
|
||||
setActivePersonTab(0);
|
||||
} else if (personShows.data?.TotalRecordCount !== 0) {
|
||||
setActivePersonTab(1);
|
||||
} else if (personBooks.data?.TotalRecordCount !== 0) {
|
||||
setActivePersonTab(2);
|
||||
} else if (personPhotos.data?.TotalRecordCount !== 0) {
|
||||
setActivePersonTab(3);
|
||||
} else if (personEpisodes.data?.TotalRecordCount !== 0) {
|
||||
setActivePersonTab(4);
|
||||
}
|
||||
}
|
||||
setBackdrop("", "");
|
||||
}, [
|
||||
personMovies.isSuccess,
|
||||
personShows.isSuccess,
|
||||
personBooks.isSuccess,
|
||||
personPhotos.isSuccess,
|
||||
personEpisodes.isSuccess,
|
||||
]);
|
||||
|
||||
const [animationDirection, setAnimationDirection] = useState("forward");
|
||||
|
||||
const pageRef = useRef(null);
|
||||
|
||||
if (item.isPending) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
if (item.isSuccess && item.data) {
|
||||
return (
|
||||
<motion.div
|
||||
key={id}
|
||||
initial={{
|
||||
opacity: 0,
|
||||
}}
|
||||
animate={{
|
||||
opacity: 1,
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.25,
|
||||
ease: "easeInOut",
|
||||
}}
|
||||
className="scrollY padded-top item item-person flex flex-column"
|
||||
ref={pageRef}
|
||||
>
|
||||
<ItemHeader item={item.data} api={api}>
|
||||
<div className="item-hero-buttons-container flex flex-row">
|
||||
<div className="flex flex-row fullWidth" />
|
||||
<div className="flex flex-row" style={{ gap: "1em" }}>
|
||||
<LikeButton
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isFavorite={item.data.UserData?.IsFavorite}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</ItemHeader>
|
||||
<div className="item-detail">
|
||||
<div style={{ width: "100%" }}>
|
||||
<ShowMoreText
|
||||
content={item.data.Overview ?? ""}
|
||||
collapsedLines={4}
|
||||
/>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: "0.6em",
|
||||
alignSelf: "end",
|
||||
marginTop: "1em",
|
||||
}}
|
||||
>
|
||||
{item.data.ExternalUrls?.map(
|
||||
(url) =>
|
||||
url.Name &&
|
||||
url.Url && <IconLink url={url.Url} name={url.Name} />,
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
{item.data.PremiereDate && (
|
||||
<div>
|
||||
<Typography variant="h6">Birth</Typography>
|
||||
<Typography variant="subtitle1" sx={{ opacity: 0.8 }}>
|
||||
{new Date(item.data.PremiereDate).toDateString()}
|
||||
</Typography>
|
||||
</div>
|
||||
)}
|
||||
{item.data.EndDate && (
|
||||
<div>
|
||||
<Typography variant="h6" mt={2}>
|
||||
Death
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" sx={{ opacity: 0.8 }}>
|
||||
{new Date(item.data.EndDate).toDateString()}
|
||||
</Typography>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="item-detail-person-container">
|
||||
<div className="item-detail-person-header">
|
||||
<Tabs
|
||||
variant="scrollable"
|
||||
value={activePersonTab}
|
||||
onChange={(_, newVal) => {
|
||||
if (newVal > activePersonTab) {
|
||||
setAnimationDirection("forward");
|
||||
} else if (newVal < activePersonTab) {
|
||||
setAnimationDirection("backwards");
|
||||
}
|
||||
setActivePersonTab(newVal);
|
||||
}}
|
||||
>
|
||||
{personTabs.map((tab) => {
|
||||
return (
|
||||
<Tab
|
||||
key={tab.title}
|
||||
label={tab.title}
|
||||
disabled={tab.data.data?.TotalRecordCount === 0}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</Tabs>
|
||||
<Divider />
|
||||
</div>
|
||||
<AnimatePresence>
|
||||
{personTabs.map((tab, index) => {
|
||||
return (
|
||||
<TabPanel value={activePersonTab} index={index} key={tab.title}>
|
||||
<motion.div
|
||||
className={`item-detail-person-cards ${
|
||||
tab.title === "Movies" ||
|
||||
tab.title === "TV Shows" ||
|
||||
tab.title === "Books"
|
||||
? "col-7"
|
||||
: "col-4"
|
||||
}`}
|
||||
key={tab.queryKey.join("")}
|
||||
initial={{
|
||||
opacity: 0,
|
||||
transform:
|
||||
animationDirection === "forward"
|
||||
? "translate(30px)"
|
||||
: "translate(-30px)",
|
||||
}}
|
||||
animate={{
|
||||
opacity: 1,
|
||||
transform: "translate(0px)",
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.2,
|
||||
ease: "anticipate",
|
||||
}}
|
||||
>
|
||||
{tab.data.isSuccess &&
|
||||
tab.data.data?.Items?.map((tabitem) => {
|
||||
return (
|
||||
<Card
|
||||
key={tabitem.Id}
|
||||
item={tabitem}
|
||||
cardTitle={
|
||||
tabitem.Type === BaseItemKind.Episode
|
||||
? tabitem.SeriesName
|
||||
: tabitem.Name
|
||||
}
|
||||
imageType={"Primary"}
|
||||
cardCaption={
|
||||
tabitem.Type === BaseItemKind.Episode
|
||||
? `S${tabitem.ParentIndexNumber}:E${tabitem.IndexNumber} - ${tabitem.Name}`
|
||||
: tabitem.Type === BaseItemKind.Series
|
||||
? `${tabitem.ProductionYear} - ${
|
||||
tabitem.EndDate
|
||||
? new Date(
|
||||
tabitem.EndDate,
|
||||
).toLocaleString([], {
|
||||
year: "numeric",
|
||||
})
|
||||
: "Present"
|
||||
}`
|
||||
: tabitem.ProductionYear
|
||||
}
|
||||
cardType={
|
||||
tabitem.Type === BaseItemKind.Episode
|
||||
? "thumb"
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={tab.queryKey}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</motion.div>
|
||||
</TabPanel>
|
||||
);
|
||||
})}
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
if (item.isError) {
|
||||
return <ErrorNotice />;
|
||||
}
|
||||
}
|
||||
|
||||
export default PersonTitlePage;
|
||||
@@ -1,89 +0,0 @@
|
||||
$cardWidth: 18%;
|
||||
.item-detail-person {
|
||||
&-container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
&-header {
|
||||
width: 100%;
|
||||
}
|
||||
&-cards {
|
||||
display: grid;
|
||||
align-items: start;
|
||||
}
|
||||
}
|
||||
|
||||
.col-7 {
|
||||
grid-template-columns: repeat(7, minmax(0, 1fr));
|
||||
}
|
||||
.col-4 {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.item-person.item {
|
||||
gap: 1em;
|
||||
|
||||
|
||||
.item-detail {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 35%;
|
||||
justify-items: center;
|
||||
align-items: start;
|
||||
gap: 3em;
|
||||
|
||||
&-cast {
|
||||
&-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
}
|
||||
&-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
gap: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
&-card {
|
||||
display: grid;
|
||||
grid-template-columns: 6em 1fr;
|
||||
gap: 0.5em;
|
||||
align-items: center;
|
||||
color: white !important;
|
||||
text-decoration: none;
|
||||
padding: 0.5em;
|
||||
background: rgb(255 255 255 / 0);
|
||||
transition: background $transition-time-default;
|
||||
border-radius: $border-radius-default;
|
||||
&:hover {
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
}
|
||||
&-image,
|
||||
&-icon {
|
||||
width: 6em;
|
||||
height: 6em;
|
||||
object-fit: cover;
|
||||
border-radius: 100%;
|
||||
box-shadow: $shadow-card-image;
|
||||
}
|
||||
&-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1em;
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
.material-symbols-rounded {
|
||||
font-size: 3em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&-link {
|
||||
color: white;
|
||||
text-decoration-color: rgb(255 255 255 / 0.5);
|
||||
&:hover {
|
||||
text-decoration-color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+215
-146
@@ -29,163 +29,195 @@
|
||||
}
|
||||
|
||||
&-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
// Art size drives the whole left column so everything fits the viewport.
|
||||
--np-size: min(420px, 44vh, 80vw);
|
||||
|
||||
display: grid;
|
||||
grid-template-columns: var(--np-size) minmax(0, 560px);
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: clamp(2rem, 6vw, 6rem);
|
||||
height: 100vh;
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
gap: 1rem;
|
||||
padding: 5rem 3rem 2.5rem;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
color: white;
|
||||
overflow: hidden;
|
||||
|
||||
@media (min-width: 900px) {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 4rem;
|
||||
gap: 3rem;
|
||||
max-width: 1600px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
&-left-column {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@media (max-width: 900px) {
|
||||
grid-template-columns: minmax(0, var(--np-size));
|
||||
grid-template-rows: auto minmax(0, 1fr);
|
||||
align-items: start;
|
||||
padding: 4.5rem 1rem 1rem;
|
||||
gap: 1.5rem;
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
margin: 0 auto;
|
||||
min-height: 0; // Allow shrinking
|
||||
|
||||
@media (min-width: 900px) {
|
||||
gap: 2rem;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
|
||||
&-right-column {
|
||||
flex: 1;
|
||||
&-now-playing {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
gap: 1.25rem;
|
||||
width: var(--np-size);
|
||||
min-width: 0;
|
||||
|
||||
&-art {
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 1.25rem;
|
||||
overflow: hidden;
|
||||
@include glass-effect($blur: 20px, $bg-color: rgba(255, 255, 255, 0.05));
|
||||
border-radius: 1.5rem;
|
||||
padding: 0;
|
||||
min-height: 0; // Allow shrinking
|
||||
box-shadow: 0 24px 60px rgb(0 0 0 / 0.55);
|
||||
background: rgb(255 255 255 / 0.08);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
}
|
||||
.material-symbols-rounded {
|
||||
font-size: 6rem;
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
&-right-content {
|
||||
&-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
&-text {
|
||||
flex: 1;
|
||||
padding: 1.5rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&-subtitle {
|
||||
opacity: 0.7;
|
||||
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-transport {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
// Spread prev / play / next evenly with shuffle and repeat
|
||||
.player-controls {
|
||||
display: contents !important;
|
||||
}
|
||||
|
||||
// Toggle-style buttons read as "off" until enabled
|
||||
> .MuiIconButton-root,
|
||||
> span > .MuiIconButton-root {
|
||||
color: rgb(255 255 255 / 0.55);
|
||||
}
|
||||
> .MuiIconButton-root.is-active {
|
||||
color: $clr-accent-default;
|
||||
}
|
||||
}
|
||||
|
||||
&-utility {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
&-volume {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
max-width: 14rem;
|
||||
opacity: 0.85;
|
||||
|
||||
// Secondary control: neutral instead of the accent colour
|
||||
.MuiSlider-root {
|
||||
color: rgb(255 255 255 / 0.85);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-side {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
height: min(80vh, 760px);
|
||||
min-height: 0;
|
||||
|
||||
@media (max-width: 900px) {
|
||||
height: 70vh;
|
||||
}
|
||||
|
||||
&-lyrics {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
scrollbar-width: none;
|
||||
// Fade lines in and out at the edges
|
||||
mask-image: linear-gradient(transparent, black 15%, black 85%, transparent);
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
// "Up next" sits on a quiet card; no blur so the artwork backdrop stays clean
|
||||
&-queue {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
// The queue view scrolls its own list so the header stays put
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
padding: 1rem 1.25rem 0;
|
||||
|
||||
.queue {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
background: rgb(0 0 0 / 0.22);
|
||||
border: 1px solid rgb(255 255 255 / 0.06);
|
||||
border-radius: 1.25rem;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
&::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 3px;
|
||||
}
|
||||
&::-webkit-scrollbar-thumb:hover {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
}
|
||||
|
||||
&-info {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start; // Left align text
|
||||
text-align: left;
|
||||
gap: 0.5em;
|
||||
|
||||
@media (max-width: 900px) {
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
&.has-lyrics .audio-side-queue {
|
||||
flex: 0 1 auto;
|
||||
max-height: 40%;
|
||||
}
|
||||
|
||||
&-image {
|
||||
width: 100%;
|
||||
aspect-ratio: 1;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
border-radius: 1.5rem;
|
||||
box-shadow: 0 20px 50px rgba(0,0,0,0.5);
|
||||
transition: transform 0.3s ease;
|
||||
|
||||
&-container {
|
||||
width: 100%;
|
||||
aspect-ratio: 1;
|
||||
position: relative;
|
||||
border-radius: 1.5rem;
|
||||
overflow: hidden;
|
||||
margin-bottom: 1rem;
|
||||
|
||||
@media (max-width: 900px) {
|
||||
max-width: 70vw;
|
||||
max-height: 35vh;
|
||||
margin: 0 auto 1rem auto;
|
||||
}
|
||||
}
|
||||
|
||||
&-icon {
|
||||
font-size: 8em;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 1.5rem;
|
||||
}
|
||||
}
|
||||
&-controls {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 1.5em;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
&-queue {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
align-items: stretch; // Ensure items take full width
|
||||
|
||||
// Remove old track styles as we now use QueueListItem
|
||||
}
|
||||
|
||||
&-lyrics {
|
||||
padding: 1rem;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
min-height: 100%;
|
||||
|
||||
&-container {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding-bottom: 4rem; // Space for unsynced notice
|
||||
align-items: flex-start;
|
||||
// Room above and below so the active line can scroll to the middle
|
||||
padding: 35% 0.5rem;
|
||||
}
|
||||
|
||||
&-status {
|
||||
@@ -193,54 +225,91 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
opacity: 0.7;
|
||||
min-height: 200px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
&-line {
|
||||
margin-bottom: 1.5rem;
|
||||
opacity: 0.5;
|
||||
transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
||||
border-radius: 1rem;
|
||||
padding: 0.75rem 1.5rem;
|
||||
cursor: pointer;
|
||||
font-size: 1.5rem !important;
|
||||
line-height: 1.6 !important;
|
||||
font-weight: 600 !important;
|
||||
max-width: 90%;
|
||||
|
||||
&:hover {
|
||||
opacity: 0.8;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
margin: 0 0 0.6rem !important;
|
||||
padding: 0.35rem 0.75rem;
|
||||
border-radius: 0.75rem;
|
||||
font-size: clamp(1.25rem, 2vw, 1.85rem) !important;
|
||||
line-height: 1.35 !important;
|
||||
font-weight: 700 !important;
|
||||
text-align: left;
|
||||
opacity: 0.35;
|
||||
transition: opacity 0.35s ease, filter 0.35s ease;
|
||||
filter: blur(0.4px);
|
||||
|
||||
&[data-active-lyric="true"] {
|
||||
opacity: 1;
|
||||
font-weight: 800 !important;
|
||||
transform: scale(1.05);
|
||||
text-shadow: 0 0 30px rgba(255,255,255,0.3);
|
||||
color: var(--primary-color, #90caf9);
|
||||
filter: none;
|
||||
}
|
||||
|
||||
&[data-seekable="true"] {
|
||||
cursor: pointer;
|
||||
transition: opacity 0.35s ease, filter 0.35s ease, background-color 0.2s ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
opacity: 0.8;
|
||||
filter: none;
|
||||
background: rgb(255 255 255 / 0.08);
|
||||
outline: none;
|
||||
}
|
||||
&[data-active-lyric="true"]:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Unsynced lyrics: plain readable text, no highlight
|
||||
&[data-has-synced-lyrics="false"] {
|
||||
.audio-lyrics-container {
|
||||
padding: 1rem 0.5rem 4rem;
|
||||
}
|
||||
.audio-lyrics-line {
|
||||
font-size: 1.15rem !important;
|
||||
font-weight: 500 !important;
|
||||
opacity: 0.85;
|
||||
filter: none;
|
||||
margin-bottom: 0.25rem !important;
|
||||
}
|
||||
}
|
||||
|
||||
&-unsynced-notice {
|
||||
position: sticky;
|
||||
bottom: 1rem;
|
||||
display: flex;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.5rem 1rem;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
backdrop-filter: blur(10px);
|
||||
padding: 0.4rem 0.9rem;
|
||||
margin-left: 0.5rem;
|
||||
background: rgb(0 0 0 / 0.35);
|
||||
border-radius: 2rem;
|
||||
margin-top: auto;
|
||||
opacity: 0.8;
|
||||
opacity: 0.85;
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.2rem;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.player-progress-stacked {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
|
||||
.MuiSlider-root {
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
&-times {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.7;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
}
|
||||
|
||||
+241
-137
@@ -1,86 +1,103 @@
|
||||
import { Box, Tab, Tabs, Typography } from "@mui/material";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogTitle,
|
||||
IconButton,
|
||||
ListItemIcon,
|
||||
Menu,
|
||||
MenuItem,
|
||||
Tooltip,
|
||||
Typography,
|
||||
} from "@mui/material";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { createFileRoute, Link, useNavigate } from "@tanstack/react-router";
|
||||
import React, { useEffect, useMemo, useState } from "react";
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import LyricsPanel, {
|
||||
getLyricsQueryOptions,
|
||||
} from "@/components/playback/audioPlayer/components/LyricsPanel";
|
||||
import PlayerControls from "@/components/playback/audioPlayer/components/PlayerControls";
|
||||
import PlayerProgress from "@/components/playback/audioPlayer/components/PlayerProgress";
|
||||
import PlayerVolume from "@/components/playback/audioPlayer/components/PlayerVolume";
|
||||
import StatsPanel from "@/components/playback/audioPlayer/components/StatsPanel";
|
||||
import QueueView from "@/components/queue/queueView";
|
||||
import { secToTicks, ticksToSec } from "@/utils/date/time";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { getItemQueryOptions } from "@/utils/queries/items";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import {
|
||||
setIsMuted,
|
||||
setVolume,
|
||||
useAudioPlayback,
|
||||
} from "@/utils/store/audioPlayback";
|
||||
import useQueue from "@/utils/store/queue";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import useQueue, {
|
||||
cycleRepeatMode,
|
||||
type RepeatMode,
|
||||
shuffleUpcoming,
|
||||
} from "@/utils/store/queue";
|
||||
|
||||
import "./audio.scss";
|
||||
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import LyricsPanel from "@/components/playback/audioPlayer/components/LyricsPanel";
|
||||
import PlayerControls from "@/components/playback/audioPlayer/components/PlayerControls";
|
||||
import PlayerProgress from "@/components/playback/audioPlayer/components/PlayerProgress";
|
||||
import PlayerVolume from "@/components/playback/audioPlayer/components/PlayerVolume";
|
||||
import QueuePanel from "@/components/playback/audioPlayer/components/QueuePanel";
|
||||
import StatsPanel from "@/components/playback/audioPlayer/components/StatsPanel";
|
||||
import { secToTicks, ticksToSec } from "@/utils/date/time";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
|
||||
export const Route = createFileRoute("/_api/player/audio")({
|
||||
component: AudioPlayerRoute,
|
||||
});
|
||||
|
||||
const SEEK_AMOUNT = 10;
|
||||
const repeatLabels: Record<RepeatMode, string> = {
|
||||
off: "Repeat off",
|
||||
all: "Repeat all",
|
||||
one: "Repeat one",
|
||||
};
|
||||
|
||||
const AudioInfo = React.memo(
|
||||
({
|
||||
item,
|
||||
imageUrl,
|
||||
}: {
|
||||
item: BaseItemDto | undefined | null;
|
||||
imageUrl: string | undefined;
|
||||
}) => (
|
||||
<>
|
||||
<div className="audio-info-image-container">
|
||||
{imageUrl ? (
|
||||
<img
|
||||
alt={item?.Name ?? "Music"}
|
||||
src={imageUrl}
|
||||
className="audio-info-image"
|
||||
/>
|
||||
/** Artists (linked) and album (linked) for the current track. */
|
||||
const TrackSubtitle = ({ item }: { item: BaseItemDto }) => {
|
||||
const artists = item.ArtistItems?.length
|
||||
? item.ArtistItems
|
||||
: (item.AlbumArtists ?? []);
|
||||
return (
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
className="audio-now-playing-subtitle"
|
||||
noWrap
|
||||
>
|
||||
{artists.map((artist, index) => (
|
||||
<React.Fragment key={artist.Id ?? artist.Name}>
|
||||
{index > 0 && ", "}
|
||||
{artist.Id ? (
|
||||
<Link to="/music/artist/$id" params={{ id: artist.Id }}>
|
||||
{artist.Name}
|
||||
</Link>
|
||||
) : (
|
||||
<div className="audio-info-image-icon">
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{ fontSize: "inherit" }}
|
||||
>
|
||||
music_note
|
||||
</span>
|
||||
</div>
|
||||
artist.Name
|
||||
)}
|
||||
</React.Fragment>
|
||||
))}
|
||||
{item.Album && (
|
||||
<>
|
||||
{artists.length > 0 && " · "}
|
||||
{item.AlbumId ? (
|
||||
<Link to="/music/album/$id" params={{ id: item.AlbumId }}>
|
||||
{item.Album}
|
||||
</Link>
|
||||
) : (
|
||||
item.Album
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="audio-info">
|
||||
<Typography
|
||||
variant="h4"
|
||||
fontWeight={700}
|
||||
noWrap
|
||||
style={{ width: "100%", marginBottom: "0.2em" }}
|
||||
>
|
||||
{item?.Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="h6"
|
||||
fontWeight={400}
|
||||
className="opacity-07"
|
||||
noWrap
|
||||
style={{ width: "100%" }}
|
||||
>
|
||||
{item?.Artists?.join(", ")}
|
||||
</Typography>
|
||||
</div>
|
||||
</>
|
||||
),
|
||||
)}
|
||||
</Typography>
|
||||
);
|
||||
};
|
||||
|
||||
function AudioPlayerRoute() {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const [queue, currentTrack] = useQueue((s) => [s.tracks, s.currentItemIndex]);
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const navigate = useNavigate();
|
||||
const [queue, currentTrack, repeatMode] = useQueue((s) => [
|
||||
s.tracks,
|
||||
s.currentItemIndex,
|
||||
s.repeatMode,
|
||||
]);
|
||||
const [item, audioPlayerRef, volume, isMuted] = useAudioPlayback((s) => [
|
||||
s.item,
|
||||
s.player.ref,
|
||||
@@ -90,7 +107,8 @@ function AudioPlayerRoute() {
|
||||
|
||||
const [progress, setProgress] = useState(0);
|
||||
const [playing, setPlaying] = useState(false);
|
||||
const [tabValue, setTabValue] = useState(0);
|
||||
const [menuAnchor, setMenuAnchor] = useState<HTMLElement | null>(null);
|
||||
const [statsOpen, setStatsOpen] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const player = audioPlayerRef?.current;
|
||||
@@ -103,7 +121,6 @@ function AudioPlayerRoute() {
|
||||
player.addEventListener("play", updatePlaying);
|
||||
player.addEventListener("pause", updatePlaying);
|
||||
|
||||
// Initial state
|
||||
setProgress(player.currentTime);
|
||||
setPlaying(!player.paused);
|
||||
|
||||
@@ -114,19 +131,22 @@ function AudioPlayerRoute() {
|
||||
};
|
||||
}, [audioPlayerRef?.current, item?.Id]);
|
||||
|
||||
// Fresh user data so the like button reflects changes immediately.
|
||||
const itemDetails = useQuery({
|
||||
...getItemQueryOptions(item?.Id ?? "", api, user?.Id),
|
||||
enabled: Boolean(item?.Id && api && user?.Id),
|
||||
});
|
||||
const lyrics = useQuery(getLyricsQueryOptions(item, api));
|
||||
const hasLyrics = (lyrics.data?.Lyrics?.length ?? 0) > 0;
|
||||
|
||||
const handlePlayPause = () => {
|
||||
const player = audioPlayerRef?.current;
|
||||
if (player) {
|
||||
if (!player) return;
|
||||
if (player.paused) {
|
||||
player.play();
|
||||
} else {
|
||||
player.pause();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleSeek = (value: number) => {
|
||||
setProgress(ticksToSec(value));
|
||||
};
|
||||
|
||||
const handleSeekCommit = (value: number) => {
|
||||
@@ -137,23 +157,6 @@ function AudioPlayerRoute() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleRewind = () => {
|
||||
const player = audioPlayerRef?.current;
|
||||
if (player) {
|
||||
player.currentTime -= SEEK_AMOUNT;
|
||||
}
|
||||
};
|
||||
|
||||
const handleForward = () => {
|
||||
const player = audioPlayerRef?.current;
|
||||
if (player) {
|
||||
player.currentTime += SEEK_AMOUNT;
|
||||
}
|
||||
};
|
||||
const handleTabChange = (_: React.SyntheticEvent, newValue: number) => {
|
||||
setTabValue(newValue);
|
||||
};
|
||||
|
||||
const imageUrl = useMemo(
|
||||
() =>
|
||||
item?.ImageTags?.Primary
|
||||
@@ -165,6 +168,11 @@ function AudioPlayerRoute() {
|
||||
[item?.Id, item?.ImageTags?.Primary, api],
|
||||
);
|
||||
|
||||
const hasUpcoming = (queue?.length ?? 0) > currentTrack + 1;
|
||||
const isFavorite =
|
||||
itemDetails.data?.UserData?.IsFavorite ?? item?.UserData?.IsFavorite;
|
||||
const artistId = item?.ArtistItems?.[0]?.Id ?? item?.AlbumArtists?.[0]?.Id;
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="audio-background">
|
||||
@@ -172,36 +180,79 @@ function AudioPlayerRoute() {
|
||||
<img src={imageUrl} alt="" className="audio-background-image" />
|
||||
)}
|
||||
</div>
|
||||
<div className="audio-container" key={item?.Id}>
|
||||
<div className="audio-left-column">
|
||||
<AudioInfo item={item} imageUrl={imageUrl} />
|
||||
<div className="audio-container">
|
||||
<section className="audio-now-playing" key={item?.Id}>
|
||||
<div className="audio-now-playing-art">
|
||||
{imageUrl ? (
|
||||
<img alt={item?.Name ?? "Album art"} src={imageUrl} />
|
||||
) : (
|
||||
<span className="material-symbols-rounded">music_note</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="audio-now-playing-meta">
|
||||
<div className="audio-now-playing-text">
|
||||
<Typography
|
||||
variant="h5"
|
||||
sx={{
|
||||
fontWeight: 700,
|
||||
lineHeight: 1.2,
|
||||
overflowWrap: "anywhere",
|
||||
}}
|
||||
>
|
||||
{item?.Name}
|
||||
</Typography>
|
||||
{item && <TrackSubtitle item={item} />}
|
||||
</div>
|
||||
<LikeButton
|
||||
itemId={item?.Id ?? undefined}
|
||||
itemName={item?.Name}
|
||||
isFavorite={isFavorite}
|
||||
queryKey={["item", item?.Id ?? ""]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<PlayerProgress
|
||||
layout="stacked"
|
||||
progress={secToTicks(progress)}
|
||||
duration={item?.RunTimeTicks ?? 1}
|
||||
onSeek={handleSeek}
|
||||
onSeek={(value) => setProgress(ticksToSec(value))}
|
||||
onSeekCommit={handleSeekCommit}
|
||||
/>
|
||||
|
||||
<div className="audio-info-controls">
|
||||
<div className="audio-now-playing-transport">
|
||||
<Tooltip title="Shuffle upcoming">
|
||||
<span>
|
||||
<IconButton
|
||||
onClick={shuffleUpcoming}
|
||||
disabled={!hasUpcoming}
|
||||
aria-label="Shuffle upcoming"
|
||||
>
|
||||
<span className="material-symbols-rounded">shuffle</span>
|
||||
</IconButton>
|
||||
</span>
|
||||
</Tooltip>
|
||||
<PlayerControls
|
||||
playing={playing}
|
||||
onPlayPause={handlePlayPause}
|
||||
size="large"
|
||||
onRewind={handleRewind}
|
||||
onForward={handleForward}
|
||||
/>
|
||||
<Tooltip title={repeatLabels[repeatMode]}>
|
||||
<IconButton
|
||||
onClick={cycleRepeatMode}
|
||||
aria-label={repeatLabels[repeatMode]}
|
||||
className={repeatMode !== "off" ? "is-active" : undefined}
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
{repeatMode === "one" ? "repeat_one" : "repeat"}
|
||||
</span>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="audio-info-volume"
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
<div className="audio-now-playing-utility">
|
||||
<div className="audio-now-playing-volume">
|
||||
<PlayerVolume
|
||||
volume={volume}
|
||||
isMuted={isMuted}
|
||||
@@ -209,46 +260,99 @@ function AudioPlayerRoute() {
|
||||
onMuteToggle={() => setIsMuted(!isMuted)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="audio-right-column">
|
||||
<Box sx={{ borderBottom: 1, borderColor: "rgba(255,255,255,0.1)" }}>
|
||||
<Tabs
|
||||
value={tabValue}
|
||||
onChange={handleTabChange}
|
||||
aria-label="audio player tabs"
|
||||
variant="fullWidth"
|
||||
scrollButtons="auto"
|
||||
allowScrollButtonsMobile
|
||||
textColor="inherit"
|
||||
indicatorColor="primary"
|
||||
sx={{
|
||||
"& .MuiTab-root": {
|
||||
color: "rgba(255,255,255,0.5)",
|
||||
"&.Mui-selected": { color: "white" },
|
||||
},
|
||||
<IconButton
|
||||
onClick={(e) => setMenuAnchor(e.currentTarget)}
|
||||
aria-label="More options"
|
||||
>
|
||||
<span className="material-symbols-rounded">more_horiz</span>
|
||||
</IconButton>
|
||||
<Menu
|
||||
anchorEl={menuAnchor}
|
||||
open={Boolean(menuAnchor)}
|
||||
onClose={() => setMenuAnchor(null)}
|
||||
anchorOrigin={{ vertical: "top", horizontal: "right" }}
|
||||
transformOrigin={{ vertical: "bottom", horizontal: "right" }}
|
||||
>
|
||||
<MenuItem
|
||||
disabled={!item?.AlbumId}
|
||||
onClick={() => {
|
||||
setMenuAnchor(null);
|
||||
if (item?.AlbumId) {
|
||||
navigate({
|
||||
to: "/music/album/$id",
|
||||
params: { id: item.AlbumId },
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Tab label="Queue" />
|
||||
<Tab label="Lyrics" />
|
||||
<Tab label="Stats" />
|
||||
</Tabs>
|
||||
</Box>
|
||||
<ListItemIcon>
|
||||
<span className="material-symbols-rounded">album</span>
|
||||
</ListItemIcon>
|
||||
Go to album
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
disabled={!artistId}
|
||||
onClick={() => {
|
||||
setMenuAnchor(null);
|
||||
if (artistId) {
|
||||
navigate({
|
||||
to: "/music/artist/$id",
|
||||
params: { id: artistId },
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<span className="material-symbols-rounded">person</span>
|
||||
</ListItemIcon>
|
||||
Go to artist
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
setMenuAnchor(null);
|
||||
setStatsOpen(true);
|
||||
}}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<span className="material-symbols-rounded">query_stats</span>
|
||||
</ListItemIcon>
|
||||
Stats for nerds
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div className="audio-right-content">
|
||||
{tabValue === 0 && queue && (
|
||||
<QueuePanel queue={queue} currentTrackIndex={currentTrack} />
|
||||
<aside
|
||||
className={`audio-side ${hasLyrics ? "has-lyrics" : ""}`}
|
||||
aria-label="Lyrics and queue"
|
||||
>
|
||||
{hasLyrics && (
|
||||
<div className="audio-side-lyrics">
|
||||
<LyricsPanel
|
||||
item={item}
|
||||
api={api}
|
||||
currentTime={progress}
|
||||
onSeek={handleSeekCommit}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{tabValue === 1 && (
|
||||
<LyricsPanel item={item} api={api} currentTime={progress} />
|
||||
)}
|
||||
{tabValue === 2 && (
|
||||
<div className="audio-side-queue">
|
||||
<QueueView variant="panel" />
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<Dialog
|
||||
open={statsOpen}
|
||||
onClose={() => setStatsOpen(false)}
|
||||
maxWidth="sm"
|
||||
fullWidth
|
||||
>
|
||||
<DialogTitle>Stats for nerds</DialogTitle>
|
||||
<DialogContent>
|
||||
<StatsPanel item={item} audioRef={audioPlayerRef} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
||||
import { getSessionApi } from "@jellyfin/sdk/lib/utils/api/session-api";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import { WebviewWindow as appWindow } from "@tauri-apps/api/webviewWindow";
|
||||
import React, { useCallback, useEffect, useRef } from "react";
|
||||
@@ -12,14 +12,10 @@ import { RepeatMode } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { createFileRoute, useRouter } from "@tanstack/react-router";
|
||||
import JASSUB from "jassub";
|
||||
// @ts-expect-error
|
||||
import wasmUrl from "jassub/dist/wasm/jassub-worker.wasm?url"; // non-SIMD fallback
|
||||
// @ts-expect-error
|
||||
import modernWasmUrl from "jassub/dist/wasm/jassub-worker-modern.wasm?url"; // SIMD
|
||||
// @ts-expect-error
|
||||
import workerUrl from "jassub/dist/worker/worker.js?url"; // Web Worker
|
||||
import { PgsRenderer } from "libpgs";
|
||||
//@ts-expect-error
|
||||
import pgsWorkerUrl from "libpgs/dist/libpgs.worker.js?url";
|
||||
// import type { OnProgressProps } from "react-player";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
@@ -36,7 +32,6 @@ import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import useQueue, { clearQueue } from "@/utils/store/queue";
|
||||
import type subtitlePlaybackInfo from "@/utils/types/subtitlePlaybackInfo";
|
||||
//@ts-expect-error
|
||||
import font from "./Noto-Sans-Indosphere.ttf?url";
|
||||
|
||||
/**
|
||||
@@ -62,7 +57,7 @@ function addSubtitleTrackToReactPlayer(
|
||||
|
||||
const track = document.createElement("track");
|
||||
const separator = subtitleTracks.url.includes("?") ? "&" : "?";
|
||||
const urlParams = apiKey ? `${separator}api_key=${apiKey}` : "";
|
||||
const urlParams = apiKey ? `${separator}ApiKey=${apiKey}` : "";
|
||||
track.src = `${baseUrl}${subtitleTracks.url}${urlParams}`;
|
||||
track.kind = "subtitles";
|
||||
track.srclang = reqSubTrack.Language ?? "en";
|
||||
@@ -254,7 +249,7 @@ export function VideoPlayer() {
|
||||
setPlayerReady(true);
|
||||
|
||||
// Report Jellyfin server: Playback has begin
|
||||
getPlaystateApi(api).reportPlaybackStart({
|
||||
getSessionApi(api).reportPlaybackStart({
|
||||
playbackStartInfo: {
|
||||
AudioStreamIndex: mediaSource.audioTrack,
|
||||
CanSeek: true,
|
||||
@@ -297,7 +292,7 @@ export function VideoPlayer() {
|
||||
lastReportTimeRef.current = now;
|
||||
|
||||
// Report Jellyfin server: Playback progress
|
||||
getPlaystateApi(api).reportPlaybackProgress({
|
||||
getSessionApi(api).reportPlaybackProgress({
|
||||
playbackProgressInfo: {
|
||||
AudioStreamIndex: mediaSource.audioTrack,
|
||||
CanSeek: true,
|
||||
@@ -336,7 +331,7 @@ export function VideoPlayer() {
|
||||
}
|
||||
// Report Jellyfin server: Playback has been paused
|
||||
|
||||
getPlaystateApi(api).reportPlaybackProgress({
|
||||
getSessionApi(api).reportPlaybackProgress({
|
||||
playbackProgressInfo: {
|
||||
AudioStreamIndex: mediaSource.audioTrack,
|
||||
CanSeek: true,
|
||||
@@ -350,10 +345,10 @@ export function VideoPlayer() {
|
||||
PositionTicks: secToTicks(currentTime),
|
||||
RepeatMode: RepeatMode.RepeatNone,
|
||||
VolumeLevel: Math.floor(volume * 100),
|
||||
|
||||
},
|
||||
});
|
||||
}, [setCurrentTime,
|
||||
}, [
|
||||
setCurrentTime,
|
||||
api,
|
||||
mediaSource,
|
||||
isPlayerMuted,
|
||||
@@ -361,8 +356,8 @@ export function VideoPlayer() {
|
||||
itemId,
|
||||
playsessionId,
|
||||
userDataLastPlayedPositionTicks,
|
||||
volume,]);
|
||||
|
||||
volume,
|
||||
]);
|
||||
|
||||
const handleExitPlayer = useCallback(async () => {
|
||||
appWindow.getCurrent().setFullscreen(false);
|
||||
@@ -377,7 +372,7 @@ export function VideoPlayer() {
|
||||
}
|
||||
|
||||
// Report Jellyfin server: Playback has ended/stopped
|
||||
getPlaystateApi(api).reportPlaybackStopped({
|
||||
getSessionApi(api).reportPlaybackStopped({
|
||||
playbackStopInfo: {
|
||||
Failed: false,
|
||||
ItemId: itemId,
|
||||
@@ -463,7 +458,7 @@ export function VideoPlayer() {
|
||||
let pgsRenderer: PgsRenderer | undefined;
|
||||
const apiKey = api?.accessToken;
|
||||
const separator = mediaSource.subtitle.url?.includes("?") ? "&" : "?";
|
||||
const urlParams = apiKey ? `${separator}api_key=${apiKey}` : "";
|
||||
const urlParams = apiKey ? `${separator}ApiKey=${apiKey}` : "";
|
||||
|
||||
if (
|
||||
mediaSource.subtitle.format === "ass" ||
|
||||
|
||||
@@ -105,7 +105,7 @@ function PhotosPlayer() {
|
||||
|
||||
if (pathToSave) {
|
||||
download(
|
||||
`${api?.basePath}/Items/${currentPhoto?.Id}/Download?api_key=${api?.accessToken}`,
|
||||
`${api?.basePath}/Items/${currentPhoto?.Id}/Download?ApiKey=${api?.accessToken}`,
|
||||
pathToSave,
|
||||
);
|
||||
enqueueSnackbar("Image download queued.", { variant: "info" });
|
||||
@@ -122,7 +122,7 @@ function PhotosPlayer() {
|
||||
key={currentPhoto?.Id ?? "noPhoto"}
|
||||
src={
|
||||
currentPhoto
|
||||
? `${api?.basePath}/Items/${currentPhoto.Id}/Download?api_key=${api?.accessToken}`
|
||||
? `${api?.basePath}/Items/${currentPhoto.Id}/Download?ApiKey=${api?.accessToken}`
|
||||
: brokenImage
|
||||
}
|
||||
alt="Item"
|
||||
|
||||
Loaded 100 of 123 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user