Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5171b7bb8 | ||
|
|
9211faabf0 | ||
|
|
422b1d6aa4 | ||
|
|
7f7866b28d | ||
|
|
1defb53945 | ||
|
|
73e3b865ab | ||
|
|
691df70aff | ||
|
|
6f2d5a5627 | ||
|
|
7804ab2b86 | ||
|
|
4ade92bccc | ||
|
|
ab1aa23725 | ||
|
|
0131a23dc2 | ||
|
|
72ca2fb4f3 | ||
|
|
b39a15449d | ||
|
|
cb83b05c7a | ||
|
|
32f5b3b3cf | ||
|
|
94e6a03e87 | ||
|
|
690070207b | ||
|
|
79c70e6d46 | ||
|
|
cf1f3c772d | ||
|
|
b870a119e5 | ||
|
|
0883cb0fe1 | ||
|
|
8519c12c45 | ||
|
|
d6c1b0992e | ||
|
|
9c3cc53278 | ||
|
|
abc7d68016 | ||
|
|
ad8d8545e9 | ||
|
|
1c8c048df0 | ||
|
|
c0402fe8cf | ||
|
|
ce6e4b681b | ||
|
|
6bf7f434b5 | ||
|
|
4834a31cb5 | ||
|
|
b49f187098 | ||
|
|
e41b5b3085 | ||
|
|
c19198e706 | ||
|
|
78c4b7a206 | ||
|
|
5579d5e5e8 | ||
|
|
e50ae60216 | ||
|
|
4bc6044ca2 | ||
|
|
7d55810f08 | ||
|
|
40651fd3d6 | ||
|
|
fdf43aba18 | ||
|
|
03bd7c027b | ||
|
|
995d75dbec | ||
|
|
4952d8842b | ||
|
|
f527d97912 | ||
|
|
ef8dfbc23a | ||
|
|
6576bfe5f3 | ||
|
|
3000146e66 | ||
|
|
81e0c3b9a8 | ||
|
|
27d8e04b0f | ||
|
|
50de0b7b51 | ||
|
|
64c5b7570b | ||
|
|
d46e143262 | ||
|
|
6542ed9487 | ||
|
|
d39c064600 | ||
|
|
d254d3033d | ||
|
|
3abf27724f | ||
|
|
120e283e3d | ||
|
|
706fb7b890 | ||
|
|
11b4a878ac | ||
|
|
6695bdc6ee | ||
|
|
17922127dd | ||
|
|
a135d1be5f | ||
|
|
88c42d8110 | ||
|
|
8e667a2253 | ||
|
|
e08eaea1d1 | ||
|
|
937e9385f2 | ||
|
|
bb2c0272a2 | ||
|
|
6b4d6ed0d3 | ||
|
|
374cba8f63 | ||
|
|
07522b50c5 | ||
|
|
257ff8e552 | ||
|
|
37e898e4cf | ||
|
|
65e5370dbf | ||
|
|
2d4b0d66b4 | ||
|
|
54d0b07666 | ||
|
|
9ac556d001 | ||
|
|
333fe09f45 | ||
|
|
a8ee9c190c | ||
|
|
0cf87da218 | ||
|
|
f919162dfc | ||
|
|
c9d16f4669 | ||
|
|
53311a1728 | ||
|
|
c4073f1368 | ||
|
|
c69a547379 | ||
|
|
7b0b22b611 | ||
|
|
47a486a3ad | ||
|
|
0f5482627a | ||
|
|
4ca90e713d | ||
|
|
093e40a929 | ||
|
|
797d0600c3 | ||
|
|
18d55a4af6 | ||
|
|
d7f3317913 | ||
|
|
52b73f7475 | ||
|
|
0c8b282469 | ||
|
|
25479b2278 | ||
|
|
dfb8eeee12 | ||
|
|
790f3f163b | ||
|
|
db74b4f58b | ||
|
|
18ebe4ef1e | ||
|
|
f0c8458dc4 | ||
|
|
80080e841a | ||
|
|
d60cb2b5fb | ||
|
|
7086892843 | ||
|
|
951cf61a89 | ||
|
|
ceee9311aa | ||
|
|
21a6e492f4 | ||
|
|
b916560c6a | ||
|
|
d3d5c5ac54 | ||
|
|
3f5e764cd7 | ||
|
|
4381b6e28e | ||
|
|
83c96cf65c | ||
|
|
4ff422ae61 | ||
|
|
c0d7d4e03d | ||
|
|
cd768a088b | ||
|
|
2f12fe0862 | ||
|
|
f6c0963f48 | ||
|
|
4ae8a087ed | ||
|
|
412e54fd82 | ||
|
|
51848a39ae | ||
|
|
295b8da8eb | ||
|
|
6d1c55dda5 | ||
|
|
0c47660501 | ||
|
|
e9b37d99aa | ||
|
|
f19ffb4361 | ||
|
|
ce533dde4b | ||
|
|
6d2448ef36 | ||
|
|
c572cb35cb | ||
|
|
f57e78b244 | ||
|
|
af8dec5844 | ||
|
|
7d2659f32b | ||
|
|
06015d7702 | ||
|
|
0847c2b2ef | ||
|
|
bc6d39b004 | ||
|
|
9f7fde2173 | ||
|
|
7410c8f3e3 | ||
|
|
fcf18c01e8 | ||
|
|
620b4ce253 | ||
|
|
9dbe11ce23 | ||
|
|
5d5f127525 | ||
|
|
d7f3892ff3 | ||
|
|
dc72f381e8 | ||
|
|
d238aeff1f | ||
|
|
1c38893c68 | ||
|
|
000e62873a | ||
|
|
5b322d49e6 | ||
|
|
232aad5e8a | ||
|
|
7aceb89e11 | ||
|
|
42c154f17a | ||
|
|
27cc14c1f5 | ||
|
|
cf8c5d4490 | ||
|
|
97526e29b4 | ||
|
|
e049ce9ad6 | ||
|
|
561daa7d81 | ||
|
|
2ad920af9d | ||
|
|
907753b041 | ||
|
|
591fce7e5c | ||
|
|
9d96667d60 | ||
|
|
5c8624a73c | ||
|
|
0319d9711e | ||
|
|
70da3b3754 | ||
|
|
98078585d6 | ||
|
|
cf66b8d20c | ||
|
|
a198e09864 | ||
|
|
25d9702283 | ||
|
|
0790f0afd5 | ||
|
|
240ed3b365 | ||
|
|
5cd9b57e1f | ||
|
|
88b016f6f5 | ||
|
|
8a459f588d | ||
|
|
6c5335648d | ||
|
|
fc9abf6c5b | ||
|
|
a53224f802 | ||
|
|
865c42b419 | ||
|
|
12f963d718 | ||
|
|
8917dd240a | ||
|
|
685ef4b2fc | ||
|
|
f141ddbaf3 | ||
|
|
6e55a287eb | ||
|
|
9c110ea8fa | ||
|
|
ebbe686a57 | ||
|
|
2cb10aa342 | ||
|
|
a64f5876f2 | ||
|
|
95a180e968 | ||
|
|
99ec17501d | ||
|
|
a7eab72639 | ||
|
|
81695a583d | ||
|
|
c6b5d6a4a2 | ||
|
|
7ef8e33669 | ||
|
|
9be02b6392 | ||
|
|
dd16f3a204 | ||
|
|
7e7f44ce94 | ||
|
|
61fa734629 | ||
|
|
45f67aac40 | ||
|
|
19343b4ea3 | ||
|
|
d08998f7d8 | ||
|
|
0fe7ba0f59 | ||
|
|
c8409d8a01 | ||
|
|
b0e08ce4bd | ||
|
|
0dde74ab70 | ||
|
|
60895ceecf | ||
|
|
500a90bcc0 | ||
|
|
24e07df249 | ||
|
|
d641ddfc98 | ||
|
|
e91834ad6d | ||
|
|
9d4d523d9d | ||
|
|
d586c3e38d | ||
|
|
61441b918c | ||
|
|
60b734c615 | ||
|
|
8115f2e9e7 | ||
|
|
78cabc421c | ||
|
|
31aad0f0d7 | ||
|
|
15241dd3d3 | ||
|
|
f0fd4fe353 | ||
|
|
7fb772c3b6 | ||
|
|
3f6bdb392f | ||
|
|
a1bb8f8e23 | ||
|
|
d78676560f | ||
|
|
b83eb3aea9 | ||
|
|
1265e2281b | ||
|
|
b8f2f9ae67 | ||
|
|
bf9ba21f39 | ||
|
|
8038680683 | ||
|
|
647dcc3690 | ||
|
|
e82ff1ff0c | ||
|
|
48af14b64f | ||
|
|
15e78a370c | ||
|
|
a19ea1c52f | ||
|
|
35f6c8f74a | ||
|
|
b73629ce80 | ||
|
|
9afe933d8d | ||
|
|
8f0f7b2218 | ||
|
|
74ea154954 | ||
|
|
cb4af781e2 | ||
|
|
9fd51f10ca | ||
|
|
43bdaa1ae2 |
No files matched your search
@@ -0,0 +1,15 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: [prayag17] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||||
|
polar: # Replace with a single Polar username
|
||||||
|
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
|
||||||
|
thanks_dev: # Replace with a single thanks.dev username
|
||||||
|
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||||
@@ -24,15 +24,8 @@ A clear and concise description of what you expected to happen.
|
|||||||
If applicable, add screenshots to help explain your problem.
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
**Desktop (please complete the following information):**
|
**Desktop (please complete the following information):**
|
||||||
- OS: [e.g. iOS]
|
- OS: [e.g. Windows]
|
||||||
- Browser [e.g. chrome, safari]
|
- Version [e.g. v0.0.6-dev]
|
||||||
- Version [e.g. 22]
|
- Jellyfin Version [e.g. 10.9]
|
||||||
|
|
||||||
**Smartphone (please complete the following information):**
|
|
||||||
- Device: [e.g. iPhone6]
|
|
||||||
- OS: [e.g. iOS8.1]
|
|
||||||
- Browser [e.g. stock browser, safari]
|
|
||||||
- Version [e.g. 22]
|
|
||||||
|
|
||||||
**Additional context**
|
**Additional context**
|
||||||
Add any other context about the problem here.
|
Add any other context about the problem here.
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
changelog:
|
||||||
|
categories:
|
||||||
|
- title: 🏕 Features
|
||||||
|
labels:
|
||||||
|
- '*'
|
||||||
|
exclude:
|
||||||
|
labels:
|
||||||
|
- dependencies
|
||||||
|
- title: 👒 Dependencies
|
||||||
|
labels:
|
||||||
|
- dependencies
|
||||||
@@ -13,12 +13,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v3
|
- uses: pnpm/action-setup@v4
|
||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
with:
|
with:
|
||||||
version: 7
|
version: 10
|
||||||
run_install: false
|
run_install: false
|
||||||
|
|
||||||
- name: Get pnpm store directory
|
- name: Get pnpm store directory
|
||||||
@@ -26,7 +26,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v5
|
||||||
name: Setup pnpm cache
|
name: Setup pnpm cache
|
||||||
with:
|
with:
|
||||||
path: ${{ env.STORE_PATH }}
|
path: ${{ env.STORE_PATH }}
|
||||||
@@ -35,7 +35,7 @@ jobs:
|
|||||||
${{ runner.os }}-pnpm-store-
|
${{ runner.os }}-pnpm-store-
|
||||||
|
|
||||||
- name: Sync node version and setup cache
|
- name: Sync node version and setup cache
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: "lts/*"
|
node-version: "lts/*"
|
||||||
cache: "pnpm"
|
cache: "pnpm"
|
||||||
@@ -61,7 +61,7 @@ jobs:
|
|||||||
environment: TAURI
|
environment: TAURI
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Install dependencies (ubuntu only)
|
- name: Install dependencies (ubuntu only)
|
||||||
if: matrix.platform == 'ubuntu-22.04'
|
if: matrix.platform == 'ubuntu-22.04'
|
||||||
@@ -78,10 +78,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
workspaces: "./src-tauri -> target"
|
workspaces: "./src-tauri -> target"
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v3
|
- uses: pnpm/action-setup@v4
|
||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
with:
|
with:
|
||||||
version: 7
|
version: 10
|
||||||
run_install: false
|
run_install: false
|
||||||
|
|
||||||
- name: Get pnpm store directory
|
- name: Get pnpm store directory
|
||||||
@@ -89,7 +89,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v5
|
||||||
name: Setup pnpm cache
|
name: Setup pnpm cache
|
||||||
with:
|
with:
|
||||||
path: ${{ env.STORE_PATH }}
|
path: ${{ env.STORE_PATH }}
|
||||||
@@ -98,7 +98,7 @@ jobs:
|
|||||||
${{ runner.os }}-pnpm-store-
|
${{ runner.os }}-pnpm-store-
|
||||||
|
|
||||||
- name: Sync node version and setup cache
|
- name: Sync node version and setup cache
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: "lts/*"
|
node-version: "lts/*"
|
||||||
cache: "pnpm"
|
cache: "pnpm"
|
||||||
@@ -107,7 +107,7 @@ jobs:
|
|||||||
run: pnpm install --no-frozen-lockfile
|
run: pnpm install --no-frozen-lockfile
|
||||||
|
|
||||||
- name: Build app
|
- name: Build app
|
||||||
run: pnpm run tauri build
|
run: pnpm run tauri build --debug
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
|
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
|
||||||
@@ -115,8 +115,59 @@ jobs:
|
|||||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
||||||
|
|
||||||
|
# TODO: Remove the below command after upstream issue is fixed
|
||||||
|
# Related issue: https://github.com/tauri-apps/tauri/issues/10702
|
||||||
|
WEBKIT_DISABLE_DMABUF_RENDERER: 1 # Disable DMABUF renderer on Wayland
|
||||||
|
|
||||||
- name: Upload build Artifacts
|
- name: Upload build Artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: Blink-${{ matrix.platform }}-dev${{ github.sha }}
|
name: Blink-${{ matrix.platform }}-dev${{ github.sha }}
|
||||||
path: src-tauri/target/release/bundle/*
|
path: src-tauri/target/debug/bundle/*
|
||||||
|
|
||||||
|
# Create or update nightly release
|
||||||
|
nightly_release:
|
||||||
|
needs: build
|
||||||
|
if: github.repository == 'prayag17/Blink' && github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write # Required for creating/updating releases
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6.0.1
|
||||||
|
|
||||||
|
- name: Download all artifacts
|
||||||
|
uses: actions/download-artifact@v7.0.0
|
||||||
|
with:
|
||||||
|
path: artifacts
|
||||||
|
|
||||||
|
- name: Prepare assets
|
||||||
|
run: |
|
||||||
|
mkdir -p release_assets
|
||||||
|
find artifacts -type f \( -name "*.exe" -o -name "*.msi" -o -name "*.dmg" -o -name "*.deb" -o -name "*.AppImage" -o -name "*.rpm" -o -name "*.tar.gz" \) | while read -r file; do
|
||||||
|
# Extract platform from artifact name (e.g. Blink-ubuntu-22.04-devSHA)
|
||||||
|
artifact_name=$(echo "$file" | cut -d'/' -f2)
|
||||||
|
platform=$(echo "$artifact_name" | sed -E 's/Blink-(.*)-dev.*/\1/' | sed 's/-/_/g')
|
||||||
|
filename=$(basename "$file")
|
||||||
|
cp "$file" "release_assets/${platform}-${filename}"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Delete old nightly release
|
||||||
|
run: gh release delete nightly --yes --repo ${{ github.repository }} || true
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Create nightly release
|
||||||
|
uses: softprops/action-gh-release@v2.5.0
|
||||||
|
with:
|
||||||
|
tag_name: nightly
|
||||||
|
name: Nightly Build (${{ github.sha }})
|
||||||
|
body: |
|
||||||
|
Nightly build from the latest main branch.
|
||||||
|
|
||||||
|
**Last commit:** ${{ github.event.head_commit.message }}
|
||||||
|
**SHA:** ${{ github.sha }}
|
||||||
|
prerelease: true
|
||||||
|
files: release_assets/*
|
||||||
|
fail_on_unmatched_files: true
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ jobs:
|
|||||||
environment: TAURI
|
environment: TAURI
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Install dependencies (ubuntu only)
|
- name: Install dependencies (ubuntu only)
|
||||||
if: matrix.platform == 'ubuntu-22.04'
|
if: matrix.platform == 'ubuntu-22.04'
|
||||||
@@ -28,16 +28,19 @@ jobs:
|
|||||||
|
|
||||||
- name: Rust setup
|
- name: Rust setup
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
|
||||||
|
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
|
||||||
|
|
||||||
- name: Rust cache
|
- name: Rust cache
|
||||||
uses: swatinem/rust-cache@v2
|
uses: swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
workspaces: "./src-tauri -> target"
|
workspaces: "./src-tauri -> target"
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v3
|
- uses: pnpm/action-setup@v4
|
||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
with:
|
with:
|
||||||
version: 7
|
version: 10
|
||||||
run_install: false
|
run_install: false
|
||||||
|
|
||||||
- name: Get pnpm store directory
|
- name: Get pnpm store directory
|
||||||
@@ -45,7 +48,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v5
|
||||||
name: Setup pnpm cache
|
name: Setup pnpm cache
|
||||||
with:
|
with:
|
||||||
path: ${{ env.STORE_PATH }}
|
path: ${{ env.STORE_PATH }}
|
||||||
@@ -54,7 +57,7 @@ jobs:
|
|||||||
${{ runner.os }}-pnpm-store-
|
${{ runner.os }}-pnpm-store-
|
||||||
|
|
||||||
- name: Sync node version and setup cache
|
- name: Sync node version and setup cache
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: "lts/*"
|
node-version: "lts/*"
|
||||||
cache: "pnpm" # Set this to npm, yarn or pnpm.
|
cache: "pnpm" # Set this to npm, yarn or pnpm.
|
||||||
@@ -64,7 +67,7 @@ jobs:
|
|||||||
run: pnpm install --no-frozen-lockfile && pnpm run build # Change this to npm, yarn or pnpm.
|
run: pnpm install --no-frozen-lockfile && pnpm run build # Change this to npm, yarn or pnpm.
|
||||||
|
|
||||||
- name: Build the app
|
- name: Build the app
|
||||||
uses: tauri-apps/tauri-action@dev
|
uses: tauri-apps/tauri-action@v0
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -78,3 +81,4 @@ jobs:
|
|||||||
releaseBody: "See the assets to download and install this version."
|
releaseBody: "See the assets to download and install this version."
|
||||||
releaseDraft: true
|
releaseDraft: true
|
||||||
prerelease: false
|
prerelease: false
|
||||||
|
args: ${{ matrix.platform == 'macos-latest' && '--target universal-apple-darwin' || '' }}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
name: Publish Releases to WinGet
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
jobs:
|
||||||
|
publish-alpha:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: contains(github.event.release.tag_name, '-alpha')
|
||||||
|
steps:
|
||||||
|
- uses: vedantmgoyal9/winget-releaser@main
|
||||||
|
with:
|
||||||
|
identifier: prayag17.Blink.Alpha
|
||||||
|
version: ${{ github.event.release.tag_name }}
|
||||||
|
installers-regex: '\.exe$'
|
||||||
|
token: ${{ secrets.WINGET_TOKEN }}
|
||||||
|
|
||||||
|
publish-stable:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.release.tag_name, '-alpha')"
|
||||||
|
steps:
|
||||||
|
- uses: vedantmgoyal9/winget-releaser@main
|
||||||
|
with:
|
||||||
|
identifier: prayag17.Blink
|
||||||
|
version: ${{ github.event.release.tag_name }}
|
||||||
|
installers-regex: '\.exe$'
|
||||||
|
token: ${{ secrets.WINGET_TOKEN }}
|
||||||
@@ -31,10 +31,14 @@ target/
|
|||||||
|
|
||||||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
||||||
Cargo.lock
|
# Cargo.lock
|
||||||
|
|
||||||
# These are backup files generated by rustfmt
|
# These are backup files generated by rustfmt
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
|
|
||||||
# MSVC Windows builds of rustc generate these, which store debugging information
|
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||||
*.pdb
|
*.pdb
|
||||||
|
|
||||||
|
generateBanner
|
||||||
|
# Million Lint
|
||||||
|
.million
|
||||||
@@ -1 +0,0 @@
|
|||||||
{"encodings":["src\\main.tsx","ProviderWrapper",[40,0,44,1],[41,13,41,42],[42,19,42,54],[43,8,43,71],"src\\utils\\store\\api.tsx","ApiProvider",[57,27,71,1],[57,28,57,40],[58,17,69,2],[70,8,70,75],"useApiInContext",[73,7,79,1],[74,15,74,37],[78,8,78,34],"src\\routes\\_api\\search\\index.jsx","SearchPage",[30,0,448,1],[31,13,31,36],[33,37,33,49],[34,21,34,49],[36,14,44,3],[48,16,62,3],[63,16,77,3],[78,20,92,3],[93,15,107,3],[108,14,122,3],[123,22,137,3],[138,16,150,3],[151,18,164,3],[166,23,166,71],[168,1,171,7],[173,2,446,8],[183,3,236,9],[184,4,235,6],[201,7,230,24],[202,8,229,14],[210,9,227,11],[228,9,228,65],[237,3,421,9],[243,5,262,20],[245,7,260,9],[265,5,290,20],[267,7,288,9],[293,5,307,20],[296,8,304,10],[310,5,329,20],[312,7,327,9],[332,5,352,20],[334,7,350,9],[355,5,375,20],[357,7,373,9],[378,5,397,20],[380,7,395,9],[400,5,419,20],[402,7,417,9],[438,5,444,11],[443,6,443,68],"src\\routes\\_api\\favorite\\index.tsx","FavoritePage",[20,0,304,1],[21,13,21,36],[22,23,22,71],[24,14,32,3],[34,16,45,3],[47,16,58,3],[60,20,71,3],[73,15,84,3],[86,14,97,3],[99,22,110,3],[112,16,123,3],[125,1,127,3],[130,2,302,9],[141,4,160,19],[143,6,158,8],[163,4,188,19],[165,6,186,8],[191,4,210,19],[193,6,208,8],[213,4,233,19],[215,6,231,8],[236,4,256,19],[238,6,254,8],[259,4,278,19],[261,6,276,8],[281,4,300,19],[283,6,298,8],"src\\routes\\_api\\home\\index.tsx","Home",[38,0,419,1],[39,13,39,42],[41,14,49,3],[51,19,61,3],[63,21,83,3],[85,26,99,3],[101,26,114,3],[116,21,135,3],[137,47,137,59],[139,18,139,31],[145,1,162,26],[162,5,162,24],[171,3,416,10],[178,4,205,20],[180,6,180,26],[183,7,202,9],[185,9,185,52],[207,4,241,20],[209,6,211,12],[210,7,210,51],[215,6,215,23],[217,6,239,21],[221,10,236,12],[242,4,303,20],[244,6,246,12],[245,7,245,52],[250,6,250,23],[254,6,301,21],[257,9,298,11],[304,4,362,20],[306,6,308,12],[307,7,307,59],[312,6,312,23],[317,6,360,21],[320,9,357,11],[363,4,404,20],[365,6,367,12],[366,7,366,59],[371,6,371,23],[376,6,402,21],[379,9,399,11],[405,4,415,20],[407,6,409,12],[408,7,408,62],[413,13,413,69],"src\\routes\\setup\\server.add.tsx","ServerSetup",[25,0,152,1],[26,33,26,45],[28,29,28,42],[30,18,30,60],[32,21,66,3],[70,3,79,5],[80,3,149,15],[88,4,148,11],[95,5,97,12],[96,6,96,54],[98,5,108,12],[99,6,107,8],[109,5,123,12],[110,6,122,22],[116,8,116,71],[124,5,147,12],[136,6,143,13],[144,6,146,19],"src\\routes\\_api\\player\\index.tsx","VideoPlayer",[81,0,592,1],[82,13,82,36],[83,21,83,32],[84,39,84,54],[96,5,106,3],[108,31,108,45],[109,41,109,55],[111,51,111,66],[114,31,114,46],[115,31,115,45],[116,35,116,50],[117,45,117,68],[118,33,118,56],[119,43,119,58],[120,43,120,67],[121,49,123,2],[124,29,124,40],[125,27,125,42],[127,1,127,41],[129,49,129,71],[209,16,209,28],[223,24,259,7],[261,1,269,21],[269,5,269,19],[271,1,302,38],[302,5,302,18],[302,20,302,36],[304,1,307,15],[307,5,307,13],[310,2,590,8],[311,3,334,21],[313,5,332,18],[331,6,331,52],[335,3,562,16],[352,4,400,10],[353,5,355,18],[354,6,354,66],[356,5,360,18],[359,6,359,64],[361,5,399,12],[382,6,398,18],[390,7,392,18],[394,8,396,19],[401,4,561,10],[402,5,409,18],[405,7,407,20],[410,5,560,11],[411,6,452,12],[412,7,445,9],[446,7,451,13],[447,8,449,21],[450,8,450,61],[453,6,559,12],[454,7,485,13],[455,8,455,30],[456,8,464,21],[461,9,463,16],[465,8,469,21],[466,9,468,16],[470,8,478,21],[475,9,477,16],[479,8,479,26],[480,8,484,21],[486,7,558,13],[487,8,523,21],[509,9,511,22],[512,9,522,11],[524,8,537,21],[530,9,536,16],[538,8,538,23],[539,8,545,21],[540,9,544,16],[546,8,557,21],[554,9,556,16],[564,3,589,5],"src\\routes\\_api\\login\\index.tsx","LoginRoute",[19,0,91,1],[20,18,20,31],[21,18,21,31],[22,13,22,36],[23,29,23,65],[25,19,32,3],[48,2,89,13],[48,22,48,45],[49,3,88,9],[60,4,60,48],[61,4,87,22],[62,5,86,18],[75,6,85,19],"src\\routes\\setup\\server.list.tsx","ServerList",[28,0,203,1],[29,18,29,31],[30,39,30,53],[31,29,31,42],[33,21,33,37],[35,17,38,3],[40,23,43,3],[45,28,63,3],[87,1,89,7],[92,2,201,8],[93,3,93,21],[94,3,114,9],[103,4,105,17],[106,4,113,17],[112,5,112,56],[115,3,200,11],[118,6,198,12],[119,7,121,13],[122,7,170,13],[123,8,151,21],[133,10,149,12],[135,12,141,25],[152,8,160,21],[161,8,169,21],[171,7,197,13],[172,8,183,21],[182,9,182,62],[184,8,196,21],[195,9,195,71],"src\\routes\\_api\\playlist\\$id.jsx","TabPanel",[23,0,38,1],[23,18,23,23],[27,2,36,8],[35,23,35,44],"PlaylistTitlePage",[57,0,229,1],[58,16,58,33],[59,13,59,36],[61,14,69,3],[71,14,84,3],[86,22,99,3],[101,21,112,3],[114,26,114,74],[116,1,126,7],[130,3,140,9],[139,4,139,24],[145,3,223,9],[160,7,168,9],[174,5,221,20],[181,8,218,10],[227,9,227,24],"src\\routes\\_api\\series\\$id.tsx",[65,0,80,1],[65,18,65,23],[69,2,78,8],[77,23,77,44],"SeriesTitlePage",[99,0,1205,1],[100,16,100,33],[102,13,102,36],[104,14,112,3],[114,14,127,3],[129,22,142,3],[144,17,157,3],[159,23,174,3],[176,43,179,3],[180,55,180,70],[182,43,185,3],[187,27,199,3],[201,18,216,3],[218,25,228,3],[229,26,229,74],[231,35,231,47],[232,31,232,43],[233,29,233,41],[234,35,234,47],[236,1,260,21],[260,5,260,19],[262Line truncated
|
|
||||||
@@ -26,5 +26,7 @@
|
|||||||
"typescript.tsdk": "node_modules/typescript/lib",
|
"typescript.tsdk": "node_modules/typescript/lib",
|
||||||
"[scss]": {
|
"[scss]": {
|
||||||
"editor.defaultFormatter": "vscode.css-language-features"
|
"editor.defaultFormatter": "vscode.css-language-features"
|
||||||
}
|
},
|
||||||
|
"millionLint.theme": "million",
|
||||||
|
"millionLint.disableOutdatedVersionMessage": true
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,117 @@
|
|||||||
|
- # Alpha 3 (11/12/2024)
|
||||||
|
- refactor: prepare for alpha 3
|
||||||
|
- refactor: cleanup
|
||||||
|
- refactor: remove unused imports
|
||||||
|
- fix: series page not fetching correct season
|
||||||
|
- feat: add key binding for macos users #435
|
||||||
|
- refactor: remove jellyPlayer naming from code #460
|
||||||
|
- feat: add playlist playback support
|
||||||
|
- refactor: improve server add process
|
||||||
|
- feat: show current time while scrubbing video progress #339
|
||||||
|
- style: increase the sharpness of card images
|
||||||
|
- feat: add skip recap button
|
||||||
|
- refactor: cleanup video player
|
||||||
|
- feat: add chapter navigation buttons to video player #457
|
||||||
|
- feat: allow changing audio track from video player
|
||||||
|
- feat: allow changing chapters from a chapter list #457
|
||||||
|
- refactor: cleanup search route
|
||||||
|
- refactor: cleanup some components
|
||||||
|
- refactor: unmount card image if not inView
|
||||||
|
- refactor: cleanup person route
|
||||||
|
- style: replace noto-sans with plus-jakarta-sans
|
||||||
|
- refactor: cleanup login routes
|
||||||
|
- fix: library items not of same size #380
|
||||||
|
- refactor: cleanup item.tsx
|
||||||
|
- fix: series page breaking if season is not loaded
|
||||||
|
- fix: do not display missing items in series
|
||||||
|
- refactor: move more files to ts
|
||||||
|
- refactor: move more files to ts
|
||||||
|
- refactor: move more files to ts
|
||||||
|
- refactor: move more files to typescript
|
||||||
|
- refactor: move more components to ts
|
||||||
|
- refactore: cleanup __root.tsx
|
||||||
|
- chore(deps): update dependencies
|
||||||
|
- fix: collections page not rendering #447
|
||||||
|
- fix: quick connect not working #445
|
||||||
|
- fix: playback error if subtitle is not set
|
||||||
|
- fix: index not being assigned proper value #420
|
||||||
|
- fix: synced lyrics not working
|
||||||
|
- Merge pull request #446 from prayag17/renovate/node-22.x-lockfile
|
||||||
|
- refactor: use saved lyrics
|
||||||
|
- refactor: change GenreView to genreFilter
|
||||||
|
- fix(deps): update dependency @types/node to v22.10.1
|
||||||
|
- Merge pull request #393 from prayag17/renovate/tanstack-router-monorepo
|
||||||
|
- Merge pull request #424 from prayag17/renovate/tanstack-query-monorepo
|
||||||
|
- fix(deps): update tanstack-router monorepo
|
||||||
|
- Merge pull request #426 from prayag17/renovate/node-22.x-lockfile
|
||||||
|
- fix(deps): update dependency @types/node to v22.10.0
|
||||||
|
- Merge pull request #437 from prayag17/dependabot/cargo/src-tauri/rustls-0.23.18
|
||||||
|
- fix(deps): update tanstack-query monorepo to v5.61.4
|
||||||
|
- Merge pull request #438 from prayag17/renovate/axios-1.x-lockfile
|
||||||
|
- Merge pull request #439 from prayag17/renovate/vitejs-plugin-react-4.x-lockfile
|
||||||
|
- chore(deps): update dependency @vitejs/plugin-react to v4.3.4
|
||||||
|
- refactore: move more components to typescript
|
||||||
|
- fix: episode and series not playing if episode is not present in nextUp and continueWatching
|
||||||
|
- feat: show current episode in PlayButton
|
||||||
|
- fix: episode indexing for absolute numbering indexNumbers in PlayButton
|
||||||
|
- fix: unable to read Id of undefined in PlayButton
|
||||||
|
- fix(deps): update dependency axios to v1.7.8
|
||||||
|
- chore(deps): bump rustls from 0.23.16 to 0.23.18 in /src-tauri
|
||||||
|
- fix(ci): not uploading debug builds
|
||||||
|
- refactor(ci): build debug builds in CI
|
||||||
|
- Merge pull request #425 from prayag17/renovate/serde_json-1.x-lockfile
|
||||||
|
- Merge pull request #436 from sambartik/macos-universal-dmg
|
||||||
|
- chore(deps): update dependencies
|
||||||
|
- refactor: convert more files to typescript
|
||||||
|
- fix: improper handling of undefined api leading to crashes
|
||||||
|
- refactor: move all buttons to tsx #338
|
||||||
|
- Add universal dmg for macOS in release job
|
||||||
|
- fix: audio queue not moving after 2 changes #182
|
||||||
|
- fix: playing track from album not updating the queue #182
|
||||||
|
- refactor: use MediaSegments api for intro/outro skipping
|
||||||
|
- fix: trickplay images not showing up
|
||||||
|
- refactor: improve login page UI #338 #202
|
||||||
|
- chore(release): update latest.json
|
||||||
|
- fix(deps): update rust crate serde_json to v1.0.133
|
||||||
|
|
||||||
|
- # 0.0.7-dev (20/11/2024)
|
||||||
|
- chore(deps): update dependencies
|
||||||
|
- refactor: change UI of login/list and fix Api not being defined in context
|
||||||
|
- fix: player/audio route not able to interact with audioPlayer
|
||||||
|
- fix: audio player info not visible
|
||||||
|
- fix: audio player not playing audio
|
||||||
|
- fix: toggling ssubtitles not working
|
||||||
|
- fix: subtitles not being rendered #401
|
||||||
|
- fix: hero carousel indicators not scrolling
|
||||||
|
- fix: vite build error for safari13
|
||||||
|
- fix: blink not launching or rendering on opening
|
||||||
|
- Merge branch 'main' of https://github.com/prayag17/JellyPlayer
|
||||||
|
- chore(deps): update dependencies
|
||||||
|
- Merge pull request #410 from prayag17/renovate/tauri-plugin-notification-2.x-lockfile
|
||||||
|
- Merge pull request #409 from Blackspirits/patch-1
|
||||||
|
- chore(deps): update dependencies
|
||||||
|
- (origin/renovate/tauri-plugin-notification-2.x-lockfile) fix(deps): update rust crate tauri-plugin-notification to v2.0.1
|
||||||
|
- feat: allow downloading images from ImageViewer
|
||||||
|
- Update index.tsx
|
||||||
|
- feat: implement basic image viewer #338 #240
|
||||||
|
- fix: react infinite depth error
|
||||||
|
- fix: vite config
|
||||||
|
- refactor: remove @million/js and @million/lint
|
||||||
|
- refactor: remove Cargo.lock from .gitignore #400
|
||||||
|
- chore(deps): update dependencies
|
||||||
|
- refactor: code cleanup
|
||||||
|
- fix: bug_report showing extra fields
|
||||||
|
- refactor: remove redundant calls for getCurrentUser
|
||||||
|
- feat: show queue item from currently playing item in queueButton
|
||||||
|
- chore(deps): update dependencies
|
||||||
|
- feat: remember library filters #192
|
||||||
|
- Merge pull request #370 from prayag17/renovate/tauri-apps-plugin-clipboard-manager-2.x
|
||||||
|
- fix(deps): update dependency @tauri-apps/plugin-clipboard-manager to v2.1.0-beta.6
|
||||||
|
- Merge pull request #381 from prayag17/renovate/wavesurfer.js-7.x-lockfile
|
||||||
|
- Merge pull request #342 from prayag17/renovate/tanstack-router-monorepo
|
||||||
|
- Merge pull request #368 from prayag17/renovate/tauri-monorepo
|
||||||
|
- chore(release): update latest.json
|
||||||
|
|
||||||
- # 0.0.6-dev (9/7/2024)
|
- # 0.0.6-dev (9/7/2024)
|
||||||
> **Note** : This is an unstable release
|
> **Note** : This is an unstable release
|
||||||
- feat: add video player slider bubble theming #337
|
- feat: add video player slider bubble theming #337
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||

|

|
||||||
<div align="center">
|
<div align="center">
|
||||||
<img alt="GitHub Release" src="https://img.shields.io/github/v/release/prayag17/JellyPlayer?sort=date&display_name=tag&style=for-the-badge&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB3aWR0aD0iODc4IiBoZWlnaHQ9IjEwMTIiIHZpZXdCb3g9IjAgMCA4NzggMTAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik00MzguODA5IDUwNkwzNS40MDQ4IDczOC45MDZMNDM4LjgwOSA5NzEuODEyTDg0Mi4yMTQgNzM4LjkwNlYyNzMuMDk0TDQzOC44MDkgNDAuMTg4NUwzNS40MDQ4IDI3My4wOTRMNDM4LjgwOSA1MDZaTTQzOC44MDkgMEw4NzcuMDE4IDI1M1Y3NTlMNDM4LjgwOSAxMDEyTDAuNjAwNTg2IDc1OVY3MTguODEyVjI5My4xODhWMjUzTDQzOC44MDkgMFoiIGZpbGw9IndoaXRlIi8%2BCjwvc3ZnPgo%3D&labelColor=000&link=https%3A%2F%2Fgithub.com%2Fprayag17%2FJellyPlayer%2Freleases%2Flatest">
|
<img alt="GitHub Release" src="https://img.shields.io/github/v/release/prayag17/Blink?sort=date&display_name=tag&style=for-the-badge&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB3aWR0aD0iODc4IiBoZWlnaHQ9IjEwMTIiIHZpZXdCb3g9IjAgMCA4NzggMTAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik00MzguODA5IDUwNkwzNS40MDQ4IDczOC45MDZMNDM4LjgwOSA5NzEuODEyTDg0Mi4yMTQgNzM4LjkwNlYyNzMuMDk0TDQzOC44MDkgNDAuMTg4NUwzNS40MDQ4IDI3My4wOTRMNDM4LjgwOSA1MDZaTTQzOC44MDkgMEw4NzcuMDE4IDI1M1Y3NTlMNDM4LjgwOSAxMDEyTDAuNjAwNTg2IDc1OVY3MTguODEyVjI5My4xODhWMjUzTDQzOC44MDkgMFoiIGZpbGw9IndoaXRlIi8%2BCjwvc3ZnPgo%3D&labelColor=000&link=https%3A%2F%2Fgithub.com%2Fprayag17%Blink%2Freleases%2Flatest">
|
||||||
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/prayag17/JellyPlayer?style=for-the-badge&logo=github&labelColor=000&link=https%3A%2F%2Fgithub.com%2Fprayag17%2FJellyPlayer%2Fstargazers">
|
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/prayag17/Blink?style=for-the-badge&logo=github&labelColor=000&link=https%3A%2F%2Fgithub.com%2Fprayag17%Blink%2Fstargazers">
|
||||||
<img alt="GitHub License" src="https://img.shields.io/github/license/prayag17/JellyPlayer?style=for-the-badge&labelColor=000">
|
<img alt="GitHub License" src="https://img.shields.io/github/license/prayag17/Blink?style=for-the-badge&labelColor=000">
|
||||||
<img alt="GitHub Actions Workflow Status" src="https://img.shields.io/github/actions/workflow/status/prayag17/JellyPlayer/continuous-integration.yml?style=for-the-badge&logo=github&label=CI&labelColor=000&link=https%3A%2F%2Fgithub.com%2Fprayag17%2FJellyPlayer%2Factions%2Fworkflows%2Fcontinuous-integration.yml">
|
<img alt="GitHub Actions Workflow Status" src="https://img.shields.io/github/actions/workflow/status/prayag17/Blink/continuous-integration.yml?style=for-the-badge&logo=github&label=CI&labelColor=000&link=https%3A%2F%2Fgithub.com%2Fprayag17%Blink%2Factions%2Fworkflows%2Fcontinuous-integration.yml">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
###
|
###
|
||||||
@@ -13,8 +13,8 @@
|
|||||||
|
|
||||||
## 📝 Prerequisites
|
## 📝 Prerequisites
|
||||||
|
|
||||||
- Nodejs (≥19.1.0)
|
- Nodejs (22.14.0)
|
||||||
- Rust (≥1.76.0)
|
- Rust (>=1.85.0)
|
||||||
- Visual Studio C++ Build tools
|
- Visual Studio C++ Build tools
|
||||||
- [pnpm](https://pnpm.io/)
|
- [pnpm](https://pnpm.io/)
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
pnpm run tauri build
|
pnpm run tauri build
|
||||||
```
|
```
|
||||||
|
|
||||||
- other commands can be found inside the `"scripts"` inside [package.json](https://github.com/prayag17/JellyPlayer/blob/main/package.json)
|
- other commands can be found inside the `"scripts"` inside [package.json](https://github.com/prayag17/Blink/blob/main/package.json)
|
||||||
|
|
||||||
## 💻 Contribution
|
## 💻 Contribution
|
||||||
|
|
||||||
@@ -64,17 +64,15 @@
|
|||||||
## 📷 Screenshots
|
## 📷 Screenshots
|
||||||
|
|
||||||
- Home
|
- Home
|
||||||

|

|
||||||
- Title Page - Movie
|
- Title Page - Movie
|
||||||

|

|
||||||
- Title Page - Show
|
- Title Page - Show
|
||||||

|

|
||||||
- Episode List
|
- Episode List
|
||||||

|

|
||||||
- Video Player
|
- Video Player
|
||||||

|

|
||||||
- About Dialog
|
|
||||||

|
|
||||||
|
|
||||||
## 📃 Roadmap
|
## 📃 Roadmap
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,27 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
|
"$schema": "https://biomejs.dev/schemas/2.3.13/schema.json",
|
||||||
"organizeImports": {
|
"assist": { "actions": { "source": { "organizeImports": "on" } } },
|
||||||
"enabled": true
|
|
||||||
},
|
|
||||||
"linter": {
|
"linter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"rules": {
|
"rules": {
|
||||||
"recommended": true,
|
"recommended": true,
|
||||||
"style": {
|
"style": {
|
||||||
"noNonNullAssertion": "off",
|
"noNonNullAssertion": "off",
|
||||||
"useEnumInitializers": "off"
|
"useEnumInitializers": "off",
|
||||||
|
"noParameterAssign": "error",
|
||||||
|
"useAsConstAssertion": "error",
|
||||||
|
"useDefaultParameterLast": "error",
|
||||||
|
"useSelfClosingElements": "error",
|
||||||
|
"useSingleVarDeclarator": "error",
|
||||||
|
"noUnusedTemplateLiteral": "error",
|
||||||
|
"useNumberNamespace": "error",
|
||||||
|
"noInferrableTypes": "error",
|
||||||
|
"noUselessElse": "error"
|
||||||
},
|
},
|
||||||
"a11y": {
|
"a11y": {
|
||||||
"useKeyWithClickEvents": "off",
|
"useKeyWithClickEvents": "off",
|
||||||
"useMediaCaption": "off"
|
"useMediaCaption": "off",
|
||||||
|
"noStaticElementInteractions": "off"
|
||||||
},
|
},
|
||||||
"correctness": {
|
"correctness": {
|
||||||
"useExhaustiveDependencies": "off",
|
"useExhaustiveDependencies": "off",
|
||||||
@@ -21,17 +29,18 @@
|
|||||||
},
|
},
|
||||||
"suspicious": {
|
"suspicious": {
|
||||||
"noExplicitAny": "off"
|
"noExplicitAny": "off"
|
||||||
}
|
},
|
||||||
|
"nursery": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"files": {
|
"files": {
|
||||||
"include": [
|
"includes": [
|
||||||
"src/**/*.ts",
|
"**/src/**/*.ts",
|
||||||
"src/**/*.tsx",
|
"**/src/**/*.tsx",
|
||||||
"src/**/*.jsx",
|
"**/src/**/*.jsx",
|
||||||
"src/**/*.js",
|
"**/src/**/*.js",
|
||||||
"*.json",
|
"**/*.json",
|
||||||
"*.scss"
|
"**/*.scss"
|
||||||
],
|
],
|
||||||
"ignoreUnknown": true
|
"ignoreUnknown": true
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,60 +5,38 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<!-- <script src="http://localhost:8097"></script> -->
|
<!-- <script src="http://localhost:8097"></script> -->
|
||||||
<title>Jellyplayer</title>
|
<title>Blink</title>
|
||||||
<style>
|
<style>
|
||||||
.app-loading {
|
.app-loading {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 50%;
|
||||||
left: 0;
|
left: 50%;
|
||||||
bottom: 0;
|
transform: translate(-50%,-50%);
|
||||||
right: 0;
|
width: 10em;
|
||||||
background: #fff;
|
height: 10em;
|
||||||
|
background: rgb(180 180 180);
|
||||||
z-index: 100000;
|
z-index: 100000;
|
||||||
display: flex;
|
mask-image: url("./src/assets/icon-outline.png");
|
||||||
align-items: center;
|
mask-size: contain;
|
||||||
justify-content: center;
|
|
||||||
flex-direction: column;
|
|
||||||
transition: opacity 0.25s ease-in-out;
|
|
||||||
opacity: 0;
|
|
||||||
animation: fadeIn linear 500ms forwards;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-loading.hidden {
|
.app-loading.hidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-loading-logo {
|
|
||||||
width: 5vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-loading-bar-container{
|
.app-loading-anim{
|
||||||
height: 2px;
|
width: 150%;
|
||||||
width: 16vw;
|
|
||||||
position: absolute;
|
|
||||||
left: 50%;
|
|
||||||
bottom: 36vh;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-loading-bar{
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: #101010;
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
background: linear-gradient(to right,transparent,rgb(255 255 255),transparent);
|
||||||
transform: scaleX(0);
|
transform: scaleX(0);
|
||||||
animation: loading 1s ease-in-out infinite both;
|
animation: loading 0.75s linear infinite both;
|
||||||
transform-origin: left;
|
transform-origin: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes fadeIn {
|
|
||||||
0%{
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
100%{
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@keyframes loading {
|
@keyframes loading {
|
||||||
0%{
|
0%{
|
||||||
transform: translate(-100%);
|
transform: translate(-100%);
|
||||||
@@ -75,10 +53,8 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="app-loading">
|
<div class="app-loading">
|
||||||
<img src="./src/assets/icon-outline.svg" class="app-loading-logo" />
|
<!-- <img src="./src/assets/icon-outline.svg" class="app-loading-logo" /> -->
|
||||||
<div class="app-loading-bar-container">
|
<div class="app-loading-anim"></div>
|
||||||
<div class="app-loading-bar"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<svg style="width: 0; height: 0; position: absolute" aria-hidden="true" focusable="false">
|
<svg style="width: 0; height: 0; position: absolute" aria-hidden="true" focusable="false">
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
{
|
{
|
||||||
"version": "0.0.5-dev",
|
"version": "0.0.7-dev",
|
||||||
"notes": "\n- feat(web): Add new About page (#258) by @prayag17\n- feat(web): Allow managing servers from settings dialog by @prayag17\n- feat(search): Add Episode to search by @prayag17\n- feat(settings-server): Add a refretch button by @prayag17\n- feat(web): Add a global query fetch/mutation status by @prayag17\n- fix(server): Use redirect instead of relaunch when changing or deleting a server by @prayag17\n- refactor(player): Rewrite and improve video playback by @prayag17\n- feat(web): Use season backdrop in series page if available by @prayag17\n- feat(player): Allow selecting subtitles during playback by @prayag17\n- feat(ui): Add new episode layout by @prayag17",
|
"notes": "\n- chore(deps): update dependencies\n- refactor: change UI of login/list and fix Api not being defined in context\n- fix: player/audio route not able to interact with audioPlayer\n- fix: audio player info not visible\n- fix: audio player not playing audio\n- fix: toggling ssubtitles not working\n- fix: subtitles not being rendered #401\n- fix: hero carousel indicators not scrolling\n- fix: vite build error for safari13\n- fix: blink not launching or rendering on opening\n- Merge branch 'main' of https://github.com/prayag17/JellyPlayer\n- chore(deps): update dependencies\n- Merge pull request #410 from prayag17/renovate/tauri-plugin-notification-2.x-lockfile\n- Merge pull request #409 from Blackspirits/patch-1\n- chore(deps): update dependencies\n- fix(deps): update rust crate tauri-plugin-notification to v2.0.1\n- feat: allow downloading images from ImageViewer\n- Update index.tsx\n- feat: implement basic image viewer #338 #240\n- fix: react infinite depth error\n- fix: vite config\n- refactor: remove @million/js and @million/lint\n- refactor: remove Cargo.lock from .gitignore #400\n- chore(deps): update dependencies\n- refactor: code cleanup\n- fix: bug_report showing extra fields\n- refactor: remove redundant calls for getCurrentUser\n- feat: show queue item from currently playing item in queueButton\n- chore(deps): update dependencies\n- feat: remember library filters #192\n- Merge pull request #370 from prayag17/renovate/tauri-apps-plugin-clipboard-manager-2.x\n- fix(deps): update dependency @tauri-apps/plugin-clipboard-manager to v2.1.0-beta.6\n- Merge pull request #381 from prayag17/renovate/wavesurfer.js-7.x-lockfile\n- Merge pull request #342 from prayag17/renovate/tanstack-router-monorepo\n- Merge pull request #368 from prayag17/renovate/tauri-monorepo\n- chore(release): update latest.json",
|
||||||
"pub_date": "2024-03-17T11:50:31.121Z",
|
"pub_date": "2024-11-20T07:04:53.965Z",
|
||||||
"platforms": {
|
"platforms": {
|
||||||
"darwin-x86_64": {
|
"darwin-aarch64": {
|
||||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVROHVTNk5NMHU2bVZjYWVCcmxtUk5tRTV0bC9acGxUQkdGMlMrVFdkOVJCS3ZsMlY1aXR0M3BvdnBVTnl6MUVpcWsxUzdFbVNXbHF5S1pQbTZIM0JXallCeklYaUdyWFFBPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzEwNjc1OTMxCWZpbGU6SmVsbHlQbGF5ZXIuYXBwLnRhci5negpGM2xCQnR1YWhDWi9mMCtLZjFHQ0twMUNub3VBTHE2SHZSMnpGOVRWVGVncE42ODZ5Q2M1bm9aa3VGUFhpM245eVhIMDZWWkRyQnVMaWY4c1Z2WE5Edz09Cg==",
|
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSNkxEL1dFMElZL2RHaC9wc3VMQzJxeFRYaHVVN0xEZW91WWgwZkluYkYrdW5hUWl2UFlSeEUyRk93dm13WUdmQVZETWhmNW9MZ2lPUFdOdERzbGFibkpPNHJWMU1BYlFrPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzMyMDg1ODYyCWZpbGU6QmxpbmsuYXBwLnRhci5negpjK0VIaW9oVzlrUU92UWZudzcvRGlZNExwM0NOdmpHVGd1QUc2WWZ0bnRkU2NsWkdqQUJrR01ucVVRTktvR0RaV0l0L09KQ2luZHNUdjMvTGVlM2RCUT09Cg==",
|
||||||
"url": "https://github.com/prayag17/JellyPlayer/releases/download/v0.0.5-dev/JellyPlayer_x64.app.tar.gz"
|
"url": "https://github.com/prayag17/Blink/releases/download/v0.0.7-dev/Blink_aarch64.app.tar.gz"
|
||||||
},
|
},
|
||||||
"linux-x86_64": {
|
"linux-x86_64": {
|
||||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVROHVTNk5NMHU2bVMvOXE1SGNiWmRDVWVMYVBLTnU4MXJheTd4NmY2WWszRjdUcnRySnl5TkdEVThYa1lHNHRXT1FIUzFwelhMZ3U4S2lJTjI4Y1IrV05iOVRmZWgzS1FrPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzEwNjc2MDE4CWZpbGU6amVsbHktcGxheWVyXzAuMC41LWRldl9hbWQ2NC5BcHBJbWFnZS50YXIuZ3oKcko3VUZFZVcwcVVZK0IwY3lZUlk5WThySjI2NEptY1BFb1dYYlRDMTQxZzFJekovS2tHVFMwK0pTS01JV3NSMWxvL2QwNEVqb2VTZVE2MmQ2UFhXQ1E9PQo=",
|
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSNkxEL1dFMElZL1hKZGoxZFUvZzl5SmNnUEFRTGQ2TmFNMlphK25lTU9MTjJEM0JYQWt0Sy91Um9yRmk4QTl6dEtUSmRuRmFNODRwajJ2YW4rTGJzYVZjcmhFb1IxZkFnPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzMyMDg2MTQxCWZpbGU6QmxpbmtfMC4wLjctZGV2X2FtZDY0LkFwcEltYWdlCndKZURUdjF0bkNna1VCVDNEMFNodEZBZGkzZFBKVWx2cThSNE5najBmd2U5Rzh5SDFIbUxqRHlKOWdxMnY2QU9NdTRiQmtWY2VVaVlhNjRrNDVHMUFRPT0K",
|
||||||
"url": "https://github.com/prayag17/JellyPlayer/releases/download/v0.0.5-dev/jelly-player_0.0.5-dev_amd64.AppImage.tar.gz"
|
"url": "https://github.com/prayag17/Blink/releases/download/v0.0.7-dev/Blink_0.0.7-dev_amd64.AppImage"
|
||||||
},
|
},
|
||||||
"windows-x86_64": {
|
"windows-x86_64": {
|
||||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVROHVTNk5NMHU2bVZyK3o0d0FWVURRcDg3QnorYzNDUVNwamJIZ2JDTTNwUjdFUS9jMXN2cVFiVXNKdFNoaVNUUFlSaVI2Z3dyeEdqWmRCekFqSkYwa09xTFZSaG5mb1FRPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzEwNjc2MjIxCWZpbGU6SmVsbHlQbGF5ZXJfMC4wLjUtZGV2X3g2NC1zZXR1cC5uc2lzLnppcApPdGxzdk1aU0pJSC80a2xvYk5TbWhJeUNvVjNDa2piYkNQOTF0bmFWVTJ6TFVNc0trRkhqeUNxdGNNNUQvUXd4TUpXTzNoRHd1QUN2YnN5Y1BUTGVDQT09Cg==",
|
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSNkxEL1dFMElZL1MwRVJ0UXBUUEYvd01JbXhBalFwQ0w5bEdkZkdlblZNeW1EMXQxajhYeVd0cERWcnhWOWFOaXV4Q0hDU1VRTEhabXF1ekFIbzB0KzRmL0pxdEIzMEFrPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzMyMDg2Mjg5CWZpbGU6QmxpbmtfMC4wLjctZGV2X3g2NC1zZXR1cC5uc2lzLnppcApJMmRORUFhV3NKV3BCTTliQkIwcWtSZStKTzEwY002QndCWmxKb0ZRd2p2K0cvek90dmdsbmQ0MHhNOVJsWnE3Y29qQmNDckdxdUNabWpTWjJ3d0xBUT09Cg==",
|
||||||
"url": "https://github.com/prayag17/JellyPlayer/releases/download/v0.0.5-dev/JellyPlayer_0.0.5-dev_x64-setup.nsis.zip"
|
"url": "https://github.com/prayag17/Blink/releases/download/v0.0.7-dev/Blink_0.0.7-dev_x64-setup.nsis.zip"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "blink",
|
"name": "blink",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.6-dev",
|
"version": "1.0.0-alpha.4",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite && tsr watch",
|
"dev": "vite --force && tsr watch",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"tauri": "tauri",
|
"tauri": "tauri",
|
||||||
@@ -13,65 +13,86 @@
|
|||||||
"tanstack-router-dev": "tsr watch"
|
"tanstack-router-dev": "tsr watch"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.13.3",
|
"@dnd-kit/core": "^6.3.1",
|
||||||
"@emotion/styled": "^11.13.0",
|
"@dnd-kit/modifiers": "^9.0.0",
|
||||||
"@fontsource-variable/jetbrains-mono": "^5.0.22",
|
"@dnd-kit/sortable": "^10.0.0",
|
||||||
"@fontsource-variable/noto-sans": "^5.0.5",
|
"@dnd-kit/utilities": "^3.2.2",
|
||||||
"@jellyfin/sdk": "0.10.0",
|
"@emotion/react": "^11.14.0",
|
||||||
"@million/lint": "1.0.0-rc.84",
|
"@emotion/styled": "^11.14.1",
|
||||||
"@mui/lab": "6.0.0-beta.9",
|
"@fontsource-variable/jetbrains-mono": "^5.2.8",
|
||||||
"@mui/material": "6.0.2",
|
"@fontsource-variable/noto-sans": "^5.2.10",
|
||||||
"@react-spring/web": "^9.7.4",
|
"@fontsource-variable/plus-jakarta-sans": "^5.2.8",
|
||||||
"@tanem/react-nprogress": "^5.0.51",
|
"@fontsource-variable/space-grotesk": "^5.2.10",
|
||||||
"@tanstack/react-query": "^5.55.0",
|
"@jellyfin/sdk": "0.13.0",
|
||||||
"@tanstack/react-query-devtools": "^5.55.0",
|
"@mui/lab": "7.0.1-beta.21",
|
||||||
"@tanstack/react-router": "^1.56.1",
|
"@mui/material": "7.3.7",
|
||||||
"@tanstack/react-virtual": "^3.10.7",
|
"@popperjs/core": "^2.11.8",
|
||||||
"@tauri-apps/api": "2.0.0-beta.15",
|
"@react-spring/web": "^10.0.3",
|
||||||
"@tauri-apps/plugin-clipboard-manager": "2.1.0-beta.5",
|
"@tanem/react-nprogress": "^5.0.59",
|
||||||
"@tauri-apps/plugin-process": "2.0.0-rc.1",
|
"@tanstack/react-form": "^1.28.0",
|
||||||
|
"@tanstack/react-query": "^5.90.20",
|
||||||
|
"@tanstack/react-query-devtools": "^5.91.3",
|
||||||
|
"@tanstack/react-router": "^1.158.4",
|
||||||
|
"@tanstack/react-router-devtools": "^1.158.4",
|
||||||
|
"@tanstack/react-virtual": "^3.13.18",
|
||||||
|
"@tauri-apps/api": "2.10.1",
|
||||||
|
"@tauri-apps/plugin-clipboard-manager": "2.3.2",
|
||||||
|
"@tauri-apps/plugin-dialog": "2.6.0",
|
||||||
|
"@tauri-apps/plugin-global-shortcut": "~2.3.1",
|
||||||
|
"@tauri-apps/plugin-notification": "2.3.3",
|
||||||
|
"@tauri-apps/plugin-process": "2.3.1",
|
||||||
|
"@tauri-apps/plugin-shell": "~2.3.5",
|
||||||
"@tauri-apps/plugin-store": "github:tauri-apps/tauri-plugin-store#v2",
|
"@tauri-apps/plugin-store": "github:tauri-apps/tauri-plugin-store#v2",
|
||||||
"@tauri-apps/plugin-updater": "2.0.0-rc.2",
|
"@tauri-apps/plugin-updater": "2.10.0",
|
||||||
"@types/node": "^22.5.4",
|
"@tauri-apps/plugin-upload": "2.4.0",
|
||||||
"@types/react": "^18.3.5",
|
"@tauri-apps/plugin-window-state": "~2.4.1",
|
||||||
"@types/react-dom": "^18.3.0",
|
"@types/node": "^25.2.1",
|
||||||
"axios": "^1.7.7",
|
"@types/react": "^19.2.13",
|
||||||
"axios-tauri-api-adapter": "^0.2.2",
|
"@types/react-dom": "^19.2.3",
|
||||||
|
"axios": "^1.13.4",
|
||||||
|
"axios-tauri-api-adapter": "^2.0.6",
|
||||||
"blurhash": "^2.0.5",
|
"blurhash": "^2.0.5",
|
||||||
"framer-motion": "^11.5.4",
|
"blurhash-wasm": "^0.2.0",
|
||||||
"jassub": "^1.7.17",
|
"immer": "^11.1.3",
|
||||||
"lodash": "^4.17.21",
|
"jassub": "^2.4.1",
|
||||||
"material-symbols": "^0.23.0",
|
"libpgs": "^0.8.1",
|
||||||
"million": "^3.1.11",
|
"lodash": "^4.17.23",
|
||||||
"notistack": "^3.0.1",
|
"material-symbols": "^0.40.2",
|
||||||
"react": "18.3.1",
|
"motion": "^12.33.0",
|
||||||
|
"notistack": "^3.0.2",
|
||||||
|
"react": "^19.2.4",
|
||||||
"react-blurhash": "^0.3.0",
|
"react-blurhash": "^0.3.0",
|
||||||
"react-dnd": "^16.0.1",
|
"react-dnd": "^16.0.1",
|
||||||
"react-dnd-html5-backend": "^16.0.1",
|
"react-dnd-html5-backend": "^16.0.1",
|
||||||
"react-dom": "18.3.1",
|
"react-dom": "^19.2.4",
|
||||||
"react-error-boundary": "^4.0.13",
|
"react-error-boundary": "^6.1.0",
|
||||||
"react-markdown": "^9.0.1",
|
"react-intersection-observer": "^10.0.2",
|
||||||
"react-multi-carousel": "^2.8.5",
|
"react-markdown": "^10.1.0",
|
||||||
"react-player": "^2.16.0",
|
"react-multi-carousel": "^2.8.6",
|
||||||
"react-use-konami": "^1.1.0",
|
"react-player": "^3.4.0",
|
||||||
"remark-gfm": "^4.0.0",
|
"remark-gfm": "^4.0.1",
|
||||||
"typescript": "^5.5.4",
|
"typescript": "^5.9.3",
|
||||||
"vite-plugin-svgr": "^4.2.0",
|
"vite-plugin-svgr": "^4.5.0",
|
||||||
"wavesurfer.js": "^7.8.4",
|
"vite-plugin-top-level-await": "^1.6.0",
|
||||||
"zustand": "^4.5.5"
|
"wavesurfer.js": "^7.12.1",
|
||||||
|
"zod": "^4.3.6",
|
||||||
|
"zustand": "5.0.11"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/plugin-proposal-optional-chaining-assign": "^7.24.7",
|
"@babel/plugin-proposal-optional-chaining-assign": "^7.27.1",
|
||||||
"@biomejs/biome": "^1.8.3",
|
"@biomejs/biome": "^2.3.14",
|
||||||
"@tanstack/router-cli": "^1.56.1",
|
"@tanstack/router-cli": "^1.158.4",
|
||||||
"@tanstack/router-devtools": "^1.56.1",
|
"@tanstack/router-devtools": "^1.158.4",
|
||||||
"@tanstack/router-vite-plugin": "^1.56.1",
|
"@tanstack/router-vite-plugin": "^1.158.4",
|
||||||
"@tauri-apps/cli": "2.0.0-beta.22",
|
"@tauri-apps/cli": "2.10.0",
|
||||||
"@types/lodash": "^4.17.7",
|
"@types/lodash": "^4.17.23",
|
||||||
"@vitejs/plugin-react": "^4.3.1",
|
"@vitejs/plugin-react": "^5.1.3",
|
||||||
|
"babel-plugin-react-compiler": "19.1.0-rc.3",
|
||||||
|
"eslint-plugin-react-hooks": "7.0.1",
|
||||||
"prop-types": "^15.8.1",
|
"prop-types": "^15.8.1",
|
||||||
"sass": "^1.78.0",
|
"sass": "^1.97.3",
|
||||||
"vite": "^5.4.3"
|
"vite": "^7.3.1",
|
||||||
|
"vite-plugin-wasm": "^3.5.0"
|
||||||
},
|
},
|
||||||
"license": "GPL-3.0-only"
|
"license": "GPL-3.0-only"
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
onlyBuiltDependencies:
|
||||||
|
- '@parcel/watcher'
|
||||||
|
- core-js
|
||||||
|
- esbuild
|
||||||
|
After Width: | Height: | Size: 287 KiB |
@@ -1,10 +1,10 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "blink"
|
name = "blink"
|
||||||
version = "0.0.6-dev"
|
version = "1.0.0-alpha.4"
|
||||||
description = "A Modern Jellyfin Client"
|
description = "A Modern Jellyfin Client"
|
||||||
authors = ["prayag17", "JellyPlayer contributors (https://github.com/prayag17/JellyPlayer/graphs/contributors)"]
|
authors = ["prayag17", "Blink contributors (https://github.com/prayag17/Blink/graphs/contributors)"]
|
||||||
license = "GPL-3.0-only"
|
license = "GPL-3.0-only"
|
||||||
repository = "https://github.com/prayag17/JellyPlayer/"
|
repository = "https://github.com/prayag17/Blink/"
|
||||||
default-run = "blink"
|
default-run = "blink"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.59"
|
rust-version = "1.59"
|
||||||
@@ -12,21 +12,24 @@ rust-version = "1.59"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tauri-build = { version = "2.0.0-beta", features = [] }
|
tauri-build = { version = "2.5.4", features = [] }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
log = "^0.4.21"
|
log = "^0.4.21"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
tauri = { version = "2.0.0-beta", features = [ "devtools"] }
|
tauri = { version = "2.10.1", features = [ "devtools"] }
|
||||||
tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||||
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||||
tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2", features = ["colored"] }
|
tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2", features = ["colored"] }
|
||||||
tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
|
||||||
portpicker = "0.1" # used in the example to pick a random free port
|
portpicker = "0.1" # used in the example to pick a random free port
|
||||||
tauri-plugin-process = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
tauri-plugin-process = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||||
tauri-plugin-updater = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
tauri-plugin-updater = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||||
tauri-plugin-clipboard-manager = "2.1.0-beta.6"
|
tauri-plugin-clipboard-manager = "2.1.0-beta.6"
|
||||||
|
tauri-plugin-notification = "2.0.0-rc.1"
|
||||||
|
tauri-plugin-upload = "2.0.0"
|
||||||
|
tauri-plugin-dialog = "2.0.0"
|
||||||
|
tauri-plugin-shell = "2.3.5"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# by default Tauri runs in production mode
|
# by default Tauri runs in production mode
|
||||||
@@ -35,3 +38,7 @@ default = [ "custom-protocol" ]
|
|||||||
# 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" ]
|
||||||
|
|
||||||
|
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||||
|
tauri-plugin-global-shortcut = "2"
|
||||||
|
tauri-plugin-window-state = "2"
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"identifier": "desktop-capability",
|
||||||
|
"platforms": [
|
||||||
|
"macOS",
|
||||||
|
"windows",
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"windows": [
|
||||||
|
"main"
|
||||||
|
],
|
||||||
|
"permissions": [
|
||||||
|
"window-state:default",
|
||||||
|
"global-shortcut:default",
|
||||||
|
"global-shortcut:allow-is-registered",
|
||||||
|
"global-shortcut:allow-register",
|
||||||
|
"global-shortcut:allow-unregister",
|
||||||
|
"shell:default"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -12,6 +12,15 @@
|
|||||||
"store:allow-keys",
|
"store:allow-keys",
|
||||||
"store:allow-load",
|
"store:allow-load",
|
||||||
"updater:allow-check",
|
"updater:allow-check",
|
||||||
"updater:allow-download-and-install"
|
"updater:allow-download-and-install",
|
||||||
|
"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"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1,17 +1,20 @@
|
|||||||
{
|
{
|
||||||
"$schema": "../gen/schemas/desktop-schema.json",
|
"$schema": "../gen/schemas/desktop-schema.json",
|
||||||
"identifier": "migrated",
|
"identifier": "migrated",
|
||||||
"description": "permissions that were migrated from v1",
|
"description": "permissions that were migrated from v1",
|
||||||
"local": true,
|
"local": true,
|
||||||
"windows": ["main"],
|
"windows": [
|
||||||
"permissions": [
|
"main"
|
||||||
"core:path:default",
|
],
|
||||||
"core:event:default",
|
"permissions": [
|
||||||
"core:window:default",
|
"core:path:default",
|
||||||
"core:app:default",
|
"core:event:default",
|
||||||
"core:resources:default",
|
"core:window:default",
|
||||||
"core:menu:default",
|
"core:app:default",
|
||||||
"core:tray:default",
|
"core:resources:default",
|
||||||
"core:window:allow-set-fullscreen"
|
"core:menu:default",
|
||||||
]
|
"core:tray:default",
|
||||||
|
"core:window:allow-set-fullscreen",
|
||||||
|
"shell:default"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
@@ -1 +1 @@
|
|||||||
{"clipboard-manager":{"default_permission":{"identifier":"default","description":"No features are enabled by default, as we believe\nthe clipboard can be inherently dangerous and it is \napplication specific if read and/or write access is needed.\n\nClipboard interaction needs to be explicitly enabled.\n","permissions":[]},"permissions":{"allow-clear":{"identifier":"allow-clear","description":"Enables the clear command without any pre-configured scope.","commands":{"allow":["clear"],"deny":[]}},"allow-read-image":{"identifier":"allow-read-image","description":"Enables the read_image command without any pre-configured scope.","commands":{"allow":["read_image"],"deny":[]}},"allow-read-text":{"identifier":"allow-read-text","description":"Enables the read_text command without any pre-configured scope.","commands":{"allow":["read_text"],"deny":[]}},"allow-write-html":{"identifier":"allow-write-html","description":"Enables the write_html command without any pre-configured scope.","commands":{"allow":["write_html"],"deny":[]}},"allow-write-image":{"identifier":"allow-write-image","description":"Enables the write_image command without any pre-configured scope.","commands":{"allow":["write_image"],"deny":[]}},"allow-write-text":{"identifier":"allow-write-text","description":"Enables the write_text command without any pre-configured scope.","commands":{"allow":["write_text"],"deny":[]}},"deny-clear":{"identifier":"deny-clear","description":"Denies the clear command without any pre-configured scope.","commands":{"allow":[],"deny":["clear"]}},"deny-read-image":{"identifier":"deny-read-image","description":"Denies the read_image command without any pre-configured scope.","commands":{"allow":[],"deny":["read_image"]}},"deny-read-text":{"identifier":"deny-read-text","description":"Denies the read_text command without any pre-configured scope.","commands":{"allow":[],"deny":["read_text"]}},"deny-write-html":{"identifier":"deny-write-html","description":"Denies the write_html command without any pre-configured scope.","commands":{"allow":[],"deny":["write_html"]}},"deny-write-image":{"identifier":"deny-write-image","description":"Denies the write_image command without any pre-configured scope.","commands":{"allow":[],"deny":["write_image"]}},"deny-write-text":{"identifier":"deny-write-text","description":"Denies the write_text command without any pre-configured scope.","commands":{"allow":[],"deny":["write_text"]}}},"permission_sets":{},"global_scope_schema":null},"core:app":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-version","allow-name","allow-tauri-version"]},"permissions":{"allow-app-hide":{"identifier":"allow-app-hide","description":"Enables the app_hide command without any pre-configured scope.","commands":{"allow":["app_hide"],"deny":[]}},"allow-app-show":{"identifier":"allow-app-show","description":"Enables the app_show command without any pre-configured scope.","commands":{"allow":["app_show"],"deny":[]}},"allow-default-window-icon":{"identifier":"allow-default-window-icon","description":"Enables the default_window_icon command without any pre-configured scope.","commands":{"allow":["default_window_icon"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","commands":{"allow":["name"],"deny":[]}},"allow-tauri-version":{"identifier":"allow-tauri-version","description":"Enables the tauri_version command without any pre-configured scope.","commands":{"allow":["tauri_version"],"deny":[]}},"allow-version":{"identifier":"allow-version","description":"Enables the version command without any pre-configured scope.","commands":{"allow":["version"],"deny":[]}},"deny-app-hide":{"identifier":"deny-app-hide","description":"Denies the app_hide command without any pre-configured scope.","commands":{"allow":[],"deny":["app_hide"]}},"deny-app-show":{"identifier":"deny-app-show","description":"Denies the app_show command without any pre-configured scope.","commands":{"allow":[],"deny":["app_show"]}},"deny-default-window-icon":{"identifier":"deny-default-window-icon","description":"Denies the default_window_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["default_window_icon"]}},"deny-name":{"identifier":"deny-name","description":"Denies the name command without any pre-configured scope.","commands":{"allow":[],"deny":["name"]}},"deny-tauri-version":{"identifier":"deny-tauri-version","description":"Denies the tauri_version command without any pre-configured scope.","commands":{"allow":[],"deny":["tauri_version"]}},"deny-version":{"identifier":"deny-version","description":"Denies the version command without any pre-configured scope.","commands":{"allow":[],"deny":["version"]}}},"permission_sets":{},"global_scope_schema":null},"core:event":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["alloLine truncated
|
{"clipboard-manager":{"default_permission":{"identifier":"default","description":"No features are enabled by default, as we believe\nthe clipboard can be inherently dangerous and it is \napplication specific if read and/or write access is needed.\n\nClipboard interaction needs to be explicitly enabled.\n","permissions":[]},"permissions":{"allow-clear":{"identifier":"allow-clear","description":"Enables the clear command without any pre-configured scope.","commands":{"allow":["clear"],"deny":[]}},"allow-read-image":{"identifier":"allow-read-image","description":"Enables the read_image command without any pre-configured scope.","commands":{"allow":["read_image"],"deny":[]}},"allow-read-text":{"identifier":"allow-read-text","description":"Enables the read_text command without any pre-configured scope.","commands":{"allow":["read_text"],"deny":[]}},"allow-write-html":{"identifier":"allow-write-html","description":"Enables the write_html command without any pre-configured scope.","commands":{"allow":["write_html"],"deny":[]}},"allow-write-image":{"identifier":"allow-write-image","description":"Enables the write_image command without any pre-configured scope.","commands":{"allow":["write_image"],"deny":[]}},"allow-write-text":{"identifier":"allow-write-text","description":"Enables the write_text command without any pre-configured scope.","commands":{"allow":["write_text"],"deny":[]}},"deny-clear":{"identifier":"deny-clear","description":"Denies the clear command without any pre-configured scope.","commands":{"allow":[],"deny":["clear"]}},"deny-read-image":{"identifier":"deny-read-image","description":"Denies the read_image command without any pre-configured scope.","commands":{"allow":[],"deny":["read_image"]}},"deny-read-text":{"identifier":"deny-read-text","description":"Denies the read_text command without any pre-configured scope.","commands":{"allow":[],"deny":["read_text"]}},"deny-write-html":{"identifier":"deny-write-html","description":"Denies the write_html command without any pre-configured scope.","commands":{"allow":[],"deny":["write_html"]}},"deny-write-image":{"identifier":"deny-write-image","description":"Denies the write_image command without any pre-configured scope.","commands":{"allow":[],"deny":["write_image"]}},"deny-write-text":{"identifier":"deny-write-text","description":"Denies the write_text command without any pre-configured scope.","commands":{"allow":[],"deny":["write_text"]}}},"permission_sets":{},"global_scope_schema":null},"core":{"default_permission":{"identifier":"default","description":"Default core plugins set.","permissions":["core:path:default","core:event:default","core:window:default","core:webview:default","core:app:default","core:image:default","core:resources:default","core:menu:default","core:tray:default"]},"permissions":{},"permission_sets":{},"global_scope_schema":null},"core:app":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-version","allow-name","allow-tauri-version","allow-identifier","allow-bundle-type","allow-register-listener","allow-remove-listener"]},"permissions":{"allow-app-hide":{"identifier":"allow-app-hide","description":"Enables the app_hide command without any pre-configured scope.","commands":{"allow":["app_hide"],"deny":[]}},"allow-app-show":{"identifier":"allow-app-show","description":"Enables the app_show command without any pre-configured scope.","commands":{"allow":["app_show"],"deny":[]}},"allow-bundle-type":{"identifier":"allow-bundle-type","description":"Enables the bundle_type command without any pre-configured scope.","commands":{"allow":["bundle_type"],"deny":[]}},"allow-default-window-icon":{"identifier":"allow-default-window-icon","description":"Enables the default_window_icon command without any pre-configured scope.","commands":{"allow":["default_window_icon"],"deny":[]}},"allow-fetch-data-store-identifiers":{"identifier":"allow-fetch-data-store-identifiers","description":"Enables the fetch_data_store_identifiers command without any pre-configured scope.","commands":{"allow":["fetch_data_store_identifiers"],"deny":[]}},"allow-identifier":{"identifier":"allow-identifier","description":"Enables the identifier command without any pre-configured scope.","commands":{"allow":["identifier"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","commands":{"allow":["name"],"deny":[]}},"allow-register-listener":{"identifier":"allow-register-listener","description":"Enables the register_listener command without any pre-configured scope.","commands":{"allow":["register_listener"],"deny":[]}},"allow-remove-data-store":{"identifier":"allow-remove-data-store","description":"Enables the remove_data_store command without any pre-configured scope.","commands":{"allow":["remove_data_store"],"deny":[]}},"allow-remove-listener":{"identifier":"allow-remove-listener","description":"Enables the remove_listener commLine truncated
|
||||||
@@ -1 +1 @@
|
|||||||
{"main-capabilities":{"identifier":"main-capabilities","description":"Capability for desktop window","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","store:allow-clear","store:allow-delete","store:allow-keys","store:allow-load","updater:allow-check","updater:allow-download-and-install"]},"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"]}}
|
{"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"]}}
|
||||||
@@ -4,6 +4,12 @@ use tauri_plugin_log::{fern::colors::ColoredLevelConfig, Target, TargetKind};
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
|
.plugin(tauri_plugin_shell::init())
|
||||||
|
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
|
||||||
|
.plugin(tauri_plugin_window_state::Builder::new().build())
|
||||||
|
.plugin(tauri_plugin_dialog::init())
|
||||||
|
.plugin(tauri_plugin_upload::init())
|
||||||
|
.plugin(tauri_plugin_notification::init())
|
||||||
.plugin(tauri_plugin_clipboard_manager::init())
|
.plugin(tauri_plugin_clipboard_manager::init())
|
||||||
.plugin(
|
.plugin(
|
||||||
tauri_plugin_log::Builder::default()
|
tauri_plugin_log::Builder::default()
|
||||||
@@ -15,5 +21,5 @@ fn main() {
|
|||||||
.plugin(tauri_plugin_updater::Builder::default().build())
|
.plugin(tauri_plugin_updater::Builder::default().build())
|
||||||
// .plugin(tauri_plugin_window_state::Builder::default().build())
|
// .plugin(tauri_plugin_window_state::Builder::default().build())
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running JellyPlayer");
|
.expect("error while running Blink");
|
||||||
}
|
}
|
||||||
@@ -1,89 +1,87 @@
|
|||||||
{
|
{
|
||||||
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
|
"build": {
|
||||||
"build": {
|
"beforeBuildCommand": "pnpm run build",
|
||||||
"beforeBuildCommand": "pnpm run build",
|
"beforeDevCommand": "pnpm run dev",
|
||||||
"beforeDevCommand": "pnpm run dev",
|
"frontendDist": "../dist",
|
||||||
"frontendDist": "../dist",
|
"devUrl": "http://localhost:5173"
|
||||||
"devUrl": "http://localhost:5173"
|
},
|
||||||
},
|
"bundle": {
|
||||||
"bundle": {
|
"active": true,
|
||||||
"active": true,
|
"category": "Video",
|
||||||
"category": "Video",
|
"copyright": "GPL-3.0-only",
|
||||||
"copyright": "GPL-3.0-only",
|
"windows": {
|
||||||
"windows": {
|
"certificateThumbprint": null,
|
||||||
"certificateThumbprint": null,
|
"digestAlgorithm": "sha256",
|
||||||
"digestAlgorithm": "sha256",
|
"timestampUrl": "",
|
||||||
"timestampUrl": "",
|
"nsis": {
|
||||||
"nsis": {
|
"sidebarImage": "../public/installerSideBarImage.bmp",
|
||||||
"sidebarImage": "../public/installerSideBarImage.bmp",
|
"headerImage": "../public/installerHeaderImage.bmp",
|
||||||
"headerImage": "../public/installerHeaderImage.bmp",
|
"installerIcon": "icons/icon.ico",
|
||||||
"installerIcon": "icons/icon.ico",
|
"displayLanguageSelector": true
|
||||||
"displayLanguageSelector": true
|
}
|
||||||
}
|
},
|
||||||
},
|
"externalBin": [],
|
||||||
"externalBin": [],
|
"icon": [
|
||||||
"icon": [
|
"icons/32x32.png",
|
||||||
"icons/32x32.png",
|
"icons/128x128.png",
|
||||||
"icons/128x128.png",
|
"icons/128x128@2x.png",
|
||||||
"icons/128x128@2x.png",
|
"icons/icon.icns",
|
||||||
"icons/icon.icns",
|
"icons/icon.ico"
|
||||||
"icons/icon.ico"
|
],
|
||||||
],
|
"linux": {
|
||||||
"linux": {
|
"deb": {
|
||||||
"deb": {
|
"depends": []
|
||||||
"depends": []
|
},
|
||||||
},
|
"appimage": {
|
||||||
"appimage": {
|
"bundleMediaFramework": true
|
||||||
"bundleMediaFramework": true
|
}
|
||||||
}
|
},
|
||||||
},
|
"longDescription": "A modern desktop client for Jellyfin",
|
||||||
"longDescription": "A modern desktop client for Jellyfin",
|
"macOS": {
|
||||||
"macOS": {
|
"entitlements": null,
|
||||||
"entitlements": null,
|
"exceptionDomain": "",
|
||||||
"exceptionDomain": "",
|
"frameworks": [],
|
||||||
"frameworks": [],
|
"providerShortName": null,
|
||||||
"providerShortName": null,
|
"signingIdentity": null
|
||||||
"signingIdentity": null
|
},
|
||||||
},
|
"resources": [],
|
||||||
"resources": [],
|
"shortDescription": "Blink",
|
||||||
"shortDescription": "Blink",
|
"targets": ["deb", "appimage", "nsis", "app", "dmg"],
|
||||||
"targets": [
|
"licenseFile": "../LICENSE",
|
||||||
"deb",
|
"createUpdaterArtifacts": "v1Compatible"
|
||||||
"appimage",
|
},
|
||||||
"nsis",
|
"productName": "Blink",
|
||||||
"app",
|
"version": "../package.json",
|
||||||
"dmg"
|
"identifier": "com.blink.prayag17",
|
||||||
],
|
"plugins": {
|
||||||
"licenseFile": "../LICENSE",
|
"updater": {
|
||||||
"createUpdaterArtifacts": "v1Compatible"
|
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEZBOTJGNzM3REU2Q0JEMEYKUldRUHZXemVOL2VTK2k2andMWTZYbEN6SnIwV0V0L2Z3NlA4RzFabThPaXRqSFRMc004WGhCb2kK",
|
||||||
},
|
"endpoints": [
|
||||||
"productName": "Blink",
|
"https://rawcdn.githack.com/prayag17/Blink/refs/heads/main/latest.json"
|
||||||
"version": "../package.json",
|
],
|
||||||
"identifier": "com.blink.prayag17",
|
"windows": {
|
||||||
"plugins": {
|
"installMode": "passive"
|
||||||
"updater": {
|
}
|
||||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEZEMTg0MjEzRDYzRjJDN0EKUldSNkxEL1dFMElZL1dxbHA0V2lyVDFEdGpOZXkxMG9XdHVLVnRpVVV5c1Z0OFNRUE45dkpxbFAK",
|
}
|
||||||
"endpoints": [
|
},
|
||||||
"https://raw.githack.com/prayag17/JellyPlayer/main/latest.json"
|
"app": {
|
||||||
]
|
"windows": [
|
||||||
}
|
{
|
||||||
},
|
"fullscreen": false,
|
||||||
"app": {
|
"height": 600,
|
||||||
"windows": [
|
"width": 800,
|
||||||
{
|
"resizable": true,
|
||||||
"fullscreen": false,
|
"title": "Blink",
|
||||||
"height": 600,
|
"visible": true,
|
||||||
"width": 800,
|
"center": true,
|
||||||
"resizable": true,
|
"label": "main",
|
||||||
"title": "Blink",
|
"dragDropEnabled": false,
|
||||||
"visible": true,
|
"backgroundColor": "#08001f",
|
||||||
"center": true,
|
"transparent": false
|
||||||
"label": "main",
|
}
|
||||||
"dragDropEnabled": false
|
],
|
||||||
}
|
"security": {
|
||||||
],
|
"csp": null
|
||||||
"security": {
|
}
|
||||||
"csp": null
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
After Width: | Height: | Size: 103 KiB |
@@ -1,3 +1,3 @@
|
|||||||
<svg width="1310" height="1512" viewBox="0 0 1310 1512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg width="1512" height="1512" viewBox="0 0 1512 1512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M654.715 756L52 1103.98L654.715 1451.96L1257.43 1103.98V408.022L654.715 60.0444L52 408.022L654.715 756ZM654.715 0L1309.43 378V1134L654.715 1512L0 1134V1073.96V438.044V378L654.715 0Z" fill="#101010"/>
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M755.715 756L153 1103.98L755.715 1451.96L1358.43 1103.98V408.022L755.715 60.0444L153 408.022L755.715 756ZM755.715 0L1410.43 378V1134L755.715 1512L101 1134V1073.96V438.044V378L755.715 0Z" fill="white"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 360 B After Width: | Height: | Size: 362 B |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 2.8 MiB |
|
Before Width: | Height: | Size: 89 KiB |
@@ -1,4 +1,3 @@
|
|||||||
import useDebounce from "@/utils/hooks/useDebounce";
|
|
||||||
import React, {
|
import React, {
|
||||||
type ReactNode,
|
type ReactNode,
|
||||||
useCallback,
|
useCallback,
|
||||||
@@ -11,12 +10,7 @@ import { useSpring } from "@react-spring/web";
|
|||||||
import { debounce } from "lodash";
|
import { debounce } from "lodash";
|
||||||
|
|
||||||
import "./style.scss";
|
import "./style.scss";
|
||||||
import { Button, IconButton } from "@mui/material";
|
import { IconButton } from "@mui/material";
|
||||||
|
|
||||||
enum Direction {
|
|
||||||
RIGHT = 0,
|
|
||||||
LEFT = 1,
|
|
||||||
}
|
|
||||||
|
|
||||||
const Slider = ({
|
const Slider = ({
|
||||||
content,
|
content,
|
||||||
@@ -76,7 +70,7 @@ const Slider = ({
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const slide = (direction: Direction) => {
|
const slideLeft = useCallback(() => {
|
||||||
const clientWidth =
|
const clientWidth =
|
||||||
containerRef.current?.getBoundingClientRect().width ?? 0;
|
containerRef.current?.getBoundingClientRect().width ?? 0;
|
||||||
const cardWidth =
|
const cardWidth =
|
||||||
@@ -86,66 +80,75 @@ const Slider = ({
|
|||||||
const visibleItems = Math.floor(clientWidth / cardWidth);
|
const visibleItems = Math.floor(clientWidth / cardWidth);
|
||||||
const scrollOffset = scrollPosition % cardWidth;
|
const scrollOffset = scrollPosition % cardWidth;
|
||||||
|
|
||||||
if (direction === Direction.LEFT) {
|
const newX = Math.max(
|
||||||
const newX = Math.max(
|
scrollPosition - scrollOffset - visibleItems * cardWidth,
|
||||||
scrollPosition - scrollOffset - visibleItems * cardWidth,
|
0,
|
||||||
0,
|
);
|
||||||
);
|
setX({
|
||||||
setX.start({
|
from: { x: scrollPosition },
|
||||||
from: { x: scrollPosition },
|
to: { x: newX },
|
||||||
to: { x: newX },
|
onChange: (results) => {
|
||||||
onChange: (results) => {
|
if (containerRef.current) {
|
||||||
if (containerRef.current) {
|
containerRef.current.scrollLeft = results.value.x;
|
||||||
containerRef.current.scrollLeft = results.value.x;
|
}
|
||||||
}
|
},
|
||||||
},
|
reset: true,
|
||||||
reset: true,
|
config: { friction: 60, tension: 1000, velocity: 2 },
|
||||||
config: { friction: 60, tension: 1000, velocity: 2 },
|
});
|
||||||
});
|
|
||||||
|
|
||||||
if (newX === 0) {
|
if (newX === 0) {
|
||||||
setScrollPos({ isStart: true, isEnd: false });
|
setScrollPos({ isStart: true, isEnd: false });
|
||||||
} else {
|
} else {
|
||||||
setScrollPos({ isStart: false, isEnd: false });
|
setScrollPos({ isStart: false, isEnd: false });
|
||||||
}
|
|
||||||
} else if (direction === Direction.RIGHT) {
|
|
||||||
const newX = Math.min(
|
|
||||||
scrollPosition - scrollOffset + visibleItems * cardWidth,
|
|
||||||
containerRef.current?.scrollWidth ?? 0 - clientWidth,
|
|
||||||
);
|
|
||||||
setX.start({
|
|
||||||
from: { x: scrollPosition },
|
|
||||||
to: { x: newX },
|
|
||||||
onChange: (results) => {
|
|
||||||
if (containerRef.current) {
|
|
||||||
containerRef.current.scrollLeft = results.value.x;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
reset: true,
|
|
||||||
config: { friction: 60, tension: 500, velocity: 2 },
|
|
||||||
});
|
|
||||||
|
|
||||||
if (newX >= (containerRef.current?.scrollWidth ?? 0) - clientWidth) {
|
|
||||||
setScrollPos({ isStart: false, isEnd: true });
|
|
||||||
} else {
|
|
||||||
setScrollPos({ isStart: false, isEnd: false });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
}, [setX]);
|
||||||
|
|
||||||
|
const slideRight = useCallback(() => {
|
||||||
|
const clientWidth =
|
||||||
|
containerRef.current?.getBoundingClientRect().width ?? 0;
|
||||||
|
const cardWidth =
|
||||||
|
containerRef.current?.firstElementChild?.getBoundingClientRect().width ??
|
||||||
|
0;
|
||||||
|
const scrollPosition = containerRef.current?.scrollLeft ?? 0;
|
||||||
|
const visibleItems = Math.floor(clientWidth / cardWidth);
|
||||||
|
const scrollOffset = scrollPosition % cardWidth;
|
||||||
|
|
||||||
|
const newX = Math.min(
|
||||||
|
scrollPosition - scrollOffset + visibleItems * cardWidth,
|
||||||
|
containerRef.current?.scrollWidth ?? 0 - clientWidth,
|
||||||
|
);
|
||||||
|
setX({
|
||||||
|
from: { x: scrollPosition },
|
||||||
|
to: { x: newX },
|
||||||
|
onChange: (results) => {
|
||||||
|
if (containerRef.current) {
|
||||||
|
containerRef.current.scrollLeft = results.value.x;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
reset: true,
|
||||||
|
config: { friction: 60, tension: 500, velocity: 2 },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (newX >= (containerRef.current?.scrollWidth ?? 0) - clientWidth) {
|
||||||
|
setScrollPos({ isStart: false, isEnd: true });
|
||||||
|
} else {
|
||||||
|
setScrollPos({ isStart: false, isEnd: false });
|
||||||
|
}
|
||||||
|
}, [setX]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="slider">
|
<div className="slider">
|
||||||
<IconButton
|
<IconButton
|
||||||
className="slider-button left"
|
className="slider-button left"
|
||||||
onClick={() => slide(Direction.LEFT)}
|
onClick={slideLeft}
|
||||||
disabled={scrollPos.isStart}
|
disabled={scrollPos.isStart}
|
||||||
variant="contained"
|
|
||||||
>
|
>
|
||||||
<span className="material-symbols-rounded">chevron_left</span>
|
<span className="material-symbols-rounded">chevron_left</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<div className="slider-track" ref={containerRef} onScroll={onScroll}>
|
<div className="slider-track" ref={containerRef} onScroll={onScroll}>
|
||||||
{content?.map((item, index) => (
|
{content?.map((item, index) => (
|
||||||
<div
|
<div
|
||||||
|
//biome-ignore lint/suspicious/noArrayIndexKey: item does not have a unique key
|
||||||
key={index}
|
key={index}
|
||||||
className={
|
className={
|
||||||
currentSlide === index
|
currentSlide === index
|
||||||
@@ -159,9 +162,8 @@ const Slider = ({
|
|||||||
</div>
|
</div>
|
||||||
<IconButton
|
<IconButton
|
||||||
className="slider-button right"
|
className="slider-button right"
|
||||||
onClick={() => slide(Direction.RIGHT)}
|
onClick={slideRight}
|
||||||
disabled={scrollPos.isEnd}
|
disabled={scrollPos.isEnd}
|
||||||
variant="contained"
|
|
||||||
>
|
>
|
||||||
<span className="material-symbols-rounded">chevron_right</span>
|
<span className="material-symbols-rounded">chevron_right</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|||||||
@@ -0,0 +1,162 @@
|
|||||||
|
import { LoadingButton } from "@mui/lab";
|
||||||
|
import {
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Dialog,
|
||||||
|
InputBase,
|
||||||
|
Stack,
|
||||||
|
Typography,
|
||||||
|
} from "@mui/material";
|
||||||
|
import { useMutation } from "@tanstack/react-query";
|
||||||
|
import { enqueueSnackbar } from "notistack";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import { setServer } from "@/utils/storage/servers";
|
||||||
|
import { jellyfin } from "@/utils/store/api";
|
||||||
|
|
||||||
|
type AddServerDialogProps = {
|
||||||
|
open: boolean;
|
||||||
|
setAddServerDialog: (value: boolean) => void;
|
||||||
|
sideEffect?: () => Promise<unknown>;
|
||||||
|
hideBackdrop?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function AddServerDialog(props: AddServerDialogProps) {
|
||||||
|
const { open, setAddServerDialog, sideEffect, hideBackdrop } = props;
|
||||||
|
|
||||||
|
const [serverIp, setServerIp] = useState("");
|
||||||
|
const addServer = useMutation({
|
||||||
|
mutationKey: ["add-server"],
|
||||||
|
mutationFn: async () => {
|
||||||
|
const servers =
|
||||||
|
await jellyfin.discovery.getRecommendedServerCandidates(serverIp);
|
||||||
|
const bestServer = jellyfin.discovery.findBestServer(servers);
|
||||||
|
return bestServer;
|
||||||
|
},
|
||||||
|
onSuccess: async (bestServer) => {
|
||||||
|
if (bestServer) {
|
||||||
|
await setServer(bestServer.systemInfo?.Id ?? "", bestServer);
|
||||||
|
setAddServerDialog(false);
|
||||||
|
enqueueSnackbar(
|
||||||
|
"Client added successfully. You might need to refresh client list.",
|
||||||
|
{
|
||||||
|
variant: "success",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (sideEffect) {
|
||||||
|
await sideEffect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onError: (err) => {
|
||||||
|
console.error(err);
|
||||||
|
enqueueSnackbar(`${err}`, { variant: "error" });
|
||||||
|
enqueueSnackbar("Something went wrong", { variant: "error" });
|
||||||
|
},
|
||||||
|
onSettled: async (bestServer) => {
|
||||||
|
if (!bestServer) {
|
||||||
|
enqueueSnackbar("Provided server address is not a Jellyfin server.", {
|
||||||
|
variant: "error",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog
|
||||||
|
open={open}
|
||||||
|
onClose={() => setAddServerDialog(false)}
|
||||||
|
hideBackdrop={Boolean(hideBackdrop)}
|
||||||
|
fullWidth
|
||||||
|
maxWidth="sm"
|
||||||
|
disableScrollLock={true}
|
||||||
|
PaperProps={{
|
||||||
|
sx: {
|
||||||
|
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,
|
||||||
|
overflow: "hidden",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Stack p={4} spacing={3}>
|
||||||
|
<Stack spacing={1} alignItems="center">
|
||||||
|
<span
|
||||||
|
className="material-symbols-rounded"
|
||||||
|
style={{
|
||||||
|
fontSize: "48px",
|
||||||
|
color: "var(--mui-palette-primary-main)",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
add_to_queue
|
||||||
|
</span>
|
||||||
|
<Typography variant="h5" fontWeight="bold" textAlign="center">
|
||||||
|
Connect to Server
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="body2" color="text.secondary" textAlign="center">
|
||||||
|
Enter your Jellyfin server address to continue
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
p: "2px 16px",
|
||||||
|
bgcolor: "rgba(0,0,0,0.2)",
|
||||||
|
borderRadius: 2,
|
||||||
|
border: "1px solid",
|
||||||
|
borderColor: "rgba(255,255,255,0.05)",
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
gap: 2,
|
||||||
|
"&:focus-within": {
|
||||||
|
borderColor: "var(--mui-palette-primary-main)",
|
||||||
|
bgcolor: "rgba(0,0,0,0.3)",
|
||||||
|
},
|
||||||
|
transition: "border-color 0.2s, background-color 0.2s",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded" style={{ opacity: 0.5 }}>
|
||||||
|
dns
|
||||||
|
</span>
|
||||||
|
<InputBase
|
||||||
|
placeholder="https://jellyfin.example.com"
|
||||||
|
fullWidth
|
||||||
|
value={serverIp}
|
||||||
|
onChange={(e) => setServerIp(e.target.value)}
|
||||||
|
sx={{ py: 1.5 }}
|
||||||
|
autoFocus
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.key === "Enter") {
|
||||||
|
addServer.mutate();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Stack direction="row" spacing={2} justifyContent="flex-end" pt={1}>
|
||||||
|
<Button
|
||||||
|
onClick={() => setAddServerDialog(false)}
|
||||||
|
color="inherit"
|
||||||
|
variant="text"
|
||||||
|
sx={{ borderRadius: 2 }}
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
|
<LoadingButton
|
||||||
|
loading={addServer.isPending}
|
||||||
|
onClick={() => addServer.mutate()}
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
sx={{ borderRadius: 2, px: 3 }}
|
||||||
|
disabled={!serverIp}
|
||||||
|
>
|
||||||
|
Connect
|
||||||
|
</LoadingButton>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
.item-info-track{
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 3em 60% 6em 1fr;
|
||||||
|
gap: 1em;
|
||||||
|
padding: 1em;
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: $border-radius-default;
|
||||||
|
transition: background $transition-time-fast;
|
||||||
|
&.header {
|
||||||
|
border-bottom: 1px solid rgb(255 255 255 / 0.2);
|
||||||
|
color: rgb(255 255 255 / 0.7);
|
||||||
|
border-radius: 0 !important;
|
||||||
|
}
|
||||||
|
.index-container {
|
||||||
|
justify-self: center;
|
||||||
|
position: relative;
|
||||||
|
.material-symbols-rounded {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
font-size: 2em !important;
|
||||||
|
opacity: 0;
|
||||||
|
transition: none !important;
|
||||||
|
color: $clr-accent-default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&-info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.1em
|
||||||
|
}
|
||||||
|
&:hover {
|
||||||
|
background: rgb(255 255 255 / 0.1) !important;
|
||||||
|
.index-container {
|
||||||
|
// font-size: 0em;
|
||||||
|
.index {
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0;
|
||||||
|
}
|
||||||
|
.material-symbols-rounded {
|
||||||
|
opacity: 1;
|
||||||
|
font-size: 2.2em !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.playing {
|
||||||
|
background: rgb(0 0 0 / 0.4) !important;
|
||||||
|
.item-info-track-info-name, .index {
|
||||||
|
color: $clr-accent-default;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.4em
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
import {
|
||||||
|
generateAudioStreamUrl,
|
||||||
|
playAudio,
|
||||||
|
useAudioPlayback,
|
||||||
|
} from "@/utils/store/audioPlayback";
|
||||||
|
import type {
|
||||||
|
BaseItemDto,
|
||||||
|
BaseItemDtoQueryResult,
|
||||||
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import { Typography } from "@mui/material";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
import { getRuntimeMusic } from "@/utils/date/time";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
import { setQueue } from "@/utils/store/queue";
|
||||||
|
import { useSnackbar } from "notistack";
|
||||||
|
import lyricsIcon from "../../assets/icons/lyrics.svg";
|
||||||
|
import LikeButton from "../buttons/likeButton";
|
||||||
|
|
||||||
|
import "./albumMusicTrack.scss";
|
||||||
|
|
||||||
|
type AlbumMusicTrackProps = {
|
||||||
|
track: BaseItemDto;
|
||||||
|
/**
|
||||||
|
* This is the index of the track in the musicTracks array (not to be confused with IndexNumber property of the track)
|
||||||
|
*/
|
||||||
|
trackIndex: number;
|
||||||
|
musicTracks: BaseItemDtoQueryResult | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function AlbumMusicTrack(props: AlbumMusicTrackProps) {
|
||||||
|
const { track, musicTracks, trackIndex } = props;
|
||||||
|
const [currentPlayingItem] = useAudioPlayback((state) => [state.item]);
|
||||||
|
|
||||||
|
const user = useCentralStore((state) => state.currentUser);
|
||||||
|
const api = useApiInContext((s) => s.api);
|
||||||
|
|
||||||
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
|
|
||||||
|
const handlePlayback = (
|
||||||
|
index: number,
|
||||||
|
item: BaseItemDto,
|
||||||
|
queue: BaseItemDto[],
|
||||||
|
) => {
|
||||||
|
if (!user?.Id || !api) {
|
||||||
|
console.error("User not logged in");
|
||||||
|
enqueueSnackbar("You need to be logged in to play music", {
|
||||||
|
variant: "error",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (item.Id) {
|
||||||
|
const url = generateAudioStreamUrl(
|
||||||
|
item.Id,
|
||||||
|
user.Id,
|
||||||
|
api.deviceInfo.id,
|
||||||
|
api.basePath,
|
||||||
|
api.accessToken,
|
||||||
|
);
|
||||||
|
playAudio(url, item);
|
||||||
|
setQueue(queue, index);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={
|
||||||
|
currentPlayingItem?.Id === track.Id
|
||||||
|
? "item-info-track playing"
|
||||||
|
: "item-info-track"
|
||||||
|
}
|
||||||
|
key={track.Id}
|
||||||
|
onClick={() => {
|
||||||
|
if (musicTracks?.Items) {
|
||||||
|
handlePlayback(trackIndex, track, musicTracks.Items);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className="index-container">
|
||||||
|
<span className="material-symbols-rounded fill ">play_arrow</span>
|
||||||
|
<Typography className="index">{track.IndexNumber ?? "-"}</Typography>
|
||||||
|
</div>
|
||||||
|
<div className="item-info-track-info">
|
||||||
|
<Typography className="item-info-track-info-name">
|
||||||
|
{track.Name}
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
variant="subtitle2"
|
||||||
|
style={{
|
||||||
|
opacity: 0.6,
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
gap: "0.6em",
|
||||||
|
}}
|
||||||
|
fontWeight={300}
|
||||||
|
>
|
||||||
|
{track.HasLyrics && <img src={lyricsIcon} alt="lyrics" />}
|
||||||
|
{track.Artists?.join(", ")}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
<Typography>{getRuntimeMusic(track.RunTimeTicks ?? 0)}</Typography>
|
||||||
|
<div className="flex flex-align-center">
|
||||||
|
<LikeButton
|
||||||
|
itemId={track.Id}
|
||||||
|
isFavorite={track.UserData?.IsFavorite}
|
||||||
|
queryKey={["item", "musicTracks"]}
|
||||||
|
userId={user?.Id}
|
||||||
|
itemName={track.Name}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
.alpha-selector {
|
||||||
|
position: sticky;
|
||||||
|
top: 80px;
|
||||||
|
right: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
padding: 4px;
|
||||||
|
margin-left: auto;
|
||||||
|
user-select: none;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alpha-letter {
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1;
|
||||||
|
padding: 6px 8px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: transparent;
|
||||||
|
color: rgba(255,255,255,0.7);
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alpha-letter.active {
|
||||||
|
background: rgba(255,255,255,0.12);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alpha-letter:hover {
|
||||||
|
background: rgba(255,255,255,0.08);
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
import { getRouteApi } from "@tanstack/react-router";
|
||||||
|
import React, { useMemo } from "react";
|
||||||
|
import { useShallow } from "zustand/shallow";
|
||||||
|
import { useLibraryStateStore } from "@/utils/store/libraryState";
|
||||||
|
import "./alphaSelector.scss";
|
||||||
|
|
||||||
|
const libraryRoute = getRouteApi("/_api/library/$id");
|
||||||
|
|
||||||
|
export const AlphaSelector = React.memo(function AlphaSelector() {
|
||||||
|
const { id: currentLibraryId } = libraryRoute.useParams();
|
||||||
|
const { nameStartsWith } = useLibraryStateStore(
|
||||||
|
useShallow((s) => ({
|
||||||
|
nameStartsWith: s.libraries[currentLibraryId || ""]?.nameStartsWith,
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
const updateLibrary = useLibraryStateStore((s) => s.updateLibrary);
|
||||||
|
|
||||||
|
const letters = useMemo(() => {
|
||||||
|
const arr = Array.from({ length: 26 }, (_, i) =>
|
||||||
|
String.fromCharCode(65 + i),
|
||||||
|
);
|
||||||
|
return ["All", ...arr];
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleSelect = (letter: string) => {
|
||||||
|
const value = letter === "All" ? undefined : letter;
|
||||||
|
if (currentLibraryId)
|
||||||
|
updateLibrary(currentLibraryId, { nameStartsWith: value });
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="alpha-selector">
|
||||||
|
{letters.map((l) => {
|
||||||
|
const active = (nameStartsWith || "All") === l;
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
key={l}
|
||||||
|
className={active ? "alpha-letter active" : "alpha-letter"}
|
||||||
|
onClick={() => handleSelect(l)}
|
||||||
|
aria-label={`Filter by ${l}`}
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
{l}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
export default AlphaSelector;
|
||||||
@@ -1,20 +1,48 @@
|
|||||||
|
|
||||||
.appBar {
|
.appBar {
|
||||||
transition: background-color $transition-time-fast,
|
// Limit transitions to cheaper properties; avoid animating box-shadow directly
|
||||||
backdrop-filter $transition-time-fast,
|
transition: background-color $transition-time-fast;
|
||||||
box-shadow $transition-time-default !important;
|
|
||||||
padding: 0.8em ($page-margin - 1.7em);
|
padding: 0.8em ($page-margin - 1.7em);
|
||||||
z-index: 999 !important;
|
z-index: 999 !important;
|
||||||
.flex {
|
.flex {
|
||||||
transition: $transition-time-fast;
|
// Avoid animating padding; it causes layout reflow on each frame.
|
||||||
|
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;
|
||||||
|
|
||||||
|
// 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
|
||||||
|
.flex-inner {
|
||||||
|
transform-origin: top center;
|
||||||
|
transition: transform $transition-time-fast;
|
||||||
}
|
}
|
||||||
&.elevated{
|
&.elevated{
|
||||||
.flex {
|
.flex {
|
||||||
padding: 0.5em;
|
&::after {
|
||||||
background: rgb(0 0 0 / 0.4);
|
opacity: 1;
|
||||||
backdrop-filter: blur(40px);
|
}
|
||||||
box-shadow: 0 0 25px rgb(0 0 0 / 0.45);
|
}
|
||||||
|
|
||||||
|
// Apply a subtle scale to simulate shrink without layout changes
|
||||||
|
.flex-inner {
|
||||||
|
transform: scaleY(0.95);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&-avatar {
|
&-avatar {
|
||||||
@@ -62,48 +90,98 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.library-drawer{
|
.library-drawer {
|
||||||
width: 20em;
|
// Ensure the drawer paper itself gets the styling
|
||||||
margin: 1.4em;
|
&.MuiDrawer-paper {
|
||||||
height: calc(100vh - 2.8em) !important;
|
width: 280px;
|
||||||
border-radius: 20px;
|
margin: 16px;
|
||||||
overflow-x: hidden;
|
height: calc(100% - 32px) !important; // float in the middle
|
||||||
overflow-y: auto;
|
border-radius: 24px;
|
||||||
.library-drawer-item{
|
background: rgba(20, 20, 25, 0.75); // Darker, substantial base
|
||||||
position: relative;
|
backdrop-filter: blur(24px) saturate(180%);
|
||||||
overflow: hidden;
|
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||||
border-radius: 1000px;
|
box-shadow:
|
||||||
> div::before{
|
0 24px 48px rgba(0, 0, 0, 0.4),
|
||||||
content: "";
|
0 4px 8px rgba(0, 0, 0, 0.2);
|
||||||
position: absolute;
|
overflow: hidden; // Contain scrollbars
|
||||||
top: 0;
|
}
|
||||||
left: 0;
|
|
||||||
right: 0;
|
.MuiList-root {
|
||||||
bottom: 0;
|
padding: 8px; // Reduced from 16px
|
||||||
background: transparent;
|
gap: 2px; // Reduced gap
|
||||||
transition: $transition-time-default;
|
}
|
||||||
z-index: -1;
|
|
||||||
border-radius: 100px;
|
.MuiDivider-root {
|
||||||
|
border-color: rgba(255, 255, 255, 0.1);
|
||||||
|
margin: 4px 12px; // Reduced margins
|
||||||
|
}
|
||||||
|
|
||||||
|
// Navigation Items
|
||||||
|
.MuiListItemButton-root {
|
||||||
|
border-radius: 12px !important; // Slightly smaller radius
|
||||||
|
padding: 8px 12px; // Reduced padding (was 12px 16px)
|
||||||
|
margin-bottom: 2px;
|
||||||
|
transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.08);
|
||||||
|
color: #fff;
|
||||||
|
transform: scale(1.02);
|
||||||
|
}
|
||||||
|
|
||||||
|
.material-symbols-rounded {
|
||||||
|
margin-right: 12px; // Reduced spacing
|
||||||
|
font-size: 22px; // Slightly smaller icons usually look better with less padding
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.MuiListItemText-primary {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 0.9rem; // Slightly smaller text
|
||||||
|
letter-spacing: 0.02em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.active.library-drawer-item {
|
|
||||||
.material-symbols-rounded{
|
// Active State
|
||||||
--fill: 1;
|
.library-drawer-item.active {
|
||||||
}
|
.MuiListItemButton-root {
|
||||||
&> div::before {
|
background: linear-gradient(90deg, rgba($clr-accent-default, 0.2), rgba($clr-accent-default, 0.05));
|
||||||
background: $clr-accent-default;
|
color: $clr-accent-default;
|
||||||
|
|
||||||
|
.material-symbols-rounded {
|
||||||
|
font-variation-settings: 'FILL' 1;
|
||||||
|
color: $clr-accent-default;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Active Indicator Bar
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
height: 24px;
|
||||||
|
width: 4px;
|
||||||
|
background: $clr-accent-default;
|
||||||
|
border-radius: 0 4px 4px 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Magic scrollbar
|
|
||||||
|
// Custom Scrollbar for the drawer content
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
&-thumb {
|
width: 4px;
|
||||||
height: 150px;
|
}
|
||||||
max-height: 33%;
|
&::-webkit-scrollbar-track {
|
||||||
}
|
background: transparent;
|
||||||
&-track {
|
}
|
||||||
margin-top: 15px;
|
&::-webkit-scrollbar-thumb {
|
||||||
margin-bottom: 15px;
|
background: rgba(255, 255, 255, 0.1);
|
||||||
background: transparent !important;
|
border-radius: 4px;
|
||||||
|
&:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,157 +1,91 @@
|
|||||||
import React, { type ReactNode } from "react";
|
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
|
|
||||||
import MuiAppBar from "@mui/material/AppBar";
|
import MuiAppBar from "@mui/material/AppBar";
|
||||||
import Avatar from "@mui/material/Avatar";
|
|
||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import ListItemIcon from "@mui/material/ListItemIcon";
|
|
||||||
import Menu from "@mui/material/Menu";
|
|
||||||
import MenuItem from "@mui/material/MenuItem";
|
|
||||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||||
|
import { useLocation, useNavigate } from "@tanstack/react-router";
|
||||||
|
import React, { useCallback, useMemo, useState } from "react";
|
||||||
|
|
||||||
import { Link, useLocation, useNavigate } from "@tanstack/react-router";
|
|
||||||
|
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
|
||||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
|
||||||
|
|
||||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
||||||
|
|
||||||
import { delUser } from "@/utils/storage/user";
|
|
||||||
import "./appBar.scss";
|
import "./appBar.scss";
|
||||||
|
|
||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
import { useShallow } from "zustand/shallow";
|
||||||
|
// removed search placeholder; library state now managed via zustand
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import {
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
setSettingsDialogOpen,
|
import useHeaderStore from "@/utils/store/header";
|
||||||
setSettingsTabValue,
|
import useSearchStore from "@/utils/store/search";
|
||||||
} from "@/utils/store/settings";
|
|
||||||
import {
|
|
||||||
Divider,
|
|
||||||
Drawer,
|
|
||||||
List,
|
|
||||||
ListItem,
|
|
||||||
ListItemButton,
|
|
||||||
ListItemText,
|
|
||||||
} from "@mui/material";
|
|
||||||
import BackButton from "../buttons/backButton";
|
import BackButton from "../buttons/backButton";
|
||||||
|
import { UserAvatarMenu } from "../userAvatarMenu";
|
||||||
|
import { NavigationDrawer } from "./navigationDrawer";
|
||||||
|
|
||||||
interface ListItemLinkProps {
|
const MemoizeBackButton = React.memo(BackButton);
|
||||||
icon?: ReactNode;
|
|
||||||
primary: string;
|
|
||||||
to: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ListItemLink(props: ListItemLinkProps) {
|
const HIDDEN_PATHS = [
|
||||||
const { icon, primary, to } = props;
|
"/login",
|
||||||
|
"/setup",
|
||||||
return (
|
"/server",
|
||||||
<li>
|
"/player",
|
||||||
<ListItem
|
"/error",
|
||||||
component={Link}
|
"/settings",
|
||||||
activeClassName="active"
|
"/library",
|
||||||
className="library-drawer-item"
|
"/search",
|
||||||
to={to}
|
];
|
||||||
>
|
|
||||||
<ListItemButton
|
|
||||||
style={{
|
|
||||||
borderRadius: "100px",
|
|
||||||
gap: "0.85em",
|
|
||||||
color: "white",
|
|
||||||
textDecoration: "none",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className="material-symbols-rounded">{icon}</div>
|
|
||||||
<ListItemText primary={primary} />
|
|
||||||
</ListItemButton>
|
|
||||||
</ListItem>
|
|
||||||
</li>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export const AppBar = () => {
|
export const AppBar = () => {
|
||||||
const api = useApiInContext((s) => s.api);
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [display, setDisplay] = useState(false);
|
|
||||||
|
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|
||||||
const user = useQuery({
|
const toggleSearchDialog = useSearchStore(
|
||||||
queryKey: ["user"],
|
useShallow((s) => s.toggleSearchDialog),
|
||||||
queryFn: async () => {
|
);
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
const display = !HIDDEN_PATHS.some(
|
||||||
},
|
(path) =>
|
||||||
enabled: display && Boolean(api?.accessToken),
|
(location.pathname.startsWith(path) &&
|
||||||
throwOnError: true,
|
location.pathname !== "/player/audio") ||
|
||||||
});
|
location.pathname === "/",
|
||||||
const libraries = useQuery({
|
);
|
||||||
queryKey: ["libraries"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const libs = await getUserViewsApi(api).getUserViews({
|
|
||||||
userId: user.data?.Id,
|
|
||||||
});
|
|
||||||
return libs.data;
|
|
||||||
},
|
|
||||||
enabled: !!user.data && !!api.accessToken,
|
|
||||||
networkMode: "always",
|
|
||||||
});
|
|
||||||
|
|
||||||
const trigger = useScrollTrigger({
|
const trigger = useScrollTrigger({
|
||||||
disableHysteresis: true,
|
disableHysteresis: true,
|
||||||
threshold: 20,
|
threshold: 20,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [anchorEl, setAnchorEl] = useState(null);
|
|
||||||
const openMenu = Boolean(anchorEl);
|
|
||||||
const handleMenuOpen = (event) => {
|
|
||||||
setAnchorEl(event.currentTarget);
|
|
||||||
};
|
|
||||||
const handleMenuClose = () => {
|
|
||||||
setAnchorEl(null);
|
|
||||||
};
|
|
||||||
|
|
||||||
const queryClient = useQueryClient();
|
|
||||||
|
|
||||||
const handleLogout = async () => {
|
|
||||||
console.log("Logging out user...");
|
|
||||||
await api.logout();
|
|
||||||
delUser();
|
|
||||||
sessionStorage.removeItem("accessToken");
|
|
||||||
queryClient.clear();
|
|
||||||
setAnchorEl(null);
|
|
||||||
navigate({ to: "/login" });
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (
|
|
||||||
location.pathname.includes("login") ||
|
|
||||||
location.pathname.includes("setup") ||
|
|
||||||
location.pathname.includes("server") ||
|
|
||||||
location.pathname === "/player" ||
|
|
||||||
location.pathname.includes("error") ||
|
|
||||||
location.pathname === "/"
|
|
||||||
) {
|
|
||||||
setDisplay(false);
|
|
||||||
} else {
|
|
||||||
setDisplay(true);
|
|
||||||
}
|
|
||||||
}, [location]);
|
|
||||||
|
|
||||||
const [showDrawer, setShowDrawer] = useState(false);
|
const [showDrawer, setShowDrawer] = useState(false);
|
||||||
|
|
||||||
|
const appBarStyling = useMemo(() => {
|
||||||
|
return {
|
||||||
|
backgroundColor: "transparent",
|
||||||
|
paddingRight: "0 !important",
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const _handleNavigateToSearch = useCallback(
|
||||||
|
() => navigate({ to: "/search", search: { query: "" } }),
|
||||||
|
[navigate],
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleDrawerClose = useCallback(() => {
|
||||||
|
setShowDrawer(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleDrawerOpen = useCallback(() => {
|
||||||
|
setShowDrawer(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleNavigateToHome = useCallback(() => navigate({ to: "/home" }), []);
|
||||||
|
const handleNavigateToFavorite = useCallback(() => {
|
||||||
|
navigate({ to: "/favorite" });
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useHeaderStore(useShallow((s) => ({ pageTitle: s.pageTitle })));
|
||||||
|
|
||||||
if (!display) {
|
if (!display) {
|
||||||
return <></>;
|
return null;
|
||||||
}
|
}
|
||||||
if (display) {
|
if (display) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<MuiAppBar
|
<MuiAppBar
|
||||||
style={{
|
style={appBarStyling}
|
||||||
backgroundColor: "transparent",
|
|
||||||
paddingRight: "0 !important",
|
|
||||||
}}
|
|
||||||
className={
|
className={
|
||||||
trigger
|
trigger
|
||||||
? "appBar flex flex-row flex-justify-spaced-between elevated"
|
? "appBar flex flex-row flex-justify-spaced-between elevated"
|
||||||
@@ -161,12 +95,12 @@ export const AppBar = () => {
|
|||||||
color="transparent"
|
color="transparent"
|
||||||
>
|
>
|
||||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||||
<IconButton onClick={() => setShowDrawer(true)}>
|
<IconButton onClick={handleDrawerOpen}>
|
||||||
<div className="material-symbols-rounded">menu</div>
|
<span className="material-symbols-rounded">menu</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<BackButton />
|
<MemoizeBackButton />
|
||||||
<IconButton onClick={() => navigate({ to: "/home" })}>
|
<IconButton onClick={handleNavigateToHome}>
|
||||||
<div
|
<span
|
||||||
className={
|
className={
|
||||||
location.pathname === "/home"
|
location.pathname === "/home"
|
||||||
? "material-symbols-rounded fill"
|
? "material-symbols-rounded fill"
|
||||||
@@ -174,171 +108,21 @@ export const AppBar = () => {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
home
|
home
|
||||||
</div>
|
</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||||
<IconButton onClick={() => navigate({ to: "/search" })}>
|
<IconButton onClick={toggleSearchDialog}>
|
||||||
<div className="material-symbols-rounded">search</div>
|
<span className="material-symbols-rounded">search</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton onClick={() => navigate({ to: "/favorite" })}>
|
<IconButton onClick={handleNavigateToFavorite}>
|
||||||
<div className="material-symbols-rounded">favorite</div>
|
<span className="material-symbols-rounded">favorite</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton sx={{ p: 0 }} onClick={handleMenuOpen}>
|
<UserAvatarMenu />
|
||||||
{user.isSuccess &&
|
|
||||||
(user.data.PrimaryImageTag === undefined ? (
|
|
||||||
<Avatar
|
|
||||||
className="appBar-avatar"
|
|
||||||
alt={user.data.Name ?? "image"}
|
|
||||||
>
|
|
||||||
<span className="material-symbols-rounded appBar-avatar-icon">
|
|
||||||
account_circle
|
|
||||||
</span>
|
|
||||||
</Avatar>
|
|
||||||
) : (
|
|
||||||
<Avatar
|
|
||||||
className="appBar-avatar"
|
|
||||||
src={`${api.basePath}/Users/${user.data.Id}/Images/Primary`}
|
|
||||||
alt={user.data.Name ?? "image"}
|
|
||||||
>
|
|
||||||
<span className="material-symbols-rounded appBar-avatar-icon">
|
|
||||||
account_circle
|
|
||||||
</span>
|
|
||||||
</Avatar>
|
|
||||||
))}
|
|
||||||
</IconButton>
|
|
||||||
<Menu
|
|
||||||
anchorEl={anchorEl}
|
|
||||||
open={openMenu}
|
|
||||||
onClose={handleMenuClose}
|
|
||||||
sx={{ mt: 2 }}
|
|
||||||
disableScrollLock
|
|
||||||
>
|
|
||||||
<MenuItem
|
|
||||||
onClick={() => {
|
|
||||||
handleLogout();
|
|
||||||
handleMenuClose();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ListItemIcon>
|
|
||||||
<div className="material-symbols-rounded">logout</div>
|
|
||||||
</ListItemIcon>
|
|
||||||
Logout
|
|
||||||
</MenuItem>
|
|
||||||
<Divider />
|
|
||||||
<MenuItem
|
|
||||||
onClick={() => {
|
|
||||||
setSettingsDialogOpen(true);
|
|
||||||
setSettingsTabValue(1);
|
|
||||||
handleMenuClose();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ListItemIcon>
|
|
||||||
<div className="material-symbols-rounded">settings</div>
|
|
||||||
</ListItemIcon>
|
|
||||||
Settings
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem
|
|
||||||
onClick={() => {
|
|
||||||
setSettingsDialogOpen(true);
|
|
||||||
setSettingsTabValue(10);
|
|
||||||
handleMenuClose();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ListItemIcon>
|
|
||||||
<div className="material-symbols-rounded">info</div>
|
|
||||||
</ListItemIcon>
|
|
||||||
About
|
|
||||||
</MenuItem>
|
|
||||||
</Menu>
|
|
||||||
</div>
|
</div>
|
||||||
</MuiAppBar>
|
</MuiAppBar>
|
||||||
<Drawer
|
<NavigationDrawer open={showDrawer} onClose={handleDrawerClose} />
|
||||||
open={showDrawer}
|
|
||||||
PaperProps={{
|
|
||||||
className: "glass library-drawer",
|
|
||||||
elevation: 6,
|
|
||||||
}}
|
|
||||||
className="library-drawer"
|
|
||||||
onClose={() => setShowDrawer(false)}
|
|
||||||
>
|
|
||||||
<List>
|
|
||||||
<ListItem>
|
|
||||||
<ListItemButton
|
|
||||||
onClick={() => setShowDrawer(false)}
|
|
||||||
style={{
|
|
||||||
borderRadius: "100px",
|
|
||||||
gap: "0.85em",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span className="material-symbols-rounded">menu_open</span>
|
|
||||||
Close
|
|
||||||
</ListItemButton>
|
|
||||||
</ListItem>
|
|
||||||
</List>
|
|
||||||
<Divider variant="middle" />
|
|
||||||
<List>
|
|
||||||
<ListItemLink to="/home" icon="home" primary="Home" />
|
|
||||||
{libraries.isSuccess &&
|
|
||||||
libraries.data.Items?.map((library, index) => (
|
|
||||||
<ListItemLink
|
|
||||||
key={library.Id}
|
|
||||||
to={`/library/${library.Id}`}
|
|
||||||
icon={getTypeIcon(library.CollectionType)}
|
|
||||||
primary={library.Name}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</List>
|
|
||||||
<Divider variant="middle" />
|
|
||||||
<List>
|
|
||||||
<ListItem>
|
|
||||||
<ListItemButton
|
|
||||||
onClick={() => {
|
|
||||||
setSettingsDialogOpen(true);
|
|
||||||
setSettingsTabValue(1);
|
|
||||||
}}
|
|
||||||
style={{
|
|
||||||
borderRadius: "100px",
|
|
||||||
gap: "0.85em",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span className="material-symbols-rounded">settings</span>
|
|
||||||
Settings
|
|
||||||
</ListItemButton>
|
|
||||||
</ListItem>
|
|
||||||
<ListItem>
|
|
||||||
<ListItemButton
|
|
||||||
onClick={() => {
|
|
||||||
setSettingsDialogOpen(true);
|
|
||||||
setSettingsTabValue(2);
|
|
||||||
}}
|
|
||||||
style={{
|
|
||||||
borderRadius: "100px",
|
|
||||||
gap: "0.85em",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span className="material-symbols-rounded">dns</span>
|
|
||||||
Change Server
|
|
||||||
</ListItemButton>
|
|
||||||
</ListItem>
|
|
||||||
<ListItem>
|
|
||||||
<ListItemButton
|
|
||||||
onClick={() => {
|
|
||||||
setSettingsDialogOpen(true);
|
|
||||||
setSettingsTabValue(10);
|
|
||||||
}}
|
|
||||||
style={{
|
|
||||||
borderRadius: "100px",
|
|
||||||
gap: "0.85em",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span className="material-symbols-rounded">info</span>
|
|
||||||
About
|
|
||||||
</ListItemButton>
|
|
||||||
</ListItem>
|
|
||||||
</List>
|
|
||||||
</Drawer>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,45 @@
|
|||||||
import AppBar from "@mui/material/AppBar";
|
import AppBar from "@mui/material/AppBar";
|
||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import Toolbar from "@mui/material/Toolbar";
|
import Toolbar from "@mui/material/Toolbar";
|
||||||
import { useRouter } from "@tanstack/react-router";
|
import { useLocation, useRouter } from "@tanstack/react-router";
|
||||||
|
import React from "react";
|
||||||
|
import QuickConnectButton from "../buttons/quickConnectButton";
|
||||||
|
|
||||||
export const AppBarBackOnly = () => {
|
export default function AppBarBackOnly() {
|
||||||
const { history } = useRouter();
|
const { history } = useRouter();
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
const handleBack = () => {
|
const handleBack = () => {
|
||||||
history.go(-1);
|
history.go(-1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const hideQuickConnect = location.pathname === "/setup/server/list";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppBar elevation={0} color="transparent" position="fixed">
|
<AppBar elevation={0} color="transparent" position="fixed">
|
||||||
<Toolbar>
|
<Toolbar>
|
||||||
<IconButton
|
<IconButton
|
||||||
size="large"
|
size="large"
|
||||||
edge="start"
|
edge="start"
|
||||||
|
//@ts-ignore
|
||||||
color="white"
|
color="white"
|
||||||
aria-label="back"
|
aria-label="back"
|
||||||
|
disabled={history.length <= 1}
|
||||||
onClick={handleBack}
|
onClick={handleBack}
|
||||||
sx={{ mr: 2 }}
|
sx={{ mr: 2 }}
|
||||||
>
|
>
|
||||||
<span className="material-symbols-rounded">arrow_back</span>
|
<span className="material-symbols-rounded">arrow_back</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
{!hideQuickConnect && (
|
||||||
|
<QuickConnectButton
|
||||||
|
sx={{
|
||||||
|
marginLeft: "auto",
|
||||||
|
flex: "none !important",
|
||||||
|
borderRadius: "10px",
|
||||||
|
}}
|
||||||
|
color="secondary"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
</AppBar>
|
</AppBar>
|
||||||
);
|
);
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||||
|
import { Divider, Drawer, List, ListItem, ListItemButton } from "@mui/material";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import React, { useMemo } from "react";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
import ListItemLink from "../listItemLink";
|
||||||
|
import { getTypeIcon } from "../utils/iconsCollection";
|
||||||
|
|
||||||
|
interface NavigationDrawerProps {
|
||||||
|
open: boolean;
|
||||||
|
onClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const NavigationDrawer = ({ open, onClose }: NavigationDrawerProps) => {
|
||||||
|
const api = useApiInContext((s) => s.api);
|
||||||
|
const [user] = useCentralStore((s) => [s.currentUser]);
|
||||||
|
|
||||||
|
const libraries = useQuery({
|
||||||
|
queryKey: ["libraries"],
|
||||||
|
queryFn: async () => {
|
||||||
|
if (!user?.Id || !api?.accessToken) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const libs = await getUserViewsApi(api).getUserViews({
|
||||||
|
userId: user.Id,
|
||||||
|
});
|
||||||
|
return libs.data;
|
||||||
|
},
|
||||||
|
enabled: !!user?.Id && !!api?.accessToken,
|
||||||
|
networkMode: "always",
|
||||||
|
});
|
||||||
|
|
||||||
|
const drawerPaperProps = useMemo(() => {
|
||||||
|
return {
|
||||||
|
className: "glass library-drawer",
|
||||||
|
elevation: 6,
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Drawer
|
||||||
|
open={open}
|
||||||
|
slotProps={{ paper: drawerPaperProps }}
|
||||||
|
className="library-drawer"
|
||||||
|
onClose={onClose}
|
||||||
|
>
|
||||||
|
<List>
|
||||||
|
<ListItem>
|
||||||
|
<ListItemButton onClick={onClose}>
|
||||||
|
<span className="material-symbols-rounded">menu_open</span>
|
||||||
|
<div style={{ marginLeft: "8px" }}>Close</div>
|
||||||
|
</ListItemButton>
|
||||||
|
</ListItem>
|
||||||
|
</List>
|
||||||
|
<Divider variant="middle" />
|
||||||
|
<List>
|
||||||
|
<ListItemLink
|
||||||
|
className="library-drawer-item"
|
||||||
|
to="/home"
|
||||||
|
icon="home"
|
||||||
|
primary="Home"
|
||||||
|
onClick={onClose}
|
||||||
|
/>
|
||||||
|
{libraries.isSuccess &&
|
||||||
|
libraries.data?.Items?.map((library) => (
|
||||||
|
<ListItemLink
|
||||||
|
className="library-drawer-item"
|
||||||
|
key={library.Id}
|
||||||
|
to="/library/$id"
|
||||||
|
params={{ id: library.Id ?? "" }}
|
||||||
|
icon={
|
||||||
|
library.CollectionType &&
|
||||||
|
getTypeIcon(library.CollectionType)
|
||||||
|
}
|
||||||
|
primary={library.Name ?? "Library"}
|
||||||
|
onClick={onClose}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</List>
|
||||||
|
<Divider variant="middle" />
|
||||||
|
<List>
|
||||||
|
<ListItemLink
|
||||||
|
to="/settings/preferences"
|
||||||
|
icon="settings"
|
||||||
|
primary="Settings"
|
||||||
|
className="library-drawer-item"
|
||||||
|
onClick={onClose}
|
||||||
|
/>
|
||||||
|
<ListItemLink
|
||||||
|
to="/settings/changeServer"
|
||||||
|
icon="dns"
|
||||||
|
primary="Change Server"
|
||||||
|
className="library-drawer-item"
|
||||||
|
onClick={onClose}
|
||||||
|
/>
|
||||||
|
<ListItemLink
|
||||||
|
to="/settings/about"
|
||||||
|
icon="info"
|
||||||
|
primary="About"
|
||||||
|
className="library-drawer-item"
|
||||||
|
onClick={onClose}
|
||||||
|
/>
|
||||||
|
</List>
|
||||||
|
</Drawer>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
import PropTypes from "prop-types";
|
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
import Box from "@mui/material/Box";
|
|
||||||
|
|
||||||
import "./avatar.module.scss";
|
|
||||||
import { useRouteContext } from "@tanstack/react-router";
|
|
||||||
|
|
||||||
export const AvatarImage = ({ userId }) => {
|
|
||||||
const api = useRouteContext({ from: "/_api" }).api;
|
|
||||||
return (
|
|
||||||
<Box className="avatar-image-container">
|
|
||||||
<div
|
|
||||||
className="avatar-image"
|
|
||||||
style={{
|
|
||||||
backgroundImage: `url('${api.basePath}/Users/${userId}/Images/Primary')`,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div className="avatar-image-icon-container">
|
|
||||||
<span className="material-symbols-rounded avatar-image-icon">
|
|
||||||
account_circle
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</Box>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
AvatarImage.propType = {
|
|
||||||
userId: PropTypes.string.isRequired,
|
|
||||||
userImageTags: PropTypes.any,
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import React from "react";
|
||||||
|
|
||||||
|
import "./avatar.module.scss";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
|
||||||
|
export const AvatarImage = ({ userId }: { userId: string }) => {
|
||||||
|
const api = useApiInContext((s) => s.api);
|
||||||
|
if (!api) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="avatar-image-container">
|
||||||
|
<div
|
||||||
|
className="avatar-image"
|
||||||
|
style={{
|
||||||
|
backgroundImage: `url('${api.basePath}/Users/${userId}/Images/Primary')`,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div className="avatar-image-icon-container">
|
||||||
|
<span className="material-symbols-rounded avatar-image-icon">
|
||||||
|
account_circle
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
import { AnimatePresence, motion } from "motion/react";
|
||||||
|
import React from "react";
|
||||||
|
import { useShallow } from "zustand/shallow";
|
||||||
|
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||||
|
import BlurhashCanvas from "../blurhash-canvas";
|
||||||
|
|
||||||
|
export default function Backdrop() {
|
||||||
|
// const [backdropLoading, setBackdropLoading] = useState(true);
|
||||||
|
|
||||||
|
const { backdropHash } = useBackdropStore(
|
||||||
|
useShallow((state) => ({
|
||||||
|
backdropHash: state.backdropHash,
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!backdropHash) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AnimatePresence mode="sync">
|
||||||
|
<motion.div
|
||||||
|
initial={{ opacity: 0 }}
|
||||||
|
animate={{ opacity: 1 }}
|
||||||
|
key={backdropHash}
|
||||||
|
exit={{ opacity: 0 }}
|
||||||
|
transition={{
|
||||||
|
duration: 2,
|
||||||
|
ease: "easeInOut",
|
||||||
|
}}
|
||||||
|
className="app-backdrop-container"
|
||||||
|
>
|
||||||
|
<BlurhashCanvas
|
||||||
|
blurhashString={backdropHash}
|
||||||
|
width={300}
|
||||||
|
height={150}
|
||||||
|
canvasProps={{
|
||||||
|
style: {
|
||||||
|
display: "block",
|
||||||
|
width: "100vw",
|
||||||
|
height: "100vh",
|
||||||
|
margin: "0 auto",
|
||||||
|
filter: "brightness(0.8) contrast(1.6) saturate(1.6)",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</motion.div>
|
||||||
|
</AnimatePresence>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
import * as blurhash from "blurhash-wasm";
|
||||||
|
import React, { useEffect } from "react";
|
||||||
|
|
||||||
|
type BlurhashCanvasProps = {
|
||||||
|
canvasProps?: React.CanvasHTMLAttributes<HTMLCanvasElement>;
|
||||||
|
blurhashString: string;
|
||||||
|
width?: number;
|
||||||
|
height?: number;
|
||||||
|
// punch?: number;
|
||||||
|
onLoad?: () => void;
|
||||||
|
onError?: (error: Error) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
const BlurhashCanvas = ({
|
||||||
|
canvasProps,
|
||||||
|
blurhashString,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
// punch,
|
||||||
|
onLoad,
|
||||||
|
onError,
|
||||||
|
}: BlurhashCanvasProps) => {
|
||||||
|
const canvasRef = React.useRef<HTMLCanvasElement>(null);
|
||||||
|
useEffect(() => {
|
||||||
|
const canvas = canvasRef.current;
|
||||||
|
if (!canvas) return;
|
||||||
|
const ctx = canvas.getContext("2d");
|
||||||
|
if (!ctx) return;
|
||||||
|
const drawBlurhash = async () => {
|
||||||
|
try {
|
||||||
|
const imageDataBuffer = blurhash.decode(
|
||||||
|
blurhashString,
|
||||||
|
width || 32,
|
||||||
|
height || 32,
|
||||||
|
// punch || 1,
|
||||||
|
);
|
||||||
|
// canvas.width = width || 32;
|
||||||
|
// canvas.height = height || 32;
|
||||||
|
if (!imageDataBuffer) {
|
||||||
|
throw new Error("Failed to decode blurhash");
|
||||||
|
}
|
||||||
|
const imageData = new ImageData(
|
||||||
|
new Uint8ClampedArray(imageDataBuffer),
|
||||||
|
width || 32,
|
||||||
|
height || 32,
|
||||||
|
);
|
||||||
|
// imageData.data.set(imageDataBuffer);
|
||||||
|
ctx.putImageData(imageData, 0, 0);
|
||||||
|
if (onLoad) onLoad();
|
||||||
|
} catch (error) {
|
||||||
|
if (onError) onError(error as Error);
|
||||||
|
else console.error("Error decoding blurhash:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
drawBlurhash();
|
||||||
|
}, [blurhash, width, height, onLoad, onError]);
|
||||||
|
return <canvas ref={canvasRef} {...canvasProps} />;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default BlurhashCanvas;
|
||||||
@@ -9,7 +9,7 @@ export default function BackButton() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<IconButton onClick={handleClick}>
|
<IconButton onClick={handleClick} disabled={history.length === 0}>
|
||||||
<span className="material-symbols-rounded">arrow_back</span>
|
<span className="material-symbols-rounded">arrow_back</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,50 +1,55 @@
|
|||||||
import PropTypes from "prop-types";
|
import type { UserItemDataDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
|
||||||
import React, { useEffect } from "react";
|
|
||||||
|
|
||||||
import IconButton from "@mui/material/IconButton";
|
|
||||||
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
|
||||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
|
||||||
import { pink } from "@mui/material/colors";
|
import { pink } from "@mui/material/colors";
|
||||||
|
import IconButton from "@mui/material/IconButton";
|
||||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
import { useRouteContext } from "@tanstack/react-router";
|
|
||||||
import { useSnackbar } from "notistack";
|
import { useSnackbar } from "notistack";
|
||||||
|
import React from "react";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
|
||||||
const LikeButton = ({ itemId, isFavorite, queryKey, userId, itemName }) => {
|
export default function LikeButton({
|
||||||
|
itemId,
|
||||||
|
isFavorite,
|
||||||
|
queryKey,
|
||||||
|
userId,
|
||||||
|
itemName,
|
||||||
|
}: {
|
||||||
|
itemId: string | undefined;
|
||||||
|
isFavorite: boolean | undefined;
|
||||||
|
queryKey: string[] | undefined;
|
||||||
|
userId: string | undefined;
|
||||||
|
itemName?: string | null;
|
||||||
|
}) {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
|
|
||||||
const handleLiking = async () => {
|
const handleLiking = async () => {
|
||||||
let result = null;
|
let result: UserItemDataDto = null!;
|
||||||
|
if (!api) return;
|
||||||
|
if (!userId) return;
|
||||||
|
if (!itemId) return;
|
||||||
|
if (!itemName) return;
|
||||||
if (isFavorite) {
|
if (isFavorite) {
|
||||||
result = await getUserLibraryApi(api).unmarkFavoriteItem({
|
result = (
|
||||||
userId: userId,
|
await getUserLibraryApi(api).unmarkFavoriteItem({
|
||||||
itemId: itemId,
|
userId: userId,
|
||||||
});
|
itemId: itemId,
|
||||||
|
})
|
||||||
|
).data;
|
||||||
} else if (!isFavorite) {
|
} else if (!isFavorite) {
|
||||||
result = await getUserLibraryApi(api).markFavoriteItem({
|
result = (
|
||||||
userId: userId,
|
await getUserLibraryApi(api).markFavoriteItem({
|
||||||
itemId: itemId,
|
userId: userId,
|
||||||
});
|
itemId: itemId,
|
||||||
|
})
|
||||||
|
).data;
|
||||||
}
|
}
|
||||||
return result.data;
|
return result; // We need to return the result so that the onSettled function can invalidate the query
|
||||||
};
|
};
|
||||||
const mutation = useMutation({
|
const mutation = useMutation({
|
||||||
// mutationFn: async () => {
|
|
||||||
// new Promise((resolve, reject) => {
|
|
||||||
// setTimeout(() => {
|
|
||||||
// resolve("foo");
|
|
||||||
// }, 4000);
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
mutationFn: handleLiking,
|
mutationFn: handleLiking,
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
enqueueSnackbar(`${error}`, {
|
|
||||||
variant: "error",
|
|
||||||
});
|
|
||||||
enqueueSnackbar(`An error occured while updating "${itemName}"`, {
|
enqueueSnackbar(`An error occured while updating "${itemName}"`, {
|
||||||
variant: "error",
|
variant: "error",
|
||||||
});
|
});
|
||||||
@@ -71,32 +76,24 @@ const LikeButton = ({ itemId, isFavorite, queryKey, userId, itemName }) => {
|
|||||||
transition: "opacity 250ms",
|
transition: "opacity 250ms",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<span
|
||||||
className="material-symbols-rounded"
|
className="material-symbols-rounded"
|
||||||
style={
|
style={
|
||||||
isFavorite
|
isFavorite
|
||||||
? {
|
? {
|
||||||
|
//@ts-expect-error
|
||||||
"--fill": mutation.isPending ? 0 : 1,
|
"--fill": mutation.isPending ? 0 : 1,
|
||||||
color: mutation.isPending ? "white" : pink.A700,
|
color: mutation.isPending ? "white" : pink.A700,
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
|
//@ts-expect-error
|
||||||
"--fill": mutation.isPending ? 1 : 0,
|
"--fill": mutation.isPending ? 1 : 0,
|
||||||
color: mutation.isPending ? pink.A700 : "white",
|
color: mutation.isPending ? pink.A700 : "white",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
favorite
|
favorite
|
||||||
</div>
|
</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
LikeButton.propTypes = {
|
|
||||||
itemId: PropTypes.string.isRequired,
|
|
||||||
isFavorite: PropTypes.bool.isRequired,
|
|
||||||
queryKey: PropTypes.any.isRequired,
|
|
||||||
userId: PropTypes.string.isRequired,
|
|
||||||
itemName: PropTypes.string,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default LikeButton;
|
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
import PropTypes from "prop-types";
|
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
|
||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
|
|
||||||
import { green } from "@mui/material/colors";
|
import { green } from "@mui/material/colors";
|
||||||
@@ -10,10 +7,21 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|||||||
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
||||||
import { useRouteContext } from "@tanstack/react-router";
|
|
||||||
import { useSnackbar } from "notistack";
|
import { useSnackbar } from "notistack";
|
||||||
|
|
||||||
const MarkPlayedButton = ({ itemId, isPlayed, queryKey, userId, itemName }) => {
|
export default function MarkPlayedButton({
|
||||||
|
itemId,
|
||||||
|
isPlayed,
|
||||||
|
queryKey,
|
||||||
|
userId,
|
||||||
|
itemName,
|
||||||
|
}: {
|
||||||
|
itemId?: string;
|
||||||
|
isPlayed?: boolean;
|
||||||
|
queryKey?: string[];
|
||||||
|
userId?: string;
|
||||||
|
itemName?: string | null;
|
||||||
|
}) {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
|
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@@ -21,6 +29,12 @@ const MarkPlayedButton = ({ itemId, isPlayed, queryKey, userId, itemName }) => {
|
|||||||
|
|
||||||
const handleMarking = async () => {
|
const handleMarking = async () => {
|
||||||
let result = null;
|
let result = null;
|
||||||
|
if (!api) return;
|
||||||
|
if (!api) return;
|
||||||
|
if (!userId) return;
|
||||||
|
if (!itemId) return;
|
||||||
|
if (!itemName) return;
|
||||||
|
|
||||||
if (!isPlayed) {
|
if (!isPlayed) {
|
||||||
result = await getPlaystateApi(api).markPlayedItem({
|
result = await getPlaystateApi(api).markPlayedItem({
|
||||||
userId: userId,
|
userId: userId,
|
||||||
@@ -32,11 +46,11 @@ const MarkPlayedButton = ({ itemId, isPlayed, queryKey, userId, itemName }) => {
|
|||||||
itemId: itemId,
|
itemId: itemId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return result;
|
return result; // We need to return the result so that the onSettled function can invalidate the query
|
||||||
};
|
};
|
||||||
const mutation = useMutation({
|
const mutation = useMutation({
|
||||||
mutationFn: handleMarking,
|
mutationFn: handleMarking,
|
||||||
onError: (error, a, context) => {
|
onError: (error) => {
|
||||||
enqueueSnackbar(`${error}`, {
|
enqueueSnackbar(`${error}`, {
|
||||||
variant: "error",
|
variant: "error",
|
||||||
});
|
});
|
||||||
@@ -73,21 +87,12 @@ const MarkPlayedButton = ({ itemId, isPlayed, queryKey, userId, itemName }) => {
|
|||||||
? "white"
|
? "white"
|
||||||
: green.A700
|
: green.A700
|
||||||
: mutation.isPending
|
: mutation.isPending
|
||||||
? green.A700
|
? green.A700
|
||||||
: "white",
|
: "white",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
done
|
done
|
||||||
</div>
|
</div>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
MarkPlayedButton.propTypes = {
|
|
||||||
itemId: PropTypes.string.isRequired,
|
|
||||||
isPlayed: PropTypes.bool.isRequired,
|
|
||||||
queryKey: PropTypes.any.isRequired,
|
|
||||||
userId: PropTypes.string.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default MarkPlayedButton;
|
|
||||||
@@ -1,76 +1,73 @@
|
|||||||
import PropTypes from "prop-types";
|
import {
|
||||||
import React from "react";
|
type BaseItemDto,
|
||||||
|
BaseItemKind,
|
||||||
import Button, {
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
type ButtonProps,
|
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||||
type ButtonPropsSizeOverrides,
|
import type { SxProps } from "@mui/material";
|
||||||
} from "@mui/material/Button";
|
import Button, { type ButtonProps } from "@mui/material/Button";
|
||||||
import Fab from "@mui/material/Fab";
|
import Fab from "@mui/material/Fab";
|
||||||
import LinearProgress from "@mui/material/LinearProgress";
|
import LinearProgress from "@mui/material/LinearProgress";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import { playAudio } from "@/utils/store/audioPlayback";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
import {
|
|
||||||
type BaseItemDto,
|
|
||||||
type BaseItemDtoQueryResult,
|
|
||||||
BaseItemKind,
|
|
||||||
ItemFields,
|
|
||||||
MediaProtocol,
|
|
||||||
type PlaybackInfoResponse,
|
|
||||||
SortOrder,
|
|
||||||
type UserItemDataDto,
|
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
|
||||||
import { getDlnaApi } from "@jellyfin/sdk/lib/utils/api/dlna-api";
|
|
||||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
|
||||||
import { getPlaylistsApi } from "@jellyfin/sdk/lib/utils/api/playlists-api";
|
|
||||||
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
|
||||||
import { useMutation } from "@tanstack/react-query";
|
|
||||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
|
||||||
import { useSnackbar } from "notistack";
|
import { useSnackbar } from "notistack";
|
||||||
|
import React, { type MouseEvent, memo } from "react"; // Import memo
|
||||||
import useQueue, { setQueue } from "@/utils/store/queue";
|
|
||||||
|
|
||||||
import { playItem, usePlaybackDataLoadStore } from "@/utils/store/playback";
|
|
||||||
|
|
||||||
import type PlayResult from "@//utils/types/playResult";
|
import type PlayResult from "@//utils/types/playResult";
|
||||||
import { getRuntimeCompact } from "@/utils/date/time";
|
import { getRuntimeCompact } from "@/utils/date/time";
|
||||||
import getSubtitle from "@/utils/methods/getSubtitles";
|
import { getNextEpisode, getPlaybackInfo } from "@/utils/methods/playback";
|
||||||
import playbackProfile from "@/utils/playback-profiles";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { axiosClient, useApiInContext } from "@/utils/store/api";
|
import { generateAudioStreamUrl, playAudio } from "@/utils/store/audioPlayback";
|
||||||
import type IntroMediaInfo from "@/utils/types/introMediaInfo";
|
import { usePhotosPlayback } from "@/utils/store/photosPlayback";
|
||||||
import { getMediaInfoApi } from "@jellyfin/sdk/lib/utils/api/media-info-api";
|
import { initializePlayback } from "@/utils/store/playback";
|
||||||
import type { SxProps } from "@mui/material";
|
import { setQueue } from "@/utils/store/queue";
|
||||||
import type { AxiosResponse } from "axios";
|
|
||||||
|
|
||||||
type PlayButtonProps = {
|
type PlayButtonProps = {
|
||||||
item: BaseItemDto;
|
item: BaseItemDto;
|
||||||
itemId: string;
|
userId: string | undefined;
|
||||||
itemUserData: UserItemDataDto;
|
|
||||||
userId: string;
|
|
||||||
itemType: BaseItemKind;
|
itemType: BaseItemKind;
|
||||||
currentAudioTrack: number;
|
currentAudioTrack?: number | "auto";
|
||||||
currentVideoTrack: number;
|
currentVideoTrack?: number;
|
||||||
currentSubTrack: number | "nosub";
|
currentSubTrack?: number | "nosub";
|
||||||
className: string;
|
className?: string;
|
||||||
sx: SxProps;
|
sx?: SxProps;
|
||||||
buttonProps: ButtonProps;
|
buttonProps?: ButtonProps;
|
||||||
iconOnly: boolean;
|
iconOnly?: boolean;
|
||||||
audio: boolean;
|
audio?: boolean;
|
||||||
size: ButtonPropsSizeOverrides;
|
size?: "small" | "large" | "medium";
|
||||||
playlistItem: BaseItemDto;
|
playlistItem?: boolean;
|
||||||
playlistItemId: string;
|
playlistItemId?: string;
|
||||||
trackIndex: number;
|
trackIndex?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Memoized LinearProgress component
|
||||||
|
const MemoizedLinearProgress = memo(({ value }: { value: number }) => (
|
||||||
|
<LinearProgress
|
||||||
|
variant="determinate"
|
||||||
|
value={value}
|
||||||
|
sx={{
|
||||||
|
position: "absolute",
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
bottom: 0,
|
||||||
|
height: "100%",
|
||||||
|
background: "transparent",
|
||||||
|
opacity: 0.2,
|
||||||
|
zIndex: 0,
|
||||||
|
mixBlendMode: "difference",
|
||||||
|
}}
|
||||||
|
//@ts-expect-error
|
||||||
|
color="white"
|
||||||
|
/>
|
||||||
|
));
|
||||||
|
|
||||||
const PlayButton = ({
|
const PlayButton = ({
|
||||||
item,
|
item,
|
||||||
itemId,
|
|
||||||
itemUserData,
|
|
||||||
userId,
|
userId,
|
||||||
itemType,
|
itemType,
|
||||||
currentAudioTrack,
|
currentAudioTrack,
|
||||||
currentSubTrack,
|
currentSubTrack,
|
||||||
currentVideoTrack,
|
// currentVideoTrack,
|
||||||
className,
|
className,
|
||||||
sx,
|
sx,
|
||||||
buttonProps,
|
buttonProps,
|
||||||
@@ -79,267 +76,116 @@ const PlayButton = ({
|
|||||||
size = "large",
|
size = "large",
|
||||||
playlistItem,
|
playlistItem,
|
||||||
playlistItemId = "",
|
playlistItemId = "",
|
||||||
trackIndex,
|
|
||||||
}: PlayButtonProps) => {
|
}: PlayButtonProps) => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const setPlaybackDataLoading = usePlaybackDataLoadStore(
|
// const setPlaybackDataLoading = usePlaybackDataLoadStore(
|
||||||
(state) => state.setisPending,
|
// (state) => state.setisPending,
|
||||||
);
|
// );
|
||||||
|
const playPhotos = usePhotosPlayback((s) => s.playPhotos);
|
||||||
|
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
|
|
||||||
const itemQuery = useMutation({
|
const itemQuery = useMutation({
|
||||||
mutationKey: ["playButton", itemId, userId],
|
mutationKey: ["playButton", item?.Id, userId],
|
||||||
mutationFn: async () => {
|
mutationFn: async (currentEpisodeId?: string) => {
|
||||||
setPlaybackDataLoading(true);
|
if (!api) {
|
||||||
let result: undefined | AxiosResponse<BaseItemDtoQueryResult, any>;
|
throw new Error("API is not available");
|
||||||
let mediaSource: undefined | AxiosResponse<PlaybackInfoResponse, any>;
|
|
||||||
let introInfo: undefined | AxiosResponse<IntroMediaInfo, any>;
|
|
||||||
const indexNumber = item.IndexNumber ? item.IndexNumber - 1 : 0;
|
|
||||||
if (playlistItem) {
|
|
||||||
result = await getPlaylistsApi(api).getPlaylistItems({
|
|
||||||
userId: userId,
|
|
||||||
playlistId: playlistItemId,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.log(itemType);
|
|
||||||
switch (itemType) {
|
|
||||||
case BaseItemKind.Episode:
|
|
||||||
result = await getTvShowsApi(api).getEpisodes({
|
|
||||||
seriesId: item.SeriesId,
|
|
||||||
fields: [
|
|
||||||
ItemFields.MediaSources,
|
|
||||||
ItemFields.MediaStreams,
|
|
||||||
ItemFields.Overview,
|
|
||||||
ItemFields.Chapters,
|
|
||||||
ItemFields.Trickplay,
|
|
||||||
],
|
|
||||||
enableUserData: true,
|
|
||||||
userId: userId,
|
|
||||||
seasonId: item.SeasonId,
|
|
||||||
startItemId: item.Id,
|
|
||||||
});
|
|
||||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
|
||||||
audioStreamIndex: currentAudioTrack,
|
|
||||||
subtitleStreamIndex:
|
|
||||||
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
|
||||||
itemId: result.data.Items?.[indexNumber].Id,
|
|
||||||
startTimeTicks:
|
|
||||||
result.data.Items?.[indexNumber].UserData
|
|
||||||
?.PlaybackPositionTicks,
|
|
||||||
userId: userId,
|
|
||||||
mediaSourceId:
|
|
||||||
result.data.Items?.[indexNumber].MediaSources?.[0].Id,
|
|
||||||
playbackInfoDto: {
|
|
||||||
DeviceProfile: playbackProfile,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
introInfo = (
|
|
||||||
await axiosClient.get(
|
|
||||||
`${api.basePath}/Episode/${result.data.Items?.[0]?.Id}/IntroSkipperSegments`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Authorization: `MediaBrowser Token=${api.accessToken}`,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
)
|
|
||||||
)?.data;
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case BaseItemKind.Series:
|
|
||||||
result = await getTvShowsApi(api).getEpisodes({
|
|
||||||
seriesId: itemId,
|
|
||||||
fields: [
|
|
||||||
ItemFields.MediaSources,
|
|
||||||
ItemFields.MediaStreams,
|
|
||||||
ItemFields.Overview,
|
|
||||||
ItemFields.Chapters,
|
|
||||||
ItemFields.Trickplay,
|
|
||||||
],
|
|
||||||
enableUserData: true,
|
|
||||||
userId: userId,
|
|
||||||
});
|
|
||||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
|
||||||
audioStreamIndex: currentAudioTrack,
|
|
||||||
subtitleStreamIndex:
|
|
||||||
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
|
||||||
itemId: result.data.Items?.[0].Id,
|
|
||||||
startTimeTicks:
|
|
||||||
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
|
||||||
userId: userId,
|
|
||||||
mediaSourceId: result.data.Items?.[0].MediaSources?.[0].Id,
|
|
||||||
playbackInfoDto: {
|
|
||||||
DeviceProfile: playbackProfile,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
introInfo = (
|
|
||||||
await axiosClient.get(
|
|
||||||
`${api.basePath}/Episode/${result.data.Items?.[0]?.Id}/IntroSkipperSegments`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Authorization: `MediaBrowser Token=${api.accessToken}`,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
)
|
|
||||||
)?.data;
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case BaseItemKind.Playlist:
|
|
||||||
result = await getPlaylistsApi(api).getPlaylistItems({
|
|
||||||
userId: userId,
|
|
||||||
playlistId: playlistItemId,
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case BaseItemKind.MusicAlbum:
|
|
||||||
result = await getItemsApi(api).getItems({
|
|
||||||
parentId: itemId,
|
|
||||||
userId: userId,
|
|
||||||
fields: [ItemFields.MediaSources, ItemFields.MediaStreams],
|
|
||||||
sortOrder: [SortOrder.Ascending],
|
|
||||||
sortBy: ["IndexNumber"],
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case BaseItemKind.MusicArtist:
|
|
||||||
result = await getItemsApi(api).getItems({
|
|
||||||
artistIds: [itemId],
|
|
||||||
recursive: true,
|
|
||||||
includeItemTypes: [BaseItemKind.Audio],
|
|
||||||
userId: userId,
|
|
||||||
fields: [ItemFields.MediaSources, ItemFields.MediaStreams],
|
|
||||||
sortOrder: [SortOrder.Ascending],
|
|
||||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case BaseItemKind.BoxSet:
|
|
||||||
result = await getItemsApi(api).getItems({
|
|
||||||
parentId: itemId,
|
|
||||||
userId,
|
|
||||||
fields: [
|
|
||||||
ItemFields.MediaSources,
|
|
||||||
ItemFields.MediaStreams,
|
|
||||||
ItemFields.Chapters,
|
|
||||||
ItemFields.Trickplay,
|
|
||||||
],
|
|
||||||
sortOrder: [SortOrder.Ascending],
|
|
||||||
sortBy: ["IndexNumber"],
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
result = await getItemsApi(api).getItems({
|
|
||||||
ids: [itemId],
|
|
||||||
userId: userId,
|
|
||||||
fields: [
|
|
||||||
ItemFields.MediaSources,
|
|
||||||
ItemFields.MediaStreams,
|
|
||||||
ItemFields.Chapters,
|
|
||||||
ItemFields.Trickplay,
|
|
||||||
],
|
|
||||||
sortOrder: [SortOrder.Ascending],
|
|
||||||
sortBy: ["IndexNumber"],
|
|
||||||
});
|
|
||||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
|
||||||
audioStreamIndex: currentAudioTrack,
|
|
||||||
subtitleStreamIndex:
|
|
||||||
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
|
||||||
itemId: itemId,
|
|
||||||
startTimeTicks:
|
|
||||||
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
|
||||||
userId: userId,
|
|
||||||
mediaSourceId: result.data.Items?.[0].MediaSources?.[0].Id,
|
|
||||||
playbackInfoDto: {
|
|
||||||
DeviceProfile: playbackProfile,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return { item: result?.data, mediaSource: mediaSource?.data, introInfo };
|
if (!userId) {
|
||||||
|
throw new Error("User ID is not available");
|
||||||
|
}
|
||||||
|
if (!item.Id) {
|
||||||
|
throw new Error("Item ID is not available");
|
||||||
|
}
|
||||||
|
|
||||||
|
return await getPlaybackInfo(api, userId, item, {
|
||||||
|
currentAudioTrack,
|
||||||
|
currentSubTrack,
|
||||||
|
currentEpisodeId,
|
||||||
|
playlistItem,
|
||||||
|
playlistItemId,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onSuccess: (result: PlayResult | null) => {
|
onSuccess: async (result: PlayResult | null) => {
|
||||||
if (trackIndex) {
|
if (!api) {
|
||||||
// Playlist Playback
|
console.error("API is not available");
|
||||||
enqueueSnackbar("Playlist playback is WIP", { variant: "info" });
|
enqueueSnackbar("API is not available", { variant: "error" });
|
||||||
} else if (audio) {
|
return;
|
||||||
|
}
|
||||||
|
if (!userId) {
|
||||||
|
console.error("User ID is not available");
|
||||||
|
enqueueSnackbar("User ID is not available", { variant: "error" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!result?.item?.Items?.length) {
|
||||||
|
console.error("No items found");
|
||||||
|
enqueueSnackbar("No items found", { variant: "error" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!result?.item?.Items?.[0]?.Id) {
|
||||||
|
console.error("No item ID found");
|
||||||
|
enqueueSnackbar("No item ID found", { variant: "error" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (audio) {
|
||||||
// Album/Individual audio track playback
|
// Album/Individual audio track playback
|
||||||
const urlOptions = {
|
const playbackUrl = generateAudioStreamUrl(
|
||||||
deviceId: api?.deviceInfo.id,
|
result?.item?.Items?.[0].Id,
|
||||||
userId,
|
userId,
|
||||||
api_key: api?.accessToken,
|
api?.deviceInfo.id,
|
||||||
};
|
api.basePath,
|
||||||
const urlParams = new URLSearchParams(urlOptions).toString();
|
api.accessToken,
|
||||||
|
);
|
||||||
const playbackUrl = `${api.basePath}/Audio/${result?.item.Items[0].Id}/universal?${urlParams}`;
|
playAudio(playbackUrl, result?.item?.Items?.[0], undefined);
|
||||||
playAudio(playbackUrl, result?.item.Items[0], undefined);
|
setQueue(result?.item?.Items ?? [], 0);
|
||||||
setQueue(result?.item.Items ?? [], 0);
|
} else if (item.Type === "Photo") {
|
||||||
|
const index = result?.item?.Items?.map((i) => i.Id).indexOf(item.Id);
|
||||||
|
if (result?.item?.Items && index) {
|
||||||
|
playPhotos(result?.item?.Items, index);
|
||||||
|
navigate({ to: "/player/photos" });
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const episodeIndex = item.IndexNumber ? item.IndexNumber - 1 : 0;
|
if (!result?.mediaSource?.MediaSources?.[0]?.Id) {
|
||||||
// Creates a queue containing all Episodes for a particular season(series) or collection of movies
|
console.error("No media source ID found");
|
||||||
const queue = result?.item.Items;
|
enqueueSnackbar("No media source ID found", { variant: "error" });
|
||||||
let itemName = item.Name;
|
return;
|
||||||
let episodeTitle = "";
|
|
||||||
if (result?.item.Items?.[episodeIndex].SeriesId) {
|
|
||||||
itemName = result?.item.Items[episodeIndex].SeriesName;
|
|
||||||
episodeTitle = `S${result?.item.Items[episodeIndex].ParentIndexNumber ?? 0}:E${
|
|
||||||
result?.item.Items[episodeIndex].IndexNumber ?? 0
|
|
||||||
} ${result?.item.Items[episodeIndex].Name}`;
|
|
||||||
}
|
}
|
||||||
// Subtitle
|
const episodeIndex = result.episodeIndex;
|
||||||
const subtitle = getSubtitle(
|
const queue = result?.item?.Items ?? [];
|
||||||
currentSubTrack,
|
|
||||||
result?.mediaSource.MediaSources?.[0].MediaStreams,
|
let playItemValue = queue[episodeIndex];
|
||||||
);
|
|
||||||
// URL generation
|
|
||||||
const urlOptions = {
|
|
||||||
Static: true,
|
|
||||||
tag: result?.mediaSource.MediaSources?.[0].ETag,
|
|
||||||
mediaSourceId: result?.mediaSource.MediaSources?.[0].Id,
|
|
||||||
deviceId: api?.deviceInfo.id,
|
|
||||||
api_key: api?.accessToken,
|
|
||||||
};
|
|
||||||
const urlParams = new URLSearchParams(urlOptions).toString();
|
|
||||||
let playbackUrl = `${api?.basePath}/Videos/${result?.mediaSource.MediaSources?.[0].Id}/stream.${result?.mediaSource.MediaSources?.[0].Container}?${urlParams}`;
|
|
||||||
if (
|
|
||||||
result?.mediaSource.MediaSources?.[0].SupportsTranscoding &&
|
|
||||||
result?.mediaSource.MediaSources?.[0].TranscodingUrl
|
|
||||||
) {
|
|
||||||
playbackUrl = `${api.basePath}${result.mediaSource.MediaSources[0].TranscodingUrl}`;
|
|
||||||
}
|
|
||||||
let playItemValue = item;
|
|
||||||
if (itemType === BaseItemKind.Movie) {
|
if (itemType === BaseItemKind.Movie) {
|
||||||
playItemValue = result?.item.Items?.[0];
|
playItemValue = queue[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
playItem(
|
if (!playItemValue) {
|
||||||
itemName,
|
console.error("No item to play found");
|
||||||
episodeTitle,
|
return;
|
||||||
currentVideoTrack,
|
}
|
||||||
currentAudioTrack,
|
|
||||||
result?.mediaSource?.MediaSources?.[0].Container ?? "mkv",
|
const startPosition = playItemValue.UserData?.PlaybackPositionTicks;
|
||||||
playbackUrl,
|
|
||||||
|
initializePlayback({
|
||||||
|
api,
|
||||||
userId,
|
userId,
|
||||||
item.UserData?.PlaybackPositionTicks,
|
item: playItemValue,
|
||||||
item.RunTimeTicks,
|
mediaSource: result.mediaSource,
|
||||||
playItemValue,
|
mediaSegments: result.mediaSegments,
|
||||||
queue,
|
queueItems: queue,
|
||||||
episodeIndex,
|
queueIndex: episodeIndex,
|
||||||
result?.mediaSource.MediaSources?.[0]?.Id,
|
startPositionTicks: startPosition,
|
||||||
result?.mediaSource.PlaySessionId,
|
audioStreamIndex:
|
||||||
subtitle,
|
currentAudioTrack === "auto" ? undefined : currentAudioTrack,
|
||||||
result?.introInfo,
|
subtitleStreamIndex:
|
||||||
);
|
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||||
|
});
|
||||||
navigate({ to: "/player" });
|
navigate({ to: "/player" });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSettled: () => {
|
onSettled: () => {
|
||||||
setPlaybackDataLoading(false);
|
// setPlaybackDataLoading(false);
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@@ -348,32 +194,181 @@ const PlayButton = ({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const handleClick = (e) => {
|
const handleClick = (
|
||||||
|
e: MouseEvent<HTMLAnchorElement | MouseEvent>,
|
||||||
|
currentEpisodeId?: string | undefined,
|
||||||
|
) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
itemQuery.mutate();
|
itemQuery.mutate(currentEpisodeId);
|
||||||
};
|
};
|
||||||
|
const currentEpisode = useQuery({
|
||||||
|
queryKey: ["playButton", "currentEpisode", item?.Id],
|
||||||
|
queryFn: async () => {
|
||||||
|
if (!api) {
|
||||||
|
throw new Error("API is not available");
|
||||||
|
}
|
||||||
|
if (!userId) {
|
||||||
|
throw new Error("User ID is not available");
|
||||||
|
}
|
||||||
|
if (!item.Id) {
|
||||||
|
throw new Error("Item ID is not available");
|
||||||
|
}
|
||||||
|
const seasons = await getTvShowsApi(api).getSeasons({
|
||||||
|
seriesId: item.Id,
|
||||||
|
userId: userId,
|
||||||
|
enableUserData: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
const currentSeason = seasons.data.Items?.find((season) => {
|
||||||
|
return season.UserData?.Played !== true;
|
||||||
|
});
|
||||||
|
|
||||||
|
const episode = await getNextEpisode(
|
||||||
|
api,
|
||||||
|
userId,
|
||||||
|
item.Id,
|
||||||
|
currentSeason?.IndexNumber ?? 0,
|
||||||
|
);
|
||||||
|
if (episode) {
|
||||||
|
return { Items: [episode] };
|
||||||
|
}
|
||||||
|
return { Items: [] };
|
||||||
|
},
|
||||||
|
enabled: itemType === BaseItemKind.Series,
|
||||||
|
});
|
||||||
|
|
||||||
if (iconOnly) {
|
if (iconOnly) {
|
||||||
return (
|
return (
|
||||||
|
//@ts-expect-error
|
||||||
<Fab
|
<Fab
|
||||||
color="primary"
|
color="primary"
|
||||||
aria-label="Play"
|
aria-label="Play"
|
||||||
className={className}
|
className={className}
|
||||||
onClick={handleClick}
|
onClick={(e) => {
|
||||||
|
if (item.Type === "Episode") {
|
||||||
|
handleClick(e, item.Id);
|
||||||
|
} else if (itemType === BaseItemKind.Series) {
|
||||||
|
handleClick(e, currentEpisode.data?.Items?.[0]?.Id);
|
||||||
|
} else {
|
||||||
|
handleClick(e);
|
||||||
|
}
|
||||||
|
}}
|
||||||
sx={sx}
|
sx={sx}
|
||||||
size={size}
|
size={size}
|
||||||
|
disabled={
|
||||||
|
itemType === BaseItemKind.Series &&
|
||||||
|
(!currentEpisode.data ||
|
||||||
|
!currentEpisode.data.Items ||
|
||||||
|
currentEpisode.data.Items.length === 0)
|
||||||
|
}
|
||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
>
|
>
|
||||||
<div
|
<span
|
||||||
className="material-symbols-rounded em-4 fill"
|
className="material-symbols-rounded em-4 fill"
|
||||||
style={{
|
style={{
|
||||||
fontSize: "3em",
|
fontSize: "3em",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
play_arrow
|
play_arrow
|
||||||
</div>
|
</span>
|
||||||
</Fab>
|
</Fab>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (itemType === BaseItemKind.Series) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="play-button"
|
||||||
|
style={{
|
||||||
|
width: "auto",
|
||||||
|
position: "relative",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
loading={currentEpisode.isPending}
|
||||||
|
className={className ?? "play-button"}
|
||||||
|
variant="contained"
|
||||||
|
onClick={(e) => {
|
||||||
|
const episodeId = currentEpisode.data?.Items?.[0]?.Id;
|
||||||
|
if (episodeId) {
|
||||||
|
handleClick(e, episodeId);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
startIcon={
|
||||||
|
<span
|
||||||
|
className="material-symbols-rounded fill"
|
||||||
|
style={{
|
||||||
|
zIndex: 1,
|
||||||
|
fontSize: "2em",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
play_arrow
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
{...buttonProps}
|
||||||
|
sx={{
|
||||||
|
position: "relative",
|
||||||
|
overflow: "hidden",
|
||||||
|
}}
|
||||||
|
//@ts-expect-error - white color is a custom color in the theme which mui's types don't know about
|
||||||
|
color="white"
|
||||||
|
size={size}
|
||||||
|
disabled={
|
||||||
|
currentEpisode.isPending ||
|
||||||
|
!currentEpisode.data ||
|
||||||
|
!currentEpisode.data.Items ||
|
||||||
|
currentEpisode.data.Items.length === 0 ||
|
||||||
|
!currentEpisode.data.Items[0].Id
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{currentEpisode.isPending ? (
|
||||||
|
"Loading..."
|
||||||
|
) : !currentEpisode.data ||
|
||||||
|
!currentEpisode.data.Items ||
|
||||||
|
currentEpisode.data.Items.length === 0 ? (
|
||||||
|
"No episodes to watch found"
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
Watch S{currentEpisode.data.Items[0].ParentIndexNumber ?? 1}E
|
||||||
|
{currentEpisode.data.Items[0]?.IndexNumber ?? 1}
|
||||||
|
<MemoizedLinearProgress
|
||||||
|
//@ts-expect-error
|
||||||
|
value={
|
||||||
|
100 >
|
||||||
|
(currentEpisode.data.Items[0].UserData?.PlayedPercentage ??
|
||||||
|
100) &&
|
||||||
|
(currentEpisode.data.Items[0].UserData?.PlayedPercentage ??
|
||||||
|
0) > 0
|
||||||
|
? currentEpisode.data.Items[0].UserData?.PlayedPercentage
|
||||||
|
: 0
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
{(currentEpisode.data?.Items?.[0]?.UserData?.PlaybackPositionTicks ??
|
||||||
|
0) > 0 && (
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
opacity: 0.8,
|
||||||
|
position: "absolute",
|
||||||
|
bottom: "-1.8em",
|
||||||
|
left: "50%",
|
||||||
|
transform: "translate(-50%)",
|
||||||
|
}}
|
||||||
|
variant="caption"
|
||||||
|
>
|
||||||
|
{getRuntimeCompact(
|
||||||
|
(currentEpisode.data?.Items?.[0]?.RunTimeTicks ?? 0) -
|
||||||
|
(currentEpisode.data?.Items?.[0]?.UserData
|
||||||
|
?.PlaybackPositionTicks ?? 0),
|
||||||
|
)}{" "}
|
||||||
|
left
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="play-button"
|
className="play-button"
|
||||||
@@ -385,9 +380,11 @@ const PlayButton = ({
|
|||||||
<Button
|
<Button
|
||||||
className={className ?? "play-button"}
|
className={className ?? "play-button"}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={handleClick}
|
onClick={(e) =>
|
||||||
|
item.Type === "Episode" ? handleClick(e, item.Id) : handleClick(e)
|
||||||
|
}
|
||||||
startIcon={
|
startIcon={
|
||||||
<div
|
<span
|
||||||
className="material-symbols-rounded fill"
|
className="material-symbols-rounded fill"
|
||||||
style={{
|
style={{
|
||||||
zIndex: 1,
|
zIndex: 1,
|
||||||
@@ -395,17 +392,18 @@ const PlayButton = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
play_arrow
|
play_arrow
|
||||||
</div>
|
</span>
|
||||||
}
|
}
|
||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
sx={{
|
sx={{
|
||||||
position: "relative",
|
position: "relative",
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
}}
|
}}
|
||||||
|
//@ts-expect-error - white color is a custom color in the theme which mui's types don't know about
|
||||||
color="white"
|
color="white"
|
||||||
size={size}
|
size={size}
|
||||||
>
|
>
|
||||||
{itemUserData?.PlaybackPositionTicks
|
{item.UserData?.PlaybackPositionTicks
|
||||||
? "Continue Watching"
|
? "Continue Watching"
|
||||||
: item?.Type === "MusicAlbum" ||
|
: item?.Type === "MusicAlbum" ||
|
||||||
item?.Type === "Audio" ||
|
item?.Type === "Audio" ||
|
||||||
@@ -414,29 +412,17 @@ const PlayButton = ({
|
|||||||
audio
|
audio
|
||||||
? "Play Now"
|
? "Play Now"
|
||||||
: "Watch Now"}
|
: "Watch Now"}
|
||||||
<LinearProgress
|
<MemoizedLinearProgress
|
||||||
variant="determinate"
|
//@ts-expect-error
|
||||||
value={
|
value={
|
||||||
100 > itemUserData?.PlayedPercentage > 0
|
100 > (item.UserData?.PlayedPercentage ?? 100) &&
|
||||||
? itemUserData?.PlayedPercentage
|
(item.UserData?.PlayedPercentage ?? 0) > 0
|
||||||
|
? item.UserData?.PlayedPercentage
|
||||||
: 0
|
: 0
|
||||||
}
|
}
|
||||||
sx={{
|
|
||||||
position: "absolute",
|
|
||||||
top: 0,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
bottom: 0,
|
|
||||||
height: "100%",
|
|
||||||
background: "transparent",
|
|
||||||
opacity: 0.2,
|
|
||||||
zIndex: 0,
|
|
||||||
mixBlendMode: "difference",
|
|
||||||
}}
|
|
||||||
color="white"
|
|
||||||
/>
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
{itemUserData?.PlaybackPositionTicks > 0 && (
|
{(item.UserData?.PlaybackPositionTicks ?? 0) > 0 && (
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
opacity: 0.8,
|
opacity: 0.8,
|
||||||
@@ -448,7 +434,8 @@ const PlayButton = ({
|
|||||||
variant="caption"
|
variant="caption"
|
||||||
>
|
>
|
||||||
{getRuntimeCompact(
|
{getRuntimeCompact(
|
||||||
item.RunTimeTicks - itemUserData.PlaybackPositionTicks,
|
(item.RunTimeTicks ?? 0) -
|
||||||
|
(item.UserData?.PlaybackPositionTicks ?? 0),
|
||||||
)}{" "}
|
)}{" "}
|
||||||
left
|
left
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|||||||
@@ -4,23 +4,23 @@ 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 { useNavigate, useRouteContext } from "@tanstack/react-router";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
const PlayNextButton = () => {
|
const PlayNextButton = () => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useQuery({
|
||||||
queryKey: ["user"],
|
queryKey: ["user"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return;
|
||||||
const result = await getUserApi(api).getCurrentUser();
|
const result = await getUserApi(api).getCurrentUser();
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const navigate = useNavigate();
|
|
||||||
const handlePlayNext = useMutation({
|
const handlePlayNext = useMutation({
|
||||||
mutationKey: ["playNextButton"],
|
mutationKey: ["playNextButton"],
|
||||||
mutationFn: () => playItemFromQueue("next", user.data?.Id, api),
|
mutationFn: () => playItemFromQueue("next", user.data?.Id, api),
|
||||||
onError: (error) => [console.error(error)],
|
onError: (error) => console.error(error),
|
||||||
});
|
});
|
||||||
const [queueItems, currentItemIndex] = useQueue((state) => [
|
const [queueItems, currentItemIndex] = useQueue((state) => [
|
||||||
state.tracks,
|
state.tracks,
|
||||||
@@ -28,7 +28,7 @@ const PlayNextButton = () => {
|
|||||||
]);
|
]);
|
||||||
return (
|
return (
|
||||||
<IconButton
|
<IconButton
|
||||||
disabled={queueItems.length === currentItemIndex + 1}
|
disabled={queueItems?.length === currentItemIndex + 1}
|
||||||
onClick={() => handlePlayNext.mutate()}
|
onClick={() => handlePlayNext.mutate()}
|
||||||
>
|
>
|
||||||
<span className="material-symbols-rounded">skip_next</span>
|
<span className="material-symbols-rounded">skip_next</span>
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ 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 { useRouteContext } from "@tanstack/react-router";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
const PlayPreviousButton = () => {
|
const PlayPreviousButton = () => {
|
||||||
@@ -12,6 +11,7 @@ const PlayPreviousButton = () => {
|
|||||||
const user = useQuery({
|
const user = useQuery({
|
||||||
queryKey: ["user"],
|
queryKey: ["user"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return;
|
||||||
const result = await getUserApi(api).getCurrentUser();
|
const result = await getUserApi(api).getCurrentUser();
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
@@ -21,10 +21,7 @@ const PlayPreviousButton = () => {
|
|||||||
mutationFn: () => playItemFromQueue("previous", user.data?.Id, api),
|
mutationFn: () => playItemFromQueue("previous", user.data?.Id, api),
|
||||||
onError: (error) => [console.error(error)],
|
onError: (error) => [console.error(error)],
|
||||||
});
|
});
|
||||||
const [queueItems, currentItemIndex] = useQueue((state) => [
|
const [currentItemIndex] = useQueue((state) => [state.currentItemIndex]);
|
||||||
state.tracks,
|
|
||||||
state.currentItemIndex,
|
|
||||||
]);
|
|
||||||
return (
|
return (
|
||||||
<IconButton
|
<IconButton
|
||||||
disabled={currentItemIndex === 0}
|
disabled={currentItemIndex === 0}
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
$image-size: 5em;
|
|
||||||
|
|
||||||
.queue{
|
.queue{
|
||||||
&-item{
|
&-item{
|
||||||
|
--image-size: 5em;
|
||||||
|
&.episode {
|
||||||
|
--image-size: 8em !important;
|
||||||
|
}
|
||||||
width: 32em;
|
width: 32em;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
display: grid !important;
|
display: grid !important;
|
||||||
opacity: 1 !important;
|
opacity: 1 !important;
|
||||||
gap: 1em;
|
gap: 1em;
|
||||||
height: 5em;
|
height: 5em;
|
||||||
grid-template-columns: 3em $image-size 1fr;
|
grid-template-columns: 3em var(--image-size) 1fr;
|
||||||
justify-items: center;
|
justify-items: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
&-image{
|
&-image{
|
||||||
@@ -25,6 +27,7 @@ $image-size: 5em;
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
width: var(--image-size);
|
||||||
}
|
}
|
||||||
&-icon {
|
&-icon {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -44,6 +47,7 @@ $image-size: 5em;
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.2em;
|
gap: 0.2em;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&-item.Mui-disabled {
|
&-item.Mui-disabled {
|
||||||
@@ -51,4 +55,5 @@ $image-size: 5em;
|
|||||||
opacity: 0.5 !important;
|
opacity: 0.5 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,164 +1,382 @@
|
|||||||
import { playItemFromQueue } from "@/utils/store/playback";
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
import useQueue from "@/utils/store/queue";
|
|
||||||
import {
|
import {
|
||||||
|
Box,
|
||||||
|
Drawer,
|
||||||
IconButton,
|
IconButton,
|
||||||
Menu,
|
List,
|
||||||
MenuItem,
|
Tooltip,
|
||||||
MenuList,
|
|
||||||
Typography,
|
Typography,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import React, { useState } from "react";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
import React, { useMemo, useState } from "react";
|
||||||
|
import { playItemFromQueue } from "@/utils/store/playback";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import useQueue, {
|
||||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
clearUpcoming,
|
||||||
|
removeFromQueue,
|
||||||
|
reorderQueue,
|
||||||
|
shuffleUpcoming,
|
||||||
|
} from "@/utils/store/queue";
|
||||||
import "./queueButton.scss";
|
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 { useApiInContext } from "@/utils/store/api";
|
||||||
import { useRouteContext } from "@tanstack/react-router";
|
import QueueListItem from "../queueListItem";
|
||||||
const QueueButton = () => {
|
|
||||||
const api = useApiInContext((s) => s.api);
|
|
||||||
const [queueItems, currentItemIndex] = useQueue((state) => [
|
|
||||||
state.tracks,
|
|
||||||
state.currentItemIndex,
|
|
||||||
]);
|
|
||||||
|
|
||||||
const user = useQuery({
|
function SortableQueueItem({
|
||||||
queryKey: ["user"],
|
item,
|
||||||
queryFn: async () => {
|
onDelete,
|
||||||
const result = await getUserApi(api).getCurrentUser();
|
onPlay,
|
||||||
return result.data;
|
index,
|
||||||
},
|
}: {
|
||||||
});
|
item: BaseItemDto;
|
||||||
const [buttonEl, setButtonEl] = useState(null);
|
onDelete: () => void;
|
||||||
|
onPlay: () => void;
|
||||||
|
index: number;
|
||||||
|
}) {
|
||||||
|
const {
|
||||||
|
attributes,
|
||||||
|
listeners,
|
||||||
|
setNodeRef,
|
||||||
|
transform,
|
||||||
|
transition,
|
||||||
|
isDragging,
|
||||||
|
} = useSortable({ id: item.Id || "" });
|
||||||
|
|
||||||
const handlePlay = useMutation({
|
const style = {
|
||||||
mutationKey: ["handlePlayIndex"],
|
transform: CSS.Transform.toString(transform),
|
||||||
mutationFn: async ({ index }: { index: number }) => {
|
transition,
|
||||||
const result = playItemFromQueue(index, user.data?.Id);
|
opacity: isDragging ? 0.5 : 1,
|
||||||
return result;
|
position: "relative" as const,
|
||||||
},
|
zIndex: isDragging ? 2 : 1,
|
||||||
onSuccess: () => {
|
};
|
||||||
setButtonEl(null);
|
|
||||||
},
|
|
||||||
onError: (error) => {
|
|
||||||
console.error(error);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div ref={setNodeRef} style={style}>
|
||||||
<Menu
|
<QueueListItem
|
||||||
open={Boolean(buttonEl)}
|
queueItem={item}
|
||||||
onClose={() => setButtonEl(null)}
|
onDelete={onDelete}
|
||||||
anchorEl={buttonEl}
|
onPlay={onPlay}
|
||||||
anchorOrigin={{
|
dragHandleProps={{ ...attributes, ...listeners }}
|
||||||
vertical: "top",
|
isEpisode={item.Type === "Episode"}
|
||||||
horizontal: "center",
|
index={index}
|
||||||
}}
|
/>
|
||||||
transformOrigin={{
|
</div>
|
||||||
vertical: "bottom",
|
);
|
||||||
horizontal: "center",
|
}
|
||||||
}}
|
|
||||||
slotProps={{
|
const QueueButton = () => {
|
||||||
paper: {
|
const api = useApiInContext((s) => s.api);
|
||||||
style: {
|
|
||||||
maxHeight: "30em",
|
const [queueItems, currentItemIndex] = useQueue((state) => [
|
||||||
overflowX: "hidden",
|
state.tracks,
|
||||||
overflowY: "auto",
|
state.currentItemIndex,
|
||||||
},
|
]);
|
||||||
},
|
|
||||||
}}
|
const [open, setOpen] = useState(false);
|
||||||
>
|
|
||||||
<MenuList
|
const user = useQuery({
|
||||||
style={{
|
queryKey: ["currentUser"],
|
||||||
height: "fit-content",
|
queryFn: async () => {
|
||||||
width: " 32em",
|
if (!api) throw new Error("API not available");
|
||||||
position: "relative",
|
return (await getUserApi(api).getCurrentUser()).data;
|
||||||
}}
|
},
|
||||||
>
|
enabled: !!api,
|
||||||
{queueItems.map((item, index) => {
|
});
|
||||||
return (
|
|
||||||
<MenuItem
|
const sensors = useSensors(
|
||||||
className="queue-item"
|
useSensor(PointerSensor),
|
||||||
disabled={index === currentItemIndex}
|
useSensor(KeyboardSensor, {
|
||||||
onClick={() => handlePlay.mutate({ index })}
|
coordinateGetter: sortableKeyboardCoordinates,
|
||||||
key={item.Id}
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
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 (
|
||||||
|
<>
|
||||||
|
<Drawer
|
||||||
|
anchor="right"
|
||||||
|
open={open}
|
||||||
|
onClose={() => setOpen(false)}
|
||||||
|
PaperProps={{
|
||||||
|
className: "glass",
|
||||||
|
sx: {
|
||||||
|
width: 450,
|
||||||
|
maxWidth: "100%",
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
borderLeft: "1px solid rgba(255, 255, 255, 0.08)",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
ModalProps={{
|
||||||
|
BackdropProps: {
|
||||||
|
sx: {
|
||||||
|
backgroundColor: "rgba(0, 0, 0, 0.2)",
|
||||||
|
backdropFilter: "blur(4px)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
p={3}
|
||||||
|
display="flex"
|
||||||
|
justifyContent="space-between"
|
||||||
|
alignItems="center"
|
||||||
|
sx={{
|
||||||
|
position: "sticky",
|
||||||
|
top: 0,
|
||||||
|
zIndex: 20,
|
||||||
|
borderBottom: "1px solid",
|
||||||
|
borderColor: "rgba(255, 255, 255, 0.08)",
|
||||||
|
backgroundColor: "rgba(20, 20, 30, 0.4)",
|
||||||
|
backdropFilter: "blur(12px)",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Typography variant="subtitle2">
|
<Box display="flex" alignItems="center" gap={1}>
|
||||||
{item.Type === "Audio"
|
<Typography variant="h5" fontWeight="bold">
|
||||||
? index + 1
|
Play Queue
|
||||||
: item.IndexNumberEnd
|
</Typography>
|
||||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} / ${item.IndexNumberEnd}`
|
<Typography
|
||||||
: `S${item.ParentIndexNumber}:E${item.IndexNumber}`}
|
variant="caption"
|
||||||
</Typography>
|
color="text.secondary"
|
||||||
<div className="queue-item-image-container">
|
sx={{
|
||||||
{item.ImageTags?.Primary ? (
|
ml: 1,
|
||||||
<img
|
fontWeight: 600,
|
||||||
className="queue-item-image"
|
bgcolor: "rgba(255, 255, 255, 0.08)",
|
||||||
src={api?.getItemImageUrl(item?.Id, "Primary", {
|
px: 1,
|
||||||
tag: item.ImageTags?.Primary,
|
py: 0.5,
|
||||||
})}
|
borderRadius: 2,
|
||||||
alt={item.Name}
|
}}
|
||||||
/>
|
>
|
||||||
) : item.AlbumPrimaryImageTag?.length > 0 ? (
|
{queueItems?.length || 0}
|
||||||
<img
|
</Typography>
|
||||||
className="queue-item-image"
|
</Box>
|
||||||
src={api?.getItemImageUrl(item?.AlbumId, "Primary", {
|
<Box display="flex" gap={0.5}>
|
||||||
tag: item.AlbumPrimaryImageTag[0],
|
<Tooltip title="Shuffle Upcoming">
|
||||||
})}
|
<span>
|
||||||
alt={item.Name}
|
<IconButton
|
||||||
/>
|
onClick={handleShuffle}
|
||||||
) : (
|
size="small"
|
||||||
<div className="queue-item-image-icon">
|
disabled={upcomingItems.length < 2}
|
||||||
{getTypeIcon(item.Type)}
|
>
|
||||||
</div>
|
<span className="material-symbols-rounded">
|
||||||
)}
|
shuffle
|
||||||
{index === currentItemIndex && (
|
</span>
|
||||||
|
</IconButton>
|
||||||
|
</span>
|
||||||
|
</Tooltip>
|
||||||
|
<Tooltip title="Clear Upcoming">
|
||||||
|
<span>
|
||||||
|
<IconButton
|
||||||
|
onClick={handleClear}
|
||||||
|
size="small"
|
||||||
|
disabled={upcomingItems.length === 0}
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded">
|
||||||
|
clear_all
|
||||||
|
</span>
|
||||||
|
</IconButton>
|
||||||
|
</span>
|
||||||
|
</Tooltip>
|
||||||
|
<IconButton onClick={() => setOpen(false)} size="small">
|
||||||
|
<span className="material-symbols-rounded">close</span>
|
||||||
|
</IconButton>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
overflowY: "auto",
|
||||||
|
flex: 1,
|
||||||
|
p: 2,
|
||||||
|
"&::-webkit-scrollbar": { width: 8 },
|
||||||
|
"&::-webkit-scrollbar-track": { background: "transparent" },
|
||||||
|
"&::-webkit-scrollbar-thumb": {
|
||||||
|
background: "rgba(128,128,128,0.2)",
|
||||||
|
borderRadius: 4,
|
||||||
|
},
|
||||||
|
"&::-webkit-scrollbar-thumb:hover": {
|
||||||
|
background: "rgba(128,128,128,0.3)",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{queueItems && queueItems.length > 0 ? (
|
||||||
|
<List disablePadding>
|
||||||
|
{/* Current Item */}
|
||||||
|
{queueItems[currentItemIndex] && (
|
||||||
|
<Box sx={{ mb: 4 }}>
|
||||||
|
<Typography
|
||||||
|
variant="overline"
|
||||||
|
sx={{
|
||||||
|
display: "block",
|
||||||
|
opacity: 0.6,
|
||||||
|
mb: 1,
|
||||||
|
fontWeight: 600,
|
||||||
|
letterSpacing: 1.2,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
NOW PLAYING
|
||||||
|
</Typography>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
bgcolor: "background.paper",
|
||||||
|
borderRadius: 3,
|
||||||
|
overflow: "hidden",
|
||||||
|
boxShadow: 4,
|
||||||
|
border: "1px solid",
|
||||||
|
borderColor: "divider",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<QueueListItem
|
||||||
|
queueItem={queueItems[currentItemIndex]}
|
||||||
|
active={true}
|
||||||
|
isEpisode={
|
||||||
|
queueItems[currentItemIndex].Type === "Episode"
|
||||||
|
}
|
||||||
|
index={currentItemIndex + 1}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Upcoming Items */}
|
||||||
|
{upcomingItems.length > 0 && (
|
||||||
|
<>
|
||||||
|
<Typography
|
||||||
|
variant="overline"
|
||||||
|
sx={{
|
||||||
|
display: "block",
|
||||||
|
opacity: 0.6,
|
||||||
|
mb: 1,
|
||||||
|
fontWeight: 600,
|
||||||
|
letterSpacing: 1.2,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
NEXT UP
|
||||||
|
</Typography>
|
||||||
|
<DndContext
|
||||||
|
sensors={sensors}
|
||||||
|
collisionDetection={closestCenter}
|
||||||
|
onDragEnd={handleDragEnd}
|
||||||
|
modifiers={[restrictToVerticalAxis]}
|
||||||
|
>
|
||||||
|
<SortableContext
|
||||||
|
items={upcomingIds}
|
||||||
|
strategy={verticalListSortingStrategy}
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
gap: 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{upcomingItems.map((item, index) => (
|
||||||
|
<SortableQueueItem
|
||||||
|
key={item.Id || index}
|
||||||
|
item={item}
|
||||||
|
onDelete={() =>
|
||||||
|
handleDelete(currentItemIndex + 1 + index)
|
||||||
|
}
|
||||||
|
onPlay={() =>
|
||||||
|
handlePlay(currentItemIndex + 1 + index)
|
||||||
|
}
|
||||||
|
index={currentItemIndex + 1 + index + 1}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</Box>
|
||||||
|
</SortableContext>
|
||||||
|
</DndContext>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</List>
|
||||||
|
) : (
|
||||||
|
<Box
|
||||||
|
p={4}
|
||||||
|
textAlign="center"
|
||||||
|
display="flex"
|
||||||
|
flexDirection="column"
|
||||||
|
alignItems="center"
|
||||||
|
gap={2}
|
||||||
|
sx={{ opacity: 0.5 }}
|
||||||
|
>
|
||||||
<span
|
<span
|
||||||
className="material-symbols-rounded"
|
className="material-symbols-rounded"
|
||||||
style={{
|
style={{ fontSize: 48 }}
|
||||||
position: "absolute",
|
|
||||||
top: "50%",
|
|
||||||
left: "50%",
|
|
||||||
transform: "translate(-50%,-50%)",
|
|
||||||
fontSize: "2em",
|
|
||||||
"--wght": "100",
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
equalizer
|
queue_music
|
||||||
</span>
|
</span>
|
||||||
)}
|
<Typography>Your queue is empty</Typography>
|
||||||
</div>
|
</Box>
|
||||||
<div className="queue-item-info">
|
)}
|
||||||
{item.SeriesName ? (
|
</Box>
|
||||||
<>
|
</Drawer>
|
||||||
<Typography variant="subtitle1" width="100%">
|
<IconButton onClick={() => setOpen(true)}>
|
||||||
{item.SeriesName}
|
<span className="material-symbols-rounded">playlist_play</span>
|
||||||
</Typography>
|
</IconButton>
|
||||||
<Typography
|
</>
|
||||||
variant="subtitle2"
|
);
|
||||||
width="100%"
|
|
||||||
style={{ opacity: 0.6 }}
|
|
||||||
>
|
|
||||||
{item.Name}
|
|
||||||
</Typography>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<Typography variant="subtitle1" width="100%">
|
|
||||||
{item.Name}
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</MenuItem>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</MenuList>
|
|
||||||
</Menu>
|
|
||||||
<IconButton onClick={(e) => setButtonEl(e.currentTarget)}>
|
|
||||||
<span className="material-symbols-rounded">playlist_play</span>
|
|
||||||
</IconButton>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default QueueButton;
|
export default QueueButton;
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
import { saveUser } from "@/utils/storage/user";
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
|
||||||
import { getQuickConnectApi } from "@jellyfin/sdk/lib/utils/api/quick-connect-api";
|
import { getQuickConnectApi } from "@jellyfin/sdk/lib/utils/api/quick-connect-api";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
import { LoadingButton } from "@mui/lab";
|
import { LoadingButton, type LoadingButtonProps } from "@mui/lab";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
@@ -11,45 +9,114 @@ import {
|
|||||||
DialogContent,
|
DialogContent,
|
||||||
DialogContentText,
|
DialogContentText,
|
||||||
FormControlLabel,
|
FormControlLabel,
|
||||||
|
Slide,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Typography,
|
Typography,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
import type { TransitionProps } from "@mui/material/transitions";
|
||||||
|
import { skipToken, useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
import type { Timeout } from "@tanstack/react-router/dist/esm/utils";
|
|
||||||
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, { useState } from "react";
|
import React, { useCallback, useState } from "react";
|
||||||
|
import useInterval from "@/utils/hooks/useInterval";
|
||||||
|
import { saveUser } from "@/utils/storage/user";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
|
||||||
const QuickConnectButton = () => {
|
const Transition = React.forwardRef(function Transition(
|
||||||
|
props: TransitionProps & {
|
||||||
|
children: React.ReactElement<any, any>;
|
||||||
|
},
|
||||||
|
ref: React.Ref<unknown>,
|
||||||
|
) {
|
||||||
|
return (
|
||||||
|
<Slide
|
||||||
|
direction="up"
|
||||||
|
mountOnEnter
|
||||||
|
unmountOnExit
|
||||||
|
ref={ref}
|
||||||
|
timeout={{ enter: 500, exit: 1500 }}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const QuickConnectButton = (props: LoadingButtonProps) => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const createApi = useApiInContext((s) => s.createApi);
|
const createApi = useApiInContext((s) => s.createApi);
|
||||||
|
// if (!api) {
|
||||||
|
// console.error(
|
||||||
|
// "Unable to display quick connect button, api is not available",
|
||||||
|
// );
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
|
||||||
const headers = {
|
const headers = {
|
||||||
"X-Emby-Authorization": `MediaBrowser Client="${api.clientInfo.name}", Device="${api.deviceInfo.name}", DeviceId="${api.deviceInfo.id}", Version="${api.clientInfo.version}"`,
|
"X-Emby-Authorization": `MediaBrowser Client="${api?.clientInfo.name}", Device="${api?.deviceInfo.name}", DeviceId="${api?.deviceInfo.id}", Version="${api?.clientInfo.version}"`,
|
||||||
};
|
};
|
||||||
|
|
||||||
const [quickConnectStatusInterval, setQuickConnectStatusInterval] =
|
|
||||||
useState<Timeout | null>(null);
|
|
||||||
|
|
||||||
const quickConnectEnabled = useQuery({
|
|
||||||
queryKey: ["quick-connect-button", "check-quick-connect-enabled"],
|
|
||||||
queryFn: async () => await getQuickConnectApi(api).getQuickConnectEnabled(),
|
|
||||||
});
|
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const quickConnectEnabled = useQuery({
|
||||||
|
queryKey: ["quick-connect-button", "check-quick-connect-enabled"],
|
||||||
|
queryFn: api
|
||||||
|
? async () => await getQuickConnectApi(api).getQuickConnectEnabled()
|
||||||
|
: skipToken,
|
||||||
|
enabled: Boolean(api),
|
||||||
|
});
|
||||||
|
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
const [quickConnectCode, setQuickConnectCode] = useState<string | null>();
|
const [quickConnectCode, setQuickConnectCode] = useState<string | null>();
|
||||||
|
const [quickConnectSecret, setQuickConnectSecret] = useState<string | null>();
|
||||||
|
const [checkForQuickConnect, setCheckForQuickConnect] = useState(false);
|
||||||
const [rememberUser, setRememberUser] = useState(true);
|
const [rememberUser, setRememberUser] = useState(true);
|
||||||
|
const authenticateUser = useMutation({
|
||||||
|
mutationKey: ["quick-connect-button", "authenticate-user"],
|
||||||
|
mutationFn: async () => {
|
||||||
|
if (api && quickConnectSecret) {
|
||||||
|
return await getUserApi(api).authenticateWithQuickConnect(
|
||||||
|
{ quickConnectDto: { Secret: quickConnectSecret } },
|
||||||
|
{ headers },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onSuccess: (result) => {
|
||||||
|
if (api && result?.data?.AccessToken && result.data.User?.Name) {
|
||||||
|
setCheckForQuickConnect(false);
|
||||||
|
// saveUser({ username, password, rememberMe: rememberUser });
|
||||||
|
enqueueSnackbar(`Logged in as ${result.data.User?.Name}!`, {
|
||||||
|
variant: "success",
|
||||||
|
});
|
||||||
|
createApi(api.basePath, result.data.AccessToken);
|
||||||
|
if (rememberUser) {
|
||||||
|
saveUser(result.data.User?.Name, result.data.AccessToken);
|
||||||
|
}
|
||||||
|
navigate({ to: "/home", replace: true });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onError: (error) => {
|
||||||
|
enqueueSnackbar("Error authenticating user.", { variant: "error" });
|
||||||
|
console.error(error);
|
||||||
|
},
|
||||||
|
});
|
||||||
const checkQuickConnectStatus = useMutation({
|
const checkQuickConnectStatus = useMutation({
|
||||||
mutationKey: ["quick-connect-button", "check-quick-connect-status"],
|
mutationKey: ["quick-connect-button", "check-quick-connect-status"],
|
||||||
mutationFn: async (secret: string) =>
|
mutationFn: async (secret: string) =>
|
||||||
|
api &&
|
||||||
(
|
(
|
||||||
await getQuickConnectApi(api).getQuickConnectState(
|
await getQuickConnectApi(api).getQuickConnectState(
|
||||||
{ secret },
|
{ secret },
|
||||||
{ headers },
|
{ headers },
|
||||||
)
|
)
|
||||||
).data,
|
).data,
|
||||||
|
onSuccess: (result) => {
|
||||||
|
if (result?.Authenticated) {
|
||||||
|
setQuickConnectCode(null);
|
||||||
|
initQuickConnect.reset();
|
||||||
|
checkQuickConnectStatus.reset();
|
||||||
|
authenticateUser.mutate();
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const initQuickConnect = useMutation({
|
const initQuickConnect = useMutation({
|
||||||
mutationKey: ["quick-connect-button", "initiate-connection"],
|
mutationKey: ["quick-connect-button", "initiate-connection"],
|
||||||
@@ -59,70 +126,66 @@ const QuickConnectButton = () => {
|
|||||||
variant: "error",
|
variant: "error",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return await getQuickConnectApi(api).initiateQuickConnect({ headers });
|
if (api) {
|
||||||
|
return await getQuickConnectApi(api).initiateQuickConnect({ headers });
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onSuccess: (result) => {
|
onSuccess: (result) => {
|
||||||
setQuickConnectCode(result.data.Code);
|
setQuickConnectCode(result?.data.Code);
|
||||||
const authAwaitInterval = setInterval(async () => {
|
setQuickConnectSecret(result?.data.Secret);
|
||||||
// Check if user has been authenticated by the server
|
setCheckForQuickConnect(true);
|
||||||
const quickConnectCheck = await checkQuickConnectStatus.mutateAsync(
|
|
||||||
result.data.Secret,
|
|
||||||
);
|
|
||||||
if (quickConnectCheck.Authenticated) {
|
|
||||||
const userAuth = await getUserApi(api).authenticateWithQuickConnect({
|
|
||||||
quickConnectDto: {
|
|
||||||
Secret: quickConnectCheck.Secret,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
enqueueSnackbar(`Logged in as ${userAuth.data.User?.Name}!`, {
|
|
||||||
variant: "success",
|
|
||||||
});
|
|
||||||
sessionStorage.setItem("accessToken", userAuth.data.AccessToken);
|
|
||||||
createApi(api.basePath, userAuth.data.AccessToken);
|
|
||||||
|
|
||||||
if (rememberUser) {
|
|
||||||
await saveUser(userAuth.data.User?.Name, userAuth.data.AccessToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
clearInterval(authAwaitInterval);
|
|
||||||
|
|
||||||
navigate({ to: "/home" });
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
setQuickConnectStatusInterval(authAwaitInterval);
|
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
enqueueSnackbar("Error initiating Quick Connect.", { variant: "error" });
|
enqueueSnackbar("Error initiating Quick Connect.", { variant: "error" });
|
||||||
console.error(error);
|
console.error(error);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const handleQuickConnectClose = useCallback(() => {
|
||||||
|
setQuickConnectCode(null);
|
||||||
|
setCheckForQuickConnect(false);
|
||||||
|
initQuickConnect.reset();
|
||||||
|
checkQuickConnectStatus.reset();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useInterval(
|
||||||
|
() => {
|
||||||
|
if (quickConnectSecret) {
|
||||||
|
console.log(checkForQuickConnect);
|
||||||
|
checkQuickConnectStatus.mutate(quickConnectSecret);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
checkForQuickConnect ? 1500 : null,
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div style={{ marginLeft: "auto" }}>
|
||||||
|
{/* @ts-ignore */}
|
||||||
<LoadingButton
|
<LoadingButton
|
||||||
|
{...props}
|
||||||
disabled={
|
disabled={
|
||||||
quickConnectEnabled.isPending ||
|
quickConnectEnabled.isPending ||
|
||||||
Boolean(!quickConnectEnabled.data?.data)
|
Boolean(!quickConnectEnabled.data?.data)
|
||||||
}
|
}
|
||||||
loading={
|
loading={Boolean(
|
||||||
initQuickConnect.isPending ||
|
initQuickConnect.isPending ||
|
||||||
checkQuickConnectStatus.isPending ||
|
checkQuickConnectStatus.isPending ||
|
||||||
(quickConnectCode && !checkQuickConnectStatus.data?.Authenticated)
|
(quickConnectCode && !checkQuickConnectStatus.data?.Authenticated),
|
||||||
}
|
)}
|
||||||
variant="contained"
|
variant={props.variant ?? "contained"}
|
||||||
size="large"
|
|
||||||
style={{ flex: 1 }}
|
|
||||||
onClick={initQuickConnect.mutate}
|
onClick={initQuickConnect.mutate}
|
||||||
>
|
>
|
||||||
Quick Connect
|
{quickConnectEnabled.data?.data
|
||||||
|
? "Use Quick Connect"
|
||||||
|
: "Quick Connect Disabled"}
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
<Dialog
|
<Dialog
|
||||||
open={Boolean(quickConnectCode)}
|
open={Boolean(quickConnectCode)}
|
||||||
onClose={() => {
|
onClose={handleQuickConnectClose}
|
||||||
setQuickConnectCode(null);
|
|
||||||
clearInterval(quickConnectStatusInterval);
|
|
||||||
}}
|
|
||||||
fullWidth
|
fullWidth
|
||||||
maxWidth="xs"
|
maxWidth="xs"
|
||||||
|
TransitionComponent={Transition}
|
||||||
|
PaperProps={{ className: "glass", sx: { borderRadius: "24px" } }}
|
||||||
>
|
>
|
||||||
<DialogContent
|
<DialogContent
|
||||||
style={{
|
style={{
|
||||||
@@ -159,8 +222,8 @@ const QuickConnectButton = () => {
|
|||||||
borderRadius: "10px",
|
borderRadius: "10px",
|
||||||
cursor: "pointer",
|
cursor: "pointer",
|
||||||
}}
|
}}
|
||||||
onClick={async (e) => {
|
onClick={async () => {
|
||||||
await writeText(quickConnectCode);
|
quickConnectCode && (await writeText(quickConnectCode));
|
||||||
enqueueSnackbar("Quick Connect Code copied!", {
|
enqueueSnackbar("Quick Connect Code copied!", {
|
||||||
variant: "info",
|
variant: "info",
|
||||||
key: "copiedText",
|
key: "copiedText",
|
||||||
@@ -188,17 +251,12 @@ const QuickConnectButton = () => {
|
|||||||
}
|
}
|
||||||
label="Remember device"
|
label="Remember device"
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button variant="contained" onClick={handleQuickConnectClose}>
|
||||||
variant="contained"
|
|
||||||
onClick={() => {
|
|
||||||
setQuickConnectCode(null);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Close
|
Close
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ type TrailerButtonType = {
|
|||||||
const TrailerButton = (props: TrailerButtonType) => {
|
const TrailerButton = (props: TrailerButtonType) => {
|
||||||
const [dialog, setDialog] = useState(false);
|
const [dialog, setDialog] = useState(false);
|
||||||
return (
|
return (
|
||||||
<>
|
<div>
|
||||||
<IconButton
|
<IconButton
|
||||||
disabled={props.disabled ?? false}
|
disabled={props.disabled ?? false}
|
||||||
onClick={() => setDialog(true)}
|
onClick={() => setDialog(true)}
|
||||||
@@ -23,24 +23,27 @@ const TrailerButton = (props: TrailerButtonType) => {
|
|||||||
fullWidth
|
fullWidth
|
||||||
open={dialog}
|
open={dialog}
|
||||||
PaperProps={{
|
PaperProps={{
|
||||||
|
className: "glass",
|
||||||
style: {
|
style: {
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
onClose={() => setDialog(false)}
|
onClose={() => setDialog(false)}
|
||||||
>
|
>
|
||||||
<ReactPlayer
|
{props.trailerItem[0]?.Url && (
|
||||||
playing={false}
|
<ReactPlayer
|
||||||
url={props.trailerItem[0]?.Url}
|
playing={false}
|
||||||
width="100%"
|
url={props.trailerItem[0]?.Url}
|
||||||
height="auto"
|
width="100%"
|
||||||
style={{
|
height="auto"
|
||||||
aspectRatio: "16/9",
|
style={{
|
||||||
}}
|
aspectRatio: "16/9",
|
||||||
controls
|
}}
|
||||||
/>
|
controls
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,120 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
import { useNavigate } from "react-router-dom";
|
|
||||||
|
|
||||||
import MuiCard from "@mui/material/Card";
|
|
||||||
import CardActionArea from "@mui/material/CardActionArea";
|
|
||||||
import Typography from "@mui/material/Typography";
|
|
||||||
|
|
||||||
import { Blurhash } from "react-blurhash";
|
|
||||||
import { useApi } from "../../utils/store/api";
|
|
||||||
import "./card.scss";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} Props
|
|
||||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemDto} item
|
|
||||||
* @property {string} cardTitle
|
|
||||||
* @property {string | number} cardCaption
|
|
||||||
* @property {string} imageBlurhash
|
|
||||||
* @property {string} seriesId
|
|
||||||
* @property {boolean} hideText
|
|
||||||
* @property {() => {}} onClick
|
|
||||||
* @property {boolean} disablePadding
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Hero section for item pages
|
|
||||||
* @param {Props}
|
|
||||||
* @returns {React.Component}
|
|
||||||
*/
|
|
||||||
|
|
||||||
export const ActorCard = ({
|
|
||||||
item,
|
|
||||||
cardTitle,
|
|
||||||
cardCaption,
|
|
||||||
imageBlurhash,
|
|
||||||
seriesId,
|
|
||||||
hideText,
|
|
||||||
onClick,
|
|
||||||
disablePadding,
|
|
||||||
}) => {
|
|
||||||
const [api] = useApi((state) => [state.api]);
|
|
||||||
const navigate = useNavigate();
|
|
||||||
const defaultOnClick = () => {
|
|
||||||
navigate(`/person/${item.Id}`);
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className="card card-actor"
|
|
||||||
elevation={0}
|
|
||||||
onClick={onClick ? onClick : defaultOnClick}
|
|
||||||
>
|
|
||||||
<div className="card-box">
|
|
||||||
<div
|
|
||||||
className="card-image-container"
|
|
||||||
style={{
|
|
||||||
aspectRatio: 1,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{!!imageBlurhash && (
|
|
||||||
<Blurhash
|
|
||||||
hash={imageBlurhash}
|
|
||||||
width={128}
|
|
||||||
height={128}
|
|
||||||
resolutionX={24}
|
|
||||||
resolutionY={24}
|
|
||||||
className="card-image-blurhash"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<div className="card-image-icon-container">
|
|
||||||
<div className="material-symbols-rounded">person</div>
|
|
||||||
</div>
|
|
||||||
<img
|
|
||||||
alt={item.Name}
|
|
||||||
src={api.getItemImageUrl(
|
|
||||||
seriesId ? item.SeriesId : item.Id,
|
|
||||||
"Primary",
|
|
||||||
{
|
|
||||||
quality: 80,
|
|
||||||
fillHeight: 448,
|
|
||||||
fillWidth: 448,
|
|
||||||
},
|
|
||||||
)}
|
|
||||||
style={{
|
|
||||||
height: "100%",
|
|
||||||
width: "100%",
|
|
||||||
opacity: 0,
|
|
||||||
}}
|
|
||||||
loading="lazy"
|
|
||||||
onLoad={(e) => {
|
|
||||||
e.target.style.opacity = 1;
|
|
||||||
}}
|
|
||||||
className="card-image"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
className="card-text-container"
|
|
||||||
style={{ display: hideText ? "none" : "block" }}
|
|
||||||
>
|
|
||||||
<Typography
|
|
||||||
variant="subtitle1"
|
|
||||||
fontWeight={500}
|
|
||||||
noWrap
|
|
||||||
textAlign="center"
|
|
||||||
style={{ opacity: 0.9 }}
|
|
||||||
>
|
|
||||||
{cardTitle}
|
|
||||||
</Typography>
|
|
||||||
<Typography
|
|
||||||
variant="subtitle2"
|
|
||||||
noWrap
|
|
||||||
textAlign="center"
|
|
||||||
style={{ opacity: 0.6 }}
|
|
||||||
lineHeight="auto"
|
|
||||||
>
|
|
||||||
{cardCaption}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -82,12 +82,13 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity $transition-time-default;
|
transition: all $transition-time-default;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
background: rgb(0 0 0 / 0.6);
|
background: rgba(20, 20, 30, 0.6);
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
}
|
}
|
||||||
&:hover,
|
&:hover,
|
||||||
&:focus,
|
&:focus,
|
||||||
|
|||||||
@@ -1,41 +1,39 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
|
|
||||||
import React, { memo } from "react";
|
|
||||||
import { Component, useState } from "react";
|
|
||||||
|
|
||||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
|
||||||
|
|
||||||
import LinearProgress from "@mui/material/LinearProgress";
|
|
||||||
import Typography from "@mui/material/Typography";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
type BaseItemDto,
|
type BaseItemDto,
|
||||||
BaseItemKind,
|
BaseItemKind,
|
||||||
type ImageType,
|
type ImageType,
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
|
import React, { memo, type Ref, useCallback, useState } from "react";
|
||||||
|
import { ErrorBoundary } from "react-error-boundary";
|
||||||
|
import { useInView } from "react-intersection-observer";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
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";
|
||||||
import PlayButton from "../buttons/playButton";
|
import PlayButton from "../buttons/playButton";
|
||||||
import ErrorBoundary from "../errorBoundary";
|
|
||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
import { getTypeIcon } from "../utils/iconsCollection";
|
||||||
import "./card.scss";
|
import "./card.scss";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
|
||||||
|
|
||||||
const cardImageAspectRatios = {
|
interface CardProps {
|
||||||
thumb: 1.777,
|
item: BaseItemDto;
|
||||||
portrait: 0.666,
|
cardTitle: string | undefined | null;
|
||||||
square: 1,
|
cardCaption?: string | null | number;
|
||||||
};
|
imageType?: ImageType;
|
||||||
|
cardType: "square" | "thumb" | "portrait";
|
||||||
|
queryKey?: string[];
|
||||||
|
userId?: string;
|
||||||
|
seriesId?: string | null;
|
||||||
|
hideText?: boolean;
|
||||||
|
onClick?: () => void;
|
||||||
|
disableOverlay?: boolean;
|
||||||
|
overrideIcon?: any;
|
||||||
|
skipInView?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
const availableSpecialRoutes = [
|
const CardContent = ({
|
||||||
BaseItemKind.Series,
|
|
||||||
BaseItemKind.BoxSet,
|
|
||||||
BaseItemKind.MusicAlbum,
|
|
||||||
BaseItemKind.Episode,
|
|
||||||
BaseItemKind.Playlist,
|
|
||||||
];
|
|
||||||
|
|
||||||
const CardComponent = ({
|
|
||||||
item,
|
item,
|
||||||
cardTitle,
|
cardTitle,
|
||||||
cardCaption,
|
cardCaption,
|
||||||
@@ -48,55 +46,54 @@ const CardComponent = ({
|
|||||||
onClick,
|
onClick,
|
||||||
disableOverlay = false,
|
disableOverlay = false,
|
||||||
overrideIcon,
|
overrideIcon,
|
||||||
}: {
|
inView,
|
||||||
item: BaseItemDto;
|
forwardedRef,
|
||||||
cardTitle: string | undefined | null;
|
}: CardProps & {
|
||||||
cardCaption?: string | null | number;
|
inView: boolean;
|
||||||
imageType: ImageType;
|
forwardedRef?: Ref<HTMLDivElement>;
|
||||||
cardType: string;
|
|
||||||
queryKey?: string[];
|
|
||||||
userId?: string;
|
|
||||||
seriesId?: string | null;
|
|
||||||
hideText?: boolean;
|
|
||||||
onClick?: () => void;
|
|
||||||
disableOverlay?: boolean;
|
|
||||||
overrideIcon?: any;
|
|
||||||
}) => {
|
}) => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const defaultOnClick = () => {
|
|
||||||
switch (item.Type) {
|
const defaultOnClick = useCallback(() => {
|
||||||
case BaseItemKind.BoxSet:
|
if (item?.Id) {
|
||||||
navigate({ to: "/boxset/$id", params: { id: item.Id } });
|
switch (item?.Type) {
|
||||||
break;
|
case BaseItemKind.BoxSet:
|
||||||
case BaseItemKind.Episode:
|
navigate({ to: "/boxset/$id", params: { id: item.Id } });
|
||||||
navigate({ to: "/episode/$id", params: { id: item.Id } });
|
break;
|
||||||
break;
|
case BaseItemKind.Episode:
|
||||||
case BaseItemKind.MusicAlbum:
|
navigate({ to: "/episode/$id", params: { id: item.Id } });
|
||||||
navigate({ to: "/album/$id", params: { id: item.Id } });
|
break;
|
||||||
break;
|
case BaseItemKind.MusicAlbum:
|
||||||
case BaseItemKind.MusicArtist:
|
navigate({ to: "/album/$id", params: { id: item.Id } });
|
||||||
navigate({ to: "/artist/$id", params: { id: item.Id } });
|
break;
|
||||||
break;
|
case BaseItemKind.MusicArtist:
|
||||||
case BaseItemKind.Person:
|
navigate({ to: "/artist/$id", params: { id: item.Id } });
|
||||||
navigate({ to: "/person/$id", params: { id: item.Id } });
|
break;
|
||||||
break;
|
case BaseItemKind.Person:
|
||||||
case BaseItemKind.Series:
|
navigate({ to: "/person/$id", params: { id: item.Id } });
|
||||||
navigate({ to: "/series/$id", params: { id: item.Id } });
|
break;
|
||||||
break;
|
case BaseItemKind.Series:
|
||||||
case BaseItemKind.Playlist:
|
navigate({ to: "/series/$id", params: { id: item.Id } });
|
||||||
navigate({ to: "/playlist/$id", params: { id: item.Id } });
|
break;
|
||||||
break;
|
case BaseItemKind.Playlist:
|
||||||
default:
|
navigate({ to: "/playlist/$id", params: { id: item.Id } });
|
||||||
navigate({ to: "/item/$id", params: { id: item.Id } });
|
break;
|
||||||
break;
|
default:
|
||||||
|
navigate({ to: "/item/$id", params: { id: item.Id } });
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
}, [item?.Id, item?.Type, navigate]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="card" onClick={onClick ? onClick : defaultOnClick}>
|
<div
|
||||||
|
className="card"
|
||||||
|
ref={forwardedRef}
|
||||||
|
onClick={onClick || defaultOnClick}
|
||||||
|
>
|
||||||
<div className={`card-image-container ${cardType}`}>
|
<div className={`card-image-container ${cardType}`}>
|
||||||
<ErrorBoundary fallback>
|
<ErrorBoundary fallback={<></>}>
|
||||||
<div
|
<div
|
||||||
className="card-indicator check"
|
className="card-indicator check"
|
||||||
style={{
|
style={{
|
||||||
@@ -111,87 +108,90 @@ const CardComponent = ({
|
|||||||
opacity: item.UserData?.UnplayedItemCount ? 1 : 0,
|
opacity: item.UserData?.UnplayedItemCount ? 1 : 0,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography
|
<span
|
||||||
variant="subtitle2"
|
style={{
|
||||||
padding="0.1em 0.4em"
|
padding: "0.1em 0.4em",
|
||||||
fontWeight={400}
|
fontWeight: 400,
|
||||||
|
fontSize: "0.875rem",
|
||||||
|
lineHeight: 1.57,
|
||||||
|
fontFamily: "inherit",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{item.UserData?.UnplayedItemCount}
|
{item.UserData?.UnplayedItemCount}
|
||||||
</Typography>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
<div className="card-image-icon-container">
|
<div className="card-image-icon-container">
|
||||||
{overrideIcon ? getTypeIcon(overrideIcon) : getTypeIcon(item.Type)}
|
{overrideIcon
|
||||||
|
? getTypeIcon(overrideIcon)
|
||||||
|
: getTypeIcon(item.Type ?? "universal")}
|
||||||
</div>
|
</div>
|
||||||
<img
|
{inView && (
|
||||||
alt={item.Name ?? "blink"}
|
<img
|
||||||
src={
|
alt={item.Name ?? "blink"}
|
||||||
overrideIcon === "User"
|
src={
|
||||||
? `${api.basePath}/Users/${item.Id}/Images/Primary`
|
api
|
||||||
: api.getItemImageUrl(
|
? overrideIcon === "User"
|
||||||
seriesId ? item.SeriesId : item.AlbumId ?? item.Id,
|
? `${api?.basePath}/Users/${item.Id}/Images/Primary`
|
||||||
imageType,
|
: getImageUrlsApi(api).getItemImageUrlById(
|
||||||
{
|
(seriesId ? item.SeriesId : (item.AlbumId ?? item.Id)) ??
|
||||||
quality: 90,
|
"",
|
||||||
fillWidth: cardType === "thumb" ? 560 : 280,
|
imageType,
|
||||||
},
|
{
|
||||||
)
|
quality: 90,
|
||||||
}
|
fillWidth: cardType === "thumb" ? 560 : 320,
|
||||||
style={{
|
},
|
||||||
height: "100%",
|
)
|
||||||
width: "100%",
|
: ""
|
||||||
opacity: 0,
|
}
|
||||||
}}
|
style={{
|
||||||
loading="lazy"
|
height: "100%",
|
||||||
onLoad={(e) => {
|
width: "100%",
|
||||||
e.currentTarget.style.setProperty("opacity", "1");
|
opacity: 0,
|
||||||
}}
|
display: "block",
|
||||||
onLoadStart={(e) => console.log(e)}
|
transition: "opacity 0.3s ease-in-out",
|
||||||
className="card-image"
|
}}
|
||||||
/>
|
loading="lazy"
|
||||||
<div className="card-overlay">
|
onLoad={(e) => {
|
||||||
{!disableOverlay && (
|
e.currentTarget.style.opacity = "1";
|
||||||
<>
|
}}
|
||||||
<PlayButton
|
className="card-image"
|
||||||
itemId={item.Id}
|
/>
|
||||||
item={item}
|
)}
|
||||||
userId={userId}
|
{inView && !disableOverlay && (
|
||||||
itemType={item.Type}
|
<div className="card-overlay">
|
||||||
currentAudioTrack={0}
|
<PlayButton
|
||||||
currentSubTrack="nosub"
|
item={item}
|
||||||
currentVideoTrack={0}
|
userId={userId}
|
||||||
className="card-play-button"
|
itemType={item.Type ?? "Movie"}
|
||||||
iconProps={{
|
className="card-play-button"
|
||||||
style: { fontSize: "2.5em" },
|
iconOnly
|
||||||
}}
|
audio={
|
||||||
iconOnly
|
item.Type === BaseItemKind.MusicAlbum ||
|
||||||
audio={
|
item.Type === BaseItemKind.Audio ||
|
||||||
item.Type === BaseItemKind.MusicAlbum ||
|
item.Type === BaseItemKind.AudioBook ||
|
||||||
item.Type === BaseItemKind.Audio ||
|
item.Type === BaseItemKind.Playlist
|
||||||
item.Type === BaseItemKind.AudioBook ||
|
}
|
||||||
item.Type === BaseItemKind.Playlist
|
playlistItem={item.Type === BaseItemKind.Playlist}
|
||||||
}
|
playlistItemId={item.Id}
|
||||||
playlistItem={item.Type === BaseItemKind.Playlist}
|
/>
|
||||||
playlistItemId={item.Id}
|
<LikeButton
|
||||||
/>
|
itemId={item.Id}
|
||||||
<LikeButton
|
itemName={item.Name ?? ""}
|
||||||
itemId={item.Id}
|
isFavorite={item.UserData?.IsFavorite}
|
||||||
itemName={item.Name}
|
queryKey={queryKey}
|
||||||
isFavorite={item.UserData?.IsFavorite}
|
userId={userId}
|
||||||
queryKey={queryKey}
|
/>
|
||||||
userId={userId}
|
<MarkPlayedButton
|
||||||
/>
|
itemId={item.Id}
|
||||||
<MarkPlayedButton
|
itemName={item.Name ?? ""}
|
||||||
itemId={item.Id}
|
isPlayed={item.UserData?.Played}
|
||||||
itemName={item.Name}
|
queryKey={queryKey}
|
||||||
isPlayed={item.UserData?.Played}
|
userId={userId}
|
||||||
queryKey={queryKey}
|
/>
|
||||||
userId={userId}
|
</div>
|
||||||
/>
|
)}
|
||||||
</>
|
{(item.UserData?.PlaybackPositionTicks ?? -1) > 0 && (
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
{item.UserData?.PlaybackPositionTicks > 0 && (
|
|
||||||
<div className="card-progress-container">
|
<div className="card-progress-container">
|
||||||
<div
|
<div
|
||||||
className="card-progress"
|
className="card-progress"
|
||||||
@@ -204,22 +204,50 @@ const CardComponent = ({
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className="card-text-container"
|
className="card-text-container"
|
||||||
style={{ display: hideText ? "none" : "block" }}
|
style={{ display: hideText ? "none" : "block", marginLeft: "0.2em" }}
|
||||||
>
|
>
|
||||||
<Typography mt={1} variant="subtitle2" noWrap style={{ opacity: 0.9 }}>
|
<div
|
||||||
|
style={{
|
||||||
|
marginTop: "8px",
|
||||||
|
opacity: 0.9,
|
||||||
|
fontSize: "0.875rem",
|
||||||
|
fontWeight: 500,
|
||||||
|
whiteSpace: "nowrap",
|
||||||
|
overflow: "hidden",
|
||||||
|
textOverflow: "ellipsis",
|
||||||
|
}}
|
||||||
|
>
|
||||||
{cardTitle}
|
{cardTitle}
|
||||||
</Typography>
|
</div>
|
||||||
<Typography
|
<div
|
||||||
variant="caption"
|
style={{
|
||||||
noWrap
|
opacity: 0.6,
|
||||||
style={{ opacity: 0.6 }}
|
fontSize: "0.75rem",
|
||||||
lineHeight="auto"
|
whiteSpace: "nowrap",
|
||||||
|
overflow: "hidden",
|
||||||
|
textOverflow: "ellipsis",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{cardCaption}
|
{cardCaption}
|
||||||
</Typography>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const CardWithInView = (props: CardProps) => {
|
||||||
|
const { ref, inView } = useInView({
|
||||||
|
threshold: 0.1,
|
||||||
|
});
|
||||||
|
|
||||||
|
return <CardContent {...props} inView={inView} forwardedRef={ref} />;
|
||||||
|
};
|
||||||
|
|
||||||
|
const CardComponent = (props: CardProps) => {
|
||||||
|
if (props.skipInView) {
|
||||||
|
return <CardContent {...props} inView={true} />;
|
||||||
|
}
|
||||||
|
return <CardWithInView {...props} />;
|
||||||
|
};
|
||||||
|
|
||||||
export const Card = memo(CardComponent);
|
export const Card = memo(CardComponent);
|
||||||
@@ -1,208 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
|
|
||||||
import MuiCard from "@mui/material/Card";
|
|
||||||
import CardActionArea from "@mui/material/CardActionArea";
|
|
||||||
import LinearProgress from "@mui/material/LinearProgress";
|
|
||||||
import Typography from "@mui/material/Typography";
|
|
||||||
|
|
||||||
import { Blurhash } from "react-blurhash";
|
|
||||||
|
|
||||||
import "./card.scss";
|
|
||||||
|
|
||||||
import { getRuntimeCompact } from "@/utils/date/time";
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
|
||||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
|
||||||
import LikeButton from "../buttons/likeButton";
|
|
||||||
import MarkPlayedButton from "../buttons/markPlayedButton";
|
|
||||||
import PlayButton from "../buttons/playButton";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} Props
|
|
||||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemDto} item
|
|
||||||
* @property {string} cardTitle
|
|
||||||
* @property {string | number} cardCaption
|
|
||||||
* @property {string} imageBlurhash
|
|
||||||
* @property {Array} queryKey
|
|
||||||
* @property {string} userId
|
|
||||||
* @property {boolean} disableRunTime
|
|
||||||
* @property {() => {}} onClick
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Hero section for item pages
|
|
||||||
* @param {Props}
|
|
||||||
* @returns {React.Component}
|
|
||||||
*/
|
|
||||||
|
|
||||||
export const EpisodeCard = ({
|
|
||||||
item,
|
|
||||||
cardTitle,
|
|
||||||
cardCaption,
|
|
||||||
imageBlurhash,
|
|
||||||
queryKey,
|
|
||||||
userId,
|
|
||||||
disableRunTime = false,
|
|
||||||
onClick,
|
|
||||||
}) => {
|
|
||||||
const api = useApiInContext((s) => s.api);
|
|
||||||
const navigate = useNavigate();
|
|
||||||
const defaultOnClick = () => {
|
|
||||||
navigate({ to: `/episode/${item.Id}` });
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className="card card-episode"
|
|
||||||
elevation={0}
|
|
||||||
onClick={onClick ? onClick : defaultOnClick}
|
|
||||||
>
|
|
||||||
<div className="card-box">
|
|
||||||
<div
|
|
||||||
className="card-image-container"
|
|
||||||
style={{
|
|
||||||
aspectRatio: 1.777,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{!!item.UserData && (
|
|
||||||
<div
|
|
||||||
className="card-indicator check"
|
|
||||||
style={{
|
|
||||||
opacity: item.UserData?.Played ? 1 : 0,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className="material-symbols-rounded">done</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{!!imageBlurhash && (
|
|
||||||
<Blurhash
|
|
||||||
hash={imageBlurhash}
|
|
||||||
width={128}
|
|
||||||
height={128}
|
|
||||||
resolutionX={24}
|
|
||||||
resolutionY={24}
|
|
||||||
className="card-image-blurhash"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<div className="card-image-icon-container">
|
|
||||||
<div className="material-symbols-rounded">tv_gen</div>
|
|
||||||
</div>
|
|
||||||
<img
|
|
||||||
alt={item.Name}
|
|
||||||
src={api.getItemImageUrl(item.Id, "Primary", {
|
|
||||||
quality: 90,
|
|
||||||
fillHeight: 512,
|
|
||||||
fillWidth: 512,
|
|
||||||
})}
|
|
||||||
style={{
|
|
||||||
height: "100%",
|
|
||||||
width: "100%",
|
|
||||||
opacity: 0,
|
|
||||||
}}
|
|
||||||
loading="lazy"
|
|
||||||
onLoad={(e) => {
|
|
||||||
e.target.style.opacity = 1;
|
|
||||||
}}
|
|
||||||
className="card-image"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div className="card-overlay">
|
|
||||||
<PlayButton
|
|
||||||
itemId={item.Id}
|
|
||||||
userId={userId}
|
|
||||||
itemType={item.Type}
|
|
||||||
currentAudioTrack={0}
|
|
||||||
currentSubTrack={0}
|
|
||||||
currentVideoTrack={0}
|
|
||||||
className="card-play-button"
|
|
||||||
iconProps={{
|
|
||||||
style: { fontSize: "2.5em" },
|
|
||||||
}}
|
|
||||||
iconOnly
|
|
||||||
/>
|
|
||||||
<LikeButton
|
|
||||||
itemId={item.Id}
|
|
||||||
itemName={item.Name}
|
|
||||||
isFavorite={item.UserData?.IsFavorite}
|
|
||||||
queryKey={queryKey}
|
|
||||||
userId={userId}
|
|
||||||
/>
|
|
||||||
<MarkPlayedButton
|
|
||||||
itemId={item.Id}
|
|
||||||
itemName={item.Name}
|
|
||||||
isPlayed={item.UserData?.Played}
|
|
||||||
queryKey={queryKey}
|
|
||||||
userId={userId}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{100 > item.UserData?.PlayedPercentage > 0 && (
|
|
||||||
<LinearProgress
|
|
||||||
variant="determinate"
|
|
||||||
value={item.UserData.PlayedPercentage}
|
|
||||||
style={{
|
|
||||||
position: "absolute",
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
bottom: 0,
|
|
||||||
zIndex: 2,
|
|
||||||
height: "6px",
|
|
||||||
background: "rgb(5 5 5 / 0.5) !important",
|
|
||||||
backdropFilter: "blur(5px)",
|
|
||||||
}}
|
|
||||||
color="primary"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
className="card-text-container"
|
|
||||||
style={{ display: "block", marginTop: "0.5em" }}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "space-between",
|
|
||||||
gap: "1em",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Typography
|
|
||||||
variant="subtitle1"
|
|
||||||
fontWeight={500}
|
|
||||||
textAlign="start"
|
|
||||||
noWrap
|
|
||||||
style={{
|
|
||||||
opacity: 0.9,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{cardTitle}
|
|
||||||
</Typography>
|
|
||||||
{!disableRunTime && (
|
|
||||||
<Typography
|
|
||||||
variant="subtitle1"
|
|
||||||
fontWeight={500}
|
|
||||||
noWrap
|
|
||||||
textAlign="start"
|
|
||||||
style={{ opacity: 0.8, flexShrink: 0 }}
|
|
||||||
>
|
|
||||||
{getRuntimeCompact(item.RunTimeTicks)}
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Typography
|
|
||||||
variant="subtitle2"
|
|
||||||
textAlign="start"
|
|
||||||
style={{
|
|
||||||
opacity: 0.6,
|
|
||||||
display: "-webkit-box",
|
|
||||||
overflow: "hidden",
|
|
||||||
WebkitBoxOrient: "vertical",
|
|
||||||
WebkitLineClamp: 3,
|
|
||||||
}}
|
|
||||||
lineHeight="auto"
|
|
||||||
>
|
|
||||||
{cardCaption}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
import PropTypes from "prop-types";
|
|
||||||
import React, { useState } from "react";
|
|
||||||
|
|
||||||
import Carousel from "react-multi-carousel";
|
|
||||||
import "react-multi-carousel/lib/styles.css";
|
|
||||||
|
|
||||||
import Box from "@mui/material/Box";
|
|
||||||
import ButtonGroup from "@mui/material/ButtonGroup";
|
|
||||||
import IconButton from "@mui/material/IconButton";
|
|
||||||
import Typography from "@mui/material/Typography";
|
|
||||||
|
|
||||||
import "./cardScroller.scss";
|
|
||||||
|
|
||||||
export const CardScroller = ({
|
|
||||||
children,
|
|
||||||
displayCards,
|
|
||||||
title,
|
|
||||||
headingProps,
|
|
||||||
disableDecoration = false,
|
|
||||||
boxProps,
|
|
||||||
}) => {
|
|
||||||
const responsive = {
|
|
||||||
superLargeDesktop: {
|
|
||||||
// the naming can be any, depends on you.
|
|
||||||
breakpoint: { max: 4000, min: 3000 },
|
|
||||||
items: displayCards + 1,
|
|
||||||
slidesToSlide: displayCards + 1,
|
|
||||||
partialVisibilityGutter: 40,
|
|
||||||
},
|
|
||||||
desktop: {
|
|
||||||
breakpoint: { max: 3000, min: 925 },
|
|
||||||
items: displayCards,
|
|
||||||
slidesToSlide: displayCards, // optional, default to 1.
|
|
||||||
partialVisibilityGutter: 30,
|
|
||||||
},
|
|
||||||
tablet: {
|
|
||||||
breakpoint: { max: 925, min: 600 },
|
|
||||||
items: displayCards - 3,
|
|
||||||
slidesToSlide: displayCards - 3, // optional, default to 1.
|
|
||||||
partialVisibilityGutter: 20,
|
|
||||||
},
|
|
||||||
mobile: {
|
|
||||||
breakpoint: { max: 600, min: 424 },
|
|
||||||
items: displayCards - 5,
|
|
||||||
slidesToSlide: displayCards - 5, // optional, default to 1.
|
|
||||||
partialVisibilityGutter: 10,
|
|
||||||
},
|
|
||||||
smallScreen: {
|
|
||||||
breakpoint: { max: 424, min: 0 },
|
|
||||||
items: 1,
|
|
||||||
slidesToSlide: 1, // optional, default to 1.
|
|
||||||
partialVisibilityGutter: 10,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const [carouselRef, setCarouselRef] = useState();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Box {...boxProps} className="card-scroller-container" mb={1}>
|
|
||||||
<Box
|
|
||||||
sx={{ mb: 1 }}
|
|
||||||
className={
|
|
||||||
disableDecoration
|
|
||||||
? "card-scroller-header-container hidden-decoration"
|
|
||||||
: "card-scroller-header-container"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Typography
|
|
||||||
variant="h5"
|
|
||||||
color="textPrimary"
|
|
||||||
className="card-scroller-heading"
|
|
||||||
{...headingProps}
|
|
||||||
>
|
|
||||||
<div className="card-scroller-heading-decoration" /> {title}
|
|
||||||
</Typography>
|
|
||||||
</Box>
|
|
||||||
<Carousel
|
|
||||||
swipeable
|
|
||||||
draggable
|
|
||||||
responsive={responsive}
|
|
||||||
arrows
|
|
||||||
ref={(el) => setCarouselRef(el)}
|
|
||||||
className="card-scroller"
|
|
||||||
customTransition="all .6s"
|
|
||||||
transitionDuration={600}
|
|
||||||
customRightArrow={
|
|
||||||
<IconButton className="card-scroller-button right">
|
|
||||||
<div className="material-symbols-rounded">chevron_right</div>
|
|
||||||
</IconButton>
|
|
||||||
}
|
|
||||||
customLeftArrow={
|
|
||||||
<IconButton className="card-scroller-button left">
|
|
||||||
<div className="material-symbols-rounded">chevron_left</div>
|
|
||||||
</IconButton>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
</Carousel>
|
|
||||||
</Box>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
CardScroller.propTypes = {
|
|
||||||
displayCards: PropTypes.number.isRequired,
|
|
||||||
title: PropTypes.string.isRequired,
|
|
||||||
headingProps: PropTypes.any,
|
|
||||||
};
|
|
||||||
@@ -1,51 +1,82 @@
|
|||||||
|
@use "@/styles/variables.scss" as *;
|
||||||
|
|
||||||
|
.card-scroller-container {
|
||||||
|
margin-bottom: 2.5em;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
// Ensure the container handles overflow if needed, but usually Carousel handles it
|
||||||
|
}
|
||||||
|
|
||||||
.card-scroller {
|
.card-scroller {
|
||||||
// height: 20em;
|
// Override carousel default outline
|
||||||
|
&:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
&-slide {
|
&-slide {
|
||||||
overflow: visible;
|
padding-right: 0.5em; // Gap between cards (handled by slide padding instead of gap for carousel)
|
||||||
display: flex;
|
// With react-multi-carousel, better to rely on their gap logic or item class
|
||||||
}
|
|
||||||
&-button {
|
|
||||||
position: absolute !important;
|
|
||||||
height: 100%;
|
|
||||||
font-size: 1em !important;
|
|
||||||
width: $page-margin;
|
|
||||||
&.right{
|
|
||||||
border-radius: $border-radius-default 0 0 $border-radius-default !important;
|
|
||||||
right: -$page-margin;
|
|
||||||
}
|
|
||||||
&.left{
|
|
||||||
border-radius: 0 $border-radius-default $border-radius-default 0 !important;
|
|
||||||
left: -$page-margin;
|
|
||||||
}
|
|
||||||
.material-symbols-rounded{
|
|
||||||
font-size: 3.2em;
|
|
||||||
--wght: 200;
|
|
||||||
--opsz: 48;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-item {
|
||||||
|
padding-right: 0.6em; // Consistent gap
|
||||||
|
}
|
||||||
|
|
||||||
&-header-container {
|
&-header-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
min-height: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-heading {
|
&-heading {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
gap: 0.35em;
|
gap: 0.5em;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-bottom: 0.25em !important;
|
font-weight: 600 !important;
|
||||||
|
|
||||||
&-decoration {
|
&-decoration {
|
||||||
width: 0.75em;
|
width: 4px;
|
||||||
height: 2px;
|
height: 24px;
|
||||||
background: white;
|
background: $clr-accent-default;
|
||||||
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&-container .MuiButtonGroup-outlined{
|
|
||||||
gap: 1em;
|
&-controls {
|
||||||
}
|
display: flex;
|
||||||
|
gap: 0.5em;
|
||||||
|
|
||||||
|
.scroller-nav-btn {
|
||||||
|
background-color: rgba(255, 255, 255, 0.05);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.05);
|
||||||
|
color: rgba(255, 255, 255, 0.7);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: rgba(255, 255, 255, 0.1);
|
||||||
|
color: #fff;
|
||||||
|
border-color: rgba(255, 255, 255, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disabled state
|
||||||
|
&.Mui-disabled {
|
||||||
|
background-color: transparent;
|
||||||
|
border-color: transparent;
|
||||||
|
color: rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.material-symbols-rounded {
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.hidden-decoration {
|
.hidden-decoration {
|
||||||
|
|||||||
@@ -0,0 +1,157 @@
|
|||||||
|
import React, { type ReactNode, useRef, useState } from "react";
|
||||||
|
import Carousel from "react-multi-carousel";
|
||||||
|
import "react-multi-carousel/lib/styles.css";
|
||||||
|
|
||||||
|
import IconButton from "@mui/material/IconButton";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
|
import "./cardScroller.scss";
|
||||||
|
|
||||||
|
// Custom Header + Button Group component
|
||||||
|
const ScrollerHeader = ({
|
||||||
|
onNext,
|
||||||
|
onPrevious,
|
||||||
|
title,
|
||||||
|
headingProps,
|
||||||
|
disableDecoration,
|
||||||
|
currentSlide = 0,
|
||||||
|
isNextDisabled = false,
|
||||||
|
}: any) => {
|
||||||
|
// Basic disable logic for visual feedback
|
||||||
|
const isFirst = currentSlide === 0;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={`card-scroller-header-container ${disableDecoration ? "hidden-decoration" : ""}`}
|
||||||
|
>
|
||||||
|
<Typography
|
||||||
|
variant="h5"
|
||||||
|
color="textPrimary"
|
||||||
|
className="card-scroller-heading"
|
||||||
|
{...headingProps}
|
||||||
|
>
|
||||||
|
<div className="card-scroller-heading-decoration" />
|
||||||
|
{title}
|
||||||
|
</Typography>
|
||||||
|
|
||||||
|
<div className="card-scroller-controls">
|
||||||
|
<IconButton
|
||||||
|
onClick={onPrevious}
|
||||||
|
disabled={isFirst}
|
||||||
|
size="small"
|
||||||
|
className="scroller-nav-btn"
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded">chevron_left</span>
|
||||||
|
</IconButton>
|
||||||
|
<IconButton
|
||||||
|
onClick={onNext}
|
||||||
|
disabled={isNextDisabled}
|
||||||
|
size="small"
|
||||||
|
className="scroller-nav-btn"
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded">chevron_right</span>
|
||||||
|
</IconButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
type CardScrollerProps = {
|
||||||
|
children: ReactNode;
|
||||||
|
displayCards: number;
|
||||||
|
title: string;
|
||||||
|
headingProps?: object;
|
||||||
|
disableDecoration?: boolean;
|
||||||
|
boxProps?: object;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function CardScroller({
|
||||||
|
children,
|
||||||
|
displayCards,
|
||||||
|
title,
|
||||||
|
headingProps,
|
||||||
|
disableDecoration = false,
|
||||||
|
boxProps,
|
||||||
|
}: CardScrollerProps) {
|
||||||
|
const carouselRef = useRef<any>(null);
|
||||||
|
const [currentSlide, setCurrentSlide] = useState(0);
|
||||||
|
const [slidesToShow, setSlidesToShow] = useState(displayCards);
|
||||||
|
const totalItems = React.Children.count(children);
|
||||||
|
|
||||||
|
const responsive = {
|
||||||
|
superLargeDesktop: {
|
||||||
|
breakpoint: { max: 4000, min: 3000 },
|
||||||
|
items: displayCards + 1,
|
||||||
|
slidesToSlide: displayCards + 1,
|
||||||
|
partialVisibilityGutter: 40,
|
||||||
|
},
|
||||||
|
desktop: {
|
||||||
|
breakpoint: { max: 3000, min: 925 },
|
||||||
|
items: displayCards,
|
||||||
|
slidesToSlide: displayCards,
|
||||||
|
partialVisibilityGutter: 30,
|
||||||
|
},
|
||||||
|
tablet: {
|
||||||
|
breakpoint: { max: 925, min: 600 },
|
||||||
|
items: displayCards - 3,
|
||||||
|
slidesToSlide: displayCards - 3,
|
||||||
|
partialVisibilityGutter: 20,
|
||||||
|
},
|
||||||
|
mobile: {
|
||||||
|
breakpoint: { max: 600, min: 424 },
|
||||||
|
items: displayCards - 5,
|
||||||
|
slidesToSlide: displayCards - 5,
|
||||||
|
partialVisibilityGutter: 10,
|
||||||
|
},
|
||||||
|
smallScreen: {
|
||||||
|
breakpoint: { max: 424, min: 0 },
|
||||||
|
items: 1,
|
||||||
|
slidesToSlide: 1,
|
||||||
|
partialVisibilityGutter: 10,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleNext = () => {
|
||||||
|
if (carouselRef.current) {
|
||||||
|
carouselRef.current.next();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlePrevious = () => {
|
||||||
|
if (carouselRef.current) {
|
||||||
|
carouselRef.current.previous();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div {...boxProps} className="card-scroller-container">
|
||||||
|
<ScrollerHeader
|
||||||
|
title={title}
|
||||||
|
headingProps={headingProps}
|
||||||
|
disableDecoration={disableDecoration}
|
||||||
|
onNext={handleNext}
|
||||||
|
onPrevious={handlePrevious}
|
||||||
|
currentSlide={currentSlide}
|
||||||
|
isNextDisabled={currentSlide + slidesToShow >= totalItems}
|
||||||
|
/>
|
||||||
|
<Carousel
|
||||||
|
ref={carouselRef}
|
||||||
|
swipeable
|
||||||
|
draggable
|
||||||
|
responsive={responsive}
|
||||||
|
arrows={false}
|
||||||
|
className="card-scroller"
|
||||||
|
customTransition="transform 400ms ease-in-out"
|
||||||
|
transitionDuration={400}
|
||||||
|
containerClass="card-scroller-track"
|
||||||
|
itemClass="card-scroller-item"
|
||||||
|
beforeChange={(nextSlide, state) => {
|
||||||
|
setCurrentSlide(nextSlide);
|
||||||
|
setSlidesToShow(state.slidesToShow);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</Carousel>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,15 +1,38 @@
|
|||||||
.carousel {
|
.carousel {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 64vh;
|
overflow: visible;
|
||||||
width: calc(100% + 2*$page-margin);
|
height: 65vh;
|
||||||
left: -$page-margin;
|
margin-bottom: 3em;
|
||||||
margin-bottom: 3.2em;
|
display: grid;
|
||||||
.slider {
|
grid-template-areas: "main sidebar";
|
||||||
position: absolute;
|
grid-template-columns: 1fr 340px;
|
||||||
bottom: 0;
|
gap: 1.5em;
|
||||||
max-width: 35%;
|
|
||||||
right: $page-margin;
|
&-sidebar {
|
||||||
|
overflow-y: auto;
|
||||||
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
|
@include glass-effect($bg-color: rgba(10, 10, 14, 0.4));
|
||||||
|
border-radius: 24px;
|
||||||
|
grid-area: sidebar;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 12px;
|
||||||
|
gap: 8px;
|
||||||
|
|
||||||
|
// Ensure programmatic scroll respects padding
|
||||||
|
scroll-padding-block: 24px;
|
||||||
|
|
||||||
|
// Hide scrollbar but keep functionality
|
||||||
|
scrollbar-width: none;
|
||||||
|
-ms-overflow-style: none;
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&-button {
|
&-button {
|
||||||
position: absolute !important;
|
position: absolute !important;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
@@ -25,14 +48,102 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-ticker{
|
||||||
|
overflow: hidden;
|
||||||
|
height: 72px;
|
||||||
|
display: flex;
|
||||||
|
padding: 8px;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
position: relative;
|
||||||
|
border-radius: 12px; // Slightly smaller radius to work with the bar
|
||||||
|
background: transparent;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.05);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background: rgba(255, 255, 255, 0.08); // Subtle background
|
||||||
|
|
||||||
|
// Vertical Progress Bar
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 4px;
|
||||||
|
background-color: var(--mui-palette-primary-main, #fff);
|
||||||
|
height: 0%;
|
||||||
|
animation: ticker-v-progress 8s linear;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-image {
|
||||||
|
height: 56px;
|
||||||
|
width: 100px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
border-radius: 8px;
|
||||||
|
object-fit: cover;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.2);
|
||||||
|
|
||||||
|
&.placeholder {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: rgb(100 100 100 / 0.1);
|
||||||
|
color: rgb(200 200 200 / 0.7);
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
& > div {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
min-width: 0; // flexible text truncation
|
||||||
|
padding-left: 4px; // compensate for visual weight of potential bar
|
||||||
|
|
||||||
|
.carousel-ticker-title {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
font-weight: 500; // Slightly lighter
|
||||||
|
font-size: 0.95rem;
|
||||||
|
line-height: 1.2;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
.carousel-ticker-year {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pause progress when carousel is paused
|
||||||
|
&.paused {
|
||||||
|
.carousel-ticker.active::after {
|
||||||
|
animation-play-state: paused;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes ticker-v-progress {
|
||||||
|
from { height: 0%; }
|
||||||
|
to { height: 100%; }
|
||||||
|
}
|
||||||
|
|
||||||
&-indicator {
|
&-indicator {
|
||||||
aspect-ratio: 1.77777;
|
aspect-ratio: 1.77777;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
transition: opacity $transition-time-fast;
|
transition: opacity $transition-time-fast;
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
width: auto;
|
width: auto;
|
||||||
&:hover {
|
&:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
@@ -44,29 +155,33 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
&-image {
|
&-image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-icon {
|
&-icon {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: rgb(155 155 155 / 0.4);
|
background: rgb(155 155 155 / 0.4);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
&.active {
|
&.active {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
|
||||||
.material-symbols-rounded {
|
.material-symbols-rounded {
|
||||||
|
|
||||||
--fill: 1;
|
--fill: 1;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
.carousel-ticker-wrapper {
|
||||||
|
scroll-margin-block: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,150 +1,145 @@
|
|||||||
import { AnimatePresence, motion } from "framer-motion";
|
import { AnimatePresence } from "motion/react";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useCallback, useEffect, useState } from "react";
|
||||||
|
|
||||||
import IconButton from "@mui/material/IconButton";
|
|
||||||
|
|
||||||
import { useCarouselStore } from "../../utils/store/carousel";
|
import { useCarouselStore } from "../../utils/store/carousel";
|
||||||
import "./carousel.scss";
|
import "./carousel.scss";
|
||||||
|
import {
|
||||||
|
type BaseItemDto,
|
||||||
|
BaseItemKind,
|
||||||
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
|
||||||
import CarouselSlide from "../carouselSlide";
|
import CarouselSlide from "../carouselSlide";
|
||||||
|
import CarouselTickers from "./tickers";
|
||||||
|
|
||||||
import ReactMultiCarousel from "react-multi-carousel";
|
// Memoize CarouselSlide to prevent unnecessary re-renders
|
||||||
import Slider from "../Slider";
|
const MemoizedCarouselSlide = React.memo(CarouselSlide);
|
||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
|
||||||
|
|
||||||
const swipeConfidenceThreshold = 8000;
|
|
||||||
const swipePower = (offset, velocity) => {
|
|
||||||
return Math.abs(offset) * velocity;
|
|
||||||
};
|
|
||||||
|
|
||||||
const Carousel = ({
|
const Carousel = ({
|
||||||
content,
|
content,
|
||||||
onChange,
|
onChange,
|
||||||
}: {
|
}: {
|
||||||
content: BaseItemDto[];
|
content: BaseItemDto[];
|
||||||
onChange: () => void;
|
onChange: (currentSlide: number) => void;
|
||||||
}) => {
|
}) => {
|
||||||
const [currentSlide, setCurrentSlide] = useState(0);
|
const [currentSlide, setCurrentSlide] = useState(0);
|
||||||
|
const [isPaused, setIsPaused] = useState(false);
|
||||||
|
const sidebarRef = React.useRef<HTMLDivElement>(null);
|
||||||
|
const tickerRefs = React.useRef<(HTMLDivElement | null)[]>([]);
|
||||||
|
const currentSlideRef = React.useRef(currentSlide);
|
||||||
|
|
||||||
|
const [setDirection] = useCarouselStore((state) => [state.setDirection]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
currentSlideRef.current = currentSlide;
|
||||||
|
}, [currentSlide]);
|
||||||
|
|
||||||
const [setDirection, dir] = useCarouselStore((state) => [
|
|
||||||
state.setDirection,
|
|
||||||
state.direction,
|
|
||||||
]);
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
onChange(currentSlide);
|
onChange(currentSlide);
|
||||||
}, [content[currentSlide]?.Id]);
|
|
||||||
|
// Auto-scroll sidebar to keep active item in view
|
||||||
|
const activeTicker = tickerRefs.current[currentSlide];
|
||||||
|
const sidebar = sidebarRef.current;
|
||||||
|
|
||||||
|
if (activeTicker && sidebar) {
|
||||||
|
const sidebarTop = sidebar.scrollTop;
|
||||||
|
const sidebarBottom = sidebarTop + sidebar.clientHeight;
|
||||||
|
const activeTickerTop = activeTicker.offsetTop;
|
||||||
|
const activeTickerBottom =
|
||||||
|
activeTicker.offsetTop + activeTicker.offsetHeight;
|
||||||
|
|
||||||
|
// If element is below the visible area
|
||||||
|
if (activeTickerBottom > sidebarBottom) {
|
||||||
|
sidebar.scrollTo({
|
||||||
|
top: activeTickerBottom - sidebar.clientHeight + 24, // 24px padding
|
||||||
|
behavior: "smooth",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// If element is above the visible area
|
||||||
|
else if (activeTickerTop < sidebarTop) {
|
||||||
|
sidebar.scrollTo({
|
||||||
|
top: activeTickerTop - 24, // 24px padding
|
||||||
|
behavior: "smooth",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [currentSlide, content, onChange]);
|
||||||
|
|
||||||
|
// Autoplay functionality
|
||||||
|
useEffect(() => {
|
||||||
|
if (isPaused || content.length === 0) return;
|
||||||
|
|
||||||
|
const timer = setInterval(() => {
|
||||||
|
setDirection("right");
|
||||||
|
setCurrentSlide((prev) => (prev + 1) % content.length);
|
||||||
|
}, 8000);
|
||||||
|
|
||||||
|
return () => clearInterval(timer);
|
||||||
|
}, [isPaused, content.length, setDirection, currentSlide]);
|
||||||
|
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
|
|
||||||
const responsive = {
|
const handleTickerClick = useCallback(
|
||||||
superLargeDesktop: {
|
(index: number) => {
|
||||||
// the naming can be any, depends on you.
|
if (index === currentSlideRef.current) return;
|
||||||
breakpoint: { max: 4000, min: 3000 },
|
setDirection(index > currentSlideRef.current ? "right" : "left");
|
||||||
items: 6,
|
setCurrentSlide(index);
|
||||||
},
|
},
|
||||||
desktop: {
|
[setDirection],
|
||||||
breakpoint: { max: 3000, min: 1024 },
|
);
|
||||||
items: 6,
|
|
||||||
},
|
if (!api) return null;
|
||||||
tablet: {
|
|
||||||
breakpoint: { max: 1024, min: 464 },
|
|
||||||
items: 4,
|
|
||||||
},
|
|
||||||
mobile: {
|
|
||||||
breakpoint: { max: 464, min: 0 },
|
|
||||||
items: 1,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="carousel">
|
<div
|
||||||
|
className={`carousel ${isPaused ? "paused" : ""}`}
|
||||||
|
onMouseEnter={() => setIsPaused(true)}
|
||||||
|
onMouseLeave={() => setIsPaused(false)}
|
||||||
|
>
|
||||||
<AnimatePresence mode="sync">
|
<AnimatePresence mode="sync">
|
||||||
<motion.div
|
<MemoizedCarouselSlide
|
||||||
key={currentSlide}
|
item={content[currentSlide]}
|
||||||
initial={{ opacity: 0 }}
|
key={content[currentSlide].Id}
|
||||||
animate={{ opacity: 1 }}
|
/>
|
||||||
exit={{ opacity: 0 }}
|
|
||||||
transition={{
|
|
||||||
duration: 0.25,
|
|
||||||
ease: "linear",
|
|
||||||
}}
|
|
||||||
drag={"x"}
|
|
||||||
dragConstraints={{ left: 0, right: 0 }}
|
|
||||||
dragElastic={1}
|
|
||||||
onDragEnd={(e, { offset, velocity }) => {
|
|
||||||
const swipe = swipePower(offset.x, velocity.x);
|
|
||||||
if (
|
|
||||||
currentSlide !== content.length - 1 &&
|
|
||||||
swipe < -swipeConfidenceThreshold
|
|
||||||
) {
|
|
||||||
setDirection("right");
|
|
||||||
setCurrentSlide((init) => init + 1);
|
|
||||||
} else if (currentSlide !== 0 && swipe > swipeConfidenceThreshold) {
|
|
||||||
setDirection("left");
|
|
||||||
setCurrentSlide((init) => init - 1);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
style={{
|
|
||||||
height: "100%",
|
|
||||||
width: "100%",
|
|
||||||
position: "absolute",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<CarouselSlide
|
|
||||||
item={content[currentSlide]}
|
|
||||||
key={content[currentSlide].Id}
|
|
||||||
/>
|
|
||||||
</motion.div>
|
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
<Slider
|
<div className="carousel-sidebar" ref={sidebarRef}>
|
||||||
currentSlide={currentSlide}
|
{content.map((item, index) => (
|
||||||
content={content.map((item, index) => (
|
<div
|
||||||
<motion.div
|
|
||||||
className={
|
|
||||||
currentSlide === index
|
|
||||||
? "carousel-indicator active"
|
|
||||||
: "carousel-indicator"
|
|
||||||
}
|
|
||||||
layout
|
|
||||||
initial={{
|
|
||||||
height: "4.6em",
|
|
||||||
}}
|
|
||||||
whileHover={{
|
|
||||||
height: "5.5em",
|
|
||||||
}}
|
|
||||||
transition={{
|
|
||||||
duration: 0.05,
|
|
||||||
}}
|
|
||||||
key={item.Id}
|
key={item.Id}
|
||||||
onClick={() => {
|
ref={(el) => {
|
||||||
if (currentSlide > index) {
|
tickerRefs.current[index] = el;
|
||||||
setDirection("left");
|
|
||||||
} else if (currentSlide <= index) {
|
|
||||||
setDirection("right");
|
|
||||||
}
|
|
||||||
setCurrentSlide(index);
|
|
||||||
}}
|
}}
|
||||||
|
className="carousel-ticker-wrapper"
|
||||||
>
|
>
|
||||||
{item.ImageTags?.Thumb ? (
|
<CarouselTickers
|
||||||
<img
|
imageUrl={
|
||||||
src={api.getItemImageUrl(item.Id, "Thumb", {
|
item.ImageTags?.Thumb
|
||||||
tag: item.ImageTags.Primary,
|
? getImageUrlsApi(api).getItemImageUrlById(
|
||||||
fillWidth: 300,
|
item.Id ?? "",
|
||||||
})}
|
"Thumb",
|
||||||
alt={item.Name ?? "item-image"}
|
{
|
||||||
className="carousel-indicator-image"
|
quality: 90,
|
||||||
/>
|
fillHeight: 360,
|
||||||
) : (
|
},
|
||||||
<div className="carousel-indicator-icon">
|
)
|
||||||
{getTypeIcon(item.Type)}
|
: undefined
|
||||||
</div>
|
}
|
||||||
)}
|
isActive={index === currentSlide}
|
||||||
</motion.div>
|
itemName={item.Name ?? "Unknown"}
|
||||||
|
itemYear={
|
||||||
|
item.Type === BaseItemKind.Series && item.EndDate
|
||||||
|
? `${item.ProductionYear ?? ""} - ${new Date(item.EndDate).getFullYear().toString()}`
|
||||||
|
: (item.ProductionYear?.toString() ?? "")
|
||||||
|
}
|
||||||
|
onTickerClick={handleTickerClick}
|
||||||
|
index={index}
|
||||||
|
itemType={item.Type as BaseItemKind}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
))}
|
))}
|
||||||
/>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Carousel;
|
export default React.memo(Carousel);
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
import type { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import { Typography } from "@mui/material";
|
||||||
|
import React from "react";
|
||||||
|
import { getTypeIcon } from "../utils/iconsCollection";
|
||||||
|
|
||||||
|
type CarouselTickersProps = {
|
||||||
|
imageUrl?: string | undefined | null;
|
||||||
|
itemName: string;
|
||||||
|
itemYear: string;
|
||||||
|
onTickerClick: (index: number) => void;
|
||||||
|
index: number;
|
||||||
|
isActive: boolean;
|
||||||
|
itemType: BaseItemKind;
|
||||||
|
};
|
||||||
|
|
||||||
|
const CarouselTickers = React.memo(
|
||||||
|
({
|
||||||
|
imageUrl,
|
||||||
|
itemName,
|
||||||
|
itemYear,
|
||||||
|
onTickerClick,
|
||||||
|
index,
|
||||||
|
isActive,
|
||||||
|
itemType,
|
||||||
|
}: CarouselTickersProps) => {
|
||||||
|
const handleClick = React.useCallback(() => {
|
||||||
|
onTickerClick(index);
|
||||||
|
}, [index, onTickerClick]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={`carousel-ticker${isActive ? " active" : ""}`}
|
||||||
|
onClick={handleClick}
|
||||||
|
>
|
||||||
|
{imageUrl ? (
|
||||||
|
<img
|
||||||
|
src={imageUrl}
|
||||||
|
alt={itemName}
|
||||||
|
className="carousel-ticker-image"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<div className="carousel-ticker-image placeholder material-symbols-rounded">
|
||||||
|
{" "}
|
||||||
|
{getTypeIcon(itemType)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div>
|
||||||
|
<Typography variant="subtitle1" className="carousel-ticker-title">
|
||||||
|
{itemName}
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="caption" className="carousel-ticker-year">
|
||||||
|
{itemYear}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
export default CarouselTickers;
|
||||||
@@ -1,203 +1,176 @@
|
|||||||
import React, { memo } from "react";
|
|
||||||
import { Blurhash } from "react-blurhash";
|
|
||||||
|
|
||||||
import { motion } from "framer-motion";
|
|
||||||
|
|
||||||
import Button from "@mui/material/Button";
|
|
||||||
import Chip from "@mui/material/Chip";
|
|
||||||
import Paper from "@mui/material/Paper";
|
|
||||||
import Stack from "@mui/material/Stack";
|
|
||||||
import Typography from "@mui/material/Typography";
|
|
||||||
|
|
||||||
import { yellow } from "@mui/material/colors";
|
|
||||||
|
|
||||||
import { endsAt, getRuntime } from "@/utils/date/time";
|
|
||||||
import { green, red } from "@mui/material/colors";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
|
||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
|
||||||
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
|
||||||
import { useCarouselStore } from "@/utils/store/carousel";
|
|
||||||
import {
|
import {
|
||||||
type BaseItemDto,
|
type BaseItemDto,
|
||||||
BaseItemKind,
|
BaseItemKind,
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import Button from "@mui/material/Button";
|
||||||
|
import Chip from "@mui/material/Chip";
|
||||||
|
import { green, red, yellow } from "@mui/material/colors";
|
||||||
|
import Stack from "@mui/material/Stack";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
|
import { motion } from "motion/react";
|
||||||
|
import React from "react";
|
||||||
|
import { endsAt, getRuntime } from "@/utils/date/time";
|
||||||
|
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { useCarouselStore } from "@/utils/store/carousel";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import LikeButton from "../buttons/likeButton";
|
import LikeButton from "../buttons/likeButton";
|
||||||
import MarkPlayedButton from "../buttons/markPlayedButton";
|
import MarkPlayedButton from "../buttons/markPlayedButton";
|
||||||
import PlayButton from "../buttons/playButton";
|
import PlayButton from "../buttons/playButton";
|
||||||
|
import { getTypeIcon } from "../utils/iconsCollection";
|
||||||
|
|
||||||
const availableSpecialRoutes = [
|
const textVariants = {
|
||||||
BaseItemKind.Series,
|
initial: (direction: string) => ({
|
||||||
BaseItemKind.BoxSet,
|
x: direction === "right" ? 40 : -40,
|
||||||
BaseItemKind.MusicAlbum,
|
opacity: 0,
|
||||||
];
|
}),
|
||||||
|
animate: {
|
||||||
|
x: 0,
|
||||||
|
opacity: 1,
|
||||||
|
transition: {
|
||||||
|
duration: 0.35,
|
||||||
|
ease: [0.2, 0, 0, 1],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
exit: (direction: string) => ({
|
||||||
|
x: direction === "right" ? -40 : 40,
|
||||||
|
opacity: 0,
|
||||||
|
transition: {
|
||||||
|
duration: 0.2,
|
||||||
|
ease: "easeInOut",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} Props
|
|
||||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemDto} item
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Carousel slide component
|
|
||||||
* @param {Props}
|
|
||||||
* @returns {React.Component}
|
|
||||||
*/
|
|
||||||
const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleMoreInfo = () => {
|
const handleMoreInfo = () => {
|
||||||
switch (item.Type) {
|
if (item.Id) {
|
||||||
case BaseItemKind.BoxSet:
|
switch (item.Type) {
|
||||||
navigate({ to: "/boxset/$id", params: { id: item.Id } });
|
case BaseItemKind.BoxSet:
|
||||||
break;
|
navigate({ to: "/boxset/$id", params: { id: item.Id } });
|
||||||
case BaseItemKind.Episode:
|
break;
|
||||||
navigate({ to: "/episode/$id", params: { id: item.Id } });
|
case BaseItemKind.Episode:
|
||||||
break;
|
navigate({ to: "/episode/$id", params: { id: item.Id } });
|
||||||
case BaseItemKind.MusicAlbum:
|
break;
|
||||||
navigate({ to: "/album/$id", params: { id: item.Id } });
|
case BaseItemKind.MusicAlbum:
|
||||||
break;
|
navigate({ to: "/album/$id", params: { id: item.Id } });
|
||||||
case BaseItemKind.MusicArtist:
|
break;
|
||||||
navigate({ to: "/artist/$id", params: { id: item.Id } });
|
case BaseItemKind.MusicArtist:
|
||||||
break;
|
navigate({ to: "/artist/$id", params: { id: item.Id } });
|
||||||
case BaseItemKind.Person:
|
break;
|
||||||
navigate({ to: "/person/$id", params: { id: item.Id } });
|
case BaseItemKind.Person:
|
||||||
break;
|
navigate({ to: "/person/$id", params: { id: item.Id } });
|
||||||
case BaseItemKind.Series:
|
break;
|
||||||
navigate({ to: "/series/$id", params: { id: item.Id } });
|
case BaseItemKind.Series:
|
||||||
break;
|
navigate({ to: "/series/$id", params: { id: item.Id } });
|
||||||
case BaseItemKind.Playlist:
|
break;
|
||||||
navigate({ to: "/playlist/$id", params: { id: item.Id } });
|
case BaseItemKind.Playlist:
|
||||||
break;
|
navigate({ to: "/playlist/$id", params: { id: item.Id } });
|
||||||
default:
|
break;
|
||||||
navigate({ to: "/item/$id", params: { id: item.Id } });
|
default:
|
||||||
break;
|
navigate({ to: "/item/$id", params: { id: item.Id } });
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const [animationDirection] = useCarouselStore((state) => [state.direction]);
|
const [animationDirection] = useCarouselStore((state) => [state.direction]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper
|
<div className="hero-carousel-slide">
|
||||||
className="hero-carousel-slide"
|
<motion.div
|
||||||
sx={{
|
className="hero-carousel-background-container"
|
||||||
background: "transparent",
|
initial={{ opacity: 0 }}
|
||||||
// px: 3,
|
animate={{ opacity: 1 }}
|
||||||
}}
|
exit={{ opacity: 0 }}
|
||||||
elevation={0}
|
transition={{ duration: 0.4, ease: "easeInOut" }}
|
||||||
>
|
>
|
||||||
<div className="hero-carousel-background-container">
|
|
||||||
{item.BackdropImageTags?.length ? (
|
{item.BackdropImageTags?.length ? (
|
||||||
<img
|
<img
|
||||||
alt={item.Name}
|
alt={item.Name ?? "item"}
|
||||||
className="hero-carousel-background-image"
|
className="hero-carousel-background-image"
|
||||||
src={
|
src={
|
||||||
item.ParentBackdropItemId
|
item.ParentBackdropItemId
|
||||||
? `${api.basePath}/Items/${item.ParentBackdropItemId}/Images/Backdrop?quality=80`
|
? `${api?.basePath}/Items/${item.ParentBackdropItemId}/Images/Backdrop?quality=80`
|
||||||
: `${api.basePath}/Items/${item.Id}/Images/Backdrop?quality=80&fillHeight=1400`
|
: `${api?.basePath}/Items/${item.Id}/Images/Backdrop?quality=80&fillHeight=1400`
|
||||||
}
|
}
|
||||||
style={{
|
style={{
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
}}
|
}}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.target.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
loading="eager"
|
loading="eager"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="hero-carousel-background-icon-container">
|
<div className="hero-carousel-background-icon-container">
|
||||||
{getTypeIcon(item.Type)}
|
{getTypeIcon(item.Type ?? "Movie")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</motion.div>
|
||||||
<div className="hero-carousel-detail">
|
<motion.div
|
||||||
|
className="hero-carousel-detail"
|
||||||
|
initial="initial"
|
||||||
|
animate="animate"
|
||||||
|
exit="exit"
|
||||||
|
variants={{
|
||||||
|
animate: {
|
||||||
|
transition: {
|
||||||
|
staggerChildren: 0.05,
|
||||||
|
delayChildren: 0.05,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
exit: {
|
||||||
|
transition: {
|
||||||
|
staggerChildren: 0.02,
|
||||||
|
staggerDirection: -1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{/* @ts-ignore */}
|
||||||
<Typography
|
<Typography
|
||||||
component={motion.div}
|
component={motion.div}
|
||||||
initial={{
|
custom={animationDirection}
|
||||||
transform:
|
variants={textVariants}
|
||||||
animationDirection === "right"
|
|
||||||
? "translateX(60px)"
|
|
||||||
: "translateX(-60px)",
|
|
||||||
opacity: 0,
|
|
||||||
}}
|
|
||||||
animate={{
|
|
||||||
transform: "translateX(0px)",
|
|
||||||
opacity: 1,
|
|
||||||
}}
|
|
||||||
exit={{
|
|
||||||
transform:
|
|
||||||
animationDirection === "right"
|
|
||||||
? "translateX(-60px)"
|
|
||||||
: "translateX(60px)",
|
|
||||||
opacity: 0,
|
|
||||||
}}
|
|
||||||
transition={{
|
|
||||||
duration: 0.25,
|
|
||||||
ease: "easeInOut",
|
|
||||||
}}
|
|
||||||
key={item.Id}
|
key={item.Id}
|
||||||
variant="h2"
|
variant="h2"
|
||||||
className="hero-carousel-text"
|
className="hero-carousel-text"
|
||||||
sx={{
|
sx={{
|
||||||
mb: "5px",
|
mb: "5px",
|
||||||
}}
|
}}
|
||||||
fontWeight={200}
|
fontWeight={600}
|
||||||
overflow="visible"
|
overflow="visible"
|
||||||
>
|
>
|
||||||
{!item.ImageTags.Logo ? (
|
{!item.ImageTags?.Logo ? (
|
||||||
item.Name
|
item.Name
|
||||||
) : (
|
) : (
|
||||||
<img
|
<img
|
||||||
alt={item.Name}
|
alt={item.Name ?? "Item"}
|
||||||
className="hero-carousel-text-logo"
|
className="hero-carousel-text-logo"
|
||||||
src={`${api.basePath}/Items/${item.Id}/Images/Logo?quality=90&tag=${item.ImageTags.Logo}`}
|
src={`${api?.basePath}/Items/${item.Id}/Images/Logo?quality=90&tag=${item.ImageTags.Logo}`}
|
||||||
style={{
|
style={{
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
transition: "opacity 0.2s",
|
transition: "opacity 0.2s",
|
||||||
objectFit: "contain",
|
objectFit: "contain",
|
||||||
}}
|
}}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.target.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
{/* @ts-ignore */}
|
||||||
<Stack
|
<Stack
|
||||||
component={motion.div}
|
component={motion.div}
|
||||||
initial={{
|
custom={animationDirection}
|
||||||
transform:
|
variants={textVariants}
|
||||||
animationDirection === "right"
|
|
||||||
? "translateX(20px)"
|
|
||||||
: "translateX(-20px)",
|
|
||||||
opacity: 0,
|
|
||||||
}}
|
|
||||||
animate={{
|
|
||||||
transform: "translateX(0px)",
|
|
||||||
opacity: 1,
|
|
||||||
}}
|
|
||||||
exit={{
|
|
||||||
transform:
|
|
||||||
animationDirection === "right"
|
|
||||||
? "translateX(-20px)"
|
|
||||||
: "translateX(20px)",
|
|
||||||
|
|
||||||
opacity: 0,
|
|
||||||
}}
|
|
||||||
transition={{
|
|
||||||
duration: 0.25,
|
|
||||||
ease: "easeInOut",
|
|
||||||
}}
|
|
||||||
direction="row"
|
direction="row"
|
||||||
gap={2}
|
gap={2}
|
||||||
className="hero-carousel-info"
|
className="hero-carousel-info"
|
||||||
@@ -277,74 +250,45 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
)}
|
)}
|
||||||
{item.RunTimeTicks && (
|
{item.RunTimeTicks && (
|
||||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||||
{endsAt(item.RunTimeTicks - item.UserData.PlaybackPositionTicks)}
|
{endsAt(
|
||||||
|
item.RunTimeTicks - (item.UserData?.PlaybackPositionTicks ?? 0),
|
||||||
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
<Typography variant="subtitle2" style={{ opacity: 0.8 }}>
|
<Typography variant="subtitle2" style={{ opacity: 0.8 }}>
|
||||||
{item.Genres?.slice(0, 4).join(" / ")}
|
{item.Genres?.slice(0, 4).join(" / ")}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
{/* @ts-ignore */}
|
||||||
<Typography
|
<Typography
|
||||||
component={motion.div}
|
component={motion.div}
|
||||||
initial={{
|
custom={animationDirection}
|
||||||
transform:
|
variants={textVariants}
|
||||||
animationDirection === "right"
|
className="hero-carousel-overview"
|
||||||
? "translateX(20px)"
|
variant="body1"
|
||||||
: "translateX(-20px)",
|
fontWeight={400}
|
||||||
opacity: 0,
|
|
||||||
}}
|
|
||||||
animate={{
|
|
||||||
transform: "translateX(0px)",
|
|
||||||
opacity: 1,
|
|
||||||
}}
|
|
||||||
exit={{
|
|
||||||
transform:
|
|
||||||
animationDirection === "right"
|
|
||||||
? "translateX(-20px)"
|
|
||||||
: "translateX(20px)",
|
|
||||||
|
|
||||||
opacity: 0,
|
|
||||||
}}
|
|
||||||
transition={{
|
|
||||||
duration: 0.25,
|
|
||||||
ease: "easeInOut",
|
|
||||||
}}
|
|
||||||
className="hero-carousel-text"
|
|
||||||
sx={{
|
|
||||||
display: "-webkit-box",
|
|
||||||
maxWidth: "70%",
|
|
||||||
maxHeight: "50%",
|
|
||||||
textOverflow: "ellipsis",
|
|
||||||
overflow: "hidden",
|
|
||||||
WebkitLineClamp: "4",
|
|
||||||
WebkitBoxOrient: "vertical",
|
|
||||||
}}
|
|
||||||
variant="subtitle2"
|
|
||||||
fontWeight={300}
|
|
||||||
>
|
>
|
||||||
{item.Overview}
|
{item.Overview}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
|
{/* @ts-ignore */}
|
||||||
<Stack
|
<Stack
|
||||||
mt={3}
|
|
||||||
direction="row"
|
direction="row"
|
||||||
gap={3}
|
gap={2}
|
||||||
width="100%"
|
width="100%"
|
||||||
className="hero-carousel-button-container"
|
className="hero-carousel-button-container"
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
|
component={motion.div}
|
||||||
|
custom={animationDirection}
|
||||||
|
variants={textVariants}
|
||||||
>
|
>
|
||||||
<PlayButton
|
<PlayButton
|
||||||
item={item}
|
item={item}
|
||||||
itemId={item.Id}
|
userId={user?.Id}
|
||||||
userId={user.data.Id}
|
itemType={item.Type ?? "Movie"}
|
||||||
itemType={item.Type}
|
|
||||||
currentAudioTrack={0}
|
|
||||||
currentSubTrack={0}
|
|
||||||
currentVideoTrack={0}
|
|
||||||
buttonProps={{
|
buttonProps={{
|
||||||
size: "large",
|
size: "large",
|
||||||
}}
|
}}
|
||||||
itemUserData={item.UserData}
|
|
||||||
audio={
|
audio={
|
||||||
item.Type === BaseItemKind.MusicAlbum ||
|
item.Type === BaseItemKind.MusicAlbum ||
|
||||||
item.Type === BaseItemKind.Audio ||
|
item.Type === BaseItemKind.Audio ||
|
||||||
@@ -357,6 +301,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
size="large"
|
size="large"
|
||||||
|
//@ts-expect-error
|
||||||
color="white"
|
color="white"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
endIcon={
|
endIcon={
|
||||||
@@ -377,21 +322,21 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
<LikeButton
|
<LikeButton
|
||||||
itemId={item.Id}
|
itemId={item.Id}
|
||||||
queryKey={["home", "latestMedia"]}
|
queryKey={["home", "latestMedia"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
isFavorite={item.UserData.IsFavorite}
|
isFavorite={item.UserData?.IsFavorite}
|
||||||
itemName={item.Name}
|
itemName={item.Name}
|
||||||
/>
|
/>
|
||||||
<MarkPlayedButton
|
<MarkPlayedButton
|
||||||
itemId={item.Id}
|
itemId={item.Id}
|
||||||
queryKey={["home", "latestMedia"]}
|
queryKey={["home", "latestMedia"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
isPlayed={item.UserData.Played}
|
isPlayed={item.UserData?.Played}
|
||||||
itemName={item.Name}
|
itemName={item.Name}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</div>
|
</motion.div>
|
||||||
</Paper>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
// Write a react component that included an MUI circluar progress element utilizing NProgrss
|
||||||
|
|
||||||
|
import { CircularProgress } from "@mui/material";
|
||||||
|
import { useNProgress } from "@tanem/react-nprogress";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
const CircularPageLoadingAnimation = () => {
|
||||||
|
const { progress } = useNProgress({
|
||||||
|
isAnimating: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
pointerEvents: "none",
|
||||||
|
position: "absolute",
|
||||||
|
top: "50%",
|
||||||
|
left: "50%",
|
||||||
|
transform: "translate(-50%, -50%)",
|
||||||
|
zIndex: "10001",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CircularProgress
|
||||||
|
// variant="indeterminate"
|
||||||
|
sx={{
|
||||||
|
transitionDuration: "0.3s",
|
||||||
|
transform: `scale(${progress})`,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default CircularPageLoadingAnimation;
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
class ErrorBoundary extends React.Component {
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
this.state = { hasError: false };
|
|
||||||
}
|
|
||||||
|
|
||||||
static getDerivedStateFromError(error) {
|
|
||||||
// Update state so the next render will show the fallback UI.
|
|
||||||
return { hasError: true };
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidCatch(error, info) {
|
|
||||||
// Example "componentStack":
|
|
||||||
// in ComponentThatThrows (created by App)
|
|
||||||
// in ErrorBoundary (created by App)
|
|
||||||
// in div (created by App)
|
|
||||||
// in App
|
|
||||||
this.setState;
|
|
||||||
console.error(`Err in ${info} - ${error}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
if (this.state.hasError) {
|
|
||||||
// You can render any custom fallback UI
|
|
||||||
return this.props.fallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.props.children;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export default ErrorBoundary;
|
|
||||||
@@ -0,0 +1,527 @@
|
|||||||
|
import { getGenresApi } from "@jellyfin/sdk/lib/utils/api/genres-api";
|
||||||
|
import { getMusicGenresApi } from "@jellyfin/sdk/lib/utils/api/music-genres-api";
|
||||||
|
import {
|
||||||
|
Accordion,
|
||||||
|
AccordionDetails,
|
||||||
|
AccordionSummary,
|
||||||
|
Button,
|
||||||
|
Checkbox,
|
||||||
|
Dialog,
|
||||||
|
DialogActions,
|
||||||
|
DialogContent,
|
||||||
|
DialogTitle,
|
||||||
|
FormControlLabel,
|
||||||
|
FormGroup,
|
||||||
|
IconButton,
|
||||||
|
Stack,
|
||||||
|
Tooltip,
|
||||||
|
Typography,
|
||||||
|
} from "@mui/material";
|
||||||
|
import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
||||||
|
import { getRouteApi } from "@tanstack/react-router";
|
||||||
|
import React, { useMemo, useRef, useState } from "react";
|
||||||
|
import { useShallow } from "zustand/shallow";
|
||||||
|
import type { FILTERS } from "@/utils/constants/library";
|
||||||
|
import { getLibraryQueryOptions } from "@/utils/queries/library";
|
||||||
|
import { useLibraryStateStore } from "@/utils/store/libraryState";
|
||||||
|
|
||||||
|
const route = getRouteApi("/_api/library/$id");
|
||||||
|
|
||||||
|
const FILTER_LABELS: Record<FILTERS, string> = {
|
||||||
|
isPlayed: "Played",
|
||||||
|
isUnPlayed: "Unplayed",
|
||||||
|
isResumable: "Resumable",
|
||||||
|
isFavorite: "Favorite",
|
||||||
|
hasSubtitles: "Has Subtitles",
|
||||||
|
hasTrailer: "Has Trailer",
|
||||||
|
hasSpecialFeature: "Special Feature",
|
||||||
|
hasThemeSong: "Theme Song",
|
||||||
|
hasThemeVideo: "Theme Video",
|
||||||
|
isSD: "SD",
|
||||||
|
isHD: "HD",
|
||||||
|
is4K: "4K",
|
||||||
|
is3D: "3D",
|
||||||
|
};
|
||||||
|
|
||||||
|
interface FiltersDialogProps {
|
||||||
|
open: boolean;
|
||||||
|
onClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
|
||||||
|
({ open, onClose }) => {
|
||||||
|
const { id: currentLibraryId } = route.useParams();
|
||||||
|
const { api, user } = route.useRouteContext();
|
||||||
|
const { routeFilters, routeVideoTypes, routeGenreIds } =
|
||||||
|
useLibraryStateStore(
|
||||||
|
useShallow((s) => {
|
||||||
|
const slice = s.libraries[currentLibraryId || ""];
|
||||||
|
return {
|
||||||
|
routeFilters: slice?.filters,
|
||||||
|
routeVideoTypes: slice?.videoTypesState,
|
||||||
|
routeGenreIds: slice?.genreIds,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
const updateLibrary = useLibraryStateStore((s) => s.updateLibrary);
|
||||||
|
const initial = useMemo(
|
||||||
|
() => ({ ...(routeFilters || {}) }),
|
||||||
|
[routeFilters],
|
||||||
|
);
|
||||||
|
const [localFilters, setLocalFilters] =
|
||||||
|
useState<Record<string, boolean | undefined>>(initial);
|
||||||
|
const initialVideo = useMemo(
|
||||||
|
() => ({ ...(routeVideoTypes || {}) }),
|
||||||
|
[routeVideoTypes],
|
||||||
|
);
|
||||||
|
const [localVideoTypes, setLocalVideoTypes] =
|
||||||
|
useState<Record<string, boolean>>(initialVideo);
|
||||||
|
const initialGenres = useMemo(
|
||||||
|
() => [...(routeGenreIds || [])] as string[],
|
||||||
|
[routeGenreIds],
|
||||||
|
);
|
||||||
|
const [localGenreIds, setLocalGenreIds] = useState<string[]>(initialGenres);
|
||||||
|
const dirty = useMemo(
|
||||||
|
() =>
|
||||||
|
JSON.stringify(initial) !== JSON.stringify(localFilters) ||
|
||||||
|
JSON.stringify(initialVideo) !== JSON.stringify(localVideoTypes) ||
|
||||||
|
JSON.stringify(initialGenres) !== JSON.stringify(localGenreIds),
|
||||||
|
[
|
||||||
|
initial,
|
||||||
|
localFilters,
|
||||||
|
initialVideo,
|
||||||
|
localVideoTypes,
|
||||||
|
initialGenres,
|
||||||
|
localGenreIds,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
const debounceRef = useRef<number | null>(null);
|
||||||
|
const currentLibrary = useSuspenseQuery(
|
||||||
|
getLibraryQueryOptions(api, user?.Id, currentLibraryId),
|
||||||
|
);
|
||||||
|
const collectionType = currentLibrary.data.CollectionType;
|
||||||
|
const isVideoCollection = ["movies", "tvshows", "boxsets"].includes(
|
||||||
|
String(collectionType || "").toLowerCase(),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Fetch genres for this library (music uses music-genres API)
|
||||||
|
const { data: genresData } = useQuery({
|
||||||
|
queryKey: ["library", "genres", currentLibraryId, collectionType],
|
||||||
|
queryFn: async () => {
|
||||||
|
if (!api || !user?.Id || !currentLibraryId) return { Items: [] } as any;
|
||||||
|
if (String(collectionType || "").toLowerCase() === "music") {
|
||||||
|
const res = await getMusicGenresApi(api).getMusicGenres({
|
||||||
|
parentId: currentLibraryId,
|
||||||
|
userId: user.Id,
|
||||||
|
});
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
const res = await getGenresApi(api).getGenres({
|
||||||
|
parentId: currentLibraryId,
|
||||||
|
userId: user.Id,
|
||||||
|
});
|
||||||
|
return res.data;
|
||||||
|
},
|
||||||
|
staleTime: 10 * 60 * 1000,
|
||||||
|
enabled: !!open && !!api && !!user?.Id && !!currentLibraryId,
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleToggle = (key: FILTERS) => {
|
||||||
|
setLocalFilters((prev) => {
|
||||||
|
const next = { ...prev };
|
||||||
|
// isHD special: undefined if unchecked instead of false
|
||||||
|
if (key === "isHD") {
|
||||||
|
if (next[key]) delete next[key];
|
||||||
|
else next[key] = true;
|
||||||
|
} else {
|
||||||
|
next[key] = !next[key];
|
||||||
|
}
|
||||||
|
return next;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const apply = () => {
|
||||||
|
if (!currentLibraryId) return;
|
||||||
|
if (debounceRef.current) window.clearTimeout(debounceRef.current);
|
||||||
|
debounceRef.current = window.setTimeout(() => {
|
||||||
|
updateLibrary(currentLibraryId, {
|
||||||
|
filters: localFilters as any,
|
||||||
|
videoTypesState: localVideoTypes as any,
|
||||||
|
genreIds: localGenreIds as any,
|
||||||
|
});
|
||||||
|
onClose();
|
||||||
|
}, 40);
|
||||||
|
};
|
||||||
|
|
||||||
|
const clearAll = () => {
|
||||||
|
setLocalFilters({});
|
||||||
|
setLocalVideoTypes({});
|
||||||
|
setLocalGenreIds([]);
|
||||||
|
};
|
||||||
|
|
||||||
|
const restore = () => setLocalFilters(initial);
|
||||||
|
const restoreVideo = () => setLocalVideoTypes(initialVideo);
|
||||||
|
const restoreGenres = () => setLocalGenreIds(initialGenres);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog
|
||||||
|
open={open}
|
||||||
|
onClose={onClose}
|
||||||
|
fullWidth
|
||||||
|
maxWidth="sm"
|
||||||
|
keepMounted
|
||||||
|
PaperProps={{ className: "glass-dialog-paper" }}
|
||||||
|
>
|
||||||
|
<DialogTitle>Filters</DialogTitle>
|
||||||
|
<DialogContent
|
||||||
|
dividers
|
||||||
|
sx={{ borderColor: "rgba(255, 255, 255, 0.1)" }}
|
||||||
|
>
|
||||||
|
<Stack spacing={1.25}>
|
||||||
|
<Accordion
|
||||||
|
disableGutters
|
||||||
|
sx={{
|
||||||
|
backgroundColor: "transparent",
|
||||||
|
boxShadow: "none",
|
||||||
|
m: 0,
|
||||||
|
"&:before": { display: "none" },
|
||||||
|
"&:not(:last-of-type)": {
|
||||||
|
borderBottom: "1px solid rgba(255,255,255,0.12)",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<AccordionSummary
|
||||||
|
sx={{
|
||||||
|
minHeight: 40,
|
||||||
|
"& .MuiAccordionSummary-content": { my: 0 },
|
||||||
|
}}
|
||||||
|
expandIcon={
|
||||||
|
<span className="material-symbols-rounded">expand_more</span>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Typography variant="subtitle2">General</Typography>
|
||||||
|
</AccordionSummary>
|
||||||
|
<AccordionDetails sx={{ px: 1.5, py: 1.25 }}>
|
||||||
|
<FormGroup>
|
||||||
|
{(
|
||||||
|
[
|
||||||
|
"isPlayed",
|
||||||
|
"isUnPlayed",
|
||||||
|
"isResumable",
|
||||||
|
"isFavorite",
|
||||||
|
] as FILTERS[]
|
||||||
|
).map((k) => (
|
||||||
|
<FormControlLabel
|
||||||
|
key={k}
|
||||||
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={!!localFilters[k]}
|
||||||
|
onChange={() => handleToggle(k)}
|
||||||
|
size="small"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={FILTER_LABELS[k]}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</FormGroup>
|
||||||
|
</AccordionDetails>
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
{isVideoCollection && (
|
||||||
|
<Accordion
|
||||||
|
disableGutters
|
||||||
|
sx={{
|
||||||
|
backgroundColor: "transparent",
|
||||||
|
boxShadow: "none",
|
||||||
|
m: 0,
|
||||||
|
"&:before": { display: "none" },
|
||||||
|
"&:not(:last-of-type)": {
|
||||||
|
borderBottom: "1px solid rgba(255,255,255,0.12)",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<AccordionSummary
|
||||||
|
sx={{
|
||||||
|
minHeight: 40,
|
||||||
|
"& .MuiAccordionSummary-content": { my: 0 },
|
||||||
|
}}
|
||||||
|
expandIcon={
|
||||||
|
<span className="material-symbols-rounded">
|
||||||
|
expand_more
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Typography variant="subtitle2">Video features</Typography>
|
||||||
|
</AccordionSummary>
|
||||||
|
<AccordionDetails sx={{ px: 1.5, py: 1.25 }}>
|
||||||
|
<FormGroup>
|
||||||
|
{(
|
||||||
|
[
|
||||||
|
"hasSubtitles",
|
||||||
|
"hasTrailer",
|
||||||
|
"hasSpecialFeature",
|
||||||
|
"hasThemeSong",
|
||||||
|
"hasThemeVideo",
|
||||||
|
] as FILTERS[]
|
||||||
|
).map((k) => (
|
||||||
|
<FormControlLabel
|
||||||
|
key={k}
|
||||||
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={!!localFilters[k]}
|
||||||
|
onChange={() => handleToggle(k)}
|
||||||
|
size="small"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={FILTER_LABELS[k]}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</FormGroup>
|
||||||
|
</AccordionDetails>
|
||||||
|
</Accordion>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{isVideoCollection && (
|
||||||
|
<Accordion
|
||||||
|
disableGutters
|
||||||
|
sx={{
|
||||||
|
backgroundColor: "transparent",
|
||||||
|
boxShadow: "none",
|
||||||
|
m: 0,
|
||||||
|
"&:before": { display: "none" },
|
||||||
|
"&:not(:last-of-type)": {
|
||||||
|
borderBottom: "1px solid rgba(255,255,255,0.12)",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<AccordionSummary
|
||||||
|
sx={{
|
||||||
|
minHeight: 40,
|
||||||
|
"& .MuiAccordionSummary-content": { my: 0 },
|
||||||
|
}}
|
||||||
|
expandIcon={
|
||||||
|
<span className="material-symbols-rounded">
|
||||||
|
expand_more
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Typography variant="subtitle2">Resolution</Typography>
|
||||||
|
</AccordionSummary>
|
||||||
|
<AccordionDetails sx={{ px: 1.5, py: 1.25 }}>
|
||||||
|
<FormGroup>
|
||||||
|
{(["isSD", "isHD", "is4K", "is3D"] as FILTERS[]).map(
|
||||||
|
(k) => (
|
||||||
|
<FormControlLabel
|
||||||
|
key={k}
|
||||||
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={!!localFilters[k]}
|
||||||
|
onChange={() => handleToggle(k)}
|
||||||
|
size="small"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={FILTER_LABELS[k]}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
)}
|
||||||
|
</FormGroup>
|
||||||
|
</AccordionDetails>
|
||||||
|
</Accordion>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{isVideoCollection && (
|
||||||
|
<Accordion
|
||||||
|
disableGutters
|
||||||
|
sx={{
|
||||||
|
backgroundColor: "transparent",
|
||||||
|
boxShadow: "none",
|
||||||
|
m: 0,
|
||||||
|
"&:before": { display: "none" },
|
||||||
|
"&:not(:last-of-type)": {
|
||||||
|
borderBottom: "1px solid rgba(255,255,255,0.12)",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<AccordionSummary
|
||||||
|
sx={{
|
||||||
|
minHeight: 40,
|
||||||
|
"& .MuiAccordionSummary-content": { my: 0 },
|
||||||
|
}}
|
||||||
|
expandIcon={
|
||||||
|
<span className="material-symbols-rounded">
|
||||||
|
expand_more
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Typography variant="subtitle2">Media type</Typography>
|
||||||
|
</AccordionSummary>
|
||||||
|
<AccordionDetails sx={{ px: 1.5, py: 1.25 }}>
|
||||||
|
<FormGroup>
|
||||||
|
{(["BluRay", "Dvd", "Iso", "VideoFile"] as const).map(
|
||||||
|
(k) => (
|
||||||
|
<FormControlLabel
|
||||||
|
key={k}
|
||||||
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={!!(localVideoTypes as any)[k]}
|
||||||
|
onChange={() =>
|
||||||
|
setLocalVideoTypes((prev) => ({
|
||||||
|
...(prev || {}),
|
||||||
|
[k]: !(prev as any)?.[k],
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
size="small"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={k}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
)}
|
||||||
|
</FormGroup>
|
||||||
|
</AccordionDetails>
|
||||||
|
</Accordion>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Genres (all collection types) */}
|
||||||
|
{(genresData?.Items?.length || 0) > 0 && (
|
||||||
|
<Accordion
|
||||||
|
disableGutters
|
||||||
|
sx={{
|
||||||
|
backgroundColor: "transparent",
|
||||||
|
boxShadow: "none",
|
||||||
|
m: 0,
|
||||||
|
"&:before": { display: "none" },
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<AccordionSummary
|
||||||
|
sx={{
|
||||||
|
minHeight: 40,
|
||||||
|
"& .MuiAccordionSummary-content": { my: 0 },
|
||||||
|
}}
|
||||||
|
expandIcon={
|
||||||
|
<span className="material-symbols-rounded">
|
||||||
|
expand_more
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Typography variant="subtitle2">Genres</Typography>
|
||||||
|
</AccordionSummary>
|
||||||
|
<AccordionDetails sx={{ px: 1.5, py: 1.25 }}>
|
||||||
|
<FormGroup>
|
||||||
|
{(genresData?.Items || []).map((g: any) => (
|
||||||
|
<FormControlLabel
|
||||||
|
key={g.Id}
|
||||||
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={localGenreIds.includes(g.Id)}
|
||||||
|
onChange={() =>
|
||||||
|
setLocalGenreIds((prev) =>
|
||||||
|
prev.includes(g.Id)
|
||||||
|
? prev.filter((id) => id !== g.Id)
|
||||||
|
: [...prev, g.Id],
|
||||||
|
)
|
||||||
|
}
|
||||||
|
size="small"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={g.Name}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</FormGroup>
|
||||||
|
</AccordionDetails>
|
||||||
|
</Accordion>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<Button
|
||||||
|
onClick={clearAll}
|
||||||
|
color="inherit"
|
||||||
|
disabled={Object.keys(localFilters).length === 0}
|
||||||
|
>
|
||||||
|
Clear
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
restore();
|
||||||
|
restoreVideo();
|
||||||
|
restoreGenres();
|
||||||
|
}}
|
||||||
|
color="inherit"
|
||||||
|
disabled={!dirty}
|
||||||
|
>
|
||||||
|
Reset
|
||||||
|
</Button>
|
||||||
|
<Button onClick={onClose}>Cancel</Button>
|
||||||
|
<Button onClick={apply} disabled={!dirty} variant="contained">
|
||||||
|
Apply
|
||||||
|
</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
(FiltersDialog as any).displayName = "FiltersDialog";
|
||||||
|
|
||||||
|
export const FiltersDialogTrigger: React.FC = () => {
|
||||||
|
const [open, setOpen] = React.useState(false);
|
||||||
|
const { id: currentLibraryId } = route.useParams();
|
||||||
|
const { filters, videoTypesState, genreIds } = useLibraryStateStore(
|
||||||
|
useShallow((s) => {
|
||||||
|
const slice = s.libraries[currentLibraryId || ""];
|
||||||
|
return {
|
||||||
|
filters: slice?.filters,
|
||||||
|
videoTypesState: slice?.videoTypesState,
|
||||||
|
genreIds: slice?.genreIds,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
const activeCount = useMemo(() => {
|
||||||
|
const a = Object.values(filters || {}).filter((v) => v === true).length;
|
||||||
|
const b = Object.values(videoTypesState || {}).filter(
|
||||||
|
(v) => v === true,
|
||||||
|
).length;
|
||||||
|
const c = (genreIds || []).length;
|
||||||
|
return a + b + c;
|
||||||
|
}, [filters, videoTypesState, genreIds]);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Tooltip
|
||||||
|
title={activeCount ? `${activeCount} active filters` : "Filters"}
|
||||||
|
>
|
||||||
|
<IconButton
|
||||||
|
onClick={() => setOpen(true)}
|
||||||
|
aria-label="Open filters dialog"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className="material-symbols-rounded"
|
||||||
|
style={{ position: "relative" }}
|
||||||
|
>
|
||||||
|
filter_list
|
||||||
|
{activeCount > 0 && (
|
||||||
|
<span
|
||||||
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
top: -2,
|
||||||
|
right: -4,
|
||||||
|
background: "#ff4081",
|
||||||
|
color: "#fff",
|
||||||
|
fontSize: 10,
|
||||||
|
borderRadius: 8,
|
||||||
|
lineHeight: 1,
|
||||||
|
padding: "2px 4px",
|
||||||
|
fontFamily: "Plus Jakarta Sans Variable",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{activeCount}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
<FiltersDialog open={open} onClose={() => setOpen(false)} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default FiltersDialog;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Link, Typography } from "@mui/material";
|
import { Link, Typography } from "@mui/material";
|
||||||
import React from "react";
|
import React, { memo } from "react";
|
||||||
|
|
||||||
import anidbIcon from "../../assets/icons/anidb.png";
|
import anidbIcon from "../../assets/icons/anidb.png";
|
||||||
import anilistIcon from "../../assets/icons/anilist.svg";
|
import anilistIcon from "../../assets/icons/anilist.svg";
|
||||||
@@ -25,7 +25,7 @@ const knownIcons = [
|
|||||||
"kitsu",
|
"kitsu",
|
||||||
];
|
];
|
||||||
|
|
||||||
const IconLink = ({ name, url }: { name: string; url: string }) => {
|
const IconLink = memo(({ name, url }: { name: string; url: string }) => {
|
||||||
return (
|
return (
|
||||||
<Link target="_blank" href={url} className="item-detail-link">
|
<Link target="_blank" href={url} className="item-detail-link">
|
||||||
{name.toLocaleLowerCase() === "imdb" && <img src={imdbIcon} alt="IMDb" />}
|
{name.toLocaleLowerCase() === "imdb" && <img src={imdbIcon} alt="IMDb" />}
|
||||||
@@ -61,6 +61,6 @@ const IconLink = ({ name, url }: { name: string; url: string }) => {
|
|||||||
)}
|
)}
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
};
|
});
|
||||||
|
|
||||||
export default IconLink;
|
export default IconLink;
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
import {
|
||||||
|
AnimatePresence,
|
||||||
|
type HTMLMotionProps,
|
||||||
|
motion,
|
||||||
|
useScroll,
|
||||||
|
useTransform,
|
||||||
|
} from "motion/react";
|
||||||
|
import React, { type RefObject, useEffect, useState } from "react";
|
||||||
|
|
||||||
|
interface ItemBackdropProps {
|
||||||
|
targetRef: RefObject<HTMLElement | null>;
|
||||||
|
backdropSrc?: string;
|
||||||
|
fallbackSrc: string;
|
||||||
|
alt: string;
|
||||||
|
distance?: number; // parallax distance
|
||||||
|
className?: string;
|
||||||
|
onLoad?: (e: React.SyntheticEvent<HTMLImageElement>) => void;
|
||||||
|
motionProps?: HTMLMotionProps<"img">;
|
||||||
|
}
|
||||||
|
|
||||||
|
const MotionImg = motion.img;
|
||||||
|
|
||||||
|
const animationProps = {
|
||||||
|
initial: { opacity: 0 },
|
||||||
|
animate: { opacity: 1 },
|
||||||
|
exit: { opacity: 0 },
|
||||||
|
transition: { duration: 0.5 },
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ItemBackdrop delays applying motion-driven parallax until after mount
|
||||||
|
* to avoid hydration timing errors ("Target ref is defined but not hydrated").
|
||||||
|
* It accepts a scroll container ref from the parent; if the ref is not yet
|
||||||
|
* attached, it renders a static img to prevent motion from touching an
|
||||||
|
* unhydrated DOM node.
|
||||||
|
*/
|
||||||
|
const ItemBackdropContent = React.memo(function ItemBackdropContent({
|
||||||
|
targetRef,
|
||||||
|
src,
|
||||||
|
alt,
|
||||||
|
distance,
|
||||||
|
className,
|
||||||
|
onLoad,
|
||||||
|
motionProps,
|
||||||
|
}: {
|
||||||
|
targetRef: RefObject<HTMLElement | null>;
|
||||||
|
src: string;
|
||||||
|
alt: string;
|
||||||
|
distance: number;
|
||||||
|
className?: string;
|
||||||
|
onLoad?: (e: React.SyntheticEvent<HTMLImageElement>) => void;
|
||||||
|
motionProps?: HTMLMotionProps<"img">;
|
||||||
|
}) {
|
||||||
|
const { scrollYProgress } = useScroll({
|
||||||
|
target: targetRef,
|
||||||
|
offset: ["start start", "60vh start"],
|
||||||
|
});
|
||||||
|
const y = useTransform(scrollYProgress, [0, 1], [-distance, distance]);
|
||||||
|
return (
|
||||||
|
<MotionImg
|
||||||
|
alt={alt}
|
||||||
|
src={src}
|
||||||
|
className={className ?? "item-hero-backdrop"}
|
||||||
|
onLoad={(e) => {
|
||||||
|
onLoad?.(e);
|
||||||
|
}}
|
||||||
|
style={{ y }}
|
||||||
|
{...motionProps}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
export function ItemBackdrop({
|
||||||
|
targetRef,
|
||||||
|
backdropSrc,
|
||||||
|
fallbackSrc,
|
||||||
|
alt,
|
||||||
|
distance = 50,
|
||||||
|
className,
|
||||||
|
onLoad,
|
||||||
|
motionProps,
|
||||||
|
}: ItemBackdropProps) {
|
||||||
|
const src = backdropSrc || fallbackSrc;
|
||||||
|
const [ready, setReady] = useState(false);
|
||||||
|
// Poll a few animation frames until the target ref hydrates to avoid premature motion initialization.
|
||||||
|
useEffect(() => {
|
||||||
|
if (ready) return;
|
||||||
|
let frame = 0;
|
||||||
|
let raf: number;
|
||||||
|
const tick = () => {
|
||||||
|
if (targetRef.current || frame > 5) {
|
||||||
|
setReady(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
frame++;
|
||||||
|
raf = requestAnimationFrame(tick);
|
||||||
|
};
|
||||||
|
tick();
|
||||||
|
return () => cancelAnimationFrame(raf);
|
||||||
|
}, [targetRef, ready]);
|
||||||
|
|
||||||
|
const finalMotionProps = React.useMemo(
|
||||||
|
() => ({
|
||||||
|
...animationProps,
|
||||||
|
...motionProps,
|
||||||
|
}),
|
||||||
|
[motionProps],
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!ready) {
|
||||||
|
return (
|
||||||
|
<img
|
||||||
|
alt={alt}
|
||||||
|
src={src}
|
||||||
|
className={className ?? "item-hero-backdrop"}
|
||||||
|
onLoad={(e) => {
|
||||||
|
e.currentTarget.style.opacity = "1";
|
||||||
|
onLoad?.(e);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AnimatePresence>
|
||||||
|
<ItemBackdropContent
|
||||||
|
key={src}
|
||||||
|
targetRef={targetRef}
|
||||||
|
src={src}
|
||||||
|
alt={alt}
|
||||||
|
distance={distance}
|
||||||
|
className={className}
|
||||||
|
onLoad={onLoad}
|
||||||
|
motionProps={finalMotionProps}
|
||||||
|
/>
|
||||||
|
</AnimatePresence>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ItemBackdrop;
|
||||||
@@ -0,0 +1,366 @@
|
|||||||
|
import type { Api } from "@jellyfin/sdk";
|
||||||
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import Chip from "@mui/material/Chip";
|
||||||
|
import { green, red, yellow } from "@mui/material/colors";
|
||||||
|
import Stack from "@mui/material/Stack";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
import { Link } from "@tanstack/react-router";
|
||||||
|
import React, { type ReactNode, type RefObject } from "react";
|
||||||
|
import { Blurhash } from "react-blurhash";
|
||||||
|
import heroBg from "@/assets/herobg.png";
|
||||||
|
import ultraHdIcon from "@/assets/icons/4k.svg";
|
||||||
|
import dolbyAtmosIcon from "@/assets/icons/dolby-atmos.svg";
|
||||||
|
import dolbyDigitalIcon from "@/assets/icons/dolby-digital.svg";
|
||||||
|
import dolbyTrueHDIcon from "@/assets/icons/dolby-truehd.svg";
|
||||||
|
import dolbyVisionIcon from "@/assets/icons/dolby-vision.svg";
|
||||||
|
import dolbyVisionAtmosIcon from "@/assets/icons/dolby-vision-atmos.png";
|
||||||
|
import dtsIcon from "@/assets/icons/dts.svg";
|
||||||
|
import dtsHdMaIcon from "@/assets/icons/dts-hd-ma.svg";
|
||||||
|
import hdIcon from "@/assets/icons/hd.svg";
|
||||||
|
import hdrIcon from "@/assets/icons/hdr.svg";
|
||||||
|
import hdr10Icon from "@/assets/icons/hdr10.svg";
|
||||||
|
import hdr10PlusIcon from "@/assets/icons/hdr10-plus.svg";
|
||||||
|
import sdIcon from "@/assets/icons/sd.svg";
|
||||||
|
import sdrIcon from "@/assets/icons/sdr.svg";
|
||||||
|
import ItemBackdrop from "@/components/itemBackdrop";
|
||||||
|
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||||
|
import { endsAt, getRuntime } from "@/utils/date/time";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
|
||||||
|
import "./itemHeader.scss";
|
||||||
|
|
||||||
|
interface ItemHeaderProps {
|
||||||
|
item: BaseItemDto;
|
||||||
|
api: Api | undefined;
|
||||||
|
mediaQualityInfo?: MediaQualityInfo;
|
||||||
|
scrollTargetRef?: RefObject<HTMLDivElement | null>;
|
||||||
|
children?: ReactNode;
|
||||||
|
backdropSrc?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ItemHeader = ({
|
||||||
|
item,
|
||||||
|
api,
|
||||||
|
mediaQualityInfo,
|
||||||
|
scrollTargetRef,
|
||||||
|
children,
|
||||||
|
backdropSrc,
|
||||||
|
}: ItemHeaderProps) => {
|
||||||
|
const isEpisode = item.Type === "Episode";
|
||||||
|
const backdropTag =
|
||||||
|
isEpisode && item.ParentBackdropImageTags?.length
|
||||||
|
? item.ParentBackdropImageTags[0]
|
||||||
|
: item.BackdropImageTags?.[0];
|
||||||
|
const backdropId =
|
||||||
|
isEpisode && item.ParentBackdropImageTags?.length
|
||||||
|
? (item.ParentBackdropItemId ?? item.Id)
|
||||||
|
: item.Id;
|
||||||
|
|
||||||
|
const parentLogoImageTag =
|
||||||
|
(item as any).ParentLogoImageTag || (item as any).ParentLogoImageTags?.[0];
|
||||||
|
const logoTag =
|
||||||
|
isEpisode && parentLogoImageTag ? parentLogoImageTag : item.ImageTags?.Logo;
|
||||||
|
const logoId =
|
||||||
|
isEpisode && parentLogoImageTag ? (item.SeriesId ?? item.Id) : item.Id;
|
||||||
|
|
||||||
|
const logo =
|
||||||
|
logoTag ? (
|
||||||
|
<img
|
||||||
|
alt={item.Name ?? ""}
|
||||||
|
src={
|
||||||
|
api &&
|
||||||
|
getImageUrlsApi(api).getItemImageUrlById(logoId ?? "", "Logo", {
|
||||||
|
quality: 90,
|
||||||
|
fillWidth: 592,
|
||||||
|
fillHeight: 592,
|
||||||
|
tag: logoTag,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
onLoad={(e) => {
|
||||||
|
e.currentTarget.style.opacity = "1";
|
||||||
|
}}
|
||||||
|
className="item-hero-logo"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Typography mb={2} fontWeight={200} variant="h2">
|
||||||
|
{isEpisode ? item.SeriesName : item.Name}
|
||||||
|
</Typography>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="item-hero">
|
||||||
|
<div className="item-hero-backdrop-container">
|
||||||
|
{scrollTargetRef && (
|
||||||
|
<ItemBackdrop
|
||||||
|
targetRef={scrollTargetRef}
|
||||||
|
alt={item.Name ?? ""}
|
||||||
|
backdropSrc={
|
||||||
|
backdropSrc ??
|
||||||
|
(backdropTag
|
||||||
|
? api &&
|
||||||
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
backdropId ?? "",
|
||||||
|
"Backdrop",
|
||||||
|
{ tag: backdropTag },
|
||||||
|
)
|
||||||
|
: undefined)
|
||||||
|
}
|
||||||
|
fallbackSrc={heroBg}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="item-hero-image-container"
|
||||||
|
style={{
|
||||||
|
aspectRatio: item.PrimaryImageAspectRatio ?? 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{item.ImageTags?.Primary ? (
|
||||||
|
<div>
|
||||||
|
<Blurhash
|
||||||
|
hash={
|
||||||
|
item.ImageBlurHashes?.Primary?.[item.ImageTags.Primary] ?? ""
|
||||||
|
}
|
||||||
|
className="item-hero-image-blurhash"
|
||||||
|
/>
|
||||||
|
<img
|
||||||
|
alt={item.Name ?? ""}
|
||||||
|
src={
|
||||||
|
api &&
|
||||||
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.Id ?? "",
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
|
quality: 90,
|
||||||
|
tag: item.ImageTags.Primary,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
onLoad={(e) => {
|
||||||
|
e.currentTarget.style.opacity = "1";
|
||||||
|
}}
|
||||||
|
className="item-hero-image"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="item-hero-image-icon">
|
||||||
|
{getTypeIcon(item.Type ?? "Movie")}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="item-hero-detail flex flex-column">
|
||||||
|
{isEpisode && logoId ? (
|
||||||
|
<Link
|
||||||
|
to="/series/$id"
|
||||||
|
params={{ id: logoId }}
|
||||||
|
style={{
|
||||||
|
textDecoration: "none",
|
||||||
|
color: "inherit",
|
||||||
|
width: "fit-content",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{logo}
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
logo
|
||||||
|
)}
|
||||||
|
{isEpisode && (
|
||||||
|
<Typography mb={2} fontWeight={200} variant="h4">
|
||||||
|
{item.ParentIndexNumber !== undefined &&
|
||||||
|
item.IndexNumber !== undefined
|
||||||
|
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - `
|
||||||
|
: ""}
|
||||||
|
{item.Name}
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
gap={2}
|
||||||
|
justifyItems="flex-start"
|
||||||
|
alignItems="center"
|
||||||
|
>
|
||||||
|
{mediaQualityInfo?.isUHD && (
|
||||||
|
<img
|
||||||
|
src={ultraHdIcon}
|
||||||
|
alt="ultra hd"
|
||||||
|
className="item-hero-mediaInfo badge"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{mediaQualityInfo?.isHD && (
|
||||||
|
<img src={hdIcon} alt="hd" className="item-hero-mediaInfo badge" />
|
||||||
|
)}
|
||||||
|
{mediaQualityInfo?.isSD && (
|
||||||
|
<img src={sdIcon} alt="sd" className="item-hero-mediaInfo badge" />
|
||||||
|
)}
|
||||||
|
{mediaQualityInfo?.isSDR && (
|
||||||
|
<img
|
||||||
|
src={sdrIcon}
|
||||||
|
alt="sdr"
|
||||||
|
className="item-hero-mediaInfo badge"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{mediaQualityInfo?.isHDR &&
|
||||||
|
!mediaQualityInfo?.isHDR10 &&
|
||||||
|
!mediaQualityInfo?.isHDR10Plus && (
|
||||||
|
<img
|
||||||
|
src={hdrIcon}
|
||||||
|
alt="hdr"
|
||||||
|
className="item-hero-mediaInfo badge"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{mediaQualityInfo?.isHDR10 && (
|
||||||
|
<img
|
||||||
|
src={hdr10Icon}
|
||||||
|
alt="hdr10"
|
||||||
|
className="item-hero-mediaInfo badge"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{item.PremiereDate && (
|
||||||
|
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||||
|
{item.ProductionYear ?? ""}
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
{item.OfficialRating && (
|
||||||
|
<Chip variant="filled" size="small" label={item.OfficialRating} />
|
||||||
|
)}
|
||||||
|
|
||||||
|
{item.CommunityRating && (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
gap: "0.25em",
|
||||||
|
alignItems: "center",
|
||||||
|
}}
|
||||||
|
className="hero-carousel-info-rating"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="material-symbols-rounded fill"
|
||||||
|
style={{
|
||||||
|
// fontSize: "2.2em",
|
||||||
|
color: yellow[400],
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
star
|
||||||
|
</div>
|
||||||
|
<Typography
|
||||||
|
style={{
|
||||||
|
opacity: "0.8",
|
||||||
|
}}
|
||||||
|
variant="subtitle2"
|
||||||
|
>
|
||||||
|
{Math.round(item.CommunityRating * 10) / 10}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{item.CriticRating && (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
gap: "0.25em",
|
||||||
|
alignItems: "center",
|
||||||
|
}}
|
||||||
|
className="hero-carousel-info-rating"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="material-symbols-rounded fill"
|
||||||
|
style={{
|
||||||
|
color: item.CriticRating > 50 ? green[400] : red[400],
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{item.CriticRating > 50 ? "thumb_up" : "thumb_down"}
|
||||||
|
</div>
|
||||||
|
<Typography
|
||||||
|
style={{
|
||||||
|
opacity: "0.8",
|
||||||
|
}}
|
||||||
|
variant="subtitle2"
|
||||||
|
>
|
||||||
|
{item.CriticRating}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{item.RunTimeTicks && (
|
||||||
|
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||||
|
{getRuntime(item.RunTimeTicks)}
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
{item.RunTimeTicks && (
|
||||||
|
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||||
|
{endsAt(
|
||||||
|
item.RunTimeTicks - (item.UserData?.PlaybackPositionTicks ?? 0),
|
||||||
|
)}
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
<Typography variant="subtitle2" style={{ opacity: 0.8 }}>
|
||||||
|
{item.Genres?.slice(0, 4).join(" / ")}
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
{mediaQualityInfo && (
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
gap={2}
|
||||||
|
justifyItems="flex-start"
|
||||||
|
alignItems="center"
|
||||||
|
>
|
||||||
|
{mediaQualityInfo?.isHDR10Plus && (
|
||||||
|
<img
|
||||||
|
src={hdr10PlusIcon}
|
||||||
|
alt="hdr10+"
|
||||||
|
className="item-hero-mediaInfo"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{mediaQualityInfo.isDts && (
|
||||||
|
<img src={dtsIcon} alt="dts" className="item-hero-mediaInfo" />
|
||||||
|
)}
|
||||||
|
{mediaQualityInfo.isDtsHDMA && (
|
||||||
|
<img
|
||||||
|
src={dtsHdMaIcon}
|
||||||
|
alt="dts-hd ma"
|
||||||
|
className="item-hero-mediaInfo"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{mediaQualityInfo.isAtmos && mediaQualityInfo.isDolbyVision && (
|
||||||
|
<img
|
||||||
|
src={dolbyVisionAtmosIcon}
|
||||||
|
alt="dolby vision atmos"
|
||||||
|
className="item-hero-mediaInfo"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{mediaQualityInfo.isAtmos && !mediaQualityInfo.isDolbyVision && (
|
||||||
|
<img
|
||||||
|
src={dolbyAtmosIcon}
|
||||||
|
alt="dolby atmos"
|
||||||
|
className="item-hero-mediaInfo"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{mediaQualityInfo.isDolbyVision && !mediaQualityInfo.isAtmos && (
|
||||||
|
<img
|
||||||
|
src={dolbyVisionIcon}
|
||||||
|
alt="dolby vision"
|
||||||
|
className="item-hero-mediaInfo"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{mediaQualityInfo.isTrueHD && (
|
||||||
|
<img
|
||||||
|
src={dolbyTrueHDIcon}
|
||||||
|
alt="dolby truehd"
|
||||||
|
className="item-hero-mediaInfo"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{mediaQualityInfo.isDD && (
|
||||||
|
<img
|
||||||
|
src={dolbyDigitalIcon}
|
||||||
|
alt="dolby digital"
|
||||||
|
className="item-hero-mediaInfo"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ItemHeader;
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
@import "../../styles/variables.scss";
|
||||||
|
|
||||||
|
$cardWidth: 18%;
|
||||||
|
|
||||||
|
.item-hero {
|
||||||
|
height: 60vh;
|
||||||
|
gap: 2em;
|
||||||
|
row-gap: 1.2em;
|
||||||
|
position: relative;
|
||||||
|
align-items: flex-end;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: $cardWidth 1fr;
|
||||||
|
grid-template-rows: 1fr auto;
|
||||||
|
&-image {
|
||||||
|
opacity: 0;
|
||||||
|
width: 100%;
|
||||||
|
object-fit: contain;
|
||||||
|
transition: opacity $transition-time-default;
|
||||||
|
&-container {
|
||||||
|
height: fit-content;
|
||||||
|
max-height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: $border-radius-default;
|
||||||
|
box-shadow: $shadow-card;
|
||||||
|
flex-grow: 1;
|
||||||
|
flex-shrink: 0;
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
&-blurhash {
|
||||||
|
position: absolute !important;
|
||||||
|
width: 100% !important;
|
||||||
|
height: 100% !important;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
&-icon {
|
||||||
|
background: linear-gradient(45deg, rgb(255 255 255 / 0.05), rgb(255 255 255 / 0.15));
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
.material-symbols-rounded{
|
||||||
|
font-size: 4em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&-logo {
|
||||||
|
max-width: 34rem;
|
||||||
|
max-height: 10rem;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity $transition-time-default;
|
||||||
|
object-position: bottom;
|
||||||
|
margin-bottom: 2em;
|
||||||
|
}
|
||||||
|
&-detail {
|
||||||
|
width: 100%;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 0.2em;
|
||||||
|
justify-content: end;
|
||||||
|
}
|
||||||
|
&-buttons {
|
||||||
|
&-container {
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
grid-column: 1/3;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: inherit;
|
||||||
|
gap: 2em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&-backdrop {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
object-fit: cover;
|
||||||
|
object-position: top;
|
||||||
|
opacity: 0;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
transition: opacity $transition-time-default;
|
||||||
|
&-container {
|
||||||
|
filter: brightness(0.8);
|
||||||
|
position: absolute;
|
||||||
|
top: -4.4em;
|
||||||
|
left: -$page-margin;
|
||||||
|
width: 100vw;
|
||||||
|
height: calc(64vh + 4.4em);
|
||||||
|
z-index: -1;
|
||||||
|
mask-image: linear-gradient(to top, transparent, black);
|
||||||
|
-webkit-mask-image: linear-gradient(
|
||||||
|
to top,
|
||||||
|
transparent,
|
||||||
|
black
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
& .play-button {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
height: 16em;
|
height: 16em;
|
||||||
box-shadow: $shadow-card-image;
|
box-shadow: $shadow-card-image;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
flex-shrink: 0;
|
||||||
&-icon {
|
&-icon {
|
||||||
color: rgb(255 255 255 / 0.5);
|
color: rgb(255 255 255 / 0.5);
|
||||||
font-variation-settings: "FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40;
|
font-variation-settings: "FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40;
|
||||||
|
|||||||
@@ -1,274 +0,0 @@
|
|||||||
import React, { useState } from "react";
|
|
||||||
|
|
||||||
import MuiLink from "@mui/material/Link";
|
|
||||||
import Paper from "@mui/material/Paper";
|
|
||||||
import Stack from "@mui/material/Stack";
|
|
||||||
import Typography from "@mui/material/Typography";
|
|
||||||
|
|
||||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
|
|
||||||
import { getRuntimeMusic } from "../../../utils/date/time";
|
|
||||||
|
|
||||||
import { SortOrder } from "@jellyfin/sdk/lib/generated-client";
|
|
||||||
import { useAudioPlayback } from "../../../utils/store/audioPlayback";
|
|
||||||
import LikeButton from "../../buttons/likeButton";
|
|
||||||
import PlayButton from "../../buttons/playButton";
|
|
||||||
|
|
||||||
import TrackList from "../tracksList/index";
|
|
||||||
import "./albumArtist.scss";
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
|
||||||
import { Link, useRouteContext } from "@tanstack/react-router";
|
|
||||||
|
|
||||||
export const ArtistAlbum = ({ user, album, boxProps }) => {
|
|
||||||
const api = useApiInContext((s) => s.api);
|
|
||||||
const albumTracks = useQuery({
|
|
||||||
queryKey: ["artist", "album", album.Id],
|
|
||||||
queryFn: async () => {
|
|
||||||
const result = await getItemsApi(api).getItems({
|
|
||||||
userId: user.Id,
|
|
||||||
parentId: album.Id,
|
|
||||||
sortOrder: SortOrder.Ascending,
|
|
||||||
sortBy: "IndexNumber",
|
|
||||||
});
|
|
||||||
return result.data;
|
|
||||||
},
|
|
||||||
|
|
||||||
networkMode: "always",
|
|
||||||
});
|
|
||||||
|
|
||||||
const [
|
|
||||||
currentTrackItem,
|
|
||||||
setCurrentAudioTrack,
|
|
||||||
setAudioUrl,
|
|
||||||
setAudioDisplay,
|
|
||||||
setAudioItem,
|
|
||||||
setAudioTracks,
|
|
||||||
] = useAudioPlayback((state) => [
|
|
||||||
state.item,
|
|
||||||
state.setCurrentTrack,
|
|
||||||
state.setUrl,
|
|
||||||
state.setDisplay,
|
|
||||||
state.setItem,
|
|
||||||
state.setTracks,
|
|
||||||
]);
|
|
||||||
const playTrack = (index) => {
|
|
||||||
setAudioTracks(albumTracks.data.Items);
|
|
||||||
setCurrentAudioTrack(index);
|
|
||||||
setAudioUrl(
|
|
||||||
`${api.basePath}/Audio/${albumTracks.data.Items[index].Id}/universal?deviceId=${api.deviceInfo.id}&userId=${user.Id}&api_key=${api.accessToken}`,
|
|
||||||
);
|
|
||||||
setAudioItem(albumTracks.data.Items[index]);
|
|
||||||
setAudioDisplay(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div style={{ marginBottom: "3em" }} {...boxProps}>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "row",
|
|
||||||
gap: "1em",
|
|
||||||
marginBottom: "1em",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{!!album.ImageTags?.Primary && (
|
|
||||||
<div className="album-image">
|
|
||||||
<img
|
|
||||||
alt={album.Name}
|
|
||||||
src={`${api.basePath}/Items/${album.Id}/Images/Primary?fillHeight=532&fillWidth=532&quality=96`}
|
|
||||||
style={{
|
|
||||||
width: "100%",
|
|
||||||
height: "100%",
|
|
||||||
objectFit: "cover",
|
|
||||||
opacity: 0,
|
|
||||||
transition: "opacity 250ms",
|
|
||||||
position: "relative",
|
|
||||||
zIndex: 2,
|
|
||||||
}}
|
|
||||||
onLoad={(e) => (e.currentTarget.style.opacity = 1)}
|
|
||||||
/>
|
|
||||||
<div className="album-image-icon-container">
|
|
||||||
<span
|
|
||||||
className="material-symbols-rounded album-image-icon"
|
|
||||||
style={{ fontSize: "8em" }}
|
|
||||||
>
|
|
||||||
album
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<div
|
|
||||||
className="flex flex-column"
|
|
||||||
style={{
|
|
||||||
alignItems: "flex-start",
|
|
||||||
justifyContent: "space-between",
|
|
||||||
padding: "1em 0",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className="flex flex-column">
|
|
||||||
<Typography
|
|
||||||
variant="h4"
|
|
||||||
fontWeight={300}
|
|
||||||
style={{ opacity: "0.6", mb: 1 }}
|
|
||||||
>
|
|
||||||
{album.ProductionYear}
|
|
||||||
</Typography>
|
|
||||||
<MuiLink
|
|
||||||
component={Link}
|
|
||||||
to="/album/$Id"
|
|
||||||
variant="h2"
|
|
||||||
color="inherit"
|
|
||||||
underline="hover"
|
|
||||||
>
|
|
||||||
{album.Name}
|
|
||||||
</MuiLink>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
className=" flex flex-row"
|
|
||||||
style={{
|
|
||||||
gap: "1em",
|
|
||||||
alignItems: "center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<PlayButton
|
|
||||||
audio
|
|
||||||
itemId={album.Id}
|
|
||||||
itemType={album.Type}
|
|
||||||
itemUserData={album.UserData}
|
|
||||||
userId={user.Id}
|
|
||||||
buttonProps={{
|
|
||||||
color: "white",
|
|
||||||
style: {
|
|
||||||
color: "black ",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<LikeButton
|
|
||||||
itemName={album.Name}
|
|
||||||
key={album.Id}
|
|
||||||
queryKey={[
|
|
||||||
"item",
|
|
||||||
album.ParentBackdropItemId,
|
|
||||||
"artist",
|
|
||||||
"discography",
|
|
||||||
]}
|
|
||||||
isFavorite={album.UserData.IsFavorite}
|
|
||||||
itemId={album.Id}
|
|
||||||
itemType={album.Type}
|
|
||||||
itemUserData={album.UserData}
|
|
||||||
userId={user.Id}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{albumTracks.isSuccess && (
|
|
||||||
<TrackList user={user} tracks={albumTracks.data.Items} />
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
{
|
|
||||||
/* <div
|
|
||||||
key={0}
|
|
||||||
className="item-detail-album-track"
|
|
||||||
style={{
|
|
||||||
padding: "0.75em 0 ",
|
|
||||||
background: "rgb(0 0 0 / 0.6)",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Typography
|
|
||||||
variant="h6"
|
|
||||||
fontWeight={400}
|
|
||||||
style={{
|
|
||||||
justifySelf: "end",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
#
|
|
||||||
</Typography>
|
|
||||||
<div />
|
|
||||||
<Typography
|
|
||||||
variant="h6"
|
|
||||||
style={{
|
|
||||||
justifySelf: "start",
|
|
||||||
}}
|
|
||||||
fontWeight={400}
|
|
||||||
>
|
|
||||||
Name
|
|
||||||
</Typography>
|
|
||||||
<span className="material-symbols-rounded">schedule</span>
|
|
||||||
</div>
|
|
||||||
{/*albumTracks.data.Items.map((track, index) => {
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
key={track.Id}
|
|
||||||
className={
|
|
||||||
currentTrackItem.Id === track.Id &&
|
|
||||||
currentTrackItem.ParentId === track.ParentId
|
|
||||||
? "item-detail-album-track playing"
|
|
||||||
: "item-detail-album-track"
|
|
||||||
}
|
|
||||||
onClick={() => playTrack(index)}
|
|
||||||
>
|
|
||||||
<Typography
|
|
||||||
variant="subtitle1"
|
|
||||||
style={{
|
|
||||||
justifySelf: "end",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{track.IndexNumber ? track.IndexNumber : "-"}
|
|
||||||
</Typography>
|
|
||||||
|
|
||||||
<LikeButton
|
|
||||||
itemId={track.Id}
|
|
||||||
isFavorite={track.UserData?.IsFavorite}
|
|
||||||
queryKey={["artist", "album", album.Id]}
|
|
||||||
userId={user.Id}
|
|
||||||
itemName={track.Name}
|
|
||||||
color={
|
|
||||||
currentTrackItem.Id === track.Id &&
|
|
||||||
currentTrackItem.ParentId === track.ParentId
|
|
||||||
? "hsl(337, 96%, 56%)"
|
|
||||||
: "white"
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
width: "100%",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Typography
|
|
||||||
variant="subtitle1"
|
|
||||||
style={{
|
|
||||||
justifySelf: "start",
|
|
||||||
}}
|
|
||||||
fontWeight={500}
|
|
||||||
>
|
|
||||||
{track.Name}
|
|
||||||
</Typography>
|
|
||||||
{track.AlbumArtist === "Various Artists" && (
|
|
||||||
<Typography
|
|
||||||
variant="subtitle2"
|
|
||||||
style={{
|
|
||||||
opacity: 0.5,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{track.ArtistItems.map((artist) => artist.Name).join(
|
|
||||||
", ",
|
|
||||||
)}
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<Typography variant="subtitle1">
|
|
||||||
{getRuntimeMusic(track.RunTimeTicks)}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})*/
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
import React from "react";
|
||||||
|
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
|
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
import {
|
||||||
|
type BaseItemDto,
|
||||||
|
SortOrder,
|
||||||
|
type UserDto,
|
||||||
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import LikeButton from "../../buttons/likeButton";
|
||||||
|
import PlayButton from "../../buttons/playButton";
|
||||||
|
|
||||||
|
import "./albumArtist.scss";
|
||||||
|
import AlbumMusicTrack from "@/components/albumMusicTrack";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { Link } from "@tanstack/react-router";
|
||||||
|
|
||||||
|
type ArtistAlbumProps = {
|
||||||
|
user: UserDto;
|
||||||
|
album: BaseItemDto;
|
||||||
|
boxProps?: object;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const ArtistAlbum = ({ user, album, boxProps }: ArtistAlbumProps) => {
|
||||||
|
const api = useApiInContext((s) => s.api);
|
||||||
|
const albumTracks = useQuery({
|
||||||
|
queryKey: ["artist", "album", album.Id],
|
||||||
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
|
const result = await getItemsApi(api).getItems({
|
||||||
|
userId: user.Id,
|
||||||
|
parentId: album.Id,
|
||||||
|
sortOrder: [SortOrder.Ascending],
|
||||||
|
sortBy: ["IndexNumber"],
|
||||||
|
});
|
||||||
|
return result.data;
|
||||||
|
},
|
||||||
|
|
||||||
|
networkMode: "always",
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ marginBottom: "3em" }} {...boxProps}>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "row",
|
||||||
|
gap: "1em",
|
||||||
|
marginBottom: "1em",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{!!album.ImageTags?.Primary && (
|
||||||
|
<div className="album-image">
|
||||||
|
<img
|
||||||
|
alt={album.Name ?? "Album Image"}
|
||||||
|
src={`${api?.basePath}/Items/${album.Id}/Images/Primary?fillHeight=532&fillWidth=532&quality=96`}
|
||||||
|
style={{
|
||||||
|
width: "100%",
|
||||||
|
height: "100%",
|
||||||
|
objectFit: "cover",
|
||||||
|
opacity: 0,
|
||||||
|
transition: "opacity 250ms",
|
||||||
|
position: "relative",
|
||||||
|
zIndex: 2,
|
||||||
|
}}
|
||||||
|
onLoad={(e) => {
|
||||||
|
e.currentTarget.style.opacity = "1";
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div className="album-image-icon-container">
|
||||||
|
<span
|
||||||
|
className="material-symbols-rounded album-image-icon"
|
||||||
|
style={{ fontSize: "8em" }}
|
||||||
|
>
|
||||||
|
album
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div
|
||||||
|
className="flex flex-column"
|
||||||
|
style={{
|
||||||
|
alignItems: "flex-start",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
padding: "1em 0",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className="flex flex-column">
|
||||||
|
<Typography
|
||||||
|
variant="h5"
|
||||||
|
fontWeight={300}
|
||||||
|
style={{ opacity: "0.6" }}
|
||||||
|
>
|
||||||
|
{album.ProductionYear}
|
||||||
|
</Typography>
|
||||||
|
<Link
|
||||||
|
to="/album/$id"
|
||||||
|
params={{ id: album.Id ?? "" }}
|
||||||
|
style={{ color: "white", textDecoration: "none" }}
|
||||||
|
>
|
||||||
|
<Typography variant="h4" color="white">
|
||||||
|
{album.Name}
|
||||||
|
</Typography>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className=" flex flex-row"
|
||||||
|
style={{
|
||||||
|
gap: "1em",
|
||||||
|
alignItems: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<PlayButton
|
||||||
|
audio
|
||||||
|
item={album}
|
||||||
|
itemType={album.Type ?? "MusicAlbum"}
|
||||||
|
userId={user.Id}
|
||||||
|
buttonProps={{
|
||||||
|
//@ts-ignore
|
||||||
|
color: "white",
|
||||||
|
style: {
|
||||||
|
color: "black ",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LikeButton
|
||||||
|
itemName={album.Name}
|
||||||
|
key={album.Id}
|
||||||
|
queryKey={[
|
||||||
|
"item",
|
||||||
|
album.ParentBackdropItemId ?? "",
|
||||||
|
"artist",
|
||||||
|
"discography",
|
||||||
|
]}
|
||||||
|
isFavorite={album.UserData?.IsFavorite}
|
||||||
|
itemId={album.Id}
|
||||||
|
userId={user.Id}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{albumTracks.isSuccess && (albumTracks.data?.Items?.length ?? 0) > 0 && (
|
||||||
|
<div>
|
||||||
|
<div className="item-info-track header">
|
||||||
|
<span className="material-symbols-rounded index">tag</span>
|
||||||
|
<Typography variant="subtitle1">Title</Typography>
|
||||||
|
<Typography variant="subtitle1">Duration</Typography>
|
||||||
|
</div>
|
||||||
|
{albumTracks.data?.Items?.map((track, index) => (
|
||||||
|
<AlbumMusicTrack
|
||||||
|
track={track}
|
||||||
|
trackIndex={index}
|
||||||
|
musicTracks={albumTracks.data}
|
||||||
|
key={track.Id}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Card } from "../../card/card";
|
import { Card } from "../../card/card";
|
||||||
import { CardScroller } from "../../cardScroller/cardScroller";
|
import CardScroller from "../../cardScroller/cardScroller";
|
||||||
import { CardsSkeleton } from "../../skeleton/cards";
|
import { CardsSkeleton } from "../../skeleton/cards";
|
||||||
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import {
|
import {
|
||||||
type BaseItemDto,
|
type BaseItemDto,
|
||||||
BaseItemKind,
|
BaseItemKind,
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
|
||||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,36 +19,30 @@ export const LatestMediaSection = ({
|
|||||||
latestMediaLib,
|
latestMediaLib,
|
||||||
}: { latestMediaLib: BaseItemDto }) => {
|
}: { latestMediaLib: BaseItemDto }) => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
});
|
|
||||||
const fetchLatestMedia = async (library: BaseItemDto) => {
|
const fetchLatestMedia = async (library: BaseItemDto) => {
|
||||||
|
if (!api || !user?.Id) return null;
|
||||||
const media = await getUserLibraryApi(api).getLatestMedia({
|
const media = await getUserLibraryApi(api).getLatestMedia({
|
||||||
userId: user.data?.Id,
|
userId: user.Id,
|
||||||
parentId: library.Id,
|
parentId: library.Id,
|
||||||
limit: 16,
|
limit: 16,
|
||||||
fields: ["PrimaryImageAspectRatio"],
|
fields: ["PrimaryImageAspectRatio", "ParentId"],
|
||||||
});
|
});
|
||||||
return media.data;
|
return media.data;
|
||||||
};
|
};
|
||||||
const data = useQuery({
|
const data = useQuery({
|
||||||
queryKey: ["home", "latestMedia", latestMediaLib.Id],
|
queryKey: ["home", "latestMedia", latestMediaLib.Id],
|
||||||
queryFn: () => fetchLatestMedia(latestMediaLib),
|
queryFn: () => fetchLatestMedia(latestMediaLib),
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
refetchOnMount: true,
|
refetchOnMount: true,
|
||||||
});
|
});
|
||||||
if (data.isPending) {
|
if (data.isPending) {
|
||||||
return <CardsSkeleton />;
|
return <CardsSkeleton />;
|
||||||
}
|
}
|
||||||
if (data.isSuccess && data.data.length >= 1) {
|
if (data.isSuccess && (data.data?.length ?? 0) >= 1) {
|
||||||
return (
|
return (
|
||||||
<CardScroller displayCards={7} title={`Latest ${latestMediaLib.Name}`}>
|
<CardScroller displayCards={7} title={`Latest ${latestMediaLib.Name}`}>
|
||||||
{data.data.map((item) => {
|
{data.data?.map((item) => {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
key={item.Id}
|
key={item.Id}
|
||||||
@@ -79,14 +73,8 @@ export const LatestMediaSection = ({
|
|||||||
? "square"
|
? "square"
|
||||||
: "portrait"
|
: "portrait"
|
||||||
}
|
}
|
||||||
queryKey={["home", "latestMedia", latestMediaLib.Id]}
|
queryKey={["home", "latestMedia", latestMediaLib.Id ?? ""]}
|
||||||
userId={user.data?.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
|
||||||
item.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
import { useApiInContext } from "@/utils/store/api";
|
|
||||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
|
||||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
|
||||||
import Typography from "@mui/material/Typography";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
import { useRouteContext } from "@tanstack/react-router";
|
|
||||||
import React from "react";
|
|
||||||
import { Card } from "../../../card/card";
|
|
||||||
import { CardScroller } from "../../../cardScroller/cardScroller";
|
|
||||||
|
|
||||||
const GenreView = ({ libraryId, genreId, genreName, userId }) => {
|
|
||||||
const api = useApiInContext((s) => s.api);
|
|
||||||
|
|
||||||
const items = useQuery({
|
|
||||||
queryKey: ["library", "genreItem", genreId],
|
|
||||||
queryFn: async () => {
|
|
||||||
const result = await getItemsApi(api).getItems({
|
|
||||||
genreIds: [genreId],
|
|
||||||
parentId: libraryId,
|
|
||||||
userId: userId,
|
|
||||||
});
|
|
||||||
return result.data;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
if (items.isSuccess && items.data.Items.length > 0) {
|
|
||||||
return (
|
|
||||||
<div className="library-genre">
|
|
||||||
<CardScroller title={genreName} displayCards={8} disableDecoration>
|
|
||||||
{items.data.Items.map((item) => {
|
|
||||||
return (
|
|
||||||
<Card
|
|
||||||
key={item.Id}
|
|
||||||
item={item}
|
|
||||||
seriesId={item.SeriesId}
|
|
||||||
cardTitle={
|
|
||||||
item.Type === BaseItemKind.Episode
|
|
||||||
? item.SeriesName
|
|
||||||
: item.Name
|
|
||||||
}
|
|
||||||
imageType={"Primary"}
|
|
||||||
cardCaption={
|
|
||||||
item.Type === BaseItemKind.Episode
|
|
||||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`
|
|
||||||
: item.Type === BaseItemKind.Series
|
|
||||||
? `${item.ProductionYear} - ${
|
|
||||||
item.EndDate
|
|
||||||
? new Date(item.EndDate).toLocaleString([], {
|
|
||||||
year: "numeric",
|
|
||||||
})
|
|
||||||
: "Present"
|
|
||||||
}`
|
|
||||||
: item.ProductionYear
|
|
||||||
}
|
|
||||||
disableOverlay={
|
|
||||||
item.Type === BaseItemKind.Person ||
|
|
||||||
item.Type === BaseItemKind.MusicAlbum ||
|
|
||||||
item.Type === BaseItemKind.Genre ||
|
|
||||||
item.Type === BaseItemKind.MusicGenre ||
|
|
||||||
item.Type === BaseItemKind.Studio
|
|
||||||
}
|
|
||||||
cardType={
|
|
||||||
item.Type === BaseItemKind.MusicAlbum ||
|
|
||||||
item.Type === BaseItemKind.Audio ||
|
|
||||||
item.Type === BaseItemKind.Genre ||
|
|
||||||
item.Type === BaseItemKind.MusicGenre ||
|
|
||||||
item.Type === BaseItemKind.Studio ||
|
|
||||||
item.Type === BaseItemKind.Playlist
|
|
||||||
? "square"
|
|
||||||
: "portrait"
|
|
||||||
}
|
|
||||||
queryKey={["library", "genreItem", genreId]}
|
|
||||||
userId={userId}
|
|
||||||
imageBlurhash={
|
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
|
||||||
item.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</CardScroller>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default GenreView;
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
import Typography from "@mui/material/Typography";
|
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
// Types
|
|
||||||
import type { BaseItemDto, UserDto } from "@jellyfin/sdk/lib/generated-client";
|
|
||||||
|
|
||||||
import { getRuntimeMusic } from "../../../utils/date/time";
|
|
||||||
import { useAudioPlayback } from "../../../utils/store/audioPlayback";
|
|
||||||
import LikeButton from "../../buttons/likeButton";
|
|
||||||
import "./tracksList.scss";
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
|
||||||
import { useRouteContext } from "@tanstack/react-router";
|
|
||||||
|
|
||||||
export default function TracksList({
|
|
||||||
tracks,
|
|
||||||
user,
|
|
||||||
queryKey,
|
|
||||||
}: { tracks: BaseItemDto[]; user: UserDto; queryKey: [] }) {
|
|
||||||
const api = useApiInContext((s) => s.api);
|
|
||||||
|
|
||||||
const [
|
|
||||||
currentItem,
|
|
||||||
setCurrentAudioTrack,
|
|
||||||
setAudioUrl,
|
|
||||||
setAudioDisplay,
|
|
||||||
setAudioItem,
|
|
||||||
setAudioTracks,
|
|
||||||
] = useAudioPlayback((state) => [
|
|
||||||
state.item,
|
|
||||||
state.setCurrentTrack,
|
|
||||||
state.setUrl,
|
|
||||||
state.setDisplay,
|
|
||||||
state.setItem,
|
|
||||||
state.setTracks,
|
|
||||||
]);
|
|
||||||
const playTrack = (index: number) => {
|
|
||||||
setAudioTracks(tracks);
|
|
||||||
setCurrentAudioTrack(index);
|
|
||||||
setAudioUrl(
|
|
||||||
`${api.basePath}/Audio/${tracks[index].Id}/universal?deviceId=${api.deviceInfo.id}&userId=${user.Id}&api_key=${api.accessToken}`,
|
|
||||||
);
|
|
||||||
setAudioItem(tracks[index]);
|
|
||||||
setAudioDisplay(true);
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<div className="track-list">
|
|
||||||
<div className="track track-header">
|
|
||||||
<Typography variant="h6">#</Typography>
|
|
||||||
<div>{""}</div>
|
|
||||||
<Typography
|
|
||||||
variant="h6"
|
|
||||||
style={{
|
|
||||||
width: "100%",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Name
|
|
||||||
</Typography>
|
|
||||||
<span className="material-symbols-rounded">schedule</span>
|
|
||||||
</div>
|
|
||||||
{tracks.map((track, index) => (
|
|
||||||
<div
|
|
||||||
className={currentItem?.Id === track.Id ? "track playing" : "track"}
|
|
||||||
key={track.Id}
|
|
||||||
onClick={() => playTrack(index)}
|
|
||||||
>
|
|
||||||
{currentItem?.Id === track.Id ? (
|
|
||||||
<span className="material-symbols-rounded ">equalizer</span>
|
|
||||||
) : (
|
|
||||||
<Typography>{track.IndexNumber ?? "-"}</Typography>
|
|
||||||
)}
|
|
||||||
<LikeButton
|
|
||||||
itemId={track.Id}
|
|
||||||
isFavorite={track.UserData?.IsFavorite}
|
|
||||||
queryKey={queryKey}
|
|
||||||
userId={user.Id}
|
|
||||||
itemName={track.Name}
|
|
||||||
/>
|
|
||||||
<Typography
|
|
||||||
style={{
|
|
||||||
width: "100%",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{track.Name}
|
|
||||||
</Typography>
|
|
||||||
<Typography>{getRuntimeMusic(track?.RunTimeTicks)}</Typography>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
.track{
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 4% 1fr 80% 1fr;
|
|
||||||
align-items: center;
|
|
||||||
justify-items: center;
|
|
||||||
gap: 0.5em;
|
|
||||||
width: 100%;
|
|
||||||
transition: background $transition-time-default;
|
|
||||||
padding: 0.4em;
|
|
||||||
border-bottom: 1px solid rgb(255 255 255 / 0.1);
|
|
||||||
cursor: pointer;
|
|
||||||
box-sizing: border-box;
|
|
||||||
|
|
||||||
&:hover{
|
|
||||||
background: rgb(255 255 255 / 0.1);
|
|
||||||
}
|
|
||||||
&.playing {
|
|
||||||
background: rgb(255 255 255 / 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
&-list {
|
|
||||||
background: rgb(0 0 0 / 0.4);
|
|
||||||
backdrop-filter: blur(5px);
|
|
||||||
border-radius: 20px;
|
|
||||||
overflow: hidden;
|
|
||||||
border: 1px solid rgb(255 255 255 / 0.2);
|
|
||||||
margin-bottom: 2em;
|
|
||||||
}
|
|
||||||
&-header{
|
|
||||||
background: rgb(0 0 0 / 0.4) !important;
|
|
||||||
padding: 0.8em 0.4em;
|
|
||||||
}
|
|
||||||
> *:first-child {
|
|
||||||
justify-self: end;
|
|
||||||
}
|
|
||||||
&:last-child {
|
|
||||||
border-bottom: 0px solid !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,400 @@
|
|||||||
|
import type { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import { ItemSortBy, SortOrder } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||||
|
import {
|
||||||
|
AppBar,
|
||||||
|
Chip,
|
||||||
|
IconButton,
|
||||||
|
MenuItem,
|
||||||
|
TextField,
|
||||||
|
Typography,
|
||||||
|
useScrollTrigger,
|
||||||
|
} from "@mui/material";
|
||||||
|
import { useQueryClient, useSuspenseQuery } from "@tanstack/react-query";
|
||||||
|
import { getRouteApi, useNavigate } from "@tanstack/react-router";
|
||||||
|
import type { ChangeEvent } from "react";
|
||||||
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
||||||
|
import { useShallow } from "zustand/shallow";
|
||||||
|
import { AVAILABLE_VIEWS, SORT_BY_OPTIONS } from "@/utils/constants/library";
|
||||||
|
import { getLibraryQueryOptions } from "@/utils/queries/library";
|
||||||
|
// import removed: header reads name/count from Zustand slice
|
||||||
|
import { useLibraryStateStore } from "@/utils/store/libraryState";
|
||||||
|
import useSearchStore from "@/utils/store/search";
|
||||||
|
import { NavigationDrawer } from "../appBar/navigationDrawer";
|
||||||
|
import BackButton from "../buttons/backButton";
|
||||||
|
import { FiltersDialogTrigger } from "../filtersDialog";
|
||||||
|
import { UserAvatarMenu } from "../userAvatarMenu";
|
||||||
|
import "./libraryHeader.scss";
|
||||||
|
|
||||||
|
const route = getRouteApi("/_api/library/$id");
|
||||||
|
|
||||||
|
const MemoizeBackButton = React.memo(BackButton);
|
||||||
|
|
||||||
|
export const LibraryHeader = () => {
|
||||||
|
const { id: currentLibraryId } = route.useParams();
|
||||||
|
const { api, user } = route.useRouteContext();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
// Zustand library state (selected via shallow comparator)
|
||||||
|
const {
|
||||||
|
currentViewType,
|
||||||
|
storeSortBy,
|
||||||
|
storeSortAscending,
|
||||||
|
filters,
|
||||||
|
vts,
|
||||||
|
nameStartsWith,
|
||||||
|
genreIds,
|
||||||
|
libraryNameFromStore,
|
||||||
|
itemsTotalCount,
|
||||||
|
} = useLibraryStateStore(
|
||||||
|
useShallow((s) => {
|
||||||
|
const slice = s.libraries[currentLibraryId || ""];
|
||||||
|
return {
|
||||||
|
currentViewType: slice?.currentViewType,
|
||||||
|
storeSortBy: slice?.sortBy,
|
||||||
|
storeSortAscending: slice?.sortAscending,
|
||||||
|
filters: slice?.filters,
|
||||||
|
vts: slice?.videoTypesState,
|
||||||
|
nameStartsWith: slice?.nameStartsWith,
|
||||||
|
genreIds: slice?.genreIds,
|
||||||
|
libraryNameFromStore: slice?.libraryName,
|
||||||
|
itemsTotalCount: slice?.itemsTotalCount,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
const { initLibrary, updateLibrary } = useLibraryStateStore(
|
||||||
|
useShallow((s) => ({
|
||||||
|
initLibrary: s.initLibrary,
|
||||||
|
updateLibrary: s.updateLibrary,
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!currentLibraryId) return;
|
||||||
|
// If the slice isn't initialized, these fields will be undefined
|
||||||
|
if (
|
||||||
|
currentViewType === undefined &&
|
||||||
|
storeSortBy === undefined &&
|
||||||
|
storeSortAscending === undefined
|
||||||
|
) {
|
||||||
|
initLibrary(currentLibraryId, {
|
||||||
|
sortBy: ItemSortBy.Name,
|
||||||
|
sortAscending: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [
|
||||||
|
currentLibraryId,
|
||||||
|
currentViewType,
|
||||||
|
storeSortBy,
|
||||||
|
storeSortAscending,
|
||||||
|
initLibrary,
|
||||||
|
]);
|
||||||
|
const currentLibrary = useSuspenseQuery(
|
||||||
|
getLibraryQueryOptions(api, user?.Id, currentLibraryId),
|
||||||
|
);
|
||||||
|
const scrollTrigger = useScrollTrigger({
|
||||||
|
disableHysteresis: true,
|
||||||
|
threshold: 20,
|
||||||
|
});
|
||||||
|
|
||||||
|
const compatibleViews = useMemo(
|
||||||
|
() =>
|
||||||
|
AVAILABLE_VIEWS.filter((v) =>
|
||||||
|
v.compatibleCollectionTypes.includes(
|
||||||
|
currentLibrary.data.CollectionType as any,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
[currentLibrary.data.CollectionType],
|
||||||
|
);
|
||||||
|
// Values from store
|
||||||
|
const sortBy = (storeSortBy ?? ItemSortBy.Name) as string;
|
||||||
|
const sortAscending = storeSortAscending ?? true;
|
||||||
|
const effectiveViewType = currentViewType as any;
|
||||||
|
const effectiveSortByRaw = sortBy;
|
||||||
|
const effectiveSortAscending = sortAscending;
|
||||||
|
|
||||||
|
const normalizedViewType = useMemo(() => {
|
||||||
|
const values = compatibleViews.map((v) => v.value);
|
||||||
|
if (effectiveViewType && values.includes(effectiveViewType as any))
|
||||||
|
return effectiveViewType as any;
|
||||||
|
return values[0] as BaseItemKind | "Artist";
|
||||||
|
}, [effectiveViewType, compatibleViews]);
|
||||||
|
|
||||||
|
const normalizedSortBy = useMemo(() => {
|
||||||
|
const compatibleOptions = SORT_BY_OPTIONS.filter(
|
||||||
|
(option) =>
|
||||||
|
option.compatibleViewTypes?.includes(normalizedViewType as any) ||
|
||||||
|
option.compatibleCollectionTypes?.includes(
|
||||||
|
currentLibrary.data.CollectionType as any,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
const compatibleValues = compatibleOptions.map((opt) =>
|
||||||
|
Array.isArray(opt.value) ? opt.value.join(",") : String(opt.value),
|
||||||
|
);
|
||||||
|
const current = String(effectiveSortByRaw ?? "");
|
||||||
|
if (current && compatibleValues.includes(current)) return current;
|
||||||
|
return compatibleValues[0] ?? String(ItemSortBy.Name);
|
||||||
|
}, [
|
||||||
|
effectiveSortByRaw,
|
||||||
|
normalizedViewType,
|
||||||
|
currentLibrary.data.CollectionType,
|
||||||
|
]);
|
||||||
|
|
||||||
|
const handleChangeViewType = (e: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
const next = e.target.value as unknown as BaseItemKind | "Artist";
|
||||||
|
if (currentLibraryId)
|
||||||
|
updateLibrary(currentLibraryId, { currentViewType: next });
|
||||||
|
};
|
||||||
|
const handleChangeSortBy = (e: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
const next = e.target.value as unknown as string;
|
||||||
|
if (currentLibraryId) updateLibrary(currentLibraryId, { sortBy: next });
|
||||||
|
};
|
||||||
|
const handleSortAscendingToggle = () => {
|
||||||
|
if (currentLibraryId)
|
||||||
|
updateLibrary(currentLibraryId, {
|
||||||
|
sortAscending: !effectiveSortAscending,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// (Video type multi-select temporarily removed; logic cleaned to reduce overhead.)
|
||||||
|
|
||||||
|
// Prefetch helpers to reduce perceived latency on sort changes
|
||||||
|
// filters, vts, nameStartsWith, genreIds are already selected above
|
||||||
|
// Prefetch handler will be attached on menu items below
|
||||||
|
const prefetchItems = useCallback(
|
||||||
|
async (sortByValue: string, asc: boolean) => {
|
||||||
|
if (!api || !user?.Id || !currentLibraryId || !normalizedViewType) return;
|
||||||
|
const key = [
|
||||||
|
"library",
|
||||||
|
"items",
|
||||||
|
currentLibraryId,
|
||||||
|
{
|
||||||
|
currentViewType: normalizedViewType,
|
||||||
|
sortAscending: asc,
|
||||||
|
sortBy: sortByValue,
|
||||||
|
filters,
|
||||||
|
videoTypesState: vts,
|
||||||
|
nameStartsWith,
|
||||||
|
genreIds,
|
||||||
|
},
|
||||||
|
] as const;
|
||||||
|
await queryClient.prefetchQuery({
|
||||||
|
queryKey: key,
|
||||||
|
queryFn: async () => {
|
||||||
|
const result = await getItemsApi(api).getItems({
|
||||||
|
userId: user.Id!,
|
||||||
|
parentId: currentLibraryId,
|
||||||
|
recursive: true,
|
||||||
|
includeItemTypes: [normalizedViewType as any],
|
||||||
|
sortOrder: [asc ? SortOrder.Ascending : SortOrder.Descending],
|
||||||
|
sortBy: String(sortByValue).split(",") as any,
|
||||||
|
enableUserData: true,
|
||||||
|
nameStartsWith: nameStartsWith || undefined,
|
||||||
|
genreIds: genreIds && genreIds.length > 0 ? genreIds : undefined,
|
||||||
|
});
|
||||||
|
return result.data;
|
||||||
|
},
|
||||||
|
staleTime: 5_000,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[
|
||||||
|
api,
|
||||||
|
user?.Id,
|
||||||
|
currentLibraryId,
|
||||||
|
normalizedViewType,
|
||||||
|
filters,
|
||||||
|
vts,
|
||||||
|
nameStartsWith,
|
||||||
|
genreIds,
|
||||||
|
queryClient,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
const disableSortOption = useMemo(
|
||||||
|
() =>
|
||||||
|
!normalizedViewType ||
|
||||||
|
!SORT_BY_OPTIONS.some(
|
||||||
|
(option) =>
|
||||||
|
option.compatibleViewTypes?.includes(normalizedViewType as any) ||
|
||||||
|
option.compatibleCollectionTypes?.includes(
|
||||||
|
currentLibrary.data.CollectionType as any,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
[normalizedViewType, currentLibrary.data.CollectionType],
|
||||||
|
);
|
||||||
|
|
||||||
|
const appBarStyling = useMemo(
|
||||||
|
() => ({ backgroundColor: "transparent", paddingRight: "0 !important" }),
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
|
// Read values from Zustand: name set by route, count set by grid
|
||||||
|
const libraryName = libraryNameFromStore ?? currentLibrary.data.Name;
|
||||||
|
const totalCount = itemsTotalCount;
|
||||||
|
|
||||||
|
const toggleSearchDialog = useSearchStore(
|
||||||
|
useShallow((s) => s.toggleSearchDialog),
|
||||||
|
);
|
||||||
|
const handleNavigateToHome = useCallback(
|
||||||
|
() => navigate({ to: "/home" }),
|
||||||
|
[navigate],
|
||||||
|
);
|
||||||
|
const handleNavigateToFavorite = useCallback(
|
||||||
|
() => navigate({ to: "/favorite" }),
|
||||||
|
[navigate],
|
||||||
|
);
|
||||||
|
|
||||||
|
const [showDrawer, setShowDrawer] = useState(false);
|
||||||
|
|
||||||
|
const handleDrawerClose = useCallback(() => {
|
||||||
|
setShowDrawer(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleDrawerOpen = useCallback(() => {
|
||||||
|
setShowDrawer(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AppBar
|
||||||
|
className={
|
||||||
|
scrollTrigger
|
||||||
|
? "library-header scrolling flex flex-row"
|
||||||
|
: "library-header flex flex-row"
|
||||||
|
}
|
||||||
|
style={appBarStyling}
|
||||||
|
elevation={0}
|
||||||
|
color="transparent"
|
||||||
|
>
|
||||||
|
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||||
|
<IconButton onClick={handleDrawerOpen}>
|
||||||
|
<div className="material-symbols-rounded">menu</div>
|
||||||
|
</IconButton>
|
||||||
|
<MemoizeBackButton />
|
||||||
|
<IconButton onClick={handleNavigateToHome}>
|
||||||
|
<div
|
||||||
|
className={
|
||||||
|
location.pathname === "/home"
|
||||||
|
? "material-symbols-rounded fill"
|
||||||
|
: "material-symbols-rounded"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
home
|
||||||
|
</div>
|
||||||
|
</IconButton>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="flex flex-row library-header-center"
|
||||||
|
style={{ gap: "0.6em" }}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="library-title-count flex flex-row flex-align-center"
|
||||||
|
title={`${libraryName}${typeof totalCount === "number" ? ` · ${totalCount.toLocaleString()} items` : ""}`}
|
||||||
|
>
|
||||||
|
<Typography variant="subtitle1" noWrap align="center">
|
||||||
|
{libraryName}
|
||||||
|
</Typography>
|
||||||
|
{typeof totalCount === "number" && (
|
||||||
|
<Chip label={totalCount} sx={{ px: 0.5, ml: 1 }} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<TextField
|
||||||
|
select
|
||||||
|
size="small"
|
||||||
|
value={String(normalizedViewType)}
|
||||||
|
onChange={handleChangeViewType}
|
||||||
|
SelectProps={{
|
||||||
|
MenuProps: {
|
||||||
|
PaperProps: {
|
||||||
|
className: "glass-menu-paper",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<MenuItem disabled value="">
|
||||||
|
<Typography variant="overline" color="textSecondary">
|
||||||
|
View
|
||||||
|
</Typography>
|
||||||
|
</MenuItem>
|
||||||
|
{compatibleViews.map((v) => (
|
||||||
|
<MenuItem key={String(v.value)} value={String(v.value)}>
|
||||||
|
{v.title}
|
||||||
|
</MenuItem>
|
||||||
|
))}
|
||||||
|
</TextField>
|
||||||
|
<IconButton
|
||||||
|
onClick={handleSortAscendingToggle}
|
||||||
|
aria-label="Toggle sort order"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="material-symbols-rounded"
|
||||||
|
style={{
|
||||||
|
transform: sortAscending ? "rotateX(0deg)" : "rotateX(180deg)",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
sort
|
||||||
|
</div>
|
||||||
|
</IconButton>
|
||||||
|
<TextField
|
||||||
|
select
|
||||||
|
size="small"
|
||||||
|
value={normalizedSortBy}
|
||||||
|
onChange={handleChangeSortBy}
|
||||||
|
disabled={disableSortOption}
|
||||||
|
SelectProps={{
|
||||||
|
MenuProps: {
|
||||||
|
PaperProps: {
|
||||||
|
className: "glass-menu-paper",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<MenuItem disabled value="">
|
||||||
|
<Typography variant="overline" color="textSecondary">
|
||||||
|
Sort By
|
||||||
|
</Typography>
|
||||||
|
</MenuItem>
|
||||||
|
{SORT_BY_OPTIONS.map((option) => {
|
||||||
|
const isCompatible =
|
||||||
|
option.compatibleViewTypes?.includes(currentViewType as any) ||
|
||||||
|
option.compatibleCollectionTypes?.includes(
|
||||||
|
currentLibrary.data.CollectionType as any,
|
||||||
|
);
|
||||||
|
if (!isCompatible) return null;
|
||||||
|
const valueStr = Array.isArray(option.value)
|
||||||
|
? option.value.join(",")
|
||||||
|
: option.value;
|
||||||
|
return (
|
||||||
|
<MenuItem
|
||||||
|
key={
|
||||||
|
Array.isArray(option.value)
|
||||||
|
? option.value.join(",")
|
||||||
|
: option.value
|
||||||
|
}
|
||||||
|
value={valueStr}
|
||||||
|
onMouseEnter={() =>
|
||||||
|
prefetchItems(String(valueStr), sortAscending)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{option.title}
|
||||||
|
</MenuItem>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</TextField>
|
||||||
|
<FiltersDialogTrigger />
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||||
|
<IconButton onClick={toggleSearchDialog}>
|
||||||
|
<div className="material-symbols-rounded">search</div>
|
||||||
|
</IconButton>
|
||||||
|
<IconButton onClick={handleNavigateToFavorite}>
|
||||||
|
<div className="material-symbols-rounded">favorite</div>
|
||||||
|
</IconButton>
|
||||||
|
<UserAvatarMenu />
|
||||||
|
</div>
|
||||||
|
</AppBar>
|
||||||
|
<NavigationDrawer open={showDrawer} onClose={handleDrawerClose} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
.library-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
inset: 1em 2em auto 2em !important;
|
||||||
|
border-radius: 9999px;
|
||||||
|
margin: 0 auto;
|
||||||
|
width: fit-content;
|
||||||
|
position: sticky;
|
||||||
|
width: calc(100vw - 4em) !important;
|
||||||
|
z-index: 10;
|
||||||
|
padding: 0.25em !important;
|
||||||
|
transition: all 0.2s ease-in-out;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
inset: -0.35em;
|
||||||
|
pointer-events: none;
|
||||||
|
border-radius: inherit;
|
||||||
|
@include glass-effect;
|
||||||
|
opacity: 0;
|
||||||
|
z-index: -1;
|
||||||
|
transition: all 150ms;
|
||||||
|
}
|
||||||
|
&.scrolling {
|
||||||
|
&::after {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,326 @@
|
|||||||
|
import {
|
||||||
|
type BaseItemDto,
|
||||||
|
BaseItemKind,
|
||||||
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import { useSuspenseQuery } from "@tanstack/react-query";
|
||||||
|
import { getRouteApi } from "@tanstack/react-router";
|
||||||
|
import { useWindowVirtualizer } from "@tanstack/react-virtual";
|
||||||
|
import React, {
|
||||||
|
useCallback,
|
||||||
|
useEffect,
|
||||||
|
useMemo,
|
||||||
|
useRef,
|
||||||
|
useState,
|
||||||
|
} from "react";
|
||||||
|
import "./libraryItemsGrid.scss";
|
||||||
|
import { useShallow } from "zustand/shallow";
|
||||||
|
import { getLibraryQueryOptions } from "@/utils/queries/library";
|
||||||
|
import { getLibraryItemsQueryOptions } from "@/utils/queries/libraryItems";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
import { useLibraryStateStore } from "@/utils/store/libraryState";
|
||||||
|
// @ts-expect-error: Vite worker import
|
||||||
|
import BackdropWorker from "@/utils/workers/backdrop.worker?worker";
|
||||||
|
import { Card } from "../card/card";
|
||||||
|
|
||||||
|
const libraryRoute = getRouteApi("/_api/library/$id");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Virtualized library items grid.
|
||||||
|
* Virtualizes vertical scrolling only; items are arranged into responsive columns.
|
||||||
|
* Assumptions:
|
||||||
|
* - Card aspect ratio handled by CSS; we approximate a fixed height for virtualization.
|
||||||
|
* - Width changes trigger re-measure via ResizeObserver.
|
||||||
|
* Future improvements:
|
||||||
|
* - Dynamic row height based on item type.
|
||||||
|
* - Horizontal virtualization for extremely wide displays.
|
||||||
|
*/
|
||||||
|
const LibraryItemsGrid = () => {
|
||||||
|
const api = useApiInContext((s) => s.api);
|
||||||
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
|
const { id: currentLibraryId } = libraryRoute.useParams();
|
||||||
|
const {
|
||||||
|
currentViewType,
|
||||||
|
sortAscending,
|
||||||
|
sortBy,
|
||||||
|
filters,
|
||||||
|
videoTypesState,
|
||||||
|
nameStartsWith,
|
||||||
|
genreIds,
|
||||||
|
} = useLibraryStateStore(
|
||||||
|
useShallow((s) => {
|
||||||
|
const slice = s.libraries[currentLibraryId || ""];
|
||||||
|
return {
|
||||||
|
currentViewType: slice?.currentViewType,
|
||||||
|
sortAscending: slice?.sortAscending ?? true,
|
||||||
|
sortBy: slice?.sortBy ?? "Name",
|
||||||
|
filters: slice?.filters,
|
||||||
|
videoTypesState: slice?.videoTypesState,
|
||||||
|
nameStartsWith: slice?.nameStartsWith,
|
||||||
|
genreIds: slice?.genreIds,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
const updateLibrary = useLibraryStateStore((s) => s.updateLibrary);
|
||||||
|
const currentLibrary = useSuspenseQuery(
|
||||||
|
getLibraryQueryOptions(api, user?.Id, currentLibraryId),
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (currentLibraryId && !currentViewType && currentLibrary.data?.Type) {
|
||||||
|
updateLibrary(currentLibraryId, {
|
||||||
|
currentViewType: currentLibrary.data.Type as BaseItemKind,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [
|
||||||
|
currentLibrary.data?.Type,
|
||||||
|
currentLibraryId,
|
||||||
|
currentViewType,
|
||||||
|
updateLibrary,
|
||||||
|
]);
|
||||||
|
|
||||||
|
const items = useSuspenseQuery(
|
||||||
|
getLibraryItemsQueryOptions(api, user?.Id, currentLibraryId, {
|
||||||
|
currentViewType,
|
||||||
|
sortAscending,
|
||||||
|
sortBy,
|
||||||
|
filters,
|
||||||
|
videoTypesState,
|
||||||
|
nameStartsWith,
|
||||||
|
genreIds,
|
||||||
|
collectionType: currentLibrary.data.CollectionType as any,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
// --- Backdrop ---
|
||||||
|
const setBackdrop = useBackdropStore(useShallow((s) => s.setBackdrop));
|
||||||
|
const backdropItems = useMemo<BaseItemDto[]>(() => {
|
||||||
|
if (!items.isSuccess || !items.data?.Items) return [];
|
||||||
|
return items.data.Items.filter(
|
||||||
|
(item) => Object.keys(item.ImageBlurHashes?.Backdrop ?? {}).length > 0,
|
||||||
|
);
|
||||||
|
}, [items.isSuccess, items.data?.Items]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const worker = new BackdropWorker();
|
||||||
|
|
||||||
|
worker.onmessage = (event: MessageEvent) => {
|
||||||
|
if (event.data.type === "UPDATE_BACKDROP") {
|
||||||
|
const schedule =
|
||||||
|
(window as any).requestIdleCallback || window.requestAnimationFrame;
|
||||||
|
schedule(() => setBackdrop(event.data.payload));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (backdropItems.length > 0) {
|
||||||
|
worker.postMessage({
|
||||||
|
type: "SET_BACKDROP_ITEMS",
|
||||||
|
payload: backdropItems,
|
||||||
|
});
|
||||||
|
worker.postMessage({ type: "START" });
|
||||||
|
}
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
worker.postMessage({ type: "STOP" });
|
||||||
|
worker.terminate();
|
||||||
|
};
|
||||||
|
}, [backdropItems, setBackdrop]);
|
||||||
|
// --- Virtualization setup ---
|
||||||
|
const parentRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
const [containerWidth, setContainerWidth] = useState<number>(0);
|
||||||
|
|
||||||
|
// Determine column count based on container width (simple heuristic)
|
||||||
|
const [columns, setColumns] = useState(1);
|
||||||
|
const measureColumns = useCallback(() => {
|
||||||
|
if (!parentRef.current) return;
|
||||||
|
const width = parentRef.current.clientWidth;
|
||||||
|
setContainerWidth(width);
|
||||||
|
// Base desired approximate card width (including gap) 180px
|
||||||
|
const ideal = Math.max(1, Math.floor(width / 180));
|
||||||
|
setColumns(ideal);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
measureColumns();
|
||||||
|
if (!parentRef.current) return;
|
||||||
|
|
||||||
|
const ro = new ResizeObserver(() => measureColumns());
|
||||||
|
ro.observe(parentRef.current);
|
||||||
|
return () => ro.disconnect();
|
||||||
|
}, [measureColumns]);
|
||||||
|
|
||||||
|
const itemCount = items.data?.Items?.length ?? 0;
|
||||||
|
// Compute number of virtual rows
|
||||||
|
const rowCount = Math.ceil(itemCount / columns);
|
||||||
|
|
||||||
|
// Estimated row height (depends on card type). Using 260px as base (portrait taller)
|
||||||
|
// Compute card width minus gaps
|
||||||
|
const cardGap = 16; // px gap between cards
|
||||||
|
const cardWidth = useMemo(() => {
|
||||||
|
if (columns <= 0) return 180;
|
||||||
|
const totalGap = (columns - 1) * cardGap;
|
||||||
|
return Math.floor((containerWidth - totalGap) / columns);
|
||||||
|
}, [columns, containerWidth]);
|
||||||
|
|
||||||
|
// Approximate tallest card height (portrait ratio ~ 2:3 => height ≈ width / 0.666) + text/footer area
|
||||||
|
// We add a small buffer (20px) for hover overlays and progress bars
|
||||||
|
const estimatedTallCardHeight = useMemo(
|
||||||
|
() => Math.round(cardWidth / 0.666666 + 90),
|
||||||
|
[cardWidth],
|
||||||
|
);
|
||||||
|
|
||||||
|
const estimateRowHeight = useCallback(
|
||||||
|
() => estimatedTallCardHeight,
|
||||||
|
[estimatedTallCardHeight],
|
||||||
|
);
|
||||||
|
|
||||||
|
const virtualizer = useWindowVirtualizer({
|
||||||
|
count: rowCount,
|
||||||
|
estimateSize: estimateRowHeight,
|
||||||
|
overscan: 6,
|
||||||
|
scrollMargin: parentRef.current?.offsetTop ?? 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
const virtualItems = virtualizer.getVirtualItems();
|
||||||
|
|
||||||
|
// Update count in Zustand so header can display it without extra fetches
|
||||||
|
useEffect(() => {
|
||||||
|
const total = items.data?.TotalRecordCount;
|
||||||
|
if (currentLibraryId && typeof total === "number") {
|
||||||
|
updateLibrary(currentLibraryId, { itemsTotalCount: total });
|
||||||
|
}
|
||||||
|
}, [items.data?.TotalRecordCount, currentLibraryId, updateLibrary]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
ref={parentRef}
|
||||||
|
className="library-items-container virtualized"
|
||||||
|
style={{ position: "relative" }}
|
||||||
|
>
|
||||||
|
{items.isSuccess && itemCount === 0 ? (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
minHeight: 240,
|
||||||
|
width: "100%",
|
||||||
|
opacity: 0.8,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div style={{ textAlign: "center" }}>
|
||||||
|
<div
|
||||||
|
className="material-symbols-rounded"
|
||||||
|
style={{ fontSize: 48, marginBottom: 8 }}
|
||||||
|
>
|
||||||
|
sentiment_dissatisfied
|
||||||
|
</div>
|
||||||
|
<div style={{ fontSize: 16 }}>No items to show</div>
|
||||||
|
<div style={{ fontSize: 13, marginTop: 6 }}>
|
||||||
|
Try adjusting filters, sort, or the A–Z selector.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
position: "relative",
|
||||||
|
height: virtualizer.getTotalSize(),
|
||||||
|
width: "100%",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{virtualItems.map((row) => {
|
||||||
|
const startIndex = row.index * columns;
|
||||||
|
const endIndex = Math.min(startIndex + columns, itemCount);
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
key={row.key}
|
||||||
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
transform: `translateY(${
|
||||||
|
row.start - virtualizer.options.scrollMargin
|
||||||
|
}px)`,
|
||||||
|
left: 0,
|
||||||
|
width: "100%",
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "row",
|
||||||
|
alignItems: "flex-start",
|
||||||
|
gap: `${cardGap}px`,
|
||||||
|
// Allow natural height; virtualizer will update size after measurement.
|
||||||
|
paddingBottom: "0.6em",
|
||||||
|
}}
|
||||||
|
data-index={row.index}
|
||||||
|
ref={(el) => {
|
||||||
|
if (el) virtualizer.measureElement(el);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{items.data?.Items?.slice(startIndex, endIndex).map(
|
||||||
|
(item: BaseItemDto, localIndex: number) => {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
key={item?.Id ?? localIndex}
|
||||||
|
style={{
|
||||||
|
width: `${cardWidth}px`,
|
||||||
|
flex: "0 0 auto",
|
||||||
|
// Override default card margins to avoid compounding with gaps
|
||||||
|
margin: 0,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Card
|
||||||
|
item={item}
|
||||||
|
seriesId={item?.SeriesId}
|
||||||
|
skipInView
|
||||||
|
cardTitle={
|
||||||
|
item?.Type === BaseItemKind.Episode
|
||||||
|
? item.SeriesName
|
||||||
|
: item?.Name
|
||||||
|
}
|
||||||
|
imageType={"Primary"}
|
||||||
|
cardCaption={
|
||||||
|
item?.Type === BaseItemKind.Episode
|
||||||
|
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`
|
||||||
|
: item?.Type === BaseItemKind.Series
|
||||||
|
? `${item.ProductionYear} - ${
|
||||||
|
item.EndDate
|
||||||
|
? new Date(item.EndDate).toLocaleString(
|
||||||
|
[],
|
||||||
|
{
|
||||||
|
year: "numeric",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: "Present"
|
||||||
|
}`
|
||||||
|
: item?.ProductionYear
|
||||||
|
}
|
||||||
|
disableOverlay={
|
||||||
|
item?.Type === BaseItemKind.Person ||
|
||||||
|
item?.Type === BaseItemKind.Genre ||
|
||||||
|
item?.Type === BaseItemKind.MusicGenre ||
|
||||||
|
item?.Type === BaseItemKind.Studio
|
||||||
|
}
|
||||||
|
cardType={
|
||||||
|
item?.Type === BaseItemKind.MusicAlbum ||
|
||||||
|
item?.Type === BaseItemKind.Audio ||
|
||||||
|
item?.Type === BaseItemKind.Genre ||
|
||||||
|
item?.Type === BaseItemKind.MusicGenre ||
|
||||||
|
item?.Type === BaseItemKind.Studio ||
|
||||||
|
item?.Type === BaseItemKind.Playlist
|
||||||
|
? "square"
|
||||||
|
: "portrait"
|
||||||
|
}
|
||||||
|
userId={user?.Id}
|
||||||
|
// Inline style overrides to neutralize original margins for virtualization
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default LibraryItemsGrid;
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
// Overrides for virtualized library items layout to prevent horizontal overflow
|
||||||
|
.library-items-container.virtualized {
|
||||||
|
overflow-x: hidden;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
|
display: block !important; // override grid from route styles
|
||||||
|
padding: 0 !important; // override padding from route styles
|
||||||
|
position: relative; // required for absolutely positioned rows
|
||||||
|
gap: 0 !important;
|
||||||
|
justify-items: normal !important;
|
||||||
|
align-content: stretch !important;
|
||||||
|
> .card {
|
||||||
|
max-width: none !important;
|
||||||
|
}
|
||||||
|
// Ensure no unintended padding expands width
|
||||||
|
padding-right: 0;
|
||||||
|
padding-left: 0;
|
||||||
|
.card {
|
||||||
|
margin-right: 0 !important;
|
||||||
|
margin-bottom: 0.6em !important; // keep a consistent vertical rhythm
|
||||||
|
}
|
||||||
|
.card-image-container {
|
||||||
|
// Remove box shadow spread from affecting layout width calculation
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// When page has audio-playing class, avoid extra bottom padding causing scrollbars
|
||||||
|
.audio-playing .library-items-container.virtualized {
|
||||||
|
padding-bottom: 8em; // mimic original intent without affecting width
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import {
|
||||||
|
ListItem,
|
||||||
|
ListItemButton,
|
||||||
|
type ListItemProps,
|
||||||
|
ListItemText,
|
||||||
|
} from "@mui/material";
|
||||||
|
import { createLink, Link } from "@tanstack/react-router";
|
||||||
|
import React, { forwardRef, type ReactNode } from "react";
|
||||||
|
|
||||||
|
interface MUIListItemLinkProps extends ListItemProps<"a"> {
|
||||||
|
icon?: ReactNode;
|
||||||
|
primary: string;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const CreatedListItemLink = forwardRef<HTMLAnchorElement, MUIListItemLinkProps>(
|
||||||
|
(props, ref) => (
|
||||||
|
<ListItem component="a" ref={ref} {...props}>
|
||||||
|
<ListItemButton
|
||||||
|
sx={{
|
||||||
|
color: "inherit",
|
||||||
|
textDecoration: "none",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className="material-symbols-rounded">{props.icon}</div>
|
||||||
|
<ListItemText primary={props.primary} />
|
||||||
|
</ListItemButton>
|
||||||
|
</ListItem>
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
const ListItemLink = createLink(CreatedListItemLink);
|
||||||
|
|
||||||
|
export default ListItemLink;
|
||||||
|
|
||||||
|
/* export default function ListItemLink(props: ListItemLinkProps) {
|
||||||
|
const { icon, primary, to, className } = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<li>
|
||||||
|
{/* @ts-expect-error /*}
|
||||||
|
<ListItem
|
||||||
|
component={Link}
|
||||||
|
activeClassName="active"
|
||||||
|
className={className}
|
||||||
|
to={to}
|
||||||
|
>
|
||||||
|
<ListItemButton
|
||||||
|
style={{
|
||||||
|
borderRadius: "100px",
|
||||||
|
gap: "0.85em",
|
||||||
|
color: "white",
|
||||||
|
textDecoration: "none",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className="material-symbols-rounded">{icon}</div>
|
||||||
|
<ListItemText primary={primary} />
|
||||||
|
</ListItemButton>
|
||||||
|
</ListItem>
|
||||||
|
</li>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
*/
|
||||||
@@ -4,29 +4,16 @@ import { getRuntimeMusic } from "../../utils/date/time";
|
|||||||
import { useAudioPlayback } from "../../utils/store/audioPlayback";
|
import { useAudioPlayback } from "../../utils/store/audioPlayback";
|
||||||
import LikeButton from "../buttons/likeButton";
|
import LikeButton from "../buttons/likeButton";
|
||||||
import PlayButton from "../buttons/playButton";
|
import PlayButton from "../buttons/playButton";
|
||||||
import TextLink from "../textLink";
|
|
||||||
import "./musicTrack.scss";
|
import "./musicTrack.scss";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
import type { QueryKey } from "@tanstack/react-query";
|
import { Link } from "@tanstack/react-router";
|
||||||
import lyrics_icon from "../../assets/icons/lyrics.svg";
|
import lyrics_icon from "../../assets/icons/lyrics.svg";
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} Props
|
|
||||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemDto} item
|
|
||||||
* @property {Array} queryKey
|
|
||||||
* @property {string} userId
|
|
||||||
* @property {bool} playlistItem
|
|
||||||
* @property {number} trackIndex
|
|
||||||
* @property {string | undefined} playlistItemId
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Music Track element displayed in ArtistTitlePage and Songs library
|
* @description Music Track element displayed in ArtistTitlePage and Songs library
|
||||||
* @param {Props}
|
|
||||||
* @returns {React.Component}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const MusicTrack = ({
|
const MusicTrack = ({
|
||||||
item,
|
item,
|
||||||
queryKey,
|
queryKey,
|
||||||
@@ -37,12 +24,12 @@ const MusicTrack = ({
|
|||||||
className = "",
|
className = "",
|
||||||
}: {
|
}: {
|
||||||
item: BaseItemDto;
|
item: BaseItemDto;
|
||||||
queryKey: QueryKey;
|
queryKey: string[];
|
||||||
userId: string | undefined;
|
userId?: string | undefined;
|
||||||
playlistItem: boolean;
|
playlistItem?: boolean;
|
||||||
playlistItemId: string;
|
playlistItemId?: string;
|
||||||
trackIndex: number;
|
trackIndex?: number;
|
||||||
className: string;
|
className?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const [currentTrackItem] = useAudioPlayback((state) => [state.item]);
|
const [currentTrackItem] = useAudioPlayback((state) => [state.item]);
|
||||||
@@ -59,16 +46,21 @@ const MusicTrack = ({
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<img
|
<img
|
||||||
alt={item.Name}
|
alt={item.Name ?? "Music Track"}
|
||||||
src={api.getItemImageUrl(
|
src={
|
||||||
Object.keys(item.ImageTags).length === 0 ? item.AlbumId : item.Id,
|
api &&
|
||||||
"Primary",
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
{
|
(Object.keys(item.ImageTags ?? {}).length === 0
|
||||||
quality: 70,
|
? item.AlbumId
|
||||||
fillHeight: 128,
|
: item.Id) ?? "",
|
||||||
fillWidth: 128,
|
"Primary",
|
||||||
},
|
{
|
||||||
)}
|
quality: 70,
|
||||||
|
fillHeight: 128,
|
||||||
|
fillWidth: 128,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
style={{
|
style={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
height: "100%",
|
height: "100%",
|
||||||
@@ -76,14 +68,14 @@ const MusicTrack = ({
|
|||||||
opacity: 0,
|
opacity: 0,
|
||||||
}}
|
}}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.target.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<div className="music-track-image-overlay">
|
<div className="music-track-image-overlay">
|
||||||
<PlayButton
|
<PlayButton
|
||||||
itemId={item.Id}
|
item={item}
|
||||||
|
itemType="Audio"
|
||||||
userId={userId}
|
userId={userId}
|
||||||
itemType={item.Type}
|
|
||||||
size="small"
|
size="small"
|
||||||
iconOnly
|
iconOnly
|
||||||
audio
|
audio
|
||||||
@@ -118,21 +110,26 @@ const MusicTrack = ({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{item.ArtistItems?.map((artist, index) => (
|
{item.ArtistItems?.map((artist, index) => (
|
||||||
<>
|
<span
|
||||||
<TextLink
|
style={{ display: "inline-flex", alignItems: "center" }}
|
||||||
key={index}
|
key={artist.Id}
|
||||||
variant={"subtitle2"}
|
>
|
||||||
location={`/artist/${artist.Id}`}
|
<Typography
|
||||||
otherProps={{
|
variant="subtitle2"
|
||||||
fontWeight: 400,
|
fontWeight="400"
|
||||||
style: {
|
style={{
|
||||||
textDecoration: "none",
|
textDecoration: "none",
|
||||||
},
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{artist.Name}
|
<Link
|
||||||
</TextLink>
|
style={{ textDecoration: "none", color: "white" }}
|
||||||
{index !== item.ArtistItems.length - 1 && (
|
to="/artist/$id"
|
||||||
|
params={{ id: artist.Id ?? "" }}
|
||||||
|
>
|
||||||
|
{artist.Name}
|
||||||
|
</Link>
|
||||||
|
</Typography>
|
||||||
|
{index !== (item.ArtistItems?.length ?? 0) - 1 && (
|
||||||
<span
|
<span
|
||||||
style={{
|
style={{
|
||||||
whiteSpace: "pre",
|
whiteSpace: "pre",
|
||||||
@@ -141,12 +138,12 @@ const MusicTrack = ({
|
|||||||
,{" "}
|
,{" "}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</>
|
</span>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Typography variant="subtitl1">
|
<Typography variant="subtitle1">
|
||||||
{getRuntimeMusic(item.RunTimeTicks)}
|
{getRuntimeMusic(item.RunTimeTicks ?? 0)}
|
||||||
</Typography>
|
</Typography>
|
||||||
<LikeButton
|
<LikeButton
|
||||||
itemId={item.Id}
|
itemId={item.Id}
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
aspect-ratio: 1;
|
aspect-ratio: 1;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 4em;
|
width: 4em;
|
||||||
|
box-shadow: 0 0 10px rgb(0 0 0 / 0.2);
|
||||||
|
transition: opacity $transition-time-default;
|
||||||
&-overlay {
|
&-overlay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
@@ -39,8 +41,6 @@
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity $transition-time-fast;
|
transition: opacity $transition-time-fast;
|
||||||
}
|
}
|
||||||
box-shadow: 0 0 10px rgb(0 0 0 / 0.2);
|
|
||||||
transition: opacity $transition-time-default;
|
|
||||||
}
|
}
|
||||||
&-info {
|
&-info {
|
||||||
justify-self: start;
|
justify-self: start;
|
||||||
|
|||||||
@@ -1,27 +1,40 @@
|
|||||||
import { LinearProgress } from "@mui/material";
|
import { LinearProgress } from "@mui/material";
|
||||||
import { useNProgress } from "@tanem/react-nprogress";
|
import { useNProgress } from "@tanem/react-nprogress";
|
||||||
import type React from "react";
|
import { useIsFetching, useIsMutating } from "@tanstack/react-query";
|
||||||
|
import { useRouterState } from "@tanstack/react-router";
|
||||||
|
import React, { useMemo } from "react";
|
||||||
|
import { createPortal } from "react-dom";
|
||||||
|
|
||||||
|
export default function NProgress() {
|
||||||
|
const isQueryFetching = useIsFetching();
|
||||||
|
const isMutating = useIsMutating();
|
||||||
|
const routeIsLoading = useRouterState().isLoading;
|
||||||
|
|
||||||
|
const isAnimating = useMemo(() => {
|
||||||
|
if (isQueryFetching || isMutating || routeIsLoading) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}, [isQueryFetching, isMutating, routeIsLoading]);
|
||||||
|
|
||||||
const NProgress: React.FC<{ isAnimating: boolean | number }> = ({
|
|
||||||
isAnimating,
|
|
||||||
}) => {
|
|
||||||
const { animationDuration, isFinished, progress } = useNProgress({
|
const { animationDuration, isFinished, progress } = useNProgress({
|
||||||
isAnimating,
|
isAnimating,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isAnimating) {
|
return (
|
||||||
return (
|
<div
|
||||||
<div
|
style={{
|
||||||
style={{
|
pointerEvents: "none",
|
||||||
pointerEvents: "none",
|
transition: "opacity 250ms linear",
|
||||||
transition: `opacity ${animationDuration}ms linear`,
|
position: "fixed",
|
||||||
position: "fixed",
|
top: "0",
|
||||||
top: "0",
|
left: "0",
|
||||||
left: "0",
|
right: "0",
|
||||||
right: "0",
|
zIndex: "10001",
|
||||||
zIndex: "10001",
|
opacity: isFinished ? 0 : 1,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
{isAnimating && (
|
||||||
<LinearProgress
|
<LinearProgress
|
||||||
sx={{
|
sx={{
|
||||||
height: 3,
|
height: 3,
|
||||||
@@ -30,9 +43,8 @@ const NProgress: React.FC<{ isAnimating: boolean | number }> = ({
|
|||||||
value={progress * 100}
|
value={progress * 100}
|
||||||
variant="determinate"
|
variant="determinate"
|
||||||
/>
|
/>
|
||||||
</div>
|
)}
|
||||||
);
|
</div>
|
||||||
}
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default NProgress;
|
|
||||||
@@ -4,7 +4,7 @@ import Typography from "@mui/material/Typography";
|
|||||||
import { yellow } from "@mui/material/colors";
|
import { yellow } from "@mui/material/colors";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
export const EmptyNotice = ({ extraMsg }) => {
|
export const EmptyNotice = ({ extraMsg }: { extraMsg?: string }) => {
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import Button from "@mui/material/Button";
|
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import { red } from "@mui/material/colors";
|
import { red } from "@mui/material/colors";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
export const ErrorNotice = ({ error }) => {
|
export const ErrorNotice = ({ error }: { error?: Error }) => {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@@ -23,14 +22,15 @@ export const ErrorNotice = ({ error }) => {
|
|||||||
style={{
|
style={{
|
||||||
fontSize: "10em",
|
fontSize: "10em",
|
||||||
color: red[800],
|
color: red[800],
|
||||||
|
//@ts-ignore
|
||||||
"--clr": "rgb(198 40 40 / 30%)",
|
"--clr": "rgb(198 40 40 / 30%)",
|
||||||
fontVariationSettings: '"FILL" 1, "wght" 400, "GRAD" 25, "opsz" 60',
|
fontVariationSettings: '"FILL" 1, "wght" 400, "GRAD" 25, "opsz" 60',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
error
|
error
|
||||||
</div>
|
</div>
|
||||||
<Typography variant="h3" fontWeight={300}>
|
<Typography variant="h3" color="white" fontWeight={300}>
|
||||||
Something went wrong
|
Something went wrong.
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
fontFamily="JetBrains Mono Variable"
|
fontFamily="JetBrains Mono Variable"
|
||||||
@@ -42,11 +42,14 @@ export const ErrorNotice = ({ error }) => {
|
|||||||
borderRadius: "8px",
|
borderRadius: "8px",
|
||||||
border: "2px dashed rgb(255 255 255 / 0.5)",
|
border: "2px dashed rgb(255 255 255 / 0.5)",
|
||||||
maxWidth: "40em",
|
maxWidth: "40em",
|
||||||
|
maxHeight: "20em",
|
||||||
|
overflow: "auto",
|
||||||
marginTop: "1em",
|
marginTop: "1em",
|
||||||
// opacity: 0.6,
|
// opacity: 0.6,
|
||||||
}}
|
}}
|
||||||
|
color="gray"
|
||||||
>
|
>
|
||||||
{JSON.stringify(error.message)}
|
{JSON.stringify(error?.stack)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { playItemFromQueue, usePlaybackStore } from "@/utils/store/playback";
|
import { playItemFromQueue } from "@/utils/store/playback";
|
||||||
import useQueue from "@/utils/store/queue";
|
import useQueue from "@/utils/store/queue";
|
||||||
import { Button, Typography } from "@mui/material";
|
import { Button, Typography } from "@mui/material";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
import { getTypeIcon } from "../utils/iconsCollection";
|
||||||
|
|
||||||
import "./outroCard.scss";
|
import "./outroCard.scss";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
import { useMutation } from "@tanstack/react-query";
|
||||||
|
|
||||||
const OutroCard = (props: { handleShowCredits: () => void }) => {
|
const OutroCard = (props: { handleShowCredits: () => void }) => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
@@ -15,19 +16,14 @@ const OutroCard = (props: { handleShowCredits: () => void }) => {
|
|||||||
s.currentItemIndex,
|
s.currentItemIndex,
|
||||||
s.tracks,
|
s.tracks,
|
||||||
]);
|
]);
|
||||||
const item = queueItems[nextItemIndex + 1];
|
const item = queueItems?.[nextItemIndex + 1];
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const result = await getUserApi(api).getCurrentUser();
|
|
||||||
return result.data;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const handlePlayNext = useMutation({
|
const handlePlayNext = useMutation({
|
||||||
mutationKey: ["playNextButton"],
|
mutationKey: ["playNextButton"],
|
||||||
mutationFn: () => playItemFromQueue("next", user.data?.Id, api),
|
mutationFn: () => playItemFromQueue("next", user?.Id, api),
|
||||||
onError: (error) => [console.error(error)],
|
onError: (error) => [console.error(error)],
|
||||||
});
|
});
|
||||||
|
if (!item || !item.Type) return null;
|
||||||
return (
|
return (
|
||||||
<div className="outro-card">
|
<div className="outro-card">
|
||||||
<Typography variant="h4">Up Next</Typography>
|
<Typography variant="h4">Up Next</Typography>
|
||||||
@@ -36,14 +32,21 @@ const OutroCard = (props: { handleShowCredits: () => void }) => {
|
|||||||
<img
|
<img
|
||||||
className="outro-card-content-image"
|
className="outro-card-content-image"
|
||||||
alt={item.Name ?? "Cover"}
|
alt={item.Name ?? "Cover"}
|
||||||
src={api.getItemImageUrl(item.Id, "Primary", {
|
src={
|
||||||
tag: item.ImageTags.Primary,
|
api &&
|
||||||
quality: 80,
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
})}
|
item.Id ?? "",
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
|
tag: item.ImageTags.Primary,
|
||||||
|
quality: 80,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="outro-card-content-image icon">
|
<div className="outro-card-content-image icon">
|
||||||
{getTypeIcon(item?.Type)}
|
{getTypeIcon(item.Type)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<Typography variant="h5" className="outro-card-content-title">
|
<Typography variant="h5" className="outro-card-content-title">
|
||||||
@@ -55,6 +58,7 @@ const OutroCard = (props: { handleShowCredits: () => void }) => {
|
|||||||
<div className="outro-card-content-buttons">
|
<div className="outro-card-content-buttons">
|
||||||
<Button
|
<Button
|
||||||
onClick={handlePlayNext.mutate}
|
onClick={handlePlayNext.mutate}
|
||||||
|
//@ts-ignore
|
||||||
color="white"
|
color="white"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
startIcon={
|
startIcon={
|
||||||
@@ -73,6 +77,7 @@ const OutroCard = (props: { handleShowCredits: () => void }) => {
|
|||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={props.handleShowCredits}
|
onClick={props.handleShowCredits}
|
||||||
|
//@ts-ignore
|
||||||
color="white"
|
color="white"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
&-image {
|
&-image {
|
||||||
grid-area: img;
|
grid-area: img;
|
||||||
max-height: 14em;
|
aspect-ratio: 16/9;
|
||||||
width: 20em;
|
width: 20em;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
border-radius: $border-radius-default;
|
border-radius: $border-radius-default;
|
||||||
|
|||||||
@@ -2,15 +2,40 @@ $image-size: 4em;
|
|||||||
|
|
||||||
.audio-player {
|
.audio-player {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 1rem;
|
||||||
right: 0;
|
left: 50%;
|
||||||
z-index: 10;
|
transform: translateX(-50%);
|
||||||
|
width: 95%;
|
||||||
|
max-width: 1200px;
|
||||||
|
z-index: 100;
|
||||||
display: grid;
|
display: grid;
|
||||||
padding: 0.5em 1.5em;
|
padding: 0.75em 1.5em;
|
||||||
gap: 1em;
|
gap: 1.5em;
|
||||||
box-shadow: 0 0 20px rgb(0 0 0 / 0.25);
|
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
|
||||||
grid-template-columns: 30% 1fr 30%;
|
grid-template-columns: 25% 1fr 25%;
|
||||||
background: rgb(0 0 0 / 0.8) !important;
|
@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;
|
||||||
|
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
grid-template-columns: 1fr auto;
|
||||||
|
padding: 0.5em 1em;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 0;
|
||||||
|
border-bottom: none;
|
||||||
|
border-left: none;
|
||||||
|
border-right: none;
|
||||||
|
|
||||||
|
.audio-player-controls {
|
||||||
|
display: none; // Hide controls on mobile for now or adjust
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#waveform {
|
#waveform {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
transform: scaleY(0);
|
transform: scaleY(0);
|
||||||
@@ -36,6 +61,13 @@ $image-size: 4em;
|
|||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
|
&-text {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
&-image {
|
&-image {
|
||||||
width: $image-size;
|
width: $image-size;
|
||||||
|
|||||||
@@ -0,0 +1,104 @@
|
|||||||
|
import type { Api } from "@jellyfin/sdk";
|
||||||
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import { getLyricsApi } from "@jellyfin/sdk/lib/utils/api/lyrics-api";
|
||||||
|
import { Typography } from "@mui/material";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
|
import { secToTicks } from "@/utils/date/time";
|
||||||
|
|
||||||
|
interface LyricsPanelProps {
|
||||||
|
item: BaseItemDto | undefined | null;
|
||||||
|
api: Api | undefined;
|
||||||
|
currentTime: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const LyricsPanel = ({ item, api, currentTime }: LyricsPanelProps) => {
|
||||||
|
const lyricsContainer = useRef<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
|
const lyrics = useQuery({
|
||||||
|
queryKey: ["player", "audio", item?.Id, "lyrics"],
|
||||||
|
queryFn: async () => {
|
||||||
|
if (!item?.Id || !api) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const response = await getLyricsApi(api).getLyrics({
|
||||||
|
itemId: item?.Id,
|
||||||
|
});
|
||||||
|
return response.data;
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Failed to fetch lyrics", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
enabled: Boolean(item?.Id) && Boolean(api),
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (lyrics.data && lyricsContainer.current) {
|
||||||
|
const currentLyric = lyricsContainer.current.querySelector(
|
||||||
|
"[data-active-lyric='true']",
|
||||||
|
);
|
||||||
|
if (currentLyric) {
|
||||||
|
currentLyric.scrollIntoView({
|
||||||
|
block: "center",
|
||||||
|
inline: "nearest",
|
||||||
|
behavior: "smooth",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [currentTime, lyrics.data]);
|
||||||
|
|
||||||
|
if (lyrics.isLoading) {
|
||||||
|
return (
|
||||||
|
<div className="audio-lyrics-status">
|
||||||
|
<Typography>Loading lyrics...</Typography>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lyrics.isError || !lyrics.data || !lyrics.data.Lyrics?.length) {
|
||||||
|
return (
|
||||||
|
<div className="audio-lyrics-status">
|
||||||
|
<Typography>No lyrics available</Typography>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const hasSyncedLyrics = (lyrics.data.Lyrics[0].Start ?? -1) >= 0;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="audio-lyrics" data-has-synced-lyrics={hasSyncedLyrics}>
|
||||||
|
<div className="audio-lyrics-container" ref={lyricsContainer}>
|
||||||
|
{lyrics.data.Lyrics.map((lyric, index) => {
|
||||||
|
const isActive =
|
||||||
|
hasSyncedLyrics &&
|
||||||
|
secToTicks(currentTime) >= (lyric.Start ?? 0) &&
|
||||||
|
secToTicks(currentTime) <
|
||||||
|
(lyrics.data?.Lyrics?.[index + 1]?.Start ??
|
||||||
|
Number.POSITIVE_INFINITY);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Typography
|
||||||
|
variant="body1"
|
||||||
|
component="p"
|
||||||
|
className={`audio-lyrics-line ${isActive ? "active" : ""}`}
|
||||||
|
key={`${lyric.Text}-${index}`}
|
||||||
|
data-active-lyric={isActive}
|
||||||
|
>
|
||||||
|
{lyric.Text}
|
||||||
|
</Typography>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
{!hasSyncedLyrics && (
|
||||||
|
<div className="audio-lyrics-unsynced-notice">
|
||||||
|
<span className="material-symbols-rounded">info</span>
|
||||||
|
<Typography variant="caption">Synced lyrics not available</Typography>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default React.memo(LyricsPanel);
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import IconButton from "@mui/material/IconButton";
|
||||||
|
import type { ReactNode } from "react";
|
||||||
|
import React from "react";
|
||||||
|
import QueueButton from "@/components/buttons/queueButton";
|
||||||
|
|
||||||
|
interface PlayerActionsProps {
|
||||||
|
onNavigate: () => void;
|
||||||
|
onClose: () => void;
|
||||||
|
children?: ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
const PlayerActions = ({
|
||||||
|
onNavigate,
|
||||||
|
onClose,
|
||||||
|
children,
|
||||||
|
}: PlayerActionsProps) => {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "flex-end",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconButton onClick={onNavigate}>
|
||||||
|
<span className="material-symbols-rounded">info</span>
|
||||||
|
</IconButton>
|
||||||
|
<QueueButton />
|
||||||
|
{children}
|
||||||
|
<IconButton onClick={onClose}>
|
||||||
|
<div className="material-symbols-rounded">close</div>
|
||||||
|
</IconButton>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PlayerActions;
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
import Fab from "@mui/material/Fab";
|
||||||
|
import IconButton from "@mui/material/IconButton";
|
||||||
|
import React from "react";
|
||||||
|
import PlayNextButton from "@/components/buttons/playNextButton";
|
||||||
|
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
||||||
|
|
||||||
|
interface PlayerControlsProps {
|
||||||
|
playing: boolean;
|
||||||
|
onPlayPause: () => void;
|
||||||
|
size?: "small" | "medium" | "large";
|
||||||
|
onRewind?: () => void;
|
||||||
|
onForward?: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const PlayerControls = ({
|
||||||
|
playing,
|
||||||
|
onPlayPause,
|
||||||
|
size = "small",
|
||||||
|
onRewind,
|
||||||
|
onForward,
|
||||||
|
}: PlayerControlsProps) => {
|
||||||
|
return (
|
||||||
|
<div style={{ display: "flex", gap: "1em", alignItems: "center" }}>
|
||||||
|
<PlayPreviousButton />
|
||||||
|
{onRewind && (
|
||||||
|
<IconButton onClick={onRewind}>
|
||||||
|
<span className="material-symbols-rounded">fast_rewind</span>
|
||||||
|
</IconButton>
|
||||||
|
)}
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "inline-flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
position: "relative",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Fab size={size} onClick={onPlayPause}>
|
||||||
|
<div
|
||||||
|
className="material-symbols-rounded"
|
||||||
|
style={{
|
||||||
|
fontSize: size === "large" ? "2.4em" : "2em",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{playing ? "pause" : "play_arrow"}
|
||||||
|
</div>
|
||||||
|
</Fab>
|
||||||
|
</div>
|
||||||
|
{onForward && (
|
||||||
|
<IconButton onClick={onForward}>
|
||||||
|
<span className="material-symbols-rounded">fast_forward</span>
|
||||||
|
</IconButton>
|
||||||
|
)}
|
||||||
|
<PlayNextButton />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default React.memo(PlayerControls);
|
||||||