Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b00f93d262 | ||
|
|
4c9dd86962 | ||
|
|
3131c1f905 | ||
|
|
c560f8ae1b | ||
|
|
cf5fb43377 | ||
|
|
5a9b3ad273 | ||
|
|
1c499f42ec | ||
|
|
61ebc66127 | ||
|
|
c232c1bf12 | ||
|
|
2d5f49c32e | ||
|
|
0c50acddd9 |
No files matched your search
@@ -42,3 +42,6 @@ target/
|
|||||||
generateBanner
|
generateBanner
|
||||||
# Million Lint
|
# Million Lint
|
||||||
.million
|
.million
|
||||||
|
|
||||||
|
# TypeScript incremental build cache
|
||||||
|
*.tsbuildinfo
|
||||||
Generated
+19
-19
@@ -64,10 +64,10 @@ importers:
|
|||||||
version: 1.33.5(react-dom@19.3.1(react@19.3.1))(react@19.3.1)
|
version: 1.33.5(react-dom@19.3.1(react@19.3.1))(react@19.3.1)
|
||||||
'@tanstack/react-query':
|
'@tanstack/react-query':
|
||||||
specifier: ^5.104.4
|
specifier: ^5.104.4
|
||||||
version: 5.104.5(@types/react@19.3.0)(react@19.3.1)
|
version: 5.104.4(@types/react@19.3.0)(react@19.3.1)
|
||||||
'@tanstack/react-query-devtools':
|
'@tanstack/react-query-devtools':
|
||||||
specifier: ^5.104.4
|
specifier: ^5.104.4
|
||||||
version: 5.104.5(@tanstack/react-query@5.104.5(@types/react@19.3.0)(react@19.3.1))(@types/react@19.3.0)(csstype@3.2.3)(react@19.3.1)
|
version: 5.104.4(@tanstack/react-query@5.104.4(@types/react@19.3.0)(react@19.3.1))(@types/react@19.3.0)(csstype@3.2.3)(react@19.3.1)
|
||||||
'@tanstack/react-router':
|
'@tanstack/react-router':
|
||||||
specifier: ^1.170.45
|
specifier: ^1.170.45
|
||||||
version: 1.170.45(react-dom@19.3.1(react@19.3.1))(react@19.3.1)
|
version: 1.170.45(react-dom@19.3.1(react@19.3.1))(react@19.3.1)
|
||||||
@@ -1399,11 +1399,11 @@ packages:
|
|||||||
resolution: {integrity: sha512-y/xtNPNt/YeyoVxE/JCx+T7yjEzpezmbb+toK8DDD1P4m7Kzs5YR956+7OKexG3f8aXgC3rLZl7b1V+yNUSy5w==}
|
resolution: {integrity: sha512-y/xtNPNt/YeyoVxE/JCx+T7yjEzpezmbb+toK8DDD1P4m7Kzs5YR956+7OKexG3f8aXgC3rLZl7b1V+yNUSy5w==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
'@tanstack/query-core@5.104.5':
|
'@tanstack/query-core@5.104.4':
|
||||||
resolution: {integrity: sha512-Q94gI8Opd+CbdVNOdj8ZCyV8WqLYitrDq1t96Xc8WZT6lY0r5iRnJLXYDxMex7EEf2v+mXvn4FcjaBKSxXZQ9A==}
|
resolution: {integrity: sha512-nU4Yrb8Sjn0DeVb7PKG9uiepNavys3yoxy1FX0hViY4/P6Ng/mBje2SMl7i9812rtyHKtHyqiaC/td6GkI8StA==}
|
||||||
|
|
||||||
'@tanstack/query-devtools@5.104.5':
|
'@tanstack/query-devtools@5.104.4':
|
||||||
resolution: {integrity: sha512-BLVEw4lFF7aIRsfqGvI50SSR9oN46/EmlygC+3h5TUdI+fL8GnMQialL3H92TbYi7J1b/hYlUGnckBT2uG5h8w==}
|
resolution: {integrity: sha512-paO01QqGmuS0dNtOQeWTVrAMwOZAoL3QARPnOxSnck6Zp1s4sPphP2hlJEjBrjk2JGPTnTFOEbK15ZoiqljmOA==}
|
||||||
|
|
||||||
'@tanstack/react-devtools@0.10.13':
|
'@tanstack/react-devtools@0.10.13':
|
||||||
resolution: {integrity: sha512-r0cdB/14+st2Vxl/1Bodlyq4VC8pf9SykLQDYbGHDc1+V146WQo5B3KlYLkfyxD9Q/6+9NPRQHZyl8fvZVMdRA==}
|
resolution: {integrity: sha512-r0cdB/14+st2Vxl/1Bodlyq4VC8pf9SykLQDYbGHDc1+V146WQo5B3KlYLkfyxD9Q/6+9NPRQHZyl8fvZVMdRA==}
|
||||||
@@ -1423,18 +1423,18 @@ packages:
|
|||||||
'@tanstack/react-start':
|
'@tanstack/react-start':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@tanstack/react-query-devtools@5.104.5':
|
'@tanstack/react-query-devtools@5.104.4':
|
||||||
resolution: {integrity: sha512-2SMhSSYnOGSaPLuSTKLOj5nPoP4sqasOfkpTn5BLe6LIZuHzrpcqrJx0Rm8uUSN5Ob4lPAbh/1oWClnnGaR7Bg==}
|
resolution: {integrity: sha512-FvpCnCv3gpY0Y6Cw09kNjghpmhA3/MJn5MsLuaPFfalpTWoyXw1XZr+Q7kPLS4bp1VBBjUCyVWThzu4anve70g==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@tanstack/react-query': ^5.104.5
|
'@tanstack/react-query': ^5.104.4
|
||||||
'@types/react': ^18 || ^19
|
'@types/react': ^18 || ^19
|
||||||
react: ^18 || ^19
|
react: ^18 || ^19
|
||||||
peerDependenciesMeta:
|
peerDependenciesMeta:
|
||||||
'@types/react':
|
'@types/react':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@tanstack/react-query@5.104.5':
|
'@tanstack/react-query@5.104.4':
|
||||||
resolution: {integrity: sha512-RORgFe052U+93weaNuqg7qHq7vNVNzXN/VrXqD4bbAuQCWUqOl2lV5Ui9flWk5CVvMyL/Bh27QWhzwH0aaOx9g==}
|
resolution: {integrity: sha512-YD5QkvUNy8Ey3LbOy2vwL97JjoYycwDv++cWAibTe+9BLYvl3c09XpYp5dZ2VcxcguwoDhGF+utYJYb79RB36w==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@types/react': ^18 || ^19
|
'@types/react': ^18 || ^19
|
||||||
react: ^18 || ^19
|
react: ^18 || ^19
|
||||||
@@ -4546,16 +4546,16 @@ snapshots:
|
|||||||
|
|
||||||
'@tanstack/pacer-lite@0.1.1': {}
|
'@tanstack/pacer-lite@0.1.1': {}
|
||||||
|
|
||||||
'@tanstack/query-core@5.104.5': {}
|
'@tanstack/query-core@5.104.4': {}
|
||||||
|
|
||||||
'@tanstack/query-devtools@5.104.5(csstype@3.2.3)':
|
'@tanstack/query-devtools@5.104.4(csstype@3.2.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@kobalte/core': 0.13.14(solid-js@1.9.17)
|
'@kobalte/core': 0.13.14(solid-js@1.9.17)
|
||||||
'@solid-primitives/keyed': 1.5.3(solid-js@1.9.17)
|
'@solid-primitives/keyed': 1.5.3(solid-js@1.9.17)
|
||||||
'@solid-primitives/resize-observer': 2.2.0(solid-js@1.9.17)
|
'@solid-primitives/resize-observer': 2.2.0(solid-js@1.9.17)
|
||||||
'@solid-primitives/storage': 1.3.11(solid-js@1.9.17)
|
'@solid-primitives/storage': 1.3.11(solid-js@1.9.17)
|
||||||
'@tanstack/match-sorter-utils': 9.2.6
|
'@tanstack/match-sorter-utils': 9.2.6
|
||||||
'@tanstack/query-core': 5.104.5
|
'@tanstack/query-core': 5.104.4
|
||||||
clsx: 2.1.1
|
clsx: 2.1.1
|
||||||
goober: 2.1.19(csstype@3.2.3)
|
goober: 2.1.19(csstype@3.2.3)
|
||||||
solid-js: 1.9.17
|
solid-js: 1.9.17
|
||||||
@@ -4585,19 +4585,19 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- react-dom
|
- react-dom
|
||||||
|
|
||||||
'@tanstack/react-query-devtools@5.104.5(@tanstack/react-query@5.104.5(@types/react@19.3.0)(react@19.3.1))(@types/react@19.3.0)(csstype@3.2.3)(react@19.3.1)':
|
'@tanstack/react-query-devtools@5.104.4(@tanstack/react-query@5.104.4(@types/react@19.3.0)(react@19.3.1))(@types/react@19.3.0)(csstype@3.2.3)(react@19.3.1)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@tanstack/query-devtools': 5.104.5(csstype@3.2.3)
|
'@tanstack/query-devtools': 5.104.4(csstype@3.2.3)
|
||||||
'@tanstack/react-query': 5.104.5(@types/react@19.3.0)(react@19.3.1)
|
'@tanstack/react-query': 5.104.4(@types/react@19.3.0)(react@19.3.1)
|
||||||
react: 19.3.1
|
react: 19.3.1
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@types/react': 19.3.0
|
'@types/react': 19.3.0
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- csstype
|
- csstype
|
||||||
|
|
||||||
'@tanstack/react-query@5.104.5(@types/react@19.3.0)(react@19.3.1)':
|
'@tanstack/react-query@5.104.4(@types/react@19.3.0)(react@19.3.1)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@tanstack/query-core': 5.104.5
|
'@tanstack/query-core': 5.104.4
|
||||||
react: 19.3.1
|
react: 19.3.1
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@types/react': 19.3.0
|
'@types/react': 19.3.0
|
||||||
|
|||||||
Generated
+398
-91
@@ -73,11 +73,11 @@ dependencies = [
|
|||||||
"clipboard-win",
|
"clipboard-win",
|
||||||
"image",
|
"image",
|
||||||
"log",
|
"log",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-app-kit",
|
"objc2-app-kit 0.3.2",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-core-graphics",
|
"objc2-core-graphics",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
@@ -320,6 +320,7 @@ dependencies = [
|
|||||||
"tauri-plugin-global-shortcut",
|
"tauri-plugin-global-shortcut",
|
||||||
"tauri-plugin-localhost",
|
"tauri-plugin-localhost",
|
||||||
"tauri-plugin-log",
|
"tauri-plugin-log",
|
||||||
|
"tauri-plugin-mcp-bridge",
|
||||||
"tauri-plugin-notification",
|
"tauri-plugin-notification",
|
||||||
"tauri-plugin-process",
|
"tauri-plugin-process",
|
||||||
"tauri-plugin-shell",
|
"tauri-plugin-shell",
|
||||||
@@ -338,13 +339,22 @@ dependencies = [
|
|||||||
"generic-array",
|
"generic-array",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "block2"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f"
|
||||||
|
dependencies = [
|
||||||
|
"objc2 0.5.3",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "block2"
|
name = "block2"
|
||||||
version = "0.6.2"
|
version = "0.6.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5"
|
checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -794,6 +804,12 @@ dependencies = [
|
|||||||
"syn 3.0.9",
|
"syn 3.0.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "data-encoding"
|
||||||
|
version = "2.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dbus"
|
name = "dbus"
|
||||||
version = "0.9.12"
|
version = "0.9.12"
|
||||||
@@ -904,9 +920,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38"
|
checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.13.2",
|
"bitflags 2.13.2",
|
||||||
"block2",
|
"block2 0.6.2",
|
||||||
"libc",
|
"libc",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1604,8 +1620,8 @@ checksum = "8c386b0a4a70cb2d39fffd74480f985b6f0bfbcb934b6a6b6b7e630e448f242e"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"keyboard-types 0.7.0",
|
"keyboard-types 0.7.0",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-app-kit",
|
"objc2-app-kit 0.3.2",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 2.0.21",
|
"thiserror 2.0.21",
|
||||||
@@ -2005,6 +2021,8 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
"png 0.18.1",
|
"png 0.18.1",
|
||||||
"tiff",
|
"tiff",
|
||||||
|
"zune-core",
|
||||||
|
"zune-jpeg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2380,8 +2398,8 @@ checksum = "fd604973958ddcc11b561193c0fb96ba146506ef2f231ef2e7c35fd2cbc9beca"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"log",
|
"log",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
"time",
|
"time",
|
||||||
"uuid",
|
"uuid",
|
||||||
]
|
]
|
||||||
@@ -2475,10 +2493,10 @@ dependencies = [
|
|||||||
"dpi",
|
"dpi",
|
||||||
"gtk",
|
"gtk",
|
||||||
"keyboard-types 0.8.3",
|
"keyboard-types 0.8.3",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-app-kit",
|
"objc2-app-kit 0.3.2",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"png 0.18.1",
|
"png 0.18.1",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -2609,6 +2627,22 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc-sys"
|
||||||
|
version = "0.3.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2"
|
||||||
|
version = "0.5.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "19d5490aaf8f1d7cf7688dfa9b0ce07900e168852c45cd2c03f534dfd27cfd0b"
|
||||||
|
dependencies = [
|
||||||
|
"objc-sys",
|
||||||
|
"objc2-encode",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "objc2"
|
name = "objc2"
|
||||||
version = "0.6.5"
|
version = "0.6.5"
|
||||||
@@ -2619,6 +2653,22 @@ dependencies = [
|
|||||||
"objc2-exception-helper",
|
"objc2-exception-helper",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-app-kit"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.13.2",
|
||||||
|
"block2 0.5.1",
|
||||||
|
"libc",
|
||||||
|
"objc2 0.5.3",
|
||||||
|
"objc2-core-data 0.2.2",
|
||||||
|
"objc2-core-image 0.2.2",
|
||||||
|
"objc2-foundation 0.2.2",
|
||||||
|
"objc2-quartz-core 0.2.2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "objc2-app-kit"
|
name = "objc2-app-kit"
|
||||||
version = "0.3.2"
|
version = "0.3.2"
|
||||||
@@ -2626,12 +2676,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c"
|
checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.13.2",
|
"bitflags 2.13.2",
|
||||||
"block2",
|
"block2 0.6.2",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-core-graphics",
|
"objc2-core-graphics",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
"objc2-quartz-core",
|
"objc2-quartz-core 0.3.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-cloud-kit"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.13.2",
|
||||||
|
"block2 0.5.1",
|
||||||
|
"objc2 0.5.3",
|
||||||
|
"objc2-core-location 0.2.2",
|
||||||
|
"objc2-foundation 0.2.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2641,8 +2704,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "73ad74d880bb43877038da939b7427bba67e9dd42004a18b809ba7d87cee241c"
|
checksum = "73ad74d880bb43877038da939b7427bba67e9dd42004a18b809ba7d87cee241c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.13.2",
|
"bitflags 2.13.2",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-contacts"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889"
|
||||||
|
dependencies = [
|
||||||
|
"block2 0.5.1",
|
||||||
|
"objc2 0.5.3",
|
||||||
|
"objc2-foundation 0.2.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-core-data"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.13.2",
|
||||||
|
"block2 0.5.1",
|
||||||
|
"objc2 0.5.3",
|
||||||
|
"objc2-foundation 0.2.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2651,8 +2737,8 @@ version = "0.3.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0b402a653efbb5e82ce4df10683b6b28027616a2715e90009947d50b8dd298fa"
|
checksum = "0b402a653efbb5e82ce4df10683b6b28027616a2715e90009947d50b8dd298fa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2663,7 +2749,7 @@ checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.13.2",
|
"bitflags 2.13.2",
|
||||||
"dispatch2",
|
"dispatch2",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2674,19 +2760,43 @@ checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.13.2",
|
"bitflags 2.13.2",
|
||||||
"dispatch2",
|
"dispatch2",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-io-surface",
|
"objc2-io-surface",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-core-image"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80"
|
||||||
|
dependencies = [
|
||||||
|
"block2 0.5.1",
|
||||||
|
"objc2 0.5.3",
|
||||||
|
"objc2-foundation 0.2.2",
|
||||||
|
"objc2-metal",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "objc2-core-image"
|
name = "objc2-core-image"
|
||||||
version = "0.3.2"
|
version = "0.3.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e5d563b38d2b97209f8e861173de434bd0214cf020e3423a52624cd1d989f006"
|
checksum = "e5d563b38d2b97209f8e861173de434bd0214cf020e3423a52624cd1d989f006"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-core-location"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781"
|
||||||
|
dependencies = [
|
||||||
|
"block2 0.5.1",
|
||||||
|
"objc2 0.5.3",
|
||||||
|
"objc2-contacts",
|
||||||
|
"objc2-foundation 0.2.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2695,8 +2805,8 @@ version = "0.3.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ca347214e24bc973fc025fd0d36ebb179ff30536ed1f80252706db19ee452009"
|
checksum = "ca347214e24bc973fc025fd0d36ebb179ff30536ed1f80252706db19ee452009"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2706,7 +2816,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d"
|
checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.13.2",
|
"bitflags 2.13.2",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-core-graphics",
|
"objc2-core-graphics",
|
||||||
]
|
]
|
||||||
@@ -2726,6 +2836,18 @@ dependencies = [
|
|||||||
"cc",
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-foundation"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.13.2",
|
||||||
|
"block2 0.5.1",
|
||||||
|
"libc",
|
||||||
|
"objc2 0.5.3",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "objc2-foundation"
|
name = "objc2-foundation"
|
||||||
version = "0.3.2"
|
version = "0.3.2"
|
||||||
@@ -2733,9 +2855,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"
|
checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.13.2",
|
"bitflags 2.13.2",
|
||||||
"block2",
|
"block2 0.6.2",
|
||||||
"libc",
|
"libc",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2746,10 +2868,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d"
|
checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.13.2",
|
"bitflags 2.13.2",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-link-presentation"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398"
|
||||||
|
dependencies = [
|
||||||
|
"block2 0.5.1",
|
||||||
|
"objc2 0.5.3",
|
||||||
|
"objc2-app-kit 0.2.2",
|
||||||
|
"objc2-foundation 0.2.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-metal"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.13.2",
|
||||||
|
"block2 0.5.1",
|
||||||
|
"objc2 0.5.3",
|
||||||
|
"objc2-foundation 0.2.2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "objc2-osa-kit"
|
name = "objc2-osa-kit"
|
||||||
version = "0.3.2"
|
version = "0.3.2"
|
||||||
@@ -2757,9 +2903,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "f112d1746737b0da274ef79a23aac283376f335f4095a083a267a082f21db0c0"
|
checksum = "f112d1746737b0da274ef79a23aac283376f335f4095a083a267a082f21db0c0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.13.2",
|
"bitflags 2.13.2",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-app-kit",
|
"objc2-app-kit 0.3.2",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-quartz-core"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.13.2",
|
||||||
|
"block2 0.5.1",
|
||||||
|
"objc2 0.5.3",
|
||||||
|
"objc2-foundation 0.2.2",
|
||||||
|
"objc2-metal",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2769,9 +2928,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f"
|
checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.13.2",
|
"bitflags 2.13.2",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-symbols"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc"
|
||||||
|
dependencies = [
|
||||||
|
"objc2 0.5.3",
|
||||||
|
"objc2-foundation 0.2.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-ui-kit"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.13.2",
|
||||||
|
"block2 0.5.1",
|
||||||
|
"objc2 0.5.3",
|
||||||
|
"objc2-cloud-kit 0.2.2",
|
||||||
|
"objc2-core-data 0.2.2",
|
||||||
|
"objc2-core-image 0.2.2",
|
||||||
|
"objc2-core-location 0.2.2",
|
||||||
|
"objc2-foundation 0.2.2",
|
||||||
|
"objc2-link-presentation",
|
||||||
|
"objc2-quartz-core 0.2.2",
|
||||||
|
"objc2-symbols",
|
||||||
|
"objc2-uniform-type-identifiers",
|
||||||
|
"objc2-user-notifications 0.2.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2781,18 +2971,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22"
|
checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.13.2",
|
"bitflags 2.13.2",
|
||||||
"block2",
|
"block2 0.6.2",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-cloud-kit",
|
"objc2-cloud-kit 0.3.2",
|
||||||
"objc2-core-data",
|
"objc2-core-data 0.3.2",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-core-graphics",
|
"objc2-core-graphics",
|
||||||
"objc2-core-image",
|
"objc2-core-image 0.3.2",
|
||||||
"objc2-core-location",
|
"objc2-core-location 0.3.2",
|
||||||
"objc2-core-text",
|
"objc2-core-text",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
"objc2-quartz-core",
|
"objc2-quartz-core 0.3.2",
|
||||||
"objc2-user-notifications",
|
"objc2-user-notifications 0.3.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-uniform-type-identifiers"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe"
|
||||||
|
dependencies = [
|
||||||
|
"block2 0.5.1",
|
||||||
|
"objc2 0.5.3",
|
||||||
|
"objc2-foundation 0.2.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-user-notifications"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.13.2",
|
||||||
|
"block2 0.5.1",
|
||||||
|
"objc2 0.5.3",
|
||||||
|
"objc2-core-location 0.2.2",
|
||||||
|
"objc2-foundation 0.2.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2801,8 +3015,21 @@ version = "0.3.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9df9128cbbfef73cda168416ccf7f837b62737d748333bfe9ab71c245d76613e"
|
checksum = "9df9128cbbfef73cda168416ccf7f837b62737d748333bfe9ab71c245d76613e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-web-kit"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "68bc69301064cebefc6c4c90ce9cba69225239e4b8ff99d445a2b5563797da65"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.13.2",
|
||||||
|
"block2 0.5.1",
|
||||||
|
"objc2 0.5.3",
|
||||||
|
"objc2-app-kit 0.2.2",
|
||||||
|
"objc2-foundation 0.2.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2812,11 +3039,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "b2e5aaab980c433cf470df9d7af96a7b46a9d892d521a2cbbb2f8a4c16751e7f"
|
checksum = "b2e5aaab980c433cf470df9d7af96a7b46a9d892d521a2cbbb2f8a4c16751e7f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.13.2",
|
"bitflags 2.13.2",
|
||||||
"block2",
|
"block2 0.6.2",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-app-kit",
|
"objc2-app-kit 0.3.2",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2874,8 +3101,8 @@ version = "0.3.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "732c71caeaa72c065bb69d7ea08717bd3f4863a4f451402fc9513e29dbd5261b"
|
checksum = "732c71caeaa72c065bb69d7ea08717bd3f4863a4f451402fc9513e29dbd5261b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
"objc2-osa-kit",
|
"objc2-osa-kit",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -3561,17 +3788,17 @@ version = "0.16.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a15ad77d9e70a92437d8f74c35d99b4e4691128df018833e99f90bcd36152672"
|
checksum = "a15ad77d9e70a92437d8f74c35d99b4e4691128df018833e99f90bcd36152672"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"block2",
|
"block2 0.6.2",
|
||||||
"dispatch2",
|
"dispatch2",
|
||||||
"glib-sys",
|
"glib-sys",
|
||||||
"gobject-sys",
|
"gobject-sys",
|
||||||
"gtk-sys",
|
"gtk-sys",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"log",
|
"log",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-app-kit",
|
"objc2-app-kit 0.3.2",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures",
|
||||||
@@ -4005,6 +4232,17 @@ dependencies = [
|
|||||||
"stable_deref_trait",
|
"stable_deref_trait",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sha1"
|
||||||
|
version = "0.10.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"cpufeatures 0.2.17",
|
||||||
|
"digest",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sha2"
|
name = "sha2"
|
||||||
version = "0.10.9"
|
version = "0.10.9"
|
||||||
@@ -4101,11 +4339,11 @@ dependencies = [
|
|||||||
"bytemuck",
|
"bytemuck",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"ndk",
|
"ndk",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-core-graphics",
|
"objc2-core-graphics",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
"objc2-quartz-core",
|
"objc2-quartz-core 0.3.2",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"redox_syscall",
|
"redox_syscall",
|
||||||
"tracing",
|
"tracing",
|
||||||
@@ -4292,7 +4530,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "f37f381f4e048e6cdf038b5705f8cf14ad108279d46eb968140a7b291aba9400"
|
checksum = "f37f381f4e048e6cdf038b5705f8cf14ad108279d46eb968140a7b291aba9400"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.13.2",
|
"bitflags 2.13.2",
|
||||||
"block2",
|
"block2 0.6.2",
|
||||||
"core-foundation 0.10.1",
|
"core-foundation 0.10.1",
|
||||||
"core-graphics",
|
"core-graphics",
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
@@ -4309,10 +4547,10 @@ dependencies = [
|
|||||||
"ndk",
|
"ndk",
|
||||||
"ndk-context",
|
"ndk-context",
|
||||||
"ndk-sys",
|
"ndk-sys",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-app-kit",
|
"objc2-app-kit 0.3.2",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
"objc2-ui-kit",
|
"objc2-ui-kit 0.3.2",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
@@ -4375,11 +4613,11 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"mime",
|
"mime",
|
||||||
"muda",
|
"muda",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-app-kit",
|
"objc2-app-kit 0.3.2",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
"objc2-ui-kit",
|
"objc2-ui-kit 0.3.2",
|
||||||
"objc2-web-kit",
|
"objc2-web-kit 0.3.2",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"plist",
|
"plist",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
@@ -4527,7 +4765,7 @@ dependencies = [
|
|||||||
"dunce",
|
"dunce",
|
||||||
"glob",
|
"glob",
|
||||||
"log",
|
"log",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"schemars 0.8.22",
|
"schemars 0.8.22",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -4578,8 +4816,8 @@ dependencies = [
|
|||||||
"android_logger",
|
"android_logger",
|
||||||
"fern",
|
"fern",
|
||||||
"log",
|
"log",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_repr",
|
"serde_repr",
|
||||||
@@ -4590,6 +4828,38 @@ dependencies = [
|
|||||||
"time",
|
"time",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tauri-plugin-mcp-bridge"
|
||||||
|
version = "0.13.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "aab4a85c370385dd0f7384855a75d480936d6c1f8a489fadd9fb878d4f0ef4b2"
|
||||||
|
dependencies = [
|
||||||
|
"base64 0.22.1",
|
||||||
|
"block2 0.5.1",
|
||||||
|
"cairo-rs",
|
||||||
|
"futures-util",
|
||||||
|
"gio",
|
||||||
|
"image",
|
||||||
|
"jni 0.21.1",
|
||||||
|
"objc2 0.5.3",
|
||||||
|
"objc2-app-kit 0.2.2",
|
||||||
|
"objc2-foundation 0.2.2",
|
||||||
|
"objc2-ui-kit 0.2.2",
|
||||||
|
"objc2-web-kit 0.2.2",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"tauri",
|
||||||
|
"tauri-plugin",
|
||||||
|
"thiserror 1.0.69",
|
||||||
|
"tokio",
|
||||||
|
"tokio-tungstenite",
|
||||||
|
"uuid",
|
||||||
|
"webkit2gtk",
|
||||||
|
"webview2-com",
|
||||||
|
"windows",
|
||||||
|
"windows-core",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-plugin-notification"
|
name = "tauri-plugin-notification"
|
||||||
version = "2.7.0"
|
version = "2.7.0"
|
||||||
@@ -4735,9 +5005,9 @@ dependencies = [
|
|||||||
"gtk",
|
"gtk",
|
||||||
"http",
|
"http",
|
||||||
"jni 0.21.1",
|
"jni 0.21.1",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-ui-kit",
|
"objc2-ui-kit 0.3.2",
|
||||||
"objc2-web-kit",
|
"objc2-web-kit 0.3.2",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -4759,8 +5029,8 @@ dependencies = [
|
|||||||
"http",
|
"http",
|
||||||
"jni 0.21.1",
|
"jni 0.21.1",
|
||||||
"log",
|
"log",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-app-kit",
|
"objc2-app-kit 0.3.2",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
@@ -4980,7 +5250,9 @@ dependencies = [
|
|||||||
"bytes",
|
"bytes",
|
||||||
"libc",
|
"libc",
|
||||||
"mio",
|
"mio",
|
||||||
|
"parking_lot",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
|
"signal-hook-registry",
|
||||||
"socket2",
|
"socket2",
|
||||||
"tokio-macros",
|
"tokio-macros",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
@@ -5007,6 +5279,18 @@ dependencies = [
|
|||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tokio-tungstenite"
|
||||||
|
version = "0.28.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d25a406cddcc431a75d3d9afc6a7c0f7428d4891dd973e4d54c56b46127bf857"
|
||||||
|
dependencies = [
|
||||||
|
"futures-util",
|
||||||
|
"log",
|
||||||
|
"tokio",
|
||||||
|
"tungstenite",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio-util"
|
name = "tokio-util"
|
||||||
version = "0.7.20"
|
version = "0.7.20"
|
||||||
@@ -5203,11 +5487,11 @@ dependencies = [
|
|||||||
"dirs",
|
"dirs",
|
||||||
"libappindicator",
|
"libappindicator",
|
||||||
"muda",
|
"muda",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-app-kit",
|
"objc2-app-kit 0.3.2",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-core-graphics",
|
"objc2-core-graphics",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"png 0.18.1",
|
"png 0.18.1",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -5232,6 +5516,23 @@ version = "0.2.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tungstenite"
|
||||||
|
version = "0.28.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8628dcc84e5a09eb3d8423d6cb682965dea9133204e8fb3efee74c2a0c259442"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"data-encoding",
|
||||||
|
"http",
|
||||||
|
"httparse",
|
||||||
|
"log",
|
||||||
|
"rand 0.9.5",
|
||||||
|
"sha1",
|
||||||
|
"thiserror 2.0.21",
|
||||||
|
"utf-8",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typed-path"
|
name = "typed-path"
|
||||||
version = "0.12.4"
|
version = "0.12.4"
|
||||||
@@ -5304,6 +5605,12 @@ dependencies = [
|
|||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "utf-8"
|
||||||
|
version = "0.7.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "utf8_iter"
|
name = "utf8_iter"
|
||||||
version = "1.0.4"
|
version = "1.0.4"
|
||||||
@@ -5711,11 +6018,11 @@ version = "0.8.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "111e51caca442cafd9bab396628ac4d814880eaea4e63dfd76a12e9f342b5580"
|
checksum = "111e51caca442cafd9bab396628ac4d814880eaea4e63dfd76a12e9f342b5580"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-app-kit",
|
"objc2-app-kit 0.3.2",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
"objc2-quartz-core",
|
"objc2-quartz-core 0.3.2",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
"windows-version",
|
"windows-version",
|
||||||
@@ -6147,7 +6454,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "a819957a01b3119af85e638a38d242af76dbc87d130dca67bfd0441072e21ff0"
|
checksum = "a819957a01b3119af85e638a38d242af76dbc87d130dca67bfd0441072e21ff0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"block2",
|
"block2 0.6.2",
|
||||||
"cookie",
|
"cookie",
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"dirs",
|
"dirs",
|
||||||
@@ -6161,12 +6468,12 @@ dependencies = [
|
|||||||
"jni 0.21.1",
|
"jni 0.21.1",
|
||||||
"libc",
|
"libc",
|
||||||
"ndk",
|
"ndk",
|
||||||
"objc2",
|
"objc2 0.6.5",
|
||||||
"objc2-app-kit",
|
"objc2-app-kit 0.3.2",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-foundation",
|
"objc2-foundation 0.3.2",
|
||||||
"objc2-ui-kit",
|
"objc2-ui-kit 0.3.2",
|
||||||
"objc2-web-kit",
|
"objc2-web-kit 0.3.2",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
|
|||||||
@@ -30,11 +30,14 @@ tauri-plugin-notification = "2.0.0-rc.1"
|
|||||||
tauri-plugin-upload = "2.0.0"
|
tauri-plugin-upload = "2.0.0"
|
||||||
tauri-plugin-dialog = "2.0.0"
|
tauri-plugin-dialog = "2.0.0"
|
||||||
tauri-plugin-shell = "2.3.5"
|
tauri-plugin-shell = "2.3.5"
|
||||||
|
tauri-plugin-mcp-bridge = { version = "0.13.2", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# by default Tauri runs in production mode
|
# by default Tauri runs in production mode
|
||||||
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
|
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
|
||||||
default = [ "custom-protocol" ]
|
default = [ "custom-protocol" ]
|
||||||
|
# Dev-only MCP bridge for UI automation: `pnpm tauri dev -- --features mcp-bridge`
|
||||||
|
mcp-bridge = ["dep:tauri-plugin-mcp-bridge"]
|
||||||
# this feature is used for production builds where `devPath` points to the filesystem
|
# this feature is used for production builds where `devPath` points to the filesystem
|
||||||
# DO NOT remove this
|
# DO NOT remove this
|
||||||
custom-protocol = [ "tauri/custom-protocol" ]
|
custom-protocol = [ "tauri/custom-protocol" ]
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
"updater:allow-install",
|
"updater:allow-install",
|
||||||
"notification:default",
|
"notification:default",
|
||||||
"core:webview:allow-internal-toggle-devtools",
|
"core:webview:allow-internal-toggle-devtools",
|
||||||
|
"core:window:allow-start-dragging",
|
||||||
"dialog:default",
|
"dialog:default",
|
||||||
"upload:allow-download",
|
"upload:allow-download",
|
||||||
"clipboard-manager:allow-write-text",
|
"clipboard-manager:allow-write-text",
|
||||||
|
|||||||
@@ -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","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","dialog:default","upload:allow-download","clipboard-manager:allow-write-text","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","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","dialog:default","upload:allow-download","clipboard-manager:allow-write-text","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"]}}
|
||||||
+11
-1
@@ -3,7 +3,17 @@
|
|||||||
use tauri_plugin_log::{fern::colors::ColoredLevelConfig, Target, TargetKind};
|
use tauri_plugin_log::{fern::colors::ColoredLevelConfig, Target, TargetKind};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
tauri::Builder::default()
|
let builder = tauri::Builder::default();
|
||||||
|
|
||||||
|
// Dev-only MCP bridge: `pnpm tauri dev -- --features mcp-bridge`.
|
||||||
|
#[cfg(all(debug_assertions, feature = "mcp-bridge"))]
|
||||||
|
let builder = builder.plugin(
|
||||||
|
tauri_plugin_mcp_bridge::Builder::new()
|
||||||
|
.bind_address("127.0.0.1")
|
||||||
|
.build(),
|
||||||
|
);
|
||||||
|
|
||||||
|
builder
|
||||||
.plugin(tauri_plugin_shell::init())
|
.plugin(tauri_plugin_shell::init())
|
||||||
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
|
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
|
||||||
.plugin(tauri_plugin_window_state::Builder::new().build())
|
.plugin(tauri_plugin_window_state::Builder::new().build())
|
||||||
|
|||||||
@@ -77,7 +77,10 @@
|
|||||||
"label": "main",
|
"label": "main",
|
||||||
"dragDropEnabled": false,
|
"dragDropEnabled": false,
|
||||||
"backgroundColor": "#08001f",
|
"backgroundColor": "#08001f",
|
||||||
"transparent": false
|
"transparent": false,
|
||||||
|
"titleBarStyle": "Overlay",
|
||||||
|
"hiddenTitle": true,
|
||||||
|
"trafficLightPosition": { "x": 18, "y": 31 }
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"security": {
|
"security": {
|
||||||
|
|||||||
@@ -1,50 +1,33 @@
|
|||||||
|
|
||||||
.appBar {
|
.appBar {
|
||||||
// Limit transitions to cheaper properties; avoid animating box-shadow directly
|
// Custom titlebar: the app header itself sits at the very top of the window,
|
||||||
|
// under the native overlay titlebar (no native glass strip, no blur panels).
|
||||||
transition: background-color $transition-time-fast;
|
transition: background-color $transition-time-fast;
|
||||||
padding: 0.8em ($page-margin - 1.7em);
|
padding: 0.8em ($page-margin - 1.7em);
|
||||||
z-index: 999 !important;
|
z-index: 999 !important;
|
||||||
|
top: 0 !important;
|
||||||
|
|
||||||
|
// Keep the left controls clear of the macOS traffic lights.
|
||||||
|
html.is-macos & {
|
||||||
|
padding-left: calc(#{$page-margin} - 1.7em + 72px);
|
||||||
|
}
|
||||||
|
|
||||||
.flex {
|
.flex {
|
||||||
// Avoid animating padding; it causes layout reflow on each frame.
|
// Avoid animating padding; it causes layout reflow on each frame.
|
||||||
transition: background-color $transition-time-fast;
|
transition: background-color $transition-time-fast;
|
||||||
// Avoid using will-change: scroll-position; it can degrade performance when misused
|
|
||||||
// will-change: opacity, transform;
|
|
||||||
border-radius: 1000px;
|
border-radius: 1000px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
// Pseudo-element handles elevation shadow; we animate its opacity
|
|
||||||
&::after {
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
inset: -0.35em;
|
|
||||||
pointer-events: none;
|
|
||||||
border-radius: inherit;
|
|
||||||
|
|
||||||
@include glass-effect;
|
|
||||||
|
|
||||||
opacity: 0;
|
|
||||||
z-index: -1;
|
|
||||||
transition: all $transition-time-fast;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inner content wrapper that we can scale without causing layout reflow
|
// Solid, part-of-the-screen titlebar background once the page scrolls.
|
||||||
.flex-inner {
|
&.elevated {
|
||||||
transform-origin: top center;
|
background-color: $clr-background-default !important;
|
||||||
transition: transform $transition-time-fast;
|
border-bottom: 1px solid rgb(255 255 255 / 0.06);
|
||||||
}
|
box-shadow: none !important;
|
||||||
&.elevated{
|
background-image: none !important;
|
||||||
.flex {
|
backdrop-filter: none !important;
|
||||||
&::after {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply a subtle scale to simulate shrink without layout changes
|
|
||||||
.flex-inner {
|
|
||||||
transform: scaleY(0.95);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&-avatar {
|
&-avatar {
|
||||||
background: rgb(255 255 255 / 0.1) !important;
|
background: rgb(255 255 255 / 0.1) !important;
|
||||||
&-icon {
|
&-icon {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import MuiAppBar from "@mui/material/AppBar";
|
|||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||||
import { useLocation, useNavigate } from "@tanstack/react-router";
|
import { useLocation, useNavigate } from "@tanstack/react-router";
|
||||||
import React, { useCallback, useMemo, useState } from "react";
|
import React, { useCallback, useState } from "react";
|
||||||
|
|
||||||
import "./appBar.scss";
|
import "./appBar.scss";
|
||||||
|
|
||||||
@@ -51,13 +51,6 @@ export const AppBar = () => {
|
|||||||
|
|
||||||
const [showDrawer, setShowDrawer] = useState(false);
|
const [showDrawer, setShowDrawer] = useState(false);
|
||||||
|
|
||||||
const appBarStyling = useMemo(() => {
|
|
||||||
return {
|
|
||||||
backgroundColor: "transparent",
|
|
||||||
paddingRight: "0 !important",
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const _handleNavigateToSearch = useCallback(
|
const _handleNavigateToSearch = useCallback(
|
||||||
() => navigate({ to: "/search", search: { query: "" } }),
|
() => navigate({ to: "/search", search: { query: "" } }),
|
||||||
[navigate],
|
[navigate],
|
||||||
@@ -85,7 +78,7 @@ export const AppBar = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<MuiAppBar
|
<MuiAppBar
|
||||||
style={appBarStyling}
|
data-tauri-drag-region
|
||||||
className={
|
className={
|
||||||
trigger
|
trigger
|
||||||
? "appBar flex flex-row flex-justify-spaced-between elevated"
|
? "appBar flex flex-row flex-justify-spaced-between elevated"
|
||||||
@@ -94,7 +87,7 @@ export const AppBar = () => {
|
|||||||
elevation={0}
|
elevation={0}
|
||||||
color="transparent"
|
color="transparent"
|
||||||
>
|
>
|
||||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
<div className="flex flex-row" data-tauri-drag-region style={{ gap: "0.6em" }}>
|
||||||
<IconButton onClick={handleDrawerOpen}>
|
<IconButton onClick={handleDrawerOpen}>
|
||||||
<span className="material-symbols-rounded">menu</span>
|
<span className="material-symbols-rounded">menu</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
@@ -112,7 +105,7 @@ export const AppBar = () => {
|
|||||||
</IconButton>
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
<div className="flex flex-row" data-tauri-drag-region style={{ gap: "0.6em" }}>
|
||||||
<IconButton onClick={toggleSearchDialog}>
|
<IconButton onClick={toggleSearchDialog}>
|
||||||
<span className="material-symbols-rounded">search</span>
|
<span className="material-symbols-rounded">search</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|||||||
@@ -5,15 +5,20 @@ import { useBackdropStore } from "@/utils/store/backdrop";
|
|||||||
import BlurhashCanvas from "../blurhash-canvas";
|
import BlurhashCanvas from "../blurhash-canvas";
|
||||||
|
|
||||||
export default function Backdrop() {
|
export default function Backdrop() {
|
||||||
// const [backdropLoading, setBackdropLoading] = useState(true);
|
|
||||||
|
|
||||||
const { backdropHash } = useBackdropStore(
|
const { backdropHash } = useBackdropStore(
|
||||||
useShallow((state) => ({
|
useShallow((state) => ({
|
||||||
backdropHash: state.backdropHash,
|
backdropHash: state.backdropHash,
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!backdropHash) {
|
// Routes clear the backdrop when they mount ("") and some set it later.
|
||||||
|
// Keep the last non-empty hash so the app background never blanks out
|
||||||
|
// (which looked like a flash on every page open).
|
||||||
|
const lastHash = React.useRef<string | undefined>(undefined);
|
||||||
|
if (backdropHash) lastHash.current = backdropHash;
|
||||||
|
const hash = backdropHash || lastHash.current;
|
||||||
|
|
||||||
|
if (!hash) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,16 +27,16 @@ export default function Backdrop() {
|
|||||||
<motion.div
|
<motion.div
|
||||||
initial={{ opacity: 0 }}
|
initial={{ opacity: 0 }}
|
||||||
animate={{ opacity: 1 }}
|
animate={{ opacity: 1 }}
|
||||||
key={backdropHash}
|
key={hash}
|
||||||
exit={{ opacity: 0 }}
|
exit={{ opacity: 0 }}
|
||||||
transition={{
|
transition={{
|
||||||
duration: 2,
|
duration: 0.45,
|
||||||
ease: "easeInOut",
|
ease: "easeInOut",
|
||||||
}}
|
}}
|
||||||
className="app-backdrop-container"
|
className="app-backdrop-container"
|
||||||
>
|
>
|
||||||
<BlurhashCanvas
|
<BlurhashCanvas
|
||||||
blurhashString={backdropHash}
|
blurhashString={hash}
|
||||||
width={300}
|
width={300}
|
||||||
height={150}
|
height={150}
|
||||||
canvasProps={{
|
canvasProps={{
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { useApiInContext } from "@/utils/store/api";
|
|
||||||
import { playItemFromQueue } from "@/utils/store/playback";
|
|
||||||
import useQueue from "@/utils/store/queue";
|
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
import { IconButton } from "@mui/material";
|
import { IconButton } from "@mui/material";
|
||||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { playItemFromQueue } from "@/utils/store/playback";
|
||||||
|
import useQueue, { getNextTrackIndex } from "@/utils/store/queue";
|
||||||
|
|
||||||
const PlayNextButton = () => {
|
const PlayNextButton = () => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
@@ -19,18 +19,18 @@ const PlayNextButton = () => {
|
|||||||
});
|
});
|
||||||
const handlePlayNext = useMutation({
|
const handlePlayNext = useMutation({
|
||||||
mutationKey: ["playNextButton"],
|
mutationKey: ["playNextButton"],
|
||||||
mutationFn: () => playItemFromQueue("next", user.data?.Id, api),
|
mutationFn: async () => {
|
||||||
|
const nextIndex = getNextTrackIndex();
|
||||||
|
if (nextIndex === undefined) return;
|
||||||
|
return playItemFromQueue(nextIndex, user.data?.Id, api);
|
||||||
|
},
|
||||||
onError: (error) => console.error(error),
|
onError: (error) => console.error(error),
|
||||||
});
|
});
|
||||||
const [queueItems, currentItemIndex] = useQueue((state) => [
|
// Re-render when the queue position or repeat mode changes.
|
||||||
state.tracks,
|
useQueue((state) => [state.tracks, state.currentItemIndex, state.repeatMode]);
|
||||||
state.currentItemIndex,
|
const hasNext = getNextTrackIndex() !== undefined;
|
||||||
]);
|
|
||||||
return (
|
return (
|
||||||
<IconButton
|
<IconButton disabled={!hasNext} onClick={() => handlePlayNext.mutate()}>
|
||||||
disabled={queueItems?.length === currentItemIndex + 1}
|
|
||||||
onClick={() => handlePlayNext.mutate()}
|
|
||||||
>
|
|
||||||
<span className="material-symbols-rounded">skip_next</span>
|
<span className="material-symbols-rounded">skip_next</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,390 +1,31 @@
|
|||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import Drawer from "@mui/material/Drawer";
|
||||||
import {
|
import IconButton from "@mui/material/IconButton";
|
||||||
Box,
|
import Tooltip from "@mui/material/Tooltip";
|
||||||
Drawer,
|
import React, { useState } from "react";
|
||||||
IconButton,
|
import QueueView from "@/components/queue/queueView";
|
||||||
List,
|
|
||||||
Tooltip,
|
|
||||||
Typography,
|
|
||||||
} from "@mui/material";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
import React, { useMemo, useState } from "react";
|
|
||||||
import { playItemFromQueue } from "@/utils/store/playback";
|
|
||||||
import useQueue, {
|
|
||||||
clearUpcoming,
|
|
||||||
removeFromQueue,
|
|
||||||
reorderQueue,
|
|
||||||
shuffleUpcoming,
|
|
||||||
} from "@/utils/store/queue";
|
|
||||||
import "./queueButton.scss";
|
|
||||||
import {
|
|
||||||
closestCenter,
|
|
||||||
DndContext,
|
|
||||||
type DragEndEvent,
|
|
||||||
KeyboardSensor,
|
|
||||||
PointerSensor,
|
|
||||||
useSensor,
|
|
||||||
useSensors,
|
|
||||||
} from "@dnd-kit/core";
|
|
||||||
import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
|
|
||||||
import {
|
|
||||||
arrayMove,
|
|
||||||
SortableContext,
|
|
||||||
sortableKeyboardCoordinates,
|
|
||||||
useSortable,
|
|
||||||
verticalListSortingStrategy,
|
|
||||||
} from "@dnd-kit/sortable";
|
|
||||||
import { CSS } from "@dnd-kit/utilities";
|
|
||||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
|
||||||
import QueueListItem from "../queueListItem";
|
|
||||||
|
|
||||||
function SortableQueueItem({
|
|
||||||
item,
|
|
||||||
onDelete,
|
|
||||||
onPlay,
|
|
||||||
index,
|
|
||||||
}: {
|
|
||||||
item: BaseItemDto;
|
|
||||||
onDelete: () => void;
|
|
||||||
onPlay: () => void;
|
|
||||||
index: number;
|
|
||||||
}) {
|
|
||||||
const {
|
|
||||||
attributes,
|
|
||||||
listeners,
|
|
||||||
setNodeRef,
|
|
||||||
transform,
|
|
||||||
transition,
|
|
||||||
isDragging,
|
|
||||||
} = useSortable({ id: item.Id || "" });
|
|
||||||
|
|
||||||
const style = {
|
|
||||||
transform: CSS.Transform.toString(transform),
|
|
||||||
transition,
|
|
||||||
opacity: isDragging ? 0.5 : 1,
|
|
||||||
position: "relative" as const,
|
|
||||||
zIndex: isDragging ? 2 : 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div ref={setNodeRef} style={style}>
|
|
||||||
<QueueListItem
|
|
||||||
queueItem={item}
|
|
||||||
onDelete={onDelete}
|
|
||||||
onPlay={onPlay}
|
|
||||||
dragHandleProps={{ ...attributes, ...listeners }}
|
|
||||||
isEpisode={item.Type === "Episode"}
|
|
||||||
index={index}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/** Opens the play queue in a side drawer. */
|
||||||
const QueueButton = () => {
|
const QueueButton = () => {
|
||||||
const api = useApiInContext((s) => s.api);
|
|
||||||
|
|
||||||
const [queueItems, currentItemIndex] = useQueue((state) => [
|
|
||||||
state.tracks,
|
|
||||||
state.currentItemIndex,
|
|
||||||
]);
|
|
||||||
|
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
const user = useQuery({
|
|
||||||
queryKey: ["currentUser"],
|
|
||||||
queryFn: async () => {
|
|
||||||
if (!api) throw new Error("API not available");
|
|
||||||
return (await getUserApi(api).getCurrentUser()).data;
|
|
||||||
},
|
|
||||||
enabled: !!api,
|
|
||||||
});
|
|
||||||
|
|
||||||
const sensors = useSensors(
|
|
||||||
useSensor(PointerSensor),
|
|
||||||
useSensor(KeyboardSensor, {
|
|
||||||
coordinateGetter: sortableKeyboardCoordinates,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
const upcomingItems = useMemo(() => {
|
|
||||||
return queueItems ? queueItems.slice(currentItemIndex + 1) : [];
|
|
||||||
}, [queueItems, currentItemIndex]);
|
|
||||||
|
|
||||||
const upcomingIds = useMemo(() => {
|
|
||||||
return upcomingItems.map((item) => item.Id || "");
|
|
||||||
}, [upcomingItems]);
|
|
||||||
|
|
||||||
const handleDragEnd = (event: DragEndEvent) => {
|
|
||||||
const { active, over } = event;
|
|
||||||
|
|
||||||
if (active.id !== over?.id && queueItems) {
|
|
||||||
const oldIndex = upcomingItems.findIndex((item) => item.Id === active.id);
|
|
||||||
const newIndex = upcomingItems.findIndex((item) => item.Id === over?.id);
|
|
||||||
|
|
||||||
if (oldIndex !== -1 && newIndex !== -1) {
|
|
||||||
const newUpcoming = arrayMove(upcomingItems, oldIndex, newIndex);
|
|
||||||
const newQueue = [
|
|
||||||
...queueItems.slice(0, currentItemIndex + 1),
|
|
||||||
...newUpcoming,
|
|
||||||
];
|
|
||||||
reorderQueue(newQueue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDelete = (index: number) => {
|
|
||||||
removeFromQueue(index);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handlePlay = (index: number) => {
|
|
||||||
playItemFromQueue(index, user.data?.Id, api);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleClear = () => {
|
|
||||||
clearUpcoming();
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleShuffle = () => {
|
|
||||||
shuffleUpcoming();
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<Tooltip title="Queue">
|
||||||
|
<IconButton onClick={() => setOpen(true)} aria-label="Open queue">
|
||||||
|
<span className="material-symbols-rounded">queue_music</span>
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
<Drawer
|
<Drawer
|
||||||
anchor="right"
|
anchor="right"
|
||||||
open={open}
|
open={open}
|
||||||
onClose={() => setOpen(false)}
|
onClose={() => setOpen(false)}
|
||||||
slotProps={{
|
slotProps={{
|
||||||
backdrop: {
|
backdrop: { sx: { backgroundColor: "rgb(0 0 0 / 0.3)" } },
|
||||||
sx: {
|
paper: { className: "queue-drawer-paper" },
|
||||||
backgroundColor: "rgba(0, 0, 0, 0.2)",
|
|
||||||
backdropFilter: "blur(4px)",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
paper: {
|
|
||||||
className: "glass",
|
|
||||||
sx: {
|
|
||||||
width: 450,
|
|
||||||
maxWidth: "100%",
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
borderLeft: "1px solid rgba(255, 255, 255, 0.08)",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box
|
<QueueView variant="drawer" onClose={() => setOpen(false)} />
|
||||||
sx={{
|
|
||||||
p: 3,
|
|
||||||
display: "flex",
|
|
||||||
justifyContent: "space-between",
|
|
||||||
alignItems: "center",
|
|
||||||
position: "sticky",
|
|
||||||
top: 0,
|
|
||||||
zIndex: 20,
|
|
||||||
borderBottom: "1px solid",
|
|
||||||
borderColor: "rgba(255, 255, 255, 0.08)",
|
|
||||||
backgroundColor: "rgba(20, 20, 30, 0.4)",
|
|
||||||
backdropFilter: "blur(12px)",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
gap: 1,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Typography
|
|
||||||
variant="h5"
|
|
||||||
sx={{
|
|
||||||
fontWeight: "bold",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Play Queue
|
|
||||||
</Typography>
|
|
||||||
<Typography
|
|
||||||
variant="caption"
|
|
||||||
sx={{
|
|
||||||
color: "text.secondary",
|
|
||||||
ml: 1,
|
|
||||||
fontWeight: 600,
|
|
||||||
bgcolor: "rgba(255, 255, 255, 0.08)",
|
|
||||||
px: 1,
|
|
||||||
py: 0.5,
|
|
||||||
borderRadius: 2,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{queueItems?.length || 0}
|
|
||||||
</Typography>
|
|
||||||
</Box>
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
gap: 0.5,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Tooltip title="Shuffle Upcoming">
|
|
||||||
<span>
|
|
||||||
<IconButton
|
|
||||||
onClick={handleShuffle}
|
|
||||||
size="small"
|
|
||||||
disabled={upcomingItems.length < 2}
|
|
||||||
>
|
|
||||||
<span className="material-symbols-rounded">shuffle</span>
|
|
||||||
</IconButton>
|
|
||||||
</span>
|
|
||||||
</Tooltip>
|
|
||||||
<Tooltip title="Clear Upcoming">
|
|
||||||
<span>
|
|
||||||
<IconButton
|
|
||||||
onClick={handleClear}
|
|
||||||
size="small"
|
|
||||||
disabled={upcomingItems.length === 0}
|
|
||||||
>
|
|
||||||
<span className="material-symbols-rounded">clear_all</span>
|
|
||||||
</IconButton>
|
|
||||||
</span>
|
|
||||||
</Tooltip>
|
|
||||||
<IconButton onClick={() => setOpen(false)} size="small">
|
|
||||||
<span className="material-symbols-rounded">close</span>
|
|
||||||
</IconButton>
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
overflowY: "auto",
|
|
||||||
flex: 1,
|
|
||||||
p: 2,
|
|
||||||
"&::-webkit-scrollbar": { width: 8 },
|
|
||||||
"&::-webkit-scrollbar-track": { background: "transparent" },
|
|
||||||
"&::-webkit-scrollbar-thumb": {
|
|
||||||
background: "rgba(128,128,128,0.2)",
|
|
||||||
borderRadius: 4,
|
|
||||||
},
|
|
||||||
"&::-webkit-scrollbar-thumb:hover": {
|
|
||||||
background: "rgba(128,128,128,0.3)",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{queueItems && queueItems.length > 0 ? (
|
|
||||||
<List disablePadding>
|
|
||||||
{/* Current Item */}
|
|
||||||
{queueItems[currentItemIndex] && (
|
|
||||||
<Box sx={{ mb: 4 }}>
|
|
||||||
<Typography
|
|
||||||
variant="overline"
|
|
||||||
sx={{
|
|
||||||
display: "block",
|
|
||||||
opacity: 0.6,
|
|
||||||
mb: 1,
|
|
||||||
fontWeight: 600,
|
|
||||||
letterSpacing: 1.2,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
NOW PLAYING
|
|
||||||
</Typography>
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
bgcolor: "background.paper",
|
|
||||||
borderRadius: 3,
|
|
||||||
overflow: "hidden",
|
|
||||||
boxShadow: 4,
|
|
||||||
border: "1px solid",
|
|
||||||
borderColor: "divider",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<QueueListItem
|
|
||||||
queueItem={queueItems[currentItemIndex]}
|
|
||||||
active={true}
|
|
||||||
isEpisode={
|
|
||||||
queueItems[currentItemIndex].Type === "Episode"
|
|
||||||
}
|
|
||||||
index={currentItemIndex + 1}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Upcoming Items */}
|
|
||||||
{upcomingItems.length > 0 && (
|
|
||||||
<>
|
|
||||||
<Typography
|
|
||||||
variant="overline"
|
|
||||||
sx={{
|
|
||||||
display: "block",
|
|
||||||
opacity: 0.6,
|
|
||||||
mb: 1,
|
|
||||||
fontWeight: 600,
|
|
||||||
letterSpacing: 1.2,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
NEXT UP
|
|
||||||
</Typography>
|
|
||||||
<DndContext
|
|
||||||
sensors={sensors}
|
|
||||||
collisionDetection={closestCenter}
|
|
||||||
onDragEnd={handleDragEnd}
|
|
||||||
modifiers={[restrictToVerticalAxis]}
|
|
||||||
>
|
|
||||||
<SortableContext
|
|
||||||
items={upcomingIds}
|
|
||||||
strategy={verticalListSortingStrategy}
|
|
||||||
>
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
gap: 1,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{upcomingItems.map((item, index) => (
|
|
||||||
<SortableQueueItem
|
|
||||||
key={item.Id || index}
|
|
||||||
item={item}
|
|
||||||
onDelete={() =>
|
|
||||||
handleDelete(currentItemIndex + 1 + index)
|
|
||||||
}
|
|
||||||
onPlay={() =>
|
|
||||||
handlePlay(currentItemIndex + 1 + index)
|
|
||||||
}
|
|
||||||
index={currentItemIndex + 1 + index + 1}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</Box>
|
|
||||||
</SortableContext>
|
|
||||||
</DndContext>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</List>
|
|
||||||
) : (
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
p: 4,
|
|
||||||
textAlign: "center",
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
alignItems: "center",
|
|
||||||
gap: 2,
|
|
||||||
opacity: 0.5,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
className="material-symbols-rounded"
|
|
||||||
style={{ fontSize: 48 }}
|
|
||||||
>
|
|
||||||
queue_music
|
|
||||||
</span>
|
|
||||||
<Typography>Your queue is empty</Typography>
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
</Drawer>
|
</Drawer>
|
||||||
<IconButton onClick={() => setOpen(true)}>
|
|
||||||
<span className="material-symbols-rounded">playlist_play</span>
|
|
||||||
</IconButton>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import type { TransitionProps } from "@mui/material/transitions";
|
import type { TransitionProps } from "@mui/material/transitions";
|
||||||
import { skipToken, useMutation, useQuery } from "@tanstack/react-query";
|
import { skipToken, useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
import { useNavigate, useRouter } from "@tanstack/react-router";
|
||||||
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
|
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
|
||||||
import { useSnackbar } from "notistack";
|
import { useSnackbar } from "notistack";
|
||||||
import React, { useCallback, useState } from "react";
|
import React, { useCallback, useState } from "react";
|
||||||
@@ -55,6 +55,7 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const quickConnectEnabled = useQuery({
|
const quickConnectEnabled = useQuery({
|
||||||
queryKey: ["quick-connect-button", "check-quick-connect-enabled"],
|
queryKey: ["quick-connect-button", "check-quick-connect-enabled"],
|
||||||
@@ -79,18 +80,20 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSuccess: (result) => {
|
onSuccess: async (result) => {
|
||||||
if (api && result?.data?.AccessToken && result.data.User?.Name) {
|
const { AccessToken, User } = result?.data ?? {};
|
||||||
|
if (api && AccessToken && User?.Name && User.Id) {
|
||||||
setCheckForQuickConnect(false);
|
setCheckForQuickConnect(false);
|
||||||
// saveUser({ username, password, rememberMe: rememberUser });
|
enqueueSnackbar(`Logged in as ${User.Name}!`, {
|
||||||
enqueueSnackbar(`Logged in as ${result.data.User?.Name}!`, {
|
|
||||||
variant: "success",
|
variant: "success",
|
||||||
});
|
});
|
||||||
createApi(api.basePath, result.data.AccessToken);
|
createApi(api.basePath, AccessToken);
|
||||||
if (rememberUser) {
|
if (rememberUser) {
|
||||||
saveUser(result.data.User?.Name, result.data.AccessToken);
|
await saveUser(User.Name, AccessToken, User.Id);
|
||||||
}
|
}
|
||||||
|
router.invalidate().finally(() => {
|
||||||
navigate({ to: "/home", replace: true });
|
navigate({ to: "/home", replace: true });
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
transition: all $transition-time-fast;
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import React, { memo, type Ref, useCallback, useState } from "react";
|
|||||||
import { ErrorBoundary } from "react-error-boundary";
|
import { ErrorBoundary } from "react-error-boundary";
|
||||||
import { useInView } from "react-intersection-observer";
|
import { useInView } from "react-intersection-observer";
|
||||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import { resolveItemImage } from "@/utils/methods/itemImages";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import LikeButton from "../buttons/likeButton";
|
import LikeButton from "../buttons/likeButton";
|
||||||
import MarkPlayedButton from "../buttons/markPlayedButton";
|
import MarkPlayedButton from "../buttons/markPlayedButton";
|
||||||
@@ -56,6 +57,10 @@ const CardContent = ({
|
|||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const image = resolveItemImage(item, imageType, {
|
||||||
|
seriesId: seriesId ? (item.SeriesId ?? undefined) : undefined,
|
||||||
|
});
|
||||||
|
|
||||||
const defaultOnClick = useCallback(() => {
|
const defaultOnClick = useCallback(() => {
|
||||||
if (item?.Id) {
|
if (item?.Id) {
|
||||||
navigate(getItemLinkOptions(item.Id, item?.Type));
|
navigate(getItemLinkOptions(item.Id, item?.Type));
|
||||||
@@ -102,20 +107,20 @@ const CardContent = ({
|
|||||||
? getTypeIcon(overrideIcon)
|
? getTypeIcon(overrideIcon)
|
||||||
: getTypeIcon(item.Type ?? "universal")}
|
: getTypeIcon(item.Type ?? "universal")}
|
||||||
</div>
|
</div>
|
||||||
{inView && (
|
{image && (
|
||||||
<img
|
<img
|
||||||
alt={item.Name ?? "blink"}
|
alt={item.Name ?? "blink"}
|
||||||
src={
|
src={
|
||||||
api
|
api && image
|
||||||
? overrideIcon === "User"
|
? overrideIcon === "User"
|
||||||
? `${api?.basePath}/Users/${item.Id}/Images/Primary`
|
? `${api?.basePath}/Users/${item.Id}/Images/Primary`
|
||||||
: getImageUrlsApi(api).getItemImageUrlById(
|
: getImageUrlsApi(api).getItemImageUrlById(
|
||||||
(seriesId ? item.SeriesId : (item.AlbumId ?? item.Id)) ??
|
image.itemId,
|
||||||
"",
|
image.imageType,
|
||||||
imageType,
|
|
||||||
{
|
{
|
||||||
quality: 90,
|
quality: 90,
|
||||||
fillWidth: cardType === "thumb" ? 560 : 320,
|
fillWidth: cardType === "thumb" ? 560 : 320,
|
||||||
|
tag: image.tag,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
: ""
|
: ""
|
||||||
@@ -123,14 +128,9 @@ const CardContent = ({
|
|||||||
style={{
|
style={{
|
||||||
height: "100%",
|
height: "100%",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
opacity: 0,
|
|
||||||
display: "block",
|
display: "block",
|
||||||
transition: "opacity 0.3s ease-in-out",
|
|
||||||
}}
|
}}
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
onLoad={(e) => {
|
|
||||||
e.currentTarget.style.opacity = "1";
|
|
||||||
}}
|
|
||||||
className="card-image"
|
className="card-image"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -99,14 +99,14 @@ export default function CardScroller({
|
|||||||
},
|
},
|
||||||
tablet: {
|
tablet: {
|
||||||
breakpoint: { max: 925, min: 600 },
|
breakpoint: { max: 925, min: 600 },
|
||||||
items: displayCards - 3,
|
items: Math.max(2, displayCards - 2),
|
||||||
slidesToSlide: displayCards - 3,
|
slidesToSlide: Math.max(2, displayCards - 2),
|
||||||
partialVisibilityGutter: 20,
|
partialVisibilityGutter: 20,
|
||||||
},
|
},
|
||||||
mobile: {
|
mobile: {
|
||||||
breakpoint: { max: 600, min: 424 },
|
breakpoint: { max: 600, min: 424 },
|
||||||
items: displayCards - 5,
|
items: Math.max(1, displayCards - 4),
|
||||||
slidesToSlide: displayCards - 5,
|
slidesToSlide: Math.max(1, displayCards - 4),
|
||||||
partialVisibilityGutter: 10,
|
partialVisibilityGutter: 10,
|
||||||
},
|
},
|
||||||
smallScreen: {
|
smallScreen: {
|
||||||
|
|||||||
@@ -8,6 +8,15 @@
|
|||||||
grid-template-columns: 1fr 340px;
|
grid-template-columns: 1fr 340px;
|
||||||
gap: 1.5em;
|
gap: 1.5em;
|
||||||
|
|
||||||
|
&-slide-wrapper {
|
||||||
|
grid-area: main;
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
&-sidebar {
|
&-sidebar {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { AnimatePresence } from "motion/react";
|
|
||||||
import React, { useCallback, useEffect, useState } from "react";
|
import React, { useCallback, useEffect, useState } from "react";
|
||||||
|
import type { Api } from "@jellyfin/sdk";
|
||||||
|
|
||||||
import { useCarouselStore } from "../../utils/store/carousel";
|
import { useCarouselStore } from "../../utils/store/carousel";
|
||||||
import "./carousel.scss";
|
import "./carousel.scss";
|
||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
BaseItemKind,
|
BaseItemKind,
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import { resolveItemImage } from "@/utils/methods/itemImages";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import CarouselSlide from "../carouselSlide";
|
import CarouselSlide from "../carouselSlide";
|
||||||
import CarouselTickers from "./tickers";
|
import CarouselTickers from "./tickers";
|
||||||
@@ -15,6 +16,24 @@ import CarouselTickers from "./tickers";
|
|||||||
// Memoize CarouselSlide to prevent unnecessary re-renders
|
// Memoize CarouselSlide to prevent unnecessary re-renders
|
||||||
const MemoizedCarouselSlide = React.memo(CarouselSlide);
|
const MemoizedCarouselSlide = React.memo(CarouselSlide);
|
||||||
|
|
||||||
|
/** Sidebar thumbnail: prefer Thumb, fall back to Backdrop/Primary when missing. */
|
||||||
|
const tickerImageUrl = (
|
||||||
|
api: Api,
|
||||||
|
item: BaseItemDto,
|
||||||
|
): string | undefined => {
|
||||||
|
const image = resolveItemImage(item, "Thumb");
|
||||||
|
if (!image) return undefined;
|
||||||
|
return getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
image.itemId,
|
||||||
|
image.imageType,
|
||||||
|
{
|
||||||
|
quality: 90,
|
||||||
|
fillHeight: 360,
|
||||||
|
tag: image.tag,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const Carousel = ({
|
const Carousel = ({
|
||||||
content,
|
content,
|
||||||
onChange,
|
onChange,
|
||||||
@@ -96,12 +115,9 @@ const Carousel = ({
|
|||||||
onMouseEnter={() => setIsPaused(true)}
|
onMouseEnter={() => setIsPaused(true)}
|
||||||
onMouseLeave={() => setIsPaused(false)}
|
onMouseLeave={() => setIsPaused(false)}
|
||||||
>
|
>
|
||||||
<AnimatePresence mode="sync">
|
<div className="hero-carousel-slide-wrapper">
|
||||||
<MemoizedCarouselSlide
|
<MemoizedCarouselSlide item={content[currentSlide]} />
|
||||||
item={content[currentSlide]}
|
</div>
|
||||||
key={content[currentSlide].Id}
|
|
||||||
/>
|
|
||||||
</AnimatePresence>
|
|
||||||
<div className="carousel-sidebar" ref={sidebarRef}>
|
<div className="carousel-sidebar" ref={sidebarRef}>
|
||||||
{content.map((item, index) => (
|
{content.map((item, index) => (
|
||||||
<div
|
<div
|
||||||
@@ -112,18 +128,7 @@ const Carousel = ({
|
|||||||
className="carousel-ticker-wrapper"
|
className="carousel-ticker-wrapper"
|
||||||
>
|
>
|
||||||
<CarouselTickers
|
<CarouselTickers
|
||||||
imageUrl={
|
imageUrl={tickerImageUrl(api, item)}
|
||||||
item.ImageTags?.Thumb
|
|
||||||
? getImageUrlsApi(api).getItemImageUrlById(
|
|
||||||
item.Id ?? "",
|
|
||||||
"Thumb",
|
|
||||||
{
|
|
||||||
quality: 90,
|
|
||||||
fillHeight: 360,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: undefined
|
|
||||||
}
|
|
||||||
isActive={index === currentSlide}
|
isActive={index === currentSlide}
|
||||||
itemName={item.Name ?? "Unknown"}
|
itemName={item.Name ?? "Unknown"}
|
||||||
itemYear={
|
itemYear={
|
||||||
|
|||||||
@@ -8,9 +8,16 @@ import { green, red, yellow } from "@mui/material/colors";
|
|||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { motion, type Variants } from "motion/react";
|
import { motion, type Variants } from "motion/react";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { endsAt, getRuntime } from "@/utils/date/time";
|
import { endsAt, getRuntime } from "@/utils/date/time";
|
||||||
|
import {
|
||||||
|
getHeroPosterUrl,
|
||||||
|
getItemImagesQueryOptions,
|
||||||
|
resolveHeroArtwork,
|
||||||
|
} from "@/utils/methods/heroArtwork";
|
||||||
|
import BlurhashCanvas from "../blurhash-canvas";
|
||||||
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { useCarouselStore } from "@/utils/store/carousel";
|
import { useCarouselStore } from "@/utils/store/carousel";
|
||||||
@@ -25,10 +32,11 @@ const MotionTypography = motion.create(Typography);
|
|||||||
const MotionStack = motion.create(Stack);
|
const MotionStack = motion.create(Stack);
|
||||||
|
|
||||||
const textVariants: Variants = {
|
const textVariants: Variants = {
|
||||||
initial: (direction: string) => ({
|
// No hidden start state: hero text must not blink on slide changes.
|
||||||
x: direction === "right" ? 40 : -40,
|
initial: {
|
||||||
opacity: 0,
|
x: 0,
|
||||||
}),
|
opacity: 1,
|
||||||
|
},
|
||||||
animate: {
|
animate: {
|
||||||
x: 0,
|
x: 0,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
@@ -61,30 +69,38 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
|
|
||||||
const [animationDirection] = useCarouselStore((state) => [state.direction]);
|
const [animationDirection] = useCarouselStore((state) => [state.direction]);
|
||||||
|
|
||||||
|
// Jellyfin stores several images per item (poster, thumb, backdrops).
|
||||||
|
// Ask the server which ones exist and their real size, then pick the wide one.
|
||||||
|
const imageInfos = useQuery(getItemImagesQueryOptions(api, item.Id));
|
||||||
|
const heroArtwork = resolveHeroArtwork(api, item, imageInfos.data);
|
||||||
|
const heroPoster = heroArtwork?.isPortrait
|
||||||
|
? getHeroPosterUrl(api, item)
|
||||||
|
: undefined;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="hero-carousel-slide">
|
<div className="hero-carousel-slide">
|
||||||
<motion.div
|
<motion.div
|
||||||
className="hero-carousel-background-container"
|
className="hero-carousel-background-container"
|
||||||
initial={{ opacity: 0 }}
|
initial={{ opacity: 1 }}
|
||||||
animate={{ opacity: 1 }}
|
animate={{ opacity: 1 }}
|
||||||
exit={{ opacity: 0 }}
|
exit={{ opacity: 0 }}
|
||||||
transition={{ duration: 0.4, ease: "easeInOut" }}
|
transition={{ duration: 0.4, ease: "easeInOut" }}
|
||||||
>
|
>
|
||||||
{item.BackdropImageTags?.length ? (
|
{heroArtwork?.blurhash && (
|
||||||
|
<BlurhashCanvas
|
||||||
|
blurhashString={heroArtwork.blurhash}
|
||||||
|
width={48}
|
||||||
|
height={27}
|
||||||
|
canvasProps={{
|
||||||
|
className: "hero-carousel-background-blurhash",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{heroArtwork ? (
|
||||||
<img
|
<img
|
||||||
alt={item.Name ?? "item"}
|
alt={item.Name ?? "item"}
|
||||||
className="hero-carousel-background-image"
|
className={`hero-carousel-background-image${heroArtwork.isPortrait ? " is-poster" : ""}`}
|
||||||
src={
|
src={heroArtwork.url}
|
||||||
item.ParentBackdropItemId
|
|
||||||
? `${api?.basePath}/Items/${item.ParentBackdropItemId}/Images/Backdrop?quality=80`
|
|
||||||
: `${api?.basePath}/Items/${item.Id}/Images/Backdrop?quality=80&fillHeight=1400`
|
|
||||||
}
|
|
||||||
style={{
|
|
||||||
opacity: 0,
|
|
||||||
}}
|
|
||||||
onLoad={(e) => {
|
|
||||||
e.currentTarget.style.opacity = "1";
|
|
||||||
}}
|
|
||||||
loading="eager"
|
loading="eager"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -92,6 +108,14 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
{getTypeIcon(item.Type ?? "Movie")}
|
{getTypeIcon(item.Type ?? "Movie")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{heroPoster && (
|
||||||
|
<img
|
||||||
|
alt={item.Name ?? "poster"}
|
||||||
|
className="hero-carousel-poster"
|
||||||
|
src={heroPoster}
|
||||||
|
loading="eager"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</motion.div>
|
</motion.div>
|
||||||
<motion.div
|
<motion.div
|
||||||
className="hero-carousel-detail"
|
className="hero-carousel-detail"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Link, Typography } from "@mui/material";
|
import { Link, Tooltip } from "@mui/material";
|
||||||
import React, { memo } from "react";
|
import React, { memo } from "react";
|
||||||
|
|
||||||
import anidbIcon from "../../assets/icons/anidb.png";
|
import anidbIcon from "../../assets/icons/anidb.png";
|
||||||
@@ -12,54 +12,49 @@ import tmdbIcon from "../../assets/icons/themoviedatabase.svg";
|
|||||||
import traktIcon from "../../assets/icons/trakt.svg";
|
import traktIcon from "../../assets/icons/trakt.svg";
|
||||||
import tvMazeIcon from "../../assets/icons/tvmaze.png";
|
import tvMazeIcon from "../../assets/icons/tvmaze.png";
|
||||||
|
|
||||||
const knownIcons = [
|
/**
|
||||||
"imdb",
|
* Provider icons keyed by the start of the normalized link name, so variants like
|
||||||
"themoviedb",
|
* "TMDB"/"TheMovieDb", "TVDB"/"TheTVDB" or "MusicBrainz Artist" all match.
|
||||||
"trakt",
|
*/
|
||||||
"musicbrainz",
|
const providerIcons: [prefixes: string[], icon: string][] = [
|
||||||
"thetvdb",
|
[["imdb"], imdbIcon],
|
||||||
"anidb",
|
[["tmdb", "themoviedb"], tmdbIcon],
|
||||||
"anilist",
|
[["tvdb", "thetvdb"], tvDbIcon],
|
||||||
"tvmaze",
|
[["trakt"], traktIcon],
|
||||||
"theaudiodb",
|
[["musicbrainz"], musicBrainzIcon],
|
||||||
"kitsu",
|
[["anidb"], anidbIcon],
|
||||||
|
[["anilist"], anilistIcon],
|
||||||
|
[["tvmaze"], tvMazeIcon],
|
||||||
|
[["theaudiodb", "audiodb"], audioDBIcon],
|
||||||
|
[["kitsu"], kitsuIcon],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const getProviderIcon = (name: string) => {
|
||||||
|
const normalized = name.toLocaleLowerCase().replace(/[^a-z0-9]/g, "");
|
||||||
|
return providerIcons.find(([prefixes]) =>
|
||||||
|
prefixes.some((prefix) => normalized.startsWith(prefix)),
|
||||||
|
)?.[1];
|
||||||
|
};
|
||||||
|
|
||||||
const IconLink = memo(({ name, url }: { name: string; url: string }) => {
|
const IconLink = memo(({ name, url }: { name: string; url: string }) => {
|
||||||
|
const icon = getProviderIcon(name);
|
||||||
return (
|
return (
|
||||||
<Link target="_blank" href={url} className="item-detail-link">
|
<Tooltip title={name}>
|
||||||
{name.toLocaleLowerCase() === "imdb" && <img src={imdbIcon} alt="IMDb" />}
|
<Link
|
||||||
{name.toLocaleLowerCase() === "themoviedb" && (
|
target="_blank"
|
||||||
<img src={tmdbIcon} alt="TheMovieDb" />
|
href={url}
|
||||||
)}
|
className="item-detail-link"
|
||||||
{name.toLocaleLowerCase() === "trakt" && (
|
aria-label={name}
|
||||||
<img src={traktIcon} alt="Trakt" />
|
>
|
||||||
)}
|
{icon ? (
|
||||||
{name.toLocaleLowerCase() === "musicbrainz" && (
|
<img src={icon} alt={name} />
|
||||||
<img src={musicBrainzIcon} alt="MusicBrainz" />
|
) : (
|
||||||
)}
|
<span className="material-symbols-rounded item-detail-link-generic">
|
||||||
{name.toLocaleLowerCase() === "thetvdb" && (
|
link
|
||||||
<img src={tvDbIcon} alt="TheTVDB" />
|
</span>
|
||||||
)}
|
|
||||||
{name.toLocaleLowerCase() === "anidb" && (
|
|
||||||
<img src={anidbIcon} alt="AniDB" />
|
|
||||||
)}
|
|
||||||
{name.toLocaleLowerCase() === "anilist" && (
|
|
||||||
<img src={anilistIcon} alt="AniList" />
|
|
||||||
)}
|
|
||||||
{name.toLocaleLowerCase() === "tvmaze" && (
|
|
||||||
<img src={tvMazeIcon} alt="TVMaze" />
|
|
||||||
)}
|
|
||||||
{name.toLocaleLowerCase() === "theaudiodb" && (
|
|
||||||
<img src={audioDBIcon} alt="TheAudioDB" />
|
|
||||||
)}
|
|
||||||
{name.toLocaleLowerCase() === "kitsu" && (
|
|
||||||
<img src={kitsuIcon} alt="Kitsu" />
|
|
||||||
)}
|
|
||||||
{!knownIcons.includes(name.toLocaleLowerCase()) && (
|
|
||||||
<Typography>{name}</Typography>
|
|
||||||
)}
|
)}
|
||||||
</Link>
|
</Link>
|
||||||
|
</Tooltip>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,12 @@ interface ItemBackdropProps {
|
|||||||
const MotionImg = motion.img;
|
const MotionImg = motion.img;
|
||||||
|
|
||||||
const animationProps = {
|
const animationProps = {
|
||||||
initial: { opacity: 0 },
|
// Do not fade in from black on every navigation: cached artwork should be
|
||||||
|
// visible immediately (a fade here reads as a flash).
|
||||||
|
initial: { opacity: 1 },
|
||||||
animate: { opacity: 1 },
|
animate: { opacity: 1 },
|
||||||
exit: { opacity: 0 },
|
exit: { opacity: 0 },
|
||||||
transition: { duration: 0.5 },
|
transition: { duration: 0.3 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -113,6 +115,9 @@ export function ItemBackdrop({
|
|||||||
alt={alt}
|
alt={alt}
|
||||||
src={src}
|
src={src}
|
||||||
className={className ?? "item-hero-backdrop"}
|
className={className ?? "item-hero-backdrop"}
|
||||||
|
ref={(el) => {
|
||||||
|
if (el?.complete && el.naturalWidth > 0) el.style.opacity = "1";
|
||||||
|
}}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = "1";
|
e.currentTarget.style.opacity = "1";
|
||||||
onLoad?.(e);
|
onLoad?.(e);
|
||||||
|
|||||||
@@ -101,8 +101,6 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
opacity: 0;
|
|
||||||
transition: opacity $transition-time-default;
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
@@ -208,6 +206,16 @@
|
|||||||
filter: brightness(0.5);
|
filter: brightness(0.5);
|
||||||
transition: filter $transition-time-default;
|
transition: filter $transition-time-default;
|
||||||
}
|
}
|
||||||
|
&-generic {
|
||||||
|
display: block;
|
||||||
|
font-size: 2em !important;
|
||||||
|
color: white;
|
||||||
|
opacity: 0.5;
|
||||||
|
transition: opacity $transition-time-default;
|
||||||
|
}
|
||||||
|
&:hover > &-generic {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ const ItemHeader = ({
|
|||||||
backdropSrc,
|
backdropSrc,
|
||||||
}: ItemHeaderProps) => {
|
}: ItemHeaderProps) => {
|
||||||
const isEpisode = item.Type === "Episode";
|
const isEpisode = item.Type === "Episode";
|
||||||
|
// A runtime / "ends at" is meaningless for people and artists (it sums their whole catalogue)
|
||||||
|
const showRuntime = item.Type !== "MusicArtist" && item.Type !== "Person";
|
||||||
const backdropTag =
|
const backdropTag =
|
||||||
isEpisode && item.ParentBackdropImageTags?.length
|
isEpisode && item.ParentBackdropImageTags?.length
|
||||||
? item.ParentBackdropImageTags[0]
|
? item.ParentBackdropImageTags[0]
|
||||||
@@ -75,9 +77,6 @@ const ItemHeader = ({
|
|||||||
tag: logoTag,
|
tag: logoTag,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
onLoad={(e) => {
|
|
||||||
e.currentTarget.style.opacity = "1";
|
|
||||||
}}
|
|
||||||
className="item-hero-logo"
|
className="item-hero-logo"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -141,9 +140,6 @@ const ItemHeader = ({
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
onLoad={(e) => {
|
|
||||||
e.currentTarget.style.opacity = "1";
|
|
||||||
}}
|
|
||||||
className="item-hero-image"
|
className="item-hero-image"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -294,12 +290,12 @@ const ItemHeader = ({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{item.RunTimeTicks && (
|
{showRuntime && item.RunTimeTicks && (
|
||||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||||
{getRuntime(item.RunTimeTicks)}
|
{getRuntime(item.RunTimeTicks)}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
{item.RunTimeTicks && (
|
{showRuntime && item.RunTimeTicks && (
|
||||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||||
{endsAt(
|
{endsAt(
|
||||||
item.RunTimeTicks - (item.UserData?.PlaybackPositionTicks ?? 0),
|
item.RunTimeTicks - (item.UserData?.PlaybackPositionTicks ?? 0),
|
||||||
|
|||||||
@@ -12,10 +12,8 @@ $cardWidth: 18%;
|
|||||||
grid-template-columns: $cardWidth 1fr;
|
grid-template-columns: $cardWidth 1fr;
|
||||||
grid-template-rows: 1fr auto;
|
grid-template-rows: 1fr auto;
|
||||||
&-image {
|
&-image {
|
||||||
opacity: 0;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
transition: opacity $transition-time-default;
|
|
||||||
&-container {
|
&-container {
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
@@ -47,8 +45,6 @@ $cardWidth: 18%;
|
|||||||
&-logo {
|
&-logo {
|
||||||
max-width: 34rem;
|
max-width: 34rem;
|
||||||
max-height: 10rem;
|
max-height: 10rem;
|
||||||
opacity: 0;
|
|
||||||
transition: opacity $transition-time-default;
|
|
||||||
object-position: bottom;
|
object-position: bottom;
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
}
|
}
|
||||||
@@ -74,11 +70,9 @@ $cardWidth: 18%;
|
|||||||
height: 100vh;
|
height: 100vh;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
object-position: top;
|
object-position: top;
|
||||||
opacity: 0;
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
transition: opacity $transition-time-default;
|
|
||||||
&-container {
|
&-container {
|
||||||
filter: brightness(0.8);
|
filter: brightness(0.8);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ export const LibraryHeader = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AppBar
|
<AppBar
|
||||||
|
data-tauri-drag-region
|
||||||
className={
|
className={
|
||||||
scrollTrigger
|
scrollTrigger
|
||||||
? "library-header scrolling flex flex-row"
|
? "library-header scrolling flex flex-row"
|
||||||
@@ -267,7 +268,7 @@ export const LibraryHeader = () => {
|
|||||||
elevation={0}
|
elevation={0}
|
||||||
color="transparent"
|
color="transparent"
|
||||||
>
|
>
|
||||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
<div className="flex flex-row" data-tauri-drag-region style={{ gap: "0.6em" }}>
|
||||||
<IconButton onClick={handleDrawerOpen}>
|
<IconButton onClick={handleDrawerOpen}>
|
||||||
<div className="material-symbols-rounded">menu</div>
|
<div className="material-symbols-rounded">menu</div>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|||||||
@@ -12,16 +12,28 @@
|
|||||||
padding: 0.25em !important;
|
padding: 0.25em !important;
|
||||||
transition: all 0.2s ease-in-out;
|
transition: all 0.2s ease-in-out;
|
||||||
|
|
||||||
|
html.is-macos & {
|
||||||
|
// The window has an overlay titlebar: keep controls clear of the traffic lights
|
||||||
|
// without pushing the right-hand actions out of the viewport.
|
||||||
|
padding-left: 72px !important;
|
||||||
|
width: calc(100vw - 4em - 72px) !important;
|
||||||
|
left: calc(2em + 72px) !important;
|
||||||
|
right: 2em !important;
|
||||||
|
}
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
content: "";
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: -0.35em;
|
inset: -0.35em;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
border-radius: inherit;
|
border-radius: inherit;
|
||||||
@include glass-effect;
|
// Solid titlebar surface: no glass/blur.
|
||||||
|
background-color: $clr-background-default;
|
||||||
|
border: 1px solid rgb(255 255 255 / 0.08);
|
||||||
|
box-shadow: 0 4px 20px rgb(0 0 0 / 0.4);
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
transition: all 150ms;
|
transition: opacity 150ms;
|
||||||
}
|
}
|
||||||
&.scrolling {
|
&.scrolling {
|
||||||
&::after {
|
&::after {
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ const LibraryItemsGrid = () => {
|
|||||||
// --- Virtualization setup ---
|
// --- Virtualization setup ---
|
||||||
const parentRef = useRef<HTMLDivElement | null>(null);
|
const parentRef = useRef<HTMLDivElement | null>(null);
|
||||||
const [containerWidth, setContainerWidth] = useState<number>(0);
|
const [containerWidth, setContainerWidth] = useState<number>(0);
|
||||||
|
const [scrollMargin, setScrollMargin] = useState<number>(0);
|
||||||
|
|
||||||
// Determine column count based on container width (simple heuristic)
|
// Determine column count based on container width (simple heuristic)
|
||||||
const [columns, setColumns] = useState(1);
|
const [columns, setColumns] = useState(1);
|
||||||
@@ -134,6 +135,7 @@ const LibraryItemsGrid = () => {
|
|||||||
if (!parentRef.current) return;
|
if (!parentRef.current) return;
|
||||||
const width = parentRef.current.clientWidth;
|
const width = parentRef.current.clientWidth;
|
||||||
setContainerWidth(width);
|
setContainerWidth(width);
|
||||||
|
setScrollMargin(parentRef.current.offsetTop);
|
||||||
// Base desired approximate card width (including gap) 180px
|
// Base desired approximate card width (including gap) 180px
|
||||||
const ideal = Math.max(1, Math.floor(width / 180));
|
const ideal = Math.max(1, Math.floor(width / 180));
|
||||||
setColumns(ideal);
|
setColumns(ideal);
|
||||||
@@ -145,7 +147,14 @@ const LibraryItemsGrid = () => {
|
|||||||
|
|
||||||
const ro = new ResizeObserver(() => measureColumns());
|
const ro = new ResizeObserver(() => measureColumns());
|
||||||
ro.observe(parentRef.current);
|
ro.observe(parentRef.current);
|
||||||
return () => ro.disconnect();
|
// The header above the grid can change height (filters, wrapping): keep the
|
||||||
|
// window-virtualizer offset in sync so rows never jump while scrolling.
|
||||||
|
ro.observe(document.body);
|
||||||
|
window.addEventListener("resize", measureColumns);
|
||||||
|
return () => {
|
||||||
|
ro.disconnect();
|
||||||
|
window.removeEventListener("resize", measureColumns);
|
||||||
|
};
|
||||||
}, [measureColumns]);
|
}, [measureColumns]);
|
||||||
|
|
||||||
const itemCount = items.data?.Items?.length ?? 0;
|
const itemCount = items.data?.Items?.length ?? 0;
|
||||||
@@ -161,23 +170,30 @@ const LibraryItemsGrid = () => {
|
|||||||
return Math.floor((containerWidth - totalGap) / columns);
|
return Math.floor((containerWidth - totalGap) / columns);
|
||||||
}, [columns, containerWidth]);
|
}, [columns, containerWidth]);
|
||||||
|
|
||||||
// Approximate tallest card height (portrait ratio ~ 2:3 => height ≈ width / 0.666) + text/footer area
|
// Approximate card height: width / aspect ratio + text block (title + caption).
|
||||||
// We add a small buffer (20px) for hover overlays and progress bars
|
// Square artwork (music, genres) is shorter than portrait posters.
|
||||||
const estimatedTallCardHeight = useMemo(
|
const cardAspect = useMemo(() => {
|
||||||
() => Math.round(cardWidth / 0.666666 + 90),
|
const first = items.data?.Items?.[0];
|
||||||
[cardWidth],
|
const square =
|
||||||
);
|
first?.Type === BaseItemKind.MusicAlbum ||
|
||||||
|
first?.Type === BaseItemKind.Audio ||
|
||||||
|
first?.Type === BaseItemKind.Genre ||
|
||||||
|
first?.Type === BaseItemKind.MusicGenre ||
|
||||||
|
first?.Type === BaseItemKind.Studio ||
|
||||||
|
first?.Type === BaseItemKind.Playlist;
|
||||||
|
return square ? 1 : 0.666666;
|
||||||
|
}, [items.data?.Items]);
|
||||||
|
|
||||||
const estimateRowHeight = useCallback(
|
const estimateRowHeight = useCallback(
|
||||||
() => estimatedTallCardHeight,
|
() => Math.round(cardWidth / cardAspect + 60),
|
||||||
[estimatedTallCardHeight],
|
[cardWidth, cardAspect],
|
||||||
);
|
);
|
||||||
|
|
||||||
const virtualizer = useWindowVirtualizer({
|
const virtualizer = useWindowVirtualizer({
|
||||||
count: rowCount,
|
count: rowCount,
|
||||||
estimateSize: estimateRowHeight,
|
estimateSize: estimateRowHeight,
|
||||||
overscan: 6,
|
overscan: 4,
|
||||||
scrollMargin: parentRef.current?.offsetTop ?? 0,
|
scrollMargin,
|
||||||
});
|
});
|
||||||
|
|
||||||
const virtualItems = virtualizer.getVirtualItems();
|
const virtualItems = virtualizer.getVirtualItems();
|
||||||
@@ -245,13 +261,9 @@ const LibraryItemsGrid = () => {
|
|||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
alignItems: "flex-start",
|
alignItems: "flex-start",
|
||||||
gap: `${cardGap}px`,
|
gap: `${cardGap}px`,
|
||||||
// Allow natural height; virtualizer will update size after measurement.
|
|
||||||
paddingBottom: "0.6em",
|
|
||||||
}}
|
}}
|
||||||
data-index={row.index}
|
data-index={row.index}
|
||||||
ref={(el) => {
|
ref={virtualizer.measureElement}
|
||||||
if (el) virtualizer.measureElement(el);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{items.data?.Items?.slice(startIndex, endIndex).map(
|
{items.data?.Items?.slice(startIndex, endIndex).map(
|
||||||
(item: BaseItemDto, localIndex: number) => {
|
(item: BaseItemDto, localIndex: number) => {
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
import { getBrandingApi } from "@jellyfin/sdk/lib/utils/api/branding-api";
|
||||||
|
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import { Link } from "@tanstack/react-router";
|
||||||
|
import React, { type ReactNode, useEffect } from "react";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||||
|
|
||||||
|
import "./loginShell.scss";
|
||||||
|
|
||||||
|
type LoginShellProps = {
|
||||||
|
title: ReactNode;
|
||||||
|
subtitle?: ReactNode;
|
||||||
|
/** Max width of the content column. */
|
||||||
|
width?: "narrow" | "wide";
|
||||||
|
children: ReactNode;
|
||||||
|
footer?: ReactNode;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Shared full-screen layout for the sign-in pages. */
|
||||||
|
const LoginShell = ({
|
||||||
|
title,
|
||||||
|
subtitle,
|
||||||
|
width = "narrow",
|
||||||
|
children,
|
||||||
|
footer,
|
||||||
|
}: LoginShellProps) => {
|
||||||
|
const api = useApiInContext((s) => s.api);
|
||||||
|
|
||||||
|
const serverInfo = useQuery({
|
||||||
|
queryKey: ["login", "serverInfo"],
|
||||||
|
queryFn: async () =>
|
||||||
|
api ? (await getSystemApi(api).getPublicSystemInfo()).data : null,
|
||||||
|
enabled: Boolean(api),
|
||||||
|
staleTime: 5 * 60_000,
|
||||||
|
});
|
||||||
|
const branding = useQuery({
|
||||||
|
queryKey: ["login", "branding"],
|
||||||
|
queryFn: async () =>
|
||||||
|
api ? (await getBrandingApi(api).getBrandingOptions()).data : null,
|
||||||
|
enabled: Boolean(api),
|
||||||
|
staleTime: 5 * 60_000,
|
||||||
|
});
|
||||||
|
|
||||||
|
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||||
|
useEffect(() => {
|
||||||
|
setBackdrop("");
|
||||||
|
}, [setBackdrop]);
|
||||||
|
|
||||||
|
const serverName = serverInfo.data?.ServerName;
|
||||||
|
const serverHost = api?.basePath.replace(/^https?:\/\//, "");
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="login-shell scrollY" data-tauri-drag-region>
|
||||||
|
<div className={`login-shell-content login-shell-${width}`}>
|
||||||
|
{serverHost && (
|
||||||
|
<div className="login-shell-server">
|
||||||
|
<span className="material-symbols-rounded">dns</span>
|
||||||
|
<span className="login-shell-server-name" title={serverHost}>
|
||||||
|
{serverName ?? serverHost}
|
||||||
|
</span>
|
||||||
|
<Link to="/setup/server/list" className="login-shell-server-change">
|
||||||
|
Change
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<header className="login-shell-header">
|
||||||
|
<h1 className="login-shell-title">{title}</h1>
|
||||||
|
{subtitle && <p className="login-shell-subtitle">{subtitle}</p>}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main className="login-shell-body">{children}</main>
|
||||||
|
|
||||||
|
{footer && <footer className="login-shell-footer">{footer}</footer>}
|
||||||
|
|
||||||
|
{branding.data?.LoginDisclaimer && (
|
||||||
|
<aside className="login-shell-disclaimer">
|
||||||
|
<span className="material-symbols-rounded">info</span>
|
||||||
|
<p>{branding.data.LoginDisclaimer}</p>
|
||||||
|
</aside>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default LoginShell;
|
||||||
@@ -0,0 +1,278 @@
|
|||||||
|
.login-shell {
|
||||||
|
// In normal flow (not fixed) so the app bar above stays clickable
|
||||||
|
position: relative;
|
||||||
|
min-height: 100vh;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 5rem 1.5rem 3rem;
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: white;
|
||||||
|
// Soft accent glow instead of a boxed card
|
||||||
|
background:
|
||||||
|
radial-gradient(ellipse 60% 45% at 50% 0%, rgb(255 41 128 / 0.14), transparent 70%),
|
||||||
|
radial-gradient(ellipse 50% 40% at 50% 100%, rgb(110 0 184 / 0.18), transparent 70%);
|
||||||
|
|
||||||
|
&-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
margin: auto 0;
|
||||||
|
gap: 1.5rem;
|
||||||
|
}
|
||||||
|
&-narrow {
|
||||||
|
max-width: 380px;
|
||||||
|
}
|
||||||
|
&-wide {
|
||||||
|
max-width: 880px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-server {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
max-width: 100%;
|
||||||
|
padding: 0.35rem 0.5rem 0.35rem 0.75rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: rgb(255 255 255 / 0.06);
|
||||||
|
border: 1px solid rgb(255 255 255 / 0.08);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
|
||||||
|
.material-symbols-rounded {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
&-name {
|
||||||
|
opacity: 0.85;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
&-change {
|
||||||
|
flex-shrink: 0;
|
||||||
|
padding: 0.15rem 0.6rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
color: white;
|
||||||
|
font-weight: 600;
|
||||||
|
text-decoration: none;
|
||||||
|
background: rgb(255 255 255 / 0.08);
|
||||||
|
transition: background 0.15s ease;
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus-visible {
|
||||||
|
background: rgb(255 255 255 / 0.16);
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-header {
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
}
|
||||||
|
&-title {
|
||||||
|
margin: 0;
|
||||||
|
font-size: clamp(1.75rem, 4vw, 2.5rem);
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
line-height: 1.15;
|
||||||
|
}
|
||||||
|
&-subtitle {
|
||||||
|
margin: 0.5rem 0 0;
|
||||||
|
opacity: 0.65;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-body {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-footer {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 0.5rem 1rem;
|
||||||
|
opacity: 0.85;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-disclaimer {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.6rem;
|
||||||
|
max-width: 480px;
|
||||||
|
padding: 0.9rem 1rem;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
background: rgb(255 255 255 / 0.04);
|
||||||
|
border: 1px solid rgb(255 255 255 / 0.08);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
|
||||||
|
.material-symbols-rounded {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
opacity: 0.75;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Text-style secondary action used in login footers
|
||||||
|
.login-link {
|
||||||
|
all: unset;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.35rem;
|
||||||
|
padding: 0.4rem 0.75rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: rgb(255 255 255 / 0.75);
|
||||||
|
text-decoration: none;
|
||||||
|
transition: background 0.15s ease, color 0.15s ease;
|
||||||
|
|
||||||
|
.material-symbols-rounded {
|
||||||
|
font-size: 1.15rem;
|
||||||
|
}
|
||||||
|
&:hover,
|
||||||
|
&:focus-visible {
|
||||||
|
color: white;
|
||||||
|
background: rgb(255 255 255 / 0.08);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Profile picker
|
||||||
|
.profile-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(128px, 148px));
|
||||||
|
justify-content: center;
|
||||||
|
gap: 1.5rem 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile {
|
||||||
|
all: unset;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.75rem;
|
||||||
|
padding: 0.75rem 0.5rem;
|
||||||
|
border-radius: 1rem;
|
||||||
|
cursor: pointer;
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
&-avatar {
|
||||||
|
position: relative;
|
||||||
|
width: 112px;
|
||||||
|
height: 112px;
|
||||||
|
border-radius: 50%;
|
||||||
|
// Ring that lights up on hover / focus
|
||||||
|
box-shadow: 0 0 0 3px transparent, 0 10px 24px rgb(0 0 0 / 0.4);
|
||||||
|
transition: box-shadow 0.2s ease, transform 0.2s ease;
|
||||||
|
|
||||||
|
img,
|
||||||
|
.profile-avatar-fallback {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 50%;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
&-fallback {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 2.75rem;
|
||||||
|
font-weight: 700;
|
||||||
|
background: linear-gradient(135deg, $clr-accent-default, $clr-secondary-default);
|
||||||
|
}
|
||||||
|
&-add {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: rgb(255 255 255 / 0.06);
|
||||||
|
border: 2px dashed rgb(255 255 255 / 0.25);
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
.material-symbols-rounded {
|
||||||
|
font-size: 2.5rem;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-lock {
|
||||||
|
position: absolute;
|
||||||
|
right: 2px;
|
||||||
|
bottom: 2px;
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: rgb(18 18 24);
|
||||||
|
border: 2px solid rgb(18 18 24);
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
.material-symbols-rounded {
|
||||||
|
font-size: 1rem;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-name {
|
||||||
|
max-width: 100%;
|
||||||
|
font-weight: 600;
|
||||||
|
opacity: 0.8;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
transition: opacity 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus-visible {
|
||||||
|
.profile-avatar {
|
||||||
|
transform: translateY(-3px);
|
||||||
|
box-shadow: 0 0 0 3px $clr-accent-default, 0 14px 30px rgb(0 0 0 / 0.5);
|
||||||
|
}
|
||||||
|
.profile-name {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Password / manual sign-in form
|
||||||
|
.login-form {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
&-avatar {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
|
||||||
|
.profile-avatar {
|
||||||
|
width: 96px;
|
||||||
|
height: 96px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-options {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin: -0.25rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-submit.MuiButton-root {
|
||||||
|
height: 48px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-weight: 700;
|
||||||
|
text-transform: none;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
import type { Api } from "@jellyfin/sdk";
|
||||||
|
import type { UserDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
|
import { queryOptions } from "@tanstack/react-query";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
|
||||||
|
/** Public (listed) users of the current server; shared by the login pages. */
|
||||||
|
export const getPublicUsersQueryOptions = (api: Api | null | undefined) =>
|
||||||
|
queryOptions({
|
||||||
|
queryKey: ["login", "public-users"],
|
||||||
|
queryFn: async () =>
|
||||||
|
api ? (await getUserApi(api).getPublicUsers()).data : [],
|
||||||
|
enabled: Boolean(api),
|
||||||
|
});
|
||||||
|
|
||||||
|
type ProfileAvatarProps = {
|
||||||
|
userId: string;
|
||||||
|
name: string;
|
||||||
|
imageTag?: string | null;
|
||||||
|
/** Shows a lock badge for password-protected profiles. */
|
||||||
|
locked?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Round profile picture, falling back to the user's initial. */
|
||||||
|
export const ProfileAvatar = ({
|
||||||
|
userId,
|
||||||
|
name,
|
||||||
|
imageTag,
|
||||||
|
locked,
|
||||||
|
}: ProfileAvatarProps) => {
|
||||||
|
const api = useApiInContext((s) => s.api);
|
||||||
|
const [failed, setFailed] = useState(false);
|
||||||
|
const showImage = api && imageTag && !failed;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<span className="profile-avatar">
|
||||||
|
{showImage ? (
|
||||||
|
<img
|
||||||
|
alt=""
|
||||||
|
src={`${api.basePath}/Users/${userId}/Images/Primary?quality=85&fillWidth=224&fillHeight=224&tag=${imageTag}`}
|
||||||
|
onError={() => setFailed(true)}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<span className="profile-avatar-fallback" aria-hidden>
|
||||||
|
{name.trim().charAt(0).toUpperCase() || "?"}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
{locked && (
|
||||||
|
<span className="profile-lock" title="Password protected">
|
||||||
|
<span className="material-symbols-rounded">lock</span>
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const isPasswordProtected = (user: UserDto | undefined) =>
|
||||||
|
user?.HasPassword !== false;
|
||||||
@@ -31,15 +31,16 @@ export const ErrorNotice = ({ error }: { error?: Error }) => {
|
|||||||
</div>
|
</div>
|
||||||
<Typography
|
<Typography
|
||||||
variant="h3"
|
variant="h3"
|
||||||
color="white"
|
|
||||||
sx={{
|
sx={{
|
||||||
|
color: "white",
|
||||||
fontWeight: 300,
|
fontWeight: 300,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Something went wrong.
|
Something went wrong.
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
variant="h5"
|
variant="body2"
|
||||||
|
component="pre"
|
||||||
style={{
|
style={{
|
||||||
padding: "0.5em",
|
padding: "0.5em",
|
||||||
background: "rgb(0 0 0 / 1)",
|
background: "rgb(0 0 0 / 1)",
|
||||||
@@ -49,15 +50,16 @@ export const ErrorNotice = ({ error }: { error?: Error }) => {
|
|||||||
maxHeight: "20em",
|
maxHeight: "20em",
|
||||||
overflow: "auto",
|
overflow: "auto",
|
||||||
marginTop: "1em",
|
marginTop: "1em",
|
||||||
// opacity: 0.6,
|
whiteSpace: "pre-wrap",
|
||||||
}}
|
}}
|
||||||
color="gray"
|
|
||||||
sx={{
|
sx={{
|
||||||
|
color: "grey.400",
|
||||||
fontFamily: "JetBrains Mono Variable",
|
fontFamily: "JetBrains Mono Variable",
|
||||||
fontWeight: 100,
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{JSON.stringify(error?.stack)}
|
{error
|
||||||
|
? error.stack || `${error.name}: ${error.message}`
|
||||||
|
: "Unknown error"}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,140 +1,228 @@
|
|||||||
$image-size: 4em;
|
$art-size: 48px;
|
||||||
|
|
||||||
.audio-player {
|
.audio-player {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 1rem;
|
bottom: 0.75rem;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
width: 95%;
|
width: min(1100px, calc(100% - 1.5rem));
|
||||||
max-width: 1200px;
|
height: 80px;
|
||||||
|
box-sizing: border-box;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
|
|
||||||
display: grid;
|
display: grid;
|
||||||
padding: 0.75em 1.5em;
|
// Equal side columns keep the transport truly centred
|
||||||
gap: 1.5em;
|
grid-template-columns: minmax(0, 1fr) minmax(0, 540px) minmax(0, 1fr);
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
|
|
||||||
grid-template-columns: 25% 1fr 25%;
|
|
||||||
@include glass-effect($blur: 12px, $bg-color: rgba(18, 18, 18, 0.85));
|
|
||||||
// background: rgba(18, 18, 18, 0.85) !important;
|
|
||||||
// backdrop-filter: blur(12px);
|
|
||||||
// -webkit-backdrop-filter: blur(12px);
|
|
||||||
// border: 1px solid rgba(255, 255, 255, 0.1);
|
|
||||||
border-radius: 1rem;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
gap: 1.5rem;
|
||||||
|
padding: 0 0.75rem 0 1rem;
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
color: white;
|
||||||
grid-template-columns: 1fr auto;
|
background: rgb(18 18 24 / 0.92);
|
||||||
padding: 0.5em 1em;
|
backdrop-filter: blur(16px);
|
||||||
bottom: 0;
|
-webkit-backdrop-filter: blur(16px);
|
||||||
width: 100%;
|
border: 1px solid rgb(255 255 255 / 0.08);
|
||||||
border-radius: 0;
|
border-radius: 14px;
|
||||||
border-bottom: none;
|
box-shadow: 0 12px 40px rgb(0 0 0 / 0.45);
|
||||||
border-left: none;
|
|
||||||
border-right: none;
|
|
||||||
|
|
||||||
.audio-player-controls {
|
&-info {
|
||||||
display: none; // Hide controls on mobile for now or adjust
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#waveform {
|
|
||||||
width: 100%;
|
|
||||||
transform: scaleY(0);
|
|
||||||
transition: transform $transition-time-default;
|
|
||||||
&[data-show="true"] {
|
|
||||||
transform: scaleY(1) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&-controls {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
gap: 0.75rem;
|
||||||
gap: 0.5em;
|
min-width: 0;
|
||||||
padding: 0.5em 0;
|
|
||||||
flex-flow: column;
|
> .MuiIconButton-root {
|
||||||
|
flex-shrink: 0;
|
||||||
|
color: rgb(255 255 255 / 0.75);
|
||||||
|
.material-symbols-rounded {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
&-info {
|
|
||||||
display: grid;
|
|
||||||
gap: 1em;
|
|
||||||
grid-template-columns: minmax(0, $image-size) minmax(0, 1fr);
|
|
||||||
width: fit-content;
|
|
||||||
align-items: center;
|
|
||||||
flex-grow: 1;
|
|
||||||
width: 100%;
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
&-text {
|
&-text {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: hidden;
|
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-title {
|
||||||
|
all: unset;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: 600 !important;
|
||||||
|
line-height: 1.25 !important;
|
||||||
|
// Wrap long titles onto a second line before truncating
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
overflow: hidden;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus-visible {
|
||||||
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-artist {
|
||||||
|
opacity: 0.6;
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&-image {
|
&-image {
|
||||||
width: $image-size;
|
position: absolute;
|
||||||
aspect-ratio: 1;
|
inset: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
flex-shrink: 0;
|
|
||||||
flex-grow: 1;
|
|
||||||
|
|
||||||
position: relative;
|
|
||||||
&-container {
|
&-container {
|
||||||
border-radius: $border-radius_04;
|
all: unset;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: $art-size;
|
||||||
|
height: $art-size;
|
||||||
|
border-radius: 8px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
height: fit-content;
|
cursor: pointer;
|
||||||
aspect-ratio: 1;
|
background: rgb(255 255 255 / 0.08);
|
||||||
background: rgb(255 255 255 / 0.1);
|
|
||||||
|
&:hover .audio-player-image-expand,
|
||||||
|
&:focus-visible .audio-player-image-expand {
|
||||||
|
opacity: 1;
|
||||||
}
|
}
|
||||||
&-icon {
|
}
|
||||||
|
|
||||||
|
&-icon,
|
||||||
|
&-expand {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
font-size: 2em !important;
|
}
|
||||||
z-index: 0;
|
|
||||||
|
&-icon {
|
||||||
|
font-size: 1.5rem !important;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// "Open player" affordance shown over the art on hover
|
||||||
|
&-expand {
|
||||||
|
z-index: 2;
|
||||||
|
inset: 0;
|
||||||
|
transform: none;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: rgb(0 0 0 / 0.5);
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.15s ease;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&-track {
|
|
||||||
grid-template-columns: $image-size 60% 0.5fr 0.5fr !important;
|
// Transport on top, compact seek row underneath
|
||||||
}
|
&-center {
|
||||||
&-playlist{
|
|
||||||
background: $clr-background-dark !important;
|
|
||||||
border: 1.2px solid rgb(255 255 255 / 0.2);
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1em;
|
align-items: center;
|
||||||
// Magic scrollbar
|
gap: 2px;
|
||||||
&::-webkit-scrollbar {
|
min-width: 0;
|
||||||
&-thumb {
|
|
||||||
height: 150px;
|
.player-controls {
|
||||||
max-height: 33%;
|
gap: 0.5rem !important;
|
||||||
|
|
||||||
|
.MuiFab-root {
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
min-height: 36px;
|
||||||
|
box-shadow: none;
|
||||||
|
|
||||||
|
.material-symbols-rounded {
|
||||||
|
font-size: 1.6rem !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
&-track {
|
|
||||||
margin-top: 20px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
background: transparent !important;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-track{
|
&-progress {
|
||||||
display: grid;
|
gap: 0.6rem !important;
|
||||||
gap: 1em;
|
|
||||||
grid-template-columns: 4em 1fr 4em;
|
.MuiTypography-root {
|
||||||
cursor: pointer;
|
min-width: 2.75em !important;
|
||||||
&.active{
|
font-size: 0.7rem;
|
||||||
color: $clr-accent-default;
|
opacity: 0.6 !important;
|
||||||
}
|
}
|
||||||
&-image{
|
|
||||||
background: rgb(255 255 255 / 0.1);
|
.MuiSlider-root {
|
||||||
border: 1.2px solid rgb(255 255 255 / 0.1);
|
padding: 8px 0;
|
||||||
overflow: hidden;
|
}
|
||||||
border-radius:5px;
|
.MuiSlider-thumb {
|
||||||
width: 100%;
|
width: 10px;
|
||||||
aspect-ratio: 1;
|
height: 10px;
|
||||||
height: 4em;
|
opacity: 0;
|
||||||
|
transition: opacity 0.15s ease;
|
||||||
|
}
|
||||||
|
&:hover .MuiSlider-thumb,
|
||||||
|
.MuiSlider-root.Mui-active .MuiSlider-thumb {
|
||||||
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 0.25rem;
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
|
.MuiIconButton-root {
|
||||||
|
color: rgb(255 255 255 / 0.75);
|
||||||
|
&:hover {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-volume {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
|
// Secondary control: neutral and compact
|
||||||
|
.MuiSlider-root {
|
||||||
|
width: 5.5rem !important;
|
||||||
|
color: rgb(255 255 255 / 0.85);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.audio-player-volume,
|
||||||
|
.audio-player-progress .MuiTypography-root {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
grid-template-columns: minmax(0, 1fr) auto auto;
|
||||||
|
gap: 0.5rem;
|
||||||
|
bottom: 0.5rem;
|
||||||
|
width: calc(100% - 1rem);
|
||||||
|
height: 64px;
|
||||||
|
|
||||||
|
.audio-player-center .player-controls > :not(:has(.MuiFab-root)),
|
||||||
|
.audio-player-progress {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.audio-player-actions > :not(:last-child) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,20 +2,15 @@ import type { Api } from "@jellyfin/sdk";
|
|||||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { getLyricApi } from "@jellyfin/sdk/lib/utils/api/lyric-api";
|
import { getLyricApi } from "@jellyfin/sdk/lib/utils/api/lyric-api";
|
||||||
import { Typography } from "@mui/material";
|
import { Typography } from "@mui/material";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { queryOptions, useQuery } from "@tanstack/react-query";
|
||||||
import React, { useEffect, useRef, useState } from "react";
|
import React, { useEffect, useRef } from "react";
|
||||||
import { secToTicks } from "@/utils/date/time";
|
import { secToTicks } from "@/utils/date/time";
|
||||||
|
|
||||||
interface LyricsPanelProps {
|
export const getLyricsQueryOptions = (
|
||||||
item: BaseItemDto | undefined | null;
|
item: BaseItemDto | undefined | null,
|
||||||
api: Api | undefined;
|
api: Api | undefined,
|
||||||
currentTime: number;
|
) =>
|
||||||
}
|
queryOptions({
|
||||||
|
|
||||||
const LyricsPanel = ({ item, api, currentTime }: LyricsPanelProps) => {
|
|
||||||
const lyricsContainer = useRef<HTMLDivElement | null>(null);
|
|
||||||
|
|
||||||
const lyrics = useQuery({
|
|
||||||
queryKey: ["player", "audio", item?.Id, "lyrics"],
|
queryKey: ["player", "audio", item?.Id, "lyrics"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
if (!item?.Id || !api) {
|
if (!item?.Id || !api) {
|
||||||
@@ -23,17 +18,30 @@ const LyricsPanel = ({ item, api, currentTime }: LyricsPanelProps) => {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const response = await getLyricApi(api).getLyrics({
|
const response = await getLyricApi(api).getLyrics({
|
||||||
itemId: item?.Id,
|
itemId: item.Id,
|
||||||
});
|
});
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (e) {
|
} catch {
|
||||||
console.error("Failed to fetch lyrics", e);
|
// Items without lyrics return 404
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
enabled: Boolean(item?.Id) && Boolean(api),
|
enabled: Boolean(item?.Id) && Boolean(api),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
interface LyricsPanelProps {
|
||||||
|
item: BaseItemDto | undefined | null;
|
||||||
|
api: Api | undefined;
|
||||||
|
currentTime: number;
|
||||||
|
/** Seeks playback to a position in ticks; enables clicking synced lines. */
|
||||||
|
onSeek?: (ticks: number) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const LyricsPanel = ({ item, api, currentTime, onSeek }: LyricsPanelProps) => {
|
||||||
|
const lyricsContainer = useRef<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
|
const lyrics = useQuery(getLyricsQueryOptions(item, api));
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (lyrics.data && lyricsContainer.current) {
|
if (lyrics.data && lyricsContainer.current) {
|
||||||
const currentLyric = lyricsContainer.current.querySelector(
|
const currentLyric = lyricsContainer.current.querySelector(
|
||||||
@@ -78,6 +86,11 @@ const LyricsPanel = ({ item, api, currentTime }: LyricsPanelProps) => {
|
|||||||
(lyrics.data?.Lyrics?.[index + 1]?.Start ??
|
(lyrics.data?.Lyrics?.[index + 1]?.Start ??
|
||||||
Number.POSITIVE_INFINITY);
|
Number.POSITIVE_INFINITY);
|
||||||
|
|
||||||
|
const canSeek = hasSyncedLyrics && onSeek && lyric.Start != null;
|
||||||
|
const seek = () => {
|
||||||
|
if (canSeek) onSeek(lyric.Start ?? 0);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Typography
|
<Typography
|
||||||
variant="body1"
|
variant="body1"
|
||||||
@@ -85,6 +98,18 @@ const LyricsPanel = ({ item, api, currentTime }: LyricsPanelProps) => {
|
|||||||
className={`audio-lyrics-line ${isActive ? "active" : ""}`}
|
className={`audio-lyrics-line ${isActive ? "active" : ""}`}
|
||||||
key={`${lyric.Text}-${index}`}
|
key={`${lyric.Text}-${index}`}
|
||||||
data-active-lyric={isActive}
|
data-active-lyric={isActive}
|
||||||
|
{...(canSeek && {
|
||||||
|
role: "button",
|
||||||
|
tabIndex: 0,
|
||||||
|
"data-seekable": true,
|
||||||
|
onClick: seek,
|
||||||
|
onKeyDown: (e: React.KeyboardEvent) => {
|
||||||
|
if (e.key === "Enter" || e.key === " ") {
|
||||||
|
e.preventDefault();
|
||||||
|
seek();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})}
|
||||||
>
|
>
|
||||||
{lyric.Text}
|
{lyric.Text}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|||||||
@@ -1,35 +1,31 @@
|
|||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import type { ReactNode } from "react";
|
import Tooltip from "@mui/material/Tooltip";
|
||||||
import React from "react";
|
import React, { type ReactNode } from "react";
|
||||||
import QueueButton from "@/components/buttons/queueButton";
|
import QueueButton from "@/components/buttons/queueButton";
|
||||||
|
|
||||||
interface PlayerActionsProps {
|
interface PlayerActionsProps {
|
||||||
onNavigate: () => void;
|
/** Opens the full-screen player. */
|
||||||
|
onExpand: () => void;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
|
/** Volume control, rendered between the queue and expand buttons. */
|
||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PlayerActions = ({
|
const PlayerActions = ({ onExpand, onClose, children }: PlayerActionsProps) => {
|
||||||
onNavigate,
|
|
||||||
onClose,
|
|
||||||
children,
|
|
||||||
}: PlayerActionsProps) => {
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div className="audio-player-actions">
|
||||||
style={{
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "flex-end",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<IconButton onClick={onNavigate}>
|
|
||||||
<span className="material-symbols-rounded">info</span>
|
|
||||||
</IconButton>
|
|
||||||
<QueueButton />
|
<QueueButton />
|
||||||
{children}
|
<div className="audio-player-volume">{children}</div>
|
||||||
<IconButton onClick={onClose}>
|
<Tooltip title="Open player">
|
||||||
<div className="material-symbols-rounded">close</div>
|
<IconButton onClick={onExpand} aria-label="Open player">
|
||||||
|
<span className="material-symbols-rounded">open_in_full</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
<Tooltip title="Stop and close">
|
||||||
|
<IconButton onClick={onClose} aria-label="Stop and close">
|
||||||
|
<span className="material-symbols-rounded">close</span>
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,7 +20,10 @@ const PlayerControls = ({
|
|||||||
onForward,
|
onForward,
|
||||||
}: PlayerControlsProps) => {
|
}: PlayerControlsProps) => {
|
||||||
return (
|
return (
|
||||||
<div style={{ display: "flex", gap: "1em", alignItems: "center" }}>
|
<div
|
||||||
|
className="player-controls"
|
||||||
|
style={{ display: "flex", gap: "1em", alignItems: "center" }}
|
||||||
|
>
|
||||||
<PlayPreviousButton />
|
<PlayPreviousButton />
|
||||||
{onRewind && (
|
{onRewind && (
|
||||||
<IconButton onClick={onRewind}>
|
<IconButton onClick={onRewind}>
|
||||||
|
|||||||
@@ -1,58 +1,97 @@
|
|||||||
import type { Api } from "@jellyfin/sdk";
|
import type { Api } from "@jellyfin/sdk";
|
||||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import { Link } from "@tanstack/react-router";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import LikeButton from "@/components/buttons/likeButton";
|
||||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import { getItemQueryOptions } from "@/utils/queries/items";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
|
||||||
interface PlayerInfoProps {
|
interface PlayerInfoProps {
|
||||||
item: BaseItemDto | undefined | null;
|
item: BaseItemDto | undefined | null;
|
||||||
api: Api | undefined;
|
api: Api | undefined;
|
||||||
trackName?: string;
|
/** Opens the full-screen player. */
|
||||||
|
onOpen: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PlayerInfo = ({ item, api, trackName }: PlayerInfoProps) => {
|
const PlayerInfo = ({ item, api, onOpen }: PlayerInfoProps) => {
|
||||||
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
|
// Fresh user data so the like button reflects changes immediately.
|
||||||
|
const itemDetails = useQuery({
|
||||||
|
...getItemQueryOptions(item?.Id ?? "", api, user?.Id),
|
||||||
|
enabled: Boolean(item?.Id && api && user?.Id),
|
||||||
|
});
|
||||||
|
|
||||||
if (!api || !item) return null;
|
if (!api || !item) return null;
|
||||||
|
|
||||||
|
const artists = item.ArtistItems?.length
|
||||||
|
? item.ArtistItems
|
||||||
|
: (item.AlbumArtists ?? []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="audio-player-info">
|
<div className="audio-player-info">
|
||||||
<div className="audio-player-image-container">
|
<button
|
||||||
<img
|
type="button"
|
||||||
alt={trackName ?? "track"}
|
className="audio-player-image-container"
|
||||||
className="audio-player-image"
|
onClick={onOpen}
|
||||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
aria-label="Open player"
|
||||||
(!item?.ImageTags?.Primary ? item?.AlbumId : item.Id) ?? "",
|
>
|
||||||
"Primary",
|
|
||||||
{
|
|
||||||
quality: 85,
|
|
||||||
fillHeight: 462,
|
|
||||||
fillWidth: 462,
|
|
||||||
},
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<span className="material-symbols-rounded audio-player-image-icon">
|
<span className="material-symbols-rounded audio-player-image-icon">
|
||||||
music_note
|
music_note
|
||||||
</span>
|
</span>
|
||||||
</div>
|
<img
|
||||||
|
alt=""
|
||||||
|
className="audio-player-image"
|
||||||
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
(!item.ImageTags?.Primary ? item.AlbumId : item.Id) ?? "",
|
||||||
|
"Primary",
|
||||||
|
{ quality: 85, fillHeight: 120, fillWidth: 120 },
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<span className="material-symbols-rounded audio-player-image-expand">
|
||||||
|
expand_less
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
<div className="audio-player-info-text">
|
<div className="audio-player-info-text">
|
||||||
<Typography
|
<Typography
|
||||||
variant="subtitle2"
|
variant="subtitle2"
|
||||||
style={{
|
component="button"
|
||||||
width: "100%",
|
className="audio-player-info-title"
|
||||||
}}
|
title={item.Name ?? undefined}
|
||||||
noWrap
|
onClick={onOpen}
|
||||||
>
|
>
|
||||||
{item?.Name}
|
{item.Name}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
variant="caption"
|
variant="caption"
|
||||||
style={{
|
|
||||||
opacity: 0.5,
|
|
||||||
}}
|
|
||||||
noWrap
|
noWrap
|
||||||
|
className="audio-player-info-artist"
|
||||||
>
|
>
|
||||||
by {item?.Artists?.map((artist) => artist).join(",")}
|
{artists.map((artist, index) => (
|
||||||
|
<React.Fragment key={artist.Id ?? artist.Name}>
|
||||||
|
{index > 0 && ", "}
|
||||||
|
{artist.Id ? (
|
||||||
|
<Link to="/music/artist/$id" params={{ id: artist.Id }}>
|
||||||
|
{artist.Name}
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
artist.Name
|
||||||
|
)}
|
||||||
|
</React.Fragment>
|
||||||
|
))}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
|
<LikeButton
|
||||||
|
itemId={item.Id ?? undefined}
|
||||||
|
itemName={item.Name}
|
||||||
|
isFavorite={
|
||||||
|
itemDetails.data?.UserData?.IsFavorite ?? item.UserData?.IsFavorite
|
||||||
|
}
|
||||||
|
queryKey={["item", item.Id ?? ""]}
|
||||||
|
userId={user?.Id}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,6 +8,12 @@ interface PlayerProgressProps {
|
|||||||
duration: number;
|
duration: number;
|
||||||
onSeek?: (value: number) => void;
|
onSeek?: (value: number) => void;
|
||||||
onSeekCommit: (value: number) => void;
|
onSeekCommit: (value: number) => void;
|
||||||
|
/**
|
||||||
|
* "inline" puts the times beside the bar, "stacked" puts them underneath,
|
||||||
|
* "bare" renders only the slider.
|
||||||
|
*/
|
||||||
|
layout?: "inline" | "stacked" | "bare";
|
||||||
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PlayerProgress = ({
|
const PlayerProgress = ({
|
||||||
@@ -15,6 +21,8 @@ const PlayerProgress = ({
|
|||||||
duration,
|
duration,
|
||||||
onSeek,
|
onSeek,
|
||||||
onSeekCommit,
|
onSeekCommit,
|
||||||
|
layout = "inline",
|
||||||
|
className,
|
||||||
}: PlayerProgressProps) => {
|
}: PlayerProgressProps) => {
|
||||||
const [isScrubbing, setIsScrubbing] = useState(false);
|
const [isScrubbing, setIsScrubbing] = useState(false);
|
||||||
const [sliderValue, setSliderValue] = useState(progress);
|
const [sliderValue, setSliderValue] = useState(progress);
|
||||||
@@ -38,8 +46,44 @@ const PlayerProgress = ({
|
|||||||
onSeekCommit(newValue);
|
onSeekCommit(newValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (layout === "bare") {
|
||||||
|
return (
|
||||||
|
<Slider
|
||||||
|
className={className}
|
||||||
|
value={sliderValue}
|
||||||
|
step={1}
|
||||||
|
size="small"
|
||||||
|
max={duration}
|
||||||
|
onChange={handleChange}
|
||||||
|
onChangeCommitted={handleChangeCommitted}
|
||||||
|
aria-label="Seek"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (layout === "stacked") {
|
||||||
|
return (
|
||||||
|
<div className="player-progress-stacked">
|
||||||
|
<Slider
|
||||||
|
value={sliderValue}
|
||||||
|
step={1}
|
||||||
|
size="small"
|
||||||
|
max={duration}
|
||||||
|
onChange={handleChange}
|
||||||
|
onChangeCommitted={handleChangeCommitted}
|
||||||
|
aria-label="Seek"
|
||||||
|
/>
|
||||||
|
<div className="player-progress-stacked-times">
|
||||||
|
<span>{getRuntimeMusic(sliderValue)}</span>
|
||||||
|
<span>-{getRuntimeMusic(Math.max(duration - sliderValue, 0))}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
className={className}
|
||||||
style={{
|
style={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
|||||||
@@ -45,20 +45,25 @@ const PlayerVolume = ({
|
|||||||
ml: 1,
|
ml: 1,
|
||||||
width: "10em",
|
width: "10em",
|
||||||
"& .MuiSlider-valueLabel": {
|
"& .MuiSlider-valueLabel": {
|
||||||
|
// Compact pill hugging the thumb; above the play FAB (zIndex.fab)
|
||||||
|
zIndex: (theme) => theme.zIndex.tooltip,
|
||||||
lineHeight: 1.2,
|
lineHeight: 1.2,
|
||||||
fontSize: 24,
|
fontSize: "0.75rem",
|
||||||
background: "rgb(0 0 0 / 0.5)",
|
fontWeight: 600,
|
||||||
backdropFilter: "blur(5px)",
|
fontVariantNumeric: "tabular-nums",
|
||||||
padding: 1,
|
minWidth: "2.25em",
|
||||||
borderRadius: "10px",
|
background: "rgb(0 0 0 / 0.75)",
|
||||||
|
padding: "2px 6px",
|
||||||
|
borderRadius: "6px",
|
||||||
border: "1px solid rgb(255 255 255 / 0.15)",
|
border: "1px solid rgb(255 255 255 / 0.15)",
|
||||||
boxShadow: "0 0 10px rgb(0 0 0 / 0.4) ",
|
boxShadow: "0 2px 8px rgb(0 0 0 / 0.4)",
|
||||||
transform: "translatey(-120%) scale(0)",
|
top: -6,
|
||||||
|
transform: "translatey(-100%) scale(0)",
|
||||||
"&:before": {
|
"&:before": {
|
||||||
display: "none",
|
display: "none",
|
||||||
},
|
},
|
||||||
"&.MuiSlider-valueLabelOpen": {
|
"&.MuiSlider-valueLabelOpen": {
|
||||||
transform: "translateY(-120%) scale(1)",
|
transform: "translateY(-100%) scale(1)",
|
||||||
},
|
},
|
||||||
"& > *": {
|
"& > *": {
|
||||||
transform: "rotate(0deg)",
|
transform: "rotate(0deg)",
|
||||||
|
|||||||
@@ -1,302 +0,0 @@
|
|||||||
import {
|
|
||||||
closestCenter,
|
|
||||||
DndContext,
|
|
||||||
type DragEndEvent,
|
|
||||||
DragOverlay,
|
|
||||||
type DragStartEvent,
|
|
||||||
type DropAnimation,
|
|
||||||
defaultDropAnimationSideEffects,
|
|
||||||
KeyboardSensor,
|
|
||||||
PointerSensor,
|
|
||||||
useSensor,
|
|
||||||
useSensors,
|
|
||||||
} from "@dnd-kit/core";
|
|
||||||
import {
|
|
||||||
restrictToVerticalAxis,
|
|
||||||
restrictToWindowEdges,
|
|
||||||
} from "@dnd-kit/modifiers";
|
|
||||||
import {
|
|
||||||
arrayMove,
|
|
||||||
SortableContext,
|
|
||||||
sortableKeyboardCoordinates,
|
|
||||||
useSortable,
|
|
||||||
verticalListSortingStrategy,
|
|
||||||
} from "@dnd-kit/sortable";
|
|
||||||
import { CSS } from "@dnd-kit/utilities";
|
|
||||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
|
||||||
import {
|
|
||||||
Box,
|
|
||||||
IconButton,
|
|
||||||
Menu,
|
|
||||||
MenuItem,
|
|
||||||
Tooltip,
|
|
||||||
Typography,
|
|
||||||
} from "@mui/material";
|
|
||||||
import React, { useMemo, useState } from "react";
|
|
||||||
import QueueListItem from "@/components/queueListItem";
|
|
||||||
import { stopPlayback } from "@/utils/store/audioPlayback";
|
|
||||||
import useQueue, {
|
|
||||||
clearQueue,
|
|
||||||
removeFromQueue,
|
|
||||||
setQueue,
|
|
||||||
shuffleUpcoming,
|
|
||||||
} from "@/utils/store/queue";
|
|
||||||
|
|
||||||
interface QueuePanelProps {
|
|
||||||
queue: BaseItemDto[];
|
|
||||||
currentTrackIndex: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
const dropAnimation: DropAnimation = {
|
|
||||||
sideEffects: defaultDropAnimationSideEffects({
|
|
||||||
styles: {
|
|
||||||
active: {
|
|
||||||
opacity: "0.5",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
|
|
||||||
function SortableQueueItem({
|
|
||||||
item,
|
|
||||||
onDelete,
|
|
||||||
index,
|
|
||||||
isActive,
|
|
||||||
}: {
|
|
||||||
item: BaseItemDto;
|
|
||||||
onDelete: () => void;
|
|
||||||
index: number;
|
|
||||||
isActive: boolean;
|
|
||||||
}) {
|
|
||||||
const {
|
|
||||||
attributes,
|
|
||||||
listeners,
|
|
||||||
setNodeRef,
|
|
||||||
transform,
|
|
||||||
transition,
|
|
||||||
isDragging,
|
|
||||||
} = useSortable({ id: item.Id || "" });
|
|
||||||
|
|
||||||
const style = {
|
|
||||||
transform: CSS.Translate.toString(transform),
|
|
||||||
transition,
|
|
||||||
opacity: isDragging ? 0.3 : 1,
|
|
||||||
position: "relative" as const,
|
|
||||||
zIndex: isDragging ? 999 : "auto",
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div ref={setNodeRef} style={style} className="sortable-queue-item">
|
|
||||||
<QueueListItem
|
|
||||||
queueItem={item}
|
|
||||||
onDelete={onDelete}
|
|
||||||
dragHandleProps={{ ...attributes, ...listeners }}
|
|
||||||
isEpisode={item.Type === "Episode"}
|
|
||||||
index={index}
|
|
||||||
className={isActive ? "active" : ""}
|
|
||||||
sx={{
|
|
||||||
bgcolor: isActive
|
|
||||||
? "rgba(255, 255, 255, 0.1) !important"
|
|
||||||
: "transparent",
|
|
||||||
borderRadius: 2,
|
|
||||||
mb: 1,
|
|
||||||
transition: "background-color 0.2s",
|
|
||||||
"&:hover": {
|
|
||||||
bgcolor: "rgba(255, 255, 255, 0.05)",
|
|
||||||
},
|
|
||||||
".MuiListItemText-primary": {
|
|
||||||
color: isActive ? "var(--primary-color, #90caf9)" : "inherit",
|
|
||||||
fontWeight: isActive ? 600 : 500,
|
|
||||||
fontSize: "1rem",
|
|
||||||
},
|
|
||||||
".MuiListItemText-secondary": {
|
|
||||||
fontSize: "0.85rem",
|
|
||||||
opacity: 0.7,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const QueuePanel = ({ queue, currentTrackIndex }: QueuePanelProps) => {
|
|
||||||
const [activeId, setActiveId] = useState<string | null>(null);
|
|
||||||
|
|
||||||
const sensors = useSensors(
|
|
||||||
useSensor(PointerSensor, {
|
|
||||||
activationConstraint: {
|
|
||||||
distance: 8,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
useSensor(KeyboardSensor, {
|
|
||||||
coordinateGetter: sortableKeyboardCoordinates,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
const activeItem = useMemo(
|
|
||||||
() => queue.find((item) => item.Id === activeId),
|
|
||||||
[queue, activeId],
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleDragStart = (event: DragStartEvent) => {
|
|
||||||
setActiveId(String(event.active.id));
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDragEnd = (event: DragEndEvent) => {
|
|
||||||
const { active, over } = event;
|
|
||||||
setActiveId(null);
|
|
||||||
|
|
||||||
if (active.id !== over?.id) {
|
|
||||||
const oldIndex = queue.map((item) => item.Id).indexOf(String(active.id));
|
|
||||||
const newIndex = queue.map((item) => item.Id).indexOf(String(over?.id));
|
|
||||||
|
|
||||||
if (oldIndex !== -1 && newIndex !== -1) {
|
|
||||||
const newQueue = arrayMove(queue, oldIndex, newIndex);
|
|
||||||
const currentTrackId = queue[currentTrackIndex]?.Id;
|
|
||||||
const newCurrentTrackIndex = newQueue.findIndex(
|
|
||||||
(item) => item.Id === currentTrackId,
|
|
||||||
);
|
|
||||||
|
|
||||||
setQueue(
|
|
||||||
newQueue,
|
|
||||||
newCurrentTrackIndex !== -1 ? newCurrentTrackIndex : 0,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
||||||
const open = Boolean(anchorEl);
|
|
||||||
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
||||||
setAnchorEl(event.currentTarget);
|
|
||||||
};
|
|
||||||
const handleClose = () => {
|
|
||||||
setAnchorEl(null);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleClearQueue = () => {
|
|
||||||
stopPlayback();
|
|
||||||
clearQueue();
|
|
||||||
handleClose();
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<DndContext
|
|
||||||
sensors={sensors}
|
|
||||||
collisionDetection={closestCenter}
|
|
||||||
onDragStart={handleDragStart}
|
|
||||||
onDragEnd={handleDragEnd}
|
|
||||||
modifiers={[restrictToVerticalAxis, restrictToWindowEdges]}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="audio-queue-container"
|
|
||||||
style={{
|
|
||||||
width: "100%",
|
|
||||||
height: "100%",
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
justifyContent: "space-between",
|
|
||||||
alignItems: "center",
|
|
||||||
mb: 2,
|
|
||||||
px: 1,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Typography
|
|
||||||
variant="h6"
|
|
||||||
sx={{
|
|
||||||
fontWeight: 700,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Queue
|
|
||||||
</Typography>
|
|
||||||
<Box sx={{ display: "flex", gap: 1 }}>
|
|
||||||
<Tooltip title="Shuffle Upcoming">
|
|
||||||
<IconButton onClick={() => shuffleUpcoming()} size="small">
|
|
||||||
<span className="material-symbols-rounded">shuffle</span>
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
<IconButton onClick={handleClick} size="small">
|
|
||||||
<span className="material-symbols-rounded">more_vert</span>
|
|
||||||
</IconButton>
|
|
||||||
</Box>
|
|
||||||
<Menu
|
|
||||||
anchorEl={anchorEl}
|
|
||||||
open={open}
|
|
||||||
onClose={handleClose}
|
|
||||||
transformOrigin={{ horizontal: "right", vertical: "top" }}
|
|
||||||
anchorOrigin={{ horizontal: "right", vertical: "bottom" }}
|
|
||||||
>
|
|
||||||
<MenuItem onClick={handleClearQueue}>
|
|
||||||
<span
|
|
||||||
className="material-symbols-rounded"
|
|
||||||
style={{ marginRight: "0.5em", fontSize: "1.2em" }}
|
|
||||||
>
|
|
||||||
clear_all
|
|
||||||
</span>
|
|
||||||
Clear Queue
|
|
||||||
</MenuItem>
|
|
||||||
</Menu>
|
|
||||||
</Box>
|
|
||||||
|
|
||||||
<SortableContext
|
|
||||||
items={queue.map((track) => track.Id ?? "")}
|
|
||||||
strategy={verticalListSortingStrategy}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="audio-queue"
|
|
||||||
style={{ display: "flex", flexDirection: "column", gap: "0px" }}
|
|
||||||
>
|
|
||||||
{queue.map((track, index) => (
|
|
||||||
<SortableQueueItem
|
|
||||||
key={track.Id}
|
|
||||||
item={track}
|
|
||||||
index={index}
|
|
||||||
onDelete={() => removeFromQueue(index)}
|
|
||||||
isActive={currentTrackIndex === index}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</SortableContext>
|
|
||||||
|
|
||||||
<DragOverlay
|
|
||||||
dropAnimation={dropAnimation}
|
|
||||||
style={{
|
|
||||||
left: "1.5rem",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{activeItem ? (
|
|
||||||
<QueueListItem
|
|
||||||
queueItem={activeItem}
|
|
||||||
isEpisode={activeItem.Type === "Episode"}
|
|
||||||
dragHandleProps={{}} // Pass empty object to render handle
|
|
||||||
onDelete={() => {}} // Pass empty function to render delete button space
|
|
||||||
sx={{
|
|
||||||
bgcolor: "rgba(40, 40, 40, 0.9)",
|
|
||||||
backdropFilter: "blur(10px)",
|
|
||||||
borderRadius: 2,
|
|
||||||
boxShadow: "0 8px 32px rgba(0,0,0,0.5)",
|
|
||||||
outline: "1px solid rgba(255, 255, 255, 0.1)",
|
|
||||||
mb: 1,
|
|
||||||
".MuiListItemText-primary": {
|
|
||||||
fontWeight: 500,
|
|
||||||
fontSize: "1rem",
|
|
||||||
},
|
|
||||||
".MuiListItemText-secondary": {
|
|
||||||
fontSize: "0.85rem",
|
|
||||||
opacity: 0.7,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
</DragOverlay>
|
|
||||||
</div>
|
|
||||||
</DndContext>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default React.memo(QueuePanel);
|
|
||||||
@@ -4,7 +4,7 @@ import React, { useEffect, useState } from "react";
|
|||||||
|
|
||||||
interface StatsPanelProps {
|
interface StatsPanelProps {
|
||||||
item: BaseItemDto | undefined | null;
|
item: BaseItemDto | undefined | null;
|
||||||
audioRef: React.RefObject<HTMLAudioElement> | null;
|
audioRef: React.RefObject<HTMLAudioElement | null> | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const StatRow = ({
|
const StatRow = ({
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
} 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 { playItemFromQueue } from "@/utils/store/playback";
|
||||||
import useQueue from "@/utils/store/queue";
|
import useQueue, { getNextTrackIndex } from "@/utils/store/queue";
|
||||||
import PlayerActions from "./components/PlayerActions";
|
import PlayerActions from "./components/PlayerActions";
|
||||||
import PlayerControls from "./components/PlayerControls";
|
import PlayerControls from "./components/PlayerControls";
|
||||||
import PlayerInfo from "./components/PlayerInfo";
|
import PlayerInfo from "./components/PlayerInfo";
|
||||||
@@ -104,8 +104,9 @@ const AudioPlayer = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
navigator.mediaSession.setActionHandler("nexttrack", () => {
|
navigator.mediaSession.setActionHandler("nexttrack", () => {
|
||||||
if (user?.Id && api) {
|
const nextIndex = getNextTrackIndex();
|
||||||
playItemFromQueue("next", user.Id, api);
|
if (nextIndex !== undefined && user?.Id && api) {
|
||||||
|
playItemFromQueue(nextIndex, user.Id, api);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
navigator.mediaSession.setActionHandler("seekto", (details) => {
|
navigator.mediaSession.setActionHandler("seekto", (details) => {
|
||||||
@@ -151,9 +152,15 @@ const AudioPlayer = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleEnded = () => {
|
const handleEnded = () => {
|
||||||
|
if (useQueue.getState().repeatMode === "one" && audioRef.current) {
|
||||||
|
audioRef.current.currentTime = 0;
|
||||||
|
audioRef.current.play();
|
||||||
|
return;
|
||||||
|
}
|
||||||
setPlaying(false);
|
setPlaying(false);
|
||||||
if (tracks?.[currentTrack + 1]?.Id && api && user?.Id) {
|
const nextIndex = getNextTrackIndex();
|
||||||
playItemFromQueue("next", user.Id, api);
|
if (nextIndex !== undefined && api && user?.Id) {
|
||||||
|
playItemFromQueue(nextIndex, user.Id, api);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -210,13 +217,9 @@ const AudioPlayer = () => {
|
|||||||
}}
|
}}
|
||||||
exit={{ transform: "translate(-50%, 150%)" }}
|
exit={{ transform: "translate(-50%, 150%)" }}
|
||||||
transition={{ duration: 0.3, ease: "circOut" }}
|
transition={{ duration: 0.3, ease: "circOut" }}
|
||||||
className="audio-player glass"
|
className="audio-player"
|
||||||
>
|
>
|
||||||
<PlayerInfo
|
<PlayerInfo item={item} api={api} onOpen={handleNavigate} />
|
||||||
item={item}
|
|
||||||
api={api}
|
|
||||||
trackName={tracks?.[currentTrack]?.Name ?? "Unknown Track"}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<audio
|
<audio
|
||||||
autoPlay
|
autoPlay
|
||||||
@@ -232,16 +235,17 @@ const AudioPlayer = () => {
|
|||||||
id="audio-player"
|
id="audio-player"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="audio-player-controls">
|
<div className="audio-player-center">
|
||||||
<PlayerControls playing={playing} onPlayPause={handlePlayPause} />
|
<PlayerControls playing={playing} onPlayPause={handlePlayPause} />
|
||||||
<PlayerProgress
|
<PlayerProgress
|
||||||
|
className="audio-player-progress"
|
||||||
progress={progress}
|
progress={progress}
|
||||||
duration={item?.RunTimeTicks ?? 1}
|
duration={item?.RunTimeTicks ?? 1}
|
||||||
onSeekCommit={handleSeekCommit}
|
onSeekCommit={handleSeekCommit}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<PlayerActions onNavigate={handleNavigate} onClose={handleClose}>
|
<PlayerActions onExpand={handleNavigate} onClose={handleClose}>
|
||||||
<PlayerVolume
|
<PlayerVolume
|
||||||
volume={volume}
|
volume={volume}
|
||||||
isMuted={isMuted}
|
isMuted={isMuted}
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ const BubbleSlider = () => {
|
|||||||
const backgroundOffsetY = -(imageOffsetY * trickplayResolution?.Height);
|
const backgroundOffsetY = -(imageOffsetY * trickplayResolution?.Height);
|
||||||
|
|
||||||
const imgUrlParamsObject: Record<string, string> = {
|
const imgUrlParamsObject: Record<string, string> = {
|
||||||
api_key: String(api?.accessToken),
|
ApiKey: String(api?.accessToken),
|
||||||
MediaSourceId: mediaSource.id ?? "",
|
MediaSourceId: mediaSource.id ?? "",
|
||||||
};
|
};
|
||||||
const imgUrlParams = new URLSearchParams(imgUrlParamsObject).toString();
|
const imgUrlParams = new URLSearchParams(imgUrlParamsObject).toString();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
MenuItem,
|
MenuItem,
|
||||||
|
MenuList,
|
||||||
Popover,
|
Popover,
|
||||||
Switch,
|
Switch,
|
||||||
TextField,
|
TextField,
|
||||||
@@ -144,6 +145,7 @@ const VideoPlayerSettingsMenu = ({
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
))}
|
))}
|
||||||
</TextField>
|
</TextField>
|
||||||
|
<MenuList disablePadding>
|
||||||
<MenuItem onClick={toggleShowStatsForNerds}>
|
<MenuItem onClick={toggleShowStatsForNerds}>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
@@ -154,6 +156,7 @@ const VideoPlayerSettingsMenu = ({
|
|||||||
</Typography>
|
</Typography>
|
||||||
<Switch checked={showStatsForNerds} />
|
<Switch checked={showStatsForNerds} />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
</MenuList>
|
||||||
</Popover>
|
</Popover>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,325 @@
|
|||||||
|
.queue {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 0;
|
||||||
|
height: 100%;
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
&-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 1rem;
|
||||||
|
padding-bottom: 0.75rem;
|
||||||
|
|
||||||
|
&-text {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.125rem;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
.MuiIconButton-root {
|
||||||
|
color: rgb(255 255 255 / 0.75);
|
||||||
|
&:hover {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-title {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-summary {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-body {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1.25rem;
|
||||||
|
// Room so focus rings and the dragged row aren't clipped
|
||||||
|
padding: 2px 2px 1rem;
|
||||||
|
margin: 0 -2px;
|
||||||
|
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
width: 6px;
|
||||||
|
}
|
||||||
|
&::-webkit-scrollbar-thumb {
|
||||||
|
background: rgb(255 255 255 / 0.2);
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-section {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.5rem;
|
||||||
|
|
||||||
|
&-label {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.7rem;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.08em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
opacity: 0.55;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-toggle {
|
||||||
|
all: unset;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0.25rem 0.5rem;
|
||||||
|
margin: 0 -0.5rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus-visible {
|
||||||
|
background: rgb(255 255 255 / 0.05);
|
||||||
|
}
|
||||||
|
.material-symbols-rounded {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-hint {
|
||||||
|
margin: 0.25rem 0 0;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
opacity: 0.4;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-empty {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.25rem;
|
||||||
|
padding: 2rem 1rem;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px dashed rgb(255 255 255 / 0.12);
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
|
||||||
|
&-icon {
|
||||||
|
font-size: 2.25rem;
|
||||||
|
opacity: 0.4;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
&-title {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
&-text {
|
||||||
|
font-size: 0.85rem;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.queue-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.75rem;
|
||||||
|
padding: 0.4rem 0.5rem;
|
||||||
|
border-radius: 0.6rem;
|
||||||
|
outline: none;
|
||||||
|
background: transparent;
|
||||||
|
transition: background-color 0.15s ease;
|
||||||
|
|
||||||
|
&[role="button"] {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus-visible,
|
||||||
|
&.is-dragging {
|
||||||
|
background: rgb(255 255 255 / 0.07);
|
||||||
|
}
|
||||||
|
&:focus-visible {
|
||||||
|
box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.4);
|
||||||
|
}
|
||||||
|
&.is-dragging {
|
||||||
|
box-shadow: 0 8px 24px rgb(0 0 0 / 0.45);
|
||||||
|
background: rgb(40 40 50 / 0.95);
|
||||||
|
}
|
||||||
|
|
||||||
|
&-current {
|
||||||
|
background: rgb(255 255 255 / 0.08);
|
||||||
|
|
||||||
|
.queue-row-title {
|
||||||
|
color: $clr-accent-default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-history {
|
||||||
|
opacity: 0.6;
|
||||||
|
&:hover,
|
||||||
|
&:focus-visible {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-handle {
|
||||||
|
all: unset;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 1.25rem;
|
||||||
|
margin-right: -0.25rem;
|
||||||
|
cursor: grab;
|
||||||
|
touch-action: none;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.15s ease;
|
||||||
|
|
||||||
|
.material-symbols-rounded {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
&:active {
|
||||||
|
cursor: grabbing;
|
||||||
|
}
|
||||||
|
&:focus-visible {
|
||||||
|
opacity: 1;
|
||||||
|
outline: 2px solid rgb(255 255 255 / 0.4);
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-art {
|
||||||
|
position: relative;
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
|
border-radius: 6px;
|
||||||
|
overflow: hidden;
|
||||||
|
background: rgb(255 255 255 / 0.08);
|
||||||
|
|
||||||
|
img {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-fallback,
|
||||||
|
&-overlay,
|
||||||
|
&-play {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
&-fallback {
|
||||||
|
opacity: 0.4;
|
||||||
|
font-size: 1.25rem !important;
|
||||||
|
}
|
||||||
|
&-overlay,
|
||||||
|
&-play {
|
||||||
|
background: rgb(0 0 0 / 0.55);
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
&-overlay {
|
||||||
|
color: $clr-accent-default;
|
||||||
|
}
|
||||||
|
&-play {
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.15s ease;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-text {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-title {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.25;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
overflow: hidden;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-subtitle {
|
||||||
|
font-size: 0.78rem;
|
||||||
|
opacity: 0.6;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-duration {
|
||||||
|
flex-shrink: 0;
|
||||||
|
font-size: 0.78rem;
|
||||||
|
opacity: 0.55;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-remove.MuiIconButton-root {
|
||||||
|
flex-shrink: 0;
|
||||||
|
color: rgb(255 255 255 / 0.7);
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.15s ease;
|
||||||
|
|
||||||
|
.material-symbols-rounded {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reveal row controls on hover / keyboard focus; always shown on touch screens
|
||||||
|
&:hover,
|
||||||
|
&:focus-within {
|
||||||
|
.queue-row-handle,
|
||||||
|
.queue-row-remove {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
.queue-row-art-play {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (hover: none) {
|
||||||
|
.queue-row-handle,
|
||||||
|
.queue-row-remove {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Queue drawer (mini player / video player)
|
||||||
|
.queue-drawer-paper.MuiPaper-root {
|
||||||
|
width: 420px;
|
||||||
|
max-width: 100%;
|
||||||
|
padding: 1.25rem 1rem 0 1.25rem;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background: rgb(18 18 24 / 0.97);
|
||||||
|
border-left: 1px solid rgb(255 255 255 / 0.08);
|
||||||
|
background-image: none;
|
||||||
|
}
|
||||||
@@ -0,0 +1,178 @@
|
|||||||
|
import { useSortable } from "@dnd-kit/sortable";
|
||||||
|
import { CSS } from "@dnd-kit/utilities";
|
||||||
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import IconButton from "@mui/material/IconButton";
|
||||||
|
import Tooltip from "@mui/material/Tooltip";
|
||||||
|
import React from "react";
|
||||||
|
import { getRuntimeMusic } from "@/utils/date/time";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
|
||||||
|
export const getQueueItemText = (item: BaseItemDto) => {
|
||||||
|
if (item.Type === "Episode") {
|
||||||
|
const episode = item.IndexNumberEnd
|
||||||
|
? `E${item.IndexNumber}-${item.IndexNumberEnd}`
|
||||||
|
: `E${item.IndexNumber}`;
|
||||||
|
return {
|
||||||
|
title: item.Name ?? "Unknown episode",
|
||||||
|
subtitle: [item.SeriesName, `S${item.ParentIndexNumber}:${episode}`]
|
||||||
|
.filter(Boolean)
|
||||||
|
.join(" · "),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
title: item.Name ?? "Unknown track",
|
||||||
|
subtitle: item.Artists?.join(", ") || item.AlbumArtist || "",
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const useQueueItemImage = (item: BaseItemDto) => {
|
||||||
|
const api = useApiInContext((s) => s.api);
|
||||||
|
if (!api || !item.Id) return undefined;
|
||||||
|
const size = { fillWidth: 96, fillHeight: 96, quality: 85 };
|
||||||
|
if (item.ImageTags?.Primary) {
|
||||||
|
return getImageUrlsApi(api).getItemImageUrlById(item.Id, "Primary", {
|
||||||
|
...size,
|
||||||
|
tag: item.ImageTags.Primary,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
||||||
|
return getImageUrlsApi(api).getItemImageUrlById(item.AlbumId, "Primary", {
|
||||||
|
...size,
|
||||||
|
tag: item.AlbumPrimaryImageTag,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
type QueueRowProps = {
|
||||||
|
item: BaseItemDto;
|
||||||
|
variant: "current" | "upcoming" | "history";
|
||||||
|
onPlay?: () => void;
|
||||||
|
onRemove?: () => void;
|
||||||
|
/** Drag handle props from useSortable (upcoming rows only). */
|
||||||
|
dragHandle?: React.HTMLAttributes<HTMLButtonElement>;
|
||||||
|
isDragging?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const QueueRow = React.forwardRef<
|
||||||
|
HTMLDivElement,
|
||||||
|
QueueRowProps & { style?: React.CSSProperties }
|
||||||
|
>(({ item, variant, onPlay, onRemove, dragHandle, isDragging, style }, ref) => {
|
||||||
|
const imageUrl = useQueueItemImage(item);
|
||||||
|
const { title, subtitle } = getQueueItemText(item);
|
||||||
|
const isCurrent = variant === "current";
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
ref={ref}
|
||||||
|
style={style}
|
||||||
|
className={`queue-row queue-row-${variant} ${isDragging ? "is-dragging" : ""}`}
|
||||||
|
{...(onPlay && {
|
||||||
|
role: "button",
|
||||||
|
tabIndex: 0,
|
||||||
|
"aria-label": `Play ${title}`,
|
||||||
|
})}
|
||||||
|
onClick={onPlay}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.target !== e.currentTarget) return;
|
||||||
|
if (onPlay && (e.key === "Enter" || e.key === " ")) {
|
||||||
|
e.preventDefault();
|
||||||
|
onPlay();
|
||||||
|
} else if (onRemove && (e.key === "Delete" || e.key === "Backspace")) {
|
||||||
|
e.preventDefault();
|
||||||
|
onRemove();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{dragHandle && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="queue-row-handle"
|
||||||
|
aria-label={`Reorder ${title}`}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
{...dragHandle}
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded">drag_indicator</span>
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
<div className="queue-row-art">
|
||||||
|
<span className="material-symbols-rounded queue-row-art-fallback">
|
||||||
|
{item.Type === "Episode" ? "tv_gen" : "music_note"}
|
||||||
|
</span>
|
||||||
|
{imageUrl && <img src={imageUrl} alt="" loading="lazy" />}
|
||||||
|
{isCurrent && (
|
||||||
|
<span className="queue-row-art-overlay material-symbols-rounded">
|
||||||
|
graphic_eq
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
{onPlay && (
|
||||||
|
<span className="queue-row-art-play material-symbols-rounded">
|
||||||
|
play_arrow
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="queue-row-text">
|
||||||
|
<span className="queue-row-title" title={title}>
|
||||||
|
{title}
|
||||||
|
</span>
|
||||||
|
{subtitle && <span className="queue-row-subtitle">{subtitle}</span>}
|
||||||
|
</div>
|
||||||
|
<span className="queue-row-duration">
|
||||||
|
{item.RunTimeTicks ? getRuntimeMusic(item.RunTimeTicks) : ""}
|
||||||
|
</span>
|
||||||
|
{onRemove && (
|
||||||
|
<Tooltip title="Remove from queue">
|
||||||
|
<IconButton
|
||||||
|
size="small"
|
||||||
|
className="queue-row-remove"
|
||||||
|
aria-label={`Remove ${title} from queue`}
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
onRemove();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded">close</span>
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
/** An upcoming row that can be dragged to reorder. */
|
||||||
|
export const SortableQueueRow = (
|
||||||
|
props: Omit<QueueRowProps, "dragHandle" | "isDragging" | "variant">,
|
||||||
|
) => {
|
||||||
|
const {
|
||||||
|
attributes,
|
||||||
|
listeners,
|
||||||
|
setNodeRef,
|
||||||
|
setActivatorNodeRef,
|
||||||
|
transform,
|
||||||
|
transition,
|
||||||
|
isDragging,
|
||||||
|
} = useSortable({ id: props.item.Id ?? "" });
|
||||||
|
|
||||||
|
return (
|
||||||
|
<QueueRow
|
||||||
|
{...props}
|
||||||
|
ref={setNodeRef}
|
||||||
|
variant="upcoming"
|
||||||
|
isDragging={isDragging}
|
||||||
|
style={{
|
||||||
|
transform: CSS.Translate.toString(transform),
|
||||||
|
transition,
|
||||||
|
zIndex: isDragging ? 2 : undefined,
|
||||||
|
position: "relative",
|
||||||
|
}}
|
||||||
|
dragHandle={
|
||||||
|
{
|
||||||
|
...attributes,
|
||||||
|
...listeners,
|
||||||
|
ref: setActivatorNodeRef,
|
||||||
|
} as React.HTMLAttributes<HTMLButtonElement>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,273 @@
|
|||||||
|
import {
|
||||||
|
closestCenter,
|
||||||
|
DndContext,
|
||||||
|
type DragEndEvent,
|
||||||
|
KeyboardSensor,
|
||||||
|
PointerSensor,
|
||||||
|
useSensor,
|
||||||
|
useSensors,
|
||||||
|
} from "@dnd-kit/core";
|
||||||
|
import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
|
||||||
|
import {
|
||||||
|
arrayMove,
|
||||||
|
SortableContext,
|
||||||
|
sortableKeyboardCoordinates,
|
||||||
|
verticalListSortingStrategy,
|
||||||
|
} from "@dnd-kit/sortable";
|
||||||
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import Button from "@mui/material/Button";
|
||||||
|
import Collapse from "@mui/material/Collapse";
|
||||||
|
import IconButton from "@mui/material/IconButton";
|
||||||
|
import Tooltip from "@mui/material/Tooltip";
|
||||||
|
import { useSnackbar } from "notistack";
|
||||||
|
import React, { useMemo, useState } from "react";
|
||||||
|
import { getRuntimeCompact } from "@/utils/date/time";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
import { playItemFromQueue } from "@/utils/store/playback";
|
||||||
|
import useQueue, {
|
||||||
|
clearUpcoming,
|
||||||
|
insertIntoQueue,
|
||||||
|
removeFromQueue,
|
||||||
|
reorderQueue,
|
||||||
|
shuffleUpcoming,
|
||||||
|
} from "@/utils/store/queue";
|
||||||
|
import { getQueueItemText, QueueRow, SortableQueueRow } from "./queueRow";
|
||||||
|
|
||||||
|
import "./queue.scss";
|
||||||
|
|
||||||
|
type QueueViewProps = {
|
||||||
|
/**
|
||||||
|
* "drawer": standalone queue with the now playing row and a close button.
|
||||||
|
* "panel": embedded next to a full player that already shows the current track.
|
||||||
|
*/
|
||||||
|
variant: "drawer" | "panel";
|
||||||
|
onClose?: () => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
const QueueView = ({ variant, onClose }: QueueViewProps) => {
|
||||||
|
const api = useApiInContext((s) => s.api);
|
||||||
|
const userId = useCentralStore((s) => s.currentUser?.Id ?? undefined);
|
||||||
|
const { enqueueSnackbar, closeSnackbar } = useSnackbar();
|
||||||
|
const [tracks, currentIndex] = useQueue((s) => [
|
||||||
|
s.tracks,
|
||||||
|
s.currentItemIndex,
|
||||||
|
]);
|
||||||
|
const [showHistory, setShowHistory] = useState(false);
|
||||||
|
|
||||||
|
const queue = tracks ?? [];
|
||||||
|
const current = queue[currentIndex];
|
||||||
|
const history = queue.slice(0, currentIndex);
|
||||||
|
const upcoming = useMemo(
|
||||||
|
() => queue.slice(currentIndex + 1),
|
||||||
|
[queue, currentIndex],
|
||||||
|
);
|
||||||
|
const upcomingTicks = upcoming.reduce(
|
||||||
|
(total, item) => total + (item.RunTimeTicks ?? 0),
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
|
||||||
|
const sensors = useSensors(
|
||||||
|
useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),
|
||||||
|
useSensor(KeyboardSensor, {
|
||||||
|
coordinateGetter: sortableKeyboardCoordinates,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
const play = (index: number) => {
|
||||||
|
playItemFromQueue(index, userId, api);
|
||||||
|
};
|
||||||
|
|
||||||
|
const remove = (item: BaseItemDto, index: number) => {
|
||||||
|
removeFromQueue(index);
|
||||||
|
const { title } = getQueueItemText(item);
|
||||||
|
enqueueSnackbar(`Removed "${title}"`, {
|
||||||
|
variant: "default",
|
||||||
|
action: (key) => (
|
||||||
|
<Button
|
||||||
|
color="inherit"
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
insertIntoQueue(item, index);
|
||||||
|
closeSnackbar(key);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Undo
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const clearAll = () => {
|
||||||
|
const removed = upcoming;
|
||||||
|
clearUpcoming();
|
||||||
|
enqueueSnackbar(`Cleared ${removed.length} tracks from up next`, {
|
||||||
|
action: (key) => (
|
||||||
|
<Button
|
||||||
|
color="inherit"
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
const state = useQueue.getState();
|
||||||
|
reorderQueue([
|
||||||
|
...(state.tracks ?? []).slice(0, state.currentItemIndex + 1),
|
||||||
|
...removed,
|
||||||
|
]);
|
||||||
|
closeSnackbar(key);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Undo
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDragEnd = ({ active, over }: DragEndEvent) => {
|
||||||
|
if (!over || active.id === over.id) return;
|
||||||
|
const from = upcoming.findIndex((item) => item.Id === active.id);
|
||||||
|
const to = upcoming.findIndex((item) => item.Id === over.id);
|
||||||
|
if (from === -1 || to === -1) return;
|
||||||
|
reorderQueue([
|
||||||
|
...queue.slice(0, currentIndex + 1),
|
||||||
|
...arrayMove(upcoming, from, to),
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
|
||||||
|
const summary =
|
||||||
|
upcoming.length > 0
|
||||||
|
? `${upcoming.length} ${upcoming.length === 1 ? "track" : "tracks"} · ${getRuntimeCompact(upcomingTicks)}`
|
||||||
|
: "Nothing queued";
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={`queue queue-${variant}`}>
|
||||||
|
<header className="queue-header">
|
||||||
|
<div className="queue-header-text">
|
||||||
|
<h2 className="queue-title">
|
||||||
|
{variant === "drawer" ? "Queue" : "Up next"}
|
||||||
|
</h2>
|
||||||
|
<span className="queue-summary">{summary}</span>
|
||||||
|
</div>
|
||||||
|
<div className="queue-header-actions">
|
||||||
|
<Tooltip title="Shuffle up next">
|
||||||
|
<span>
|
||||||
|
<IconButton
|
||||||
|
onClick={shuffleUpcoming}
|
||||||
|
disabled={upcoming.length < 2}
|
||||||
|
aria-label="Shuffle up next"
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded">shuffle</span>
|
||||||
|
</IconButton>
|
||||||
|
</span>
|
||||||
|
</Tooltip>
|
||||||
|
<Tooltip title="Clear up next">
|
||||||
|
<span>
|
||||||
|
<IconButton
|
||||||
|
onClick={clearAll}
|
||||||
|
disabled={upcoming.length === 0}
|
||||||
|
aria-label="Clear up next"
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded">
|
||||||
|
playlist_remove
|
||||||
|
</span>
|
||||||
|
</IconButton>
|
||||||
|
</span>
|
||||||
|
</Tooltip>
|
||||||
|
{onClose && (
|
||||||
|
<IconButton onClick={onClose} aria-label="Close queue">
|
||||||
|
<span className="material-symbols-rounded">close</span>
|
||||||
|
</IconButton>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div className="queue-body">
|
||||||
|
{variant === "drawer" && current && (
|
||||||
|
<section className="queue-section">
|
||||||
|
<h3 className="queue-section-label">Now playing</h3>
|
||||||
|
<QueueRow item={current} variant="current" />
|
||||||
|
</section>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<section className="queue-section">
|
||||||
|
{variant === "drawer" && (
|
||||||
|
<h3 className="queue-section-label">Up next</h3>
|
||||||
|
)}
|
||||||
|
{upcoming.length > 0 ? (
|
||||||
|
<>
|
||||||
|
<DndContext
|
||||||
|
sensors={sensors}
|
||||||
|
collisionDetection={closestCenter}
|
||||||
|
onDragEnd={handleDragEnd}
|
||||||
|
modifiers={[restrictToVerticalAxis]}
|
||||||
|
>
|
||||||
|
<SortableContext
|
||||||
|
items={upcoming.map((item) => item.Id ?? "")}
|
||||||
|
strategy={verticalListSortingStrategy}
|
||||||
|
>
|
||||||
|
<div className="queue-list">
|
||||||
|
{upcoming.map((item, offset) => {
|
||||||
|
const index = currentIndex + 1 + offset;
|
||||||
|
return (
|
||||||
|
<SortableQueueRow
|
||||||
|
key={item.Id ?? index}
|
||||||
|
item={item}
|
||||||
|
onPlay={() => play(index)}
|
||||||
|
onRemove={() => remove(item, index)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</SortableContext>
|
||||||
|
</DndContext>
|
||||||
|
<p className="queue-hint">
|
||||||
|
Click a track to play it now · drag to reorder
|
||||||
|
</p>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<div className="queue-empty">
|
||||||
|
<span className="material-symbols-rounded queue-empty-icon">
|
||||||
|
queue_music
|
||||||
|
</span>
|
||||||
|
<span className="queue-empty-title">Nothing up next</span>
|
||||||
|
<span className="queue-empty-text">
|
||||||
|
Play an album, playlist or artist to fill the queue.
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{history.length > 0 && (
|
||||||
|
<section className="queue-section">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="queue-section-toggle"
|
||||||
|
onClick={() => setShowHistory((open) => !open)}
|
||||||
|
aria-expanded={showHistory}
|
||||||
|
>
|
||||||
|
<span className="queue-section-label">
|
||||||
|
Previously played · {history.length}
|
||||||
|
</span>
|
||||||
|
<span className="material-symbols-rounded">
|
||||||
|
{showHistory ? "expand_less" : "expand_more"}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<Collapse in={showHistory} unmountOnExit>
|
||||||
|
<div className="queue-list">
|
||||||
|
{history.map((item, index) => (
|
||||||
|
<QueueRow
|
||||||
|
key={item.Id ?? index}
|
||||||
|
item={item}
|
||||||
|
variant="history"
|
||||||
|
onPlay={() => play(index)}
|
||||||
|
onRemove={() => remove(item, index)}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</Collapse>
|
||||||
|
</section>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default QueueView;
|
||||||
@@ -1,236 +0,0 @@
|
|||||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
|
||||||
import {
|
|
||||||
Box,
|
|
||||||
IconButton,
|
|
||||||
ListItem,
|
|
||||||
ListItemAvatar,
|
|
||||||
ListItemText,
|
|
||||||
} from "@mui/material";
|
|
||||||
import React from "react";
|
|
||||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
|
||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
|
||||||
|
|
||||||
type QueueListItemProps = {
|
|
||||||
queueItem: BaseItemDto;
|
|
||||||
active?: boolean;
|
|
||||||
onDelete?: () => void;
|
|
||||||
onPlay?: () => void;
|
|
||||||
dragHandleProps?: any;
|
|
||||||
isEpisode?: boolean;
|
|
||||||
index?: number;
|
|
||||||
className?: string;
|
|
||||||
sx?: any;
|
|
||||||
};
|
|
||||||
|
|
||||||
const QueueListItem = ({
|
|
||||||
queueItem,
|
|
||||||
active,
|
|
||||||
onDelete,
|
|
||||||
onPlay,
|
|
||||||
dragHandleProps,
|
|
||||||
isEpisode,
|
|
||||||
className,
|
|
||||||
sx,
|
|
||||||
}: QueueListItemProps) => {
|
|
||||||
const api = useApiInContext((s) => s.api);
|
|
||||||
|
|
||||||
const imageUrl =
|
|
||||||
api &&
|
|
||||||
queueItem.Id &&
|
|
||||||
(queueItem.ImageTags?.Primary
|
|
||||||
? getImageUrlsApi(api).getItemImageUrlById(queueItem.Id, "Primary", {
|
|
||||||
tag: queueItem.ImageTags.Primary,
|
|
||||||
})
|
|
||||||
: queueItem.AlbumPrimaryImageTag?.[0]
|
|
||||||
? getImageUrlsApi(api).getItemImageUrlById(
|
|
||||||
queueItem.AlbumId || "",
|
|
||||||
"Primary",
|
|
||||||
{ tag: queueItem.AlbumPrimaryImageTag[0] },
|
|
||||||
)
|
|
||||||
: null);
|
|
||||||
|
|
||||||
const primaryText = queueItem.SeriesName || queueItem.Name;
|
|
||||||
|
|
||||||
let secondaryText = "";
|
|
||||||
if (isEpisode) {
|
|
||||||
const season = queueItem.ParentIndexNumber;
|
|
||||||
const episode = queueItem.IndexNumber;
|
|
||||||
const episodeEnd = queueItem.IndexNumberEnd;
|
|
||||||
const episodeString = episodeEnd
|
|
||||||
? `S${season}:E${episode}-${episodeEnd}`
|
|
||||||
: `S${season}:E${episode}`;
|
|
||||||
|
|
||||||
secondaryText = `${episodeString} - ${queueItem.Name}`;
|
|
||||||
} else {
|
|
||||||
secondaryText = queueItem.Artists?.join(", ") || "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ListItem
|
|
||||||
component="div"
|
|
||||||
className={className}
|
|
||||||
secondaryAction={
|
|
||||||
onDelete && (
|
|
||||||
<IconButton
|
|
||||||
edge="end"
|
|
||||||
aria-label="delete"
|
|
||||||
onClick={onDelete}
|
|
||||||
size="small"
|
|
||||||
sx={{
|
|
||||||
opacity: 0,
|
|
||||||
transition: "opacity 0.2s",
|
|
||||||
".MuiListItem-root:hover &": { opacity: 0.7 },
|
|
||||||
"&:hover": { opacity: "1 !important", bgcolor: "action.hover" },
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span className="material-symbols-rounded" style={{ fontSize: 20 }}>
|
|
||||||
close
|
|
||||||
</span>
|
|
||||||
</IconButton>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
sx={{
|
|
||||||
opacity: active ? 1 : 1,
|
|
||||||
bgcolor: active ? "rgba(255, 255, 255, 0.1)" : "rgba(0,0,0,0.2)",
|
|
||||||
borderRadius: 3,
|
|
||||||
mb: 0,
|
|
||||||
transition: "all 0.2s ease",
|
|
||||||
border: "1px solid",
|
|
||||||
borderColor: active
|
|
||||||
? "rgba(255, 255, 255, 0.2)"
|
|
||||||
: "rgba(255,255,255,0.05)",
|
|
||||||
"&:hover": {
|
|
||||||
bgcolor: active
|
|
||||||
? "rgba(255, 255, 255, 0.15)"
|
|
||||||
: "rgba(255,255,255,0.05)",
|
|
||||||
transform: active ? "none" : "translateY(-2px)",
|
|
||||||
borderColor: active
|
|
||||||
? "rgba(255, 255, 255, 0.3)"
|
|
||||||
: "rgba(255,255,255,0.2)",
|
|
||||||
boxShadow: active ? "none" : "0 4px 12px rgba(0,0,0,0.2)",
|
|
||||||
},
|
|
||||||
pr: onDelete ? 6 : 2,
|
|
||||||
...sx,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{dragHandleProps && (
|
|
||||||
<div
|
|
||||||
{...dragHandleProps}
|
|
||||||
style={{
|
|
||||||
cursor: "grab",
|
|
||||||
marginRight: 12,
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
opacity: 0.5,
|
|
||||||
transition: "opacity 0.2s",
|
|
||||||
}}
|
|
||||||
className="drag-handle"
|
|
||||||
>
|
|
||||||
<span className="material-symbols-rounded">drag_indicator</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<ListItemAvatar sx={{ minWidth: 64 }}>
|
|
||||||
<Box
|
|
||||||
onClick={onPlay}
|
|
||||||
sx={{
|
|
||||||
width: 48,
|
|
||||||
height: 48,
|
|
||||||
borderRadius: 2,
|
|
||||||
overflow: "hidden",
|
|
||||||
position: "relative",
|
|
||||||
boxShadow: "0 2px 8px rgba(0,0,0,0.2)",
|
|
||||||
cursor: onPlay ? "pointer" : "default",
|
|
||||||
"&:hover .play-overlay": {
|
|
||||||
opacity: 1,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{imageUrl ? (
|
|
||||||
<img
|
|
||||||
src={imageUrl}
|
|
||||||
alt={queueItem.Name || ""}
|
|
||||||
style={{ width: "100%", height: "100%", objectFit: "cover" }}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
width: "100%",
|
|
||||||
height: "100%",
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "center",
|
|
||||||
background: "#2a2a2a",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{queueItem.Type && getTypeIcon(queueItem.Type)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{active && (
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
position: "absolute",
|
|
||||||
inset: 0,
|
|
||||||
background: "rgba(0,0,0,0.4)",
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "center",
|
|
||||||
backdropFilter: "blur(2px)",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
className="material-symbols-rounded"
|
|
||||||
style={{ fontSize: "1.5rem", color: "white" }}
|
|
||||||
>
|
|
||||||
equalizer
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{!active && onPlay && (
|
|
||||||
<Box
|
|
||||||
className="play-overlay"
|
|
||||||
sx={{
|
|
||||||
position: "absolute",
|
|
||||||
inset: 0,
|
|
||||||
background: "rgba(0,0,0,0.4)",
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "center",
|
|
||||||
opacity: 0,
|
|
||||||
transition: "opacity 0.2s",
|
|
||||||
backdropFilter: "blur(1px)",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
className="material-symbols-rounded"
|
|
||||||
style={{ fontSize: "2rem", color: "white" }}
|
|
||||||
>
|
|
||||||
play_arrow
|
|
||||||
</span>
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
</ListItemAvatar>
|
|
||||||
|
|
||||||
<ListItemText
|
|
||||||
primary={primaryText}
|
|
||||||
secondary={secondaryText}
|
|
||||||
slotProps={{
|
|
||||||
primary: {
|
|
||||||
noWrap: true,
|
|
||||||
variant: "body2",
|
|
||||||
sx: { mb: 0.5, fontWeight: active ? 700 : 500 },
|
|
||||||
},
|
|
||||||
secondary: {
|
|
||||||
noWrap: true,
|
|
||||||
variant: "caption",
|
|
||||||
sx: { opacity: 0.7 },
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</ListItem>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default QueueListItem;
|
|
||||||
@@ -1,10 +1,24 @@
|
|||||||
import { CircularProgress } from "@mui/material";
|
import { CircularProgress } from "@mui/material";
|
||||||
import { useRouterState } from "@tanstack/react-router";
|
import { useRouterState } from "@tanstack/react-router";
|
||||||
import React from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
|
|
||||||
|
/** Only show the full-screen loader for genuinely slow navigations. */
|
||||||
|
const SHOW_DELAY_MS = 250;
|
||||||
|
|
||||||
export default function RouterLoading() {
|
export default function RouterLoading() {
|
||||||
const routeLoading = useRouterState().isLoading;
|
const routeLoading = useRouterState().isLoading;
|
||||||
if (!routeLoading) return null;
|
const [visible, setVisible] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!routeLoading) {
|
||||||
|
setVisible(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const timer = setTimeout(() => setVisible(true), SHOW_DELAY_MS);
|
||||||
|
return () => clearTimeout(timer);
|
||||||
|
}, [routeLoading]);
|
||||||
|
|
||||||
|
if (!visible) return null;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
+6
-1
@@ -43,7 +43,7 @@ const router = createRouter({
|
|||||||
},
|
},
|
||||||
defaultPreload: false,
|
defaultPreload: false,
|
||||||
defaultPreloadStaleTime: 0,
|
defaultPreloadStaleTime: 0,
|
||||||
defaultViewTransition: true,
|
defaultViewTransition: false,
|
||||||
scrollRestoration: true,
|
scrollRestoration: true,
|
||||||
scrollRestorationBehavior: "auto",
|
scrollRestorationBehavior: "auto",
|
||||||
});
|
});
|
||||||
@@ -95,6 +95,11 @@ function ProviderWrapper() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
|
// The window is frameless-ish on macOS (overlay titlebar): the app header is the titlebar.
|
||||||
|
if (navigator.userAgent.includes("Macintosh")) {
|
||||||
|
document.documentElement.classList.add("is-macos");
|
||||||
|
}
|
||||||
|
|
||||||
const initialApi = await initializeApi();
|
const initialApi = await initializeApi();
|
||||||
|
|
||||||
ReactDOM.createRoot(document.getElementById("root")!).render(
|
ReactDOM.createRoot(document.getElementById("root")!).render(
|
||||||
|
|||||||
@@ -32,15 +32,16 @@
|
|||||||
|
|
||||||
.MuiTabs-root {
|
.MuiTabs-root {
|
||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
margin-left: -12px;
|
// Negative margins cancel the scroller padding below, so the layout is unchanged
|
||||||
margin-top: 1em;
|
margin: calc(1em - 8px) 0 -16px -12px;
|
||||||
|
|
||||||
.MuiTabs-indicator {
|
.MuiTabs-indicator {
|
||||||
display: none; // Hide default indicator
|
display: none; // Hide default indicator
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tabs clip their content; pad the scroller so the selected pill's shadow fits
|
||||||
.MuiTabs-scroller {
|
.MuiTabs-scroller {
|
||||||
overflow: visible !important; // Allow shadows/glows to show
|
padding: 8px 0 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.MuiTab-root {
|
.MuiTab-root {
|
||||||
|
|||||||
@@ -57,7 +57,22 @@
|
|||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
transition: opacity 0.5s;
|
|
||||||
|
// Poster-only item: never stretch/crop a 2:3 poster across 16:9.
|
||||||
|
// Blur it into an ambient background and show the sharp poster on top.
|
||||||
|
&.is-poster {
|
||||||
|
filter: blur(36px) saturate(1.6) brightness(0.65);
|
||||||
|
transform: scale(1.25);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-blurhash {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
width: 100% !important;
|
||||||
|
height: 100% !important;
|
||||||
|
z-index: 0;
|
||||||
|
filter: blur(30px) saturate(1.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
&-icon-container {
|
&-icon-container {
|
||||||
@@ -95,9 +110,26 @@
|
|||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
object-position: left bottom;
|
object-position: left bottom;
|
||||||
filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
|
filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
|
||||||
|
// The logo is an <img> inside a line-clamped heading; as an inline image
|
||||||
|
// its box was clipped by the heading's line box (cut-off titles).
|
||||||
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-poster {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 3;
|
||||||
|
right: 7%;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
height: 66%;
|
||||||
|
max-width: 26%;
|
||||||
|
object-fit: contain;
|
||||||
|
border-radius: 14px;
|
||||||
|
box-shadow: 0 24px 60px rgb(0 0 0 / 0.65), 0 0 0 1px rgb(255 255 255 / 0.08);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
&-overview {
|
&-overview {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-bottom: 0.5em;
|
margin-bottom: 0.5em;
|
||||||
@@ -144,10 +176,19 @@
|
|||||||
@media (max-width: 1140px) {
|
@media (max-width: 1140px) {
|
||||||
.carousel {
|
.carousel {
|
||||||
height: 60vh !important;
|
height: 60vh !important;
|
||||||
|
// Never squeeze the hero below the height its own content needs,
|
||||||
|
// otherwise the title/logo is clipped by the slide's overflow.
|
||||||
|
min-height: 430px;
|
||||||
}
|
}
|
||||||
.hero-carousel {
|
.hero-carousel {
|
||||||
|
&-poster {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
&-detail {
|
&-detail {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
padding: 3rem;
|
||||||
|
padding-bottom: 4rem;
|
||||||
background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
|
background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,6 +197,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&-text {
|
&-text {
|
||||||
|
// Narrow layouts: the hero column is ~400px, a 3.75rem title wraps
|
||||||
|
// to two lines and overflows the slide, clipping the top line.
|
||||||
|
font-size: 2.5rem !important;
|
||||||
|
line-height: 1.15 !important;
|
||||||
|
|
||||||
&-logo {
|
&-logo {
|
||||||
max-width: 60vw;
|
max-width: 60vw;
|
||||||
max-height: 10vh;
|
max-height: 10vh;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useQueries, useSuspenseQuery } from "@tanstack/react-query";
|
import { useSuspenseQuery } from "@tanstack/react-query";
|
||||||
import React, { useCallback, useMemo } from "react";
|
import React, { useCallback, useMemo } from "react";
|
||||||
|
|
||||||
import "./home.scss";
|
import "./home.scss";
|
||||||
@@ -24,25 +24,11 @@ import Carousel from "@/components/carousel";
|
|||||||
import CircularPageLoadingAnimation from "@/components/circularPageLoadingAnimation";
|
import CircularPageLoadingAnimation from "@/components/circularPageLoadingAnimation";
|
||||||
import { LatestMediaSection } from "@/components/layouts/homeSection/latestMediaSection";
|
import { LatestMediaSection } from "@/components/layouts/homeSection/latestMediaSection";
|
||||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||||
import {
|
import { getLatestItemsQueryOptions } from "@/utils/queries/items";
|
||||||
getLatestItemsQueryOptions,
|
|
||||||
getLibraryLatestQueryOptions,
|
|
||||||
} from "@/utils/queries/items";
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||||
import { useCentralStore } from "@/utils/store/central";
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
|
||||||
const heroItemTypes = new Set<string>([
|
|
||||||
BaseItemKind.Movie,
|
|
||||||
BaseItemKind.Series,
|
|
||||||
BaseItemKind.Episode,
|
|
||||||
BaseItemKind.MusicAlbum,
|
|
||||||
]);
|
|
||||||
|
|
||||||
const combineLibraryLatest = (
|
|
||||||
results: { data?: BaseItemDto[] | null }[],
|
|
||||||
): BaseItemDto[][] => results.map((result) => result.data ?? []);
|
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/home/")({
|
export const Route = createFileRoute("/_api/home/")({
|
||||||
component: Home,
|
component: Home,
|
||||||
pendingComponent: () => <CircularPageLoadingAnimation />,
|
pendingComponent: () => <CircularPageLoadingAnimation />,
|
||||||
@@ -141,28 +127,14 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
|
|||||||
}
|
}
|
||||||
}, [libraries.data?.Items?.length]);
|
}, [libraries.data?.Items?.length]);
|
||||||
|
|
||||||
// The per-library "latest" rows; shares cache entries with LatestMediaSection.
|
const heroItems = useMemo(
|
||||||
const libraryLatest = useQueries({
|
() =>
|
||||||
queries: (latestMediaLibs ?? []).map((lib) =>
|
latestMedia.data?.filter(
|
||||||
getLibraryLatestQueryOptions(api, user.Id, lib.Id),
|
(item) =>
|
||||||
),
|
item.Type === BaseItemKind.Movie || item.Type === BaseItemKind.Series,
|
||||||
combine: combineLibraryLatest,
|
) ?? [],
|
||||||
});
|
[latestMedia.data],
|
||||||
|
);
|
||||||
// Some servers return nothing for the global /Items/Latest query, so fall back to
|
|
||||||
// interleaving the per-library results (each already newest-first).
|
|
||||||
const heroItems = useMemo(() => {
|
|
||||||
if (latestMedia.data?.length) return latestMedia.data;
|
|
||||||
const items: BaseItemDto[] = [];
|
|
||||||
const longest = Math.max(0, ...libraryLatest.map((list) => list.length));
|
|
||||||
for (let index = 0; index < longest; index++) {
|
|
||||||
for (const list of libraryLatest) {
|
|
||||||
const item = list[index];
|
|
||||||
if (item?.Type && heroItemTypes.has(item.Type)) items.push(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return items.slice(0, 16);
|
|
||||||
}, [latestMedia.data, libraryLatest]);
|
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
@@ -170,19 +142,20 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
|
|||||||
|
|
||||||
const setBackdropForItem = useCallback(
|
const setBackdropForItem = useCallback(
|
||||||
(item: BaseItemDto) => {
|
(item: BaseItemDto) => {
|
||||||
if (item?.ParentBackdropImageTags) {
|
// Use the wide artwork when present, otherwise the poster's BlurHash as
|
||||||
setBackdrop(
|
// an ambient background (poster-only items would otherwise leave it dark).
|
||||||
item.ImageBlurHashes?.Backdrop?.[item.ParentBackdropImageTags[0]],
|
const backdropTag =
|
||||||
);
|
item.ParentBackdropImageTags?.[0] ?? item.BackdropImageTags?.[0];
|
||||||
} else {
|
if (backdropTag) {
|
||||||
if (!item?.BackdropImageTags) {
|
setBackdrop(item.ImageBlurHashes?.Backdrop?.[backdropTag] ?? undefined);
|
||||||
setBackdrop(undefined);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const primaryTag = item.ImageTags?.Primary;
|
||||||
setBackdrop(
|
setBackdrop(
|
||||||
item.ImageBlurHashes?.Backdrop?.[item.BackdropImageTags[0]],
|
primaryTag
|
||||||
|
? (item.ImageBlurHashes?.Primary?.[primaryTag] ?? undefined)
|
||||||
|
: undefined,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
[setBackdrop],
|
[setBackdrop],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,108 +1,57 @@
|
|||||||
import LoadingButton from "@mui/lab/LoadingButton";
|
import Button from "@mui/material/Button";
|
||||||
import { Paper, TextField, Typography } from "@mui/material";
|
|
||||||
import Checkbox from "@mui/material/Checkbox";
|
import Checkbox from "@mui/material/Checkbox";
|
||||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import InputAdornment from "@mui/material/InputAdornment";
|
import InputAdornment from "@mui/material/InputAdornment";
|
||||||
|
import TextField from "@mui/material/TextField";
|
||||||
import { useSnackbar } from "notistack";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
import { AvatarImage } from "@/components/avatar/avatar.jsx";
|
|
||||||
import "./login.scss";
|
|
||||||
|
|
||||||
import { useMutation } from "@tanstack/react-query";
|
|
||||||
import {
|
import {
|
||||||
createFileRoute,
|
createFileRoute,
|
||||||
|
Link,
|
||||||
useNavigate,
|
useNavigate,
|
||||||
useRouter,
|
useRouter,
|
||||||
} from "@tanstack/react-router";
|
} from "@tanstack/react-router";
|
||||||
import React, {
|
import React, { type FormEvent, useState } from "react";
|
||||||
type ChangeEvent,
|
import LoginShell from "@/components/loginShell";
|
||||||
type FormEvent,
|
import {
|
||||||
useEffect,
|
getPublicUsersQueryOptions,
|
||||||
useState,
|
isPasswordProtected,
|
||||||
} from "react";
|
ProfileAvatar,
|
||||||
import { useShallow } from "zustand/shallow";
|
} from "@/components/loginShell/profileAvatar";
|
||||||
import { saveUser } from "@/utils/storage/user";
|
import { saveUser } from "@/utils/storage/user";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { useBackdropStore } from "@/utils/store/backdrop.js";
|
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/login/$userId/$userName")({
|
export const Route = createFileRoute("/_api/login/$userId/$userName")({
|
||||||
component: LoginUser,
|
component: LoginUser,
|
||||||
});
|
});
|
||||||
|
|
||||||
type PasswordState = {
|
|
||||||
showpass: boolean;
|
|
||||||
password: string | undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
function LoginUser() {
|
function LoginUser() {
|
||||||
const { userName, userId } = Route.useParams();
|
const { userName, userId } = Route.useParams();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const navigate = useNavigate({ from: "/login/$userId/$userName" });
|
||||||
|
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const createApi = useApiInContext((s) => s.createApi);
|
const createApi = useApiInContext((s) => s.createApi);
|
||||||
|
|
||||||
const [password, setPassword] = useState<PasswordState>({
|
const [password, setPassword] = useState("");
|
||||||
showpass: false,
|
const [showPassword, setShowPassword] = useState(false);
|
||||||
password: undefined,
|
|
||||||
});
|
|
||||||
const [rememberMe, setRememberMe] = useState(true);
|
const [rememberMe, setRememberMe] = useState(true);
|
||||||
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
|
||||||
const navigate = useNavigate({ from: "/login/$userId/$userName" });
|
// Profile details (image, whether a password is needed) from the public user list
|
||||||
|
const users = useQuery(getPublicUsersQueryOptions(api));
|
||||||
|
const user = users.data?.find((u) => u.Id === userId);
|
||||||
|
const needsPassword = isPasswordProtected(user);
|
||||||
|
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
const handleLogin = useMutation({
|
||||||
|
mutationKey: ["login", "authenticate"],
|
||||||
const handlePassword =
|
mutationFn: async () => {
|
||||||
(prop: "password" | "showPassord") =>
|
if (!api) throw new Error("API not initialized");
|
||||||
(event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
const authenticate = await api.authenticateUserByName(userName, password);
|
||||||
setPassword({
|
|
||||||
...password,
|
|
||||||
[prop]: event.target.value,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleShowPassword = () => {
|
|
||||||
setPassword({
|
|
||||||
...password,
|
|
||||||
showpass: !password.showpass,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const setBackdrop = useBackdropStore(
|
|
||||||
useShallow((state) => state.setBackdrop),
|
|
||||||
);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!api) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setBackdrop("");
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const handleCheckRememberMe = (
|
|
||||||
_: ChangeEvent<HTMLInputElement>,
|
|
||||||
checked: boolean,
|
|
||||||
) => {
|
|
||||||
setRememberMe(checked);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleLoginFn = async (event: FormEvent<HTMLFormElement>) => {
|
|
||||||
event.preventDefault();
|
|
||||||
try {
|
|
||||||
if (!api) {
|
|
||||||
throw new Error("API not initialized");
|
|
||||||
}
|
|
||||||
const authenticate = await api.authenticateUserByName(
|
|
||||||
userName,
|
|
||||||
password.password,
|
|
||||||
);
|
|
||||||
if (!authenticate.data.AccessToken) {
|
if (!authenticate.data.AccessToken) {
|
||||||
throw new Error("No access token received");
|
throw new Error("No access token received");
|
||||||
}
|
}
|
||||||
createApi(api.basePath, authenticate.data?.AccessToken);
|
createApi(api.basePath, authenticate.data.AccessToken);
|
||||||
|
|
||||||
if (authenticate.data.SessionInfo?.UserId && rememberMe) {
|
if (authenticate.data.SessionInfo?.UserId && rememberMe) {
|
||||||
await saveUser(
|
await saveUser(
|
||||||
userName,
|
userName,
|
||||||
@@ -110,158 +59,118 @@ function LoginUser() {
|
|||||||
authenticate.data.SessionInfo.UserId,
|
authenticate.data.SessionInfo.UserId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
onSuccess: () => {
|
||||||
router.invalidate().finally(() => {
|
router.invalidate().finally(() => {
|
||||||
navigate({ to: "/home", replace: true });
|
navigate({ to: "/home", replace: true });
|
||||||
});
|
});
|
||||||
} catch (err) {
|
},
|
||||||
|
onError: (err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
enqueueSnackbar("Unable to authenticate! Please check your password", {
|
setError(
|
||||||
variant: "error",
|
needsPassword
|
||||||
|
? "Incorrect password. Please try again."
|
||||||
|
: "Couldn't sign in. Please try again.",
|
||||||
|
);
|
||||||
|
setPassword("");
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
|
||||||
return;
|
const handleSubmit = (event: FormEvent<HTMLFormElement>) => {
|
||||||
|
event.preventDefault();
|
||||||
|
setError(null);
|
||||||
|
handleLogin.mutate();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleLogin = useMutation({
|
|
||||||
mutationKey: ["login", "authenticate"],
|
|
||||||
mutationFn: handleLoginFn,
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<LoginShell
|
||||||
className="login flex flex-center flex-column centered"
|
title={`Welcome back, ${userName}`}
|
||||||
style={{ marginTop: 0 }}
|
subtitle={
|
||||||
|
needsPassword
|
||||||
|
? "Enter your password to continue"
|
||||||
|
: "This profile doesn't need a password"
|
||||||
|
}
|
||||||
|
footer={
|
||||||
|
<Link to="/login/list" className="login-link">
|
||||||
|
<span className="material-symbols-rounded">switch_account</span>
|
||||||
|
Not you? Switch user
|
||||||
|
</Link>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<Paper
|
<form className="login-form" onSubmit={handleSubmit}>
|
||||||
sx={{
|
<div className="login-form-avatar">
|
||||||
p: 4,
|
<ProfileAvatar
|
||||||
width: "100%",
|
userId={userId}
|
||||||
maxWidth: "600px",
|
name={userName}
|
||||||
backgroundColor: "rgba(20, 20, 30, 0.7)",
|
imageTag={user?.PrimaryImageTag}
|
||||||
backdropFilter: "blur(24px) saturate(180%)",
|
/>
|
||||||
backgroundImage:
|
|
||||||
"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0))",
|
|
||||||
border: "1px solid rgba(255, 255, 255, 0.08)",
|
|
||||||
boxShadow: "0 20px 50px rgba(0,0,0,0.5)",
|
|
||||||
borderRadius: 4,
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
alignItems: "center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
marginBottom: "2em",
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
alignItems: "center",
|
|
||||||
gap: "1em",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<AvatarImage userId={userId} />
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
alignItems: "center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Typography variant="body1" sx={{ opacity: 0.7 }}>
|
|
||||||
Login as
|
|
||||||
</Typography>
|
|
||||||
<Typography
|
|
||||||
variant="h5"
|
|
||||||
className="gradient-text"
|
|
||||||
sx={{
|
|
||||||
fontWeight: 700,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{userName}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form
|
{needsPassword && (
|
||||||
onSubmit={(e) => handleLogin.mutate(e)}
|
|
||||||
style={{
|
|
||||||
width: "100%",
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
gap: "1.5rem",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<TextField
|
<TextField
|
||||||
fullWidth
|
fullWidth
|
||||||
type={password.showpass ? "text" : "password"}
|
autoFocus
|
||||||
onChange={handlePassword("password")}
|
|
||||||
label="Password"
|
label="Password"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
autoFocus
|
type={showPassword ? "text" : "password"}
|
||||||
|
autoComplete="current-password"
|
||||||
|
value={password}
|
||||||
|
onChange={(e) => {
|
||||||
|
setPassword(e.target.value);
|
||||||
|
setError(null);
|
||||||
|
}}
|
||||||
|
error={Boolean(error)}
|
||||||
|
helperText={error}
|
||||||
slotProps={{
|
slotProps={{
|
||||||
input: {
|
input: {
|
||||||
startAdornment: (
|
|
||||||
<InputAdornment position="start">
|
|
||||||
<span
|
|
||||||
className="material-symbols-rounded"
|
|
||||||
style={{ opacity: 0.5 }}
|
|
||||||
>
|
|
||||||
key
|
|
||||||
</span>
|
|
||||||
</InputAdornment>
|
|
||||||
),
|
|
||||||
endAdornment: (
|
endAdornment: (
|
||||||
<InputAdornment position="end">
|
<InputAdornment position="end">
|
||||||
<IconButton onClick={handleShowPassword} edge="end">
|
<IconButton
|
||||||
{password.showpass ? (
|
onClick={() => setShowPassword((show) => !show)}
|
||||||
|
edge="end"
|
||||||
|
aria-label={
|
||||||
|
showPassword ? "Hide password" : "Show password"
|
||||||
|
}
|
||||||
|
>
|
||||||
<span className="material-symbols-rounded">
|
<span className="material-symbols-rounded">
|
||||||
visibility
|
{showPassword ? "visibility_off" : "visibility"}
|
||||||
</span>
|
</span>
|
||||||
) : (
|
|
||||||
<span className="material-symbols-rounded">
|
|
||||||
visibility_off
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</InputAdornment>
|
</InputAdornment>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
|
{!needsPassword && error && (
|
||||||
|
<p className="login-shell-subtitle" role="alert">
|
||||||
|
{error}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
|
||||||
<div
|
<div className="login-form-options">
|
||||||
style={{
|
|
||||||
display: "flex",
|
|
||||||
justifyContent: "space-between",
|
|
||||||
alignItems: "center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={
|
control={
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={rememberMe}
|
checked={rememberMe}
|
||||||
onChange={handleCheckRememberMe}
|
onChange={(_, checked) => setRememberMe(checked)}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
label="Remember me"
|
label="Keep me signed in"
|
||||||
sx={{ m: 0 }}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<LoadingButton
|
<Button
|
||||||
|
className="login-form-submit"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
endIcon={<span className="material-symbols-rounded">login</span>}
|
|
||||||
type="submit"
|
type="submit"
|
||||||
loading={handleLogin.isPending}
|
|
||||||
loadingPosition="end"
|
|
||||||
size="large"
|
size="large"
|
||||||
fullWidth
|
fullWidth
|
||||||
sx={{ borderRadius: 2, height: 48 }}
|
loading={handleLogin.isPending || handleLogin.isSuccess}
|
||||||
>
|
>
|
||||||
Login
|
Sign in
|
||||||
</LoadingButton>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
</Paper>
|
</LoginShell>
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
+60
-181
@@ -1,197 +1,76 @@
|
|||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import Skeleton from "@mui/material/Skeleton";
|
||||||
import { Box, Chip, Typography } from "@mui/material";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import React, { useEffect } from "react";
|
|
||||||
|
|
||||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice.jsx";
|
|
||||||
import "./login.scss";
|
|
||||||
|
|
||||||
import type { UserDto } from "@jellyfin/sdk/lib/generated-client";
|
|
||||||
import { Paper } from "@mui/material";
|
|
||||||
import { createFileRoute, Link } from "@tanstack/react-router";
|
import { createFileRoute, Link } from "@tanstack/react-router";
|
||||||
|
import React from "react";
|
||||||
|
import LoginShell from "@/components/loginShell";
|
||||||
|
import {
|
||||||
|
getPublicUsersQueryOptions,
|
||||||
|
isPasswordProtected,
|
||||||
|
ProfileAvatar,
|
||||||
|
} from "@/components/loginShell/profileAvatar";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { useBackdropStore } from "@/utils/store/backdrop.js";
|
|
||||||
import avatar from "../../../assets/icons/avatar.png";
|
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/login/list")({
|
export const Route = createFileRoute("/_api/login/list")({
|
||||||
component: LoginPublicUsersList,
|
component: LoginPublicUsersList,
|
||||||
});
|
});
|
||||||
|
|
||||||
const UserCard = ({ user }: { user: UserDto }) => {
|
|
||||||
const api = useApiInContext((s) => s.api);
|
|
||||||
return (
|
|
||||||
<Link
|
|
||||||
to="/login/$userId/$userName"
|
|
||||||
params={{ userId: user.Id ?? "", userName: user.Name ?? "" }}
|
|
||||||
className="user-list-item user-card"
|
|
||||||
style={{ textDecoration: "none", display: "block" }}
|
|
||||||
>
|
|
||||||
<Paper
|
|
||||||
elevation={0}
|
|
||||||
sx={{
|
|
||||||
p: 2,
|
|
||||||
bgcolor: "rgba(255,255,255,0.03)",
|
|
||||||
"&:hover": {
|
|
||||||
bgcolor: "rgba(255,255,255,0.1)",
|
|
||||||
transform: "translateY(-4px)",
|
|
||||||
boxShadow: "0 8px 20px rgba(0,0,0,0.3)",
|
|
||||||
},
|
|
||||||
transition: "all 0.3s ease",
|
|
||||||
borderRadius: 4,
|
|
||||||
border: "1px solid rgba(255,255,255,0.05)",
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
alignItems: "center",
|
|
||||||
width: "160px",
|
|
||||||
height: "100%",
|
|
||||||
cursor: "pointer",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="user-card-image-container"
|
|
||||||
style={{
|
|
||||||
width: "100px",
|
|
||||||
height: "100px",
|
|
||||||
borderRadius: "50%",
|
|
||||||
overflow: "hidden",
|
|
||||||
boxShadow: "0 8px 16px rgba(0,0,0,0.3)",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{user.PrimaryImageTag ? (
|
|
||||||
<img
|
|
||||||
className="user-card-image"
|
|
||||||
alt={"user"}
|
|
||||||
src={`${api?.basePath}/Users/${user.Id}/Images/Primary?quality=80&tag=${user.PrimaryImageTag}`}
|
|
||||||
style={{ width: "100%", height: "100%", objectFit: "cover" }}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<img
|
|
||||||
className="user-card-image"
|
|
||||||
alt="user"
|
|
||||||
src={avatar}
|
|
||||||
style={{ width: "100%", height: "100%", objectFit: "cover" }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<Typography
|
|
||||||
align="center"
|
|
||||||
variant="subtitle1"
|
|
||||||
noWrap
|
|
||||||
sx={{
|
|
||||||
mt: 2,
|
|
||||||
fontWeight: "bold",
|
|
||||||
width: "100%",
|
|
||||||
color: "text.primary",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{user.Name}
|
|
||||||
</Typography>
|
|
||||||
</Paper>
|
|
||||||
</Link>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
function LoginPublicUsersList() {
|
function LoginPublicUsersList() {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
|
const users = useQuery(getPublicUsersQueryOptions(api));
|
||||||
|
|
||||||
const users = useQuery({
|
|
||||||
queryKey: ["login", "public-users"],
|
|
||||||
queryFn: async () => {
|
|
||||||
if (!api) return [];
|
|
||||||
const result = await getUserApi(api).getPublicUsers();
|
|
||||||
return result.data;
|
|
||||||
},
|
|
||||||
enabled: Boolean(api),
|
|
||||||
});
|
|
||||||
|
|
||||||
const setBackdrop = useBackdropStore((state) => state.setBackdrop);
|
|
||||||
useEffect(() => {
|
|
||||||
setBackdrop("");
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
if (users.isSuccess) {
|
|
||||||
return (
|
return (
|
||||||
<div className="login-container scrollY flex flex-column flex-center">
|
<LoginShell
|
||||||
<Paper
|
width="wide"
|
||||||
sx={{
|
title="Who's watching?"
|
||||||
p: 4,
|
subtitle="Choose your profile to sign in"
|
||||||
maxWidth: "800px",
|
|
||||||
width: "90%",
|
|
||||||
backgroundColor: "rgba(20, 20, 30, 0.7)",
|
|
||||||
backdropFilter: "blur(24px) saturate(180%)",
|
|
||||||
backgroundImage:
|
|
||||||
"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0))",
|
|
||||||
border: "1px solid rgba(255, 255, 255, 0.08)",
|
|
||||||
boxShadow: "0 20px 50px rgba(0,0,0,0.5)",
|
|
||||||
borderRadius: 4,
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
alignItems: "center",
|
|
||||||
gap: 3,
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<Typography
|
<div className="profile-grid">
|
||||||
variant="h4"
|
{users.isPending &&
|
||||||
align="center"
|
[0, 1, 2].map((key) => (
|
||||||
sx={{
|
<div className="profile" key={key} aria-hidden>
|
||||||
fontWeight: "bold",
|
<Skeleton variant="circular" width={112} height={112} />
|
||||||
}}
|
<Skeleton variant="text" width={72} />
|
||||||
>
|
|
||||||
Select User
|
|
||||||
</Typography>
|
|
||||||
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
flexWrap: "wrap",
|
|
||||||
gap: 3,
|
|
||||||
justifyContent: "center",
|
|
||||||
width: "100%",
|
|
||||||
maxHeight: "60vh",
|
|
||||||
overflowY: "auto",
|
|
||||||
py: 2,
|
|
||||||
"&::-webkit-scrollbar": { display: "none" },
|
|
||||||
scrollbarWidth: "none",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{users.data.map((item) => {
|
|
||||||
return <UserCard user={item} key={item.Id} />;
|
|
||||||
})}
|
|
||||||
</Box>
|
|
||||||
|
|
||||||
<Chip
|
|
||||||
label={
|
|
||||||
<Typography variant="body2" align="center">
|
|
||||||
Don't see your user? Try using{" "}
|
|
||||||
<Link
|
|
||||||
to="/login/manual"
|
|
||||||
style={{ color: "inherit", fontWeight: "bold" }}
|
|
||||||
>
|
|
||||||
Manual Login
|
|
||||||
</Link>{" "}
|
|
||||||
or{" "}
|
|
||||||
<Link
|
|
||||||
to="/setup/server/list"
|
|
||||||
style={{ color: "inherit", fontWeight: "bold" }}
|
|
||||||
>
|
|
||||||
Changing Server
|
|
||||||
</Link>
|
|
||||||
</Typography>
|
|
||||||
}
|
|
||||||
sx={{
|
|
||||||
bgcolor: "rgba(255,255,255,0.05)",
|
|
||||||
p: 1,
|
|
||||||
height: "auto",
|
|
||||||
"& .MuiChip-label": {
|
|
||||||
padding: "8px 12px",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Paper>
|
|
||||||
</div>
|
</div>
|
||||||
|
))}
|
||||||
|
|
||||||
|
{users.data?.map((user) => (
|
||||||
|
<Link
|
||||||
|
key={user.Id}
|
||||||
|
className="profile"
|
||||||
|
to="/login/$userId/$userName"
|
||||||
|
params={{ userId: user.Id ?? "", userName: user.Name ?? "" }}
|
||||||
|
aria-label={`Sign in as ${user.Name}`}
|
||||||
|
>
|
||||||
|
<ProfileAvatar
|
||||||
|
userId={user.Id ?? ""}
|
||||||
|
name={user.Name ?? ""}
|
||||||
|
imageTag={user.PrimaryImageTag}
|
||||||
|
locked={isPasswordProtected(user)}
|
||||||
|
/>
|
||||||
|
<span className="profile-name">{user.Name}</span>
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
|
||||||
|
{!users.isPending && (
|
||||||
|
<Link
|
||||||
|
className="profile"
|
||||||
|
to="/login/manual"
|
||||||
|
aria-label="Sign in with a username"
|
||||||
|
>
|
||||||
|
<span className="profile-avatar profile-avatar-add">
|
||||||
|
<span className="material-symbols-rounded">person_add</span>
|
||||||
|
</span>
|
||||||
|
<span className="profile-name">Other user</span>
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{users.isError && (
|
||||||
|
<p className="login-shell-subtitle" style={{ textAlign: "center" }}>
|
||||||
|
Couldn't load profiles from this server. Use "Other user" to sign in
|
||||||
|
with your username.
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</LoginShell>
|
||||||
);
|
);
|
||||||
}
|
|
||||||
if (users.isError) {
|
|
||||||
return <ErrorNotice />;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
|
|
||||||
.user {
|
|
||||||
&-list {
|
|
||||||
&-container {
|
|
||||||
display: flex;
|
|
||||||
flex-flow: row wrap;
|
|
||||||
gap: 1em;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
height: 30em;
|
|
||||||
overflow-y: auto;
|
|
||||||
overflow-x: hidden;
|
|
||||||
scroll-snap-type: y mandatory;
|
|
||||||
margin: 2em 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&-card {
|
|
||||||
width: fit-content;
|
|
||||||
scroll-snap-align: start;
|
|
||||||
text-decoration: none !important;
|
|
||||||
color: white !important;
|
|
||||||
&-image{
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
&-container{
|
|
||||||
aspect-ratio: 1;
|
|
||||||
width: 8em;
|
|
||||||
overflow: hidden;
|
|
||||||
border-radius: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&Icon {
|
|
||||||
font-size: 5em;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
background: $clr-accent-dark;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.buttons {
|
|
||||||
display: flex;
|
|
||||||
gap: 1em;
|
|
||||||
width: 100%;
|
|
||||||
>* {
|
|
||||||
flex: 1 1 0 !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.login {
|
|
||||||
// width: 50em;
|
|
||||||
height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
&-container{
|
|
||||||
width: 100vw;
|
|
||||||
height: 100vh;
|
|
||||||
margin: auto;
|
|
||||||
padding-top: 4em;
|
|
||||||
padding-bottom: 4em;
|
|
||||||
}
|
|
||||||
|
|
||||||
&-form {
|
|
||||||
width: 24em;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: stretch;
|
|
||||||
gap:1em;
|
|
||||||
&-container{
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
gap:2em;
|
|
||||||
background: rgb(255 255 255 / 0.05);
|
|
||||||
padding: 2em;
|
|
||||||
border-radius: 20px;
|
|
||||||
// border: 1px solid rgb(255 255 255 / 0.1);
|
|
||||||
&.padded-top {
|
|
||||||
margin-top: 25vh;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +1,20 @@
|
|||||||
import { getBrandingApi } from "@jellyfin/sdk/lib/utils/api/branding-api";
|
|
||||||
import LoadingButton from "@mui/lab/LoadingButton";
|
|
||||||
import { Paper, TextField, Typography } from "@mui/material";
|
|
||||||
import Button from "@mui/material/Button";
|
import Button from "@mui/material/Button";
|
||||||
import Checkbox from "@mui/material/Checkbox";
|
import Checkbox from "@mui/material/Checkbox";
|
||||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import InputAdornment from "@mui/material/InputAdornment";
|
import InputAdornment from "@mui/material/InputAdornment";
|
||||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
import TextField from "@mui/material/TextField";
|
||||||
import { useSnackbar } from "notistack";
|
import { useMutation } from "@tanstack/react-query";
|
||||||
import React, {
|
|
||||||
type ChangeEvent,
|
|
||||||
type FormEvent,
|
|
||||||
useEffect,
|
|
||||||
useState,
|
|
||||||
} from "react";
|
|
||||||
import { saveUser } from "@/utils/storage/user.js";
|
|
||||||
import { useApiInContext } from "@/utils/store/api.js";
|
|
||||||
import "./login.scss";
|
|
||||||
|
|
||||||
import { blue } from "@mui/material/colors";
|
|
||||||
import {
|
import {
|
||||||
createFileRoute,
|
createFileRoute,
|
||||||
|
Link,
|
||||||
useNavigate,
|
useNavigate,
|
||||||
useRouter,
|
useRouter,
|
||||||
} from "@tanstack/react-router";
|
} from "@tanstack/react-router";
|
||||||
import { useShallow } from "zustand/shallow";
|
import React, { type FormEvent, useState } from "react";
|
||||||
import { useBackdropStore } from "@/utils/store/backdrop.js";
|
import LoginShell from "@/components/loginShell";
|
||||||
|
import { saveUser } from "@/utils/storage/user";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/login/manual")({
|
export const Route = createFileRoute("/_api/login/manual")({
|
||||||
component: UserLoginManual,
|
component: UserLoginManual,
|
||||||
@@ -35,191 +24,112 @@ export const Route = createFileRoute("/_api/login/manual")({
|
|||||||
});
|
});
|
||||||
|
|
||||||
function UserLoginManual() {
|
function UserLoginManual() {
|
||||||
const [rememberMe, setRememberMe] = useState(true);
|
|
||||||
// console.log(Route.useRouteContext());
|
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const createApi = useApiInContext((s) => s.createApi);
|
const createApi = useApiInContext((s) => s.createApi);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const navigate = useNavigate();
|
||||||
const searchParams = Route.useSearch();
|
const searchParams = Route.useSearch();
|
||||||
|
|
||||||
const server = useQuery({
|
|
||||||
queryKey: ["login", "manual", "serverInfo"],
|
|
||||||
queryFn: async () =>
|
|
||||||
api ? (await getBrandingApi(api).getBrandingOptions()).data : null,
|
|
||||||
});
|
|
||||||
|
|
||||||
const navigate = useNavigate();
|
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
|
||||||
|
|
||||||
const [username, setUsername] = useState("");
|
const [username, setUsername] = useState("");
|
||||||
const [password, setPassword] = useState<{
|
const [password, setPassword] = useState("");
|
||||||
password: string | undefined;
|
const [showPassword, setShowPassword] = useState(false);
|
||||||
showpass: boolean;
|
const [rememberMe, setRememberMe] = useState(true);
|
||||||
}>({
|
const [error, setError] = useState<string | null>(null);
|
||||||
showpass: false,
|
|
||||||
password: "",
|
|
||||||
});
|
|
||||||
|
|
||||||
const handlePassword =
|
const handleLogin = useMutation({
|
||||||
(prop: "password" | "showpass") =>
|
mutationKey: ["login", "authenticate"],
|
||||||
(event: ChangeEvent<HTMLInputElement>) => {
|
mutationFn: async () => {
|
||||||
setPassword({
|
if (!api) throw new Error("Api is not available");
|
||||||
...password,
|
|
||||||
[prop]: event.target.value,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleShowPassword = () => {
|
|
||||||
setPassword({
|
|
||||||
...password,
|
|
||||||
showpass: !password.showpass,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleLoginFn = async (event: FormEvent<HTMLFormElement>) => {
|
|
||||||
event.preventDefault();
|
|
||||||
try {
|
|
||||||
if (!api) {
|
|
||||||
throw new Error("Api is not available");
|
|
||||||
}
|
|
||||||
const authenticate = await api.authenticateUserByName(
|
const authenticate = await api.authenticateUserByName(
|
||||||
username,
|
username.trim(),
|
||||||
password.password,
|
password,
|
||||||
);
|
);
|
||||||
if (!authenticate.data?.AccessToken) {
|
if (!authenticate.data?.AccessToken) {
|
||||||
throw new Error("Access token not available");
|
throw new Error("Access token not available");
|
||||||
}
|
}
|
||||||
createApi(api.basePath, authenticate.data?.AccessToken);
|
createApi(api.basePath, authenticate.data.AccessToken);
|
||||||
|
if (rememberMe) {
|
||||||
if (rememberMe)
|
|
||||||
await saveUser(
|
await saveUser(
|
||||||
username,
|
username.trim(),
|
||||||
authenticate.data.AccessToken,
|
authenticate.data.AccessToken,
|
||||||
authenticate.data.User?.Id ?? "",
|
authenticate.data.User?.Id ?? "",
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onSuccess: () => {
|
||||||
router.invalidate().finally(() => {
|
router.invalidate().finally(() => {
|
||||||
navigate({ to: searchParams.redirect || "/home", replace: true });
|
navigate({ to: searchParams.redirect || "/home", replace: true });
|
||||||
});
|
});
|
||||||
} catch (err) {
|
},
|
||||||
|
onError: (err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
enqueueSnackbar(
|
setError("Incorrect username or password.");
|
||||||
"Unable to authenticate. Please check your username and password",
|
setPassword("");
|
||||||
{ variant: "error" },
|
},
|
||||||
);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleLogin = useMutation({
|
|
||||||
mutationKey: ["login", "authenticate"],
|
|
||||||
mutationFn: handleLoginFn,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleCheckRememberMe = (
|
const handleSubmit = (event: FormEvent<HTMLFormElement>) => {
|
||||||
_: ChangeEvent<HTMLInputElement>,
|
event.preventDefault();
|
||||||
checked: boolean,
|
if (!username.trim()) {
|
||||||
) => {
|
setError("Enter your username.");
|
||||||
setRememberMe(checked);
|
return;
|
||||||
|
}
|
||||||
|
setError(null);
|
||||||
|
handleLogin.mutate();
|
||||||
};
|
};
|
||||||
|
|
||||||
const setBackdrop = useBackdropStore(
|
|
||||||
useShallow((state) => state.setBackdrop),
|
|
||||||
);
|
|
||||||
useEffect(() => {
|
|
||||||
setBackdrop("");
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="login scrollY flex flex-center flex-column">
|
<LoginShell
|
||||||
<Paper
|
title="Sign in"
|
||||||
sx={{
|
subtitle="Use your username and password"
|
||||||
p: 4,
|
footer={
|
||||||
width: "100%",
|
<Link to="/login/list" className="login-link">
|
||||||
maxWidth: "600px",
|
<span className="material-symbols-rounded">group</span>
|
||||||
backgroundColor: "rgba(20, 20, 30, 0.7)",
|
Choose a profile instead
|
||||||
backdropFilter: "blur(24px) saturate(180%)",
|
</Link>
|
||||||
backgroundImage:
|
}
|
||||||
"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0))",
|
|
||||||
border: "1px solid rgba(255, 255, 255, 0.08)",
|
|
||||||
boxShadow: "0 20px 50px rgba(0,0,0,0.5)",
|
|
||||||
borderRadius: 4,
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
gap: 3,
|
|
||||||
mb: 3,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Typography
|
|
||||||
variant="h4"
|
|
||||||
align="center"
|
|
||||||
sx={{
|
|
||||||
fontWeight: "bold",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Login
|
|
||||||
</Typography>
|
|
||||||
<form
|
|
||||||
className="flex flex-column"
|
|
||||||
style={{ gap: "1.5em", width: "100%" }}
|
|
||||||
onSubmit={(e) => handleLogin.mutate(e)}
|
|
||||||
>
|
>
|
||||||
|
<form className="login-form" onSubmit={handleSubmit} noValidate>
|
||||||
<TextField
|
<TextField
|
||||||
variant="outlined"
|
|
||||||
label="Username" // Label helps accessibility, theme handles style
|
|
||||||
fullWidth
|
fullWidth
|
||||||
onChange={(e) => setUsername(e.currentTarget.value)}
|
autoFocus
|
||||||
slotProps={{
|
label="Username"
|
||||||
input: {
|
variant="outlined"
|
||||||
startAdornment: (
|
autoComplete="username"
|
||||||
<InputAdornment position="start">
|
value={username}
|
||||||
<span
|
onChange={(e) => {
|
||||||
className="material-symbols-rounded"
|
setUsername(e.target.value);
|
||||||
style={{ opacity: 0.5 }}
|
setError(null);
|
||||||
>
|
|
||||||
person
|
|
||||||
</span>
|
|
||||||
</InputAdornment>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
}}
|
}}
|
||||||
|
error={Boolean(error) && !username.trim()}
|
||||||
/>
|
/>
|
||||||
<TextField
|
<TextField
|
||||||
fullWidth
|
fullWidth
|
||||||
type={password.showpass ? "text" : "password"}
|
|
||||||
onChange={handlePassword("password")}
|
|
||||||
label="Password"
|
label="Password"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
|
type={showPassword ? "text" : "password"}
|
||||||
|
autoComplete="current-password"
|
||||||
|
value={password}
|
||||||
|
onChange={(e) => {
|
||||||
|
setPassword(e.target.value);
|
||||||
|
setError(null);
|
||||||
|
}}
|
||||||
|
error={Boolean(error) && Boolean(username.trim())}
|
||||||
|
helperText={error ?? "Leave blank if your account has no password"}
|
||||||
slotProps={{
|
slotProps={{
|
||||||
input: {
|
input: {
|
||||||
startAdornment: (
|
|
||||||
<InputAdornment position="start">
|
|
||||||
<span
|
|
||||||
className="material-symbols-rounded"
|
|
||||||
style={{ opacity: 0.5 }}
|
|
||||||
>
|
|
||||||
key
|
|
||||||
</span>
|
|
||||||
</InputAdornment>
|
|
||||||
),
|
|
||||||
endAdornment: (
|
endAdornment: (
|
||||||
<InputAdornment position="end">
|
<InputAdornment position="end">
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={handleShowPassword}
|
onClick={() => setShowPassword((show) => !show)}
|
||||||
edge="end"
|
edge="end"
|
||||||
sx={{
|
aria-label={
|
||||||
color: "rgba(255,255,255,0.7)",
|
showPassword ? "Hide password" : "Show password"
|
||||||
"&:hover": { color: "#fff" },
|
}
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{password.showpass ? (
|
|
||||||
<span className="material-symbols-rounded">
|
<span className="material-symbols-rounded">
|
||||||
visibility
|
{showPassword ? "visibility_off" : "visibility"}
|
||||||
</span>
|
</span>
|
||||||
) : (
|
|
||||||
<span className="material-symbols-rounded">
|
|
||||||
visibility_off
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</InputAdornment>
|
</InputAdornment>
|
||||||
),
|
),
|
||||||
@@ -227,92 +137,29 @@ function UserLoginManual() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<div className="login-form-options">
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={
|
control={
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={rememberMe}
|
checked={rememberMe}
|
||||||
onChange={handleCheckRememberMe}
|
onChange={(_, checked) => setRememberMe(checked)}
|
||||||
sx={{
|
|
||||||
color: "rgba(255,255,255,0.5)",
|
|
||||||
"&.Mui-checked": {
|
|
||||||
color: "primary.main",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
label={
|
label="Keep me signed in"
|
||||||
<Typography variant="body2" sx={{ opacity: 0.7 }}>
|
|
||||||
Remember me
|
|
||||||
</Typography>
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-column" style={{ gap: "1em" }}>
|
<Button
|
||||||
<LoadingButton
|
className="login-form-submit"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
type="submit"
|
type="submit"
|
||||||
loading={handleLogin.isPending}
|
|
||||||
sx={{ width: "100%", height: 48, borderRadius: 2 }}
|
|
||||||
size="large"
|
size="large"
|
||||||
|
fullWidth
|
||||||
|
loading={handleLogin.isPending || handleLogin.isSuccess}
|
||||||
>
|
>
|
||||||
Login
|
Sign in
|
||||||
</LoadingButton>
|
|
||||||
<Button
|
|
||||||
color="inherit"
|
|
||||||
variant="text"
|
|
||||||
sx={{
|
|
||||||
width: "100%",
|
|
||||||
color: "rgba(255,255,255,0.5)",
|
|
||||||
"&:hover": {
|
|
||||||
color: "white",
|
|
||||||
bgcolor: "rgba(255,255,255,0.05)",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
onClick={() => navigate({ to: "/setup/server/list" })}
|
|
||||||
>
|
|
||||||
Change Server
|
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</Paper>
|
</LoginShell>
|
||||||
{server.isSuccess && server.data?.LoginDisclaimer && (
|
|
||||||
<Paper
|
|
||||||
elevation={0}
|
|
||||||
sx={{
|
|
||||||
padding: "1.5em",
|
|
||||||
borderRadius: "16px",
|
|
||||||
width: "100%",
|
|
||||||
maxWidth: "450px",
|
|
||||||
backgroundColor: "rgba(33, 150, 243, 0.1)",
|
|
||||||
border: "1px solid rgba(33, 150, 243, 0.2)",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="flex flex-row flex-align-center"
|
|
||||||
style={{ gap: "0.5em", marginBottom: "0.5em" }}
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
className="material-symbols-rounded"
|
|
||||||
style={{
|
|
||||||
color: blue[400],
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
info
|
|
||||||
</span>
|
|
||||||
<Typography
|
|
||||||
variant="subtitle1"
|
|
||||||
sx={{
|
|
||||||
fontWeight: "bold",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Notice
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
<Typography variant="body2" style={{ opacity: 0.8, lineHeight: 1.6 }}>
|
|
||||||
{server.data.LoginDisclaimer}
|
|
||||||
</Typography>
|
|
||||||
</Paper>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ import Tab from "@mui/material/Tab";
|
|||||||
import Tabs from "@mui/material/Tabs";
|
import Tabs from "@mui/material/Tabs";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { AnimatePresence, motion, useScroll } from "motion/react";
|
import { AnimatePresence, motion } from "motion/react";
|
||||||
import React, {
|
import React, {
|
||||||
type ReactNode,
|
type ReactNode,
|
||||||
useEffect,
|
useEffect,
|
||||||
@@ -21,19 +21,40 @@ import React, {
|
|||||||
} from "react";
|
} from "react";
|
||||||
|
|
||||||
import LikeButton from "@/components/buttons/likeButton";
|
import LikeButton from "@/components/buttons/likeButton";
|
||||||
|
import PlayButton from "@/components/buttons/playButton";
|
||||||
import { Card } from "@/components/card/card";
|
import { Card } from "@/components/card/card";
|
||||||
import ItemHeader from "@/components/itemHeader";
|
import ItemHeader from "@/components/itemHeader";
|
||||||
import { ArtistAlbum } from "@/components/layouts/artist/artistAlbum";
|
import { ArtistAlbum } from "@/components/layouts/artist/artistAlbum";
|
||||||
import MusicTrack from "@/components/musicTrack";
|
import MusicTrack from "@/components/musicTrack";
|
||||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||||
import ShowMoreText from "@/components/showMoreText";
|
import ShowMoreText from "@/components/showMoreText";
|
||||||
import useParallax from "@/utils/hooks/useParallax";
|
|
||||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||||
import "./artist.scss";
|
import "./artist.scss";
|
||||||
|
|
||||||
|
import type { Api } from "@jellyfin/sdk";
|
||||||
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import IconButton from "@mui/material/IconButton";
|
||||||
|
import Tooltip from "@mui/material/Tooltip";
|
||||||
import { createFileRoute } from "@tanstack/react-router";
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
import IconLink from "@/components/iconLink";
|
import IconLink from "@/components/iconLink";
|
||||||
import { useCentralStore } from "@/utils/store/central";
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
import { playItemFromQueue } from "@/utils/store/playback";
|
||||||
|
import { setQueue } from "@/utils/store/queue";
|
||||||
|
|
||||||
|
/** Queues the given tracks in random order and starts playing. */
|
||||||
|
const shuffleAndPlay = (
|
||||||
|
tracks: BaseItemDto[],
|
||||||
|
userId: string | undefined,
|
||||||
|
api: Api | undefined,
|
||||||
|
) => {
|
||||||
|
const shuffled = [...tracks];
|
||||||
|
for (let i = shuffled.length - 1; i > 0; i--) {
|
||||||
|
const j = Math.floor(Math.random() * (i + 1));
|
||||||
|
[shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
|
||||||
|
}
|
||||||
|
setQueue(shuffled, 0);
|
||||||
|
playItemFromQueue(0, userId, api);
|
||||||
|
};
|
||||||
|
|
||||||
type TabPanelProp = {
|
type TabPanelProp = {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
@@ -167,15 +188,29 @@ function ArtistTitlePage() {
|
|||||||
|
|
||||||
const [animationDirection, setAnimationDirection] = useState("forward");
|
const [animationDirection, setAnimationDirection] = useState("forward");
|
||||||
|
|
||||||
const { setBackdrop } = useBackdropStore();
|
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||||
|
const backdropTag = item.data?.BackdropImageTags?.[0];
|
||||||
|
const backdropHash =
|
||||||
|
(backdropTag && item.data?.ImageBlurHashes?.Backdrop?.[backdropTag]) || "";
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (item.isSuccess && item.data) {
|
setBackdrop(backdropHash);
|
||||||
setBackdrop(`${api?.basePath}/Items/${item.data.Id}/Images/Backdrop`);
|
}, [backdropHash, setBackdrop]);
|
||||||
}
|
|
||||||
}, [item.isSuccess]);
|
|
||||||
|
|
||||||
const scrollTargetRef = useRef<HTMLDivElement | null>(null);
|
const scrollTargetRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
|
const pluralize = (count: number, word: string) =>
|
||||||
|
`${count} ${count === 1 ? word : `${word}s`}`;
|
||||||
|
const catalogueSummary = [
|
||||||
|
artistDiscography.data?.TotalRecordCount
|
||||||
|
? pluralize(artistDiscography.data.TotalRecordCount, "album")
|
||||||
|
: null,
|
||||||
|
artistSongs.data?.TotalRecordCount
|
||||||
|
? pluralize(artistSongs.data.TotalRecordCount, "song")
|
||||||
|
: null,
|
||||||
|
]
|
||||||
|
.filter(Boolean)
|
||||||
|
.join(" · ");
|
||||||
|
|
||||||
if (item.isPending) {
|
if (item.isPending) {
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
@@ -214,6 +249,33 @@ function ArtistTitlePage() {
|
|||||||
scrollTargetRef={scrollTargetRef}
|
scrollTargetRef={scrollTargetRef}
|
||||||
>
|
>
|
||||||
<div className="item-hero-buttons-container">
|
<div className="item-hero-buttons-container">
|
||||||
|
<div className="flex flex-row" style={{ width: "100%" }}>
|
||||||
|
<PlayButton
|
||||||
|
item={item.data}
|
||||||
|
itemType={BaseItemKind.MusicArtist}
|
||||||
|
userId={user?.Id}
|
||||||
|
audio
|
||||||
|
buttonProps={{ fullWidth: true }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-row" style={{ gap: "1em" }}>
|
||||||
|
<Tooltip title="Shuffle">
|
||||||
|
<span>
|
||||||
|
<IconButton
|
||||||
|
aria-label="Shuffle"
|
||||||
|
disabled={!artistSongs.data?.Items?.length}
|
||||||
|
onClick={() =>
|
||||||
|
shuffleAndPlay(
|
||||||
|
artistSongs.data?.Items ?? [],
|
||||||
|
user?.Id,
|
||||||
|
api,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded">shuffle</span>
|
||||||
|
</IconButton>
|
||||||
|
</span>
|
||||||
|
</Tooltip>
|
||||||
<LikeButton
|
<LikeButton
|
||||||
itemName={item.data.Name}
|
itemName={item.data.Name}
|
||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
@@ -222,9 +284,15 @@ function ArtistTitlePage() {
|
|||||||
userId={user?.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</ItemHeader>
|
</ItemHeader>
|
||||||
<div className="item-detail">
|
<div className="item-detail">
|
||||||
<div style={{ width: "100%", overflow: "hidden" }}>
|
<div style={{ width: "100%", overflow: "hidden" }}>
|
||||||
|
{catalogueSummary && (
|
||||||
|
<Typography sx={{ opacity: 0.8, mb: 1.5 }}>
|
||||||
|
{catalogueSummary}
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
<ShowMoreText
|
<ShowMoreText
|
||||||
content={item.data.Overview ?? ""}
|
content={item.data.Overview ?? ""}
|
||||||
collapsedLines={4}
|
collapsedLines={4}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ $cardWidth: 22%;
|
|||||||
.item-detail {
|
.item-detail {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 35%;
|
grid-template-columns: 1fr 35%;
|
||||||
justify-items: center;
|
justify-items: start;
|
||||||
align-items: start;
|
align-items: start;
|
||||||
gap: 3em;
|
gap: 3em;
|
||||||
|
|
||||||
|
|||||||
+215
-146
@@ -29,163 +29,195 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&-container {
|
&-container {
|
||||||
display: flex;
|
// Art size drives the whole left column so everything fits the viewport.
|
||||||
flex-direction: column;
|
--np-size: min(420px, 44vh, 80vw);
|
||||||
|
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: var(--np-size) minmax(0, 560px);
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: clamp(2rem, 6vw, 6rem);
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 1rem;
|
padding: 5rem 3rem 2.5rem;
|
||||||
gap: 1rem;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
color: white;
|
color: white;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
@media (min-width: 900px) {
|
@media (max-width: 900px) {
|
||||||
flex-direction: row;
|
grid-template-columns: minmax(0, var(--np-size));
|
||||||
align-items: center;
|
grid-template-rows: auto minmax(0, 1fr);
|
||||||
justify-content: center;
|
align-items: start;
|
||||||
padding: 4rem;
|
padding: 4.5rem 1rem 1rem;
|
||||||
gap: 3rem;
|
|
||||||
max-width: 1600px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-left-column {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
width: 100%;
|
overflow-y: auto;
|
||||||
max-width: 500px;
|
|
||||||
margin: 0 auto;
|
|
||||||
min-height: 0; // Allow shrinking
|
|
||||||
|
|
||||||
@media (min-width: 900px) {
|
|
||||||
gap: 2rem;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-right-column {
|
&-now-playing {
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100%;
|
gap: 1.25rem;
|
||||||
|
width: var(--np-size);
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
|
&-art {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 600px;
|
aspect-ratio: 1;
|
||||||
|
border-radius: 1.25rem;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@include glass-effect($blur: 20px, $bg-color: rgba(255, 255, 255, 0.05));
|
box-shadow: 0 24px 60px rgb(0 0 0 / 0.55);
|
||||||
border-radius: 1.5rem;
|
background: rgb(255 255 255 / 0.08);
|
||||||
padding: 0;
|
display: flex;
|
||||||
min-height: 0; // Allow shrinking
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.material-symbols-rounded {
|
||||||
|
font-size: 6rem;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-right-content {
|
&-meta {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-text {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 1.5rem;
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-subtitle {
|
||||||
|
opacity: 0.7;
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-transport {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
// Spread prev / play / next evenly with shuffle and repeat
|
||||||
|
.player-controls {
|
||||||
|
display: contents !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Toggle-style buttons read as "off" until enabled
|
||||||
|
> .MuiIconButton-root,
|
||||||
|
> span > .MuiIconButton-root {
|
||||||
|
color: rgb(255 255 255 / 0.55);
|
||||||
|
}
|
||||||
|
> .MuiIconButton-root.is-active {
|
||||||
|
color: $clr-accent-default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-utility {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-volume {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex: 1;
|
||||||
|
max-width: 14rem;
|
||||||
|
opacity: 0.85;
|
||||||
|
|
||||||
|
// Secondary control: neutral instead of the accent colour
|
||||||
|
.MuiSlider-root {
|
||||||
|
color: rgb(255 255 255 / 0.85);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-side {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1.5rem;
|
||||||
|
height: min(80vh, 760px);
|
||||||
|
min-height: 0;
|
||||||
|
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
height: 70vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-lyrics {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
scrollbar-width: none;
|
||||||
|
// Fade lines in and out at the edges
|
||||||
|
mask-image: linear-gradient(transparent, black 15%, black 85%, transparent);
|
||||||
|
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// "Up next" sits on a quiet card; no blur so the artwork backdrop stays clean
|
||||||
|
&-queue {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
// The queue view scrolls its own list so the header stays put
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 1rem 1.25rem 0;
|
||||||
|
|
||||||
|
.queue {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
background: rgb(0 0 0 / 0.22);
|
||||||
|
border: 1px solid rgb(255 255 255 / 0.06);
|
||||||
|
border-radius: 1.25rem;
|
||||||
|
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
width: 6px;
|
width: 6px;
|
||||||
}
|
}
|
||||||
&::-webkit-scrollbar-track {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
&::-webkit-scrollbar-thumb {
|
&::-webkit-scrollbar-thumb {
|
||||||
background: rgba(255, 255, 255, 0.2);
|
background: rgba(255, 255, 255, 0.2);
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
&::-webkit-scrollbar-thumb:hover {
|
|
||||||
background: rgba(255, 255, 255, 0.3);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&-info {
|
&.has-lyrics .audio-side-queue {
|
||||||
width: 100%;
|
flex: 0 1 auto;
|
||||||
display: flex;
|
max-height: 40%;
|
||||||
flex-direction: column;
|
|
||||||
align-items: flex-start; // Left align text
|
|
||||||
text-align: left;
|
|
||||||
gap: 0.5em;
|
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
|
||||||
align-items: center;
|
|
||||||
text-align: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&-image {
|
|
||||||
width: 100%;
|
|
||||||
aspect-ratio: 1;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
border-radius: 1.5rem;
|
|
||||||
box-shadow: 0 20px 50px rgba(0,0,0,0.5);
|
|
||||||
transition: transform 0.3s ease;
|
|
||||||
|
|
||||||
&-container {
|
|
||||||
width: 100%;
|
|
||||||
aspect-ratio: 1;
|
|
||||||
position: relative;
|
|
||||||
border-radius: 1.5rem;
|
|
||||||
overflow: hidden;
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
|
||||||
max-width: 70vw;
|
|
||||||
max-height: 35vh;
|
|
||||||
margin: 0 auto 1rem auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-icon {
|
|
||||||
font-size: 8em;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
background: rgba(255, 255, 255, 0.1);
|
|
||||||
border-radius: 1.5rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&-controls {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 1.5em;
|
|
||||||
margin-top: 1rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-queue {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
width: 100%;
|
|
||||||
align-items: stretch; // Ensure items take full width
|
|
||||||
|
|
||||||
// Remove old track styles as we now use QueueListItem
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&-lyrics {
|
&-lyrics {
|
||||||
padding: 1rem;
|
|
||||||
text-align: center;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100%;
|
|
||||||
|
|
||||||
&-container {
|
&-container {
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: flex-start;
|
||||||
padding-bottom: 4rem; // Space for unsynced notice
|
// Room above and below so the active line can scroll to the middle
|
||||||
|
padding: 35% 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-status {
|
&-status {
|
||||||
@@ -193,54 +225,91 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
|
||||||
opacity: 0.7;
|
|
||||||
min-height: 200px;
|
min-height: 200px;
|
||||||
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-line {
|
&-line {
|
||||||
margin-bottom: 1.5rem;
|
margin: 0 0 0.6rem !important;
|
||||||
opacity: 0.5;
|
padding: 0.35rem 0.75rem;
|
||||||
transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
border-radius: 0.75rem;
|
||||||
border-radius: 1rem;
|
font-size: clamp(1.25rem, 2vw, 1.85rem) !important;
|
||||||
padding: 0.75rem 1.5rem;
|
line-height: 1.35 !important;
|
||||||
cursor: pointer;
|
font-weight: 700 !important;
|
||||||
font-size: 1.5rem !important;
|
text-align: left;
|
||||||
line-height: 1.6 !important;
|
opacity: 0.35;
|
||||||
font-weight: 600 !important;
|
transition: opacity 0.35s ease, filter 0.35s ease;
|
||||||
max-width: 90%;
|
filter: blur(0.4px);
|
||||||
|
|
||||||
&:hover {
|
|
||||||
opacity: 0.8;
|
|
||||||
background: rgba(255, 255, 255, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
&[data-active-lyric="true"] {
|
&[data-active-lyric="true"] {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
font-weight: 800 !important;
|
filter: none;
|
||||||
transform: scale(1.05);
|
}
|
||||||
text-shadow: 0 0 30px rgba(255,255,255,0.3);
|
|
||||||
color: var(--primary-color, #90caf9);
|
&[data-seekable="true"] {
|
||||||
|
cursor: pointer;
|
||||||
|
transition: opacity 0.35s ease, filter 0.35s ease, background-color 0.2s ease;
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus-visible {
|
||||||
|
opacity: 0.8;
|
||||||
|
filter: none;
|
||||||
|
background: rgb(255 255 255 / 0.08);
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
&[data-active-lyric="true"]:hover {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unsynced lyrics: plain readable text, no highlight
|
||||||
|
&[data-has-synced-lyrics="false"] {
|
||||||
|
.audio-lyrics-container {
|
||||||
|
padding: 1rem 0.5rem 4rem;
|
||||||
|
}
|
||||||
|
.audio-lyrics-line {
|
||||||
|
font-size: 1.15rem !important;
|
||||||
|
font-weight: 500 !important;
|
||||||
|
opacity: 0.85;
|
||||||
|
filter: none;
|
||||||
|
margin-bottom: 0.25rem !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-unsynced-notice {
|
&-unsynced-notice {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
bottom: 1rem;
|
bottom: 1rem;
|
||||||
display: flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
padding: 0.5rem 1rem;
|
padding: 0.4rem 0.9rem;
|
||||||
background: rgba(0, 0, 0, 0.4);
|
margin-left: 0.5rem;
|
||||||
backdrop-filter: blur(10px);
|
background: rgb(0 0 0 / 0.35);
|
||||||
border-radius: 2rem;
|
border-radius: 2rem;
|
||||||
margin-top: auto;
|
opacity: 0.85;
|
||||||
opacity: 0.8;
|
|
||||||
|
|
||||||
.material-symbols-rounded {
|
.material-symbols-rounded {
|
||||||
font-size: 1.2rem;
|
font-size: 1.1rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.player-progress-stacked {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
.MuiSlider-root {
|
||||||
|
padding: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-times {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
opacity: 0.7;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
+242
-141
@@ -1,90 +1,103 @@
|
|||||||
import { Box, Tab, Tabs, Typography } from "@mui/material";
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { createFileRoute } from "@tanstack/react-router";
|
import {
|
||||||
|
Dialog,
|
||||||
|
DialogContent,
|
||||||
|
DialogTitle,
|
||||||
|
IconButton,
|
||||||
|
ListItemIcon,
|
||||||
|
Menu,
|
||||||
|
MenuItem,
|
||||||
|
Tooltip,
|
||||||
|
Typography,
|
||||||
|
} from "@mui/material";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import { createFileRoute, Link, useNavigate } from "@tanstack/react-router";
|
||||||
import React, { useEffect, useMemo, useState } from "react";
|
import React, { useEffect, useMemo, useState } from "react";
|
||||||
|
import LikeButton from "@/components/buttons/likeButton";
|
||||||
|
import LyricsPanel, {
|
||||||
|
getLyricsQueryOptions,
|
||||||
|
} from "@/components/playback/audioPlayer/components/LyricsPanel";
|
||||||
|
import PlayerControls from "@/components/playback/audioPlayer/components/PlayerControls";
|
||||||
|
import PlayerProgress from "@/components/playback/audioPlayer/components/PlayerProgress";
|
||||||
|
import PlayerVolume from "@/components/playback/audioPlayer/components/PlayerVolume";
|
||||||
|
import StatsPanel from "@/components/playback/audioPlayer/components/StatsPanel";
|
||||||
|
import QueueView from "@/components/queue/queueView";
|
||||||
|
import { secToTicks, ticksToSec } from "@/utils/date/time";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import { getItemQueryOptions } from "@/utils/queries/items";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import {
|
import {
|
||||||
setIsMuted,
|
setIsMuted,
|
||||||
setVolume,
|
setVolume,
|
||||||
useAudioPlayback,
|
useAudioPlayback,
|
||||||
} from "@/utils/store/audioPlayback";
|
} from "@/utils/store/audioPlayback";
|
||||||
import useQueue from "@/utils/store/queue";
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
import useQueue, {
|
||||||
|
cycleRepeatMode,
|
||||||
|
type RepeatMode,
|
||||||
|
shuffleUpcoming,
|
||||||
|
} from "@/utils/store/queue";
|
||||||
|
|
||||||
import "./audio.scss";
|
import "./audio.scss";
|
||||||
|
|
||||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
|
||||||
import LyricsPanel from "@/components/playback/audioPlayer/components/LyricsPanel";
|
|
||||||
import PlayerControls from "@/components/playback/audioPlayer/components/PlayerControls";
|
|
||||||
import PlayerProgress from "@/components/playback/audioPlayer/components/PlayerProgress";
|
|
||||||
import PlayerVolume from "@/components/playback/audioPlayer/components/PlayerVolume";
|
|
||||||
import QueuePanel from "@/components/playback/audioPlayer/components/QueuePanel";
|
|
||||||
import StatsPanel from "@/components/playback/audioPlayer/components/StatsPanel";
|
|
||||||
import { secToTicks, ticksToSec } from "@/utils/date/time";
|
|
||||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/player/audio")({
|
export const Route = createFileRoute("/_api/player/audio")({
|
||||||
component: AudioPlayerRoute,
|
component: AudioPlayerRoute,
|
||||||
});
|
});
|
||||||
|
|
||||||
const SEEK_AMOUNT = 10;
|
const repeatLabels: Record<RepeatMode, string> = {
|
||||||
|
off: "Repeat off",
|
||||||
|
all: "Repeat all",
|
||||||
|
one: "Repeat one",
|
||||||
|
};
|
||||||
|
|
||||||
const AudioInfo = React.memo(
|
/** Artists (linked) and album (linked) for the current track. */
|
||||||
({
|
const TrackSubtitle = ({ item }: { item: BaseItemDto }) => {
|
||||||
item,
|
const artists = item.ArtistItems?.length
|
||||||
imageUrl,
|
? item.ArtistItems
|
||||||
}: {
|
: (item.AlbumArtists ?? []);
|
||||||
item: BaseItemDto | undefined | null;
|
return (
|
||||||
imageUrl: string | undefined;
|
<Typography
|
||||||
}) => (
|
variant="subtitle1"
|
||||||
<>
|
className="audio-now-playing-subtitle"
|
||||||
<div className="audio-info-image-container">
|
noWrap
|
||||||
{imageUrl ? (
|
>
|
||||||
<img
|
{artists.map((artist, index) => (
|
||||||
alt={item?.Name ?? "Music"}
|
<React.Fragment key={artist.Id ?? artist.Name}>
|
||||||
src={imageUrl}
|
{index > 0 && ", "}
|
||||||
className="audio-info-image"
|
{artist.Id ? (
|
||||||
/>
|
<Link to="/music/artist/$id" params={{ id: artist.Id }}>
|
||||||
|
{artist.Name}
|
||||||
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
<div className="audio-info-image-icon">
|
artist.Name
|
||||||
<span
|
)}
|
||||||
className="material-symbols-rounded"
|
</React.Fragment>
|
||||||
style={{ fontSize: "inherit" }}
|
))}
|
||||||
>
|
{item.Album && (
|
||||||
music_note
|
<>
|
||||||
</span>
|
{artists.length > 0 && " · "}
|
||||||
</div>
|
{item.AlbumId ? (
|
||||||
|
<Link to="/music/album/$id" params={{ id: item.AlbumId }}>
|
||||||
|
{item.Album}
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
item.Album
|
||||||
)}
|
)}
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="audio-info">
|
|
||||||
<Typography
|
|
||||||
variant="h4"
|
|
||||||
noWrap
|
|
||||||
style={{ width: "100%", marginBottom: "0.2em" }}
|
|
||||||
sx={{
|
|
||||||
fontWeight: 700,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{item?.Name}
|
|
||||||
</Typography>
|
|
||||||
<Typography
|
|
||||||
variant="h6"
|
|
||||||
className="opacity-07"
|
|
||||||
noWrap
|
|
||||||
style={{ width: "100%" }}
|
|
||||||
sx={{
|
|
||||||
fontWeight: 400,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{item?.Artists?.join(", ")}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
),
|
)}
|
||||||
);
|
</Typography>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
function AudioPlayerRoute() {
|
function AudioPlayerRoute() {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const [queue, currentTrack] = useQueue((s) => [s.tracks, s.currentItemIndex]);
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [queue, currentTrack, repeatMode] = useQueue((s) => [
|
||||||
|
s.tracks,
|
||||||
|
s.currentItemIndex,
|
||||||
|
s.repeatMode,
|
||||||
|
]);
|
||||||
const [item, audioPlayerRef, volume, isMuted] = useAudioPlayback((s) => [
|
const [item, audioPlayerRef, volume, isMuted] = useAudioPlayback((s) => [
|
||||||
s.item,
|
s.item,
|
||||||
s.player.ref,
|
s.player.ref,
|
||||||
@@ -94,7 +107,8 @@ function AudioPlayerRoute() {
|
|||||||
|
|
||||||
const [progress, setProgress] = useState(0);
|
const [progress, setProgress] = useState(0);
|
||||||
const [playing, setPlaying] = useState(false);
|
const [playing, setPlaying] = useState(false);
|
||||||
const [tabValue, setTabValue] = useState(0);
|
const [menuAnchor, setMenuAnchor] = useState<HTMLElement | null>(null);
|
||||||
|
const [statsOpen, setStatsOpen] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const player = audioPlayerRef?.current;
|
const player = audioPlayerRef?.current;
|
||||||
@@ -107,7 +121,6 @@ function AudioPlayerRoute() {
|
|||||||
player.addEventListener("play", updatePlaying);
|
player.addEventListener("play", updatePlaying);
|
||||||
player.addEventListener("pause", updatePlaying);
|
player.addEventListener("pause", updatePlaying);
|
||||||
|
|
||||||
// Initial state
|
|
||||||
setProgress(player.currentTime);
|
setProgress(player.currentTime);
|
||||||
setPlaying(!player.paused);
|
setPlaying(!player.paused);
|
||||||
|
|
||||||
@@ -118,19 +131,22 @@ function AudioPlayerRoute() {
|
|||||||
};
|
};
|
||||||
}, [audioPlayerRef?.current, item?.Id]);
|
}, [audioPlayerRef?.current, item?.Id]);
|
||||||
|
|
||||||
|
// Fresh user data so the like button reflects changes immediately.
|
||||||
|
const itemDetails = useQuery({
|
||||||
|
...getItemQueryOptions(item?.Id ?? "", api, user?.Id),
|
||||||
|
enabled: Boolean(item?.Id && api && user?.Id),
|
||||||
|
});
|
||||||
|
const lyrics = useQuery(getLyricsQueryOptions(item, api));
|
||||||
|
const hasLyrics = (lyrics.data?.Lyrics?.length ?? 0) > 0;
|
||||||
|
|
||||||
const handlePlayPause = () => {
|
const handlePlayPause = () => {
|
||||||
const player = audioPlayerRef?.current;
|
const player = audioPlayerRef?.current;
|
||||||
if (player) {
|
if (!player) return;
|
||||||
if (player.paused) {
|
if (player.paused) {
|
||||||
player.play();
|
player.play();
|
||||||
} else {
|
} else {
|
||||||
player.pause();
|
player.pause();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSeek = (value: number) => {
|
|
||||||
setProgress(ticksToSec(value));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSeekCommit = (value: number) => {
|
const handleSeekCommit = (value: number) => {
|
||||||
@@ -141,23 +157,6 @@ function AudioPlayerRoute() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRewind = () => {
|
|
||||||
const player = audioPlayerRef?.current;
|
|
||||||
if (player) {
|
|
||||||
player.currentTime -= SEEK_AMOUNT;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleForward = () => {
|
|
||||||
const player = audioPlayerRef?.current;
|
|
||||||
if (player) {
|
|
||||||
player.currentTime += SEEK_AMOUNT;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const handleTabChange = (_: React.SyntheticEvent, newValue: number) => {
|
|
||||||
setTabValue(newValue);
|
|
||||||
};
|
|
||||||
|
|
||||||
const imageUrl = useMemo(
|
const imageUrl = useMemo(
|
||||||
() =>
|
() =>
|
||||||
item?.ImageTags?.Primary
|
item?.ImageTags?.Primary
|
||||||
@@ -169,6 +168,11 @@ function AudioPlayerRoute() {
|
|||||||
[item?.Id, item?.ImageTags?.Primary, api],
|
[item?.Id, item?.ImageTags?.Primary, api],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const hasUpcoming = (queue?.length ?? 0) > currentTrack + 1;
|
||||||
|
const isFavorite =
|
||||||
|
itemDetails.data?.UserData?.IsFavorite ?? item?.UserData?.IsFavorite;
|
||||||
|
const artistId = item?.ArtistItems?.[0]?.Id ?? item?.AlbumArtists?.[0]?.Id;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="audio-background">
|
<div className="audio-background">
|
||||||
@@ -176,36 +180,79 @@ function AudioPlayerRoute() {
|
|||||||
<img src={imageUrl} alt="" className="audio-background-image" />
|
<img src={imageUrl} alt="" className="audio-background-image" />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="audio-container" key={item?.Id}>
|
<div className="audio-container">
|
||||||
<div className="audio-left-column">
|
<section className="audio-now-playing" key={item?.Id}>
|
||||||
<AudioInfo item={item} imageUrl={imageUrl} />
|
<div className="audio-now-playing-art">
|
||||||
|
{imageUrl ? (
|
||||||
|
<img alt={item?.Name ?? "Album art"} src={imageUrl} />
|
||||||
|
) : (
|
||||||
|
<span className="material-symbols-rounded">music_note</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="audio-now-playing-meta">
|
||||||
|
<div className="audio-now-playing-text">
|
||||||
|
<Typography
|
||||||
|
variant="h5"
|
||||||
|
sx={{
|
||||||
|
fontWeight: 700,
|
||||||
|
lineHeight: 1.2,
|
||||||
|
overflowWrap: "anywhere",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{item?.Name}
|
||||||
|
</Typography>
|
||||||
|
{item && <TrackSubtitle item={item} />}
|
||||||
|
</div>
|
||||||
|
<LikeButton
|
||||||
|
itemId={item?.Id ?? undefined}
|
||||||
|
itemName={item?.Name}
|
||||||
|
isFavorite={isFavorite}
|
||||||
|
queryKey={["item", item?.Id ?? ""]}
|
||||||
|
userId={user?.Id}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<PlayerProgress
|
<PlayerProgress
|
||||||
|
layout="stacked"
|
||||||
progress={secToTicks(progress)}
|
progress={secToTicks(progress)}
|
||||||
duration={item?.RunTimeTicks ?? 1}
|
duration={item?.RunTimeTicks ?? 1}
|
||||||
onSeek={handleSeek}
|
onSeek={(value) => setProgress(ticksToSec(value))}
|
||||||
onSeekCommit={handleSeekCommit}
|
onSeekCommit={handleSeekCommit}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="audio-info-controls">
|
<div className="audio-now-playing-transport">
|
||||||
|
<Tooltip title="Shuffle upcoming">
|
||||||
|
<span>
|
||||||
|
<IconButton
|
||||||
|
onClick={shuffleUpcoming}
|
||||||
|
disabled={!hasUpcoming}
|
||||||
|
aria-label="Shuffle upcoming"
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded">shuffle</span>
|
||||||
|
</IconButton>
|
||||||
|
</span>
|
||||||
|
</Tooltip>
|
||||||
<PlayerControls
|
<PlayerControls
|
||||||
playing={playing}
|
playing={playing}
|
||||||
onPlayPause={handlePlayPause}
|
onPlayPause={handlePlayPause}
|
||||||
size="large"
|
size="large"
|
||||||
onRewind={handleRewind}
|
|
||||||
onForward={handleForward}
|
|
||||||
/>
|
/>
|
||||||
|
<Tooltip title={repeatLabels[repeatMode]}>
|
||||||
|
<IconButton
|
||||||
|
onClick={cycleRepeatMode}
|
||||||
|
aria-label={repeatLabels[repeatMode]}
|
||||||
|
className={repeatMode !== "off" ? "is-active" : undefined}
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded">
|
||||||
|
{repeatMode === "one" ? "repeat_one" : "repeat"}
|
||||||
|
</span>
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div className="audio-now-playing-utility">
|
||||||
className="audio-info-volume"
|
<div className="audio-now-playing-volume">
|
||||||
style={{
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "center",
|
|
||||||
width: "100%",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<PlayerVolume
|
<PlayerVolume
|
||||||
volume={volume}
|
volume={volume}
|
||||||
isMuted={isMuted}
|
isMuted={isMuted}
|
||||||
@@ -213,45 +260,99 @@ function AudioPlayerRoute() {
|
|||||||
onMuteToggle={() => setIsMuted(!isMuted)}
|
onMuteToggle={() => setIsMuted(!isMuted)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<IconButton
|
||||||
|
onClick={(e) => setMenuAnchor(e.currentTarget)}
|
||||||
<div className="audio-right-column">
|
aria-label="More options"
|
||||||
<Box sx={{ borderBottom: 1, borderColor: "rgba(255,255,255,0.1)" }}>
|
>
|
||||||
<Tabs
|
<span className="material-symbols-rounded">more_horiz</span>
|
||||||
value={tabValue}
|
</IconButton>
|
||||||
onChange={handleTabChange}
|
<Menu
|
||||||
aria-label="audio player tabs"
|
anchorEl={menuAnchor}
|
||||||
variant="fullWidth"
|
open={Boolean(menuAnchor)}
|
||||||
scrollButtons="auto"
|
onClose={() => setMenuAnchor(null)}
|
||||||
allowScrollButtonsMobile
|
anchorOrigin={{ vertical: "top", horizontal: "right" }}
|
||||||
textColor="inherit"
|
transformOrigin={{ vertical: "bottom", horizontal: "right" }}
|
||||||
indicatorColor="primary"
|
>
|
||||||
sx={{
|
<MenuItem
|
||||||
"& .MuiTab-root": {
|
disabled={!item?.AlbumId}
|
||||||
color: "rgba(255,255,255,0.5)",
|
onClick={() => {
|
||||||
"&.Mui-selected": { color: "white" },
|
setMenuAnchor(null);
|
||||||
},
|
if (item?.AlbumId) {
|
||||||
|
navigate({
|
||||||
|
to: "/music/album/$id",
|
||||||
|
params: { id: item.AlbumId },
|
||||||
|
});
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Tab label="Queue" />
|
<ListItemIcon>
|
||||||
<Tab label="Lyrics" />
|
<span className="material-symbols-rounded">album</span>
|
||||||
<Tab label="Stats" />
|
</ListItemIcon>
|
||||||
</Tabs>
|
Go to album
|
||||||
</Box>
|
</MenuItem>
|
||||||
|
<MenuItem
|
||||||
|
disabled={!artistId}
|
||||||
|
onClick={() => {
|
||||||
|
setMenuAnchor(null);
|
||||||
|
if (artistId) {
|
||||||
|
navigate({
|
||||||
|
to: "/music/artist/$id",
|
||||||
|
params: { id: artistId },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ListItemIcon>
|
||||||
|
<span className="material-symbols-rounded">person</span>
|
||||||
|
</ListItemIcon>
|
||||||
|
Go to artist
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem
|
||||||
|
onClick={() => {
|
||||||
|
setMenuAnchor(null);
|
||||||
|
setStatsOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ListItemIcon>
|
||||||
|
<span className="material-symbols-rounded">query_stats</span>
|
||||||
|
</ListItemIcon>
|
||||||
|
Stats for nerds
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<div className="audio-right-content">
|
<aside
|
||||||
{tabValue === 0 && queue && (
|
className={`audio-side ${hasLyrics ? "has-lyrics" : ""}`}
|
||||||
<QueuePanel queue={queue} currentTrackIndex={currentTrack} />
|
aria-label="Lyrics and queue"
|
||||||
|
>
|
||||||
|
{hasLyrics && (
|
||||||
|
<div className="audio-side-lyrics">
|
||||||
|
<LyricsPanel
|
||||||
|
item={item}
|
||||||
|
api={api}
|
||||||
|
currentTime={progress}
|
||||||
|
onSeek={handleSeekCommit}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
{tabValue === 1 && (
|
<div className="audio-side-queue">
|
||||||
<LyricsPanel item={item} api={api} currentTime={progress} />
|
<QueueView variant="panel" />
|
||||||
)}
|
</div>
|
||||||
{tabValue === 2 && (
|
</aside>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Dialog
|
||||||
|
open={statsOpen}
|
||||||
|
onClose={() => setStatsOpen(false)}
|
||||||
|
maxWidth="sm"
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
|
<DialogTitle>Stats for nerds</DialogTitle>
|
||||||
|
<DialogContent>
|
||||||
<StatsPanel item={item} audioRef={audioPlayerRef} />
|
<StatsPanel item={item} audioRef={audioPlayerRef} />
|
||||||
)}
|
</DialogContent>
|
||||||
</div>
|
</Dialog>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ function addSubtitleTrackToReactPlayer(
|
|||||||
|
|
||||||
const track = document.createElement("track");
|
const track = document.createElement("track");
|
||||||
const separator = subtitleTracks.url.includes("?") ? "&" : "?";
|
const separator = subtitleTracks.url.includes("?") ? "&" : "?";
|
||||||
const urlParams = apiKey ? `${separator}api_key=${apiKey}` : "";
|
const urlParams = apiKey ? `${separator}ApiKey=${apiKey}` : "";
|
||||||
track.src = `${baseUrl}${subtitleTracks.url}${urlParams}`;
|
track.src = `${baseUrl}${subtitleTracks.url}${urlParams}`;
|
||||||
track.kind = "subtitles";
|
track.kind = "subtitles";
|
||||||
track.srclang = reqSubTrack.Language ?? "en";
|
track.srclang = reqSubTrack.Language ?? "en";
|
||||||
@@ -458,7 +458,7 @@ export function VideoPlayer() {
|
|||||||
let pgsRenderer: PgsRenderer | undefined;
|
let pgsRenderer: PgsRenderer | undefined;
|
||||||
const apiKey = api?.accessToken;
|
const apiKey = api?.accessToken;
|
||||||
const separator = mediaSource.subtitle.url?.includes("?") ? "&" : "?";
|
const separator = mediaSource.subtitle.url?.includes("?") ? "&" : "?";
|
||||||
const urlParams = apiKey ? `${separator}api_key=${apiKey}` : "";
|
const urlParams = apiKey ? `${separator}ApiKey=${apiKey}` : "";
|
||||||
|
|
||||||
if (
|
if (
|
||||||
mediaSource.subtitle.format === "ass" ||
|
mediaSource.subtitle.format === "ass" ||
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ function PhotosPlayer() {
|
|||||||
|
|
||||||
if (pathToSave) {
|
if (pathToSave) {
|
||||||
download(
|
download(
|
||||||
`${api?.basePath}/Items/${currentPhoto?.Id}/Download?api_key=${api?.accessToken}`,
|
`${api?.basePath}/Items/${currentPhoto?.Id}/Download?ApiKey=${api?.accessToken}`,
|
||||||
pathToSave,
|
pathToSave,
|
||||||
);
|
);
|
||||||
enqueueSnackbar("Image download queued.", { variant: "info" });
|
enqueueSnackbar("Image download queued.", { variant: "info" });
|
||||||
@@ -122,7 +122,7 @@ function PhotosPlayer() {
|
|||||||
key={currentPhoto?.Id ?? "noPhoto"}
|
key={currentPhoto?.Id ?? "noPhoto"}
|
||||||
src={
|
src={
|
||||||
currentPhoto
|
currentPhoto
|
||||||
? `${api?.basePath}/Items/${currentPhoto.Id}/Download?api_key=${api?.accessToken}`
|
? `${api?.basePath}/Items/${currentPhoto.Id}/Download?ApiKey=${api?.accessToken}`
|
||||||
: brokenImage
|
: brokenImage
|
||||||
}
|
}
|
||||||
alt="Item"
|
alt="Item"
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ function SearchAppBar({
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
handleClearCategories();
|
handleClearCategories();
|
||||||
}}
|
}}
|
||||||
sx={{ mr: 2, p: 0.5 }}
|
sx={{ p: 0.5 }}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="material-symbols-rounded"
|
className="material-symbols-rounded"
|
||||||
|
|||||||
@@ -127,6 +127,11 @@
|
|||||||
|
|
||||||
fieldset { border: none; }
|
fieldset { border: none; }
|
||||||
|
|
||||||
|
// Keep the clear button clear of the absolutely positioned dropdown arrow
|
||||||
|
&.MuiInputBase-adornedEnd {
|
||||||
|
padding-right: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: rgba(255, 255, 255, 0.05);
|
background-color: rgba(255, 255, 255, 0.05);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,11 @@
|
|||||||
padding: 1.5em 1em; // Reduced padding
|
padding: 1.5em 1em; // Reduced padding
|
||||||
gap: 1em; // Reduced gap
|
gap: 1em; // Reduced gap
|
||||||
|
|
||||||
|
html.is-macos & {
|
||||||
|
// Overlay titlebar: leave room for the traffic lights.
|
||||||
|
padding-top: 2.9em;
|
||||||
|
}
|
||||||
|
|
||||||
&-controls {
|
&-controls {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ function SettingsRoute() {
|
|||||||
navigate({ to: "/home" });
|
navigate({ to: "/home" });
|
||||||
}, []);
|
}, []);
|
||||||
return (
|
return (
|
||||||
<div className="settings-page-container">
|
<div className="settings-page-container" data-tauri-drag-region>
|
||||||
<div className="settings-sidebar">
|
<div className="settings-sidebar">
|
||||||
<div className="settings-sidebar-controls">
|
<div className="settings-sidebar-controls">
|
||||||
<BackButton />
|
<BackButton />
|
||||||
|
|||||||
@@ -0,0 +1,158 @@
|
|||||||
|
import type { Api } from "@jellyfin/sdk";
|
||||||
|
import type {
|
||||||
|
BaseItemDto,
|
||||||
|
ImageInfo,
|
||||||
|
ImageType,
|
||||||
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import { getImageApi } from "@jellyfin/sdk/lib/utils/api/image-api";
|
||||||
|
import { queryOptions } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
export type HeroArtwork = {
|
||||||
|
url: string;
|
||||||
|
/** Primary (poster) is portrait; it must not be cropped into a 16:9 hero. */
|
||||||
|
isPortrait: boolean;
|
||||||
|
/** BlurHash for the chosen image, used as an instant placeholder. */
|
||||||
|
blurhash?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** All images Jellyfin actually stores for an item (with real resolutions). */
|
||||||
|
export const getItemImagesQueryOptions = (
|
||||||
|
api: Api | null | undefined,
|
||||||
|
itemId: string | undefined | null,
|
||||||
|
) =>
|
||||||
|
queryOptions({
|
||||||
|
queryKey: ["item", "images", itemId],
|
||||||
|
queryFn: async () => {
|
||||||
|
if (!api || !itemId) return [];
|
||||||
|
const result = await getImageApi(api).getItemImageInfos({ itemId });
|
||||||
|
return result.data;
|
||||||
|
},
|
||||||
|
enabled: Boolean(api && itemId),
|
||||||
|
staleTime: 30 * 60_000,
|
||||||
|
});
|
||||||
|
|
||||||
|
/** Prefer the biggest wide image Jellyfin has; Backdrop wins ties over Thumb. */
|
||||||
|
const pickWideImage = (images: ImageInfo[]): ImageInfo | undefined => {
|
||||||
|
const wide = images.filter((image) => {
|
||||||
|
if (image.ImageType !== "Backdrop" && image.ImageType !== "Thumb") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const width = image.Width ?? 0;
|
||||||
|
const height = image.Height ?? 0;
|
||||||
|
return height > 0 && width / height >= 1.3;
|
||||||
|
});
|
||||||
|
wide.sort((a, b) => {
|
||||||
|
const area = (i: ImageInfo) => (i.Width ?? 0) * (i.Height ?? 0);
|
||||||
|
const diff = area(b) - area(a);
|
||||||
|
if (diff !== 0) return diff;
|
||||||
|
return a.ImageType === "Backdrop" ? -1 : 1;
|
||||||
|
});
|
||||||
|
return wide[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
const imageUrl = (
|
||||||
|
api: Api,
|
||||||
|
itemId: string,
|
||||||
|
type: ImageType,
|
||||||
|
tag: string | null | undefined,
|
||||||
|
params: { maxWidth?: number; maxHeight?: number },
|
||||||
|
) => {
|
||||||
|
const query = new URLSearchParams();
|
||||||
|
if (tag) query.set("tag", tag);
|
||||||
|
if (params.maxWidth) query.set("maxWidth", String(params.maxWidth));
|
||||||
|
if (params.maxHeight) query.set("maxHeight", String(params.maxHeight));
|
||||||
|
query.set("quality", "90");
|
||||||
|
return `${api.basePath}/Items/${itemId}/Images/${type}?${query.toString()}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const blurhashFor = (
|
||||||
|
item: BaseItemDto,
|
||||||
|
type: ImageType,
|
||||||
|
tag: string | null | undefined,
|
||||||
|
) => (tag ? item.ImageBlurHashes?.[type]?.[tag] ?? undefined : undefined);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Best artwork for the home hero (a wide 16:9 area).
|
||||||
|
*
|
||||||
|
* Jellyfin usually stores several images per item; the player/hero should use
|
||||||
|
* a wide one: Backdrop, then Thumb (often a 4K still). A Primary poster is 2:3,
|
||||||
|
* so it is only used when nothing wide exists, and the caller renders it as a
|
||||||
|
* poster on a blurred background instead of stretching it.
|
||||||
|
*/
|
||||||
|
export const resolveHeroArtwork = (
|
||||||
|
api: Api | undefined,
|
||||||
|
item: BaseItemDto | undefined | null,
|
||||||
|
images: ImageInfo[] | undefined,
|
||||||
|
): HeroArtwork | undefined => {
|
||||||
|
if (!api || !item?.Id) return undefined;
|
||||||
|
|
||||||
|
const wide = images?.length ? pickWideImage(images) : undefined;
|
||||||
|
if (wide) {
|
||||||
|
return {
|
||||||
|
url: imageUrl(api, item.Id, wide.ImageType as ImageType, wide.ImageTag, {
|
||||||
|
maxWidth: 1920,
|
||||||
|
}),
|
||||||
|
isPortrait: false,
|
||||||
|
blurhash: blurhashFor(item, wide.ImageType as ImageType, wide.ImageTag),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fall back to tags while /Images is still loading (or for servers that
|
||||||
|
// don't return image infos).
|
||||||
|
if (item.BackdropImageTags?.length) {
|
||||||
|
return {
|
||||||
|
url: imageUrl(api, item.Id, "Backdrop", item.BackdropImageTags[0], {
|
||||||
|
maxWidth: 1920,
|
||||||
|
}),
|
||||||
|
isPortrait: false,
|
||||||
|
blurhash: blurhashFor(item, "Backdrop", item.BackdropImageTags[0]),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (item.ImageTags?.Thumb) {
|
||||||
|
return {
|
||||||
|
url: imageUrl(api, item.Id, "Thumb", item.ImageTags.Thumb, {
|
||||||
|
maxWidth: 1920,
|
||||||
|
}),
|
||||||
|
isPortrait: false,
|
||||||
|
blurhash: blurhashFor(item, "Thumb", item.ImageTags.Thumb),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (item.ImageTags?.Primary) {
|
||||||
|
return {
|
||||||
|
url: imageUrl(api, item.Id, "Primary", item.ImageTags.Primary, {
|
||||||
|
maxHeight: 1400,
|
||||||
|
}),
|
||||||
|
isPortrait: true,
|
||||||
|
blurhash: blurhashFor(item, "Primary", item.ImageTags.Primary),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (item.ParentBackdropItemId && item.ParentBackdropImageTags?.length) {
|
||||||
|
return {
|
||||||
|
url: imageUrl(
|
||||||
|
api,
|
||||||
|
item.ParentBackdropItemId,
|
||||||
|
"Backdrop",
|
||||||
|
item.ParentBackdropImageTags[0],
|
||||||
|
{ maxWidth: 1920 },
|
||||||
|
),
|
||||||
|
isPortrait: false,
|
||||||
|
blurhash: blurhashFor(
|
||||||
|
item,
|
||||||
|
"Backdrop",
|
||||||
|
item.ParentBackdropImageTags[0],
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Sharp poster URL for the poster-on-blurred-background hero treatment. */
|
||||||
|
export const getHeroPosterUrl = (
|
||||||
|
api: Api | undefined,
|
||||||
|
item: BaseItemDto | undefined | null,
|
||||||
|
) => {
|
||||||
|
if (!api || !item?.Id || !item.ImageTags?.Primary) return undefined;
|
||||||
|
return imageUrl(api, item.Id, "Primary", item.ImageTags.Primary, {
|
||||||
|
maxHeight: 900,
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
import type { BaseItemDto, ImageType } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
|
||||||
|
export type ResolvedItemImage = {
|
||||||
|
/** Item that actually owns the image (episodes borrow their series' artwork). */
|
||||||
|
itemId: string;
|
||||||
|
imageType: ImageType;
|
||||||
|
tag?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const ownFallbackOrder: Partial<Record<ImageType, ImageType[]>> = {
|
||||||
|
Primary: ["Primary", "Thumb", "Backdrop"],
|
||||||
|
Thumb: ["Thumb", "Backdrop", "Primary"],
|
||||||
|
Backdrop: ["Backdrop", "Thumb", "Primary"],
|
||||||
|
Logo: ["Logo", "Primary", "Thumb"],
|
||||||
|
Banner: ["Banner", "Backdrop", "Primary"],
|
||||||
|
Art: ["Art", "Backdrop", "Primary"],
|
||||||
|
Disc: ["Disc", "Backdrop", "Primary"],
|
||||||
|
};
|
||||||
|
|
||||||
|
const hasOwnImage = (item: BaseItemDto, type: ImageType): boolean => {
|
||||||
|
if (type === "Backdrop") {
|
||||||
|
return Boolean(item.BackdropImageTags?.length || item.ImageTags?.Backdrop);
|
||||||
|
}
|
||||||
|
return Boolean(item.ImageTags?.[type]);
|
||||||
|
};
|
||||||
|
|
||||||
|
const ownTag = (item: BaseItemDto, type: ImageType): string | undefined => {
|
||||||
|
if (type === "Backdrop") {
|
||||||
|
return item.BackdropImageTags?.[0] ?? item.ImageTags?.Backdrop ?? undefined;
|
||||||
|
}
|
||||||
|
return item.ImageTags?.[type] ?? undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pick the best real image for an item. Many items do not have the requested
|
||||||
|
* image type (movies rarely have `Thumb`, episodes borrow artwork from their
|
||||||
|
* series), so try the item's own images first, then the series/parent ones.
|
||||||
|
* Returns `undefined` when there is genuinely nothing to show.
|
||||||
|
*/
|
||||||
|
export const resolveItemImage = (
|
||||||
|
item: BaseItemDto | undefined | null,
|
||||||
|
preferred: ImageType = "Primary",
|
||||||
|
options: { seriesId?: string | null } = {},
|
||||||
|
): ResolvedItemImage | undefined => {
|
||||||
|
if (!item) return undefined;
|
||||||
|
|
||||||
|
// Library grids show one poster per episode, owned by the series.
|
||||||
|
const seriesId = options.seriesId ?? item.SeriesId;
|
||||||
|
if (options.seriesId && seriesId) {
|
||||||
|
return {
|
||||||
|
itemId: seriesId,
|
||||||
|
imageType: "Primary",
|
||||||
|
tag: item.SeriesPrimaryImageTag ?? undefined,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const order = ownFallbackOrder[preferred] ?? [preferred];
|
||||||
|
for (const type of order) {
|
||||||
|
if (hasOwnImage(item, type) && item.Id) {
|
||||||
|
return { itemId: item.Id, imageType: type, tag: ownTag(item, type) };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Episodes (and some other child items) inherit artwork from their parent.
|
||||||
|
if (seriesId && item.SeriesPrimaryImageTag) {
|
||||||
|
return {
|
||||||
|
itemId: seriesId,
|
||||||
|
imageType: "Primary",
|
||||||
|
tag: item.SeriesPrimaryImageTag,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (seriesId && item.Type === "Episode") {
|
||||||
|
return { itemId: seriesId, imageType: "Primary" };
|
||||||
|
}
|
||||||
|
// Audio inherits its cover from the album.
|
||||||
|
if (item.AlbumId) {
|
||||||
|
return { itemId: item.AlbumId, imageType: "Primary" };
|
||||||
|
}
|
||||||
|
if (item.ParentBackdropItemId && item.ParentBackdropImageTags?.length) {
|
||||||
|
return {
|
||||||
|
itemId: item.ParentBackdropItemId,
|
||||||
|
imageType: "Backdrop",
|
||||||
|
tag: item.ParentBackdropImageTags[0],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nothing known: keep the requested type so the server gets a chance, but
|
||||||
|
// only when the item exists. Callers render their icon placeholder on 404.
|
||||||
|
if (item.Id) {
|
||||||
|
return { itemId: item.Id, imageType: preferred };
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Image tag for the resolved type, so caches reuse the exact displayed image. */
|
||||||
|
export const getImageTag = (
|
||||||
|
item: BaseItemDto | undefined | null,
|
||||||
|
type: ImageType,
|
||||||
|
series = false,
|
||||||
|
): string | undefined => {
|
||||||
|
if (!item) return undefined;
|
||||||
|
if (series && type === "Primary" && item.SeriesPrimaryImageTag) {
|
||||||
|
return item.SeriesPrimaryImageTag;
|
||||||
|
}
|
||||||
|
return ownTag(item, type);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getAvailableImageType = (
|
||||||
|
item: BaseItemDto | undefined | null,
|
||||||
|
preferred: ImageType = "Primary",
|
||||||
|
): ImageType => {
|
||||||
|
if (!item) return preferred;
|
||||||
|
const order = ownFallbackOrder[preferred] ?? [preferred];
|
||||||
|
for (const type of order) {
|
||||||
|
if (hasOwnImage(item, type)) return type;
|
||||||
|
}
|
||||||
|
return preferred;
|
||||||
|
};
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
import type { Api } from "@jellyfin/sdk";
|
import type { Api } from "@jellyfin/sdk";
|
||||||
import { BaseItemKind, ItemFields } from "@jellyfin/sdk/lib/generated-client";
|
import {
|
||||||
|
BaseItemKind,
|
||||||
|
ItemFields,
|
||||||
|
ItemSortBy,
|
||||||
|
LocationType,
|
||||||
|
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 { queryOptions } from "@tanstack/react-query";
|
import { queryOptions } from "@tanstack/react-query";
|
||||||
|
|
||||||
@@ -51,7 +57,7 @@ export const getLatestItemsQueryOptions = (
|
|||||||
if (!userId) {
|
if (!userId) {
|
||||||
throw Error("User ID is not defined");
|
throw Error("User ID is not defined");
|
||||||
}
|
}
|
||||||
const media = await getLibraryApi(api).getLatestMedia({
|
const request = {
|
||||||
userId: userId,
|
userId: userId,
|
||||||
fields: [
|
fields: [
|
||||||
ItemFields.Overview,
|
ItemFields.Overview,
|
||||||
@@ -61,15 +67,25 @@ export const getLatestItemsQueryOptions = (
|
|||||||
ItemFields.MediaStreams,
|
ItemFields.MediaStreams,
|
||||||
ItemFields.MediaSources,
|
ItemFields.MediaSources,
|
||||||
],
|
],
|
||||||
includeItemTypes: [
|
includeItemTypes: [BaseItemKind.Movie, BaseItemKind.Series],
|
||||||
BaseItemKind.Movie,
|
|
||||||
BaseItemKind.Series,
|
|
||||||
BaseItemKind.MusicAlbum,
|
|
||||||
],
|
|
||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
enableImages: true,
|
enableImages: true,
|
||||||
});
|
};
|
||||||
|
const media = await getLibraryApi(api).getLatestMedia(request);
|
||||||
|
if (media.data.length > 0) {
|
||||||
return media.data;
|
return media.data;
|
||||||
|
}
|
||||||
|
// Jellyfin 12 returns nothing for /Items/Latest without a parentId, so fall back
|
||||||
|
// to the most recently added movies and series.
|
||||||
|
const recent = await getLibraryApi(api).getItems({
|
||||||
|
...request,
|
||||||
|
recursive: true,
|
||||||
|
sortBy: [ItemSortBy.DateCreated],
|
||||||
|
sortOrder: [SortOrder.Descending],
|
||||||
|
excludeLocationTypes: [LocationType.Virtual],
|
||||||
|
limit: 16,
|
||||||
|
});
|
||||||
|
return recent.data.Items ?? [];
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ type AudioPlaybackStore = {
|
|||||||
player: {
|
player: {
|
||||||
currentTick: number;
|
currentTick: number;
|
||||||
playing: boolean;
|
playing: boolean;
|
||||||
ref: React.RefObject<HTMLAudioElement> | null;
|
ref: React.RefObject<HTMLAudioElement | null> | null;
|
||||||
volume: number;
|
volume: number;
|
||||||
isMuted: boolean;
|
isMuted: boolean;
|
||||||
};
|
};
|
||||||
@@ -93,7 +93,7 @@ export const generateAudioStreamUrl = (
|
|||||||
const urlOptions = {
|
const urlOptions = {
|
||||||
userId,
|
userId,
|
||||||
deviceId,
|
deviceId,
|
||||||
api_key,
|
ApiKey: api_key,
|
||||||
container: directPlayContainers,
|
container: directPlayContainers,
|
||||||
maxAudioChannels: transcodingProfile?.MaxAudioChannels,
|
maxAudioChannels: transcodingProfile?.MaxAudioChannels,
|
||||||
transcodingContainer: transcodingProfile?.Container,
|
transcodingContainer: transcodingProfile?.Container,
|
||||||
@@ -108,29 +108,28 @@ export const generateAudioStreamUrl = (
|
|||||||
return `${basePath}/Audio/${itemId}/universal?${urlParams}`;
|
return `${basePath}/Audio/${itemId}/universal?${urlParams}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setAudioRef = (ref: React.RefObject<HTMLAudioElement>) => {
|
// Player updates must replace `player` (not mutate it) so zustand notifies subscribers.
|
||||||
const state = useAudioPlayback.getState();
|
const updatePlayer = (patch: Partial<AudioPlaybackStore["player"]>) => {
|
||||||
state.player.ref = ref;
|
useAudioPlayback.setState((state) => ({
|
||||||
useAudioPlayback.setState(state);
|
player: { ...state.player, ...patch },
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const setAudioRef = (ref: React.RefObject<HTMLAudioElement | null>) => {
|
||||||
|
updatePlayer({ ref });
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setProgress = (ticks: number) => {
|
export const setProgress = (ticks: number) => {
|
||||||
const state = useAudioPlayback.getState();
|
updatePlayer({ currentTick: ticks });
|
||||||
state.player.currentTick = ticks;
|
|
||||||
useAudioPlayback.setState(state);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setVolume = (volume: number) => {
|
export const setVolume = (volume: number) => {
|
||||||
const state = useAudioPlayback.getState();
|
updatePlayer({ volume });
|
||||||
state.player.volume = volume;
|
|
||||||
useAudioPlayback.setState(state);
|
|
||||||
setPlayerVolume("audio", volume);
|
setPlayerVolume("audio", volume);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setIsMuted = (isMuted: boolean) => {
|
export const setIsMuted = (isMuted: boolean) => {
|
||||||
const state = useAudioPlayback.getState();
|
updatePlayer({ isMuted });
|
||||||
state.player.isMuted = isMuted;
|
|
||||||
useAudioPlayback.setState(state);
|
|
||||||
setPlayerMuted("audio", isMuted);
|
setPlayerMuted("audio", isMuted);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -788,7 +788,7 @@ export const initializePlayback = async (args: {
|
|||||||
tag: source.ETag,
|
tag: source.ETag,
|
||||||
mediaSourceId: source.Id,
|
mediaSourceId: source.Id,
|
||||||
deviceId: api.deviceInfo.id,
|
deviceId: api.deviceInfo.id,
|
||||||
api_key: api.accessToken,
|
ApiKey: api.accessToken,
|
||||||
};
|
};
|
||||||
|
|
||||||
let playMethod: PlayMethod = PlayMethod.Transcode;
|
let playMethod: PlayMethod = PlayMethod.Transcode;
|
||||||
@@ -1045,7 +1045,7 @@ export const changeAudioTrack = async (trackIndex: number, api: Api) => {
|
|||||||
tag: mediaSource.MediaSources?.[0].ETag,
|
tag: mediaSource.MediaSources?.[0].ETag,
|
||||||
mediaSourceId: mediaSource.MediaSources?.[0].Id,
|
mediaSourceId: mediaSource.MediaSources?.[0].Id,
|
||||||
deviceId: api?.deviceInfo.id,
|
deviceId: api?.deviceInfo.id,
|
||||||
api_key: api?.accessToken,
|
ApiKey: api?.accessToken,
|
||||||
};
|
};
|
||||||
const urlParams = new URLSearchParams(urlOptions).toString();
|
const urlParams = new URLSearchParams(urlOptions).toString();
|
||||||
let playbackUrl = `${api?.basePath}/Videos/${mediaSource.MediaSources?.[0].Id}/stream.${mediaSource.MediaSources?.[0].Container}?${urlParams}`;
|
let playbackUrl = `${api?.basePath}/Videos/${mediaSource.MediaSources?.[0].Id}/stream.${mediaSource.MediaSources?.[0].Container}?${urlParams}`;
|
||||||
|
|||||||
@@ -8,12 +8,16 @@ interface QueueStore {
|
|||||||
* This index number should be equal to index of the item in tracks array to allow seamless playback of items having broken IndexNumber field.
|
* This index number should be equal to index of the item in tracks array to allow seamless playback of items having broken IndexNumber field.
|
||||||
*/
|
*/
|
||||||
currentItemIndex: number;
|
currentItemIndex: number;
|
||||||
|
repeatMode: RepeatMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type RepeatMode = "off" | "all" | "one";
|
||||||
|
|
||||||
const useQueue = createWithEqualityFn<QueueStore>(
|
const useQueue = createWithEqualityFn<QueueStore>(
|
||||||
() => ({
|
() => ({
|
||||||
tracks: [],
|
tracks: [],
|
||||||
currentItemIndex: 0,
|
currentItemIndex: 0,
|
||||||
|
repeatMode: "off",
|
||||||
}),
|
}),
|
||||||
shallow,
|
shallow,
|
||||||
);
|
);
|
||||||
@@ -22,7 +26,7 @@ export const setQueue = (
|
|||||||
tracks: BaseItemDto[] | undefined,
|
tracks: BaseItemDto[] | undefined,
|
||||||
currentItemIndex: number,
|
currentItemIndex: number,
|
||||||
) => {
|
) => {
|
||||||
useQueue.setState(() => ({ tracks, currentItemIndex }));
|
useQueue.setState({ tracks, currentItemIndex });
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setTrackIndex = (index: number) => {
|
export const setTrackIndex = (index: number) => {
|
||||||
@@ -54,6 +58,20 @@ export const removeFromQueue = (index: number) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Inserts a track at `index`, keeping the current track pointer on the same item. */
|
||||||
|
export const insertIntoQueue = (track: BaseItemDto, index: number) => {
|
||||||
|
useQueue.setState((state) => {
|
||||||
|
const tracks = [...(state.tracks ?? [])];
|
||||||
|
const at = Math.min(Math.max(index, 0), tracks.length);
|
||||||
|
tracks.splice(at, 0, track);
|
||||||
|
const currentItemIndex =
|
||||||
|
at <= state.currentItemIndex && tracks.length > 1
|
||||||
|
? state.currentItemIndex + 1
|
||||||
|
: state.currentItemIndex;
|
||||||
|
return { ...state, tracks, currentItemIndex };
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export const clearUpcoming = () => {
|
export const clearUpcoming = () => {
|
||||||
useQueue.setState((state) => {
|
useQueue.setState((state) => {
|
||||||
if (!state.tracks) return state;
|
if (!state.tracks) return state;
|
||||||
@@ -84,6 +102,31 @@ export const shuffleUpcoming = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const nextRepeatMode: Record<RepeatMode, RepeatMode> = {
|
||||||
|
off: "all",
|
||||||
|
all: "one",
|
||||||
|
one: "off",
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Cycles repeat mode: off → all → one → off */
|
||||||
|
export const cycleRepeatMode = () => {
|
||||||
|
useQueue.setState((state) => ({
|
||||||
|
...state,
|
||||||
|
repeatMode: nextRepeatMode[state.repeatMode],
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index to advance to after the current track, honouring "repeat all".
|
||||||
|
* Returns undefined at the end of the queue when not repeating.
|
||||||
|
*/
|
||||||
|
export const getNextTrackIndex = () => {
|
||||||
|
const { tracks, currentItemIndex, repeatMode } = useQueue.getState();
|
||||||
|
if (!tracks?.length) return undefined;
|
||||||
|
if (currentItemIndex + 1 < tracks.length) return currentItemIndex + 1;
|
||||||
|
return repeatMode === "all" ? 0 : undefined;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets the Queue store
|
* Resets the Queue store
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in new issue
Block a user