Compare commits

...
4 Commits
Author SHA1 Message Date
1xDed 04ab9f767b chore(dev): enable the Tauri MCP bridge for debugging
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped
- dev-only config with withGlobalTauri and the mcp-bridge capability
- tauri:dev:mcp script runs the app with the bridge feature
- explicit capability list keeps the MCP permission out of release builds
2026-12-01 02:48:48 +03:00
1xDed e93de2beea feat(remote): remote control page for another Jellyfin client
- device list with live sessions, now-playing poster, metadata and overview
- five round transport buttons, seek bar, subtitles menu, volume, quality and fullscreen
- cover-derived wall colour, app accent and a compact service bar
- reachable from the app bar, the drawer and the audio player menu
2026-12-01 02:48:28 +03:00
1xDed 9f314582c0 feat(music): redesign the music section around the player
- album, playlist and artist pages share one layout: sleeve with a record edge, large title, metadata, full-width track list and an about block
- full-screen player: wall colour from the cover's blurhash, large sleeve, transport at the bottom, queue sliding out from under the cover
- queue rows show current/upcoming tracks with covers, hearts and durations; lyrics open in the same panel
- bottom bar follows: floating capsule, white play button and accent progress
- artist page rebuilt with a round portrait, tabs and an album grid
- music library gets a calmer grid and an aligned alphabet rail
2026-12-01 02:48:05 +03:00
1xDed fcf61012db fix(ui): unify titlebar and playback state
- window buttons live in the page header on library/search pages and in a shared chrome strip where a page has no header; removed the 44px root padding toggle that made pages jump on navigation
- video player gets its own titlebar row with window controls; the audio player hides the global app bar
- starting a video stops music and vice versa; a single track queues the rest of its album, or the artist's songs when AlbumId is missing
- album page no longer crashes on albums without AlbumArtists
- queue summary is localized
2026-12-01 02:47:40 +03:00
39 changed files with 3748 additions and 1840 deletions

No files matched your search

+1
View File
@@ -8,6 +8,7 @@
"build": "vite build", "build": "vite build",
"preview": "vite preview", "preview": "vite preview",
"tauri": "tauri", "tauri": "tauri",
"tauri:dev:mcp": "tauri dev -c src-tauri/tauri.mcp.conf.json -- --features mcp-bridge",
"lint": "biome check src/**/*", "lint": "biome check src/**/*",
"lint:fix": "biome check --apply src/**/*", "lint:fix": "biome check --apply src/**/*",
"tanstack-router-dev": "tsr watch" "tanstack-router-dev": "tsr watch"
+7
View File
@@ -0,0 +1,7 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "mcp-bridge-capability",
"description": "Dev-only permissions for the Tauri MCP bridge (AI debugging). Enabled only by tauri.mcp.conf.json.",
"windows": ["main"],
"permissions": ["mcp-bridge:default"]
}
+1 -1
View File
@@ -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-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 {"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
+1 -1
View File
@@ -1 +1 @@
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["window-state:default","global-shortcut:default","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-unregister","websocket:default","shell:default"],"platforms":["macOS","windows","linux"]},"main-capabilities":{"identifier":"main-capabilities","description":"Capability for desktop window","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","store:allow-clear","store:allow-delete","store:allow-keys","store:allow-load","updater:allow-check","updater:allow-download-and-install","updater:allow-download","updater:allow-install","notification:default","core:webview:allow-internal-toggle-devtools","core:window:allow-start-dragging","core:window:allow-start-resize-dragging","core:window:allow-minimize","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-toggle-maximize","core:window:allow-close","core:window:allow-is-maximized","dialog:default","upload:allow-download","clipboard-manager:allow-write-text","websocket:default","deep-link:default","shell:default","shell:allow-open"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default","core:window:allow-set-fullscreen","shell:default"]}} {"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["window-state:default","global-shortcut:default","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-unregister","websocket:default","shell:default"],"platforms":["macOS","windows","linux"]},"main-capabilities":{"identifier":"main-capabilities","description":"Capability for desktop window","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","store:allow-clear","store:allow-delete","store:allow-keys","store:allow-load","updater:allow-check","updater:allow-download-and-install","updater:allow-download","updater:allow-install","notification:default","core:webview:allow-internal-toggle-devtools","core:window:allow-start-dragging","core:window:allow-start-resize-dragging","core:window:allow-minimize","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-toggle-maximize","core:window:allow-close","core:window:allow-is-maximized","dialog:default","upload:allow-download","clipboard-manager:allow-write-text","websocket:default","deep-link:default","shell:default","shell:allow-open"]},"mcp-bridge-capability":{"identifier":"mcp-bridge-capability","description":"Dev-only permissions for the Tauri MCP bridge (AI debugging). Enabled only by tauri.mcp.conf.json.","local":true,"windows":["main"],"permissions":["mcp-bridge:default"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default","core:window:allow-set-fullscreen","shell:default"]}}
-162
View File
@@ -2720,168 +2720,6 @@
"const": "log:deny-log", "const": "log:deny-log",
"markdownDescription": "Denies the log command without any pre-configured scope." "markdownDescription": "Denies the log command without any pre-configured scope."
}, },
{
"description": "Default permissions for MCP Bridge plugin\n#### This default permission set includes:\n\n- `allow-capture-native-screenshot`\n- `allow-emit-event`\n- `allow-execute-command`\n- `allow-execute-js`\n- `allow-get-backend-state`\n- `allow-get-ipc-events`\n- `allow-get-window-info`\n- `allow-list-windows`\n- `allow-report-ipc-event`\n- `allow-request-script-injection`\n- `allow-script-result`\n- `allow-start-ipc-monitor`\n- `allow-stop-ipc-monitor`",
"type": "string",
"const": "mcp-bridge:default",
"markdownDescription": "Default permissions for MCP Bridge plugin\n#### This default permission set includes:\n\n- `allow-capture-native-screenshot`\n- `allow-emit-event`\n- `allow-execute-command`\n- `allow-execute-js`\n- `allow-get-backend-state`\n- `allow-get-ipc-events`\n- `allow-get-window-info`\n- `allow-list-windows`\n- `allow-report-ipc-event`\n- `allow-request-script-injection`\n- `allow-script-result`\n- `allow-start-ipc-monitor`\n- `allow-stop-ipc-monitor`"
},
{
"description": "Enables the capture_native_screenshot command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:allow-capture-native-screenshot",
"markdownDescription": "Enables the capture_native_screenshot command without any pre-configured scope."
},
{
"description": "Enables the emit_event command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:allow-emit-event",
"markdownDescription": "Enables the emit_event command without any pre-configured scope."
},
{
"description": "Enables the execute_command command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:allow-execute-command",
"markdownDescription": "Enables the execute_command command without any pre-configured scope."
},
{
"description": "Enables the execute_js command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:allow-execute-js",
"markdownDescription": "Enables the execute_js command without any pre-configured scope."
},
{
"description": "Enables the get_backend_state command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:allow-get-backend-state",
"markdownDescription": "Enables the get_backend_state command without any pre-configured scope."
},
{
"description": "Enables the get_ipc_events command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:allow-get-ipc-events",
"markdownDescription": "Enables the get_ipc_events command without any pre-configured scope."
},
{
"description": "Enables the get_window_info command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:allow-get-window-info",
"markdownDescription": "Enables the get_window_info command without any pre-configured scope."
},
{
"description": "Enables the list_windows command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:allow-list-windows",
"markdownDescription": "Enables the list_windows command without any pre-configured scope."
},
{
"description": "Enables the report_ipc_event command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:allow-report-ipc-event",
"markdownDescription": "Enables the report_ipc_event command without any pre-configured scope."
},
{
"description": "Enables the request_script_injection command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:allow-request-script-injection",
"markdownDescription": "Enables the request_script_injection command without any pre-configured scope."
},
{
"description": "Enables the script_result command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:allow-script-result",
"markdownDescription": "Enables the script_result command without any pre-configured scope."
},
{
"description": "Enables the start_ipc_monitor command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:allow-start-ipc-monitor",
"markdownDescription": "Enables the start_ipc_monitor command without any pre-configured scope."
},
{
"description": "Enables the stop_ipc_monitor command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:allow-stop-ipc-monitor",
"markdownDescription": "Enables the stop_ipc_monitor command without any pre-configured scope."
},
{
"description": "Denies the capture_native_screenshot command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:deny-capture-native-screenshot",
"markdownDescription": "Denies the capture_native_screenshot command without any pre-configured scope."
},
{
"description": "Denies the emit_event command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:deny-emit-event",
"markdownDescription": "Denies the emit_event command without any pre-configured scope."
},
{
"description": "Denies the execute_command command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:deny-execute-command",
"markdownDescription": "Denies the execute_command command without any pre-configured scope."
},
{
"description": "Denies the execute_js command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:deny-execute-js",
"markdownDescription": "Denies the execute_js command without any pre-configured scope."
},
{
"description": "Denies the get_backend_state command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:deny-get-backend-state",
"markdownDescription": "Denies the get_backend_state command without any pre-configured scope."
},
{
"description": "Denies the get_ipc_events command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:deny-get-ipc-events",
"markdownDescription": "Denies the get_ipc_events command without any pre-configured scope."
},
{
"description": "Denies the get_window_info command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:deny-get-window-info",
"markdownDescription": "Denies the get_window_info command without any pre-configured scope."
},
{
"description": "Denies the list_windows command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:deny-list-windows",
"markdownDescription": "Denies the list_windows command without any pre-configured scope."
},
{
"description": "Denies the report_ipc_event command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:deny-report-ipc-event",
"markdownDescription": "Denies the report_ipc_event command without any pre-configured scope."
},
{
"description": "Denies the request_script_injection command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:deny-request-script-injection",
"markdownDescription": "Denies the request_script_injection command without any pre-configured scope."
},
{
"description": "Denies the script_result command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:deny-script-result",
"markdownDescription": "Denies the script_result command without any pre-configured scope."
},
{
"description": "Denies the start_ipc_monitor command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:deny-start-ipc-monitor",
"markdownDescription": "Denies the start_ipc_monitor command without any pre-configured scope."
},
{
"description": "Denies the stop_ipc_monitor command without any pre-configured scope.",
"type": "string",
"const": "mcp-bridge:deny-stop-ipc-monitor",
"markdownDescription": "Denies the stop_ipc_monitor 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-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": "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", "type": "string",
+84
View File
@@ -2516,6 +2516,60 @@
"const": "core:window:deny-unminimize", "const": "core:window:deny-unminimize",
"markdownDescription": "Denies the unminimize command without any pre-configured scope." "markdownDescription": "Denies the unminimize command without any pre-configured scope."
}, },
{
"description": "Allows reading the opened deep link via the get_current command\n#### This default permission set includes:\n\n- `allow-get-current`",
"type": "string",
"const": "deep-link:default",
"markdownDescription": "Allows reading the opened deep link via the get_current command\n#### This default permission set includes:\n\n- `allow-get-current`"
},
{
"description": "Enables the get_current command without any pre-configured scope.",
"type": "string",
"const": "deep-link:allow-get-current",
"markdownDescription": "Enables the get_current command without any pre-configured scope."
},
{
"description": "Enables the is_registered command without any pre-configured scope.",
"type": "string",
"const": "deep-link:allow-is-registered",
"markdownDescription": "Enables the is_registered command without any pre-configured scope."
},
{
"description": "Enables the register command without any pre-configured scope.",
"type": "string",
"const": "deep-link:allow-register",
"markdownDescription": "Enables the register command without any pre-configured scope."
},
{
"description": "Enables the unregister command without any pre-configured scope.",
"type": "string",
"const": "deep-link:allow-unregister",
"markdownDescription": "Enables the unregister command without any pre-configured scope."
},
{
"description": "Denies the get_current command without any pre-configured scope.",
"type": "string",
"const": "deep-link:deny-get-current",
"markdownDescription": "Denies the get_current command without any pre-configured scope."
},
{
"description": "Denies the is_registered command without any pre-configured scope.",
"type": "string",
"const": "deep-link:deny-is-registered",
"markdownDescription": "Denies the is_registered command without any pre-configured scope."
},
{
"description": "Denies the register command without any pre-configured scope.",
"type": "string",
"const": "deep-link:deny-register",
"markdownDescription": "Denies the register command without any pre-configured scope."
},
{
"description": "Denies the unregister command without any pre-configured scope.",
"type": "string",
"const": "deep-link:deny-unregister",
"markdownDescription": "Denies the unregister 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-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", "type": "string",
@@ -3230,6 +3284,36 @@
"const": "upload:deny-upload", "const": "upload:deny-upload",
"markdownDescription": "Denies the upload command without any pre-configured scope." "markdownDescription": "Denies the upload command without any pre-configured scope."
}, },
{
"description": "Allows connecting and sending data to a WebSocket server\n#### This default permission set includes:\n\n- `allow-connect`\n- `allow-send`",
"type": "string",
"const": "websocket:default",
"markdownDescription": "Allows connecting and sending data to a WebSocket server\n#### This default permission set includes:\n\n- `allow-connect`\n- `allow-send`"
},
{
"description": "Enables the connect command without any pre-configured scope.",
"type": "string",
"const": "websocket:allow-connect",
"markdownDescription": "Enables the connect command without any pre-configured scope."
},
{
"description": "Enables the send command without any pre-configured scope.",
"type": "string",
"const": "websocket:allow-send",
"markdownDescription": "Enables the send command without any pre-configured scope."
},
{
"description": "Denies the connect command without any pre-configured scope.",
"type": "string",
"const": "websocket:deny-connect",
"markdownDescription": "Denies the connect command without any pre-configured scope."
},
{
"description": "Denies the send command without any pre-configured scope.",
"type": "string",
"const": "websocket:deny-send",
"markdownDescription": "Denies the send command without any pre-configured scope."
},
{ {
"description": "This permission set configures what kind of\noperations are available from the window state plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-filename`\n- `allow-restore-state`\n- `allow-save-window-state`", "description": "This permission set configures what kind of\noperations are available from the window state plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-filename`\n- `allow-restore-state`\n- `allow-save-window-state`",
"type": "string", "type": "string",
+6 -1
View File
@@ -89,7 +89,12 @@
} }
], ],
"security": { "security": {
"csp": null "csp": null,
"capabilities": [
"desktop-capability",
"main-capabilities",
"migrated"
]
} }
} }
} }
+13
View File
@@ -0,0 +1,13 @@
{
"app": {
"withGlobalTauri": true,
"security": {
"capabilities": [
"desktop-capability",
"main-capabilities",
"migrated",
"mcp-bridge-capability"
]
}
}
}
@@ -1,60 +1,111 @@
.item-info-track{ .album-track {
display: grid; display: grid;
grid-template-columns: 3em 60% 6em 1fr; grid-template-columns: 2.4em minmax(0, 1fr) 4.5em 2.6em;
gap: 1em; gap: 1em;
padding: 1em; align-items: center;
align-items: center; padding: 0.5em 1em;
cursor: pointer; border-radius: 8px;
border-radius: $border-radius-default; cursor: pointer;
transition: background $transition-time-fast; transition: background $transition-time-fast;
&.header {
border-bottom: 1px solid rgb(255 255 255 / 0.2); &-index {
color: rgb(255 255 255 / 0.7); position: relative;
border-radius: 0 !important; display: grid;
} place-items: center;
.index-container { }
justify-self: center;
position: relative; &-number {
.material-symbols-rounded { font-size: 0.8rem;
position: absolute; color: rgb(255 255 255 / 0.4);
top: 50%; font-variant-numeric: tabular-nums;
left: 50%; }
transform: translate(-50%, -50%);
font-size: 2em !important; &-play {
opacity: 0; position: absolute;
transition: none !important; top: 50%;
color: $clr-accent-default; left: 50%;
} transform: translate(-50%, -50%) scale(0.9);
} opacity: 0;
&-info { font-size: 1.4rem;
display: flex; color: #fff;
flex-direction: column; transition: opacity $transition-time-fast, transform $transition-time-fast;
gap: 0.1em }
}
&:hover { &-info {
background: rgb(255 255 255 / 0.1) !important; display: flex;
.index-container { flex-direction: column;
// font-size: 0em; gap: 0.15em;
.index { min-width: 0;
opacity: 0; }
transition: opacity 0;
} &-name {
.material-symbols-rounded { font-size: 0.95rem;
opacity: 1; color: rgb(255 255 255 / 0.92);
font-size: 2.2em !important; white-space: nowrap;
} overflow: hidden;
} text-overflow: ellipsis;
} }
&.playing {
background: rgb(0 0 0 / 0.4) !important; &-artist {
.item-info-track-info-name, .index { display: flex;
color: $clr-accent-default; align-items: center;
font-weight: 600; gap: 0.5em;
} font-size: 0.78rem;
} color: rgb(255 255 255 / 0.45);
&-container {
display: flex; img {
flex-direction: column; width: 1em;
gap: 0.4em height: 1em;
} opacity: 0.7;
}
}
&-duration {
text-align: right;
font-size: 0.8rem;
color: rgb(255 255 255 / 0.45);
font-variant-numeric: tabular-nums;
}
&-like {
display: flex;
justify-content: center;
opacity: 0;
transition: opacity $transition-time-fast;
.MuiIconButton-root {
padding: 4px;
}
}
&:hover {
background: rgb(255 255 255 / 0.06);
.album-track-number {
opacity: 0;
}
.album-track-play {
opacity: 1;
transform: translate(-50%, -50%) scale(1);
}
.album-track-like {
opacity: 1;
}
}
&.is-playing {
background: rgb(245 25 107 / 0.1);
.album-track-name,
.album-track-number,
.album-track-duration {
color: $clr-accent-default;
}
.album-track-like {
opacity: 1;
}
}
} }
+34 -40
View File
@@ -1,21 +1,19 @@
import type {
BaseItemDto,
BaseItemDtoQueryResult,
} from "@jellyfin/sdk/lib/generated-client";
import React from "react";
import { useSnackbar } from "notistack";
import lyricsIcon from "../../assets/icons/lyrics.svg";
import { getRuntimeMusic } from "@/utils/date/time";
import { import {
generateAudioStreamUrl, generateAudioStreamUrl,
playAudio, playAudio,
useAudioPlayback, useAudioPlayback,
} from "@/utils/store/audioPlayback"; } from "@/utils/store/audioPlayback";
import type {
BaseItemDto,
BaseItemDtoQueryResult,
} from "@jellyfin/sdk/lib/generated-client";
import { Typography } from "@mui/material";
import React from "react";
import { getRuntimeMusic } from "@/utils/date/time";
import { useApiInContext } from "@/utils/store/api"; import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central"; import { useCentralStore } from "@/utils/store/central";
import { setQueue } from "@/utils/store/queue"; import { setQueue } from "@/utils/store/queue";
import { useSnackbar } from "notistack";
import lyricsIcon from "../../assets/icons/lyrics.svg";
import LikeButton from "../buttons/likeButton"; import LikeButton from "../buttons/likeButton";
import "./albumMusicTrack.scss"; import "./albumMusicTrack.scss";
@@ -62,46 +60,42 @@ export default function AlbumMusicTrack(props: AlbumMusicTrackProps) {
setQueue(queue, index); setQueue(queue, index);
} }
}; };
const isPlaying = currentPlayingItem?.Id === track.Id;
const artists = track.Artists?.filter(Boolean) ?? [];
return ( return (
<div <div
className={ className={isPlaying ? "album-track is-playing" : "album-track"}
currentPlayingItem?.Id === track.Id
? "item-info-track playing"
: "item-info-track"
}
key={track.Id}
onClick={() => { onClick={() => {
if (musicTracks?.Items) { if (musicTracks?.Items) {
handlePlayback(trackIndex, track, musicTracks.Items); handlePlayback(trackIndex, track, musicTracks.Items);
} }
}} }}
> >
<div className="index-container"> <div className="album-track-index">
<span className="material-symbols-rounded fill ">play_arrow</span> <span className="material-symbols-rounded album-track-play">
<Typography className="index">{track.IndexNumber ?? "-"}</Typography> play_arrow
</span>
<span className="album-track-number">
{track.IndexNumber ?? "–"}
</span>
</div> </div>
<div className="item-info-track-info"> <div className="album-track-info">
<Typography className="item-info-track-info-name"> <span className="album-track-name">{track.Name}</span>
{track.Name} {(artists.length > 0 || track.HasLyrics) && (
</Typography> <span className="album-track-artist">
<Typography {track.HasLyrics && (
variant="subtitle2" <img src={lyricsIcon} alt="Есть текст песни" />
style={{ )}
opacity: 0.6, {artists.join(", ")}
display: "flex", </span>
alignItems: "center", )}
gap: "0.6em",
}}
sx={{
fontWeight: 300,
}}
>
{track.HasLyrics && <img src={lyricsIcon} alt="Текст песни" />}
{track.Artists?.join(", ")}
</Typography>
</div> </div>
<Typography>{getRuntimeMusic(track.RunTimeTicks ?? 0)}</Typography> <span className="album-track-duration">
<div className="flex flex-align-center"> {getRuntimeMusic(track.RunTimeTicks ?? 0)}
</span>
<div className="album-track-like" onClick={(e) => e.stopPropagation()}>
<LikeButton <LikeButton
itemId={track.Id} itemId={track.Id}
isFavorite={track.UserData?.IsFavorite} isFavorite={track.UserData?.IsFavorite}
+10 -3
View File
@@ -29,6 +29,7 @@ const HIDDEN_PATHS = [
"/settings", "/settings",
"/library", "/library",
"/search", "/search",
"/remote",
// The home page draws its own header inside the hero frame. // The home page draws its own header inside the hero frame.
"/home", "/home",
]; ];
@@ -36,9 +37,7 @@ const HIDDEN_PATHS = [
/** Whether the global app header is drawn for this route. */ /** Whether the global app header is drawn for this route. */
export const shouldShowAppBar = (pathname: string) => export const shouldShowAppBar = (pathname: string) =>
!HIDDEN_PATHS.some( !HIDDEN_PATHS.some(
(path) => (path) => pathname.startsWith(path) || pathname === "/",
(pathname.startsWith(path) && pathname !== "/player/audio") ||
pathname === "/",
); );
const AppBarContent = () => { const AppBarContent = () => {
@@ -146,6 +145,14 @@ const AppBarContent = () => {
<span className="material-symbols-rounded">search</span> <span className="material-symbols-rounded">search</span>
</IconButton> </IconButton>
</Tooltip> </Tooltip>
<Tooltip title="Пульт">
<IconButton
onClick={() => navigate({ to: "/remote" })}
aria-label="Пульт"
>
<span className="material-symbols-rounded">settings_remote</span>
</IconButton>
</Tooltip>
<Tooltip title="Избранное"> <Tooltip title="Избранное">
<IconButton <IconButton
onClick={handleNavigateToFavorite} onClick={handleNavigateToFavorite}
@@ -90,6 +90,13 @@ export const NavigationDrawer = ({ open, onClose }: NavigationDrawerProps) => {
primary="Поиск" primary="Поиск"
onClick={onClose} onClick={onClose}
/> />
<ListItemLink
className="library-drawer-item"
to="/remote"
icon="settings_remote"
primary="Пульт"
onClick={onClose}
/>
<ListItemLink <ListItemLink
className="library-drawer-item" className="library-drawer-item"
to="/favorite" to="/favorite"
+66 -1
View File
@@ -1,7 +1,10 @@
import { import {
type BaseItemDto, type BaseItemDto,
BaseItemKind, BaseItemKind,
ItemFields,
SortOrder,
} from "@jellyfin/sdk/lib/generated-client"; } 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 { getShowApi } from "@jellyfin/sdk/lib/utils/api/show-api";
import type { SxProps } from "@mui/material"; import type { SxProps } from "@mui/material";
import Button, { type ButtonProps } from "@mui/material/Button"; import Button, { type ButtonProps } from "@mui/material/Button";
@@ -131,6 +134,7 @@ const PlayButton = ({
if (audio) { if (audio) {
// Album/Individual audio track playback // Album/Individual audio track playback
const playedItem = result?.item?.Items?.[0];
const playbackUrl = generateAudioStreamUrl( const playbackUrl = generateAudioStreamUrl(
result?.item?.Items?.[0].Id, result?.item?.Items?.[0].Id,
userId, userId,
@@ -139,7 +143,68 @@ const PlayButton = ({
api.accessToken, api.accessToken,
); );
playAudio(playbackUrl, result?.item?.Items?.[0], undefined); playAudio(playbackUrl, result?.item?.Items?.[0], undefined);
setQueue(result?.item?.Items ?? [], 0);
if (
playedItem?.Type === BaseItemKind.Audio &&
(result?.item?.Items?.length ?? 0) <= 1
) {
// A single track has no queue of its own. Queue the record it
// belongs to; when the server does not expose AlbumId, fall
// back to the artist's songs so "Очередь" is never empty.
const loadQueue = async (): Promise<{
items: BaseItemDto[];
index: number;
}> => {
if (playedItem.AlbumId) {
const albumTracks = await getLibraryApi(api).getItems({
parentId: playedItem.AlbumId,
userId,
sortOrder: [SortOrder.Ascending],
sortBy: ["IndexNumber"],
fields: [ItemFields.MediaSources],
});
const items = albumTracks.data.Items ?? [];
if (items.length > 0) {
return {
items,
index: Math.max(
items.findIndex((t) => t.Id === playedItem.Id),
0,
),
};
}
}
const artistName =
playedItem.Artists?.[0] ?? playedItem.AlbumArtists?.[0]?.Name;
if (artistName) {
const artistTracks = await getLibraryApi(api).getItems({
userId,
includeItemTypes: [BaseItemKind.Audio],
artists: [artistName],
recursive: true,
sortBy: ["SortName"],
sortOrder: [SortOrder.Ascending],
fields: [ItemFields.MediaSources],
});
const items = artistTracks.data.Items ?? [];
const index = items.findIndex((t) => t.Id === playedItem.Id);
if (items.length > 1 && index >= 0) {
return { items, index };
}
}
return { items: [playedItem], index: 0 };
};
try {
const nextQueue = await loadQueue();
setQueue(nextQueue.items, nextQueue.index);
} catch (error) {
console.warn("Could not build the audio queue", error);
setQueue([playedItem], 0);
}
} else {
setQueue(result?.item?.Items ?? [], 0);
}
} else if (item.Type === "Photo") { } else if (item.Type === "Photo") {
const index = result?.item?.Items?.map((i) => i.Id).indexOf(item.Id); const index = result?.item?.Items?.map((i) => i.Id).indexOf(item.Id);
if (result?.item?.Items && index) { if (result?.item?.Items && index) {
+2
View File
@@ -25,6 +25,7 @@ import BackButton from "../buttons/backButton";
import CastButton from "../buttons/castButton"; import CastButton from "../buttons/castButton";
import { FiltersDialogTrigger } from "../filtersDialog"; import { FiltersDialogTrigger } from "../filtersDialog";
import { UserAvatarMenu } from "../userAvatarMenu"; import { UserAvatarMenu } from "../userAvatarMenu";
import WindowControls from "../windowControls";
import "./libraryHeader.scss"; import "./libraryHeader.scss";
const route = getRouteApi("/_api/library/$id"); const route = getRouteApi("/_api/library/$id");
@@ -417,6 +418,7 @@ export const LibraryHeader = () => {
<div className="material-symbols-rounded">favorite</div> <div className="material-symbols-rounded">favorite</div>
</IconButton> </IconButton>
<UserAvatarMenu /> <UserAvatarMenu />
<WindowControls />
</div> </div>
</AppBar> </AppBar>
<NavigationDrawer open={showDrawer} onClose={handleDrawerClose} /> <NavigationDrawer open={showDrawer} onClose={handleDrawerClose} />
@@ -232,12 +232,12 @@ $art-size: 48px;
display: flex; display: flex;
align-items: center; align-items: center;
width: min(1440px, calc(100% - 1.5rem)); width: min(1440px, calc(100% - 1.5rem));
height: 84px; height: 82px;
gap: 1.25rem; gap: 1.25rem;
padding: 0 0.9rem; padding: 0 0.9rem;
background: #0b0c12; background: #0b0816;
border: 1px solid rgb(255 255 255 / 0.08); border: 1px solid rgb(255 255 255 / 0.08);
border-radius: 16px; border-radius: 18px;
.media-bar { .media-bar {
&-left { &-left {
@@ -325,7 +325,7 @@ $art-size: 48px;
background: rgb(255 255 255 / 0.06); background: rgb(255 255 255 / 0.06);
} }
&.active { &.active {
color: #7cc7ff; color: $clr-accent-default;
} }
.material-symbols-rounded { .material-symbols-rounded {
font-size: 1.25rem; font-size: 1.25rem;
@@ -334,11 +334,19 @@ $art-size: 48px;
} }
&-play { &-play {
width: 42px !important; width: 46px !important;
height: 42px !important; height: 46px !important;
margin: 0 0.35rem; margin: 0 0.5rem;
border: 1px solid rgb(255 255 255 / 0.35); background: #fff !important;
color: #fff !important; border: 0;
color: #0b0417 !important;
box-shadow: 0 6px 18px rgb(0 0 0 / 0.35);
transition: transform 0.15s ease;
&:hover {
background: #fff !important;
transform: scale(1.04);
}
.material-symbols-rounded { .material-symbols-rounded {
font-size: 1.6rem !important; font-size: 1.6rem !important;
} }
@@ -350,7 +358,7 @@ $art-size: 48px;
.MuiSlider-root { .MuiSlider-root {
padding: 10px 0; padding: 10px 0;
color: #7cc7ff; color: $clr-accent-default;
} }
.MuiSlider-rail { .MuiSlider-rail {
background: rgb(255 255 255 / 0.16); background: rgb(255 255 255 / 0.16);
@@ -397,7 +405,7 @@ $art-size: 48px;
&-volume { &-volume {
width: 84px !important; width: 84px !important;
margin: 0 0.35rem 0 0 !important; margin: 0 0.35rem 0 0 !important;
color: #7cc7ff !important; color: $clr-accent-default !important;
.MuiSlider-rail { .MuiSlider-rail {
background: rgb(255 255 255 / 0.16); background: rgb(255 255 255 / 0.16);
+29 -4
View File
@@ -89,6 +89,9 @@ const AudioPlayer = () => {
const [remoteVolumeDraft, setRemoteVolumeDraft] = useState<number | null>( const [remoteVolumeDraft, setRemoteVolumeDraft] = useState<number | null>(
null, null,
); );
const remoteVolumeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(
null,
);
useEffect(() => setRemoteVolumeDraft(null), [selectedRemoteId]); useEffect(() => setRemoteVolumeDraft(null), [selectedRemoteId]);
const sessions = useQuery({ const sessions = useQuery({
@@ -132,6 +135,20 @@ const AudioPlayer = () => {
: undefined; : undefined;
remoteActiveRef.current = Boolean(remote); remoteActiveRef.current = Boolean(remote);
// Keep the picked remote volume until the target reports it back (progress
// updates can lag by seconds), then drop the optimistic value.
useEffect(() => {
if (remoteVolumeDraft == null) return;
const server = remote?.PlayState?.VolumeLevel;
if (server != null && Math.abs(server / 100 - remoteVolumeDraft) <= 0.02) {
setRemoteVolumeDraft(null);
if (remoteVolumeTimerRef.current) {
clearTimeout(remoteVolumeTimerRef.current);
remoteVolumeTimerRef.current = null;
}
}
}, [remote?.PlayState?.VolumeLevel, remoteVolumeDraft]);
const activeItem: BaseItemDto | undefined | null = const activeItem: BaseItemDto | undefined | null =
remote?.NowPlayingItem ?? item; remote?.NowPlayingItem ?? item;
const artists = activeItem?.ArtistItems?.length const artists = activeItem?.ArtistItems?.length
@@ -198,7 +215,9 @@ const AudioPlayer = () => {
// visibility rather than the DOM: during the exit animation the element is // visibility rather than the DOM: during the exit animation the element is
// still mounted but already off-screen. // still mounted but already off-screen.
const isFullPlayer = const isFullPlayer =
location.pathname === "/player" || location.pathname === "/player/audio"; location.pathname === "/player" ||
location.pathname === "/player/audio" ||
location.pathname === "/remote";
useEffect(() => { useEffect(() => {
const visible = barVisible && !isFullPlayer; const visible = barVisible && !isFullPlayer;
document.body.classList.toggle("has-player-bar", visible); document.body.classList.toggle("has-player-bar", visible);
@@ -735,7 +754,13 @@ const AudioPlayer = () => {
onChangeCommitted={(_, value) => { onChangeCommitted={(_, value) => {
if (!remote) return; if (!remote) return;
const next = Array.isArray(value) ? value[0] : value; const next = Array.isArray(value) ? value[0] : value;
setRemoteVolumeDraft(null); setRemoteVolumeDraft(next);
if (remoteVolumeTimerRef.current) {
clearTimeout(remoteVolumeTimerRef.current);
}
remoteVolumeTimerRef.current = setTimeout(() => {
setRemoteVolumeDraft(null);
}, 12000);
sendGeneral(GeneralCommandType.SetVolume, { sendGeneral(GeneralCommandType.SetVolume, {
Volume: String(Math.round(next * 100)), Volume: String(Math.round(next * 100)),
}); });
@@ -797,13 +822,13 @@ const AudioPlayer = () => {
<MenuItem <MenuItem
onClick={() => { onClick={() => {
setMoreAnchor(null); setMoreAnchor(null);
openRemoteDialog(); navigate({ to: "/remote" });
}} }}
> >
<ListItemIcon> <ListItemIcon>
<span className="material-symbols-rounded">settings_remote</span> <span className="material-symbols-rounded">settings_remote</span>
</ListItemIcon> </ListItemIcon>
<ListItemText primary="Удалённое управление…" /> <ListItemText primary="Удалённый пульт" />
</MenuItem> </MenuItem>
<Divider /> <Divider />
<MenuItem <MenuItem
@@ -20,13 +20,24 @@
--media-object-fit: fill; --media-object-fit: fill;
} }
&-drag-region { &-titlebar {
position: absolute; position: absolute;
inset: 0 0 auto; inset: 0 0 auto;
height: 38px; z-index: 3;
z-index: 4; display: flex;
cursor: default; align-items: center;
gap: 0.75em;
padding: 4px 8px;
min-height: 46px;
user-select: none; user-select: none;
&-end {
display: flex;
align-items: center;
gap: 0.5em;
margin-left: auto;
min-width: 0;
}
} }
&-osd { &-osd {
@@ -53,22 +64,16 @@
} }
&-back, &-back,
&-actions { &-actions {
position: absolute;
top: 2em;
z-index: 3;
display: flex; display: flex;
align-items: center; align-items: center;
flex: 0 0 auto;
padding: 0.3em; padding: 0.3em;
border-radius: 999px; border-radius: 999px;
border: 1px solid rgb(255 255 255 / 0.08); border: 1px solid rgb(255 255 255 / 0.08);
background: rgb(0 0 0 / 0.28); background: rgb(0 0 0 / 0.28);
backdrop-filter: blur(12px); backdrop-filter: blur(12px);
} }
&-back {
left: 3em;
}
&-actions { &-actions {
right: 3em;
gap: 0.35em; gap: 0.35em;
} }
&-info { &-info {
@@ -118,3 +123,26 @@
} }
} }
} }
// The window is frameless outside macOS: the player draws the titlebar row and
// the window buttons in the same strip the rest of the app uses on Windows and
// Linux, so they sit on the window edge instead of floating over the picture.
// macOS keeps its native traffic lights inside the overlay titlebar, so the
// player only has to clear them.
html.is-macos .video-player-titlebar {
padding-left: 84px;
padding-top: 14px;
min-height: 60px;
}
html.is-macos .video-player-titlebar.is-fullscreen {
padding-left: 8px;
padding-top: 4px;
min-height: 46px;
}
// A faded-out OSD keeps its buttons clickable otherwise; the titlebar would
// then catch clicks in the top corners while invisible.
.video-player-osd:not(.hovering) .video-player-titlebar {
pointer-events: none;
}
+56 -121
View File
@@ -15,9 +15,9 @@ import PlayNextButton from "@/components/buttons/playNextButton";
import PlayPreviousButton from "@/components/buttons/playPreviousButtom"; import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
import QueueButton from "@/components/buttons/queueButton"; import QueueButton from "@/components/buttons/queueButton";
import BubbleSlider from "@/components/playback/videoPlayer/bubbleSlider"; import BubbleSlider from "@/components/playback/videoPlayer/bubbleSlider";
import WindowControls from "@/components/windowControls";
import { secToTicks, ticksToSec } from "@/utils/date/time"; import { secToTicks, ticksToSec } from "@/utils/date/time";
import { buildPlayDeepLink } from "@/utils/deepLinks"; import { buildPlayDeepLink } from "@/utils/deepLinks";
import { getPlayerVideoElement } from "@/utils/methods/pictureInPicture";
import { openSyncPlayDialog } from "@/utils/methods/syncPlay"; import { openSyncPlayDialog } from "@/utils/methods/syncPlay";
import { useApiInContext } from "@/utils/store/api"; import { useApiInContext } from "@/utils/store/api";
import { useShareStore } from "@/utils/store/share"; import { useShareStore } from "@/utils/store/share";
@@ -88,6 +88,7 @@ const VideoPlayerControls = ({
isPlayerPlaying, isPlayerPlaying,
toggleIsPlaying, toggleIsPlaying,
toggleIsPlayerFullscreen, toggleIsPlayerFullscreen,
isPlayerFullscreen,
isUserSeeking, isUserSeeking,
// seekValue, // seekValue,
isPlayerMuted, isPlayerMuted,
@@ -112,6 +113,7 @@ const VideoPlayerControls = ({
playsessionId: state.playsessionId, playsessionId: state.playsessionId,
toggleIsPlaying: state.toggleIsPlaying, toggleIsPlaying: state.toggleIsPlaying,
toggleIsPlayerFullscreen: state.toggleIsPlayerFullscreen, toggleIsPlayerFullscreen: state.toggleIsPlayerFullscreen,
isPlayerFullscreen: state.playerState.isPlayerFullscreen,
isUserSeeking: state.playerState.isUserSeeking, isUserSeeking: state.playerState.isUserSeeking,
seekValue: state.playerState.seekValue, seekValue: state.playerState.seekValue,
isPlayerMuted: state.playerState.isPlayerMuted, isPlayerMuted: state.playerState.isPlayerMuted,
@@ -153,69 +155,6 @@ const VideoPlayerControls = ({
const [settingsMenuRef, setSettingsMenuRef] = const [settingsMenuRef, setSettingsMenuRef] =
useState<HTMLButtonElement | null>(null); useState<HTMLButtonElement | null>(null);
const [videoFrame, setVideoFrame] = useState<{
top: number;
left: number;
right: number;
} | null>(null);
// Keep the back button and the top action buttons on one line inside the
// visible video area, below any letterbox bars.
useEffect(() => {
let frame = 0;
const update = () => {
const video = getPlayerVideoElement();
if (!video) return;
const rect = video.getBoundingClientRect();
const ratio =
video.videoWidth > 0 && video.videoHeight > 0
? video.videoWidth / video.videoHeight
: null;
const contentWidth = ratio
? Math.min(rect.width, rect.height * ratio)
: rect.width;
const contentHeight = ratio ? contentWidth / ratio : rect.height;
const contentLeft = rect.left + (rect.width - contentWidth) / 2;
const contentTop = rect.top + (rect.height - contentHeight) / 2;
setVideoFrame((current) => {
const next = {
// 14% keeps the controls inside the picture even when the
// file has letterbox bars baked into a 16:9 frame.
top: Math.round(
contentTop + Math.max(28, contentHeight * 0.14),
),
left: Math.round(contentLeft + 24),
right: Math.round(
window.innerWidth - contentLeft - contentWidth + 24,
),
};
return current?.top === next.top &&
current?.left === next.left &&
current?.right === next.right
? current
: next;
});
};
const schedule = () => {
cancelAnimationFrame(frame);
frame = requestAnimationFrame(update);
};
schedule();
const video = getPlayerVideoElement();
video?.addEventListener("loadedmetadata", schedule);
window.addEventListener("resize", schedule);
const interval = window.setInterval(schedule, 1000);
return () => {
cancelAnimationFrame(frame);
window.clearInterval(interval);
video?.removeEventListener("loadedmetadata", schedule);
window.removeEventListener("resize", schedule);
};
}, [playsessionId]);
// const creditInfo = mediaSegments?.Items?.find( // const creditInfo = mediaSegments?.Items?.find(
// (segment) => segment.Type === "Outro", // (segment) => segment.Type === "Outro",
@@ -301,64 +240,60 @@ const VideoPlayerControls = ({
}} }}
> >
<div <div
className="video-player-osd-back" className={`video-player-titlebar${isPlayerFullscreen ? " is-fullscreen" : ""}`}
style={ data-tauri-drag-region
videoFrame
? { top: videoFrame.top, left: videoFrame.left }
: undefined
}
> >
<IconButton <div className="video-player-osd-back">
onClick={handleExitPlayer} <IconButton
aria-label="Выйти из плеера" onClick={handleExitPlayer}
title="Выйти из плеера" aria-label="Выйти из плеера"
> title="Выйти из плеера"
<span className="material-symbols-rounded">arrow_back</span> >
</IconButton> <span className="material-symbols-rounded">arrow_back</span>
</div> </IconButton>
<div </div>
className="video-player-osd-actions" <div className="video-player-titlebar-end">
style={ <div className="video-player-osd-actions">
videoFrame <IconButton
? { top: videoFrame.top, right: videoFrame.right } onClick={() =>
: undefined useShareStore
} .getState()
> .openShareDialog(
<IconButton buildPlayDeepLink(
onClick={() => itemId ?? "",
useShareStore currentTime > 0
.getState() ? ticksToSec(currentTime)
.openShareDialog( : getCurrentTime(),
buildPlayDeepLink( ),
itemId ?? "", "Поделиться этой сценой",
currentTime > 0 ? ticksToSec(currentTime) : getCurrentTime(), )
), }
"Поделиться этой сценой", aria-label="Поделиться сценой"
) title="Поделиться сценой"
} >
aria-label="Поделиться сценой" <span className="material-symbols-rounded">share</span>
title="Поделиться сценой" </IconButton>
> <IconButton
<span className="material-symbols-rounded">share</span> onClick={openSyncPlayDialog}
</IconButton> aria-label="Смотреть вместе"
<IconButton title="Смотреть вместе"
onClick={openSyncPlayDialog} >
aria-label="Смотреть вместе" <span className="material-symbols-rounded">groups</span>
title="Смотреть вместе" </IconButton>
> <IconButton
<span className="material-symbols-rounded">groups</span> onClick={(e) => setSettingsMenuRef(e.currentTarget)}
</IconButton> aria-label="Настройки плеера"
<IconButton title="Настройки плеера"
onClick={(e) => setSettingsMenuRef(e.currentTarget)} >
aria-label="Настройки плеера" <span className="material-symbols-rounded">settings</span>
title="Настройки плеера" </IconButton>
> <VideoPlayerSettingsMenu
<span className="material-symbols-rounded">settings</span> settingsMenuRef={settingsMenuRef}
</IconButton> handleClose={() => setSettingsMenuRef(null)}
<VideoPlayerSettingsMenu />
settingsMenuRef={settingsMenuRef} </div>
handleClose={() => setSettingsMenuRef(null)} {!isPlayerFullscreen && <WindowControls />}
/> </div>
</div> </div>
<div className="video-player-osd-info"> <div className="video-player-osd-info">
<div> <div>
+11 -1
View File
@@ -132,9 +132,19 @@ const QueueView = ({ variant, onClose }: QueueViewProps) => {
]); ]);
}; };
const tracksLabel = (count: number) => {
const mod10 = count % 10;
const mod100 = count % 100;
if (mod10 === 1 && mod100 !== 11) return `${count} трек`;
if (mod10 >= 2 && mod10 <= 4 && (mod100 < 12 || mod100 > 14)) {
return `${count} трека`;
}
return `${count} треков`;
};
const summary = const summary =
upcoming.length > 0 upcoming.length > 0
? `${upcoming.length} ${upcoming.length === 1 ? "track" : "tracks"} · ${getRuntimeCompact(upcomingTicks)}` ? `${tracksLabel(upcoming.length)} · ${getRuntimeCompact(upcomingTicks)}`
: "Очередь пуста"; : "Очередь пуста";
return ( return (
+24 -20
View File
@@ -1,5 +1,5 @@
import { useLocation } from "@tanstack/react-router"; import { useLocation } from "@tanstack/react-router";
import React, { useEffect } from "react"; import React from "react";
import { shouldShowAppBar } from "@/components/appBar/appBar"; import { shouldShowAppBar } from "@/components/appBar/appBar";
import WindowControls from "."; import WindowControls from ".";
@@ -7,11 +7,29 @@ import "./windowControls.scss";
const isMac = navigator.userAgent.includes("Macintosh"); const isMac = navigator.userAgent.includes("Macintosh");
const WindowChromeContent = () => { /**
useEffect(() => { * Frameless-window fallback for pages that do not draw the app header:
document.body.classList.add("has-window-chrome"); * a small drag strip plus the window buttons in the top-right corner.
return () => document.body.classList.remove("has-window-chrome"); *
}, []); * Pages with a header (home, library, search, player) put the window buttons
* in that header's row instead, so every page has one titlebar plane and the
* buttons never float over the avatar or the page controls.
*/
const WindowChrome = () => {
const { pathname } = useLocation();
if (isMac) return null;
// The global app header owns the window buttons on these routes.
if (shouldShowAppBar(pathname)) return null;
// The home page draws its own header inside the hero frame.
if (pathname === "/home") return null;
// The video/photo players have their own fullscreen UI.
if (pathname.startsWith("/player")) return null;
// Library and search headers draw the window buttons themselves.
if (pathname.startsWith("/library") || pathname.startsWith("/search")) {
return null;
}
// The remote control page has its own titlebar with window buttons.
if (pathname.startsWith("/remote")) return null;
return ( return (
<div className="window-chrome"> <div className="window-chrome">
@@ -23,18 +41,4 @@ const WindowChromeContent = () => {
); );
}; };
/**
* Frameless-window fallback for pages that do not draw the app header:
* a small drag strip plus the window buttons in the top-right corner.
*/
const WindowChrome = () => {
const { pathname } = useLocation();
if (isMac) return null;
if (pathname === "/home" || shouldShowAppBar(pathname)) return null;
// The video player has its own fullscreen UI.
if (pathname.startsWith("/player")) return null;
return <WindowChromeContent />;
};
export default WindowChrome; export default WindowChrome;
@@ -41,18 +41,6 @@ html.is-linux .home-header .window-controls {
margin-left: 0.6rem; margin-left: 0.6rem;
} }
// Reserve a strip for the custom titlebar on routes without the app header.
html.is-windows body.has-window-chrome #root,
html.is-linux body.has-window-chrome #root {
padding-top: 44px;
}
// Search uses a fixed header; move it below the custom titlebar strip.
html.is-windows body.has-window-chrome .search-header,
html.is-linux body.has-window-chrome .search-header {
top: calc(1em + 44px) !important;
}
.window-resize-handles { .window-resize-handles {
position: fixed; position: fixed;
inset: 0; inset: 0;
+21
View File
@@ -12,6 +12,7 @@ import { Route as rootRouteImport } from './routes/__root'
import { Route as IndexRouteImport } from './routes/index' import { Route as IndexRouteImport } from './routes/index'
import { Route as ApiRouteImport } from './routes/_api' import { Route as ApiRouteImport } from './routes/_api'
import { Route as ApiLoginRouteImport } from './routes/_api/login' import { Route as ApiLoginRouteImport } from './routes/_api/login'
import { Route as ApiRemoteRouteImport } from './routes/_api/remote'
import { Route as ApiSettingsRouteImport } from './routes/_api/settings' import { Route as ApiSettingsRouteImport } from './routes/_api/settings'
import { Route as ErrorCodeRouteImport } from './routes/error/$code' import { Route as ErrorCodeRouteImport } from './routes/error/$code'
import { Route as ApiFavoriteIndexRouteImport } from './routes/_api/favorite/index' import { Route as ApiFavoriteIndexRouteImport } from './routes/_api/favorite/index'
@@ -49,6 +50,11 @@ const ApiLoginRoute = ApiLoginRouteImport.update({
path: '/login', path: '/login',
getParentRoute: () => ApiRoute, getParentRoute: () => ApiRoute,
} as any) } as any)
const ApiRemoteRoute = ApiRemoteRouteImport.update({
id: '/remote',
path: '/remote',
getParentRoute: () => ApiRoute,
} as any)
const ApiSettingsRoute = ApiSettingsRouteImport.update({ const ApiSettingsRoute = ApiSettingsRouteImport.update({
id: '/settings', id: '/settings',
path: '/settings', path: '/settings',
@@ -164,6 +170,7 @@ const ApiSettingsChangeServerIndexRoute =
export interface FileRoutesByFullPath { export interface FileRoutesByFullPath {
'/': typeof IndexRoute '/': typeof IndexRoute
'/login': typeof ApiLoginRouteWithChildren '/login': typeof ApiLoginRouteWithChildren
'/remote': typeof ApiRemoteRoute
'/settings': typeof ApiSettingsRouteWithChildren '/settings': typeof ApiSettingsRouteWithChildren
'/error/$code': typeof ErrorCodeRoute '/error/$code': typeof ErrorCodeRoute
'/item/$id': typeof ApiItemIdRoute '/item/$id': typeof ApiItemIdRoute
@@ -190,6 +197,7 @@ export interface FileRoutesByFullPath {
export interface FileRoutesByTo { export interface FileRoutesByTo {
'/': typeof IndexRoute '/': typeof IndexRoute
'/login': typeof ApiLoginRouteWithChildren '/login': typeof ApiLoginRouteWithChildren
'/remote': typeof ApiRemoteRoute
'/settings': typeof ApiSettingsRouteWithChildren '/settings': typeof ApiSettingsRouteWithChildren
'/error/$code': typeof ErrorCodeRoute '/error/$code': typeof ErrorCodeRoute
'/item/$id': typeof ApiItemIdRoute '/item/$id': typeof ApiItemIdRoute
@@ -218,6 +226,7 @@ export interface FileRoutesById {
'/': typeof IndexRoute '/': typeof IndexRoute
'/_api': typeof ApiRouteWithChildren '/_api': typeof ApiRouteWithChildren
'/_api/login': typeof ApiLoginRouteWithChildren '/_api/login': typeof ApiLoginRouteWithChildren
'/_api/remote': typeof ApiRemoteRoute
'/_api/settings': typeof ApiSettingsRouteWithChildren '/_api/settings': typeof ApiSettingsRouteWithChildren
'/error/$code': typeof ErrorCodeRoute '/error/$code': typeof ErrorCodeRoute
'/_api/item/$id': typeof ApiItemIdRoute '/_api/item/$id': typeof ApiItemIdRoute
@@ -246,6 +255,7 @@ export interface FileRouteTypes {
fullPaths: fullPaths:
| '/' | '/'
| '/login' | '/login'
| '/remote'
| '/settings' | '/settings'
| '/error/$code' | '/error/$code'
| '/item/$id' | '/item/$id'
@@ -272,6 +282,7 @@ export interface FileRouteTypes {
to: to:
| '/' | '/'
| '/login' | '/login'
| '/remote'
| '/settings' | '/settings'
| '/error/$code' | '/error/$code'
| '/item/$id' | '/item/$id'
@@ -299,6 +310,7 @@ export interface FileRouteTypes {
| '/' | '/'
| '/_api' | '/_api'
| '/_api/login' | '/_api/login'
| '/_api/remote'
| '/_api/settings' | '/_api/settings'
| '/error/$code' | '/error/$code'
| '/_api/item/$id' | '/_api/item/$id'
@@ -355,6 +367,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof ApiLoginRouteImport preLoaderRoute: typeof ApiLoginRouteImport
parentRoute: typeof ApiRoute parentRoute: typeof ApiRoute
} }
'/_api/remote': {
id: '/_api/remote'
path: '/remote'
fullPath: '/remote'
preLoaderRoute: typeof ApiRemoteRouteImport
parentRoute: typeof ApiRoute
}
'/_api/settings': { '/_api/settings': {
id: '/_api/settings' id: '/_api/settings'
path: '/settings' path: '/settings'
@@ -546,6 +565,7 @@ const ApiSettingsRouteWithChildren = ApiSettingsRoute._addFileChildren(
interface ApiRouteChildren { interface ApiRouteChildren {
ApiLoginRoute: typeof ApiLoginRouteWithChildren ApiLoginRoute: typeof ApiLoginRouteWithChildren
ApiRemoteRoute: typeof ApiRemoteRoute
ApiSettingsRoute: typeof ApiSettingsRouteWithChildren ApiSettingsRoute: typeof ApiSettingsRouteWithChildren
ApiItemIdRoute: typeof ApiItemIdRoute ApiItemIdRoute: typeof ApiItemIdRoute
ApiLibraryIdRoute: typeof ApiLibraryIdRoute ApiLibraryIdRoute: typeof ApiLibraryIdRoute
@@ -562,6 +582,7 @@ interface ApiRouteChildren {
const ApiRouteChildren: ApiRouteChildren = { const ApiRouteChildren: ApiRouteChildren = {
ApiLoginRoute: ApiLoginRouteWithChildren, ApiLoginRoute: ApiLoginRouteWithChildren,
ApiRemoteRoute: ApiRemoteRoute,
ApiSettingsRoute: ApiSettingsRouteWithChildren, ApiSettingsRoute: ApiSettingsRouteWithChildren,
ApiItemIdRoute: ApiItemIdRoute, ApiItemIdRoute: ApiItemIdRoute,
ApiLibraryIdRoute: ApiLibraryIdRoute, ApiLibraryIdRoute: ApiLibraryIdRoute,
+17 -2
View File
@@ -98,14 +98,29 @@ function Library() {
} */ } */
return ( return (
<main className="scrollY library padded-top"> <main
className={`scrollY library padded-top${
currentLib.data.CollectionType === "music"
? " music-library music-page"
: ""
}`}
>
<LibraryHeader /> <LibraryHeader />
<Suspense fallback={<LibraryItemsSkeleton />}> <Suspense fallback={<LibraryItemsSkeleton />}>
<div className="library-items"> <div className="library-items">
<LibraryItemsGrid /> <LibraryItemsGrid />
</div> </div>
<div style={{ position: "fixed", right: 14, top: 80 }}> <div
style={{
position: "fixed",
right:
currentLib.data.CollectionType === "music"
? "max(14px, calc((100vw - 1180px) / 2 + 18px))"
: 14,
top: 80,
}}
>
<AlphaSelector /> <AlphaSelector />
</div> </div>
</Suspense> </Suspense>
+163 -175
View File
@@ -2,34 +2,41 @@ import { BaseItemKind, SortOrder } from "@jellyfin/sdk/lib/generated-client";
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api"; import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
import Box from "@mui/material/Box"; import Box from "@mui/material/Box";
import CircularProgress from "@mui/material/CircularProgress"; import CircularProgress from "@mui/material/CircularProgress";
import Typography from "@mui/material/Typography"; import { createFileRoute, Link } from "@tanstack/react-router";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
import React, { useLayoutEffect, useMemo } from "react"; import React, { useLayoutEffect, useMemo } from "react";
import LikeButton from "@/components/buttons/likeButton"; import AlbumMusicTrack from "@/components/albumMusicTrack";
import InstantMixButton from "@/components/buttons/instantMixButton"; import InstantMixButton from "@/components/buttons/instantMixButton";
import LikeButton from "@/components/buttons/likeButton";
import PlayButton from "@/components/buttons/playButton"; import PlayButton from "@/components/buttons/playButton";
import { Card } from "@/components/card/card"; import { Card } from "@/components/card/card";
import CardScroller from "@/components/cardScroller/cardScroller"; import CardScroller from "@/components/cardScroller/cardScroller";
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice"; import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
import { getTypeIcon } from "@/components/utils/iconsCollection";
import { getRuntimeCompact } from "@/utils/date/time";
import { useBackdropStore } from "@/utils/store/backdrop";
import "./album.scss";
import { Chip } from "@mui/material";
import { createFileRoute, Link } from "@tanstack/react-router";
import { createPortal } from "react-dom";
import AlbumMusicTrack from "@/components/albumMusicTrack";
import ShowMoreText from "@/components/showMoreText"; import ShowMoreText from "@/components/showMoreText";
import TagChip from "@/components/tagChip"; import TagChip from "@/components/tagChip";
import { getTypeIcon } from "@/components/utils/iconsCollection";
import { getRuntimeCompact } from "@/utils/date/time";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi"; import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api"; import { useApiInContext } from "@/utils/store/api";
import { useBackdropStore } from "@/utils/store/backdrop";
import { useCentralStore } from "@/utils/store/central"; import { useCentralStore } from "@/utils/store/central";
import "../music.scss";
export const Route = createFileRoute("/_api/music/album/$id")({ export const Route = createFileRoute("/_api/music/album/$id")({
component: MusicAlbumTitlePage, component: MusicAlbumTitlePage,
}); });
const tracksLabel = (count: number) => {
const mod10 = count % 10;
const mod100 = count % 100;
if (mod10 === 1 && mod100 !== 11) return `${count} трек`;
if (mod10 >= 2 && mod10 <= 4 && (mod100 < 12 || mod100 > 14)) {
return `${count} трека`;
}
return `${count} треков`;
};
function MusicAlbumTitlePage() { function MusicAlbumTitlePage() {
const { id } = Route.useParams(); const { id } = Route.useParams();
const api = useApiInContext((s) => s.api); const api = useApiInContext((s) => s.api);
@@ -120,7 +127,7 @@ function MusicAlbumTitlePage() {
} }
}, [item.isSuccess, item.data, setBackdrop]); }, [item.isSuccess, item.data, setBackdrop]);
if (item.isPending || similarItems.isPending) { if (item.isPending) {
return ( return (
<Box <Box
sx={{ sx={{
@@ -135,170 +142,153 @@ function MusicAlbumTitlePage() {
</Box> </Box>
); );
} }
if (item.isSuccess && item.data && similarItems.isSuccess) {
if (item.isError) {
return <ErrorNotice />;
}
if (item.isSuccess && item.data) {
const trackCount = musicTracks.data?.TotalRecordCount ?? 0;
const genres = item.data.GenreItems ?? [];
const artistId = item.data.AlbumArtists?.[0]?.Id;
const coverUrl =
api && item.data.ImageTags?.Primary
? getImageUrlsApi(api).getItemImageUrlById(
item.data.Id ?? "",
"Primary",
{
tag: item.data.ImageTags.Primary,
quality: 90,
},
)
: null;
return ( return (
<div key={id} className="scrollY padded-top item item-album"> <div key={id} className="scrollY padded-top music-page">
<div className="item-info"> <header className="music-hero">
<Typography className="item-info-name" variant="h3"> <div className="music-cover">
{item.data?.Name} <div className="music-cover-disc" aria-hidden="true" />
</Typography> {coverUrl ? (
<div className="flex flex-align-center item-info-album-info"> <img src={coverUrl} alt={item.data.Name ?? "Альбом"} />
{/* @ts-ignore - Using Link as component */}
<Link
to="/music/artist/$id"
params={{ id: item.data.AlbumArtists?.[0].Id ?? "" }}
>
<Chip
// component={Link}
className="flex flex-align-center"
style={{
color: "white",
textDecoration: "none",
}}
icon={
<span
className="material-symbols-rounded fill"
style={{
paddingLeft: "0.25em",
}}
>
artist
</span>
}
label={item.data.AlbumArtist}
/>
</Link>
<Typography className="opacity-07">
{item.data.ProductionYear}
</Typography>
<Typography className="opacity-07">
{(musicTracks.data?.TotalRecordCount ?? 0) > 1
? `${musicTracks.data?.TotalRecordCount} песен`
: "Сингл"}
</Typography>
<Typography className="opacity-07">
{getRuntimeCompact(item.data.CumulativeRunTimeTicks ?? 0)}
</Typography>
</div>
<div className="item-info-buttons">
<PlayButton
item={item.data}
audio
itemType={item.data.Type ?? "Audio"}
userId={user?.Id}
/>
<InstantMixButton item={item.data} />
<LikeButton
itemId={item.data.Id}
isFavorite={item.data.UserData?.IsFavorite}
queryKey={["item", "musicTracks"]}
userId={user?.Id}
itemName={item.data.Name}
/>
</div>
<div className="item-info-track-container ">
{allDiscs.length > 1 ? (
allDiscs.map((disc) => (
<div className="item-info-disc-container" key={disc}>
<div
className="item-info-disc-header flex flex-row flex-align-center"
style={{ marginBottom: "1em" }}
>
<span
className="material-symbols-rounded"
style={{ fontSize: "2em" }}
>
album
</span>
<Typography variant="h5">Диск {disc}</Typography>
</div>
<div className="item-info-track header">
<span className="material-symbols-rounded index">tag</span>
<Typography variant="subtitle1">Название</Typography>
<Typography variant="subtitle1">Длительность</Typography>
</div>
{musicTracks.data?.Items?.map(
(track, index) =>
track.ParentIndexNumber === disc && (
<AlbumMusicTrack
key={track.Id}
track={track}
trackIndex={index}
musicTracks={musicTracks.data}
/>
),
)}
</div>
))
) : ( ) : (
<div> <div className="music-cover-fallback">
<div className="item-info-track header"> {getTypeIcon("MusicAlbum")}
<span className="material-symbols-rounded index">tag</span> </div>
<Typography variant="subtitle1">Название</Typography> )}
<Typography variant="subtitle1">Длительность</Typography> </div>
</div> <div className="music-hero-info">
{musicTracks.data?.Items?.map((track, index) => ( <div className="music-eyebrow">
<AlbumMusicTrack {trackCount > 1 ? "Альбом" : "Сингл"}
key={track.Id} {item.data.ProductionYear
track={track} ? ` · ${item.data.ProductionYear}`
trackIndex={index} : ""}
musicTracks={musicTracks.data} </div>
<h1 className="music-title">{item.data.Name}</h1>
{artistId ? (
<Link
to="/music/artist/$id"
params={{ id: artistId }}
className="music-artist"
>
{item.data.AlbumArtist}
</Link>
) : (
<span className="music-artist">{item.data.AlbumArtist}</span>
)}
<div className="music-meta">
<span>{tracksLabel(trackCount)}</span>
<span className="music-meta-dot" />
<span>
{getRuntimeCompact(item.data.CumulativeRunTimeTicks ?? 0)}
</span>
</div>
<div className="music-actions">
<PlayButton
item={item.data}
audio
itemType={item.data.Type ?? "Audio"}
userId={user?.Id}
/>
<InstantMixButton item={item.data} />
<LikeButton
itemId={item.data.Id}
isFavorite={item.data.UserData?.IsFavorite}
queryKey={["item", "musicTracks"]}
userId={user?.Id}
itemName={item.data.Name}
/>
</div>
</div>
</header>
<section className="music-tracks" aria-label="Треки">
<div className="music-tracks-head">
<span>#</span>
<span>Название</span>
<span>Время</span>
<span />
</div>
{allDiscs.length > 1 ? (
allDiscs.map((disc) => (
<div key={disc} className="music-disc">
<h2 className="music-disc-title">Диск {disc}</h2>
{musicTracks.data?.Items?.map((track, index) =>
track.ParentIndexNumber === disc ? (
<AlbumMusicTrack
key={track.Id}
track={track}
trackIndex={index}
musicTracks={musicTracks.data ?? null}
/>
) : null,
)}
</div>
))
) : (
musicTracks.data?.Items?.map((track, index) => (
<AlbumMusicTrack
key={track.Id}
track={track}
trackIndex={index}
musicTracks={musicTracks.data ?? null}
/>
))
)}
{trackCount === 0 && (
<p className="music-empty">Треки не найдены</p>
)}
</section>
{(genres.length > 0 || item.data.Overview) && (
<section className="music-about">
<h2>Об альбоме</h2>
{genres.length > 0 && (
<div className="music-genres">
{genres.map((genre) => (
<TagChip
label={genre.Name ?? "жанр"}
key={genre.Id}
/> />
))} ))}
</div> </div>
)} )}
</div> {item.data.Overview && (
</div>
{createPortal(
<div className="item-info-sidebar">
<div className="item-info-sidebar-image-container">
{item.data.ImageTags?.Primary ? (
<img
className="item-info-sidebar-image"
alt={item.data.Name ?? "Album"}
src={
api &&
getImageUrlsApi(api).getItemImageUrlById(
item.data.Id ?? "",
"Primary",
{
tag: item.data.ImageTags.Primary,
quality: 90,
},
)
}
/>
) : (
<div className="item-info-sidebar-icon">
{getTypeIcon("MusicAlbum")}
</div>
)}
</div>
<div
className="flex flex-align-center"
style={{ gap: "1em", flexWrap: "wrap" }}
>
{item.data.GenreItems?.map((genre) => (
<TagChip label={genre.Name ?? "genre"} key={genre.Id} />
))}
</div>
<div className="item-info-sidebar-overview">
<ShowMoreText <ShowMoreText
content={item.data.Overview ?? ""} content={item.data.Overview}
collapsedLines={4} collapsedLines={5}
/> />
</div> )}
</div>, </section>
document.body,
)} )}
{(similarItems.data?.TotalRecordCount ?? 0) > 0 && ( {(similarItems.data?.TotalRecordCount ?? 0) > 0 && (
<CardScroller <div className="music-similar">
title="Вам может понравиться" <CardScroller
displayCards={5} title="Вам может понравиться"
disableDecoration displayCards={5}
> disableDecoration
{similarItems.data?.Items?.map((similar) => { >
return ( {similarItems.data?.Items?.map((similar) => (
<Card <Card
key={similar.Id} key={similar.Id}
item={similar} item={similar}
@@ -315,9 +305,10 @@ function MusicAlbumTitlePage() {
: similar.Type === BaseItemKind.Series : similar.Type === BaseItemKind.Series
? `${similar.ProductionYear} - ${ ? `${similar.ProductionYear} - ${
similar.EndDate similar.EndDate
? new Date(similar.EndDate).toLocaleString("ru-RU", { ? new Date(similar.EndDate).toLocaleString(
year: "numeric", "ru-RU",
}) { year: "numeric" },
)
: "н.в." : "н.в."
}` }`
: similar.ProductionYear : similar.ProductionYear
@@ -331,16 +322,13 @@ function MusicAlbumTitlePage() {
queryKey={["item", id, "similarItem"]} queryKey={["item", id, "similarItem"]}
userId={user?.Id} userId={user?.Id}
/> />
); ))}
})} </CardScroller>
</CardScroller> </div>
)} )}
</div> </div>
); );
} }
if (item.isError || similarItems.isError) {
return <ErrorNotice />;
}
} }
export default MusicAlbumTitlePage; export default MusicAlbumTitlePage;
-229
View File
@@ -1,229 +0,0 @@
$border-radius: 20px;
.item-album {
width: 70vw;
padding-right: 2.2em;
.item-info {
display: flex;
flex-direction: column;
gap: 1.2em;
&-container {
grid-template-columns: 1fr 25%;
display: grid;
gap: 3em;
}
&-album-info {
gap: 1.2em;
}
&-buttons {
display: flex;
gap: 1em;
}
&-disc-header{
padding: 1em 2em;
background: hsla(0, 0, 100%, 10%);
border-radius: 100px;
gap: 1em;
margin-top: 1em;
}
}
}
.item-info-sidebar {
display: flex;
flex-direction: column;
gap: 1em;
position: fixed;
// max-height: 100vh;
top: 0;
right: 0;
width: 30vw;
padding: 4.4em;
padding-left: 2.2em;
&-image {
width: 100%;
object-fit: cover;
border-radius: $border-radius-default;
}
&-artist {
display: flex;
gap: 1em;
align-items: center;
padding: 1em 0;
color: rgb(255 255 255 / 0.7);
transition: $transition-time-default;
cursor: pointer;
text-decoration: none;
&:hover {
color: rgb(255 255 255)
}
&-image {
width: 100%;
height: 100%;
object-fit: cover;
z-index: 1;
position: relative;
&-container {
width: 3em;
aspect-ratio: 1;
border-radius: 100%;
overflow: hidden;
position: relative;
.material-symbols-rounded {
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background: rgb(255 255 255 / 0.1);
z-index: 0;
}
}
}
&-container {
// max-height: 20em;/
overflow-y: auto;
overflow-x: hidden;
}
}
&-overview {
overflow-y: auto;
max-height: 28vh;
padding-bottom: 2px;
}
}
.item-detail-album {
&-track {
display: grid;
grid-template-columns: 4% 1fr 80% 1fr;
align-items: center;
justify-items: center;
gap: 0.5em;
width: 100%;
padding: 0.25em 0;
background: rgb(0 0 0 / 0.4);
transition: background $transition-time-default;
backdrop-filter: blur(5px);
&:first-child {
border-radius: $border-radius $border-radius 8px 8px;
cursor: default !important;
}
&:last-child {
border-radius: 8px 8px $border-radius $border-radius;
}
border-radius: 8px;
&s {
background: transparent !important;
box-shadow: none !important;
display: flex;
flex-direction: column;
gap: 5px;
}
&:hover {
background: rgb(0 0 0 / 0.5);
cursor: pointer;
}
&.playing {
color: $clr-accent-default;
}
}
}
$cardWidth: 22%;
.item-album.item {
.item-detail {
display: grid;
grid-template-columns: 1fr 35%;
justify-items: center;
align-items: start;
gap: 3em;
&-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;
gap: 1em;
}
&-grid {
display: grid;
gap: 1em;
margin-bottom: 1em;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
&-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;
}
}
&-episodes-container {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 0.25em;
margin-top: 0.5em;
align-items: start;
justify-items: center;
}
}
}
@media (max-width: 1320px) {
.item-album .item-detail {
&-cast {
&-grid {
grid-template-columns: 1fr;
}
}
}
}
+183 -303
View File
@@ -6,42 +6,29 @@ import {
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api"; import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
import Box from "@mui/material/Box"; import Box from "@mui/material/Box";
import CircularProgress from "@mui/material/CircularProgress"; 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,
useEffect,
useLayoutEffect,
useRef,
useState,
} from "react";
import LikeButton from "@/components/buttons/likeButton";
import InstantMixButton from "@/components/buttons/instantMixButton";
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 { 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 IconButton from "@mui/material/IconButton";
import Tooltip from "@mui/material/Tooltip"; import Tooltip from "@mui/material/Tooltip";
import { useQuery } from "@tanstack/react-query";
import { createFileRoute } from "@tanstack/react-router"; import { createFileRoute } from "@tanstack/react-router";
import React, { useEffect, useMemo, useState } from "react";
import type { Api } from "@jellyfin/sdk";
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import AlbumMusicTrack from "@/components/albumMusicTrack";
import InstantMixButton from "@/components/buttons/instantMixButton";
import LikeButton from "@/components/buttons/likeButton";
import PlayButton from "@/components/buttons/playButton";
import { Card } from "@/components/card/card";
import IconLink from "@/components/iconLink"; import IconLink from "@/components/iconLink";
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
import ShowMoreText from "@/components/showMoreText";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useBackdropStore } from "@/utils/store/backdrop";
import { useCentralStore } from "@/utils/store/central"; import { useCentralStore } from "@/utils/store/central";
import { playItemFromQueue } from "@/utils/store/playback"; import { playItemFromQueue } from "@/utils/store/playback";
import { setQueue } from "@/utils/store/queue"; import { setQueue } from "@/utils/store/queue";
import "../music.scss";
/** Queues the given tracks in random order and starts playing. */ /** Queues the given tracks in random order and starts playing. */
const shuffleAndPlay = ( const shuffleAndPlay = (
tracks: BaseItemDto[], tracks: BaseItemDto[],
@@ -57,33 +44,20 @@ const shuffleAndPlay = (
playItemFromQueue(0, userId, api); playItemFromQueue(0, userId, api);
}; };
type TabPanelProp = {
children: ReactNode;
index: number;
value: number;
};
function TabPanel(props: TabPanelProp) {
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 && <Box>{children}</Box>}
</div>
);
}
export const Route = createFileRoute("/_api/music/artist/$id")({ export const Route = createFileRoute("/_api/music/artist/$id")({
component: ArtistTitlePage, component: ArtistTitlePage,
}); });
const plural = (count: number, one: string, few: string, many: string) => {
const mod10 = count % 10;
const mod100 = count % 100;
if (mod10 === 1 && mod100 !== 11) return `${count} ${one}`;
if (mod10 >= 2 && mod10 <= 4 && (mod100 < 12 || mod100 > 14)) {
return `${count} ${few}`;
}
return `${count} ${many}`;
};
function ArtistTitlePage() { function ArtistTitlePage() {
const { id } = Route.useParams(); const { id } = Route.useParams();
const api = Route.useRouteContext().api; const api = Route.useRouteContext().api;
@@ -158,36 +132,31 @@ function ArtistTitlePage() {
}); });
const artistTabs = [ const artistTabs = [
{ title: "Дискография", data: artistDiscography }, {
{ title: "Песни", data: artistSongs }, key: "discography",
{ title: "Участие", data: artistAppearances }, title: "Дискография",
count: artistDiscography.data?.TotalRecordCount ?? 0,
},
{
key: "songs",
title: "Песни",
count: artistSongs.data?.TotalRecordCount ?? 0,
},
{
key: "appearances",
title: "Участие",
count: artistAppearances.data?.TotalRecordCount ?? 0,
},
]; ];
const [activeArtistTab, setActiveArtistTab] = useState(0); const [activeTab, setActiveTab] = useState("discography");
useLayoutEffect(() => { useEffect(() => {
if ( if (artistDiscography.data && artistSongs.data && artistAppearances.data) {
artistDiscography.isSuccess && if (artistDiscography.data.TotalRecordCount) setActiveTab("discography");
artistSongs.isSuccess && else if (artistSongs.data.TotalRecordCount) setActiveTab("songs");
artistAppearances.isSuccess && else if (artistAppearances.data.TotalRecordCount) setActiveTab("appearances");
artistDiscography.data &&
artistSongs.data &&
artistAppearances.data
) {
if (artistDiscography.data.TotalRecordCount !== 0) {
setActiveArtistTab(0);
} else if (artistSongs.data.TotalRecordCount !== 0) {
setActiveArtistTab(1);
} else if (artistAppearances.data.TotalRecordCount !== 0) {
setActiveArtistTab(2);
}
} }
}, [ }, [artistDiscography.data, artistSongs.data, artistAppearances.data]);
artistDiscography.isSuccess,
artistSongs.isSuccess,
artistAppearances.isSuccess,
]);
const [animationDirection, setAnimationDirection] = useState("forward");
const setBackdrop = useBackdropStore((s) => s.setBackdrop); const setBackdrop = useBackdropStore((s) => s.setBackdrop);
const backdropTag = item.data?.BackdropImageTags?.[0]; const backdropTag = item.data?.BackdropImageTags?.[0];
@@ -197,20 +166,30 @@ function ArtistTitlePage() {
setBackdrop(backdropHash); setBackdrop(backdropHash);
}, [backdropHash, setBackdrop]); }, [backdropHash, setBackdrop]);
const scrollTargetRef = useRef<HTMLDivElement | null>(null); const albumCount = artistDiscography.data?.TotalRecordCount ?? 0;
const songCount = artistSongs.data?.TotalRecordCount ?? 0;
const pluralize = (count: number, word: string) => const portraitUrl = useMemo(
`${count} ${count === 1 ? word : `${word}s`}`; () =>
const catalogueSummary = [ api && item.data?.ImageTags?.Primary
artistDiscography.data?.TotalRecordCount ? getImageUrlsApi(api).getItemImageUrlById(
? pluralize(artistDiscography.data.TotalRecordCount, "album") item.data.Id ?? "",
"Primary",
{ quality: 90 },
)
: undefined,
[api, item.data?.Id, item.data?.ImageTags?.Primary],
);
const metaItems = [
albumCount > 0 ? plural(albumCount, "альбом", "альбома", "альбомов") : null,
songCount > 0 ? plural(songCount, "песня", "песни", "песен") : null,
item.data?.PremiereDate
? new Date(item.data.PremiereDate).toLocaleDateString("ru-RU", {
year: "numeric",
})
: null, : null,
artistSongs.data?.TotalRecordCount ].filter(Boolean);
? pluralize(artistSongs.data.TotalRecordCount, "song")
: null,
]
.filter(Boolean)
.join(" · ");
if (item.isPending) { if (item.isPending) {
return ( return (
@@ -227,39 +206,42 @@ function ArtistTitlePage() {
</Box> </Box>
); );
} }
if (item.isError) {
return <ErrorNotice />;
}
if (item.isSuccess && item.data) { if (item.isSuccess && item.data) {
return ( return (
<motion.div <div key={id} className="scrollY padded-top music-page music-artist-page">
key={id} <header className="music-hero music-hero-artist">
initial={{ <div className="music-portrait">
opacity: 0, {portraitUrl ? (
}} <img src={portraitUrl} alt={item.data.Name ?? "Исполнитель"} />
animate={{ ) : (
opacity: 1, <span className="material-symbols-rounded">person</span>
}} )}
transition={{ </div>
duration: 0.25, <div className="music-hero-info">
ease: "easeInOut", <div className="music-eyebrow">Исполнитель</div>
}} <h1 className="music-title">{item.data.Name}</h1>
className="scrollY item item-artist" {metaItems.length > 0 && (
> <div className="music-meta">
<div ref={scrollTargetRef} /> {metaItems.map((meta, index) => (
<ItemHeader <React.Fragment key={String(meta)}>
item={item.data} {index > 0 && <span className="music-meta-dot" />}
api={api} <span>{meta}</span>
scrollTargetRef={scrollTargetRef} </React.Fragment>
> ))}
<div className="item-hero-buttons-container"> </div>
<div className="flex flex-row" style={{ width: "100%" }}> )}
<div className="music-actions">
<PlayButton <PlayButton
item={item.data} item={item.data}
itemType={BaseItemKind.MusicArtist} itemType={BaseItemKind.MusicArtist}
userId={user?.Id} userId={user?.Id}
audio audio
buttonProps={{ fullWidth: true }}
/> />
</div>
<div className="flex flex-row" style={{ gap: "1em" }}>
<Tooltip title="Перемешать"> <Tooltip title="Перемешать">
<span> <span>
<IconButton <IconButton
@@ -286,201 +268,99 @@ function ArtistTitlePage() {
userId={user?.Id} userId={user?.Id}
/> />
</div> </div>
</div> {item.data.Overview && (
</ItemHeader> <div className="music-artist-about">
<div className="item-detail"> <ShowMoreText
<div style={{ width: "100%", overflow: "hidden" }}> content={item.data.Overview}
{catalogueSummary && ( collapsedLines={3}
<Typography sx={{ opacity: 0.8, mb: 1.5 }}>
{catalogueSummary}
</Typography>
)}
<ShowMoreText
content={item.data.Overview ?? ""}
collapsedLines={4}
/>
<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
style={{
width: "100%",
}}
>
{item.data.PremiereDate && (
<div>
<Typography variant="h5">Дата рождения</Typography>
<Typography sx={{ opacity: 0.8 }}>
{new Date(item.data.PremiereDate).toLocaleDateString("ru-RU")}
</Typography>
</div> </div>
)} )}
{item.data.EndDate && ( {(item.data.ExternalUrls?.length ?? 0) > 0 && (
<div> <div className="music-links">
<Typography {item.data.ExternalUrls?.map((url) => (
variant="h5" <IconLink
sx={{ url={url.Url ?? ""}
mt: 2, name={url.Name ?? ""}
}} key={url.Url}
>
Дата смерти
</Typography>
<Typography sx={{ opacity: 0.8 }}>
{new Date(item.data.EndDate).toLocaleDateString("ru-RU")}
</Typography>
</div>
)}
</div>
</div>
<div className="item-detail-artist-container">
<div className="item-detail-artist-header">
<Tabs
variant="scrollable"
value={activeArtistTab}
onChange={(_, newVal) => {
if (newVal > activeArtistTab) {
setAnimationDirection("forward");
} else if (newVal < activeArtistTab) {
setAnimationDirection("backwards");
}
setActiveArtistTab(newVal);
}}
>
{artistTabs.map((tab) => {
return (
<Tab
key={tab.title}
label={tab.title}
disabled={tab.data.data?.TotalRecordCount === 0}
/> />
); ))}
})} </div>
</Tabs> )}
<Divider />
</div> </div>
<AnimatePresence> </header>
<TabPanel value={activeArtistTab} index={0}>
<motion.div <nav className="music-tabs" aria-label="Разделы исполнителя">
key={activeArtistTab} {artistTabs.map((tab) => (
initial={{ <button
opacity: 0, key={tab.key}
transform: type="button"
animationDirection === "forward" className={activeTab === tab.key ? "is-active" : undefined}
? "translate(30px)" disabled={tab.count === 0}
: "translate(-30px)", onClick={() => setActiveTab(tab.key)}
}} >
animate={{ {tab.title}
opacity: 1, {tab.count > 0 && <span>{tab.count}</span>}
transform: "translate(0px)", </button>
}} ))}
transition={{ </nav>
duration: 0.2,
ease: "anticipate", {activeTab === "discography" && (
}} <div className="music-album-grid">
> {artistDiscography.data?.Items?.map((album) => (
{user && <Card
artistDiscography.data?.Items?.map((tabitem) => { key={album.Id}
return ( item={album}
<ArtistAlbum cardTitle={album.Name}
key={tabitem.Id} imageType={"Primary"}
user={user} cardCaption={album.ProductionYear}
album={tabitem} cardType={"square"}
/> queryKey={["item", id, "artist", "discography"]}
); userId={user?.Id}
})} />
</motion.div> ))}
</TabPanel> </div>
<TabPanel value={activeArtistTab} index={1}> )}
<motion.div
key={activeArtistTab} {activeTab === "songs" && (
initial={{ <section className="music-tracks" aria-label="Песни">
opacity: 0, <div className="music-tracks-head">
transform: <span>#</span>
animationDirection === "forward" <span>Название</span>
? "translate(30px)" <span>Время</span>
: "translate(-30px)", <span />
}} </div>
animate={{ {artistSongs.data?.Items?.map((track, index) => (
opacity: 1, <AlbumMusicTrack
transform: "translate(0px)", key={track.Id}
}} track={track}
transition={{ trackIndex={index}
duration: 0.2, musicTracks={artistSongs.data ?? null}
ease: "anticipate", />
}} ))}
> {songCount === 0 && <p className="music-empty">Песен пока нет</p>}
{artistSongs.isSuccess && </section>
artistSongs.data?.Items?.map((tabitem) => { )}
return (
<MusicTrack {activeTab === "appearances" && (
item={tabitem} <div className="music-album-grid">
key={tabitem.Id} {artistAppearances.data?.Items?.map((album) => (
queryKey={["item", id, "artist", "songs"]} <Card
userId={user?.Id} key={album.Id}
/> item={album}
); cardTitle={album.Name}
})} imageType={"Primary"}
</motion.div> cardCaption={album.AlbumArtist}
</TabPanel> cardType={"square"}
<TabPanel value={activeArtistTab} index={2}> queryKey={["item", id, "artist", "appearences"]}
<motion.div userId={user?.Id}
key={activeArtistTab} />
initial={{ ))}
opacity: 0, </div>
transform: )}
animationDirection === "forward" </div>
? "translate(30px)"
: "translate(-30px)",
}}
animate={{
opacity: 1,
transform: "translate(0px)",
}}
transition={{
duration: 0.2,
ease: "anticipate",
}}
className="grid"
>
{artistAppearances.isSuccess &&
artistAppearances.data?.Items?.map((tabitem) => {
return (
<Card
key={tabitem.Id}
item={tabitem}
cardTitle={tabitem.Name}
imageType={"Primary"}
cardCaption={tabitem.AlbumArtist}
cardType={"square"}
queryKey={["item", id, "artist", "appearences"]}
userId={user?.Id}
/>
);
})}
</motion.div>
</TabPanel>
</AnimatePresence>
</div>
</motion.div>
); );
} }
if (item.isError) {
return <ErrorNotice />;
}
} }
export default ArtistTitlePage; export default ArtistTitlePage;
+365
View File
@@ -0,0 +1,365 @@
/**
* Shared layout for the music pages (album, playlist): "Полка".
*
* The cover is the object, the track list is the main content. No fixed
* sidebar, no duplicate cover on the right — the page reads top to bottom.
*/
.music-page {
max-width: 1180px;
margin: 0 auto;
padding: clamp(3.4em, 6vw, 4.6em) clamp(1.5em, 4vw, 3.5em) 7em;
.music-hero {
display: flex;
align-items: flex-end;
gap: clamp(1.6em, 3.4vw, 3.2em);
margin-bottom: clamp(2em, 4vw, 3.4em);
}
.music-cover {
position: relative;
flex: 0 0 auto;
width: clamp(170px, 19vw, 250px);
aspect-ratio: 1;
img,
.music-cover-fallback {
position: relative;
z-index: 1;
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 6px;
box-shadow: 0 22px 48px rgb(0 0 0 / 0.55);
}
.music-cover-fallback {
display: grid;
place-items: center;
background: rgb(255 255 255 / 0.06);
color: rgb(255 255 255 / 0.5);
font-size: 3rem;
}
}
// A vinyl record peeking out of the sleeve.
.music-cover-disc {
position: absolute;
z-index: 0;
top: 7%;
right: -14%;
width: 86%;
aspect-ratio: 1;
border-radius: 50%;
background: repeating-radial-gradient(
circle at 50% 50%,
#191322 0 2px,
#0c0815 2px 4px
);
box-shadow: 0 12px 32px rgb(0 0 0 / 0.55);
}
.music-hero-info {
min-width: 0;
padding-bottom: 0.3em;
}
.music-eyebrow {
font-size: 0.72rem;
font-weight: 500;
letter-spacing: 0.22em;
text-transform: uppercase;
color: rgb(255 255 255 / 0.45);
}
.music-title {
margin: 0.35em 0 0.4em;
font-size: clamp(2.2rem, 4.6vw, 3.8rem);
font-weight: 600;
line-height: 0.98;
letter-spacing: -0.02em;
color: #fff;
overflow-wrap: anywhere;
}
.music-artist {
display: inline-flex;
width: fit-content;
padding-bottom: 2px;
border-bottom: 1px solid rgb(255 255 255 / 0.16);
font-size: 1rem;
color: rgb(255 255 255 / 0.8);
text-decoration: none;
transition: color $transition-time-fast, border-color $transition-time-fast;
&:hover {
color: #fff;
border-color: rgb(255 255 255 / 0.5);
}
}
.music-meta {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0.7em;
margin-top: 1em;
font-size: 0.85rem;
color: rgb(255 255 255 / 0.5);
}
.music-meta-dot {
width: 3px;
height: 3px;
border-radius: 50%;
background: currentColor;
opacity: 0.7;
}
.music-actions {
display: flex;
align-items: center;
gap: 0.5em;
margin-top: 1.6em;
}
.music-tracks {
margin-top: 1em;
}
.music-tracks-head {
display: grid;
grid-template-columns: 2.4em minmax(0, 1fr) 4.5em 2.6em;
gap: 1em;
align-items: center;
padding: 0 1em 0.7em;
border-bottom: 1px solid rgb(255 255 255 / 0.08);
font-size: 0.7rem;
letter-spacing: 0.16em;
text-transform: uppercase;
color: rgb(255 255 255 / 0.35);
span:nth-child(3) {
text-align: right;
}
}
.music-disc-title {
margin: 1.8em 1em 0.3em;
font-size: 0.72rem;
font-weight: 600;
letter-spacing: 0.18em;
text-transform: uppercase;
color: rgb(255 255 255 / 0.4);
}
.music-empty {
padding: 1.6em 1em;
font-size: 0.9rem;
color: rgb(255 255 255 / 0.4);
}
.music-about {
max-width: 66ch;
margin-top: 3em;
padding-top: 2em;
border-top: 1px solid rgb(255 255 255 / 0.07);
h2 {
margin: 0 0 0.8em;
font-size: 0.75rem;
font-weight: 600;
letter-spacing: 0.18em;
text-transform: uppercase;
color: rgb(255 255 255 / 0.45);
}
> div,
> p {
font-size: 0.9rem;
line-height: 1.65;
color: rgb(255 255 255 / 0.62);
}
}
.music-genres {
display: flex;
flex-wrap: wrap;
gap: 0.4em;
margin-bottom: 1em;
}
.music-similar {
margin-top: 3.4em;
}
}
@media (max-width: 900px) {
.music-page {
.music-hero {
flex-direction: column;
align-items: flex-start;
}
.music-cover {
width: min(52vw, 220px);
}
}
}
/* ------------------------------------------------------------------ artist */
.music-page .music-portrait {
flex: 0 0 auto;
width: clamp(150px, 16vw, 230px);
aspect-ratio: 1;
overflow: hidden;
border-radius: 50%;
background: rgb(255 255 255 / 0.06);
box-shadow: 0 24px 50px rgb(0 0 0 / 0.5), 0 0 0 1px rgb(255 255 255 / 0.1);
img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
> .material-symbols-rounded {
display: grid;
place-items: center;
width: 100%;
height: 100%;
font-size: 5rem;
color: rgb(255 255 255 / 0.4);
background: linear-gradient(
160deg,
rgb(255 255 255 / 0.09),
rgb(255 255 255 / 0.02)
);
}
}
.music-page .music-hero-artist .music-title {
font-size: clamp(1.9rem, 3.8vw, 3.2rem);
}
.music-artist-about {
max-width: 64ch;
margin-top: 1.1em;
font-size: 0.9rem;
line-height: 1.6;
color: rgb(255 255 255 / 0.6);
}
.music-links {
display: flex;
gap: 0.6em;
margin-top: 0.9em;
}
.music-tabs {
display: flex;
flex-wrap: wrap;
gap: 0.15em;
margin-top: 0.5em;
padding-bottom: 0.6em;
border-bottom: 1px solid rgb(255 255 255 / 0.08);
button {
display: inline-flex;
align-items: center;
gap: 0.5em;
padding: 0.5em 1em;
border: 0;
border-radius: 999px;
background: transparent;
color: rgb(255 255 255 / 0.5);
font: inherit;
font-size: 0.85rem;
cursor: pointer;
transition: background-color 0.15s ease, color 0.15s ease;
span {
font-size: 0.7rem;
color: rgb(255 255 255 / 0.35);
font-variant-numeric: tabular-nums;
}
&:hover:not(:disabled) {
color: #fff;
background: rgb(255 255 255 / 0.05);
}
&.is-active {
background: rgb(255 255 255 / 0.1);
color: #fff;
span {
color: rgb(255 255 255 / 0.7);
}
}
&:disabled {
opacity: 0.3;
cursor: default;
}
}
}
.music-album-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
gap: 1.4em;
margin-top: 1.8em;
}
/* --------------------------------------------------------------- library */
.music-library-band {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 1.5em;
flex-wrap: wrap;
margin-bottom: 0.4em;
.music-title {
margin-bottom: 0.15em;
}
}
.music-library {
// Album shelf: deeper corners, a soft lift and a calmer hover veil than
// the rest of the media grid.
.card {
transition: transform 0.2s ease;
}
.card:hover {
transform: translateY(-3px);
}
.card-image-container {
border-radius: 10px;
box-shadow: 0 10px 24px rgb(0 0 0 / 0.32);
}
.card-overlay {
background: linear-gradient(
180deg,
rgb(0 0 0 / 0) 40%,
rgb(0 0 0 / 0.6)
);
backdrop-filter: none;
}
.card-play-button .MuiFab-root {
width: 46px;
height: 46px;
min-height: 46px;
background: #fff;
color: #0b0417;
box-shadow: 0 8px 20px rgb(0 0 0 / 0.4);
}
}
+128 -117
View File
@@ -1,36 +1,41 @@
import React, { useEffect } from "react";
import Box from "@mui/material/Box";
import CircularProgress from "@mui/material/CircularProgress";
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client"; import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api"; import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
import { getPlaylistApi } from "@jellyfin/sdk/lib/utils/api/playlist-api"; import { getPlaylistApi } from "@jellyfin/sdk/lib/utils/api/playlist-api";
import Box from "@mui/material/Box";
import CircularProgress from "@mui/material/CircularProgress";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
import { createFileRoute } from "@tanstack/react-router";
import { Card } from "@/components/card/card"; import React, { useEffect } from "react";
import CardScroller from "@/components/cardScroller/cardScroller";
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
import { useBackdropStore } from "@/utils/store/backdrop";
import "./playlist.scss";
import AlbumMusicTrack from "@/components/albumMusicTrack"; import AlbumMusicTrack from "@/components/albumMusicTrack";
import LikeButton from "@/components/buttons/likeButton"; import LikeButton from "@/components/buttons/likeButton";
import PlayButton from "@/components/buttons/playButton"; import PlayButton from "@/components/buttons/playButton";
import { Card } from "@/components/card/card";
import CardScroller from "@/components/cardScroller/cardScroller";
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
import ShowMoreText from "@/components/showMoreText"; import ShowMoreText from "@/components/showMoreText";
import TagChip from "@/components/tagChip"; import TagChip from "@/components/tagChip";
import { getTypeIcon } from "@/components/utils/iconsCollection"; import { getTypeIcon } from "@/components/utils/iconsCollection";
import { getRuntimeCompact } from "@/utils/date/time"; import { getRuntimeCompact } from "@/utils/date/time";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi"; import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useBackdropStore } from "@/utils/store/backdrop";
import { useCentralStore } from "@/utils/store/central"; import { useCentralStore } from "@/utils/store/central";
import { Typography } from "@mui/material";
import { createFileRoute } from "@tanstack/react-router"; import "../music.scss";
import { createPortal } from "react-dom";
export const Route = createFileRoute("/_api/music/playlist/$id")({ export const Route = createFileRoute("/_api/music/playlist/$id")({
component: PlaylistTitlePage, component: PlaylistTitlePage,
}); });
const tracksLabel = (count: number) => {
const mod10 = count % 10;
const mod100 = count % 100;
if (mod10 === 1 && mod100 !== 11) return `${count} трек`;
if (mod10 >= 2 && mod10 <= 4 && (mod100 < 12 || mod100 > 14)) {
return `${count} трека`;
}
return `${count} треков`;
};
function PlaylistTitlePage() { function PlaylistTitlePage() {
const { id } = Route.useParams(); const { id } = Route.useParams();
const api = Route.useRouteContext().api; const api = Route.useRouteContext().api;
@@ -92,7 +97,7 @@ function PlaylistTitlePage() {
} }
}, [item.isSuccess, setAppBackdrop]); }, [item.isSuccess, setAppBackdrop]);
if (item.isPending || similarItems.isPending) { if (item.isPending) {
return ( return (
<Box <Box
sx={{ sx={{
@@ -107,106 +112,114 @@ function PlaylistTitlePage() {
</Box> </Box>
); );
} }
if (item.isSuccess && item.data && similarItems.isSuccess) {
if (item.isError) {
return <ErrorNotice />;
}
if (item.isSuccess && item.data) {
const trackCount = musicTracks.data?.TotalRecordCount ?? 0;
const genres = item.data.GenreItems ?? [];
const coverUrl =
api && item.data.ImageTags?.Primary
? getImageUrlsApi(api).getItemImageUrlById(
item.data.Id ?? "",
"Primary",
{
tag: item.data.ImageTags.Primary,
quality: 90,
},
)
: null;
return ( return (
<div key={id} className="scrollY padded-top item item-playlist"> <div key={id} className="scrollY padded-top music-page">
<div className="item-info"> <header className="music-hero">
<Typography className="item-info-name" variant="h3"> <div className="music-cover">
{item.data?.Name} <div className="music-cover-disc" aria-hidden="true" />
</Typography> {coverUrl ? (
<div className="flex flex-align-center item-info-playlist-info"> <img src={coverUrl} alt={item.data.Name ?? "Плейлист"} />
<Typography className="opacity-07"> ) : (
{(musicTracks.data?.TotalRecordCount ?? 0) > 1 <div className="music-cover-fallback">
? `${musicTracks.data?.TotalRecordCount} песен` {getTypeIcon("Playlist")}
: "Сингл"}
</Typography>
<Typography className="opacity-07">
{getRuntimeCompact(item.data.CumulativeRunTimeTicks ?? 0)}
</Typography>
</div>
<div className="item-info-buttons">
<PlayButton
item={item.data}
audio
itemType={item.data.Type ?? "Playlist"}
userId={user?.Id}
/>
<LikeButton
itemId={item.data.Id}
isFavorite={item.data.UserData?.IsFavorite}
queryKey={["item"]}
userId={user?.Id}
itemName={item.data.Name}
/>
</div>
<div className="item-info-track-container ">
<div>
<div className="item-info-track header">
<span className="material-symbols-rounded index">tag</span>
<Typography variant="subtitle1">Название</Typography>
<Typography variant="subtitle1">Длительность</Typography>
</div> </div>
{musicTracks.data?.Items?.map((track, index) => ( )}
<AlbumMusicTrack
key={track.Id}
track={track}
trackIndex={index}
musicTracks={musicTracks.data}
/>
))}
</div>
</div> </div>
</div> <div className="music-hero-info">
{createPortal( <div className="music-eyebrow">Плейлист</div>
<div className="item-info-sidebar"> <h1 className="music-title">{item.data.Name}</h1>
<div className="item-info-sidebar-image-container"> <div className="music-meta">
{item.data.ImageTags?.Primary ? ( <span>{tracksLabel(trackCount)}</span>
<img <span className="music-meta-dot" />
className="item-info-sidebar-image" <span>
alt={item.data.Name ?? "Playlist"} {getRuntimeCompact(item.data.CumulativeRunTimeTicks ?? 0)}
src={ </span>
api &&
getImageUrlsApi(api).getItemImageUrlById(
item.data.Id ?? "",
"Primary",
{
tag: item.data.ImageTags.Primary,
quality: 90,
},
)
}
/>
) : (
<div className="item-info-sidebar-icon">
{getTypeIcon("Playlist")}
</div>
)}
</div> </div>
<div <div className="music-actions">
className="flex flex-align-center" <PlayButton
style={{ gap: "1em", flexWrap: "wrap" }} item={item.data}
> audio
{item.data.GenreItems?.map((genre) => ( itemType={item.data.Type ?? "Playlist"}
<TagChip label={genre.Name ?? "genre"} key={genre.Id} /> userId={user?.Id}
))} />
</div> <LikeButton
<div className="item-info-sidebar-overview"> itemId={item.data.Id}
<ShowMoreText isFavorite={item.data.UserData?.IsFavorite}
content={item.data.Overview ?? ""} queryKey={["item"]}
collapsedLines={4} userId={user?.Id}
itemName={item.data.Name}
/> />
</div> </div>
</div>, </div>
document.body, </header>
<section className="music-tracks" aria-label="Треки">
<div className="music-tracks-head">
<span>#</span>
<span>Название</span>
<span>Время</span>
<span />
</div>
{musicTracks.data?.Items?.map((track, index) => (
<AlbumMusicTrack
key={track.Id}
track={track}
trackIndex={index}
musicTracks={musicTracks.data ?? null}
/>
))}
{trackCount === 0 && (
<p className="music-empty">В плейлисте пока нет треков</p>
)}
</section>
{(genres.length > 0 || item.data.Overview) && (
<section className="music-about">
<h2>О плейлисте</h2>
{genres.length > 0 && (
<div className="music-genres">
{genres.map((genre) => (
<TagChip label={genre.Name ?? "жанр"} key={genre.Id} />
))}
</div>
)}
{item.data.Overview && (
<ShowMoreText
content={item.data.Overview}
collapsedLines={5}
/>
)}
</section>
)} )}
{(similarItems.data?.TotalRecordCount ?? 0) > 0 && ( {(similarItems.data?.TotalRecordCount ?? 0) > 0 && (
<CardScroller <div className="music-similar">
title="Вам может понравиться" <CardScroller
displayCards={5} title="Вам может понравиться"
disableDecoration displayCards={5}
> disableDecoration
{similarItems.data?.Items?.map((similar) => { >
return ( {similarItems.data?.Items?.map((similar) => (
<Card <Card
key={similar.Id} key={similar.Id}
item={similar} item={similar}
@@ -223,9 +236,10 @@ function PlaylistTitlePage() {
: similar.Type === BaseItemKind.Series : similar.Type === BaseItemKind.Series
? `${similar.ProductionYear} - ${ ? `${similar.ProductionYear} - ${
similar.EndDate similar.EndDate
? new Date(similar.EndDate).toLocaleString("ru-RU", { ? new Date(similar.EndDate).toLocaleString(
year: "numeric", "ru-RU",
}) { year: "numeric" },
)
: "н.в." : "н.в."
}` }`
: similar.ProductionYear : similar.ProductionYear
@@ -234,16 +248,13 @@ function PlaylistTitlePage() {
queryKey={["item", id, "similarItem"]} queryKey={["item", id, "similarItem"]}
userId={user?.Id} userId={user?.Id}
/> />
); ))}
})} </CardScroller>
</CardScroller> </div>
)} )}
</div> </div>
); );
} }
if (item.isError || similarItems.isError) {
return <ErrorNotice />;
}
} }
export default PlaylistTitlePage; export default PlaylistTitlePage;
@@ -1,141 +0,0 @@
$border-radius: 20px;
.item-playlist {
width: 70vw;
padding-right: 2.2em;
.item-info {
display: flex;
flex-direction: column;
gap: 1.2em;
&-container {
grid-template-columns: 1fr 25%;
display: grid;
gap: 3em;
}
&-playlist-info {
gap: 1.2em;
}
&-buttons {
display: flex;
gap: 1em;
}
&-disc-header {
padding: 1em 2em;
background: hsla(0, 0, 100%, 10%);
border-radius: 100px;
gap: 1em;
margin-top: 1em;
}
}
}
.item-info-sidebar {
display: flex;
flex-direction: column;
gap: 1em;
position: fixed;
// max-height: 100vh;
top: 0;
right: 0;
width: 30vw;
padding: 4.4em;
padding-left: 2.2em;
&-image {
width: 100%;
object-fit: cover;
border-radius: $border-radius-default;
}
&-artist {
display: flex;
gap: 1em;
align-items: center;
padding: 1em 0;
color: rgb(255 255 255 / 0.7);
transition: $transition-time-default;
cursor: pointer;
text-decoration: none;
&:hover {
color: rgb(255 255 255)
}
&-image {
width: 100%;
height: 100%;
object-fit: cover;
z-index: 1;
position: relative;
&-container {
width: 3em;
aspect-ratio: 1;
border-radius: 100%;
overflow: hidden;
position: relative;
.material-symbols-rounded {
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background: rgb(255 255 255 / 0.1);
z-index: 0;
}
}
}
&-container {
// max-height: 20em;/
overflow-y: auto;
overflow-x: hidden;
}
}
&-overview {
overflow-y: auto;
max-height: 28vh;
padding-bottom: 2px;
}
}
.item-detail- {
&-track {
display: grid;
grid-template-columns: 4% 1fr 80% 1fr;
align-items: center;
justify-items: center;
gap: 0.5em;
width: 100%;
padding: 0.25em 0;
background: rgb(0 0 0 / 0.4);
transition: background $transition-time-default;
backdrop-filter: blur(5px);
&:first-child {
border-radius: $border-radius $border-radius 8px 8px;
cursor: default !important;
}
&:last-child {
border-radius: 8px 8px $border-radius $border-radius;
}
border-radius: 8px;
&s {
background: transparent !important;
box-shadow: none !important;
display: flex;
flex-direction: column;
gap: 5px;
}
&:hover {
background: rgb(0 0 0 / 0.5);
cursor: pointer;
}
&.playing {
color: $clr-accent-default;
}
}
}
@media (max-width: 1320px) {
.item-playlist .item-detail {
&-cast {
&-grid {
grid-template-columns: 1fr;
}
}
}
}
+592 -277
View File
@@ -1,317 +1,632 @@
.audio { /**
&-background { * Full-screen player, media-player style:
position: fixed; * a wall coloured by the sleeve, the cover large in the middle, only the
top: 0; * transport at the bottom, and the play queue sliding in from the right.
left: 0; */
width: 100%; .music-player {
height: 100%; position: fixed;
z-index: -1; inset: 0;
overflow: hidden; overflow: hidden;
color: #fff;
background:
radial-gradient(
90% 70% at 50% -10%,
rgb(255 255 255 / 0.1),
transparent 60%
),
linear-gradient(180deg, var(--mp-base, #2a1f3d), var(--mp-deep, #120b1c));
&::after { &-chrome {
content: ""; position: absolute;
position: absolute; inset: 0 0 auto;
top: 0; z-index: 6;
left: 0; display: flex;
width: 100%; align-items: center;
height: 100%; min-height: 46px;
// No live backdrop-filter here: blurring a full-screen layer over a padding: 4px 8px;
// repainting page made the whole player shimmer.
background: rgba(0, 0, 0, 0.55);
}
&-image { &-end {
width: 100%; margin-left: auto;
height: 100%; }
object-fit: cover; }
// Blur the image itself instead of the layer behind the page.
filter: blur(70px) brightness(0.55) saturate(1.2);
transform: scale(1.2); // Hide blurred edges
}
}
&-container { &-collapse {
// Art size drives the whole left column so everything fits the viewport. position: absolute;
--np-size: min(420px, 44vh, 80vw); top: 58px;
right: 22px;
z-index: 6;
display: grid;
place-items: center;
width: 44px;
height: 44px;
padding: 0;
border: 0;
border-radius: 50%;
background: rgb(0 0 0 / 0.18);
color: rgb(255 255 255 / 0.85);
cursor: pointer;
transition: background-color 0.15s ease, transform 0.15s ease,
opacity 0.15s ease;
display: grid; .material-symbols-rounded {
grid-template-columns: var(--np-size) minmax(0, 560px); font-size: 1.5rem;
justify-content: center; }
align-items: center;
gap: clamp(2rem, 6vw, 6rem);
height: 100vh;
width: 100%;
padding: 5rem 3rem 2.5rem;
box-sizing: border-box;
position: relative;
z-index: 1;
color: white;
overflow: hidden;
@media (max-width: 900px) { &:hover {
grid-template-columns: minmax(0, var(--np-size)); background: rgb(0 0 0 / 0.3);
grid-template-rows: auto minmax(0, 1fr); transform: translateY(1px);
align-items: start; }
padding: 4.5rem 1rem 1rem; }
gap: 1.5rem;
overflow-y: auto;
}
}
&-now-playing { // The queue panel has its own close button in the same corner.
display: flex; &.has-panel &-collapse {
flex-direction: column; opacity: 0;
gap: 1.25rem; pointer-events: none;
width: var(--np-size); }
min-width: 0;
&-art { &-stage {
width: 100%; position: absolute;
aspect-ratio: 1; inset: 46px 0 96px;
border-radius: 1.25rem; z-index: 2;
overflow: hidden; display: flex;
box-shadow: 0 24px 60px rgb(0 0 0 / 0.55); align-items: center;
background: rgb(255 255 255 / 0.08); justify-content: center;
display: flex; padding: 0 clamp(1.25rem, 3vw, 3rem);
align-items: center; box-sizing: border-box;
justify-content: center; }
img { &-row {
width: 100%; display: flex;
height: 100%; align-items: flex-start;
object-fit: cover; justify-content: center;
display: block; gap: clamp(2rem, 4vw, 4rem);
} width: 100%;
.material-symbols-rounded { max-width: 1680px;
font-size: 6rem; }
opacity: 0.6;
}
}
&-meta { &-main {
display: flex; position: relative;
align-items: center; z-index: 2;
gap: 0.75rem; display: flex;
} flex: 0 0 auto;
flex-direction: column;
align-items: center;
min-width: 0;
transition: transform 0.32s cubic-bezier(0.2, 0, 0, 1);
}
&-text { // The sleeve slides left as one piece: no resizing, no vertical shift.
flex: 1; &.has-panel &-main {
min-width: 0; transform: translateX(calc(1vw - 255px));
} }
&-subtitle { &-art {
opacity: 0.7; width: clamp(200px, min(48vh, 34vw), 430px);
aspect-ratio: 1;
overflow: hidden;
border-radius: 6px;
background: rgb(0 0 0 / 0.25);
box-shadow: 0 30px 80px rgb(0 0 0 / 0.45);
display: grid;
place-items: center;
a { img {
color: inherit; display: block;
text-decoration: none; width: 100%;
&:hover { height: 100%;
text-decoration: underline; object-fit: cover;
opacity: 1; }
}
}
}
&-transport { > .material-symbols-rounded {
display: flex; font-size: 5rem;
align-items: center; color: rgb(255 255 255 / 0.4);
justify-content: space-between; }
}
// Spread prev / play / next evenly with shuffle and repeat &-meta {
.player-controls { width: min(560px, 100%);
display: contents !important; margin-top: clamp(1.2rem, 3vh, 2rem);
} text-align: center;
}
// Toggle-style buttons read as "off" until enabled &-title {
> .MuiIconButton-root, margin: 0;
> span > .MuiIconButton-root { font-size: clamp(1.25rem, 2.2vw, 1.7rem);
color: rgb(255 255 255 / 0.55); font-weight: 600;
} letter-spacing: -0.01em;
> .MuiIconButton-root.is-active { line-height: 1.2;
color: $clr-accent-default; overflow-wrap: anywhere;
} }
}
&-utility { &-subtitle {
display: flex; margin-top: 0.35em;
align-items: center; font-size: 0.95rem;
justify-content: space-between; color: rgb(255 255 255 / 0.65);
gap: 1rem;
}
&-volume { a {
display: flex; color: inherit;
align-items: center; text-decoration: none;
flex: 1;
max-width: 14rem;
opacity: 0.85;
// Secondary control: neutral instead of the accent colour &:hover {
.MuiSlider-root { color: #fff;
color: rgb(255 255 255 / 0.85); text-decoration: underline;
} }
} }
} }
&-side { &-seek {
display: flex; width: min(420px, 100%);
flex-direction: column; margin: 1.1rem auto 0;
gap: 1.5rem;
height: min(80vh, 760px);
min-height: 0;
@media (max-width: 900px) { .MuiSlider-root {
height: 70vh; padding: 8px 0;
} color: rgb(255 255 255 / 0.92);
}
&-lyrics { .MuiSlider-rail {
flex: 1; background: rgb(255 255 255 / 0.25);
min-height: 0; opacity: 1;
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 { .MuiSlider-thumb {
display: none; width: 10px;
} height: 10px;
} background: #fff;
box-shadow: none;
}
}
// "Up next" sits on a quiet card; no blur so the artwork backdrop stays clean &-controls {
&-queue { position: absolute;
flex: 1; inset: auto 0 0;
min-height: 0; z-index: 4;
// The queue view scrolls its own list so the header stays put display: flex;
display: flex; align-items: center;
flex-direction: column; justify-content: space-between;
overflow: hidden; gap: 16px;
padding: 1rem 1.25rem 0; height: 96px;
padding: 0 clamp(1.25rem, 3vw, 3rem);
box-sizing: border-box;
.queue { .MuiIconButton-root {
flex: 1; color: rgb(255 255 255 / 0.72);
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 { &:hover {
width: 6px; color: #fff;
} background: rgb(255 255 255 / 0.1);
&::-webkit-scrollbar-thumb { }
background: rgba(255, 255, 255, 0.2);
border-radius: 3px;
}
}
&.has-lyrics .audio-side-queue { &.is-active {
flex: 0 1 auto; color: #fff;
max-height: 40%; }
} }
} }
&-lyrics { &-controls-side {
width: 100%; display: flex;
flex: 0 0 220px;
align-items: center;
gap: 0.15rem;
&-container { &.is-end {
display: flex; justify-content: flex-end;
flex-direction: column; }
align-items: flex-start; }
// Room above and below so the active line can scroll to the middle
padding: 35% 0.5rem;
}
&-status { &-transport {
display: flex; display: flex;
align-items: center; flex: 1 1 auto;
justify-content: center; align-items: center;
height: 100%; justify-content: center;
min-height: 200px; gap: 0.6rem;
opacity: 0.7; }
}
&-line { &-play {
margin: 0 0 0.6rem !important; display: grid;
padding: 0.35rem 0.75rem; place-items: center;
border-radius: 0.75rem; width: 56px;
font-size: clamp(1.25rem, 2vw, 1.85rem) !important; height: 56px;
line-height: 1.35 !important; margin: 0 0.4rem;
font-weight: 700 !important; padding: 0;
text-align: left; border: 0;
opacity: 0.35; border-radius: 50%;
transition: opacity 0.35s ease, filter 0.35s ease; background: #f5196b;
filter: blur(0.4px); color: #fff;
cursor: pointer;
box-shadow: 0 10px 26px rgb(0 0 0 / 0.35);
transition: transform 0.15s ease, filter 0.15s ease;
&[data-active-lyric="true"] { .material-symbols-rounded {
opacity: 1; font-size: 1.9rem;
filter: none; }
}
&[data-seekable="true"] { &:hover {
cursor: pointer; transform: scale(1.05);
transition: opacity 0.35s ease, filter 0.35s ease, background-color 0.2s ease; filter: brightness(1.05);
}
}
&:hover, &-volume {
&:focus-visible { width: 92px;
opacity: 0.8; display: flex;
filter: none; align-items: center;
background: rgb(255 255 255 / 0.08);
outline: none;
}
&[data-active-lyric="true"]:hover {
opacity: 1;
}
}
}
// Unsynced lyrics: plain readable text, no highlight .MuiSlider-root {
&[data-has-synced-lyrics="false"] { color: rgb(255 255 255 / 0.82);
.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 { .MuiSlider-rail {
position: sticky; background: rgb(255 255 255 / 0.22);
bottom: 1rem; opacity: 1;
display: inline-flex; }
align-items: center;
gap: 0.5rem;
padding: 0.4rem 0.9rem;
margin-left: 0.5rem;
background: rgb(0 0 0 / 0.35);
border-radius: 2rem;
opacity: 0.85;
.material-symbols-rounded { .MuiSlider-thumb {
font-size: 1.1rem; width: 9px;
} height: 9px;
} box-shadow: none;
} }
} }
.player-progress-stacked {
display: flex;
flex-direction: column;
width: 100%;
.MuiSlider-root { &-panel {
padding: 10px 0; position: absolute;
} z-index: 1;
top: 22%;
right: clamp(1.5rem, 3vw, 3rem);
bottom: 0;
width: clamp(360px, 46vw, 900px);
overflow: hidden;
&-times { &-inner {
display: flex; display: flex;
justify-content: space-between; flex-direction: column;
font-size: 0.8rem; width: 100%;
opacity: 0.7; height: 100%;
font-variant-numeric: tabular-nums; box-sizing: border-box;
} overflow: hidden;
}
}
&-panel-head {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.7rem 0.7rem 0.2rem 0.9rem;
}
&-panel-tabs {
display: flex;
gap: 0.15rem;
flex: 1;
button {
padding: 0.4rem 0.2rem;
margin-right: 0.9rem;
border: 0;
border-radius: 0;
background: transparent;
color: rgb(255 255 255 / 0.5);
font: inherit;
font-size: 0.85rem;
font-weight: 600;
cursor: pointer;
transition: color 0.15s ease;
&:hover:not(:disabled) {
color: #fff;
}
&.is-active {
color: #fff;
}
&:disabled {
opacity: 0.35;
cursor: default;
}
}
}
&-panel-body {
flex: 1;
min-height: 0;
padding: 0.4rem 0.7rem 0.9rem;
overflow-y: auto;
overflow-x: hidden;
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-thumb {
border-radius: 3px;
background: rgb(255 255 255 / 0.18);
}
}
&-panel-source {
font-size: 0.8rem;
color: rgb(255 255 255 / 0.75);
}
&-panel-title {
margin: 0.15em 0 0.9em;
font-size: 1.65rem;
font-weight: 700;
letter-spacing: -0.01em;
line-height: 1.15;
overflow-wrap: anywhere;
}
&-panel-label {
margin: 1.6rem 0.2rem 0.5rem;
font-size: 0.98rem;
font-weight: 600;
color: #fff;
&:first-child {
margin-top: 0.2rem;
}
}
&-panel-empty {
margin: 0;
padding: 0.6rem;
font-size: 0.85rem;
line-height: 1.5;
color: rgb(255 255 255 / 0.5);
}
&-panel-lyrics {
height: 100%;
padding: 0;
}
&-queue-list {
display: flex;
flex-direction: column;
gap: 2px;
}
&-queue-row {
display: grid;
grid-template-columns: 48px minmax(0, 1fr) 30px 46px;
gap: 14px;
align-items: center;
width: 100%;
padding: 7px 4px;
border: 0;
border-radius: 6px;
background: transparent;
color: inherit;
font: inherit;
text-align: left;
cursor: pointer;
transition: background-color 0.15s ease;
&:hover {
background: rgb(255 255 255 / 0.06);
}
&.is-current {
cursor: default;
.music-player-queue-title {
color: #fff;
}
}
}
&-queue-cover {
position: relative;
display: grid;
place-items: center;
width: 48px;
height: 48px;
overflow: hidden;
border-radius: 6px;
background: rgb(255 255 255 / 0.08);
img {
width: 100%;
height: 100%;
object-fit: cover;
}
.material-symbols-rounded {
font-size: 1.1rem;
opacity: 0.5;
}
}
&-queue-playing {
position: absolute;
inset: 0;
display: grid;
place-items: center;
background: rgb(0 0 0 / 0.45);
.material-symbols-rounded {
font-size: 1.5rem !important;
color: #fff;
opacity: 1 !important;
}
}
&-queue-text {
display: flex;
flex-direction: column;
min-width: 0;
}
&-queue-title {
font-size: 0.95rem;
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&-queue-artist {
font-size: 0.8rem;
color: rgb(255 255 255 / 0.5);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&-queue-time {
font-size: 0.8rem;
font-variant-numeric: tabular-nums;
color: rgb(255 255 255 / 0.6);
text-align: right;
}
&-queue-like {
display: flex;
justify-content: center;
opacity: 0.8;
transition: opacity 0.15s ease;
.MuiIconButton-root {
padding: 4px;
color: rgb(255 255 255 / 0.6);
&:hover {
color: #fff;
background: transparent;
}
}
}
&-panel-lyrics .audio-lyrics {
height: 100%;
}
.audio-lyrics-container {
padding: 24% 0.4rem;
}
.audio-lyrics-line {
margin: 0 0 0.45rem !important;
padding: 0.2rem 0.55rem;
border-radius: 0.6rem;
font-size: clamp(1rem, 1.4vw, 1.35rem) !important;
line-height: 1.3 !important;
font-weight: 600 !important;
}
@media (max-width: 900px) {
&-stage {
padding: 0 1rem;
}
&-controls-side {
flex-basis: auto;
&:not(.is-end) {
display: none;
}
}
&-volume {
display: none;
}
&-panel {
top: 1rem;
right: 1rem;
width: min(84vw, 520px);
}
&.has-panel &-main {
transform: none;
}
}
}
// macOS keeps its native traffic lights inside the overlay titlebar.
html.is-macos .music-player-chrome {
padding-top: 12px;
padding-left: 84px;
min-height: 56px;
}
/* Lyrics list, shared with the queue panel. */
.audio-lyrics {
width: 100%;
height: 100%;
overflow-y: auto;
overflow-x: hidden;
scrollbar-width: none;
mask-image: linear-gradient(transparent, black 12%, black 88%, transparent);
&::-webkit-scrollbar {
display: none;
}
&-container {
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 30% 0.5rem;
}
&-status {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
min-height: 200px;
opacity: 0.7;
}
&-line {
margin: 0 0 0.6rem !important;
padding: 0.35rem 0.75rem;
border-radius: 0.75rem;
font-size: clamp(1.1rem, 1.7vw, 1.6rem) !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;
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;
}
}
}
&[data-has-synced-lyrics="false"] {
.audio-lyrics-container {
padding: 1rem 0.5rem 4rem;
}
.audio-lyrics-line {
font-size: 1rem !important;
font-weight: 500 !important;
opacity: 0.85;
filter: none;
margin-bottom: 0.25rem !important;
}
}
} }
+394 -145
View File
@@ -7,24 +7,23 @@ import {
ListItemIcon, ListItemIcon,
Menu, Menu,
MenuItem, MenuItem,
Slider,
Tooltip, Tooltip,
Typography,
} from "@mui/material"; } from "@mui/material";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
import { createFileRoute, Link, useNavigate } from "@tanstack/react-router"; import { createFileRoute, Link, useNavigate } from "@tanstack/react-router";
import { AnimatePresence, motion } from "motion/react";
import React, { useEffect, useMemo, useState } from "react"; import React, { useEffect, useMemo, useState } from "react";
import CastButton from "@/components/buttons/castButton"; import CastButton from "@/components/buttons/castButton";
import InstantMixButton from "@/components/buttons/instantMixButton";
import LikeButton from "@/components/buttons/likeButton"; import LikeButton from "@/components/buttons/likeButton";
import LyricsPanel, { import LyricsPanel, {
getLyricsQueryOptions, getLyricsQueryOptions,
} from "@/components/playback/audioPlayer/components/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 PlayerVolume from "@/components/playback/audioPlayer/components/PlayerVolume";
import StatsPanel from "@/components/playback/audioPlayer/components/StatsPanel"; import StatsPanel from "@/components/playback/audioPlayer/components/StatsPanel";
import QueueView from "@/components/queue/queueView"; import WindowControls from "@/components/windowControls";
import { secToTicks, ticksToSec } from "@/utils/date/time"; import { getRuntimeMusic, secToTicks, ticksToSec } from "@/utils/date/time";
import { getCoverPalette } from "@/utils/methods/coverColor";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi"; import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { getItemQueryOptions } from "@/utils/queries/items"; import { getItemQueryOptions } from "@/utils/queries/items";
import { useApiInContext } from "@/utils/store/api"; import { useApiInContext } from "@/utils/store/api";
@@ -34,6 +33,7 @@ import {
useAudioPlayback, useAudioPlayback,
} from "@/utils/store/audioPlayback"; } from "@/utils/store/audioPlayback";
import { useCentralStore } from "@/utils/store/central"; import { useCentralStore } from "@/utils/store/central";
import { playItemFromQueue } from "@/utils/store/playback";
import useQueue, { import useQueue, {
cycleRepeatMode, cycleRepeatMode,
type RepeatMode, type RepeatMode,
@@ -52,44 +52,76 @@ const repeatLabels: Record<RepeatMode, string> = {
one: "Повтор одного", one: "Повтор одного",
}; };
/** Artists (linked) and album (linked) for the current track. */ const QueueRow = ({
const TrackSubtitle = ({ item }: { item: BaseItemDto }) => { item,
const artists = item.ArtistItems?.length index,
? item.ArtistItems isCurrent,
: (item.AlbumArtists ?? []); coverUrl,
return ( onPlay,
<Typography queryKey,
variant="subtitle1" userId,
className="audio-now-playing-subtitle" }: {
noWrap item: BaseItemDto;
> index: number;
{artists.map((artist, index) => ( isCurrent: boolean;
<React.Fragment key={artist.Id ?? artist.Name}> coverUrl?: string;
{index > 0 && ", "} onPlay: (index: number) => void;
{artist.Id ? ( queryKey: string[];
<Link to="/music/artist/$id" params={{ id: artist.Id }}> userId?: string;
{artist.Name} }) => (
</Link> // biome-ignore lint/a11y/useSemanticElements: the row contains its own like button
) : ( <div
artist.Name className={`music-player-queue-row${isCurrent ? " is-current" : ""}`}
)} onClick={() => {
</React.Fragment> if (!isCurrent) onPlay(index);
))} }}
{item.Album && ( onKeyDown={(event) => {
<> if (isCurrent) return;
{artists.length > 0 && " · "} if (event.key === "Enter" || event.key === " ") {
{item.AlbumId ? ( event.preventDefault();
<Link to="/music/album/$id" params={{ id: item.AlbumId }}> onPlay(index);
{item.Album} }
</Link> }}
) : ( role="button"
item.Album tabIndex={0}
)} >
</> <span className="music-player-queue-cover">
{coverUrl ? (
<img src={coverUrl} alt="" />
) : (
<span className="material-symbols-rounded">music_note</span>
)} )}
</Typography> {isCurrent && (
); <span className="music-player-queue-playing">
}; <span className="material-symbols-rounded">play_arrow</span>
</span>
)}
</span>
<span className="music-player-queue-text">
<span className="music-player-queue-title">{item.Name}</span>
<span className="music-player-queue-artist">
{item.Artists?.join(", ") ?? item.AlbumArtist ?? item.Album}
</span>
</span>
<span
className="music-player-queue-like"
onClick={(event) => event.stopPropagation()}
onKeyDown={(event) => event.stopPropagation()}
role="presentation"
>
<LikeButton
itemId={item.Id}
itemName={item.Name}
isFavorite={item.UserData?.IsFavorite}
queryKey={queryKey}
userId={userId}
/>
</span>
<span className="music-player-queue-time">
{getRuntimeMusic(item.RunTimeTicks ?? 0)}
</span>
</div>
);
function AudioPlayerRoute() { function AudioPlayerRoute() {
const api = useApiInContext((s) => s.api); const api = useApiInContext((s) => s.api);
@@ -109,6 +141,8 @@ function AudioPlayerRoute() {
const [progress, setProgress] = useState(0); const [progress, setProgress] = useState(0);
const [playing, setPlaying] = useState(false); const [playing, setPlaying] = useState(false);
const [panelOpen, setPanelOpen] = useState(false);
const [panelTab, setPanelTab] = useState<"queue" | "lyrics">("queue");
const [menuAnchor, setMenuAnchor] = useState<HTMLElement | null>(null); const [menuAnchor, setMenuAnchor] = useState<HTMLElement | null>(null);
const [statsOpen, setStatsOpen] = useState(false); const [statsOpen, setStatsOpen] = useState(false);
@@ -141,6 +175,9 @@ function AudioPlayerRoute() {
const lyrics = useQuery(getLyricsQueryOptions(item, api)); const lyrics = useQuery(getLyricsQueryOptions(item, api));
const hasLyrics = (lyrics.data?.Lyrics?.length ?? 0) > 0; const hasLyrics = (lyrics.data?.Lyrics?.length ?? 0) > 0;
// Wall colour derived from the sleeve.
const palette = useMemo(() => getCoverPalette(item), [item]);
const handlePlayPause = () => { const handlePlayPause = () => {
const player = audioPlayerRef?.current; const player = audioPlayerRef?.current;
if (!player) return; if (!player) return;
@@ -170,52 +207,235 @@ function AudioPlayerRoute() {
[item?.Id, item?.ImageTags?.Primary, api], [item?.Id, item?.ImageTags?.Primary, api],
); );
const coverFor = (track: BaseItemDto) =>
api && track.ImageTags?.Primary
? getImageUrlsApi(api).getItemImageUrlById(
track.AlbumId ?? track.Id ?? "",
"Primary",
{ quality: 70, fillHeight: 96, fillWidth: 96 },
)
: undefined;
const hasUpcoming = (queue?.length ?? 0) > currentTrack + 1; const hasUpcoming = (queue?.length ?? 0) > currentTrack + 1;
const isFavorite = const isFavorite =
itemDetails.data?.UserData?.IsFavorite ?? item?.UserData?.IsFavorite; itemDetails.data?.UserData?.IsFavorite ?? item?.UserData?.IsFavorite;
const artistId = item?.ArtistItems?.[0]?.Id ?? item?.AlbumArtists?.[0]?.Id; const artistId = item?.ArtistItems?.[0]?.Id ?? item?.AlbumArtists?.[0]?.Id;
const tracks = queue ?? [];
const current = tracks[currentTrack];
const upcoming = tracks.slice(currentTrack + 1);
const openPanel = (tab: "queue" | "lyrics") => {
if (panelOpen && panelTab === tab) {
setPanelOpen(false);
return;
}
setPanelTab(tab);
setPanelOpen(true);
};
return ( return (
<> <>
<div className="audio-background"> <div
{imageUrl && ( className={`music-player${panelOpen ? " has-panel" : ""}`}
<img src={imageUrl} alt="" className="audio-background-image" /> style={
)} {
</div> "--mp-base": palette.base,
<div className="audio-container"> "--mp-deep": palette.deep,
<section className="audio-now-playing" key={item?.Id}> } as React.CSSProperties
<div className="audio-now-playing-art"> }
{imageUrl ? ( >
<img alt={item?.Name ?? "Обложка"} src={imageUrl} /> <header className="music-player-chrome" data-tauri-drag-region>
) : ( <div className="music-player-chrome-end">
<span className="material-symbols-rounded">music_note</span> <WindowControls />
)} </div>
</header>
<Tooltip title="Свернуть плеер">
<button
type="button"
className="music-player-collapse"
onClick={() => window.history.back()}
aria-label="Свернуть плеер"
>
<span className="material-symbols-rounded">expand_more</span>
</button>
</Tooltip>
<div className="music-player-stage">
<div className="music-player-row">
<div className="music-player-main">
<motion.div
key={item?.Id}
className="music-player-art"
initial={{ opacity: 0, scale: 0.98 }}
animate={{ opacity: 1, scale: 1 }}
transition={{ duration: 0.3, ease: "easeOut" }}
>
{imageUrl ? (
<img alt={item?.Name ?? "Обложка"} src={imageUrl} />
) : (
<span className="material-symbols-rounded">music_note</span>
)}
</motion.div>
<div className="music-player-meta">
<h1 className="music-player-title">{item?.Name}</h1>
<div className="music-player-subtitle">
{item?.ArtistItems?.length
? item.ArtistItems.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>
))
: item?.Artists?.join(", ")}
{item?.Album && (
<>
{(item?.ArtistItems?.length || item?.Artists?.length) &&
" · "}
{item.AlbumId ? (
<Link
to="/music/album/$id"
params={{ id: item.AlbumId }}
>
{item.Album}
</Link>
) : (
item.Album
)}
</>
)}
</div>
<div className="music-player-seek">
<Slider
value={Math.min(
secToTicks(progress),
item?.RunTimeTicks ?? 0,
)}
max={item?.RunTimeTicks ?? 1}
step={1}
size="small"
aria-label="Перемотка"
onChange={(_, value) => {
const next = Array.isArray(value) ? value[0] : value;
setProgress(ticksToSec(next));
}}
onChangeCommitted={(_, value) => {
const next = Array.isArray(value) ? value[0] : value;
handleSeekCommit(next);
}}
/>
</div>
</div>
</div> </div>
<div className="audio-now-playing-meta"> <AnimatePresence initial={false}>
<div className="audio-now-playing-text"> {panelOpen && (
<Typography <motion.aside
variant="h5" key="panel"
sx={{ className="music-player-panel"
fontWeight: 700, initial={{ x: -240, opacity: 0 }}
lineHeight: 1.2, animate={{ x: 0, opacity: 1 }}
overflowWrap: "anywhere", exit={{ x: -240, opacity: 0 }}
}} transition={{ duration: 0.32, ease: [0.2, 0, 0, 1] }}
> >
{item?.Name} <div className="music-player-panel-inner">
</Typography> {panelTab === "lyrics" ? (
{item && <TrackSubtitle item={item} />} <>
</div> <div className="music-player-panel-head">
{item && <InstantMixButton item={item} />} <span className="music-player-panel-source">
{item && <CastButton Текст песни
item={item} </span>
transfer={{ <IconButton
kind: "audio", size="small"
positionTicks: secToTicks(progress), aria-label="Показать очередь"
queue: queue ?? [], onClick={() => setPanelTab("queue")}
startIndex: currentTrack, >
}} <span className="material-symbols-rounded">close</span>
/>} </IconButton>
</div>
<div className="music-player-panel-body music-player-panel-lyrics">
{hasLyrics ? (
<LyricsPanel
item={item}
api={api}
currentTime={progress}
onSeek={handleSeekCommit}
/>
) : (
<p className="music-player-panel-empty">
Для этого трека нет текста.
</p>
)}
</div>
</>
) : (
<div className="music-player-panel-body">
<div className="music-player-panel-source">
Сейчас играет из{" "}
{item?.Album ? "альбома" : "очереди"}
</div>
<h2 className="music-player-panel-title">
{item?.Album ?? "Очередь"}
</h2>
{current && (
<QueueRow
item={current}
index={currentTrack}
isCurrent
coverUrl={coverFor(current)}
onPlay={() => undefined}
queryKey={["queue-current"]}
userId={user?.Id}
/>
)}
<div className="music-player-panel-label">
Далее в очереди
</div>
{upcoming.length === 0 ? (
<p className="music-player-panel-empty">
Очередь пуста. Запустите альбом или плейлист,
чтобы она наполнилась.
</p>
) : (
<div className="music-player-queue-list">
{upcoming.map((track, offset) => (
<QueueRow
key={track.Id}
item={track}
index={currentTrack + 1 + offset}
isCurrent={false}
coverUrl={coverFor(track)}
onPlay={(index) =>
playItemFromQueue(index, user?.Id, api)
}
queryKey={["queue-upcoming"]}
userId={user?.Id}
/>
))}
</div>
)}
</div>
)}
</div>
</motion.aside>
)}
</AnimatePresence>
</div>
</div>
<footer className="music-player-controls">
<div className="music-player-controls-side">
<LikeButton <LikeButton
itemId={item?.Id ?? undefined} itemId={item?.Id ?? undefined}
itemName={item?.Name} itemName={item?.Name}
@@ -223,58 +443,21 @@ function AudioPlayerRoute() {
queryKey={["item", item?.Id ?? ""]} queryKey={["item", item?.Id ?? ""]}
userId={user?.Id} userId={user?.Id}
/> />
</div> {item && (
<CastButton
<PlayerProgress item={item}
layout="stacked" transfer={{
progress={secToTicks(progress)} kind: "audio",
duration={item?.RunTimeTicks ?? 1} positionTicks: secToTicks(progress),
onSeek={(value) => setProgress(ticksToSec(value))} queue: queue ?? [],
onSeekCommit={handleSeekCommit} startIndex: currentTrack,
/> }}
<div className="audio-now-playing-transport">
<Tooltip title="Перемешать следующие">
<span>
<IconButton
onClick={shuffleUpcoming}
disabled={!hasUpcoming}
aria-label="Перемешать следующие"
>
<span className="material-symbols-rounded">shuffle</span>
</IconButton>
</span>
</Tooltip>
<PlayerControls
playing={playing}
onPlayPause={handlePlayPause}
size="large"
/>
<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-now-playing-utility">
<div className="audio-now-playing-volume">
<PlayerVolume
volume={volume}
isMuted={isMuted}
onVolumeChange={setVolume}
onMuteToggle={() => setIsMuted(!isMuted)}
/> />
</div> )}
<IconButton <IconButton
onClick={(e) => setMenuAnchor(e.currentTarget)} onClick={(e) => setMenuAnchor(e.currentTarget)}
aria-label="Ещё" aria-label="Ещё"
title="Ещё"
> >
<span className="material-symbols-rounded">more_horiz</span> <span className="material-symbols-rounded">more_horiz</span>
</IconButton> </IconButton>
@@ -282,8 +465,8 @@ function AudioPlayerRoute() {
anchorEl={menuAnchor} anchorEl={menuAnchor}
open={Boolean(menuAnchor)} open={Boolean(menuAnchor)}
onClose={() => setMenuAnchor(null)} onClose={() => setMenuAnchor(null)}
anchorOrigin={{ vertical: "top", horizontal: "right" }} anchorOrigin={{ vertical: "top", horizontal: "left" }}
transformOrigin={{ vertical: "bottom", horizontal: "right" }} transformOrigin={{ vertical: "bottom", horizontal: "left" }}
> >
<MenuItem <MenuItem
disabled={!item?.AlbumId} disabled={!item?.AlbumId}
@@ -332,26 +515,92 @@ function AudioPlayerRoute() {
</MenuItem> </MenuItem>
</Menu> </Menu>
</div> </div>
</section>
<aside <div className="music-player-transport">
className={`audio-side ${hasLyrics ? "has-lyrics" : ""}`} <Tooltip title="Перемешать следующие">
aria-label="Текст и очередь" <span>
> <IconButton
{hasLyrics && ( onClick={shuffleUpcoming}
<div className="audio-side-lyrics"> disabled={!hasUpcoming}
<LyricsPanel aria-label="Перемешать следующие"
item={item} >
api={api} <span className="material-symbols-rounded">shuffle</span>
currentTime={progress} </IconButton>
onSeek={handleSeekCommit} </span>
</Tooltip>
<IconButton
onClick={() => playItemFromQueue("previous", user?.Id, api)}
aria-label="Предыдущий"
title="Предыдущий"
>
<span className="material-symbols-rounded">skip_previous</span>
</IconButton>
<button
type="button"
className="music-player-play"
onClick={handlePlayPause}
aria-label={playing ? "Пауза" : "Играть"}
>
<span className="material-symbols-rounded">
{playing ? "pause" : "play_arrow"}
</span>
</button>
<IconButton
onClick={() => playItemFromQueue("next", user?.Id, api)}
aria-label="Следующий"
title="Следующий"
>
<span className="material-symbols-rounded">skip_next</span>
</IconButton>
<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="music-player-controls-side is-end">
<div className="music-player-volume">
<PlayerVolume
volume={volume}
isMuted={isMuted}
onVolumeChange={setVolume}
onMuteToggle={() => setIsMuted(!isMuted)}
/> />
</div> </div>
)} <Tooltip title="Текст песни">
<div className="audio-side-queue"> <span>
<QueueView variant="panel" /> <IconButton
onClick={() => openPanel("lyrics")}
aria-label="Текст песни"
className={
panelOpen && panelTab === "lyrics" ? "is-active" : undefined
}
disabled={!hasLyrics}
>
<span className="material-symbols-rounded">lyrics</span>
</IconButton>
</span>
</Tooltip>
<Tooltip title="Очередь">
<IconButton
onClick={() => openPanel("queue")}
aria-label="Очередь"
className={
panelOpen && panelTab === "queue" ? "is-active" : undefined
}
>
<span className="material-symbols-rounded">queue_music</span>
</IconButton>
</Tooltip>
</div> </div>
</aside> </footer>
</div> </div>
<Dialog <Dialog
-1
View File
@@ -768,7 +768,6 @@ export function VideoPlayer() {
onMouseMove={handleMouseMove} onMouseMove={handleMouseMove}
onMouseLeave={handleMouseLeave} onMouseLeave={handleMouseLeave}
> >
<div className="video-player-drag-region" data-tauri-drag-region />
<LoadingIndicator /> <LoadingIndicator />
<ErrorDisplay <ErrorDisplay
error={error} error={error}
+640
View File
@@ -0,0 +1,640 @@
/**
* Remote control for another Jellyfin client.
* Layout follows the reference player: brand bar, poster + details + round
* transport, a full-width timeline, and a service bar with subtitles, volume,
* quality and fullscreen.
*/
.remote-page {
--remote-accent: #{$clr-accent-default};
--remote-panel: #16191f;
--remote-chip: #1b1e25;
--remote-muted: #a9b0bb;
position: fixed;
inset: 0;
display: flex;
flex-direction: column;
overflow: hidden;
color: #fff;
background: linear-gradient(
180deg,
var(--remote-base, #1b0f2e),
var(--remote-deep, #08001f)
);
font-family: "Plus Jakarta Sans Variable", "Segoe UI", "Inter", Arial,
sans-serif;
}
/* ------------------------------------------------------------------ top */
.remote-topbar {
display: flex;
flex: 0 0 auto;
align-items: center;
justify-content: space-between;
gap: 24px;
height: 88px;
padding: 0 32px;
box-sizing: border-box;
&-left,
&-right {
display: flex;
align-items: center;
gap: 14px;
min-width: 0;
}
.MuiIconButton-root {
color: #dfe3ea;
&:hover {
color: #fff;
background: rgb(255 255 255 / 0.08);
}
.material-symbols-rounded {
font-size: 1.5rem;
}
}
&-divider {
width: 1px;
height: 26px;
background: rgb(255 255 255 / 0.12);
}
}
.remote-brand {
display: flex;
align-items: center;
gap: 10px;
&-mark {
display: grid;
place-items: center;
width: 38px;
height: 38px;
border-radius: 50%;
background: linear-gradient(
135deg,
$clr-accent-default,
$clr-secondary-default
);
color: #fff;
.material-symbols-rounded {
font-size: 1.3rem;
}
}
&-name {
font-size: 1.35rem;
font-weight: 600;
letter-spacing: -0.01em;
}
}
.remote-device-chip {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 8px 12px 8px 14px;
border: 0;
border-radius: 999px;
background: var(--remote-panel);
color: #e8ebf1;
font: inherit;
font-size: 0.88rem;
cursor: pointer;
transition: background-color 0.15s ease;
&:hover {
background: #1d2028;
}
> .material-symbols-rounded {
font-size: 1.2rem;
}
}
.remote-chevron {
opacity: 0.6;
font-size: 1.15rem !important;
}
/* ---------------------------------------------------------------- hero */
.remote-body {
display: flex;
flex: 1 1 auto;
min-height: 0;
}
.remote-devices {
display: flex;
flex: 0 0 clamp(220px, 19vw, 280px);
flex-direction: column;
min-height: 0;
padding: clamp(0.5rem, 3vh, 2rem) 0 0 clamp(1.5rem, 4vw, 3.5rem);
box-sizing: border-box;
overflow: hidden;
}
.remote-devices-title {
margin: 0 0 0.5em 0.6em;
font-size: 0.72rem;
font-weight: 500;
letter-spacing: 0.2em;
text-transform: uppercase;
color: rgb(255 255 255 / 0.5);
}
.remote-device-list {
display: flex;
flex-direction: column;
gap: 0.25em;
margin: 0;
padding: 0;
overflow-y: auto;
list-style: none;
}
.remote-device {
display: flex;
align-items: center;
gap: 0.75em;
width: 100%;
padding: 0.6em 0.7em;
border: 0;
border-radius: 10px;
background: transparent;
color: rgb(255 255 255 / 0.75);
font: inherit;
text-align: left;
cursor: pointer;
transition: background-color 0.15s ease, color 0.15s ease;
&:hover {
background: rgb(255 255 255 / 0.06);
}
&.is-active {
background: rgb(255 255 255 / 0.1);
color: #fff;
}
&-icon {
font-size: 1.3rem;
opacity: 0.8;
}
&-info {
display: flex;
flex-direction: column;
min-width: 0;
}
&-name {
font-size: 0.9rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&-meta {
font-size: 0.72rem;
color: rgb(255 255 255 / 0.5);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&-dot {
flex: 0 0 auto;
width: 6px;
height: 6px;
margin-left: auto;
border-radius: 50%;
background: $clr-accent-default;
&.is-paused {
background: rgb(255 255 255 / 0.35);
}
}
}
.remote-hero {
display: flex;
flex: 1 1 auto;
align-items: center;
gap: clamp(2rem, 4vw, 4rem);
min-width: 0;
min-height: 0;
margin: 0 auto;
padding: clamp(0.5rem, 3vh, 2.5rem) clamp(1.5rem, 4vw, 3.5rem) 0;
box-sizing: border-box;
overflow: hidden;
}
.remote-poster {
position: relative;
flex: 0 0 auto;
height: 100%;
max-height: 560px;
width: auto;
max-width: 340px;
aspect-ratio: 2 / 3;
&-frame {
position: relative;
z-index: 1;
display: grid;
place-items: center;
width: 100%;
height: 100%;
overflow: hidden;
border-radius: 8px;
background: var(--remote-panel);
box-shadow: 0 24px 60px rgb(0 0 0 / 0.45);
img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
> .material-symbols-rounded {
font-size: 4rem;
color: rgb(255 255 255 / 0.3);
}
}
}
.remote-details {
flex: 1 1 auto;
min-width: 0;
max-width: 820px;
padding-top: clamp(0.5rem, 4vh, 3rem);
}
.remote-title {
margin: 0;
font-size: clamp(1.9rem, 3vw, 3rem);
font-weight: 700;
line-height: 1.1;
letter-spacing: -0.02em;
overflow-wrap: anywhere;
}
.remote-subtitle {
margin: 0.55em 0 0;
font-size: clamp(1.1rem, 1.6vw, 1.55rem);
font-weight: 500;
line-height: 1.3;
color: #d3d8e0;
overflow-wrap: anywhere;
}
.remote-chips {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-top: clamp(1.2rem, 3vh, 2rem);
}
.remote-chip {
padding: 7px 15px;
border-radius: 999px;
background: var(--remote-chip);
font-size: 0.95rem;
color: #dfe3ea;
}
.remote-overview {
display: -webkit-box;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
overflow: hidden;
max-width: 660px;
margin: clamp(1rem, 3vh, 1.8rem) 0 0;
font-size: 1rem;
line-height: 1.6;
color: var(--remote-muted);
}
.remote-transport {
display: flex;
align-items: center;
gap: clamp(1rem, 2.4vw, 2rem);
margin-top: clamp(2rem, 6vh, 3.5rem);
}
.remote-round {
display: grid;
place-items: center;
width: clamp(64px, 6vw, 86px);
height: clamp(64px, 6vw, 86px);
padding: 0;
border: 0;
border-radius: 50%;
background: var(--remote-panel);
color: #fff;
cursor: pointer;
transition: background-color 0.15s ease, transform 0.15s ease;
.material-symbols-rounded {
font-size: clamp(1.5rem, 2vw, 2rem);
}
&:hover:not(:disabled) {
background: #1e222b;
transform: scale(1.03);
}
&:disabled {
opacity: 0.4;
cursor: default;
}
&.remote-round-primary {
width: clamp(74px, 7vw, 98px);
height: clamp(74px, 7vw, 98px);
background: var(--remote-accent);
box-shadow: 0 10px 24px rgb(0 0 0 / 0.3);
.material-symbols-rounded {
font-size: clamp(1.9rem, 2.6vw, 2.6rem);
}
&:hover:not(:disabled) {
background: #8b70ff;
transform: scale(1.04);
}
}
}
/* ------------------------------------------------------------ timeline */
.remote-timeline {
display: flex;
flex: 0 0 auto;
align-items: center;
gap: 22px;
padding: clamp(0.5rem, 1.5vh, 1rem) clamp(1.5rem, 4vw, 3.5rem) 0;
box-sizing: border-box;
.MuiSlider-root {
padding: 12px 0;
color: var(--remote-accent);
}
.MuiSlider-rail {
background: rgb(255 255 255 / 0.18);
opacity: 1;
}
.MuiSlider-thumb {
width: 16px;
height: 16px;
background: #fff;
box-shadow: 0 0 0 4px rgb(255 255 255 / 0.14);
&:hover,
&.Mui-focusVisible {
box-shadow: 0 0 0 8px rgb(255 255 255 / 0.14);
}
}
}
.remote-timeline-slider {
flex: 1 1 auto;
}
.remote-time {
flex: 0 0 auto;
min-width: 4.5em;
font-size: 1.05rem;
font-variant-numeric: tabular-nums;
color: #e8ebf1;
&:last-child {
text-align: right;
}
}
/* ---------------------------------------------------------- bottom bar */
.remote-bottombar {
display: flex;
flex: 0 0 auto;
align-items: center;
justify-content: space-between;
gap: 24px;
height: 72px;
padding: 0 clamp(1.5rem, 4vw, 3rem);
box-sizing: border-box;
background: rgb(0 0 0 / 0.22);
border-top: 1px solid rgb(255 255 255 / 0.06);
}
.remote-bottom-item {
display: inline-flex;
align-items: center;
gap: 10px;
min-width: 0;
padding: 8px 0;
border: 0;
background: transparent;
color: #dfe3ea;
font: inherit;
font-size: 0.9rem;
cursor: pointer;
transition: color 0.15s ease;
> .material-symbols-rounded {
font-size: 1.3rem;
}
&:hover:not(:disabled) {
color: #fff;
}
&:disabled {
opacity: 0.2;
cursor: default;
}
> span:nth-child(2) {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.remote-bottom-volume {
flex: 0 1 320px;
gap: 8px;
.MuiIconButton-root {
color: #dfe3ea;
&:hover {
color: #fff;
background: rgb(255 255 255 / 0.06);
}
}
.MuiSlider-root {
color: var(--remote-accent);
}
.MuiSlider-rail {
background: rgb(255 255 255 / 0.18);
opacity: 1;
}
.MuiSlider-thumb {
width: 14px;
height: 14px;
background: #fff;
box-shadow: none;
}
}
/* --------------------------------------------------------------- empty */
.remote-empty {
display: flex;
flex: 1 1 auto;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 0.6em;
padding: 0 24px;
text-align: center;
> .material-symbols-rounded {
font-size: 3.5rem;
opacity: 0.4;
}
h1 {
margin: 0;
font-size: 1.7rem;
}
p {
max-width: 46ch;
margin: 0;
font-size: 0.95rem;
line-height: 1.6;
color: var(--remote-muted);
}
}
/* ------------------------------------------------------------ adapt */
@media (max-height: 780px) {
.remote-topbar {
height: 72px;
}
.remote-title {
font-size: clamp(1.6rem, 2.6vw, 2.3rem);
}
.remote-subtitle {
font-size: clamp(1rem, 1.3vw, 1.2rem);
}
.remote-chips {
margin-top: 1rem;
}
.remote-overview {
display: none;
}
.remote-transport {
margin-top: 1.4rem;
}
.remote-round {
width: 64px;
height: 64px;
}
.remote-round.remote-round-primary {
width: 78px;
height: 78px;
}
.remote-bottombar {
height: 64px;
}
}
@media (max-width: 1100px) {
.remote-hero {
gap: 2.5rem;
}
.remote-poster {
width: clamp(200px, 30vw, 280px);
}
.remote-bottombar {
height: 90px;
gap: 16px;
}
.remote-bottom-item > span:nth-child(2) {
font-size: 0.9rem;
}
}
@media (max-width: 820px) {
.remote-topbar {
height: 72px;
padding: 0 16px;
}
.remote-hero {
flex-direction: column;
align-items: center;
overflow-y: auto;
}
.remote-details {
width: 100%;
text-align: center;
}
.remote-transport {
justify-content: center;
}
.remote-chips {
justify-content: center;
}
.remote-overview {
margin-left: auto;
margin-right: auto;
}
.remote-bottombar {
justify-content: center;
flex-wrap: wrap;
height: auto;
padding: 12px 16px;
}
.remote-bottom-volume {
flex-basis: 200px;
}
}
+611
View File
@@ -0,0 +1,611 @@
import {
GeneralCommandType,
PlaystateCommand,
type SessionInfoDto,
} from "@jellyfin/sdk/lib/generated-client";
import { getSessionApi } from "@jellyfin/sdk/lib/utils/api/session-api";
import IconButton from "@mui/material/IconButton";
import Menu from "@mui/material/Menu";
import MenuItem from "@mui/material/MenuItem";
import Slider from "@mui/material/Slider";
import Tooltip from "@mui/material/Tooltip";
import { useQuery } from "@tanstack/react-query";
import { createFileRoute, useNavigate } from "@tanstack/react-router";
import React, { useEffect, useMemo, useRef, useState } from "react";
import { UserAvatarMenu } from "@/components/userAvatarMenu";
import WindowControls from "@/components/windowControls";
import { getRuntimeCompact } from "@/utils/date/time";
import { getCoverPalette } from "@/utils/methods/coverColor";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import useSearchStore from "@/utils/store/search";
import "./remote.scss";
export const Route = createFileRoute("/_api/remote")({
component: RemotePage,
});
const TICKS_PER_SECOND = 10_000_000;
const formatTime = (ticks: number | null | undefined) => {
const total = Math.max(0, Math.round((ticks ?? 0) / TICKS_PER_SECOND));
const h = Math.floor(total / 3600);
const m = Math.floor((total % 3600) / 60);
const s = total % 60;
return h > 0
? `${h}:${String(m).padStart(2, "0")}:${String(s).padStart(2, "0")}`
: `${m}:${String(s).padStart(2, "0")}`;
};
const sessionLabel = (session: SessionInfoDto) =>
session.DeviceName ||
session.Client ||
session.DeviceId ||
"Неизвестное устройство";
const channelLabel = (channels?: number | null) => {
if (!channels) return null;
if (channels === 1) return "Mono";
if (channels === 2) return "Stereo";
if (channels === 6) return "5.1";
if (channels === 8) return "7.1";
return `${channels} ch`;
};
const sessionKind = (session: SessionInfoDto) => {
const type = session.NowPlayingItem?.Type;
if (type === "TvChannel") return "tv";
if (type === "Audio" || type === "MusicAlbum") return "speaker";
if (type) return "tv";
return session.Client?.toLowerCase().includes("web") ? "computer" : "tv";
};
function RemotePage() {
const api = useApiInContext((s) => s.api);
const user = useCentralStore((s) => s.currentUser);
const navigate = useNavigate();
const toggleSearchDialog = useSearchStore((s) => s.toggleSearchDialog);
const [selectedId, setSelectedId] = useState<string | null>(null);
const [subtitleAnchor, setSubtitleAnchor] = useState<HTMLElement | null>(
null,
);
const [qualityAnchor, setQualityAnchor] = useState<HTMLElement | null>(null);
const [subtitleIndex, setSubtitleIndex] = useState<number>(-1);
const [volumeDraft, setVolumeDraft] = useState<number | null>(null);
const volumeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
const clearVolumeTimer = () => {
if (volumeTimerRef.current) {
clearTimeout(volumeTimerRef.current);
volumeTimerRef.current = null;
}
};
useEffect(() => clearVolumeTimer, []);
const sessions = useQuery({
queryKey: ["remoteSessions"],
queryFn: async () => {
if (!api || !user?.Id) return [];
const result = await getSessionApi(api).getSessions();
return result.data;
},
enabled: !!api && !!user?.Id,
refetchInterval: () => {
if (document.visibilityState !== "visible") return false;
return 2500;
},
refetchIntervalInBackground: false,
networkMode: "always",
});
const remoteSessions = (sessions.data ?? []).filter(
(session) =>
session.Id &&
session.DeviceId !== api?.deviceInfo.id &&
session.UserId === user?.Id,
);
const playing = remoteSessions.find((session) => session.NowPlayingItem);
const selected =
remoteSessions.find((session) => session.Id === selectedId) ??
playing ??
remoteSessions[0];
useEffect(() => {
setVolumeDraft(null);
setSubtitleIndex(-1);
clearVolumeTimer();
}, [selected?.Id]);
// Keep the picked volume until the target reports it back (progress updates
// can lag), then drop the optimistic value.
useEffect(() => {
if (volumeDraft == null) return;
const server = selected?.PlayState?.VolumeLevel;
if (server != null && Math.abs(server / 100 - volumeDraft) <= 0.02) {
setVolumeDraft(null);
clearVolumeTimer();
}
}, [selected?.PlayState?.VolumeLevel, volumeDraft]);
const command = async (
session: SessionInfoDto,
name: PlaystateCommand,
seekPositionTicks?: number,
) => {
if (!api || !session.Id) return;
try {
await getSessionApi(api).sendPlaystateCommand({
sessionId: session.Id,
command: name,
seekPositionTicks,
controllingUserId: user?.Id,
});
await sessions.refetch();
} catch (error) {
console.error("Remote command failed", error);
}
};
const general = async (
session: SessionInfoDto,
name: GeneralCommandType,
args?: Record<string, string>,
) => {
if (!api || !session.Id) return;
try {
await getSessionApi(api).sendFullGeneralCommand({
sessionId: session.Id,
generalCommand: {
Name: name,
Arguments: args,
ControllingUserId: user?.Id,
},
});
await sessions.refetch();
} catch (error) {
console.error("Remote general command failed", error);
}
};
const nowPlaying = selected?.NowPlayingItem;
const playState = selected?.PlayState;
const isPaused = playState?.IsPaused ?? true;
const duration = nowPlaying?.RunTimeTicks ?? 0;
const position = playState?.PositionTicks ?? 0;
const volume = volumeDraft ?? (playState?.VolumeLevel ?? 100) / 100;
const isMuted = playState?.IsMuted ?? false;
const coverUrl = useMemo(() => {
if (!api || !nowPlaying) return undefined;
const imageItemId = nowPlaying.AlbumId ?? nowPlaying.Id;
if (!imageItemId) return undefined;
return getImageUrlsApi(api).getItemImageUrlById(imageItemId, "Primary", {
quality: 90,
fillHeight: 720,
fillWidth: 480,
});
}, [api, nowPlaying?.AlbumId, nowPlaying?.Id]);
const palette = useMemo(() => getCoverPalette(nowPlaying), [nowPlaying?.Id]);
const isEpisode = nowPlaying?.Type === "Episode";
const title = isEpisode
? (nowPlaying?.SeriesName ?? nowPlaying?.Name)
: nowPlaying?.Name;
const subtitle = isEpisode
? `Сезон ${nowPlaying?.ParentIndexNumber ?? 1}, Серия ${
nowPlaying?.IndexNumber ?? 1
} — «${nowPlaying?.Name}»`
: [
nowPlaying?.AlbumArtist ?? nowPlaying?.Artists?.join(", "),
nowPlaying?.Album,
]
.filter(Boolean)
.join(" · ");
const videoStream = nowPlaying?.MediaStreams?.find(
(stream) => stream.Type === "Video",
);
const audioStream = nowPlaying?.MediaStreams?.find(
(stream) => stream.Type === "Audio",
);
const subtitleStreams =
nowPlaying?.MediaStreams?.filter((stream) => stream.Type === "Subtitle") ??
[];
const chips = [
nowPlaying?.OfficialRating,
nowPlaying?.ProductionYear,
nowPlaying?.RunTimeTicks
? getRuntimeCompact(nowPlaying.RunTimeTicks)
: null,
videoStream?.Height ? `${videoStream.Height}p` : null,
channelLabel(audioStream?.Channels),
].filter(Boolean) as string[];
const qualityLabel = videoStream?.Height
? `${videoStream.Height}p`
: (nowPlaying?.MediaSources?.[0]?.Name ?? "Авто");
const subtitleLabel =
subtitleIndex < 0
? "Выкл."
: (subtitleStreams.find((s) => s.Index === subtitleIndex)?.DisplayTitle ??
`Дорожка ${subtitleIndex}`);
const toggleMute = () => {
if (!selected) return;
void general(
selected,
isMuted ? GeneralCommandType.Unmute : GeneralCommandType.Mute,
);
};
const chooseSubtitle = (index: number) => {
if (!selected) return;
setSubtitleIndex(index);
setSubtitleAnchor(null);
void general(selected, GeneralCommandType.SetSubtitleStreamIndex, {
Index: String(index),
});
};
const transport = (name: PlaystateCommand) => {
if (!selected) return;
void command(selected, name);
};
return (
<div
className="remote-page"
style={
{
"--remote-base": palette.base,
"--remote-deep": palette.deep,
} as React.CSSProperties
}
>
<header className="remote-topbar" data-tauri-drag-region>
<div className="remote-topbar-left">
<div className="remote-brand">
<span className="remote-brand-mark">
<span className="material-symbols-rounded">settings_remote</span>
</span>
<span className="remote-brand-name">Пульт</span>
</div>
<span className="remote-topbar-divider" />
<IconButton
aria-label="Главная"
title="Главная"
onClick={() => navigate({ to: "/home" })}
>
<span className="material-symbols-rounded">home</span>
</IconButton>
</div>
<div className="remote-topbar-right">
<IconButton
aria-label="Поиск"
title="Поиск"
onClick={toggleSearchDialog}
>
<span className="material-symbols-rounded">search</span>
</IconButton>
<UserAvatarMenu />
<IconButton
aria-label="Настройки"
title="Настройки"
onClick={() => navigate({ to: "/settings/preferences" })}
>
<span className="material-symbols-rounded">settings</span>
</IconButton>
<span className="remote-topbar-divider" />
<WindowControls />
</div>
</header>
{!selected ? (
<div className="remote-empty">
<span className="material-symbols-rounded">settings_remote</span>
<h1>Нет доступных устройств</h1>
<p>
Откройте клиент Jellyfin (телевизор, браузер, телефон) под этой
учётной записью, и он появится здесь.
</p>
</div>
) : (
<>
<div className="remote-body">
<aside className="remote-devices" aria-label="Устройства">
<div className="remote-devices-title">Устройства</div>
<ul className="remote-device-list">
{remoteSessions.map((session) => {
const isActive = session.Id === selected?.Id;
const sessionItem = session.NowPlayingItem;
return (
<li key={session.Id}>
<button
type="button"
className={`remote-device${isActive ? " is-active" : ""}`}
onClick={() => setSelectedId(session.Id ?? null)}
>
<span className="material-symbols-rounded remote-device-icon">
{sessionKind(session)}
</span>
<span className="remote-device-info">
<span className="remote-device-name">
{sessionLabel(session)}
</span>
<span className="remote-device-meta">
{sessionItem?.Name
? session.PlayState?.IsPaused
? `Пауза · ${sessionItem.Name}`
: `Играет · ${sessionItem.Name}`
: "Свободно"}
</span>
</span>
{sessionItem && (
<span
className={`remote-device-dot${
session.PlayState?.IsPaused ? " is-paused" : ""
}`}
/>
)}
</button>
</li>
);
})}
</ul>
</aside>
<main className="remote-hero">
<div className="remote-poster">
<div className="remote-poster-frame">
{coverUrl ? (
<img src={coverUrl} alt={title ?? "Постер"} />
) : (
<span className="material-symbols-rounded">live_tv</span>
)}
</div>
</div>
<section className="remote-details">
<h1 className="remote-title">
{title ?? sessionLabel(selected)}
</h1>
{subtitle && <h2 className="remote-subtitle">{subtitle}</h2>}
{chips.length > 0 && (
<div className="remote-chips">
{chips.map((chip) => (
<span key={chip} className="remote-chip">
{chip}
</span>
))}
</div>
)}
{nowPlaying?.Overview && (
<p className="remote-overview">{nowPlaying.Overview}</p>
)}
{!nowPlaying && (
<p className="remote-overview">
Устройство свободно. Запустите воспроизведение на нём, и
здесь появятся название, постер и управление.
</p>
)}
<div className="remote-transport">
<Tooltip title="Назад">
<button
type="button"
className="remote-round"
onClick={() => transport(PlaystateCommand.Rewind)}
disabled={!nowPlaying}
aria-label="Назад"
>
<span className="material-symbols-rounded">
fast_rewind
</span>
</button>
</Tooltip>
<Tooltip title="Предыдущий">
<button
type="button"
className="remote-round"
onClick={() =>
transport(PlaystateCommand.PreviousTrack)
}
disabled={!nowPlaying}
aria-label="Предыдущий"
>
<span className="material-symbols-rounded">
skip_previous
</span>
</button>
</Tooltip>
<button
type="button"
className="remote-round remote-round-primary"
onClick={() => transport(PlaystateCommand.PlayPause)}
disabled={!nowPlaying}
aria-label={isPaused ? "Играть" : "Пауза"}
>
<span className="material-symbols-rounded">
{isPaused ? "play_arrow" : "pause"}
</span>
</button>
<Tooltip title="Следующий">
<button
type="button"
className="remote-round"
onClick={() => transport(PlaystateCommand.NextTrack)}
disabled={!nowPlaying}
aria-label="Следующий"
>
<span className="material-symbols-rounded">
skip_next
</span>
</button>
</Tooltip>
<Tooltip title="Вперёд">
<button
type="button"
className="remote-round"
onClick={() => transport(PlaystateCommand.FastForward)}
disabled={!nowPlaying}
aria-label="Вперёд"
>
<span className="material-symbols-rounded">
fast_forward
</span>
</button>
</Tooltip>
</div>
</section>
</main>
</div>
<div className="remote-timeline">
<span className="remote-time">{formatTime(position)}</span>
<Slider
className="remote-timeline-slider"
value={Math.min(position, duration)}
max={duration || 1}
step={1}
size="small"
aria-label="Перемотка"
onChangeCommitted={(_, value) => {
const next = Array.isArray(value) ? value[0] : value;
if (selected) {
void command(
selected,
PlaystateCommand.Seek,
Math.round(next),
);
}
}}
/>
<span className="remote-time">{formatTime(duration)}</span>
</div>
<footer className="remote-bottombar">
<button
type="button"
className="remote-bottom-item"
onClick={(event) => setSubtitleAnchor(event.currentTarget)}
disabled={!nowPlaying || subtitleStreams.length === 0}
>
<span className="material-symbols-rounded">subtitles</span>
<span>Субтитры: {subtitleLabel}</span>
<span className="material-symbols-rounded remote-chevron">
expand_more
</span>
</button>
<div className="remote-bottom-item remote-bottom-volume">
<IconButton
onClick={toggleMute}
aria-label={isMuted ? "Включить звук" : "Выключить звук"}
disabled={!nowPlaying}
>
<span className="material-symbols-rounded">
{isMuted || volume === 0 ? "volume_off" : "volume_up"}
</span>
</IconButton>
<Slider
value={isMuted ? 0 : volume}
min={0}
max={1}
step={0.01}
size="small"
aria-label="Громкость"
onChange={(_, value) => {
setVolumeDraft(Array.isArray(value) ? value[0] : value);
}}
onChangeCommitted={(_, value) => {
const next = Array.isArray(value) ? value[0] : value;
setVolumeDraft(next);
clearVolumeTimer();
volumeTimerRef.current = setTimeout(() => {
setVolumeDraft(null);
}, 12000);
if (isMuted) {
void general(selected, GeneralCommandType.Unmute);
}
void general(selected, GeneralCommandType.SetVolume, {
Volume: String(Math.round(next * 100)),
});
}}
/>
</div>
<button
type="button"
className="remote-bottom-item"
onClick={(event) => setQualityAnchor(event.currentTarget)}
disabled={!nowPlaying}
>
<span className="material-symbols-rounded">monitor</span>
<span>Качество: {qualityLabel}</span>
<span className="material-symbols-rounded remote-chevron">
expand_more
</span>
</button>
<button
type="button"
className="remote-bottom-item"
onClick={() =>
void general(selected, GeneralCommandType.ToggleFullscreen)
}
disabled={!nowPlaying}
>
<span className="material-symbols-rounded">fullscreen</span>
<span>На весь экран</span>
</button>
</footer>
<Menu
anchorEl={subtitleAnchor}
open={Boolean(subtitleAnchor)}
onClose={() => setSubtitleAnchor(null)}
>
<MenuItem
selected={subtitleIndex === -1}
onClick={() => chooseSubtitle(-1)}
>
Выключены
</MenuItem>
{subtitleStreams.map((stream) => (
<MenuItem
key={stream.Index}
selected={subtitleIndex === stream.Index}
onClick={() => chooseSubtitle(stream.Index ?? -1)}
>
{stream.DisplayTitle ?? stream.Language ?? "Дорожка"}
</MenuItem>
))}
</Menu>
<Menu
anchorEl={qualityAnchor}
open={Boolean(qualityAnchor)}
onClose={() => setQualityAnchor(null)}
>
<MenuItem disabled>Качество выбирает сам клиент</MenuItem>
{nowPlaying?.MediaSources?.map((source) => (
<MenuItem key={source.Id} disabled>
{source.Name ?? "Источник"}
</MenuItem>
))}
</Menu>
</>
)}
</div>
);
}
+3 -1
View File
@@ -29,6 +29,7 @@ import { useShallow } from "zustand/shallow";
import { NavigationDrawer } from "@/components/appBar/navigationDrawer"; import { NavigationDrawer } from "@/components/appBar/navigationDrawer";
import BackButton from "@/components/buttons/backButton"; import BackButton from "@/components/buttons/backButton";
import { UserAvatarMenu } from "@/components/userAvatarMenu"; import { UserAvatarMenu } from "@/components/userAvatarMenu";
import WindowControls from "@/components/windowControls";
import { useApiInContext } from "@/utils/store/api"; import { useApiInContext } from "@/utils/store/api";
import useDebounce from "@/utils/hooks/useDebounce"; import useDebounce from "@/utils/hooks/useDebounce";
import { useCentralStore } from "@/utils/store/central"; import { useCentralStore } from "@/utils/store/central";
@@ -110,7 +111,7 @@ function SearchPage() {
<div <div
className="search-page-content" className="search-page-content"
style={{ style={{
paddingTop: "2.4em", paddingTop: "4.4em",
}} }}
> >
{debouncedSearchTerm ? ( {debouncedSearchTerm ? (
@@ -361,6 +362,7 @@ function SearchAppBar({
<div className="material-symbols-rounded">favorite</div> <div className="material-symbols-rounded">favorite</div>
</IconButton> </IconButton>
<UserAvatarMenu /> <UserAvatarMenu />
<WindowControls />
</div> </div>
</AppBar> </AppBar>
<NavigationDrawer <NavigationDrawer
+8
View File
@@ -8,6 +8,14 @@
padding: 0; padding: 0;
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
// Frameless window on Windows/Linux: the floating window buttons
// sit in the top 44px, so the settings grid starts below that strip.
html.is-windows &,
html.is-linux & {
padding-top: 44px;
box-sizing: border-box;
}
} }
&-scrollY { &-scrollY {
padding: 2em; padding: 2em;
+84
View File
@@ -0,0 +1,84 @@
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import { decode } from "blurhash";
type Palette = {
/** Main wall colour of the player. */
base: string;
/** Darker end of the vertical gradient. */
deep: string;
};
const FALLBACK: Palette = { base: "hsl(266 32% 22%)", deep: "hsl(266 40% 9%)" };
const clamp = (value: number, min: number, max: number) =>
Math.min(max, Math.max(min, value));
const rgbToHsl = (r: number, g: number, b: number) => {
const rn = r / 255;
const gn = g / 255;
const bn = b / 255;
const max = Math.max(rn, gn, bn);
const min = Math.min(rn, gn, bn);
const l = (max + min) / 2;
let h = 0;
let s = 0;
if (max !== min) {
const d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch (max) {
case rn:
h = (gn - bn) / d + (gn < bn ? 6 : 0);
break;
case gn:
h = (bn - rn) / d + 2;
break;
default:
h = (rn - gn) / d + 4;
}
h /= 6;
}
return { h: h * 360, s, l };
};
const hsl = (h: number, s: number, l: number) =>
`hsl(${Math.round(h)} ${Math.round(s * 100)}% ${Math.round(l * 100)}%)`;
/**
* The player wall follows the record: decode the cover's blurhash, average it
* and turn it into a muted, slightly saturated background. Blurhash is local
* (no CORS/network work), and the artwork always ships one from Jellyfin.
*/
export const getCoverPalette = (item?: BaseItemDto | null): Palette => {
const tag = item?.ImageTags?.Primary;
const hash = tag ? item?.ImageBlurHashes?.Primary?.[tag] : undefined;
if (!hash) return FALLBACK;
try {
const size = 32;
const pixels = decode(hash, size, size);
let r = 0;
let g = 0;
let b = 0;
let count = 0;
for (let i = 0; i < pixels.length; i += 4) {
r += pixels[i];
g += pixels[i + 1];
b += pixels[i + 2];
count++;
}
if (!count) return FALLBACK;
const { h, s, l } = rgbToHsl(r / count, g / count, b / count);
// A wall, not a black rectangle: keep a hint of the cover's hue and
// lift it into a comfortable mid-dark range.
const wallSaturation = clamp(s + 0.14, 0.16, 0.42);
const wallLightness = clamp(l + 0.1, 0.16, 0.3);
return {
base: hsl(h, wallSaturation, wallLightness),
deep: hsl(h, wallSaturation, clamp(wallLightness * 0.45, 0.05, 0.12)),
};
} catch {
return FALLBACK;
}
};
+15
View File
@@ -59,6 +59,21 @@ export const playAudio = (
playlistItemId?: string | undefined, playlistItemId?: string | undefined,
startTimeTicks = 0, startTimeTicks = 0,
): void => { ): void => {
// Only one medium at a time: starting music stops video playback.
if (typeof document !== "undefined") {
const video = (document
.querySelector("hls-video")
?.shadowRoot?.querySelector("video") ??
document.querySelector("video")) as HTMLVideoElement | null;
if (video && !video.paused) video.pause();
}
void import("./playback").then(({ usePlaybackStore }) => {
const state = usePlaybackStore.getState();
if (state.mediaSource?.id || state.playerState.isPlayerPlaying) {
usePlaybackStore.setState(usePlaybackStore.getInitialState());
}
});
useAudioPlayback.setState({ useAudioPlayback.setState({
display: true, display: true,
url, url,
+4 -1
View File
@@ -29,7 +29,7 @@ import {
} from "../storage/player"; } from "../storage/player";
import type audioPlaybackInfo from "../types/audioPlaybackInfo"; import type audioPlaybackInfo from "../types/audioPlaybackInfo";
import type subtitlePlaybackInfo from "../types/subtitlePlaybackInfo"; import type subtitlePlaybackInfo from "../types/subtitlePlaybackInfo";
import { generateAudioStreamUrl, playAudio } from "./audioPlayback"; import { generateAudioStreamUrl, playAudio, stopPlayback } from "./audioPlayback";
import useQueue, { setQueue } from "./queue"; import useQueue, { setQueue } from "./queue";
type PlaybackStoreState = { type PlaybackStoreState = {
@@ -731,6 +731,9 @@ export const initializePlayback = async (args: {
subtitleStreamIndex, subtitleStreamIndex,
} = args; } = args;
// Only one medium at a time: starting a video stops music playback.
stopPlayback();
if (!mediaSource.MediaSources?.[0]?.Id) { if (!mediaSource.MediaSources?.[0]?.Id) {
throw new Error("Media source is undefined in initializePlayback"); throw new Error("Media source is undefined in initializePlayback");
} }