Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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
@@ -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.
|
||||||
@@ -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 }}
|
||||||
@@ -119,4 +119,4 @@ jobs:
|
|||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
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/*
|
||||||
@@ -28,6 +28,9 @@ 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
|
||||||
@@ -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' || '' }}
|
||||||
@@ -31,10 +31,12 @@ 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
|
||||||
@@ -1 +1 @@
|
|||||||
{"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
|
{"encodings":["src\\main.tsx","ProviderWrapper",[52,0,71,1],[53,39,57,3],[53,8,53,11],[53,13,53,22],[53,24,53,35],[58,34,61,3],[58,8,58,12],[58,14,58,30],[66,2,69,4],"src\\components\\notices\\errorNotice\\errorNotice.tsx","ErrorNotice",[6,27,54,1],[6,28,6,56],[9,2,52,8],[20,3,31,9],[32,3,34,16],[35,3,51,16],"src\\utils\\store\\api.tsx","ApiProvider",[50,27,67,1],[50,28,50,65],[51,17,65,2],[66,8,66,75],"useApiInContext",[69,7,75,1],[70,15,70,37],[74,8,74,57],"src\\utils\\store\\central.tsx","CentralProvider",[48,31,71,1],[48,32,48,69],[49,17,67,2],[69,2,69,77],"useCentralStore",[73,7,79,1],[74,15,74,41],[78,8,78,57],"src\\routes\\_api\\player\\index.tsx","VideoPlayer",[88,0,918,1],[89,13,89,42],[90,21,90,32],[90,9,90,16],[91,39,91,54],[92,16,92,48],[94,14,94,51],[106,5,116,3],[97,2,97,16],[98,2,98,6],[99,2,99,10],[100,2,100,14],[101,2,101,15],[102,2,102,14],[103,2,103,13],[104,2,104,15],[105,2,105,11],[117,40,120,3],[117,8,117,29],[117,31,117,36],[122,31,122,45],[123,41,125,2],[127,51,127,66],[130,31,130,46],[131,31,131,45],[132,35,132,50],[133,45,133,68],[134,33,134,56],[135,43,135,58],[137,29,137,40],[138,27,138,42],[140,1,140,41],[142,41,142,72],[219,24,257,7],[259,1,267,21],[267,5,267,19],[269,1,287,7],[289,1,292,15],[292,5,292,13],[294,41,311,62],[311,5,311,31],[311,33,311,60],[313,1,334,3],[331,2,331,28],[332,2,332,29],[333,2,333,37],[336,29,344,15],[344,5,344,13],[346,24,364,25],[364,5,364,13],[364,15,364,23],[366,25,370,15],[370,5,370,13],[372,49,372,64],[373,27,375,7],[376,1,376,56],[376,46,376,54],[378,22,384,21],[384,5,384,19],[464,5,481,11],[465,6,474,8],[475,6,477,19],[478,6,480,19],[485,4,499,10],[486,5,495,7],[496,5,498,18],[504,4,511,10],[505,5,507,18],[508,5,510,18],[515,3,519,9],[516,4,518,17],[523,51,523,66],[524,1,530,13],[530,5,530,11],[542,2,916,8],[543,3,566,21],[545,5,564,18],[563,6,563,52],[568,4,582,13],[585,4,585,55],[587,3,605,21],[589,5,603,18],[595,6,597,12],[598,6,602,8],[606,3,883,16],[642,4,696,10],[643,5,645,18],[644,6,644,66],[646,5,648,18],[647,6,647,64],[649,5,695,12],[670,6,694,18],[686,7,688,18],[690,8,692,19],[698,5,881,11],[699,6,706,19],[702,8,704,21],[707,6,880,12],[708,7,763,13],[709,8,756,10],[757,8,762,14],[758,9,760,22],[761,9,761,62],[764,7,879,13],[765,8,800,14],[766,9,766,31],[767,9,777,22],[774,10,776,17],[778,9,782,22],[779,10,781,17],[783,9,793,22],[790,10,792,17],[794,9,794,27],[795,9,799,22],[801,8,878,14],[802,9,840,22],[824,10,826,23],[827,10,839,12],[841,9,854,22],[847,10,853,17],[855,9,855,24],[856,9,865,22],[860,10,864,17],[866,9,877,22],[874,10,876,17],[884,3,915,5],"sliderDisplayFormat",[386,29,521,2],"src\\routes\\_api\\home\\index.tsx","Home",[40,0,400,1],[41,13,41,42],[42,14,42,51],[44,19,54,3],[56,21,80,3],[82,26,96,3],[98,26,111,3],[113,21,130,3],[132,47,134,6],[136,18,136,31],[138,21,138,59],[140,24,142,2],[144,1,157,26],[157,5,157,24],[161,3,397,10],[168,4,208,20],[170,6,170,26],[173,7,205,9],[210,4,245,20],[212,6,214,12],[213,7,213,51],[218,6,218,23],[220,6,243,21],[224,10,240,12],[246,4,301,20],[248,6,250,12],[249,7,249,52],[254,6,254,23],[258,6,299,21],[261,9,296,11],[302,4,354,20],[304,6,306,12],[305,7,305,59],[310,6,310,23],[315,6,352,21],[318,9,349,11],[355,4,385,20],[357,6,359,12],[358,7,358,59],[363,6,363,23],[368,6,383,21],[371,9,380,11],[386,4,396,20],[388,6,390,12],[389,7,389,62],[394,13,394,69],"src\\routes\\_api\\search\\index.jsx","SearchPage",[32,0,386,1],[33,13,33,36],[35,18,35,31],[36,19,36,36],[36,9,36,14],[38,37,38,49],[41,14,41,51],[45,16,58,3],[59,16,72,3],[73,20,86,3],[87,15,100,3],[101,14,114,3],[115,22,128,3],[129,16,140,3],[141,18,153,3],[155,23,155,71],[155,8,155,19],[157,1,160,7],[162,2,384,8],[172,3,203,9],[173,4,194,6],[195,4,202,10],[201,5,201,61],[204,3,358,9],[210,5,229,20],[212,7,227,9],[232,5,257,20],[234,7,255,9],[260,5,274,20],[263,8,271,10],[277,5,290,20],[279,7,288,9],[293,5,307,20],[295,7,305,9],[310,5,324,20],[312,7,322,9],[327,5,340,20],[329,7,338,9],[343,5,356,20],[345,7,354,9],[375,5,381,11],[380,6,380,68],[383,3,383,13],"src\\routes\\_api\\favorite\\index.tsx","FavoritePage",[21,0,297,1],[22,13,22,36],[23,23,23,71],[23,8,23,19],[25,14,25,51],[27,16,38,3],[40,16,51,3],[53,20,64,3],[66,15,77,3],[79,14,90,3],[92,22,103,3],[105,16,116,3],[118,1,120,3],[123,2,295,9],[134,4,153,19],[136,6,151,8],[156,4,181,19],[158,6,179,8],[184,4,203,19],[186,6,201,8],[206,4,226,19],[208,6,224,8],[229,4,249,19],[231,6,247,8],[252,4,271,19],[254,6,269,8],[274,4,293,19],[276,6,291,8],"src\\routes\\setup\\server.list.tsx","ServerList",[28,0,206,1],[29,18,29,31],[30,39,30,53],[31,29,31,42],[31,9,31,24],[33,19,33,54],[35,21,35,37],[37,17,40,3],[42,23,45,3],[47,28,65,3],[90,1,92,7],[95,2,204,8],[96,3,96,21],[97,3,117,9],[106,4,108,17],[109,4,116,17],[115,5,115,56],[118,3,203,11],[121,6,201,12],[122,7,124,13],[125,7,173,13],[126,8,154,21],[136,10,152,12],[138,12,144,25],[155,8,163,21],[164,8,172,21],[174,7,200,13],[175,8,186,21],[185,9,185,62],[187,8,199,21],[198,9,198,71],"src\\routes\\setup\\server.add.tsx","ServerSetup",Line 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>
|
||||||
|
|
||||||
###
|
###
|
||||||
@@ -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,17 @@
|
|||||||
## 📷 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
|
- About Dialog
|
||||||

|

|
||||||
|
|
||||||
## 📃 Roadmap
|
## 📃 Roadmap
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
|
"$schema": "https://biomejs.dev/schemas/1.9.2/schema.json",
|
||||||
"organizeImports": {
|
"organizeImports": {
|
||||||
"enabled": true
|
"enabled": true
|
||||||
},
|
},
|
||||||
@@ -21,6 +21,9 @@
|
|||||||
},
|
},
|
||||||
"suspicious": {
|
"suspicious": {
|
||||||
"noExplicitAny": "off"
|
"noExplicitAny": "off"
|
||||||
|
},
|
||||||
|
"nursery": {
|
||||||
|
"useComponentExportOnlyModules": "error"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,61 +4,39 @@
|
|||||||
<head>
|
<head>
|
||||||
<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{
|
|
||||||
height: 2px;
|
|
||||||
width: 16vw;
|
|
||||||
position: absolute;
|
|
||||||
left: 50%;
|
|
||||||
bottom: 36vh;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-loading-bar{
|
.app-loading-anim{
|
||||||
width: 100%;
|
width: 150%;
|
||||||
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.3",
|
||||||
"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,35 +13,46 @@
|
|||||||
"tanstack-router-dev": "tsr watch"
|
"tanstack-router-dev": "tsr watch"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.13.3",
|
"@dnd-kit/core": "^6.2.0",
|
||||||
"@emotion/styled": "^11.13.0",
|
"@dnd-kit/modifiers": "^8.0.0",
|
||||||
"@fontsource-variable/jetbrains-mono": "^5.0.22",
|
"@dnd-kit/sortable": "^9.0.0",
|
||||||
"@fontsource-variable/noto-sans": "^5.0.5",
|
"@dnd-kit/utilities": "^3.2.2",
|
||||||
"@jellyfin/sdk": "0.10.0",
|
"@emotion/react": "^11.13.5",
|
||||||
"@million/lint": "1.0.0-rc.84",
|
"@emotion/styled": "^11.13.5",
|
||||||
"@mui/lab": "6.0.0-beta.9",
|
"@fontsource-variable/jetbrains-mono": "^5.1.1",
|
||||||
"@mui/material": "6.0.2",
|
"@fontsource-variable/noto-sans": "^5.1.0",
|
||||||
"@react-spring/web": "^9.7.4",
|
"@fontsource-variable/plus-jakarta-sans": "^5.1.0",
|
||||||
"@tanem/react-nprogress": "^5.0.51",
|
"@fontsource-variable/space-grotesk": "^5.1.0",
|
||||||
"@tanstack/react-query": "^5.55.0",
|
"@jellyfin/sdk": "0.11.0",
|
||||||
"@tanstack/react-query-devtools": "^5.55.0",
|
"@million/lint": "^1.0.13",
|
||||||
"@tanstack/react-router": "^1.56.1",
|
"@mui/lab": "6.0.0-beta.17",
|
||||||
"@tanstack/react-virtual": "^3.10.7",
|
"@mui/material": "6.1.9",
|
||||||
"@tauri-apps/api": "2.0.0-beta.15",
|
"@popperjs/core": "^2.11.8",
|
||||||
"@tauri-apps/plugin-clipboard-manager": "2.1.0-beta.5",
|
"@react-spring/web": "^9.7.5",
|
||||||
"@tauri-apps/plugin-process": "2.0.0-rc.1",
|
"@tanem/react-nprogress": "^5.0.53",
|
||||||
|
"@tanstack/react-query": "^5.62.0",
|
||||||
|
"@tanstack/react-query-devtools": "^5.62.0",
|
||||||
|
"@tanstack/react-router": "^1.85.0",
|
||||||
|
"@tanstack/react-virtual": "^3.10.9",
|
||||||
|
"@tauri-apps/api": "2.1.1",
|
||||||
|
"@tauri-apps/plugin-clipboard-manager": "2.1.0-beta.6",
|
||||||
|
"@tauri-apps/plugin-dialog": "2.0.1",
|
||||||
|
"@tauri-apps/plugin-notification": "2.0.0",
|
||||||
|
"@tauri-apps/plugin-process": "2.0.0",
|
||||||
"@tauri-apps/plugin-store": "github:tauri-apps/tauri-plugin-store#v2",
|
"@tauri-apps/plugin-store": "github:tauri-apps/tauri-plugin-store#v2",
|
||||||
"@tauri-apps/plugin-updater": "2.0.0-rc.2",
|
"@tauri-apps/plugin-updater": "2.0.0",
|
||||||
"@types/node": "^22.5.4",
|
"@tauri-apps/plugin-upload": "2.1.0",
|
||||||
"@types/react": "^18.3.5",
|
"@types/node": "^22.10.1",
|
||||||
"@types/react-dom": "^18.3.0",
|
"@types/react": "^18.3.12",
|
||||||
"axios": "^1.7.7",
|
"@types/react-dom": "^18.3.1",
|
||||||
"axios-tauri-api-adapter": "^0.2.2",
|
"axios": "^1.7.8",
|
||||||
|
"axios-tauri-api-adapter": "^2.0.3",
|
||||||
"blurhash": "^2.0.5",
|
"blurhash": "^2.0.5",
|
||||||
"framer-motion": "^11.5.4",
|
"framer-motion": "^11.12.0",
|
||||||
|
"immer": "^10.1.1",
|
||||||
"jassub": "^1.7.17",
|
"jassub": "^1.7.17",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"material-symbols": "^0.23.0",
|
"material-symbols": "^0.27.1",
|
||||||
"million": "^3.1.11",
|
"million": "^3.1.11",
|
||||||
"notistack": "^3.0.1",
|
"notistack": "^3.0.1",
|
||||||
"react": "18.3.1",
|
"react": "18.3.1",
|
||||||
@@ -49,29 +60,31 @@
|
|||||||
"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": "18.3.1",
|
||||||
"react-error-boundary": "^4.0.13",
|
"react-error-boundary": "^4.1.2",
|
||||||
|
"react-intersection-observer": "^9.13.1",
|
||||||
"react-markdown": "^9.0.1",
|
"react-markdown": "^9.0.1",
|
||||||
"react-multi-carousel": "^2.8.5",
|
"react-multi-carousel": "^2.8.5",
|
||||||
"react-player": "^2.16.0",
|
"react-player": "^2.16.0",
|
||||||
|
"react-popper": "^2.3.0",
|
||||||
"react-use-konami": "^1.1.0",
|
"react-use-konami": "^1.1.0",
|
||||||
"remark-gfm": "^4.0.0",
|
"remark-gfm": "^4.0.0",
|
||||||
"typescript": "^5.5.4",
|
"typescript": "^5.7.2",
|
||||||
"vite-plugin-svgr": "^4.2.0",
|
"vite-plugin-svgr": "^4.3.0",
|
||||||
"wavesurfer.js": "^7.8.4",
|
"wavesurfer.js": "^7.8.10",
|
||||||
"zustand": "^4.5.5"
|
"zustand": "5.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/plugin-proposal-optional-chaining-assign": "^7.24.7",
|
"@babel/plugin-proposal-optional-chaining-assign": "^7.25.9",
|
||||||
"@biomejs/biome": "^1.8.3",
|
"@biomejs/biome": "^1.9.4",
|
||||||
"@tanstack/router-cli": "^1.56.1",
|
"@tanstack/router-cli": "^1.84.4",
|
||||||
"@tanstack/router-devtools": "^1.56.1",
|
"@tanstack/router-devtools": "^1.85.0",
|
||||||
"@tanstack/router-vite-plugin": "^1.56.1",
|
"@tanstack/router-vite-plugin": "^1.84.4",
|
||||||
"@tauri-apps/cli": "2.0.0-beta.22",
|
"@tauri-apps/cli": "2.1.0",
|
||||||
"@types/lodash": "^4.17.7",
|
"@types/lodash": "^4.17.13",
|
||||||
"@vitejs/plugin-react": "^4.3.1",
|
"@vitejs/plugin-react": "^4.3.4",
|
||||||
"prop-types": "^15.8.1",
|
"prop-types": "^15.8.1",
|
||||||
"sass": "^1.78.0",
|
"sass": "^1.81.0",
|
||||||
"vite": "^5.4.3"
|
"vite": "^6.0.2"
|
||||||
},
|
},
|
||||||
"license": "GPL-3.0-only"
|
"license": "GPL-3.0-only"
|
||||||
}
|
}
|
||||||
|
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.3"
|
||||||
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"
|
||||||
@@ -27,6 +27,9 @@ 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"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# by default Tauri runs in production mode
|
# by default Tauri runs in production mode
|
||||||
|
|||||||
@@ -12,6 +12,11 @@
|
|||||||
"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",
|
||||||
|
"notification:default",
|
||||||
|
"core:webview:allow-internal-toggle-devtools",
|
||||||
|
"dialog:default",
|
||||||
|
"upload:allow-download",
|
||||||
|
"clipboard-manager:allow-write-text"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -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 which includes:\n- 'core:path:default'\n- 'core:event:default'\n- 'core:window:default'\n- 'core:webview:default'\n- 'core:app:default'\n- 'core:image:default'\n- 'core:resources:default'\n- 'core:menu:default'\n- 'core:tray:default'\n","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"]},"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-set-app-theme":{"identifier":"allow-set-app-theme","description":"Enables the set_app_theme command without any pre-configured scope.","commands":{"allow":["set_app_theme"],"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_winLine 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"]}}
|
{"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","notification:default","core:webview:allow-internal-toggle-devtools","dialog:default","upload:allow-download","clipboard-manager:allow-write-text"]},"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"]}}
|
||||||
@@ -4,6 +4,9 @@ use tauri_plugin_log::{fern::colors::ColoredLevelConfig, Target, TargetKind};
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
|
.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 +18,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": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEZEMTg0MjEzRDYzRjJDN0EKUldSNkxEL1dFMElZL1dxbHA0V2lyVDFEdGpOZXkxMG9XdHVLVnRpVVV5c1Z0OFNRUE45dkpxbFAK",
|
||||||
},
|
"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": [
|
||||||
},
|
{
|
||||||
"app": {
|
"fullscreen": false,
|
||||||
"windows": [
|
"height": 600,
|
||||||
{
|
"width": 800,
|
||||||
"fullscreen": false,
|
"resizable": true,
|
||||||
"height": 600,
|
"title": "Blink",
|
||||||
"width": 800,
|
"visible": true,
|
||||||
"resizable": true,
|
"center": true,
|
||||||
"title": "Blink",
|
"label": "main",
|
||||||
"visible": true,
|
"dragDropEnabled": false,
|
||||||
"center": true,
|
"backgroundColor": "#08001f"
|
||||||
"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: 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,135 @@
|
|||||||
|
import { setServer } from "@/utils/storage/servers";
|
||||||
|
import { jellyfin } from "@/utils/store/api";
|
||||||
|
import { LoadingButton } from "@mui/lab";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Dialog,
|
||||||
|
DialogActions,
|
||||||
|
DialogContent,
|
||||||
|
DialogTitle,
|
||||||
|
TextField,
|
||||||
|
} from "@mui/material";
|
||||||
|
import { useMutation } from "@tanstack/react-query";
|
||||||
|
import { enqueueSnackbar } from "notistack";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
|
||||||
|
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}
|
||||||
|
hideBackdrop={Boolean(hideBackdrop)}
|
||||||
|
fullWidth
|
||||||
|
maxWidth="sm"
|
||||||
|
disableScrollLock={true}
|
||||||
|
>
|
||||||
|
<DialogTitle variant="h4" align="center" mb={1}>
|
||||||
|
Add Server
|
||||||
|
</DialogTitle>
|
||||||
|
<DialogContent className="settings-server-add">
|
||||||
|
<TextField
|
||||||
|
variant="filled"
|
||||||
|
label="Address"
|
||||||
|
fullWidth
|
||||||
|
onChange={(e) => setServerIp(e.target.value)}
|
||||||
|
/>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions
|
||||||
|
style={{
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
padding: "1em",
|
||||||
|
gap: "1em",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
startIcon={
|
||||||
|
<span
|
||||||
|
className="material-symbols-rounded"
|
||||||
|
style={{
|
||||||
|
marginRight: "0.25em",
|
||||||
|
fontVariationSettings:
|
||||||
|
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
cancel
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
color="error"
|
||||||
|
onClick={() => setAddServerDialog(false)}
|
||||||
|
>
|
||||||
|
Close
|
||||||
|
</Button>
|
||||||
|
{/* @ts-ignore */}
|
||||||
|
<LoadingButton
|
||||||
|
startIcon={
|
||||||
|
<span
|
||||||
|
className="material-symbols-rounded"
|
||||||
|
style={{
|
||||||
|
marginRight: "0.25em",
|
||||||
|
fontVariationSettings:
|
||||||
|
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
add_circle
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
variant="contained"
|
||||||
|
loading={addServer.isPending}
|
||||||
|
loadingPosition="start"
|
||||||
|
onClick={addServer.mutate}
|
||||||
|
color="success"
|
||||||
|
>
|
||||||
|
Add
|
||||||
|
</LoadingButton>
|
||||||
|
</DialogActions>
|
||||||
|
</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>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,4 +1,9 @@
|
|||||||
import React, { type ReactNode } from "react";
|
import React, {
|
||||||
|
type MouseEventHandler,
|
||||||
|
useCallback,
|
||||||
|
useMemo,
|
||||||
|
type ReactNode,
|
||||||
|
} from "react";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
import MuiAppBar from "@mui/material/AppBar";
|
import MuiAppBar from "@mui/material/AppBar";
|
||||||
@@ -9,9 +14,13 @@ import Menu from "@mui/material/Menu";
|
|||||||
import MenuItem from "@mui/material/MenuItem";
|
import MenuItem from "@mui/material/MenuItem";
|
||||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||||
|
|
||||||
import { Link, useLocation, useNavigate } from "@tanstack/react-router";
|
import {
|
||||||
|
Link,
|
||||||
|
useLocation,
|
||||||
|
useNavigate,
|
||||||
|
useRouter,
|
||||||
|
} 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 { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||||
|
|
||||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
@@ -22,6 +31,7 @@ import "./appBar.scss";
|
|||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
import { getTypeIcon } from "../utils/iconsCollection";
|
||||||
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import {
|
import {
|
||||||
setSettingsDialogOpen,
|
setSettingsDialogOpen,
|
||||||
setSettingsTabValue,
|
setSettingsTabValue,
|
||||||
@@ -47,6 +57,7 @@ function ListItemLink(props: ListItemLinkProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<li>
|
<li>
|
||||||
|
{/* @ts-ignore */}
|
||||||
<ListItem
|
<ListItem
|
||||||
component={Link}
|
component={Link}
|
||||||
activeClassName="active"
|
activeClassName="active"
|
||||||
@@ -69,32 +80,35 @@ function ListItemLink(props: ListItemLinkProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MemoizeBackButton = React.memo(BackButton);
|
||||||
|
|
||||||
export const AppBar = () => {
|
export const AppBar = () => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
|
const createApi = useApiInContext((s) => s.createApi);
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [display, setDisplay] = useState(false);
|
const [display, setDisplay] = useState(false);
|
||||||
|
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const user = useQuery({
|
const [user, resetCurrentUser] = useCentralStore((s) => [
|
||||||
queryKey: ["user"],
|
s.currentUser,
|
||||||
queryFn: async () => {
|
s.resetCurrentUser,
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
]);
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
enabled: display && Boolean(api?.accessToken),
|
|
||||||
throwOnError: true,
|
|
||||||
});
|
|
||||||
const libraries = useQuery({
|
const libraries = useQuery({
|
||||||
queryKey: ["libraries"],
|
queryKey: ["libraries"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!user?.Id || !api?.accessToken) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const libs = await getUserViewsApi(api).getUserViews({
|
const libs = await getUserViewsApi(api).getUserViews({
|
||||||
userId: user.data?.Id,
|
userId: user.Id,
|
||||||
});
|
});
|
||||||
return libs.data;
|
return libs.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data && !!api.accessToken,
|
enabled: !!user?.Id && !!api?.accessToken,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -103,22 +117,28 @@ export const AppBar = () => {
|
|||||||
threshold: 20,
|
threshold: 20,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [anchorEl, setAnchorEl] = useState(null);
|
const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);
|
||||||
const openMenu = Boolean(anchorEl);
|
const openMenu = Boolean(anchorEl);
|
||||||
const handleMenuOpen = (event) => {
|
const handleMenuOpen: MouseEventHandler<HTMLButtonElement> = useCallback(
|
||||||
setAnchorEl(event.currentTarget);
|
(event) => {
|
||||||
};
|
setAnchorEl(event.currentTarget);
|
||||||
const handleMenuClose = () => {
|
},
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
const handleMenuClose = useCallback(() => {
|
||||||
setAnchorEl(null);
|
setAnchorEl(null);
|
||||||
};
|
}, []);
|
||||||
|
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
const handleLogout = async () => {
|
const handleLogout = async () => {
|
||||||
console.log("Logging out user...");
|
console.log("Logging out user...");
|
||||||
await api.logout();
|
await api?.logout();
|
||||||
|
createApi(api?.basePath ?? "", undefined);
|
||||||
|
console.log(api);
|
||||||
|
resetCurrentUser();
|
||||||
delUser();
|
delUser();
|
||||||
sessionStorage.removeItem("accessToken");
|
sessionStorage.removeItem("accessToken");
|
||||||
|
await router.invalidate();
|
||||||
queryClient.clear();
|
queryClient.clear();
|
||||||
setAnchorEl(null);
|
setAnchorEl(null);
|
||||||
navigate({ to: "/login" });
|
navigate({ to: "/login" });
|
||||||
@@ -141,6 +161,43 @@ export const AppBar = () => {
|
|||||||
|
|
||||||
const [showDrawer, setShowDrawer] = useState(false);
|
const [showDrawer, setShowDrawer] = useState(false);
|
||||||
|
|
||||||
|
const appBarStyling = useMemo(() => {
|
||||||
|
return {
|
||||||
|
backgroundColor: "transparent",
|
||||||
|
paddingRight: "0 !important",
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
const menuStyle = useMemo(() => {
|
||||||
|
return { mt: 2 };
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const drawerPaperProps = useMemo(() => {
|
||||||
|
return {
|
||||||
|
className: "glass library-drawer",
|
||||||
|
elevation: 6,
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
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" });
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const menuButtonSx = useMemo(() => ({ p: 0 }), []);
|
||||||
|
|
||||||
if (!display) {
|
if (!display) {
|
||||||
return <></>;
|
return <></>;
|
||||||
}
|
}
|
||||||
@@ -148,10 +205,7 @@ export const AppBar = () => {
|
|||||||
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,11 +215,11 @@ 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>
|
<div className="material-symbols-rounded">menu</div>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<BackButton />
|
<MemoizeBackButton />
|
||||||
<IconButton onClick={() => navigate({ to: "/home" })}>
|
<IconButton onClick={handleNavigateToHome}>
|
||||||
<div
|
<div
|
||||||
className={
|
className={
|
||||||
location.pathname === "/home"
|
location.pathname === "/home"
|
||||||
@@ -179,19 +233,16 @@ export const AppBar = () => {
|
|||||||
</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={handleNavigateToSearch}>
|
||||||
<div className="material-symbols-rounded">search</div>
|
<div className="material-symbols-rounded">search</div>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton onClick={() => navigate({ to: "/favorite" })}>
|
<IconButton onClick={handleNavigateToFavorite}>
|
||||||
<div className="material-symbols-rounded">favorite</div>
|
<div className="material-symbols-rounded">favorite</div>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton sx={{ p: 0 }} onClick={handleMenuOpen}>
|
<IconButton sx={menuButtonSx} onClick={handleMenuOpen}>
|
||||||
{user.isSuccess &&
|
{!!user?.Id &&
|
||||||
(user.data.PrimaryImageTag === undefined ? (
|
(user?.PrimaryImageTag === undefined ? (
|
||||||
<Avatar
|
<Avatar className="appBar-avatar" alt={user?.Name ?? "image"}>
|
||||||
className="appBar-avatar"
|
|
||||||
alt={user.data.Name ?? "image"}
|
|
||||||
>
|
|
||||||
<span className="material-symbols-rounded appBar-avatar-icon">
|
<span className="material-symbols-rounded appBar-avatar-icon">
|
||||||
account_circle
|
account_circle
|
||||||
</span>
|
</span>
|
||||||
@@ -199,8 +250,8 @@ export const AppBar = () => {
|
|||||||
) : (
|
) : (
|
||||||
<Avatar
|
<Avatar
|
||||||
className="appBar-avatar"
|
className="appBar-avatar"
|
||||||
src={`${api.basePath}/Users/${user.data.Id}/Images/Primary`}
|
src={`${api?.basePath}/Users/${user?.Id}/Images/Primary`}
|
||||||
alt={user.data.Name ?? "image"}
|
alt={user?.Name ?? "image"}
|
||||||
>
|
>
|
||||||
<span className="material-symbols-rounded appBar-avatar-icon">
|
<span className="material-symbols-rounded appBar-avatar-icon">
|
||||||
account_circle
|
account_circle
|
||||||
@@ -212,7 +263,7 @@ export const AppBar = () => {
|
|||||||
anchorEl={anchorEl}
|
anchorEl={anchorEl}
|
||||||
open={openMenu}
|
open={openMenu}
|
||||||
onClose={handleMenuClose}
|
onClose={handleMenuClose}
|
||||||
sx={{ mt: 2 }}
|
sx={menuStyle}
|
||||||
disableScrollLock
|
disableScrollLock
|
||||||
>
|
>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
@@ -256,17 +307,14 @@ export const AppBar = () => {
|
|||||||
</MuiAppBar>
|
</MuiAppBar>
|
||||||
<Drawer
|
<Drawer
|
||||||
open={showDrawer}
|
open={showDrawer}
|
||||||
PaperProps={{
|
PaperProps={drawerPaperProps}
|
||||||
className: "glass library-drawer",
|
|
||||||
elevation: 6,
|
|
||||||
}}
|
|
||||||
className="library-drawer"
|
className="library-drawer"
|
||||||
onClose={() => setShowDrawer(false)}
|
onClose={handleDrawerClose}
|
||||||
>
|
>
|
||||||
<List>
|
<List>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<ListItemButton
|
<ListItemButton
|
||||||
onClick={() => setShowDrawer(false)}
|
onClick={handleDrawerClose}
|
||||||
style={{
|
style={{
|
||||||
borderRadius: "100px",
|
borderRadius: "100px",
|
||||||
gap: "0.85em",
|
gap: "0.85em",
|
||||||
@@ -281,12 +329,15 @@ export const AppBar = () => {
|
|||||||
<List>
|
<List>
|
||||||
<ListItemLink to="/home" icon="home" primary="Home" />
|
<ListItemLink to="/home" icon="home" primary="Home" />
|
||||||
{libraries.isSuccess &&
|
{libraries.isSuccess &&
|
||||||
libraries.data.Items?.map((library, index) => (
|
libraries.data?.Items?.map((library) => (
|
||||||
<ListItemLink
|
<ListItemLink
|
||||||
key={library.Id}
|
key={library.Id}
|
||||||
to={`/library/${library.Id}`}
|
to={`/library/${library.Id}`}
|
||||||
icon={getTypeIcon(library.CollectionType)}
|
icon={
|
||||||
primary={library.Name}
|
library.CollectionType &&
|
||||||
|
getTypeIcon(library.CollectionType)
|
||||||
|
}
|
||||||
|
primary={library.Name ?? "Library"}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
|
|||||||
@@ -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>
|
||||||
);
|
);
|
||||||
@@ -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,46 @@
|
|||||||
|
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||||
|
import { AnimatePresence, motion } from "framer-motion";
|
||||||
|
import React, { useLayoutEffect, useState } from "react";
|
||||||
|
|
||||||
|
export default function Backdrop() {
|
||||||
|
const [backdropLoading, setBackdropLoading] = useState(true);
|
||||||
|
|
||||||
|
const [backdropId, backdropUrl] = useBackdropStore((state) => [
|
||||||
|
state.backdropId,
|
||||||
|
state.backdropUrl,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Reset loading status for backdrop
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
setBackdropLoading(true);
|
||||||
|
}, [backdropId]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="app-backdrop-container">
|
||||||
|
<AnimatePresence>
|
||||||
|
<motion.img
|
||||||
|
key={backdropId}
|
||||||
|
src={backdropUrl}
|
||||||
|
alt=""
|
||||||
|
className="app-backdrop"
|
||||||
|
initial={{
|
||||||
|
opacity: 0,
|
||||||
|
}}
|
||||||
|
animate={{
|
||||||
|
opacity: backdropLoading ? 0 : 1,
|
||||||
|
}}
|
||||||
|
exit={{
|
||||||
|
opacity: 0,
|
||||||
|
}}
|
||||||
|
transition={{
|
||||||
|
opacity: {
|
||||||
|
duration: 1.2,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
onLoad={() => setBackdropLoading(false)}
|
||||||
|
loading="lazy"
|
||||||
|
/>
|
||||||
|
</AnimatePresence>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -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,57 @@
|
|||||||
import PropTypes from "prop-types";
|
import React from "react";
|
||||||
|
|
||||||
import React, { useEffect } from "react";
|
|
||||||
|
|
||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import type { UserItemDataDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
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 { 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";
|
||||||
|
|
||||||
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",
|
||||||
});
|
});
|
||||||
@@ -76,27 +83,19 @@ const LikeButton = ({ itemId, isFavorite, queryKey, userId, itemName }) => {
|
|||||||
style={
|
style={
|
||||||
isFavorite
|
isFavorite
|
||||||
? {
|
? {
|
||||||
|
//@ts-ignore
|
||||||
"--fill": mutation.isPending ? 0 : 1,
|
"--fill": mutation.isPending ? 0 : 1,
|
||||||
color: mutation.isPending ? "white" : pink.A700,
|
color: mutation.isPending ? "white" : pink.A700,
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
|
//@ts-ignore
|
||||||
"--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>
|
</div>
|
||||||
</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,34 +1,30 @@
|
|||||||
import PropTypes from "prop-types";
|
import React, { memo, type MouseEvent } from "react"; // Import memo
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
import Button, {
|
import Button, { type ButtonProps } from "@mui/material/Button";
|
||||||
type ButtonProps,
|
|
||||||
type ButtonPropsSizeOverrides,
|
|
||||||
} 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 { playAudio } from "@/utils/store/audioPlayback";
|
import { generateAudioStreamUrl, playAudio } from "@/utils/store/audioPlayback";
|
||||||
import {
|
import {
|
||||||
type BaseItemDto,
|
type BaseItemDto,
|
||||||
type BaseItemDtoQueryResult,
|
type BaseItemDtoQueryResult,
|
||||||
BaseItemKind,
|
BaseItemKind,
|
||||||
ItemFields,
|
ItemFields,
|
||||||
MediaProtocol,
|
ItemFilter,
|
||||||
|
LocationType,
|
||||||
|
type MediaSegmentDtoQueryResult,
|
||||||
type PlaybackInfoResponse,
|
type PlaybackInfoResponse,
|
||||||
SortOrder,
|
SortOrder,
|
||||||
type UserItemDataDto,
|
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} 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 { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||||
import { getPlaylistsApi } from "@jellyfin/sdk/lib/utils/api/playlists-api";
|
import { getPlaylistsApi } from "@jellyfin/sdk/lib/utils/api/playlists-api";
|
||||||
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||||
import { useMutation } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
import { useSnackbar } from "notistack";
|
import { useSnackbar } from "notistack";
|
||||||
|
|
||||||
import useQueue, { setQueue } from "@/utils/store/queue";
|
import { setQueue } from "@/utils/store/queue";
|
||||||
|
|
||||||
import { playItem, usePlaybackDataLoadStore } from "@/utils/store/playback";
|
import { playItem, usePlaybackDataLoadStore } from "@/utils/store/playback";
|
||||||
|
|
||||||
@@ -36,36 +32,57 @@ 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 getSubtitle from "@/utils/methods/getSubtitles";
|
||||||
import playbackProfile from "@/utils/playback-profiles";
|
import playbackProfile from "@/utils/playback-profiles";
|
||||||
import { axiosClient, useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
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 { getMediaInfoApi } from "@jellyfin/sdk/lib/utils/api/media-info-api";
|
||||||
|
import { getMediaSegmentsApi } from "@jellyfin/sdk/lib/utils/api/media-segments-api";
|
||||||
|
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||||
|
import { LoadingButton } from "@mui/lab";
|
||||||
import type { SxProps } from "@mui/material";
|
import type { SxProps } from "@mui/material";
|
||||||
import type { AxiosResponse } from "axios";
|
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-ignore
|
||||||
|
color="white"
|
||||||
|
/>
|
||||||
|
));
|
||||||
|
|
||||||
const PlayButton = ({
|
const PlayButton = ({
|
||||||
item,
|
item,
|
||||||
itemId,
|
|
||||||
itemUserData,
|
|
||||||
userId,
|
userId,
|
||||||
itemType,
|
itemType,
|
||||||
currentAudioTrack,
|
currentAudioTrack,
|
||||||
@@ -79,7 +96,6 @@ 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);
|
||||||
|
|
||||||
@@ -87,73 +103,105 @@ const PlayButton = ({
|
|||||||
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);
|
setPlaybackDataLoading(true);
|
||||||
let result: undefined | AxiosResponse<BaseItemDtoQueryResult, any>;
|
let result: undefined | AxiosResponse<BaseItemDtoQueryResult, any>;
|
||||||
let mediaSource: undefined | AxiosResponse<PlaybackInfoResponse, any>;
|
let mediaSource: undefined | AxiosResponse<PlaybackInfoResponse, any>;
|
||||||
let introInfo: undefined | AxiosResponse<IntroMediaInfo, any>;
|
let introInfo: undefined | MediaSegmentDtoQueryResult;
|
||||||
const indexNumber = item.IndexNumber ? item.IndexNumber - 1 : 0;
|
let index = 0;
|
||||||
|
if (!api) {
|
||||||
|
throw new Error("API is not available");
|
||||||
|
}
|
||||||
|
if (!item.Id) {
|
||||||
|
throw new Error("Item ID is not available");
|
||||||
|
}
|
||||||
if (playlistItem) {
|
if (playlistItem) {
|
||||||
result = await getPlaylistsApi(api).getPlaylistItems({
|
result = await getPlaylistsApi(api).getPlaylistItems({
|
||||||
userId: userId,
|
userId: userId,
|
||||||
playlistId: playlistItemId,
|
playlistId: playlistItemId,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log(itemType);
|
|
||||||
switch (itemType) {
|
switch (itemType) {
|
||||||
case BaseItemKind.Episode:
|
case BaseItemKind.Episode:
|
||||||
result = await getTvShowsApi(api).getEpisodes({
|
if (item.SeriesId && item.SeasonId) {
|
||||||
seriesId: item.SeriesId,
|
result = await getTvShowsApi(api).getEpisodes({
|
||||||
fields: [
|
seriesId: item.SeriesId,
|
||||||
ItemFields.MediaSources,
|
fields: [
|
||||||
ItemFields.MediaStreams,
|
ItemFields.MediaSources,
|
||||||
ItemFields.Overview,
|
ItemFields.MediaStreams,
|
||||||
ItemFields.Chapters,
|
ItemFields.Overview,
|
||||||
ItemFields.Trickplay,
|
ItemFields.Chapters,
|
||||||
],
|
ItemFields.Trickplay,
|
||||||
enableUserData: true,
|
],
|
||||||
userId: userId,
|
enableUserData: true,
|
||||||
seasonId: item.SeasonId,
|
userId: userId,
|
||||||
startItemId: item.Id,
|
seasonId: item.SeasonId,
|
||||||
});
|
isMissing: false,
|
||||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
// startItemId: item.Id,
|
||||||
audioStreamIndex: currentAudioTrack,
|
});
|
||||||
subtitleStreamIndex:
|
|
||||||
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
if (
|
||||||
itemId: result.data.Items?.[indexNumber].Id,
|
result.data.Items?.map((i) => i.Id).indexOf(
|
||||||
startTimeTicks:
|
currentEpisodeId,
|
||||||
result.data.Items?.[indexNumber].UserData
|
) === -1
|
||||||
?.PlaybackPositionTicks,
|
) {
|
||||||
userId: userId,
|
throw new Error(
|
||||||
mediaSourceId:
|
`Episode having id ${currentEpisodeId} not found, index return -1`,
|
||||||
result.data.Items?.[indexNumber].MediaSources?.[0].Id,
|
);
|
||||||
playbackInfoDto: {
|
}
|
||||||
DeviceProfile: playbackProfile,
|
index =
|
||||||
},
|
result.data.Items?.map((i) => i.Id).indexOf(currentEpisodeId) ??
|
||||||
});
|
0;
|
||||||
try {
|
if (currentAudioTrack === "auto") {
|
||||||
introInfo = (
|
const defaultAudioStreamIndex =
|
||||||
await axiosClient.get(
|
result.data.Items?.[index].MediaSources?.[0]
|
||||||
`${api.basePath}/Episode/${result.data.Items?.[0]?.Id}/IntroSkipperSegments`,
|
.DefaultAudioStreamIndex;
|
||||||
{
|
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||||
headers: {
|
audioStreamIndex: Number(defaultAudioStreamIndex),
|
||||||
Authorization: `MediaBrowser Token=${api.accessToken}`,
|
subtitleStreamIndex:
|
||||||
},
|
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||||
|
itemId: result.data.Items?.[index]?.Id ?? "",
|
||||||
|
startTimeTicks:
|
||||||
|
result.data.Items?.[index].UserData?.PlaybackPositionTicks,
|
||||||
|
userId: userId,
|
||||||
|
mediaSourceId:
|
||||||
|
result.data.Items?.[index].MediaSources?.[0]?.Id ?? "",
|
||||||
|
playbackInfoDto: {
|
||||||
|
DeviceProfile: playbackProfile,
|
||||||
},
|
},
|
||||||
)
|
});
|
||||||
|
} else {
|
||||||
|
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||||
|
audioStreamIndex: currentAudioTrack,
|
||||||
|
subtitleStreamIndex:
|
||||||
|
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||||
|
itemId: result.data.Items?.[index]?.Id ?? "",
|
||||||
|
startTimeTicks:
|
||||||
|
result.data.Items?.[index].UserData?.PlaybackPositionTicks,
|
||||||
|
userId: userId,
|
||||||
|
mediaSourceId:
|
||||||
|
result.data.Items?.[index].MediaSources?.[0]?.Id ?? "",
|
||||||
|
playbackInfoDto: {
|
||||||
|
DeviceProfile: playbackProfile,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
introInfo = (
|
||||||
|
await getMediaSegmentsApi(api).getItemSegments({
|
||||||
|
itemId: result.data.Items?.[index]?.Id ?? "",
|
||||||
|
})
|
||||||
)?.data;
|
)?.data;
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BaseItemKind.Series:
|
case BaseItemKind.Series:
|
||||||
result = await getTvShowsApi(api).getEpisodes({
|
result = await getTvShowsApi(api).getEpisodes({
|
||||||
seriesId: itemId,
|
seriesId: item.Id,
|
||||||
fields: [
|
fields: [
|
||||||
ItemFields.MediaSources,
|
ItemFields.MediaSources,
|
||||||
ItemFields.MediaStreams,
|
ItemFields.MediaStreams,
|
||||||
@@ -163,44 +211,78 @@ const PlayButton = ({
|
|||||||
],
|
],
|
||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
|
isMissing: false,
|
||||||
});
|
});
|
||||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
if (
|
||||||
audioStreamIndex: currentAudioTrack,
|
currentEpisodeId &&
|
||||||
subtitleStreamIndex:
|
result.data.Items?.map((i) => i.Id).indexOf(currentEpisodeId) ===
|
||||||
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
-1
|
||||||
itemId: result.data.Items?.[0].Id,
|
) {
|
||||||
startTimeTicks:
|
throw new Error(
|
||||||
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
`Episode having id=${currentEpisodeId} not found, index return -1`,
|
||||||
userId: userId,
|
);
|
||||||
mediaSourceId: result.data.Items?.[0].MediaSources?.[0].Id,
|
}
|
||||||
playbackInfoDto: {
|
if (!currentEpisodeId) {
|
||||||
DeviceProfile: playbackProfile,
|
index = 0;
|
||||||
},
|
} else {
|
||||||
});
|
index =
|
||||||
try {
|
result.data.Items?.map((i) => i.Id).indexOf(currentEpisodeId) ??
|
||||||
introInfo = (
|
0;
|
||||||
await axiosClient.get(
|
}
|
||||||
`${api.basePath}/Episode/${result.data.Items?.[0]?.Id}/IntroSkipperSegments`,
|
if (
|
||||||
{
|
result.data.Items?.[index].Id &&
|
||||||
headers: {
|
result.data.Items?.[index].MediaSources?.[0]?.Id
|
||||||
Authorization: `MediaBrowser Token=${api.accessToken}`,
|
) {
|
||||||
},
|
if (currentAudioTrack === "auto") {
|
||||||
|
const defaultAudioStreamIndex =
|
||||||
|
result.data.Items?.[index].MediaSources?.[0]
|
||||||
|
.DefaultAudioStreamIndex;
|
||||||
|
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||||
|
audioStreamIndex: Number(defaultAudioStreamIndex),
|
||||||
|
subtitleStreamIndex:
|
||||||
|
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||||
|
itemId: result.data.Items[index].Id ?? "",
|
||||||
|
startTimeTicks:
|
||||||
|
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
||||||
|
userId: userId,
|
||||||
|
mediaSourceId:
|
||||||
|
result.data.Items?.[index].MediaSources?.[0].Id ?? "",
|
||||||
|
playbackInfoDto: {
|
||||||
|
DeviceProfile: playbackProfile,
|
||||||
},
|
},
|
||||||
)
|
});
|
||||||
|
} else {
|
||||||
|
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||||
|
audioStreamIndex: currentAudioTrack,
|
||||||
|
subtitleStreamIndex:
|
||||||
|
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||||
|
itemId: result.data.Items[index].Id ?? "",
|
||||||
|
startTimeTicks:
|
||||||
|
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
||||||
|
userId: userId,
|
||||||
|
mediaSourceId:
|
||||||
|
result.data.Items?.[index].MediaSources?.[0].Id ?? "",
|
||||||
|
playbackInfoDto: {
|
||||||
|
DeviceProfile: playbackProfile,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
introInfo = (
|
||||||
|
await getMediaSegmentsApi(api).getItemSegments({
|
||||||
|
itemId: result.data.Items?.[index].Id ?? "",
|
||||||
|
})
|
||||||
)?.data;
|
)?.data;
|
||||||
} catch (error) {
|
} else {
|
||||||
console.error(error);
|
throw new Error(
|
||||||
|
`No media source id provieded for the episode. Return values are seriesId = ${result.data.Items?.[index].Id}, mediaSourceId = ${result.data.Items?.[index].MediaSources?.[0]?.Id}, index = ${index}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BaseItemKind.Playlist:
|
case BaseItemKind.Playlist:
|
||||||
result = await getPlaylistsApi(api).getPlaylistItems({
|
|
||||||
userId: userId,
|
|
||||||
playlistId: playlistItemId,
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case BaseItemKind.MusicAlbum:
|
case BaseItemKind.MusicAlbum:
|
||||||
result = await getItemsApi(api).getItems({
|
result = await getItemsApi(api).getItems({
|
||||||
parentId: itemId,
|
parentId: item.Id,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
fields: [ItemFields.MediaSources, ItemFields.MediaStreams],
|
fields: [ItemFields.MediaSources, ItemFields.MediaStreams],
|
||||||
sortOrder: [SortOrder.Ascending],
|
sortOrder: [SortOrder.Ascending],
|
||||||
@@ -209,7 +291,7 @@ const PlayButton = ({
|
|||||||
break;
|
break;
|
||||||
case BaseItemKind.MusicArtist:
|
case BaseItemKind.MusicArtist:
|
||||||
result = await getItemsApi(api).getItems({
|
result = await getItemsApi(api).getItems({
|
||||||
artistIds: [itemId],
|
artistIds: [item.Id ?? ""],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
includeItemTypes: [BaseItemKind.Audio],
|
includeItemTypes: [BaseItemKind.Audio],
|
||||||
userId: userId,
|
userId: userId,
|
||||||
@@ -220,7 +302,7 @@ const PlayButton = ({
|
|||||||
break;
|
break;
|
||||||
case BaseItemKind.BoxSet:
|
case BaseItemKind.BoxSet:
|
||||||
result = await getItemsApi(api).getItems({
|
result = await getItemsApi(api).getItems({
|
||||||
parentId: itemId,
|
parentId: item.Id,
|
||||||
userId,
|
userId,
|
||||||
fields: [
|
fields: [
|
||||||
ItemFields.MediaSources,
|
ItemFields.MediaSources,
|
||||||
@@ -231,10 +313,67 @@ const PlayButton = ({
|
|||||||
sortOrder: [SortOrder.Ascending],
|
sortOrder: [SortOrder.Ascending],
|
||||||
sortBy: ["IndexNumber"],
|
sortBy: ["IndexNumber"],
|
||||||
});
|
});
|
||||||
|
if (
|
||||||
|
result.data.Items?.[index]?.Id &&
|
||||||
|
result.data.Items?.[index].MediaSources?.[0]?.Id
|
||||||
|
) {
|
||||||
|
if (currentAudioTrack === "auto") {
|
||||||
|
const defaultAudioStreamIndex =
|
||||||
|
result.data.Items?.[index].MediaSources?.[0]
|
||||||
|
.DefaultAudioStreamIndex;
|
||||||
|
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||||
|
audioStreamIndex: Number(defaultAudioStreamIndex),
|
||||||
|
subtitleStreamIndex:
|
||||||
|
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||||
|
itemId: result.data.Items?.[index].Id ?? "",
|
||||||
|
startTimeTicks:
|
||||||
|
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
||||||
|
userId: userId,
|
||||||
|
mediaSourceId:
|
||||||
|
result.data.Items?.[index].MediaSources?.[0].Id ?? "",
|
||||||
|
playbackInfoDto: {
|
||||||
|
DeviceProfile: playbackProfile,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||||
|
audioStreamIndex: currentAudioTrack,
|
||||||
|
subtitleStreamIndex:
|
||||||
|
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||||
|
itemId: result.data.Items?.[index].Id ?? "",
|
||||||
|
startTimeTicks:
|
||||||
|
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
||||||
|
userId: userId,
|
||||||
|
mediaSourceId:
|
||||||
|
result.data.Items?.[index].MediaSources?.[0].Id ?? "",
|
||||||
|
playbackInfoDto: {
|
||||||
|
DeviceProfile: playbackProfile,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case BaseItemKind.Photo:
|
||||||
|
{
|
||||||
|
const photo = (
|
||||||
|
await getUserLibraryApi(api).getItem({
|
||||||
|
itemId: item.Id,
|
||||||
|
})
|
||||||
|
).data;
|
||||||
|
result = await getItemsApi(api).getItems({
|
||||||
|
parentId: photo.ParentId ?? "",
|
||||||
|
filters: [ItemFilter.IsNotFolder],
|
||||||
|
recursive: false,
|
||||||
|
sortBy: ["SortName"],
|
||||||
|
mediaTypes: ["Photo"],
|
||||||
|
excludeLocationTypes: [LocationType.Virtual],
|
||||||
|
collapseBoxSetItems: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
result = await getItemsApi(api).getItems({
|
result = await getItemsApi(api).getItems({
|
||||||
ids: [itemId],
|
ids: [item.Id ?? ""],
|
||||||
userId: userId,
|
userId: userId,
|
||||||
fields: [
|
fields: [
|
||||||
ItemFields.MediaSources,
|
ItemFields.MediaSources,
|
||||||
@@ -245,59 +384,131 @@ const PlayButton = ({
|
|||||||
sortOrder: [SortOrder.Ascending],
|
sortOrder: [SortOrder.Ascending],
|
||||||
sortBy: ["IndexNumber"],
|
sortBy: ["IndexNumber"],
|
||||||
});
|
});
|
||||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
if (currentAudioTrack === "auto") {
|
||||||
audioStreamIndex: currentAudioTrack,
|
const defaultAudioStreamIndex =
|
||||||
subtitleStreamIndex:
|
result.data.Items?.[index].MediaSources?.[0]
|
||||||
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
.DefaultAudioStreamIndex;
|
||||||
itemId: itemId,
|
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||||
startTimeTicks:
|
audioStreamIndex: Number(defaultAudioStreamIndex),
|
||||||
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
subtitleStreamIndex:
|
||||||
userId: userId,
|
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||||
mediaSourceId: result.data.Items?.[0].MediaSources?.[0].Id,
|
itemId: item.Id ?? "",
|
||||||
playbackInfoDto: {
|
startTimeTicks:
|
||||||
DeviceProfile: playbackProfile,
|
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
||||||
},
|
userId: userId,
|
||||||
});
|
mediaSourceId:
|
||||||
|
result.data.Items?.[0].MediaSources?.[0]?.Id ?? "",
|
||||||
|
playbackInfoDto: {
|
||||||
|
DeviceProfile: playbackProfile,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||||
|
audioStreamIndex: currentAudioTrack,
|
||||||
|
subtitleStreamIndex:
|
||||||
|
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||||
|
itemId: item.Id ?? "",
|
||||||
|
startTimeTicks:
|
||||||
|
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
||||||
|
userId: userId,
|
||||||
|
mediaSourceId:
|
||||||
|
result.data.Items?.[0].MediaSources?.[0]?.Id ?? "",
|
||||||
|
playbackInfoDto: {
|
||||||
|
DeviceProfile: playbackProfile,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { item: result?.data, mediaSource: mediaSource?.data, introInfo };
|
return {
|
||||||
|
item: result?.data,
|
||||||
|
mediaSource: mediaSource?.data,
|
||||||
|
introInfo,
|
||||||
|
episodeIndex: index,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
onSuccess: (result: PlayResult | null) => {
|
onSuccess: (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;
|
||||||
// Album/Individual audio track playback
|
}
|
||||||
const urlOptions = {
|
if (!userId) {
|
||||||
deviceId: api?.deviceInfo.id,
|
console.error("User ID is not available");
|
||||||
userId,
|
enqueueSnackbar("User ID is not available", { variant: "error" });
|
||||||
api_key: api?.accessToken,
|
return;
|
||||||
};
|
}
|
||||||
const urlParams = new URLSearchParams(urlOptions).toString();
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
const playbackUrl = `${api.basePath}/Audio/${result?.item.Items[0].Id}/universal?${urlParams}`;
|
if (audio) {
|
||||||
playAudio(playbackUrl, result?.item.Items[0], undefined);
|
// Album/Individual audio track playback
|
||||||
setQueue(result?.item.Items ?? [], 0);
|
const playbackUrl = generateAudioStreamUrl(
|
||||||
|
result?.item?.Items?.[0].Id,
|
||||||
|
userId,
|
||||||
|
api?.deviceInfo.id,
|
||||||
|
api.basePath,
|
||||||
|
api.accessToken,
|
||||||
|
);
|
||||||
|
playAudio(playbackUrl, result?.item?.Items?.[0], undefined);
|
||||||
|
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) {
|
||||||
|
console.error("No media source ID found");
|
||||||
|
enqueueSnackbar("No media source ID found", { variant: "error" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const episodeIndex = result.episodeIndex;
|
||||||
|
|
||||||
// Creates a queue containing all Episodes for a particular season(series) or collection of movies
|
// Creates a queue containing all Episodes for a particular season(series) or collection of movies
|
||||||
const queue = result?.item.Items;
|
const queue = result?.item?.Items;
|
||||||
|
|
||||||
let itemName = item.Name;
|
let itemName = item.Name;
|
||||||
let episodeTitle = "";
|
let episodeTitle = "";
|
||||||
if (result?.item.Items?.[episodeIndex].SeriesId) {
|
if (result?.item?.Items?.[episodeIndex].SeriesId) {
|
||||||
itemName = result?.item.Items[episodeIndex].SeriesName;
|
itemName = result?.item.Items[episodeIndex].SeriesName;
|
||||||
episodeTitle = `S${result?.item.Items[episodeIndex].ParentIndexNumber ?? 0}:E${
|
episodeTitle = `S${result?.item.Items[episodeIndex].ParentIndexNumber ?? 0}:E${
|
||||||
result?.item.Items[episodeIndex].IndexNumber ?? 0
|
result?.item.Items[episodeIndex].IndexNumber ?? 0
|
||||||
} ${result?.item.Items[episodeIndex].Name}`;
|
} ${result?.item.Items[episodeIndex].Name}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (itemType === "BoxSet") {
|
||||||
|
itemName = result.item.Items[0].Name;
|
||||||
|
}
|
||||||
|
|
||||||
// Subtitle
|
// Subtitle
|
||||||
const subtitle = getSubtitle(
|
const subtitle = getSubtitle(
|
||||||
currentSubTrack,
|
result.mediaSource.MediaSources?.[0].DefaultSubtitleStreamIndex ?? -1,
|
||||||
result?.mediaSource.MediaSources?.[0].MediaStreams,
|
result?.mediaSource?.MediaSources?.[0]?.MediaStreams,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Audio
|
||||||
|
const audio = {
|
||||||
|
track:
|
||||||
|
result.mediaSource.MediaSources?.[0].DefaultAudioStreamIndex ?? 0,
|
||||||
|
allTracks: result.mediaSource.MediaSources?.[0].MediaStreams?.filter(
|
||||||
|
(value) => value.Type === "Audio",
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
// URL generation
|
// URL generation
|
||||||
const urlOptions = {
|
const urlOptions: URLSearchParams = {
|
||||||
|
//@ts-ignore
|
||||||
Static: true,
|
Static: true,
|
||||||
tag: result?.mediaSource.MediaSources?.[0].ETag,
|
tag: result?.mediaSource.MediaSources?.[0].ETag,
|
||||||
mediaSourceId: result?.mediaSource.MediaSources?.[0].Id,
|
mediaSourceId: result?.mediaSource.MediaSources?.[0].Id,
|
||||||
@@ -312,28 +523,32 @@ const PlayButton = ({
|
|||||||
) {
|
) {
|
||||||
playbackUrl = `${api.basePath}${result.mediaSource.MediaSources[0].TranscodingUrl}`;
|
playbackUrl = `${api.basePath}${result.mediaSource.MediaSources[0].TranscodingUrl}`;
|
||||||
}
|
}
|
||||||
let playItemValue = item;
|
let playItemValue = result?.item?.Items?.[episodeIndex];
|
||||||
if (itemType === BaseItemKind.Movie) {
|
if (itemType === BaseItemKind.Movie) {
|
||||||
playItemValue = result?.item.Items?.[0];
|
playItemValue = result?.item?.Items?.[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const startPosition =
|
||||||
|
result?.item?.Items?.[episodeIndex].UserData?.PlaybackPositionTicks;
|
||||||
|
|
||||||
playItem(
|
playItem(
|
||||||
itemName,
|
itemName,
|
||||||
episodeTitle,
|
episodeTitle,
|
||||||
currentVideoTrack,
|
currentVideoTrack ?? 0,
|
||||||
currentAudioTrack,
|
Number(result.mediaSource.MediaSources?.[0].DefaultAudioStreamIndex),
|
||||||
result?.mediaSource?.MediaSources?.[0].Container ?? "mkv",
|
result?.mediaSource?.MediaSources?.[0].Container ?? "mkv",
|
||||||
playbackUrl,
|
playbackUrl,
|
||||||
userId,
|
userId ?? "",
|
||||||
item.UserData?.PlaybackPositionTicks,
|
startPosition,
|
||||||
item.RunTimeTicks,
|
result?.item?.Items?.[episodeIndex].RunTimeTicks,
|
||||||
playItemValue,
|
playItemValue ?? item,
|
||||||
queue,
|
queue,
|
||||||
episodeIndex,
|
episodeIndex,
|
||||||
result?.mediaSource.MediaSources?.[0]?.Id,
|
result?.mediaSource?.MediaSources?.[0]?.Id,
|
||||||
result?.mediaSource.PlaySessionId,
|
result?.mediaSource?.PlaySessionId,
|
||||||
subtitle,
|
subtitle,
|
||||||
result?.introInfo,
|
result?.introInfo,
|
||||||
|
audio,
|
||||||
);
|
);
|
||||||
navigate({ to: "/player" });
|
navigate({ to: "/player" });
|
||||||
}
|
}
|
||||||
@@ -348,17 +563,23 @@ const PlayButton = ({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const handleClick = (e) => {
|
const handleClick = (
|
||||||
|
e: MouseEvent<HTMLAnchorElement | MouseEvent>,
|
||||||
|
currentEpisodeId?: string | undefined,
|
||||||
|
) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
itemQuery.mutate();
|
itemQuery.mutate(currentEpisodeId);
|
||||||
};
|
};
|
||||||
if (iconOnly) {
|
if (iconOnly) {
|
||||||
return (
|
return (
|
||||||
|
//@ts-ignore
|
||||||
<Fab
|
<Fab
|
||||||
color="primary"
|
color="primary"
|
||||||
aria-label="Play"
|
aria-label="Play"
|
||||||
className={className}
|
className={className}
|
||||||
onClick={handleClick}
|
onClick={(e) =>
|
||||||
|
item.Type === "Episode" ? handleClick(e, item.Id) : handleClick(e)
|
||||||
|
}
|
||||||
sx={sx}
|
sx={sx}
|
||||||
size={size}
|
size={size}
|
||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
@@ -374,6 +595,116 @@ const PlayButton = ({
|
|||||||
</Fab>
|
</Fab>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (itemType === BaseItemKind.Series) {
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
let data: BaseItemDtoQueryResult | null = null;
|
||||||
|
const continueWatching = await getItemsApi(api).getResumeItems({
|
||||||
|
userId: userId,
|
||||||
|
limit: 1,
|
||||||
|
mediaTypes: ["Video"],
|
||||||
|
parentId: item.Id,
|
||||||
|
enableUserData: true,
|
||||||
|
fields: [ItemFields.MediaStreams, ItemFields.MediaSources],
|
||||||
|
});
|
||||||
|
const nextUp = await getTvShowsApi(api).getNextUp({
|
||||||
|
userId: userId,
|
||||||
|
parentId: item.Id,
|
||||||
|
limit: 1,
|
||||||
|
});
|
||||||
|
if ((continueWatching.data.Items?.length ?? 0) > 0) {
|
||||||
|
data = continueWatching.data;
|
||||||
|
} else if ((nextUp.data.Items?.length ?? 0) > 0) {
|
||||||
|
data = nextUp.data;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
// enabled: itemType === BaseItemKind.Series,
|
||||||
|
});
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="play-button"
|
||||||
|
style={{
|
||||||
|
width: "auto",
|
||||||
|
position: "relative",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<LoadingButton
|
||||||
|
loading={currentEpisode.isPending}
|
||||||
|
className={className ?? "play-button"}
|
||||||
|
variant="contained"
|
||||||
|
onClick={(e) => handleClick(e, currentEpisode.data?.Items?.[0]?.Id)}
|
||||||
|
startIcon={
|
||||||
|
<div
|
||||||
|
className="material-symbols-rounded fill"
|
||||||
|
style={{
|
||||||
|
zIndex: 1,
|
||||||
|
fontSize: "2em",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
play_arrow
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
{...buttonProps}
|
||||||
|
sx={{
|
||||||
|
position: "relative",
|
||||||
|
overflow: "hidden",
|
||||||
|
}}
|
||||||
|
//@ts-ignore - white color is a custom color in the theme which mui's types don't know about
|
||||||
|
color="white"
|
||||||
|
size={size}
|
||||||
|
>
|
||||||
|
Watch S{currentEpisode.data?.Items?.[0].ParentIndexNumber ?? 1}E
|
||||||
|
{currentEpisode.data?.Items?.[0]?.IndexNumber ?? 1}
|
||||||
|
<MemoizedLinearProgress
|
||||||
|
//@ts-ignore
|
||||||
|
value={
|
||||||
|
100 >
|
||||||
|
(currentEpisode.data?.Items?.[0].UserData?.PlayedPercentage ??
|
||||||
|
100) &&
|
||||||
|
(currentEpisode.data?.Items?.[0].UserData?.PlayedPercentage ??
|
||||||
|
0) > 0
|
||||||
|
? currentEpisode.data?.Items?.[0].UserData?.PlayedPercentage
|
||||||
|
: 0
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</LoadingButton>
|
||||||
|
{(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,7 +716,9 @@ 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
|
<div
|
||||||
className="material-symbols-rounded fill"
|
className="material-symbols-rounded fill"
|
||||||
@@ -402,10 +735,11 @@ const PlayButton = ({
|
|||||||
position: "relative",
|
position: "relative",
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
}}
|
}}
|
||||||
|
//@ts-ignore - 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 +748,17 @@ const PlayButton = ({
|
|||||||
audio
|
audio
|
||||||
? "Play Now"
|
? "Play Now"
|
||||||
: "Watch Now"}
|
: "Watch Now"}
|
||||||
<LinearProgress
|
<MemoizedLinearProgress
|
||||||
variant="determinate"
|
//@ts-ignore
|
||||||
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 +770,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}
|
||||||
|
|||||||
@@ -44,6 +44,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 {
|
||||||
|
|||||||
@@ -13,10 +13,11 @@ import { getTypeIcon } from "../utils/iconsCollection";
|
|||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import "./queueButton.scss";
|
import "./queueButton.scss";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { useRouteContext } from "@tanstack/react-router";
|
|
||||||
const QueueButton = () => {
|
const QueueButton = () => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
|
|
||||||
const [queueItems, currentItemIndex] = useQueue((state) => [
|
const [queueItems, currentItemIndex] = useQueue((state) => [
|
||||||
state.tracks,
|
state.tracks,
|
||||||
state.currentItemIndex,
|
state.currentItemIndex,
|
||||||
@@ -25,16 +26,17 @@ const QueueButton = () => {
|
|||||||
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 [buttonEl, setButtonEl] = useState(null);
|
const [buttonEl, setButtonEl] = useState<HTMLButtonElement | null>(null);
|
||||||
|
|
||||||
const handlePlay = useMutation({
|
const handlePlay = useMutation({
|
||||||
mutationKey: ["handlePlayIndex"],
|
mutationKey: ["handlePlayIndex"],
|
||||||
mutationFn: async ({ index }: { index: number }) => {
|
mutationFn: async ({ index }: { index: number }) => {
|
||||||
const result = playItemFromQueue(index, user.data?.Id);
|
const result = playItemFromQueue(index, user.data?.Id, api);
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
@@ -76,82 +78,204 @@ const QueueButton = () => {
|
|||||||
position: "relative",
|
position: "relative",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{queueItems.map((item, index) => {
|
{queueItems?.[currentItemIndex]?.Id && (
|
||||||
return (
|
<>
|
||||||
|
<Typography px="1em" mb={2} variant="h5" fontWeight={300}>
|
||||||
|
Currently Playing:
|
||||||
|
</Typography>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
className="queue-item"
|
className="queue-item"
|
||||||
disabled={index === currentItemIndex}
|
disabled
|
||||||
onClick={() => handlePlay.mutate({ index })}
|
key={queueItems[currentItemIndex].Id}
|
||||||
key={item.Id}
|
|
||||||
>
|
>
|
||||||
<Typography variant="subtitle2">
|
<Typography variant="subtitle2">
|
||||||
{item.Type === "Audio"
|
{queueItems[currentItemIndex]?.Type === "Audio"
|
||||||
? index + 1
|
? currentItemIndex + 1
|
||||||
: item.IndexNumberEnd
|
: queueItems[currentItemIndex].IndexNumberEnd
|
||||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} / ${item.IndexNumberEnd}`
|
? `S${queueItems[currentItemIndex].ParentIndexNumber}:E${queueItems[currentItemIndex].IndexNumber} / ${queueItems[currentItemIndex].IndexNumberEnd}`
|
||||||
: `S${item.ParentIndexNumber}:E${item.IndexNumber}`}
|
: `S${queueItems[currentItemIndex].ParentIndexNumber}:E${queueItems[currentItemIndex].IndexNumber}`}
|
||||||
</Typography>
|
</Typography>
|
||||||
<div className="queue-item-image-container">
|
<div className="queue-item-image-container">
|
||||||
{item.ImageTags?.Primary ? (
|
{queueItems[currentItemIndex].ImageTags?.Primary ? (
|
||||||
<img
|
<img
|
||||||
className="queue-item-image"
|
className="queue-item-image"
|
||||||
src={api?.getItemImageUrl(item?.Id, "Primary", {
|
src={
|
||||||
tag: item.ImageTags?.Primary,
|
api &&
|
||||||
})}
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
alt={item.Name}
|
queueItems[currentItemIndex]?.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
|
tag: queueItems[currentItemIndex].ImageTags
|
||||||
|
?.Primary,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
alt={queueItems[currentItemIndex].Name ?? "image"}
|
||||||
/>
|
/>
|
||||||
) : item.AlbumPrimaryImageTag?.length > 0 ? (
|
) : (queueItems[currentItemIndex].AlbumPrimaryImageTag
|
||||||
|
?.length ?? -1) > 0 ? (
|
||||||
<img
|
<img
|
||||||
className="queue-item-image"
|
className="queue-item-image"
|
||||||
src={api?.getItemImageUrl(item?.AlbumId, "Primary", {
|
src={
|
||||||
tag: item.AlbumPrimaryImageTag[0],
|
api &&
|
||||||
})}
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
alt={item.Name}
|
queueItems?.[currentItemIndex]?.AlbumId ?? "",
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
|
tag: queueItems?.[currentItemIndex]
|
||||||
|
.AlbumPrimaryImageTag?.[0],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
alt={queueItems[currentItemIndex].Name ?? "image"}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="queue-item-image-icon">
|
<div className="queue-item-image-icon">
|
||||||
{getTypeIcon(item.Type)}
|
{queueItems[currentItemIndex].Type &&
|
||||||
|
getTypeIcon(queueItems[currentItemIndex].Type)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{index === currentItemIndex && (
|
<span
|
||||||
<span
|
className="material-symbols-rounded"
|
||||||
className="material-symbols-rounded"
|
style={{
|
||||||
style={{
|
position: "absolute",
|
||||||
position: "absolute",
|
top: "50%",
|
||||||
top: "50%",
|
left: "50%",
|
||||||
left: "50%",
|
transform: "translate(-50%,-50%)",
|
||||||
transform: "translate(-50%,-50%)",
|
fontSize: "2em",
|
||||||
fontSize: "2em",
|
//@ts-ignore
|
||||||
"--wght": "100",
|
"--wght": "100",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
equalizer
|
equalizer
|
||||||
</span>
|
</span>
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<div className="queue-item-info">
|
<div className="queue-item-info">
|
||||||
{item.SeriesName ? (
|
{queueItems[currentItemIndex].SeriesName ? (
|
||||||
<>
|
<>
|
||||||
<Typography variant="subtitle1" width="100%">
|
<Typography variant="subtitle1" width="100%">
|
||||||
{item.SeriesName}
|
{queueItems[currentItemIndex].SeriesName}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
variant="subtitle2"
|
variant="subtitle2"
|
||||||
width="100%"
|
width="100%"
|
||||||
style={{ opacity: 0.6 }}
|
style={{ opacity: 0.6 }}
|
||||||
>
|
>
|
||||||
{item.Name}
|
{queueItems[currentItemIndex].Name}
|
||||||
</Typography>
|
</Typography>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<Typography variant="subtitle1" width="100%">
|
<Typography variant="subtitle1" width="100%">
|
||||||
{item.Name}
|
{queueItems[currentItemIndex].Name}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
);
|
</>
|
||||||
})}
|
)}
|
||||||
|
{queueItems &&
|
||||||
|
queueItems.slice(currentItemIndex + 1, queueItems.length - 1)
|
||||||
|
.length > 0 && (
|
||||||
|
<Typography px="1em" my={2} variant="h5" fontWeight={300}>
|
||||||
|
Queue:
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
{queueItems
|
||||||
|
?.slice(currentItemIndex + 1, queueItems.length - 1)
|
||||||
|
.map((item, index) => {
|
||||||
|
return (
|
||||||
|
<MenuItem
|
||||||
|
className="queue-item"
|
||||||
|
onClick={() =>
|
||||||
|
handlePlay.mutate({ index: index + currentItemIndex })
|
||||||
|
}
|
||||||
|
key={item.Id}
|
||||||
|
>
|
||||||
|
<Typography variant="subtitle2">
|
||||||
|
{item.Type === "Audio"
|
||||||
|
? index + 1
|
||||||
|
: item.IndexNumberEnd
|
||||||
|
? `S${item.ParentIndexNumber}:E${item.IndexNumber} / ${item.IndexNumberEnd}`
|
||||||
|
: `S${item.ParentIndexNumber}:E${item.IndexNumber}`}
|
||||||
|
</Typography>
|
||||||
|
<div className="queue-item-image-container">
|
||||||
|
{item.ImageTags?.Primary ? (
|
||||||
|
<img
|
||||||
|
className="queue-item-image"
|
||||||
|
src={
|
||||||
|
api &&
|
||||||
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item?.Id ?? "",
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
|
tag: item.ImageTags?.Primary,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
alt={item.Name ?? "image"}
|
||||||
|
/>
|
||||||
|
) : (item.AlbumPrimaryImageTag?.length ?? -1) > 0 ? (
|
||||||
|
<img
|
||||||
|
className="queue-item-image"
|
||||||
|
src={
|
||||||
|
api &&
|
||||||
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item?.AlbumId ?? "",
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
|
tag: item.AlbumPrimaryImageTag?.[0],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
alt={item.Name ?? "image"}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<div className="queue-item-image-icon">
|
||||||
|
{item.Type && getTypeIcon(item.Type)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="queue-item-info">
|
||||||
|
{item.SeriesName ? (
|
||||||
|
<>
|
||||||
|
<Typography
|
||||||
|
variant="subtitle1"
|
||||||
|
width="100%"
|
||||||
|
sx={{ overflow: "hidden", textOverflow: "ellipsis" }}
|
||||||
|
>
|
||||||
|
{item.SeriesName}
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
variant="subtitle2"
|
||||||
|
width="100%"
|
||||||
|
style={{ opacity: 0.6 }}
|
||||||
|
>
|
||||||
|
{item.Name}
|
||||||
|
</Typography>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<Typography
|
||||||
|
variant="subtitle1"
|
||||||
|
width="100%"
|
||||||
|
sx={{ overflow: "hidden", textOverflow: "ellipsis" }}
|
||||||
|
>
|
||||||
|
{item.Name}
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
variant="subtitle2"
|
||||||
|
width="100%"
|
||||||
|
style={{ opacity: 0.6 }}
|
||||||
|
sx={{ overflow: "hidden", textOverflow: "ellipsis" }}
|
||||||
|
>
|
||||||
|
{item.Artists?.join(", ")}
|
||||||
|
</Typography>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</MenuItem>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</MenuList>
|
</MenuList>
|
||||||
</Menu>
|
</Menu>
|
||||||
<IconButton onClick={(e) => setButtonEl(e.currentTarget)}>
|
<IconButton onClick={(e) => setButtonEl(e.currentTarget)}>
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
import useInterval from "@/utils/hooks/useInterval";
|
||||||
import { saveUser } from "@/utils/storage/user";
|
import { saveUser } from "@/utils/storage/user";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { 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 +12,111 @@ 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";
|
||||||
|
|
||||||
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,65 @@ 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}
|
||||||
>
|
>
|
||||||
<DialogContent
|
<DialogContent
|
||||||
style={{
|
style={{
|
||||||
@@ -159,8 +221,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 +250,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)}
|
||||||
@@ -29,18 +29,20 @@ const TrailerButton = (props: TrailerButtonType) => {
|
|||||||
}}
|
}}
|
||||||
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>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
|
|
||||||
import React, { memo } from "react";
|
import React, { memo } from "react";
|
||||||
import { Component, useState } from "react";
|
|
||||||
|
|
||||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
|
|
||||||
import LinearProgress from "@mui/material/LinearProgress";
|
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -13,27 +11,16 @@ import {
|
|||||||
BaseItemKind,
|
BaseItemKind,
|
||||||
type ImageType,
|
type ImageType,
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import { ErrorBoundary } from "react-error-boundary";
|
||||||
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 getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
|
||||||
const cardImageAspectRatios = {
|
import { useInView } from "react-intersection-observer";
|
||||||
thumb: 1.777,
|
|
||||||
portrait: 0.666,
|
|
||||||
square: 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
const availableSpecialRoutes = [
|
|
||||||
BaseItemKind.Series,
|
|
||||||
BaseItemKind.BoxSet,
|
|
||||||
BaseItemKind.MusicAlbum,
|
|
||||||
BaseItemKind.Episode,
|
|
||||||
BaseItemKind.Playlist,
|
|
||||||
];
|
|
||||||
|
|
||||||
const CardComponent = ({
|
const CardComponent = ({
|
||||||
item,
|
item,
|
||||||
@@ -52,8 +39,8 @@ const CardComponent = ({
|
|||||||
item: BaseItemDto;
|
item: BaseItemDto;
|
||||||
cardTitle: string | undefined | null;
|
cardTitle: string | undefined | null;
|
||||||
cardCaption?: string | null | number;
|
cardCaption?: string | null | number;
|
||||||
imageType: ImageType;
|
imageType?: ImageType;
|
||||||
cardType: string;
|
cardType: "square" | "thumb" | "portrait";
|
||||||
queryKey?: string[];
|
queryKey?: string[];
|
||||||
userId?: string;
|
userId?: string;
|
||||||
seriesId?: string | null;
|
seriesId?: string | null;
|
||||||
@@ -65,36 +52,46 @@ const CardComponent = ({
|
|||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const defaultOnClick = () => {
|
const defaultOnClick = () => {
|
||||||
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 { ref, inView } = useInView({
|
||||||
|
threshold: 0,
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="card" onClick={onClick ? onClick : defaultOnClick}>
|
<div
|
||||||
|
className="card"
|
||||||
|
ref={ref}
|
||||||
|
onClick={onClick ? onClick : defaultOnClick}
|
||||||
|
>
|
||||||
<div className={`card-image-container ${cardType}`}>
|
<div className={`card-image-container ${cardType}`}>
|
||||||
<ErrorBoundary fallback>
|
<ErrorBoundary fallback>
|
||||||
<div
|
<div
|
||||||
@@ -121,77 +118,79 @@ const CardComponent = ({
|
|||||||
</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,
|
||||||
}}
|
}}
|
||||||
onLoadStart={(e) => console.log(e)}
|
loading="lazy"
|
||||||
className="card-image"
|
onLoad={(e) => {
|
||||||
/>
|
e.currentTarget.style.setProperty("opacity", "1");
|
||||||
<div className="card-overlay">
|
}}
|
||||||
{!disableOverlay && (
|
onLoadStart={(e) => console.log(e)}
|
||||||
<>
|
className="card-image"
|
||||||
<PlayButton
|
/>
|
||||||
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={{
|
currentAudioTrack="auto"
|
||||||
style: { fontSize: "2.5em" },
|
currentSubTrack={-1}
|
||||||
}}
|
currentVideoTrack={0}
|
||||||
iconOnly
|
className="card-play-button"
|
||||||
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>
|
||||||
</div>
|
)}
|
||||||
{item.UserData?.PlaybackPositionTicks > 0 && (
|
{(item.UserData?.PlaybackPositionTicks ?? -1) > 0 && (
|
||||||
<div className="card-progress-container">
|
<div className="card-progress-container">
|
||||||
<div
|
<div
|
||||||
className="card-progress"
|
className="card-progress"
|
||||||
|
|||||||
@@ -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,24 +1,49 @@
|
|||||||
import PropTypes from "prop-types";
|
import React, { type ReactNode } from "react";
|
||||||
import React, { useState } from "react";
|
|
||||||
|
|
||||||
import Carousel from "react-multi-carousel";
|
import Carousel from "react-multi-carousel";
|
||||||
import "react-multi-carousel/lib/styles.css";
|
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 IconButton from "@mui/material/IconButton";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
import "./cardScroller.scss";
|
import "./cardScroller.scss";
|
||||||
|
|
||||||
export const CardScroller = ({
|
//@ts-ignore - I don't know the prop type for react-multi-carousel's customRightArrow and customLeftArrow
|
||||||
|
function RightButton(props) {
|
||||||
|
const { carouselState, children, rtl, ...restProps } = props;
|
||||||
|
return (
|
||||||
|
<IconButton className="card-scroller-button right" {...restProps}>
|
||||||
|
<div className="material-symbols-rounded">chevron_right</div>
|
||||||
|
</IconButton>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
//@ts-ignore - I don't know the prop type for react-multi-carousel's customRightArrow and customLeftArrow
|
||||||
|
function LeftButton(props) {
|
||||||
|
const { carouselState, children, rtl, ...restProps } = props;
|
||||||
|
return (
|
||||||
|
<IconButton className="card-scroller-button left" {...restProps}>
|
||||||
|
<div className="material-symbols-rounded">chevron_left</div>
|
||||||
|
</IconButton>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
type CardScrollerProps = {
|
||||||
|
children: ReactNode;
|
||||||
|
displayCards: number;
|
||||||
|
title: string;
|
||||||
|
headingProps?: object;
|
||||||
|
disableDecoration?: boolean;
|
||||||
|
boxProps?: object;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function CardScroller({
|
||||||
children,
|
children,
|
||||||
displayCards,
|
displayCards,
|
||||||
title,
|
title,
|
||||||
headingProps,
|
headingProps,
|
||||||
disableDecoration = false,
|
disableDecoration = false,
|
||||||
boxProps,
|
boxProps,
|
||||||
}) => {
|
}: CardScrollerProps) {
|
||||||
const responsive = {
|
const responsive = {
|
||||||
superLargeDesktop: {
|
superLargeDesktop: {
|
||||||
// the naming can be any, depends on you.
|
// the naming can be any, depends on you.
|
||||||
@@ -53,12 +78,14 @@ export const CardScroller = ({
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const [carouselRef, setCarouselRef] = useState();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box {...boxProps} className="card-scroller-container" mb={1}>
|
<div
|
||||||
<Box
|
{...boxProps}
|
||||||
sx={{ mb: 1 }}
|
className="card-scroller-container"
|
||||||
|
style={{ marginBottom: "1.2em" }}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{ marginBottom: "1.2em" }}
|
||||||
className={
|
className={
|
||||||
disableDecoration
|
disableDecoration
|
||||||
? "card-scroller-header-container hidden-decoration"
|
? "card-scroller-header-container hidden-decoration"
|
||||||
@@ -73,35 +100,20 @@ export const CardScroller = ({
|
|||||||
>
|
>
|
||||||
<div className="card-scroller-heading-decoration" /> {title}
|
<div className="card-scroller-heading-decoration" /> {title}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</div>
|
||||||
<Carousel
|
<Carousel
|
||||||
swipeable
|
swipeable
|
||||||
draggable
|
draggable
|
||||||
responsive={responsive}
|
responsive={responsive}
|
||||||
arrows
|
arrows
|
||||||
ref={(el) => setCarouselRef(el)}
|
|
||||||
className="card-scroller"
|
className="card-scroller"
|
||||||
customTransition="all .6s"
|
customTransition="all .6s"
|
||||||
transitionDuration={600}
|
transitionDuration={600}
|
||||||
customRightArrow={
|
customRightArrow={<RightButton />}
|
||||||
<IconButton className="card-scroller-button right">
|
customLeftArrow={<LeftButton />}
|
||||||
<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}
|
{children}
|
||||||
</Carousel>
|
</Carousel>
|
||||||
</Box>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
CardScroller.propTypes = {
|
|
||||||
displayCards: PropTypes.number.isRequired,
|
|
||||||
title: PropTypes.string.isRequired,
|
|
||||||
headingProps: PropTypes.any,
|
|
||||||
};
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { AnimatePresence, motion } from "framer-motion";
|
import { AnimatePresence, motion } from "framer-motion";
|
||||||
import React, { useEffect, useState } from "react";
|
import type { PanInfo } from "framer-motion";
|
||||||
|
import React, { useEffect, useState, useMemo, useCallback } from "react";
|
||||||
import IconButton from "@mui/material/IconButton";
|
import type { MouseEvent, PointerEvent } from "react";
|
||||||
|
|
||||||
import { useCarouselStore } from "../../utils/store/carousel";
|
import { useCarouselStore } from "../../utils/store/carousel";
|
||||||
import "./carousel.scss";
|
import "./carousel.scss";
|
||||||
@@ -9,53 +9,113 @@ 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 CarouselSlide from "../carouselSlide";
|
import CarouselSlide from "../carouselSlide";
|
||||||
|
|
||||||
import ReactMultiCarousel from "react-multi-carousel";
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import Slider from "../Slider";
|
import Slider from "../Slider";
|
||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
import { getTypeIcon } from "../utils/iconsCollection";
|
||||||
|
|
||||||
const swipeConfidenceThreshold = 8000;
|
const swipeConfidenceThreshold = 8000;
|
||||||
const swipePower = (offset, velocity) => {
|
const swipePower = (offset: number, velocity: number) => {
|
||||||
return Math.abs(offset) * velocity;
|
return Math.abs(offset) * velocity;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Memoize CarouselSlide to prevent unnecessary re-renders
|
||||||
|
const MemoizedCarouselSlide = React.memo(CarouselSlide);
|
||||||
|
|
||||||
|
// Memoize Slider to prevent unnecessary re-renders
|
||||||
|
const MemoizedSlider = React.memo(Slider);
|
||||||
|
|
||||||
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 [setDirection, dir] = useCarouselStore((state) => [
|
const [setDirection] = useCarouselStore((state) => [state.setDirection]);
|
||||||
state.setDirection,
|
|
||||||
state.direction,
|
|
||||||
]);
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
onChange(currentSlide);
|
onChange(currentSlide);
|
||||||
}, [content[currentSlide]?.Id]);
|
}, [content[currentSlide]?.Id]);
|
||||||
|
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
|
|
||||||
const responsive = {
|
// Memoize the content mapping
|
||||||
superLargeDesktop: {
|
const sliderContent = useMemo(() => {
|
||||||
// the naming can be any, depends on you.
|
return content.map((item, index) => {
|
||||||
breakpoint: { max: 4000, min: 3000 },
|
return (
|
||||||
items: 6,
|
<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}
|
||||||
|
onClick={() => {
|
||||||
|
if (currentSlide > index) {
|
||||||
|
setDirection("left");
|
||||||
|
} else if (currentSlide <= index) {
|
||||||
|
setDirection("right");
|
||||||
|
}
|
||||||
|
setCurrentSlide(index);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{item.ImageTags?.Thumb ? (
|
||||||
|
<img
|
||||||
|
src={
|
||||||
|
api &&
|
||||||
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.Id ?? "",
|
||||||
|
"Thumb",
|
||||||
|
{
|
||||||
|
tag: item.ImageTags.Primary,
|
||||||
|
fillWidth: 300,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
alt={item.Name ?? "item-image"}
|
||||||
|
className="carousel-indicator-image"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<div className="carousel-indicator-icon">
|
||||||
|
{getTypeIcon(item.Type ?? "Movie")}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</motion.div>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}, [content, currentSlide, api, setDirection]);
|
||||||
|
|
||||||
|
const handleDragEnd = useCallback(
|
||||||
|
(
|
||||||
|
_: MouseEvent | TouchEvent | PointerEvent,
|
||||||
|
{ offset, velocity }: PanInfo,
|
||||||
|
) => {
|
||||||
|
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);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
desktop: {
|
[currentSlide, content.length, setDirection],
|
||||||
breakpoint: { max: 3000, min: 1024 },
|
);
|
||||||
items: 6,
|
|
||||||
},
|
|
||||||
tablet: {
|
|
||||||
breakpoint: { max: 1024, min: 464 },
|
|
||||||
items: 4,
|
|
||||||
},
|
|
||||||
mobile: {
|
|
||||||
breakpoint: { max: 464, min: 0 },
|
|
||||||
items: 1,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="carousel">
|
<div className="carousel">
|
||||||
@@ -72,79 +132,23 @@ const Carousel = ({
|
|||||||
drag={"x"}
|
drag={"x"}
|
||||||
dragConstraints={{ left: 0, right: 0 }}
|
dragConstraints={{ left: 0, right: 0 }}
|
||||||
dragElastic={1}
|
dragElastic={1}
|
||||||
onDragEnd={(e, { offset, velocity }) => {
|
//@ts-ignore
|
||||||
const swipe = swipePower(offset.x, velocity.x);
|
onDragEnd={handleDragEnd}
|
||||||
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={{
|
style={{
|
||||||
height: "100%",
|
height: "100%",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CarouselSlide
|
<MemoizedCarouselSlide
|
||||||
item={content[currentSlide]}
|
item={content[currentSlide]}
|
||||||
key={content[currentSlide].Id}
|
key={content[currentSlide].Id}
|
||||||
/>
|
/>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
<Slider
|
<MemoizedSlider currentSlide={currentSlide} content={sliderContent} />
|
||||||
currentSlide={currentSlide}
|
|
||||||
content={content.map((item, index) => (
|
|
||||||
<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}
|
|
||||||
onClick={() => {
|
|
||||||
if (currentSlide > index) {
|
|
||||||
setDirection("left");
|
|
||||||
} else if (currentSlide <= index) {
|
|
||||||
setDirection("right");
|
|
||||||
}
|
|
||||||
setCurrentSlide(index);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{item.ImageTags?.Thumb ? (
|
|
||||||
<img
|
|
||||||
src={api.getItemImageUrl(item.Id, "Thumb", {
|
|
||||||
tag: item.ImageTags.Primary,
|
|
||||||
fillWidth: 300,
|
|
||||||
})}
|
|
||||||
alt={item.Name ?? "item-image"}
|
|
||||||
className="carousel-indicator-image"
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<div className="carousel-indicator-icon">
|
|
||||||
{getTypeIcon(item.Type)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</motion.div>
|
|
||||||
))}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Carousel;
|
export default React.memo(Carousel);
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
import React, { memo } from "react";
|
import React from "react";
|
||||||
import { Blurhash } from "react-blurhash";
|
|
||||||
|
|
||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
|
|
||||||
import Button from "@mui/material/Button";
|
import Button from "@mui/material/Button";
|
||||||
import Chip from "@mui/material/Chip";
|
import Chip from "@mui/material/Chip";
|
||||||
import Paper from "@mui/material/Paper";
|
|
||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
@@ -13,111 +11,82 @@ import { yellow } from "@mui/material/colors";
|
|||||||
|
|
||||||
import { endsAt, getRuntime } from "@/utils/date/time";
|
import { endsAt, getRuntime } from "@/utils/date/time";
|
||||||
import { green, red } from "@mui/material/colors";
|
import { green, red } from "@mui/material/colors";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
import { getTypeIcon } from "../utils/iconsCollection";
|
||||||
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { useCarouselStore } from "@/utils/store/carousel";
|
import { useCarouselStore } from "@/utils/store/carousel";
|
||||||
|
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 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";
|
||||||
|
|
||||||
const availableSpecialRoutes = [
|
|
||||||
BaseItemKind.Series,
|
|
||||||
BaseItemKind.BoxSet,
|
|
||||||
BaseItemKind.MusicAlbum,
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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"
|
|
||||||
sx={{
|
|
||||||
background: "transparent",
|
|
||||||
// px: 3,
|
|
||||||
}}
|
|
||||||
elevation={0}
|
|
||||||
>
|
|
||||||
<div className="hero-carousel-background-container">
|
<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>
|
</div>
|
||||||
@@ -155,20 +124,20 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
fontWeight={200}
|
fontWeight={200}
|
||||||
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";
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -207,7 +176,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
>
|
>
|
||||||
{item.PremiereDate && (
|
{item.PremiereDate && (
|
||||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||||
{item.ProductionYear ?? ""}
|
{item.ProductionYear}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
{item.OfficialRating && (
|
{item.OfficialRating && (
|
||||||
@@ -270,15 +239,21 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{item.RunTimeTicks && (
|
{item.RunTimeTicks ? (
|
||||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||||
{getRuntime(item.RunTimeTicks)}
|
{getRuntime(item.RunTimeTicks)}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
)}
|
)}
|
||||||
{item.RunTimeTicks && (
|
{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(" / ")}
|
||||||
@@ -335,16 +310,14 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
>
|
>
|
||||||
<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}
|
currentAudioTrack={0}
|
||||||
currentSubTrack={0}
|
currentSubTrack={0}
|
||||||
currentVideoTrack={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 +330,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
size="large"
|
size="large"
|
||||||
|
//@ts-ignore
|
||||||
color="white"
|
color="white"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
endIcon={
|
endIcon={
|
||||||
@@ -377,21 +351,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>
|
</div>
|
||||||
</Paper>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
|
||||||
@@ -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;
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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 createPortal(
|
||||||
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,9 @@ const NProgress: React.FC<{ isAnimating: boolean | number }> = ({
|
|||||||
value={progress * 100}
|
value={progress * 100}
|
||||||
variant="determinate"
|
variant="determinate"
|
||||||
/>
|
/>
|
||||||
</div>
|
)}
|
||||||
);
|
</div>,
|
||||||
}
|
document.body,
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
||||||
|
|||||||
@@ -1,24 +1,12 @@
|
|||||||
import React, {
|
import React, { useEffect, useMemo, useRef, useState } from "react";
|
||||||
useEffect,
|
|
||||||
useLayoutEffect,
|
|
||||||
useMemo,
|
|
||||||
useRef,
|
|
||||||
useState,
|
|
||||||
} from "react";
|
|
||||||
|
|
||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
|
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
|
||||||
import Fab from "@mui/material/Fab";
|
import Fab from "@mui/material/Fab";
|
||||||
import Grow from "@mui/material/Grow";
|
|
||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import Paper from "@mui/material/Paper";
|
|
||||||
import Popper from "@mui/material/Popper";
|
|
||||||
import Slider from "@mui/material/Slider";
|
import Slider from "@mui/material/Slider";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
import WaveSurfer from "wavesurfer.js";
|
|
||||||
|
|
||||||
import { setAudioRef, useAudioPlayback } from "@/utils/store/audioPlayback";
|
import { setAudioRef, useAudioPlayback } from "@/utils/store/audioPlayback";
|
||||||
import useQueue from "@/utils/store/queue";
|
import useQueue from "@/utils/store/queue";
|
||||||
|
|
||||||
@@ -26,18 +14,20 @@ import { AnimatePresence } from "framer-motion";
|
|||||||
import "./audioPlayer.scss";
|
import "./audioPlayer.scss";
|
||||||
|
|
||||||
import { getRuntimeMusic, secToTicks, ticksToSec } from "@/utils/date/time";
|
import { getRuntimeMusic, secToTicks, ticksToSec } from "@/utils/date/time";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
|
|
||||||
import PlayNextButton from "@/components/buttons/playNextButton";
|
import PlayNextButton from "@/components/buttons/playNextButton";
|
||||||
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
||||||
import QueueButton from "@/components/buttons/queueButton";
|
import QueueButton from "@/components/buttons/queueButton";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
import { playItemFromQueue } from "@/utils/store/playback";
|
||||||
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
|
|
||||||
const AudioPlayer = () => {
|
const AudioPlayer = () => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const audioRef = useRef<HTMLAudioElement>(null!);
|
|
||||||
|
const audioRef = useRef<HTMLAudioElement | null>(null);
|
||||||
const [url, display, item] = useAudioPlayback((state) => [
|
const [url, display, item] = useAudioPlayback((state) => [
|
||||||
state.url,
|
state.url,
|
||||||
state.display,
|
state.display,
|
||||||
@@ -49,108 +39,98 @@ const AudioPlayer = () => {
|
|||||||
state.currentItemIndex,
|
state.currentItemIndex,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
enabled: Boolean(display) && Boolean(api),
|
|
||||||
});
|
|
||||||
|
|
||||||
const waveSurferContainerRef = useRef(null);
|
|
||||||
|
|
||||||
const playing = useMemo(() => {
|
const playing = useMemo(() => {
|
||||||
if (audioRef.current?.paused) return false;
|
if (audioRef.current?.paused) return false;
|
||||||
return true;
|
return true;
|
||||||
}, [audioRef.current?.paused]);
|
}, [audioRef.current?.paused]);
|
||||||
const [playerReady, setPlayerReady] = useState(false);
|
|
||||||
const [volume, setVolume] = useState(0.8);
|
const [volume, setVolume] = useState(0.8);
|
||||||
const [isMuted, setIsMuted] = useState(false);
|
const [isMuted, setIsMuted] = useState(false);
|
||||||
const [progress, setProgress] = useState(0);
|
const [progress, setProgress] = useState(0);
|
||||||
const [isScrubbing, setIsScrubbing] = useState(false);
|
const [isScrubbing, setIsScrubbing] = useState(false);
|
||||||
const [sliderProgress, setSliderProgress] = useState(false);
|
const [sliderProgress, setSliderProgress] = useState(0);
|
||||||
|
|
||||||
const [loading, setLoading] = useState(true);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (display) {
|
if (display) {
|
||||||
const audioUrlRequest = new Request(audioRef.current?.dataset.src, {
|
// const audioUrlRequest = new Request(audioRef.current?.dataset.src, {
|
||||||
method: "GET",
|
// method: "GET",
|
||||||
headers: {
|
// headers: {
|
||||||
Authorization: api.authorizationHeader,
|
// Authorization: api.authorizationHeader,
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
fetch(audioUrlRequest)
|
// fetch(audioUrlRequest)
|
||||||
.then((res) => res)
|
// .then((res) => res)
|
||||||
.then(async (result) => {
|
// .then(async (result) => {
|
||||||
const blob = await result.blob();
|
// const blob = await result.blob();
|
||||||
const blobUrl = URL.createObjectURL(blob);
|
// const blobUrl = URL.createObjectURL(blob);
|
||||||
audioRef.current.src = blobUrl;
|
// audioRef.current.src = blobUrl;
|
||||||
audioRef.current.play();
|
// await audioRef.current.play();
|
||||||
setLoading(false);
|
// setLoading(false);
|
||||||
});
|
// });
|
||||||
|
|
||||||
|
// Set the audio ref in the store to allow for global control
|
||||||
setAudioRef(audioRef);
|
setAudioRef(audioRef);
|
||||||
}
|
}
|
||||||
}, [url, tracks[currentTrack]?.Id]);
|
}, [url, tracks?.[currentTrack]?.Id]);
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const info = useMemo(
|
const info = useMemo(
|
||||||
() => (
|
() =>
|
||||||
<div
|
api && (
|
||||||
// initial={{
|
<div
|
||||||
// filter: "opacity(0)",
|
// initial={{
|
||||||
// }}
|
// filter: "opacity(0)",
|
||||||
// animate={{
|
// }}
|
||||||
// filter: "opacity(1)",
|
// animate={{
|
||||||
// }}
|
// filter: "opacity(1)",
|
||||||
// exit={{
|
// }}
|
||||||
// filter: "opacity(0)",
|
// exit={{
|
||||||
// }}
|
// filter: "opacity(0)",
|
||||||
className="audio-player-info"
|
// }}
|
||||||
>
|
className="audio-player-info"
|
||||||
<div className="audio-player-image-container">
|
>
|
||||||
<img
|
<div className="audio-player-image-container">
|
||||||
alt={tracks[currentTrack]?.Name}
|
<img
|
||||||
className="audio-player-image"
|
alt={tracks?.[currentTrack]?.Name ?? "track"}
|
||||||
src={api?.getItemImageUrl(
|
className="audio-player-image"
|
||||||
!item?.ImageTags.Primary ? item?.AlbumId : item?.Id,
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
"Primary",
|
(!item?.ImageTags?.Primary ? item?.AlbumId : item.Id) ?? "",
|
||||||
{
|
"Primary",
|
||||||
quality: 85,
|
{
|
||||||
fillHeight: 462,
|
quality: 85,
|
||||||
fillWidth: 462,
|
fillHeight: 462,
|
||||||
},
|
fillWidth: 462,
|
||||||
)}
|
},
|
||||||
/>
|
)}
|
||||||
<span className="material-symbols-rounded audio-player-image-icon">
|
/>
|
||||||
music_note
|
<span className="material-symbols-rounded audio-player-image-icon">
|
||||||
</span>
|
music_note
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div className="audio-player-info-text">
|
||||||
|
<Typography
|
||||||
|
variant="subtitle2"
|
||||||
|
style={{
|
||||||
|
width: "100%",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{item?.Name}
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
variant="caption"
|
||||||
|
style={{
|
||||||
|
opacity: 0.5,
|
||||||
|
}}
|
||||||
|
noWrap
|
||||||
|
>
|
||||||
|
by {item?.Artists?.map((artist) => artist).join(",")}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="audio-player-info-text">
|
),
|
||||||
<Typography
|
[tracks?.[currentTrack]?.Id, currentTrack, api?.configuration],
|
||||||
variant="subtitle2"
|
|
||||||
style={{
|
|
||||||
width: "100%",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{item?.Name}
|
|
||||||
</Typography>
|
|
||||||
<Typography
|
|
||||||
variant="caption"
|
|
||||||
style={{
|
|
||||||
opacity: 0.5,
|
|
||||||
}}
|
|
||||||
noWrap
|
|
||||||
>
|
|
||||||
by {item?.Artists.map((artist) => artist).join(",")}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
[tracks[currentTrack]?.Id, currentTrack],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const controls = useMemo(
|
const controls = useMemo(
|
||||||
@@ -168,9 +148,9 @@ const AudioPlayer = () => {
|
|||||||
<Fab
|
<Fab
|
||||||
size="small"
|
size="small"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
audioRef.current.paused
|
audioRef.current?.paused
|
||||||
? audioRef.current.play()
|
? audioRef.current.play()
|
||||||
: audioRef.current.pause()
|
: audioRef.current?.pause()
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -186,7 +166,7 @@ const AudioPlayer = () => {
|
|||||||
<PlayNextButton />
|
<PlayNextButton />
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
[tracks[currentTrack]?.Id, loading, playing, tracks.length],
|
[tracks?.[currentTrack]?.Id, playing, tracks?.length],
|
||||||
);
|
);
|
||||||
|
|
||||||
const buttons = useMemo(
|
const buttons = useMemo(
|
||||||
@@ -203,7 +183,7 @@ const AudioPlayer = () => {
|
|||||||
</IconButton>
|
</IconButton>
|
||||||
<QueueButton />
|
<QueueButton />
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={(e) => {
|
onClick={() => {
|
||||||
setIsMuted(!isMuted);
|
setIsMuted(!isMuted);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -215,9 +195,19 @@ const AudioPlayer = () => {
|
|||||||
value={isMuted ? 0 : volume * 100}
|
value={isMuted ? 0 : volume * 100}
|
||||||
step={1}
|
step={1}
|
||||||
max={100}
|
max={100}
|
||||||
onChange={(e, newVal) => {
|
onChange={(_, newVal) => {
|
||||||
setVolume(newVal / 100);
|
if (!audioRef.current) {
|
||||||
audioRef.current.volume = newVal / 100;
|
console.error("Audio ref not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Array.isArray(newVal)
|
||||||
|
? setVolume(newVal[0] / 100)
|
||||||
|
: setVolume(newVal / 100);
|
||||||
|
if (Array.isArray(newVal)) {
|
||||||
|
audioRef.current.volume = newVal[0] / 100;
|
||||||
|
} else {
|
||||||
|
audioRef.current.volume = newVal / 100;
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
valueLabelDisplay="auto"
|
valueLabelDisplay="auto"
|
||||||
valueLabelFormat={(value) => Math.floor(value)}
|
valueLabelFormat={(value) => Math.floor(value)}
|
||||||
@@ -260,6 +250,15 @@ const AudioPlayer = () => {
|
|||||||
[volume, isMuted, currentTrack],
|
[volume, isMuted, currentTrack],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// if (audioRef.current) {
|
||||||
|
// audioRef.current.addEventListener("change", () => {
|
||||||
|
// console.log("Audio Player changed state : ", currentTrack);
|
||||||
|
// });
|
||||||
|
// audioRef.current.addEventListener("ended", () => {
|
||||||
|
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AnimatePresence mode="sync">
|
<AnimatePresence mode="sync">
|
||||||
{display && (
|
{display && (
|
||||||
@@ -287,12 +286,18 @@ const AudioPlayer = () => {
|
|||||||
>
|
>
|
||||||
{info}
|
{info}
|
||||||
<audio
|
<audio
|
||||||
data-src={url}
|
autoPlay
|
||||||
|
src={url}
|
||||||
ref={audioRef}
|
ref={audioRef}
|
||||||
key={item?.Id}
|
key={item?.Id ?? "noItem"}
|
||||||
onTimeUpdate={(e) =>
|
onTimeUpdate={(e) =>
|
||||||
setProgress(secToTicks(e.currentTarget.currentTime))
|
setProgress(secToTicks(e.currentTarget.currentTime))
|
||||||
}
|
}
|
||||||
|
onEnded={() => {
|
||||||
|
if (tracks?.[currentTrack + 1]?.Id && api && user?.Id) {
|
||||||
|
playItemFromQueue("next", user.Id, api);
|
||||||
|
}
|
||||||
|
}}
|
||||||
id="audio-player"
|
id="audio-player"
|
||||||
/>
|
/>
|
||||||
<div className="audio-player-controls">
|
<div className="audio-player-controls">
|
||||||
@@ -319,16 +324,28 @@ const AudioPlayer = () => {
|
|||||||
value={isScrubbing ? sliderProgress : progress}
|
value={isScrubbing ? sliderProgress : progress}
|
||||||
step={1}
|
step={1}
|
||||||
size="small"
|
size="small"
|
||||||
max={item?.RunTimeTicks}
|
max={item?.RunTimeTicks ?? 1}
|
||||||
onChange={(e, value) => {
|
onChange={(_, value) => {
|
||||||
setIsScrubbing(true);
|
setIsScrubbing(true);
|
||||||
setSliderProgress(value);
|
Array.isArray(value)
|
||||||
|
? setSliderProgress(value[0])
|
||||||
|
: setSliderProgress(value);
|
||||||
}}
|
}}
|
||||||
onChangeCommitted={(e, value) => {
|
onChangeCommitted={(_, value) => {
|
||||||
|
if (!audioRef.current) {
|
||||||
|
console.error("Audio ref not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
setIsScrubbing(false);
|
setIsScrubbing(false);
|
||||||
// console.log(ticksToSec(value * item?.RunTimeTicks));
|
// console.log(ticksToSec(value * item.RunTimeTicks));
|
||||||
setProgress(value);
|
Array.isArray(value)
|
||||||
audioRef.current.currentTime = ticksToSec(value);
|
? setProgress(value[0])
|
||||||
|
: setProgress(value);
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
audioRef.current.currentTime = ticksToSec(value[0]);
|
||||||
|
} else {
|
||||||
|
audioRef.current.currentTime = ticksToSec(value);
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Typography
|
<Typography
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
import { getRuntimeMusic } from "@/utils/date/time";
|
import { getRuntimeMusic } from "@/utils/date/time";
|
||||||
import useQueue, { setQueue } from "@/utils/store/queue";
|
import useQueue from "@/utils/store/queue";
|
||||||
|
|
||||||
|
import { useSortable } from "@dnd-kit/sortable";
|
||||||
|
import { CSS } from "@dnd-kit/utilities";
|
||||||
|
|
||||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { Typography } from "@mui/material";
|
import { Typography } from "@mui/material";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useCallback, useRef } from "react";
|
|
||||||
import { type XYCoord, useDrag, useDrop } from "react-dnd";
|
|
||||||
import type { Identifier } from "typescript";
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
track: BaseItemDto;
|
track: BaseItemDto;
|
||||||
@@ -13,89 +16,32 @@ type Props = {
|
|||||||
};
|
};
|
||||||
const QueueTrack = (props: Props) => {
|
const QueueTrack = (props: Props) => {
|
||||||
const { track, index } = props;
|
const { track, index } = props;
|
||||||
const [queue, currentItemIndex] = useQueue((s) => [
|
const [currentItemIndex] = useQueue((s) => [s.currentItemIndex]);
|
||||||
s.tracks,
|
|
||||||
s.currentItemIndex,
|
|
||||||
]);
|
|
||||||
const trackRef = useRef<HTMLDivElement | null>(null);
|
|
||||||
const handleQueueUpdate = useCallback(
|
|
||||||
(dragIndex: number, dropIndex: number) => {
|
|
||||||
const prevState = queue;
|
|
||||||
prevState.splice(dropIndex, 0, prevState.splice(dragIndex, 1)[0]);
|
|
||||||
setQueue(prevState, dropIndex);
|
|
||||||
},
|
|
||||||
[queue],
|
|
||||||
);
|
|
||||||
|
|
||||||
const [{ handlerId }, drop] = useDrop<
|
const { attributes, listeners, setNodeRef, transform, transition } =
|
||||||
{
|
useSortable({
|
||||||
index: number;
|
id: track.Id ?? "",
|
||||||
id: string;
|
});
|
||||||
type: string;
|
|
||||||
},
|
|
||||||
void,
|
|
||||||
{ handlerId: Identifier | null }
|
|
||||||
>({
|
|
||||||
accept: "Row",
|
|
||||||
collect(monitor) {
|
|
||||||
return {
|
|
||||||
handlerId: monitor.getHandlerId(),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
hover(hoverItem, monitor) {
|
|
||||||
console.log(hoverItem);
|
|
||||||
if (!trackRef.current) return;
|
|
||||||
|
|
||||||
const dragIndex = hoverItem.index;
|
const style = {
|
||||||
const dropIndex = index;
|
// opacity: isDragging ? 0.5 : 1,
|
||||||
|
transform: CSS.Transform.toString(transform),
|
||||||
if (dragIndex === dropIndex) return;
|
transition,
|
||||||
|
};
|
||||||
const hoverBoundingRect = trackRef.current?.getBoundingClientRect();
|
|
||||||
const hoverMiddleY =
|
|
||||||
(hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;
|
|
||||||
|
|
||||||
const clientOffset = monitor.getClientOffset();
|
|
||||||
|
|
||||||
const hoverClientY = (clientOffset as XYCoord).y - hoverBoundingRect.top;
|
|
||||||
|
|
||||||
if (dragIndex < dropIndex && hoverClientY < hoverMiddleY) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dragIndex > dropIndex && hoverClientY > hoverMiddleY) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleQueueUpdate(dragIndex, dropIndex);
|
|
||||||
hoverItem.index = dropIndex;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const [{ isDragging }, drag] = useDrag({
|
|
||||||
type: "Row",
|
|
||||||
item: () => {
|
|
||||||
const id = track.Id;
|
|
||||||
return { id, index };
|
|
||||||
},
|
|
||||||
collect: (monitor) => ({
|
|
||||||
isDragging: monitor.isDragging(),
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
drag(drop(trackRef));
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={trackRef}
|
ref={setNodeRef}
|
||||||
style={{ opacity: isDragging ? 0.5 : 1 }}
|
style={style}
|
||||||
className={
|
className={
|
||||||
currentItemIndex === index
|
currentItemIndex === index
|
||||||
? "audio-queue-track active"
|
? "audio-queue-track active"
|
||||||
: "audio-queue-track"
|
: "audio-queue-track"
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<span className="material-symbols-rounded">drag_handle</span>
|
<span {...attributes} {...listeners} className="material-symbols-rounded">
|
||||||
|
drag_handle
|
||||||
|
</span>
|
||||||
<div className="audio-queue-track-info">
|
<div className="audio-queue-track-info">
|
||||||
<Typography className="audio-queue-track-info-name">
|
<Typography className="audio-queue-track-info-name">
|
||||||
{track.Name}
|
{track.Name}
|
||||||
@@ -105,7 +51,7 @@ const QueueTrack = (props: Props) => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
<Typography className="opacity-07">
|
<Typography className="opacity-07">
|
||||||
{getRuntimeMusic(track.RunTimeTicks)}
|
{getRuntimeMusic(track.RunTimeTicks ?? 0)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { CircularProgress } from "@mui/material";
|
||||||
|
import { useRouterState } from "@tanstack/react-router";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
export default function RouterLoading() {
|
||||||
|
const routeLoading = useRouterState().isLoading;
|
||||||
|
if (!routeLoading) return null;
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
width: "100vw",
|
||||||
|
height: "100vh",
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
background: "rgb(0 0 0 / 0.35)",
|
||||||
|
position: "fixed",
|
||||||
|
zIndex: 10000,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CircularProgress size={72} thickness={2} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,23 +1,30 @@
|
|||||||
import { getSetting, setSetting } from "@/utils/storage/settings";
|
import { getSetting, setSetting } from "@/utils/storage/settings";
|
||||||
import { FormControlLabel, Switch, Typography } from "@mui/material";
|
import { FormControlLabel, Switch, Typography } from "@mui/material";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
|
|
||||||
const SettingOption = ({
|
const SettingOption = ({
|
||||||
setting,
|
setting,
|
||||||
}: { setting: { key: string; name: string; description: string } }) => {
|
}: { setting: { key: string; name: string; description: string } }) => {
|
||||||
const [settingVal, setSettingVal] = useState(
|
const initValue = useQuery({
|
||||||
async () => (await getSetting(setting.key)) ?? false,
|
queryKey: ["setting", setting.key],
|
||||||
);
|
queryFn: async () => {
|
||||||
|
const result = await getSetting(setting.key);
|
||||||
|
return Boolean(result);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const [settingVal, setSettingVal] = useState(initValue.data ?? false);
|
||||||
return (
|
return (
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={
|
control={
|
||||||
<Switch
|
<Switch
|
||||||
color="primary"
|
color="primary"
|
||||||
checked={settingVal}
|
checked={Boolean(settingVal)}
|
||||||
onChange={(e) => {
|
onChange={(_, checked) => {
|
||||||
setSetting(setting.key, e.target.checked);
|
setSetting(setting.key, checked);
|
||||||
setSettingVal(e.target.checked);
|
setSettingVal(Boolean(checked));
|
||||||
}}
|
}}
|
||||||
|
disabled={initValue.isLoading}
|
||||||
name={setting.name}
|
name={setting.name}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,21 +10,16 @@ import {
|
|||||||
DialogContent,
|
DialogContent,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
Fab,
|
Fab,
|
||||||
FormControlLabel,
|
|
||||||
IconButton,
|
IconButton,
|
||||||
LinearProgress,
|
|
||||||
Link,
|
Link,
|
||||||
Skeleton,
|
Skeleton,
|
||||||
Switch,
|
|
||||||
Tab,
|
Tab,
|
||||||
Tabs,
|
Tabs,
|
||||||
TextField,
|
TextField,
|
||||||
Typography,
|
Typography,
|
||||||
styled,
|
|
||||||
withStyles,
|
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { AnimatePresence, motion, transform } from "framer-motion";
|
import { AnimatePresence, motion } from "framer-motion";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useState, useMemo, useCallback } from "react";
|
||||||
|
|
||||||
import logo from "@/assets/logo.png";
|
import logo from "@/assets/logo.png";
|
||||||
|
|
||||||
@@ -41,14 +36,14 @@ import {
|
|||||||
setDefaultServer,
|
setDefaultServer,
|
||||||
setServer,
|
setServer,
|
||||||
} from "@/utils/storage/servers";
|
} from "@/utils/storage/servers";
|
||||||
import { allSettings, getSetting, setSetting } from "@/utils/storage/settings";
|
import { allSettings } from "@/utils/storage/settings";
|
||||||
import { delUser } from "@/utils/storage/user";
|
import { delUser } from "@/utils/storage/user";
|
||||||
import type { RecommendedServerInfo } from "@jellyfin/sdk";
|
import type { RecommendedServerInfo } from "@jellyfin/sdk";
|
||||||
import { LoadingButton } from "@mui/lab";
|
import { LoadingButton } from "@mui/lab";
|
||||||
import { red, yellow } from "@mui/material/colors";
|
import { red } from "@mui/material/colors";
|
||||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
import { relaunch } from "@tauri-apps/plugin-process";
|
import { relaunch } from "@tauri-apps/plugin-process";
|
||||||
import { type Update, check } from "@tauri-apps/plugin-updater";
|
import { check } from "@tauri-apps/plugin-updater";
|
||||||
import { useSnackbar } from "notistack";
|
import { useSnackbar } from "notistack";
|
||||||
import SettingOption from "../settingOption";
|
import SettingOption from "../settingOption";
|
||||||
|
|
||||||
@@ -73,6 +68,7 @@ const Settings = () => {
|
|||||||
const systemInfo = useQuery({
|
const systemInfo = useQuery({
|
||||||
queryKey: ["about", "systemInfo"],
|
queryKey: ["about", "systemInfo"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getSystemApi(api).getSystemInfo();
|
const result = await getSystemApi(api).getSystemInfo();
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
@@ -82,10 +78,7 @@ const Settings = () => {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
|
|
||||||
const [applicationVersion, serversOnDiskFn] = useCentralStore((state) => [
|
const [applicationVersion] = useCentralStore((state) => [state.clientVersion]);
|
||||||
state.clientVersion,
|
|
||||||
state.allServersOnDisk,
|
|
||||||
]);
|
|
||||||
|
|
||||||
const serversOnDisk = useQuery({
|
const serversOnDisk = useQuery({
|
||||||
queryKey: ["settings", "serversOnDisk"],
|
queryKey: ["settings", "serversOnDisk"],
|
||||||
@@ -114,7 +107,7 @@ const Settings = () => {
|
|||||||
const handleServerChange = useMutation({
|
const handleServerChange = useMutation({
|
||||||
mutationFn: async (server: RecommendedServerInfo) => {
|
mutationFn: async (server: RecommendedServerInfo) => {
|
||||||
await delUser();
|
await delUser();
|
||||||
await setDefaultServer(server.id);
|
await setDefaultServer(server.systemInfo?.Id ?? "");
|
||||||
await defaultServer.refetch();
|
await defaultServer.refetch();
|
||||||
createApi(server.address, undefined);
|
createApi(server.address, undefined);
|
||||||
queryClient.removeQueries();
|
queryClient.removeQueries();
|
||||||
@@ -134,15 +127,15 @@ const Settings = () => {
|
|||||||
const handleDelete = useMutation({
|
const handleDelete = useMutation({
|
||||||
mutationKey: ["server-delete"],
|
mutationKey: ["server-delete"],
|
||||||
mutationFn: async (server: RecommendedServerInfo) => {
|
mutationFn: async (server: RecommendedServerInfo) => {
|
||||||
await delServer(server.id);
|
await delServer(server.systemInfo?.Id ?? "");
|
||||||
|
|
||||||
if (server.id === defaultServer.data) {
|
if (server.systemInfo?.Id === defaultServer.data) {
|
||||||
await delUser();
|
await delUser();
|
||||||
await serversOnDisk.refetch();
|
await serversOnDisk.refetch();
|
||||||
|
|
||||||
if (serversOnDisk.data.length > 0) {
|
if (serversOnDisk.data?.length) {
|
||||||
setDefaultServer(serversOnDisk.data[0].id);
|
setDefaultServer(serversOnDisk.data[0].id);
|
||||||
createApi(serversOnDisk.data[0].address, null);
|
createApi(serversOnDisk.data[0].address, undefined);
|
||||||
} else {
|
} else {
|
||||||
// TODO: Reset api in context
|
// TODO: Reset api in context
|
||||||
// useApi.setState(useApi.getInitialState());
|
// useApi.setState(useApi.getInitialState());
|
||||||
@@ -166,7 +159,7 @@ const Settings = () => {
|
|||||||
},
|
},
|
||||||
onSuccess: async (bestServer) => {
|
onSuccess: async (bestServer) => {
|
||||||
if (bestServer) {
|
if (bestServer) {
|
||||||
await setServer(bestServer.systemInfo.Id, bestServer);
|
await setServer(bestServer.systemInfo?.Id ?? "", bestServer);
|
||||||
setAddServerDialog(false);
|
setAddServerDialog(false);
|
||||||
enqueueSnackbar(
|
enqueueSnackbar(
|
||||||
"Client added successfully. You might need to refresh client list.",
|
"Client added successfully. You might need to refresh client list.",
|
||||||
@@ -191,22 +184,33 @@ const Settings = () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Memoize PaperProps to prevent unnecessary re-renders
|
||||||
|
const paperProps = useMemo(
|
||||||
|
() => ({
|
||||||
|
className: "settings glass",
|
||||||
|
elevation: 10,
|
||||||
|
}),
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
|
// Memoize onClose function to prevent unnecessary re-renders
|
||||||
|
const handleClose = useCallback(() => {
|
||||||
|
setSettingsDialogOpen(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
open={open}
|
open={open}
|
||||||
fullWidth
|
fullWidth
|
||||||
maxWidth="md"
|
maxWidth="md"
|
||||||
PaperProps={{
|
PaperProps={paperProps}
|
||||||
className: "settings glass",
|
|
||||||
elevation: 10,
|
|
||||||
}}
|
|
||||||
hideBackdrop
|
hideBackdrop
|
||||||
onClose={() => setSettingsDialogOpen(false)}
|
onClose={handleClose}
|
||||||
>
|
>
|
||||||
<Tabs
|
<Tabs
|
||||||
orientation="vertical"
|
orientation="vertical"
|
||||||
value={tabValue}
|
value={tabValue}
|
||||||
onChange={(e, newValue) => {
|
onChange={(_, newValue) => {
|
||||||
setSettingsTabValue(newValue);
|
setSettingsTabValue(newValue);
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
@@ -410,7 +414,7 @@ const Settings = () => {
|
|||||||
{/* About */}
|
{/* About */}
|
||||||
{tabValue === 10 && (
|
{tabValue === 10 && (
|
||||||
<div className="settings-container settings-about">
|
<div className="settings-container settings-about">
|
||||||
<img src={logo} className="settings-logo" alt="JellyPlayer" />
|
<img src={logo} className="settings-logo" alt="Blink" />
|
||||||
<div className="settings-grid">
|
<div className="settings-grid">
|
||||||
<div className="settings-info-container">
|
<div className="settings-info-container">
|
||||||
<div className="settings-info">
|
<div className="settings-info">
|
||||||
@@ -419,10 +423,10 @@ const Settings = () => {
|
|||||||
icon={
|
icon={
|
||||||
<span
|
<span
|
||||||
className="material-symbols-rounded"
|
className="material-symbols-rounded"
|
||||||
style={{ "--wght": 500 }}
|
// style={{ "--wght": 500 }}
|
||||||
>
|
>
|
||||||
{updateInfo.data?.available
|
{updateInfo.data?.available
|
||||||
? "new_release"
|
? "release_alert"
|
||||||
: "new_releases"}
|
: "new_releases"}
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
@@ -481,7 +485,7 @@ const Settings = () => {
|
|||||||
setUpdating(true);
|
setUpdating(true);
|
||||||
await updateInfo.data?.downloadAndInstall();
|
await updateInfo.data?.downloadAndInstall();
|
||||||
enqueueSnackbar(
|
enqueueSnackbar(
|
||||||
"Update has been installed! You need to relaunch JellyPlayer.",
|
"Update has been installed! You need to relaunch Blink.",
|
||||||
{
|
{
|
||||||
variant: "success",
|
variant: "success",
|
||||||
},
|
},
|
||||||
@@ -513,14 +517,6 @@ const Settings = () => {
|
|||||||
{systemInfo.data?.Version}
|
{systemInfo.data?.Version}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
<div className="settings-info">
|
|
||||||
<Typography variant="subtitle2">
|
|
||||||
Operating System:
|
|
||||||
</Typography>
|
|
||||||
<Typography variant="subtitle2">
|
|
||||||
{systemInfo.data?.OperatingSystemDisplayName}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
<div className="settings-info">
|
<div className="settings-info">
|
||||||
<Typography variant="subtitle2">
|
<Typography variant="subtitle2">
|
||||||
Server Architecture:
|
Server Architecture:
|
||||||
@@ -563,9 +559,9 @@ const Settings = () => {
|
|||||||
component={Link}
|
component={Link}
|
||||||
variant="subtitle2"
|
variant="subtitle2"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="https://github.com/prayag17/JellyPlayer"
|
href="https://github.com/prayag17/Blink"
|
||||||
>
|
>
|
||||||
https://github.com/prayag17/JellyPlayer
|
https://github.com/prayag17/Blink
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
component={Link}
|
component={Link}
|
||||||
@@ -625,6 +621,7 @@ const Settings = () => {
|
|||||||
>
|
>
|
||||||
Close
|
Close
|
||||||
</Button>
|
</Button>
|
||||||
|
{/* @ts-ignore */}
|
||||||
<LoadingButton
|
<LoadingButton
|
||||||
startIcon={
|
startIcon={
|
||||||
<span
|
<span
|
||||||
|
|||||||
@@ -1,28 +1,27 @@
|
|||||||
.settings{
|
.settings {
|
||||||
display: grid !important;
|
display: grid !important;
|
||||||
grid-template-columns: 20% 1fr;
|
grid-template-columns: 20% 1fr;
|
||||||
height: 60vh;
|
height: 60vh;
|
||||||
overflow: hidden !important;
|
overflow: hidden !important;
|
||||||
.MuiTabs-flexContainerVertical{
|
.MuiTabs-flexContainerVertical {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
&-container{
|
&-container {
|
||||||
margin: 14px 0 14px 14px;
|
margin: 14px 0 14px 14px;
|
||||||
}
|
}
|
||||||
&-tab{
|
&-tab {
|
||||||
display: grid !important;
|
display: grid !important;
|
||||||
grid-template-columns: 2em 1fr;
|
grid-template-columns: 2em 1fr;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-items: start !important;
|
justify-items: start !important;
|
||||||
gap:1em;
|
gap: 1em;
|
||||||
& .material-symbols-rounded{
|
& .material-symbols-rounded {
|
||||||
justify-self: center !important;
|
justify-self: center !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
&-scroll{
|
&-scroll {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
scrollbar-gutter:stable ;
|
scrollbar-gutter: stable;
|
||||||
overscroll-behavior: contain;
|
overscroll-behavior: contain;
|
||||||
// Magic scrollbar
|
// Magic scrollbar
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
@@ -37,14 +36,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// About page
|
// About page
|
||||||
&-grid{
|
&-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
||||||
gap:1em;
|
gap: 1em;
|
||||||
}
|
}
|
||||||
&-logo{
|
&-logo {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: rgb(255 255 255 / 1);
|
background: rgb(255 255 255 / 1);
|
||||||
padding: 0em;
|
padding: 0em;
|
||||||
@@ -53,7 +51,7 @@
|
|||||||
border-radius: $border-radius-default;
|
border-radius: $border-radius-default;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
&-info{
|
&-info {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 40% 1fr;
|
grid-template-columns: 40% 1fr;
|
||||||
gap: 1em;
|
gap: 1em;
|
||||||
@@ -61,13 +59,13 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
border-bottom: 1px solid rgb(255 255 255 / 0.1);
|
border-bottom: 1px solid rgb(255 255 255 / 0.1);
|
||||||
padding-bottom: 0.5em;
|
padding-bottom: 0.5em;
|
||||||
&-container{
|
&-container {
|
||||||
background: rgb(0 0 0 / 0.3);
|
background: rgb(0 0 0 / 0.3);
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
border-radius: $border-radius-default;
|
border-radius: $border-radius-default;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap:0.6em;
|
gap: 0.6em;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
&:last-child {
|
&:last-child {
|
||||||
@@ -78,9 +76,8 @@
|
|||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//settings
|
//settings
|
||||||
&-option{
|
&-option {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -88,21 +85,12 @@
|
|||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
margin-bottom: 0.6em !important;
|
margin-bottom: 0.6em !important;
|
||||||
&-info-caption{
|
&-info-caption {
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//serverList
|
//serverList
|
||||||
&-server{
|
&-server {
|
||||||
&-container{
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 1em;
|
|
||||||
align-items: center;
|
|
||||||
padding-bottom: 4.6em;
|
|
||||||
}
|
|
||||||
|
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 3.4em 1fr auto;
|
grid-template-columns: 3.4em 1fr auto;
|
||||||
justify-items: start;
|
justify-items: start;
|
||||||
@@ -112,7 +100,13 @@
|
|||||||
padding: 1em;
|
padding: 1em;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-radius: $border-radius-default;
|
border-radius: $border-radius-default;
|
||||||
|
&-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1em;
|
||||||
|
align-items: center;
|
||||||
|
padding-bottom: 4.6em;
|
||||||
|
}
|
||||||
&-icon {
|
&-icon {
|
||||||
font-size: 3.4em !important;
|
font-size: 3.4em !important;
|
||||||
font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 10, "opsz" 40;
|
font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 10, "opsz" 40;
|
||||||
@@ -124,7 +118,7 @@
|
|||||||
&-version {
|
&-version {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap:0.4em;
|
gap: 0.4em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&-buttons {
|
&-buttons {
|
||||||
@@ -134,7 +128,6 @@
|
|||||||
// width: 100%;
|
// width: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-fab-container {
|
&-fab-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -144,7 +137,6 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 0.8em;
|
gap: 0.8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dialog
|
// Dialog
|
||||||
&-add {
|
&-add {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -154,7 +146,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.Mui-selected .material-symbols-rounded {
|
||||||
.Mui-selected .material-symbols-rounded{
|
|
||||||
font-variation-settings: "FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40;
|
font-variation-settings: "FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40;
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,20 @@
|
|||||||
import Button from "@mui/material/Button";
|
import Button from "@mui/material/Button";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
import React from "react";
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
|
||||||
const ShowMoreText = ({ content, collapsedLines, extraProps }) => {
|
const ShowMoreText = ({
|
||||||
|
content,
|
||||||
|
collapsedLines,
|
||||||
|
extraProps,
|
||||||
|
}: {
|
||||||
|
content: string;
|
||||||
|
collapsedLines: number;
|
||||||
|
extraProps?: Record<string, any>;
|
||||||
|
}) => {
|
||||||
const [displayFull, setDisplayFull] = useState(false);
|
const [displayFull, setDisplayFull] = useState(false);
|
||||||
const [isOverflowing, setIsOverflowing] = useState(false);
|
const [isOverflowing, setIsOverflowing] = useState(false);
|
||||||
const textRef = useRef(null);
|
const textRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (textRef.current) {
|
if (textRef.current) {
|
||||||
@@ -29,12 +38,12 @@ const ShowMoreText = ({ content, collapsedLines, extraProps }) => {
|
|||||||
>
|
>
|
||||||
<Typography
|
<Typography
|
||||||
ref={textRef}
|
ref={textRef}
|
||||||
key={displayFull}
|
key={displayFull ? "full" : "collapsed"}
|
||||||
style={{
|
style={{
|
||||||
display: "-webkit-box",
|
display: "-webkit-box",
|
||||||
textOverflow: "ellipsis",
|
textOverflow: "ellipsis",
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
WebkitLineClamp: displayFull ? "none" : collapsedLines ?? 2,
|
WebkitLineClamp: displayFull ? "none" : (collapsedLines ?? 2),
|
||||||
WebkitBoxOrient: "vertical",
|
WebkitBoxOrient: "vertical",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
}}
|
}}
|
||||||
@@ -45,6 +54,7 @@ const ShowMoreText = ({ content, collapsedLines, extraProps }) => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
{content.length > 0 && isOverflowing && (
|
{content.length > 0 && isOverflowing && (
|
||||||
<Button
|
<Button
|
||||||
|
//@ts-ignore
|
||||||
color="white"
|
color="white"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
onClick={() => setDisplayFull((state) => !state)}
|
onClick={() => setDisplayFull((state) => !state)}
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import Box from "@mui/material/Box";
|
|
||||||
import Card from "@mui/material/Card";
|
|
||||||
import CardActionArea from "@mui/material/CardActionArea";
|
|
||||||
import CardContent from "@mui/material/CardContent";
|
|
||||||
import CardMedia from "@mui/material/CardMedia";
|
|
||||||
import Skeleton from "@mui/material/Skeleton";
|
|
||||||
import Typography from "@mui/material/Typography";
|
|
||||||
|
|
||||||
export const CardsSkeleton = () => {
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: "flex",
|
|
||||||
flexFlow: "column",
|
|
||||||
marginBottom: "2em",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Typography variant="h4" sx={{ mb: "0.15em" }}>
|
|
||||||
<Skeleton width="35%" animation="wave" />
|
|
||||||
</Typography>
|
|
||||||
<Skeleton width="100%" variant="rounded" animation="wave">
|
|
||||||
<div style={{ paddingTop: "20%" }} />
|
|
||||||
</Skeleton>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import Skeleton from "@mui/material/Skeleton";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
export const CardsSkeleton = () => {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
flexFlow: "column",
|
||||||
|
marginBottom: "2em",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography variant="h3" sx={{ mb: "0.15em" }}>
|
||||||
|
<Skeleton width="35%" />
|
||||||
|
</Typography>
|
||||||
|
<div className="flex flex-align-center" style={{ height: "17em" }}>
|
||||||
|
{Array.from({ length: 12 }).map((_, index) => (
|
||||||
|
<Skeleton
|
||||||
|
height="26em"
|
||||||
|
sx={{
|
||||||
|
flex: "1 0 12.45%",
|
||||||
|
marginRight: "1.5em",
|
||||||
|
borderRadius: "10px",
|
||||||
|
animationDelay: `${index * 0.25}s`,
|
||||||
|
}}
|
||||||
|
// biome-ignore lint/suspicious/noArrayIndexKey: This is a skeleton component
|
||||||
|
key={index}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,22 +1,15 @@
|
|||||||
import Box from "@mui/material/Box";
|
|
||||||
import Paper from "@mui/material/Paper";
|
|
||||||
import Skeleton from "@mui/material/Skeleton";
|
import Skeleton from "@mui/material/Skeleton";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { theme } from "../../theme";
|
|
||||||
export const CarouselSkeleton = () => {
|
export const CarouselSkeleton = () => {
|
||||||
return (
|
return (
|
||||||
<Paper
|
<div
|
||||||
className="hero-carousel-skeleton"
|
className="hero-carousel hero-carousel-skeleton"
|
||||||
elevation={0}
|
style={{
|
||||||
sx={{
|
|
||||||
height: "70vh",
|
height: "70vh",
|
||||||
marginBottom: "3.2em",
|
|
||||||
position: "relative",
|
position: "relative",
|
||||||
background: "black",
|
width: "100vw",
|
||||||
border: "1px solid rgb(255 255 255 / 0.2)",
|
marginLeft: "-4.4em",
|
||||||
borderRadius: "10px",
|
|
||||||
overflow: "hidden",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="hero-carousel-detail">
|
<div className="hero-carousel-detail">
|
||||||
@@ -29,9 +22,13 @@ export const CarouselSkeleton = () => {
|
|||||||
/>
|
/>
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
variant="p"
|
variant="body1"
|
||||||
className="hero-carousel-text"
|
className="hero-carousel-text"
|
||||||
style={{ display: "flex", flexDirection: "column" }}
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
paddingBottom: "4.4em",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Skeleton
|
<Skeleton
|
||||||
variant="text"
|
variant="text"
|
||||||
@@ -53,6 +50,6 @@ export const CarouselSkeleton = () => {
|
|||||||
/>
|
/>
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
</Paper>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -2,66 +2,96 @@ import { Divider, Skeleton, Typography } from "@mui/material";
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
const EpisodeSkeleton = () => {
|
const EpisodeSkeleton = () => {
|
||||||
return Array.from(new Array(8)).map((a, index) => {
|
return Array.from(new Array(8)).map((_, index) => {
|
||||||
return <>
|
return (
|
||||||
<div
|
<div
|
||||||
key={index}
|
// biome-ignore lint/suspicious/noArrayIndexKey: this is a skeleton
|
||||||
style={{
|
key={index}
|
||||||
width: "100%",
|
style={{
|
||||||
}}
|
width: "100%",
|
||||||
className="item-detail-episode"
|
}}
|
||||||
>
|
>
|
||||||
<Typography variant="h6"><Skeleton variant="circular" sx={{
|
<div className="item-detail-episode">
|
||||||
animationDelay: `${index * 0.2}s`,
|
<Typography variant="h6">
|
||||||
animationDuration: "1.4s",
|
<Skeleton
|
||||||
animationName: "pulse",
|
variant="circular"
|
||||||
opacity: 0.1,
|
sx={{
|
||||||
}} /></Typography>
|
animationDelay: `${index * 0.25}s`,
|
||||||
<div className="item-detail-episode-image-container">
|
animationDuration: "1.4s",
|
||||||
<Skeleton className="item-detail-episode-image" variant="rectangular" sx={{
|
animationName: "pulse",
|
||||||
animationDelay: `${index * 0.2}s`,
|
opacity: 0.1,
|
||||||
animationDuration: "1.4s",
|
aspectRatio: 1,
|
||||||
animationName: "pulse",
|
width: "3rem",
|
||||||
opacity: 0.1,
|
height: "3rem",
|
||||||
}} />
|
}}
|
||||||
</div>
|
/>
|
||||||
<div className="item-detail-episode-info">
|
</Typography>
|
||||||
<Typography variant="h4">
|
<div className="item-detail-episode-image-container">
|
||||||
<Skeleton variant="text" width="10em" sx={{
|
<Skeleton
|
||||||
animationDelay: `${index * 0.2}s`,
|
className="item-detail-episode-image"
|
||||||
animationDuration: "1.4s",
|
variant="rectangular"
|
||||||
animationName: "pulse",
|
sx={{
|
||||||
opacity: 0.1,
|
animationDelay: `${index * 0.2}s`,
|
||||||
}} />
|
animationDuration: "1.4s",
|
||||||
</Typography>
|
animationName: "pulse",
|
||||||
<Skeleton variant="rounded" width="5em" style={{ borderRadius: "100px" }} sx={{
|
opacity: 0.1,
|
||||||
animationDelay: `${index * 0.2}s`,
|
}}
|
||||||
animationDuration: "1.4s",
|
/>
|
||||||
animationName: "pulse",
|
</div>
|
||||||
opacity: 0.1,
|
<div className="item-detail-episode-info">
|
||||||
}} />
|
<Typography variant="h4">
|
||||||
<Typography style={{
|
<Skeleton
|
||||||
width: "100%"
|
variant="text"
|
||||||
}}>
|
width="10em"
|
||||||
<Skeleton width="100%" sx={{
|
sx={{
|
||||||
animationDelay: `${index * 0.2}s`,
|
animationDelay: `${index * 0.2}s`,
|
||||||
animationDuration: "1.4s",
|
animationDuration: "1.4s",
|
||||||
animationName: "pulse",
|
animationName: "pulse",
|
||||||
opacity: 0.1,
|
opacity: 0.1,
|
||||||
}} />
|
}}
|
||||||
<Skeleton width="100%" sx={{
|
/>
|
||||||
animationDelay: `${index * 0.2}s`,
|
</Typography>
|
||||||
animationDuration: "1.4s",
|
<Skeleton
|
||||||
animationName: "pulse",
|
variant="rounded"
|
||||||
opacity: 0.1,
|
width="5em"
|
||||||
}} />
|
style={{ borderRadius: "100px" }}
|
||||||
</Typography>
|
sx={{
|
||||||
</div>
|
animationDelay: `${index * 0.2}s`,
|
||||||
</div>
|
animationDuration: "1.4s",
|
||||||
{index !== 7 && <Divider orientation="horizontal" flexItem />}
|
animationName: "pulse",
|
||||||
|
opacity: 0.1,
|
||||||
</>
|
}}
|
||||||
})
|
/>
|
||||||
|
<Typography
|
||||||
|
style={{
|
||||||
|
width: "100%",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Skeleton
|
||||||
|
width="100%"
|
||||||
|
sx={{
|
||||||
|
animationDelay: `${index * 0.2}s`,
|
||||||
|
animationDuration: "1.4s",
|
||||||
|
animationName: "pulse",
|
||||||
|
opacity: 0.1,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Skeleton
|
||||||
|
width="100%"
|
||||||
|
sx={{
|
||||||
|
animationDelay: `${index * 0.2}s`,
|
||||||
|
animationDuration: "1.4s",
|
||||||
|
animationName: "pulse",
|
||||||
|
opacity: 0.1,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{index !== 7 && <Divider orientation="horizontal" flexItem />}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export default EpisodeSkeleton
|
export default EpisodeSkeleton
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
import Card from "@mui/material/Card";
|
|
||||||
import CardContent from "@mui/material/CardContent";
|
|
||||||
import CardMedia from "@mui/material/CardMedia";
|
|
||||||
import Skeleton from "@mui/material/Skeleton";
|
|
||||||
import Typography from "@mui/material/Typography";
|
|
||||||
import Grid from "@mui/material/Unstable_Grid2";
|
|
||||||
|
|
||||||
export const EpisodeCardsSkeleton = () => {
|
|
||||||
return (
|
|
||||||
<Grid
|
|
||||||
container
|
|
||||||
columns={{
|
|
||||||
xs: 2,
|
|
||||||
sm: 3,
|
|
||||||
md: 4,
|
|
||||||
}}
|
|
||||||
sx={{ width: "100%" }}
|
|
||||||
>
|
|
||||||
{Array.from(new Array(4)).map((a) => {
|
|
||||||
return (
|
|
||||||
<Grid xs={1} sm={1} md={1} key={a}>
|
|
||||||
<Card sx={{ background: "transparent" }} elevation={0}>
|
|
||||||
<CardMedia>
|
|
||||||
<Skeleton
|
|
||||||
animation="wave"
|
|
||||||
variant="rectangular"
|
|
||||||
sx={{
|
|
||||||
aspectRatio: "1.777",
|
|
||||||
height: "auto",
|
|
||||||
m: 1,
|
|
||||||
borderRadius: "8px",
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</CardMedia>
|
|
||||||
<CardContent
|
|
||||||
sx={{
|
|
||||||
padding: "0 0.5em",
|
|
||||||
alignItems: "flex-start",
|
|
||||||
backgroundColor: "transparent",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Typography variant="h6">
|
|
||||||
<Skeleton variant="text" animation="wave" />
|
|
||||||
</Typography>
|
|
||||||
|
|
||||||
<Typography variant="body2">
|
|
||||||
<Skeleton variant="text" animation="wave" />
|
|
||||||
<Skeleton variant="text" animation="wave" />
|
|
||||||
|
|
||||||
<Skeleton variant="text" animation="wave" />
|
|
||||||
</Typography>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
</Grid>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</Grid>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
import { Divider, LinearProgress, Skeleton } from "@mui/material";
|
import { Skeleton } from "@mui/material";
|
||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
|
|
||||||
const ItemSkeleton = () => {
|
const ItemSkeleton = () => {
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import Divider from "@mui/material/Divider";
|
import Divider from "@mui/material/Divider";
|
||||||
import Grid from "@mui/material/Grid2";
|
import Grid2 from "@mui/material/Grid2";
|
||||||
import Skeleton from "@mui/material/Skeleton";
|
import Skeleton from "@mui/material/Skeleton";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
import React from "react";
|
||||||
import EpisodeSkeleton from "./episode";
|
import EpisodeSkeleton from "./episode";
|
||||||
|
|
||||||
export const SeasonSelectorSkeleton = () => {
|
export const SeasonSelectorSkeleton = () => {
|
||||||
return (
|
return (
|
||||||
<Grid
|
<Grid2
|
||||||
container
|
container
|
||||||
columns={{
|
columns={{
|
||||||
xs: 2,
|
xs: 2,
|
||||||
@@ -44,8 +45,8 @@ export const SeasonSelectorSkeleton = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<div className="item-detail-episode-container">
|
<div className="item-detail-episode-container">
|
||||||
<EpisodeSkeleton/>
|
<EpisodeSkeleton />
|
||||||
</div>
|
</div>
|
||||||
</Grid>
|
</Grid2>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -7,7 +7,7 @@ import "./tagChip.scss";
|
|||||||
const TagChip = ({
|
const TagChip = ({
|
||||||
label,
|
label,
|
||||||
linkProps,
|
linkProps,
|
||||||
}: { label: string; linkProps: LinkProps }) => {
|
}: { label: string; linkProps?: LinkProps }) => {
|
||||||
return (
|
return (
|
||||||
<Link className="tag" to="/search" search={{ query: label }} {...linkProps}>
|
<Link className="tag" to="/search" search={{ query: label }} {...linkProps}>
|
||||||
<Typography variant="subtitle2" fontWeight={300}>
|
<Typography variant="subtitle2" fontWeight={300}>
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
import Typography from "@mui/material/Typography";
|
|
||||||
|
|
||||||
import "./textLink.scss";
|
|
||||||
|
|
||||||
const TextLink = ({ children, location, variant, otherProps }) => {
|
|
||||||
// const navigate = useNavigate();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Typography
|
|
||||||
variant={variant}
|
|
||||||
className="link flex"
|
|
||||||
// onClick={() => navigate(location)}
|
|
||||||
{...otherProps}
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
</Typography>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default TextLink;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
|
|
||||||
.link {
|
|
||||||
text-decoration: underline;
|
|
||||||
text-decoration-color: rgb(255 255 255 / 0.5);
|
|
||||||
white-space: pre-line;
|
|
||||||
width: fit-content;
|
|
||||||
&:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
text-decoration-color: rgb(255 255 255 / 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
import { LoadingButton } from "@mui/lab";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Chip,
|
||||||
|
Dialog,
|
||||||
|
DialogActions,
|
||||||
|
DialogContent,
|
||||||
|
DialogContentText,
|
||||||
|
DialogTitle,
|
||||||
|
Link,
|
||||||
|
} from "@mui/material";
|
||||||
|
import { relaunch } from "@tauri-apps/plugin-process";
|
||||||
|
import { type Update, check } from "@tauri-apps/plugin-updater";
|
||||||
|
import { useSnackbar } from "notistack";
|
||||||
|
import React, { useLayoutEffect, useState } from "react";
|
||||||
|
|
||||||
|
export default function Updater() {
|
||||||
|
const [updateDialog, setUpdateDialog] = useState(false);
|
||||||
|
const [updateDialogButton, setUpdateDialogButton] = useState(false);
|
||||||
|
const [updateInfo, setUpdateInfo] = useState<Update | undefined>(undefined);
|
||||||
|
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
async function checkForUpdates() {
|
||||||
|
try {
|
||||||
|
const update = await check();
|
||||||
|
|
||||||
|
if (update?.available) {
|
||||||
|
setUpdateInfo(update);
|
||||||
|
setUpdateDialog(true);
|
||||||
|
|
||||||
|
console.info(`Update found : ${update.version}, ${update.date}`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
checkForUpdates();
|
||||||
|
}, []);
|
||||||
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
|
|
||||||
|
if (!updateInfo) return null;
|
||||||
|
return (
|
||||||
|
<Dialog
|
||||||
|
open={updateDialog}
|
||||||
|
maxWidth="xs"
|
||||||
|
PaperProps={{
|
||||||
|
style: {
|
||||||
|
borderRadius: "20px",
|
||||||
|
},
|
||||||
|
className: "glass",
|
||||||
|
}}
|
||||||
|
sx={{
|
||||||
|
"& img": {
|
||||||
|
width: "100%",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<DialogTitle variant="h5" align="center" textAlign={"center"}>
|
||||||
|
Update Available!
|
||||||
|
</DialogTitle>
|
||||||
|
<DialogContent
|
||||||
|
className="flex flex-center"
|
||||||
|
style={{ gap: "0.5em", padding: "0 2em 1em 2em", flexWrap: "wrap" }}
|
||||||
|
>
|
||||||
|
<Chip
|
||||||
|
icon={<span className="material-symbols-rounded">update</span>}
|
||||||
|
label={`v${updateInfo.currentVersion}`}
|
||||||
|
variant="outlined"
|
||||||
|
/>
|
||||||
|
<span className="material-symbols-rounded">arrow_right_alt</span>
|
||||||
|
<Chip
|
||||||
|
icon={<span className="material-symbols-rounded">update</span>}
|
||||||
|
label={`v${updateInfo.version}`}
|
||||||
|
variant="outlined"
|
||||||
|
/>
|
||||||
|
<DialogContentText sx={{ width: "100%" }}>
|
||||||
|
<Link
|
||||||
|
href={`https://github.com/prayag17/Blink/releases/v${updateInfo.version}`}
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
Open changelog
|
||||||
|
</Link>
|
||||||
|
</DialogContentText>
|
||||||
|
</DialogContent>
|
||||||
|
|
||||||
|
<DialogActions
|
||||||
|
style={{
|
||||||
|
padding: "1em",
|
||||||
|
}}
|
||||||
|
className="flex flex-center"
|
||||||
|
>
|
||||||
|
{/* <Button
|
||||||
|
variant="outlined"
|
||||||
|
//@ts-ignore
|
||||||
|
color="white"
|
||||||
|
disabled={updateDialogButton}
|
||||||
|
onClick={() => setUpdateDialog(false)}
|
||||||
|
>
|
||||||
|
changelog
|
||||||
|
</Button> */}
|
||||||
|
<Button
|
||||||
|
color="error"
|
||||||
|
variant="contained"
|
||||||
|
disabled={updateDialogButton}
|
||||||
|
onClick={() => setUpdateDialog(false)}
|
||||||
|
style={{ borderRadius: "10px" }}
|
||||||
|
disableElevation
|
||||||
|
>
|
||||||
|
close
|
||||||
|
</Button>
|
||||||
|
<LoadingButton
|
||||||
|
style={{ borderRadius: "10px" }}
|
||||||
|
color="success"
|
||||||
|
variant="contained"
|
||||||
|
loading={updateDialogButton}
|
||||||
|
loadingIndicator="Updating..."
|
||||||
|
disableElevation
|
||||||
|
onClick={async () => {
|
||||||
|
setUpdateDialogButton(true);
|
||||||
|
await updateInfo.downloadAndInstall();
|
||||||
|
enqueueSnackbar("Update has been installed! You need to relaunch Blink.", {
|
||||||
|
variant: "success",
|
||||||
|
});
|
||||||
|
await relaunch();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Update
|
||||||
|
</LoadingButton>
|
||||||
|
</DialogActions>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import React from "react";
|
import React, { useCallback, useMemo } from "react";
|
||||||
|
|
||||||
import { Dialog, Slide } from "@mui/material";
|
import { Dialog, Slide } from "@mui/material";
|
||||||
import { useKonamiEasterEgg } from "../../utils/misc/konami";
|
import { useKonamiEasterEgg } from "../../utils/misc/konami";
|
||||||
@@ -6,15 +6,22 @@ import { useKonamiEasterEgg } from "../../utils/misc/konami";
|
|||||||
export const EasterEgg = () => {
|
export const EasterEgg = () => {
|
||||||
const [easterEgg, setEasterEgg] = useKonamiEasterEgg();
|
const [easterEgg, setEasterEgg] = useKonamiEasterEgg();
|
||||||
|
|
||||||
|
// Memoize the onClose function
|
||||||
|
const handleClose = useCallback(() => {
|
||||||
|
setEasterEgg(false);
|
||||||
|
}, [setEasterEgg]);
|
||||||
|
|
||||||
|
// Memoize the sx object
|
||||||
|
const dialogSx = useMemo(
|
||||||
|
() => ({
|
||||||
|
background: "black",
|
||||||
|
}),
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Dialog
|
<Dialog open={easterEgg} onClose={handleClose} sx={dialogSx}>
|
||||||
open={easterEgg}
|
|
||||||
onClose={() => setEasterEgg(false)}
|
|
||||||
sx={{
|
|
||||||
background: "black",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<iframe
|
<iframe
|
||||||
width="560"
|
width="560"
|
||||||
height="315"
|
height="315"
|
||||||
|
|||||||
@@ -1,69 +1,76 @@
|
|||||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
import * as generatedClient from "@jellyfin/sdk/lib/generated-client";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
export const getTypeIcon = (icon: BaseItemKind) => {
|
export const getTypeIcon = (
|
||||||
|
icon:
|
||||||
|
| generatedClient.BaseItemKind
|
||||||
|
| generatedClient.CollectionType
|
||||||
|
| "Home"
|
||||||
|
| "User"
|
||||||
|
| "universal",
|
||||||
|
) => {
|
||||||
switch (icon) {
|
switch (icon) {
|
||||||
case "Home":
|
case "Home":
|
||||||
return <div className="material-symbols-rounded">home</div>;
|
return <div className="material-symbols-rounded">home</div>;
|
||||||
case BaseItemKind.Audio:
|
case generatedClient.BaseItemKind.Audio:
|
||||||
return <div className="material-symbols-rounded">mic</div>;
|
return <div className="material-symbols-rounded">mic</div>;
|
||||||
case BaseItemKind.AudioBook:
|
case generatedClient.BaseItemKind.AudioBook:
|
||||||
return <div className="material-symbols-rounded">speech_to_text</div>;
|
return <div className="material-symbols-rounded">speech_to_text</div>;
|
||||||
case BaseItemKind.Book:
|
case generatedClient.BaseItemKind.Book:
|
||||||
return <div className="material-symbols-rounded">book</div>;
|
return <div className="material-symbols-rounded">book</div>;
|
||||||
case "boxsets":
|
case "boxsets":
|
||||||
case BaseItemKind.BoxSet:
|
case generatedClient.BaseItemKind.BoxSet:
|
||||||
return <div className="material-symbols-rounded">video_library</div>;
|
return <div className="material-symbols-rounded">video_library</div>;
|
||||||
case "livetv":
|
case "livetv":
|
||||||
case BaseItemKind.TvProgram:
|
case generatedClient.BaseItemKind.TvProgram:
|
||||||
case BaseItemKind.TvChannel:
|
case generatedClient.BaseItemKind.TvChannel:
|
||||||
case BaseItemKind.Program:
|
case generatedClient.BaseItemKind.Program:
|
||||||
case BaseItemKind.Recording:
|
case generatedClient.BaseItemKind.Recording:
|
||||||
case BaseItemKind.LiveTvChannel:
|
case generatedClient.BaseItemKind.LiveTvChannel:
|
||||||
case BaseItemKind.LiveTvProgram:
|
case generatedClient.BaseItemKind.LiveTvProgram:
|
||||||
case BaseItemKind.ChannelFolderItem:
|
case generatedClient.BaseItemKind.ChannelFolderItem:
|
||||||
case BaseItemKind.Channel:
|
case generatedClient.BaseItemKind.Channel:
|
||||||
return (
|
return (
|
||||||
<div className="material-symbols-rounded">settings_input_antenna</div>
|
<div className="material-symbols-rounded">settings_input_antenna</div>
|
||||||
);
|
);
|
||||||
case "tvshows":
|
case "tvshows":
|
||||||
case BaseItemKind.Season:
|
case generatedClient.BaseItemKind.Season:
|
||||||
case BaseItemKind.Series:
|
case generatedClient.BaseItemKind.Series:
|
||||||
case BaseItemKind.Episode:
|
case generatedClient.BaseItemKind.Episode:
|
||||||
return <div className="material-symbols-rounded">tv_gen</div>;
|
return <div className="material-symbols-rounded">tv_gen</div>;
|
||||||
case "playlists":
|
case "playlists":
|
||||||
case BaseItemKind.Playlist:
|
case generatedClient.BaseItemKind.Playlist:
|
||||||
case BaseItemKind.PlaylistsFolder:
|
case generatedClient.BaseItemKind.PlaylistsFolder:
|
||||||
case BaseItemKind.ManualPlaylistsFolder:
|
case generatedClient.BaseItemKind.ManualPlaylistsFolder:
|
||||||
return <div className="material-symbols-rounded">queue_music</div>;
|
return <div className="material-symbols-rounded">queue_music</div>;
|
||||||
case "movies":
|
case "movies":
|
||||||
case BaseItemKind.Movie:
|
case generatedClient.BaseItemKind.Movie:
|
||||||
return <div className="material-symbols-rounded">movie</div>;
|
return <div className="material-symbols-rounded">movie</div>;
|
||||||
case BaseItemKind.MusicAlbum:
|
case generatedClient.BaseItemKind.MusicAlbum:
|
||||||
return <div className="material-symbols-rounded">album</div>;
|
return <div className="material-symbols-rounded">album</div>;
|
||||||
case BaseItemKind.MusicArtist:
|
case generatedClient.BaseItemKind.MusicArtist:
|
||||||
return <div className="material-symbols-rounded">artist</div>;
|
return <div className="material-symbols-rounded">artist</div>;
|
||||||
case BaseItemKind.Genre:
|
case generatedClient.BaseItemKind.Genre:
|
||||||
case BaseItemKind.MusicGenre:
|
case generatedClient.BaseItemKind.MusicGenre:
|
||||||
return <div className="material-symbols-rounded">domino_mask</div>;
|
return <div className="material-symbols-rounded">domino_mask</div>;
|
||||||
case "musicvideos":
|
case "musicvideos":
|
||||||
case BaseItemKind.MusicVideo:
|
case generatedClient.BaseItemKind.MusicVideo:
|
||||||
return <div className="material-symbols-rounded">music_video</div>;
|
return <div className="material-symbols-rounded">music_video</div>;
|
||||||
case "User":
|
case "User":
|
||||||
case BaseItemKind.Person:
|
case generatedClient.BaseItemKind.Person:
|
||||||
return <div className="material-symbols-rounded">person</div>;
|
return <div className="material-symbols-rounded">person</div>;
|
||||||
case BaseItemKind.Photo:
|
case generatedClient.BaseItemKind.Photo:
|
||||||
return <div className="material-symbols-rounded">image</div>;
|
return <div className="material-symbols-rounded">image</div>;
|
||||||
case "photos":
|
case "photos":
|
||||||
case BaseItemKind.PhotoAlbum:
|
case generatedClient.BaseItemKind.PhotoAlbum:
|
||||||
return <div className="material-symbols-rounded">photo_library</div>;
|
return <div className="material-symbols-rounded">photo_library</div>;
|
||||||
case "universal":
|
case "universal":
|
||||||
case BaseItemKind.Studio:
|
case generatedClient.BaseItemKind.Studio:
|
||||||
return <div className="material-symbols-rounded">category</div>;
|
return <div className="material-symbols-rounded">category</div>;
|
||||||
case "trailers":
|
case "trailers":
|
||||||
case BaseItemKind.Trailer:
|
case generatedClient.BaseItemKind.Trailer:
|
||||||
return <div className="material-symbols-rounded">smart_display</div>;
|
return <div className="material-symbols-rounded">smart_display</div>;
|
||||||
case BaseItemKind.Video:
|
case generatedClient.BaseItemKind.Video:
|
||||||
return <div className="material-symbols-rounded">theaters</div>;
|
return <div className="material-symbols-rounded">theaters</div>;
|
||||||
case "music":
|
case "music":
|
||||||
return <div className="material-symbols-rounded">library_music</div>;
|
return <div className="material-symbols-rounded">library_music</div>;
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||||
import {
|
import { RouterProvider, createRouter } from "@tanstack/react-router";
|
||||||
RouterProvider,
|
import React, { Suspense, useEffect } from "react";
|
||||||
createRouteMask,
|
|
||||||
createRouter,
|
|
||||||
} from "@tanstack/react-router";
|
|
||||||
import React, { Suspense } from "react";
|
|
||||||
import ReactDOM from "react-dom/client";
|
import ReactDOM from "react-dom/client";
|
||||||
// Import the generated route tree
|
// Import the generated route tree
|
||||||
import { routeTree } from "./routeTree.gen";
|
import { routeTree } from "./routeTree.gen";
|
||||||
@@ -25,6 +21,7 @@ const router = createRouter({
|
|||||||
createApi: undefined!,
|
createApi: undefined!,
|
||||||
user: undefined,
|
user: undefined,
|
||||||
jellyfinSDK: undefined!,
|
jellyfinSDK: undefined!,
|
||||||
|
fetchCurrentUser: undefined!,
|
||||||
},
|
},
|
||||||
defaultPreload: "intent",
|
defaultPreload: "intent",
|
||||||
});
|
});
|
||||||
@@ -36,7 +33,10 @@ declare module "@tanstack/react-router" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import { ErrorBoundary } from "react-error-boundary";
|
||||||
|
import { ErrorNotice } from "./components/notices/errorNotice/errorNotice";
|
||||||
import { ApiProvider, useApiInContext } from "./utils/store/api";
|
import { ApiProvider, useApiInContext } from "./utils/store/api";
|
||||||
|
import { CentralProvider, useCentralStore } from "./utils/store/central";
|
||||||
|
|
||||||
export const queryClient = new QueryClient({
|
export const queryClient = new QueryClient({
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
@@ -49,14 +49,34 @@ export const queryClient = new QueryClient({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// biome-ignore lint/nursery/useComponentExportOnlyModules : This is a valid use case for a component export
|
||||||
function ProviderWrapper() {
|
function ProviderWrapper() {
|
||||||
const [api, createApi, jellyfinSDK] = useApiInContext((s) => [
|
const [api, createApi, jellyfinSDK] = useApiInContext((s) => [
|
||||||
s.api,
|
s.api,
|
||||||
s.createApi,
|
s.createApi,
|
||||||
s.jellyfin,
|
s.jellyfin,
|
||||||
]);
|
]);
|
||||||
|
const [user, fetchCurrentUser] = useCentralStore((s) => [
|
||||||
|
s.currentUser,
|
||||||
|
s.fetchCurrentUser,
|
||||||
|
]);
|
||||||
|
if (api?.accessToken && !user?.Id) {
|
||||||
|
fetchCurrentUser(api);
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
if (api) {
|
||||||
|
console.log(`API is set - Route ${window.location.pathname}`);
|
||||||
|
console.log(api);
|
||||||
|
} else {
|
||||||
|
console.log(`API is not set - Route ${window.location.pathname}`);
|
||||||
|
}
|
||||||
|
router.invalidate(); // This is a hack to force the router to re-evaluate the routes and re-run the beforeLoad functions
|
||||||
|
}, [api]);
|
||||||
return (
|
return (
|
||||||
<RouterProvider router={router} context={{ api, createApi, jellyfinSDK }} />
|
<RouterProvider
|
||||||
|
router={router}
|
||||||
|
context={{ api, createApi, user, jellyfinSDK, fetchCurrentUser }}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,11 +84,15 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
|
|||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
{/* TODO: Create a proper loading fallback component */}
|
{/* TODO: Create a proper loading fallback component */}
|
||||||
<Suspense fallback={<h1>Loading in main.tsx</h1>}>
|
<ErrorBoundary FallbackComponent={ErrorNotice}>
|
||||||
<ApiProvider>
|
<Suspense fallback={<h1>Loading in main.tsx</h1>}>
|
||||||
<ProviderWrapper />
|
<CentralProvider>
|
||||||
</ApiProvider>
|
<ApiProvider>
|
||||||
</Suspense>
|
<ProviderWrapper />
|
||||||
|
</ApiProvider>
|
||||||
|
</CentralProvider>
|
||||||
|
</Suspense>
|
||||||
|
</ErrorBoundary>
|
||||||
</QueryClientProvider>
|
</QueryClientProvider>
|
||||||
</React.StrictMode>,
|
</React.StrictMode>,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/* prettier-ignore-start */
|
|
||||||
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
|
||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
// noinspection JSUnusedGlobalSymbols
|
// noinspection JSUnusedGlobalSymbols
|
||||||
|
|
||||||
// This file is auto-generated by TanStack Router
|
// This file was automatically generated by TanStack Router.
|
||||||
|
// You should NOT make any changes in this file as it will be overwritten.
|
||||||
|
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
|
||||||
|
|
||||||
// Import Routes
|
// Import Routes
|
||||||
|
|
||||||
@@ -14,9 +14,7 @@ import { Route as rootRoute } from './routes/__root'
|
|||||||
import { Route as ApiImport } from './routes/_api'
|
import { Route as ApiImport } from './routes/_api'
|
||||||
import { Route as IndexImport } from './routes/index'
|
import { Route as IndexImport } from './routes/index'
|
||||||
import { Route as ErrorCodeImport } from './routes/error/$code'
|
import { Route as ErrorCodeImport } from './routes/error/$code'
|
||||||
import { Route as ApiSearchImport } from './routes/_api/search'
|
|
||||||
import { Route as ApiLoginImport } from './routes/_api/login'
|
import { Route as ApiLoginImport } from './routes/_api/login'
|
||||||
import { Route as ApiLibraryImport } from './routes/_api/library'
|
|
||||||
import { Route as ApiSearchIndexImport } from './routes/_api/search/index'
|
import { Route as ApiSearchIndexImport } from './routes/_api/search/index'
|
||||||
import { Route as ApiPlayerIndexImport } from './routes/_api/player/index'
|
import { Route as ApiPlayerIndexImport } from './routes/_api/player/index'
|
||||||
import { Route as ApiHomeIndexImport } from './routes/_api/home/index'
|
import { Route as ApiHomeIndexImport } from './routes/_api/home/index'
|
||||||
@@ -26,6 +24,7 @@ import { Route as SetupServerErrorImport } from './routes/setup/server.error'
|
|||||||
import { Route as SetupServerAddImport } from './routes/setup/server.add'
|
import { Route as SetupServerAddImport } from './routes/setup/server.add'
|
||||||
import { Route as ApiSeriesIdImport } from './routes/_api/series/$id'
|
import { Route as ApiSeriesIdImport } from './routes/_api/series/$id'
|
||||||
import { Route as ApiPlaylistIdImport } from './routes/_api/playlist/$id'
|
import { Route as ApiPlaylistIdImport } from './routes/_api/playlist/$id'
|
||||||
|
import { Route as ApiPlayerPhotosImport } from './routes/_api/player/photos'
|
||||||
import { Route as ApiPlayerAudioImport } from './routes/_api/player/audio'
|
import { Route as ApiPlayerAudioImport } from './routes/_api/player/audio'
|
||||||
import { Route as ApiPersonIdImport } from './routes/_api/person/$id'
|
import { Route as ApiPersonIdImport } from './routes/_api/person/$id'
|
||||||
import { Route as ApiLoginManualImport } from './routes/_api/login/manual'
|
import { Route as ApiLoginManualImport } from './routes/_api/login/manual'
|
||||||
@@ -46,126 +45,145 @@ const ApiRoute = ApiImport.update({
|
|||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const IndexRoute = IndexImport.update({
|
const IndexRoute = IndexImport.update({
|
||||||
|
id: '/',
|
||||||
path: '/',
|
path: '/',
|
||||||
getParentRoute: () => rootRoute,
|
getParentRoute: () => rootRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ErrorCodeRoute = ErrorCodeImport.update({
|
const ErrorCodeRoute = ErrorCodeImport.update({
|
||||||
|
id: '/error/$code',
|
||||||
path: '/error/$code',
|
path: '/error/$code',
|
||||||
getParentRoute: () => rootRoute,
|
getParentRoute: () => rootRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiSearchRoute = ApiSearchImport.update({
|
|
||||||
path: '/search',
|
|
||||||
getParentRoute: () => ApiRoute,
|
|
||||||
} as any)
|
|
||||||
|
|
||||||
const ApiLoginRoute = ApiLoginImport.update({
|
const ApiLoginRoute = ApiLoginImport.update({
|
||||||
|
id: '/login',
|
||||||
path: '/login',
|
path: '/login',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiLibraryRoute = ApiLibraryImport.update({
|
const ApiSearchIndexRoute = ApiSearchIndexImport.update({
|
||||||
path: '/library',
|
id: '/search/',
|
||||||
|
path: '/search/',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiSearchIndexRoute = ApiSearchIndexImport.update({
|
|
||||||
path: '/',
|
|
||||||
getParentRoute: () => ApiSearchRoute,
|
|
||||||
} as any)
|
|
||||||
|
|
||||||
const ApiPlayerIndexRoute = ApiPlayerIndexImport.update({
|
const ApiPlayerIndexRoute = ApiPlayerIndexImport.update({
|
||||||
|
id: '/player/',
|
||||||
path: '/player/',
|
path: '/player/',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiHomeIndexRoute = ApiHomeIndexImport.update({
|
const ApiHomeIndexRoute = ApiHomeIndexImport.update({
|
||||||
|
id: '/home/',
|
||||||
path: '/home/',
|
path: '/home/',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiFavoriteIndexRoute = ApiFavoriteIndexImport.update({
|
const ApiFavoriteIndexRoute = ApiFavoriteIndexImport.update({
|
||||||
|
id: '/favorite/',
|
||||||
path: '/favorite/',
|
path: '/favorite/',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const SetupServerListRoute = SetupServerListImport.update({
|
const SetupServerListRoute = SetupServerListImport.update({
|
||||||
|
id: '/setup/server/list',
|
||||||
path: '/setup/server/list',
|
path: '/setup/server/list',
|
||||||
getParentRoute: () => rootRoute,
|
getParentRoute: () => rootRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const SetupServerErrorRoute = SetupServerErrorImport.update({
|
const SetupServerErrorRoute = SetupServerErrorImport.update({
|
||||||
|
id: '/setup/server/error',
|
||||||
path: '/setup/server/error',
|
path: '/setup/server/error',
|
||||||
getParentRoute: () => rootRoute,
|
getParentRoute: () => rootRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const SetupServerAddRoute = SetupServerAddImport.update({
|
const SetupServerAddRoute = SetupServerAddImport.update({
|
||||||
|
id: '/setup/server/add',
|
||||||
path: '/setup/server/add',
|
path: '/setup/server/add',
|
||||||
getParentRoute: () => rootRoute,
|
getParentRoute: () => rootRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiSeriesIdRoute = ApiSeriesIdImport.update({
|
const ApiSeriesIdRoute = ApiSeriesIdImport.update({
|
||||||
|
id: '/series/$id',
|
||||||
path: '/series/$id',
|
path: '/series/$id',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiPlaylistIdRoute = ApiPlaylistIdImport.update({
|
const ApiPlaylistIdRoute = ApiPlaylistIdImport.update({
|
||||||
|
id: '/playlist/$id',
|
||||||
path: '/playlist/$id',
|
path: '/playlist/$id',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
|
const ApiPlayerPhotosRoute = ApiPlayerPhotosImport.update({
|
||||||
|
id: '/player/photos',
|
||||||
|
path: '/player/photos',
|
||||||
|
getParentRoute: () => ApiRoute,
|
||||||
|
} as any)
|
||||||
|
|
||||||
const ApiPlayerAudioRoute = ApiPlayerAudioImport.update({
|
const ApiPlayerAudioRoute = ApiPlayerAudioImport.update({
|
||||||
|
id: '/player/audio',
|
||||||
path: '/player/audio',
|
path: '/player/audio',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiPersonIdRoute = ApiPersonIdImport.update({
|
const ApiPersonIdRoute = ApiPersonIdImport.update({
|
||||||
|
id: '/person/$id',
|
||||||
path: '/person/$id',
|
path: '/person/$id',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiLoginManualRoute = ApiLoginManualImport.update({
|
const ApiLoginManualRoute = ApiLoginManualImport.update({
|
||||||
|
id: '/manual',
|
||||||
path: '/manual',
|
path: '/manual',
|
||||||
getParentRoute: () => ApiLoginRoute,
|
getParentRoute: () => ApiLoginRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiLoginListRoute = ApiLoginListImport.update({
|
const ApiLoginListRoute = ApiLoginListImport.update({
|
||||||
|
id: '/list',
|
||||||
path: '/list',
|
path: '/list',
|
||||||
getParentRoute: () => ApiLoginRoute,
|
getParentRoute: () => ApiLoginRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiLibraryIdRoute = ApiLibraryIdImport.update({
|
const ApiLibraryIdRoute = ApiLibraryIdImport.update({
|
||||||
path: '/$id',
|
id: '/library/$id',
|
||||||
getParentRoute: () => ApiLibraryRoute,
|
path: '/library/$id',
|
||||||
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiItemIdRoute = ApiItemIdImport.update({
|
const ApiItemIdRoute = ApiItemIdImport.update({
|
||||||
|
id: '/item/$id',
|
||||||
path: '/item/$id',
|
path: '/item/$id',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiEpisodeIdRoute = ApiEpisodeIdImport.update({
|
const ApiEpisodeIdRoute = ApiEpisodeIdImport.update({
|
||||||
|
id: '/episode/$id',
|
||||||
path: '/episode/$id',
|
path: '/episode/$id',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiBoxsetIdRoute = ApiBoxsetIdImport.update({
|
const ApiBoxsetIdRoute = ApiBoxsetIdImport.update({
|
||||||
|
id: '/boxset/$id',
|
||||||
path: '/boxset/$id',
|
path: '/boxset/$id',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiArtistIdRoute = ApiArtistIdImport.update({
|
const ApiArtistIdRoute = ApiArtistIdImport.update({
|
||||||
|
id: '/artist/$id',
|
||||||
path: '/artist/$id',
|
path: '/artist/$id',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiAlbumIdRoute = ApiAlbumIdImport.update({
|
const ApiAlbumIdRoute = ApiAlbumIdImport.update({
|
||||||
|
id: '/album/$id',
|
||||||
path: '/album/$id',
|
path: '/album/$id',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiLoginUserIdUserNameRoute = ApiLoginUserIdUserNameImport.update({
|
const ApiLoginUserIdUserNameRoute = ApiLoginUserIdUserNameImport.update({
|
||||||
|
id: '/$userId/$userName',
|
||||||
path: '/$userId/$userName',
|
path: '/$userId/$userName',
|
||||||
getParentRoute: () => ApiLoginRoute,
|
getParentRoute: () => ApiLoginRoute,
|
||||||
} as any)
|
} as any)
|
||||||
@@ -188,13 +206,6 @@ declare module '@tanstack/react-router' {
|
|||||||
preLoaderRoute: typeof ApiImport
|
preLoaderRoute: typeof ApiImport
|
||||||
parentRoute: typeof rootRoute
|
parentRoute: typeof rootRoute
|
||||||
}
|
}
|
||||||
'/_api/library': {
|
|
||||||
id: '/_api/library'
|
|
||||||
path: '/library'
|
|
||||||
fullPath: '/library'
|
|
||||||
preLoaderRoute: typeof ApiLibraryImport
|
|
||||||
parentRoute: typeof ApiImport
|
|
||||||
}
|
|
||||||
'/_api/login': {
|
'/_api/login': {
|
||||||
id: '/_api/login'
|
id: '/_api/login'
|
||||||
path: '/login'
|
path: '/login'
|
||||||
@@ -202,13 +213,6 @@ declare module '@tanstack/react-router' {
|
|||||||
preLoaderRoute: typeof ApiLoginImport
|
preLoaderRoute: typeof ApiLoginImport
|
||||||
parentRoute: typeof ApiImport
|
parentRoute: typeof ApiImport
|
||||||
}
|
}
|
||||||
'/_api/search': {
|
|
||||||
id: '/_api/search'
|
|
||||||
path: '/search'
|
|
||||||
fullPath: '/search'
|
|
||||||
preLoaderRoute: typeof ApiSearchImport
|
|
||||||
parentRoute: typeof ApiImport
|
|
||||||
}
|
|
||||||
'/error/$code': {
|
'/error/$code': {
|
||||||
id: '/error/$code'
|
id: '/error/$code'
|
||||||
path: '/error/$code'
|
path: '/error/$code'
|
||||||
@@ -253,10 +257,10 @@ declare module '@tanstack/react-router' {
|
|||||||
}
|
}
|
||||||
'/_api/library/$id': {
|
'/_api/library/$id': {
|
||||||
id: '/_api/library/$id'
|
id: '/_api/library/$id'
|
||||||
path: '/$id'
|
path: '/library/$id'
|
||||||
fullPath: '/library/$id'
|
fullPath: '/library/$id'
|
||||||
preLoaderRoute: typeof ApiLibraryIdImport
|
preLoaderRoute: typeof ApiLibraryIdImport
|
||||||
parentRoute: typeof ApiLibraryImport
|
parentRoute: typeof ApiImport
|
||||||
}
|
}
|
||||||
'/_api/login/list': {
|
'/_api/login/list': {
|
||||||
id: '/_api/login/list'
|
id: '/_api/login/list'
|
||||||
@@ -286,6 +290,13 @@ declare module '@tanstack/react-router' {
|
|||||||
preLoaderRoute: typeof ApiPlayerAudioImport
|
preLoaderRoute: typeof ApiPlayerAudioImport
|
||||||
parentRoute: typeof ApiImport
|
parentRoute: typeof ApiImport
|
||||||
}
|
}
|
||||||
|
'/_api/player/photos': {
|
||||||
|
id: '/_api/player/photos'
|
||||||
|
path: '/player/photos'
|
||||||
|
fullPath: '/player/photos'
|
||||||
|
preLoaderRoute: typeof ApiPlayerPhotosImport
|
||||||
|
parentRoute: typeof ApiImport
|
||||||
|
}
|
||||||
'/_api/playlist/$id': {
|
'/_api/playlist/$id': {
|
||||||
id: '/_api/playlist/$id'
|
id: '/_api/playlist/$id'
|
||||||
path: '/playlist/$id'
|
path: '/playlist/$id'
|
||||||
@@ -344,10 +355,10 @@ declare module '@tanstack/react-router' {
|
|||||||
}
|
}
|
||||||
'/_api/search/': {
|
'/_api/search/': {
|
||||||
id: '/_api/search/'
|
id: '/_api/search/'
|
||||||
path: '/'
|
path: '/search'
|
||||||
fullPath: '/search/'
|
fullPath: '/search'
|
||||||
preLoaderRoute: typeof ApiSearchIndexImport
|
preLoaderRoute: typeof ApiSearchIndexImport
|
||||||
parentRoute: typeof ApiSearchImport
|
parentRoute: typeof ApiImport
|
||||||
}
|
}
|
||||||
'/_api/login/$userId/$userName': {
|
'/_api/login/$userId/$userName': {
|
||||||
id: '/_api/login/$userId/$userName'
|
id: '/_api/login/$userId/$userName'
|
||||||
@@ -361,18 +372,6 @@ declare module '@tanstack/react-router' {
|
|||||||
|
|
||||||
// Create and export the route tree
|
// Create and export the route tree
|
||||||
|
|
||||||
interface ApiLibraryRouteChildren {
|
|
||||||
ApiLibraryIdRoute: typeof ApiLibraryIdRoute
|
|
||||||
}
|
|
||||||
|
|
||||||
const ApiLibraryRouteChildren: ApiLibraryRouteChildren = {
|
|
||||||
ApiLibraryIdRoute: ApiLibraryIdRoute,
|
|
||||||
}
|
|
||||||
|
|
||||||
const ApiLibraryRouteWithChildren = ApiLibraryRoute._addFileChildren(
|
|
||||||
ApiLibraryRouteChildren,
|
|
||||||
)
|
|
||||||
|
|
||||||
interface ApiLoginRouteChildren {
|
interface ApiLoginRouteChildren {
|
||||||
ApiLoginListRoute: typeof ApiLoginListRoute
|
ApiLoginListRoute: typeof ApiLoginListRoute
|
||||||
ApiLoginManualRoute: typeof ApiLoginManualRoute
|
ApiLoginManualRoute: typeof ApiLoginManualRoute
|
||||||
@@ -389,89 +388,49 @@ const ApiLoginRouteWithChildren = ApiLoginRoute._addFileChildren(
|
|||||||
ApiLoginRouteChildren,
|
ApiLoginRouteChildren,
|
||||||
)
|
)
|
||||||
|
|
||||||
interface ApiSearchRouteChildren {
|
|
||||||
ApiSearchIndexRoute: typeof ApiSearchIndexRoute
|
|
||||||
}
|
|
||||||
|
|
||||||
const ApiSearchRouteChildren: ApiSearchRouteChildren = {
|
|
||||||
ApiSearchIndexRoute: ApiSearchIndexRoute,
|
|
||||||
}
|
|
||||||
|
|
||||||
const ApiSearchRouteWithChildren = ApiSearchRoute._addFileChildren(
|
|
||||||
ApiSearchRouteChildren,
|
|
||||||
)
|
|
||||||
|
|
||||||
interface ApiRouteChildren {
|
interface ApiRouteChildren {
|
||||||
ApiLibraryRoute: typeof ApiLibraryRouteWithChildren
|
|
||||||
ApiLoginRoute: typeof ApiLoginRouteWithChildren
|
ApiLoginRoute: typeof ApiLoginRouteWithChildren
|
||||||
ApiSearchRoute: typeof ApiSearchRouteWithChildren
|
|
||||||
ApiAlbumIdRoute: typeof ApiAlbumIdRoute
|
ApiAlbumIdRoute: typeof ApiAlbumIdRoute
|
||||||
ApiArtistIdRoute: typeof ApiArtistIdRoute
|
ApiArtistIdRoute: typeof ApiArtistIdRoute
|
||||||
ApiBoxsetIdRoute: typeof ApiBoxsetIdRoute
|
ApiBoxsetIdRoute: typeof ApiBoxsetIdRoute
|
||||||
ApiEpisodeIdRoute: typeof ApiEpisodeIdRoute
|
ApiEpisodeIdRoute: typeof ApiEpisodeIdRoute
|
||||||
ApiItemIdRoute: typeof ApiItemIdRoute
|
ApiItemIdRoute: typeof ApiItemIdRoute
|
||||||
|
ApiLibraryIdRoute: typeof ApiLibraryIdRoute
|
||||||
ApiPersonIdRoute: typeof ApiPersonIdRoute
|
ApiPersonIdRoute: typeof ApiPersonIdRoute
|
||||||
ApiPlayerAudioRoute: typeof ApiPlayerAudioRoute
|
ApiPlayerAudioRoute: typeof ApiPlayerAudioRoute
|
||||||
|
ApiPlayerPhotosRoute: typeof ApiPlayerPhotosRoute
|
||||||
ApiPlaylistIdRoute: typeof ApiPlaylistIdRoute
|
ApiPlaylistIdRoute: typeof ApiPlaylistIdRoute
|
||||||
ApiSeriesIdRoute: typeof ApiSeriesIdRoute
|
ApiSeriesIdRoute: typeof ApiSeriesIdRoute
|
||||||
ApiFavoriteIndexRoute: typeof ApiFavoriteIndexRoute
|
ApiFavoriteIndexRoute: typeof ApiFavoriteIndexRoute
|
||||||
ApiHomeIndexRoute: typeof ApiHomeIndexRoute
|
ApiHomeIndexRoute: typeof ApiHomeIndexRoute
|
||||||
ApiPlayerIndexRoute: typeof ApiPlayerIndexRoute
|
ApiPlayerIndexRoute: typeof ApiPlayerIndexRoute
|
||||||
|
ApiSearchIndexRoute: typeof ApiSearchIndexRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
const ApiRouteChildren: ApiRouteChildren = {
|
const ApiRouteChildren: ApiRouteChildren = {
|
||||||
ApiLibraryRoute: ApiLibraryRouteWithChildren,
|
|
||||||
ApiLoginRoute: ApiLoginRouteWithChildren,
|
ApiLoginRoute: ApiLoginRouteWithChildren,
|
||||||
ApiSearchRoute: ApiSearchRouteWithChildren,
|
|
||||||
ApiAlbumIdRoute: ApiAlbumIdRoute,
|
ApiAlbumIdRoute: ApiAlbumIdRoute,
|
||||||
ApiArtistIdRoute: ApiArtistIdRoute,
|
ApiArtistIdRoute: ApiArtistIdRoute,
|
||||||
ApiBoxsetIdRoute: ApiBoxsetIdRoute,
|
ApiBoxsetIdRoute: ApiBoxsetIdRoute,
|
||||||
ApiEpisodeIdRoute: ApiEpisodeIdRoute,
|
ApiEpisodeIdRoute: ApiEpisodeIdRoute,
|
||||||
ApiItemIdRoute: ApiItemIdRoute,
|
ApiItemIdRoute: ApiItemIdRoute,
|
||||||
|
ApiLibraryIdRoute: ApiLibraryIdRoute,
|
||||||
ApiPersonIdRoute: ApiPersonIdRoute,
|
ApiPersonIdRoute: ApiPersonIdRoute,
|
||||||
ApiPlayerAudioRoute: ApiPlayerAudioRoute,
|
ApiPlayerAudioRoute: ApiPlayerAudioRoute,
|
||||||
|
ApiPlayerPhotosRoute: ApiPlayerPhotosRoute,
|
||||||
ApiPlaylistIdRoute: ApiPlaylistIdRoute,
|
ApiPlaylistIdRoute: ApiPlaylistIdRoute,
|
||||||
ApiSeriesIdRoute: ApiSeriesIdRoute,
|
ApiSeriesIdRoute: ApiSeriesIdRoute,
|
||||||
ApiFavoriteIndexRoute: ApiFavoriteIndexRoute,
|
ApiFavoriteIndexRoute: ApiFavoriteIndexRoute,
|
||||||
ApiHomeIndexRoute: ApiHomeIndexRoute,
|
ApiHomeIndexRoute: ApiHomeIndexRoute,
|
||||||
ApiPlayerIndexRoute: ApiPlayerIndexRoute,
|
ApiPlayerIndexRoute: ApiPlayerIndexRoute,
|
||||||
|
ApiSearchIndexRoute: ApiSearchIndexRoute,
|
||||||
}
|
}
|
||||||
|
|
||||||
const ApiRouteWithChildren = ApiRoute._addFileChildren(ApiRouteChildren)
|
const ApiRouteWithChildren = ApiRoute._addFileChildren(ApiRouteChildren)
|
||||||
|
|
||||||
interface FileRoutesByFullPath {
|
export interface FileRoutesByFullPath {
|
||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'': typeof ApiRouteWithChildren
|
'': typeof ApiRouteWithChildren
|
||||||
'/library': typeof ApiLibraryRouteWithChildren
|
|
||||||
'/login': typeof ApiLoginRouteWithChildren
|
|
||||||
'/search': typeof ApiSearchRouteWithChildren
|
|
||||||
'/error/$code': typeof ErrorCodeRoute
|
|
||||||
'/album/$id': typeof ApiAlbumIdRoute
|
|
||||||
'/artist/$id': typeof ApiArtistIdRoute
|
|
||||||
'/boxset/$id': typeof ApiBoxsetIdRoute
|
|
||||||
'/episode/$id': typeof ApiEpisodeIdRoute
|
|
||||||
'/item/$id': typeof ApiItemIdRoute
|
|
||||||
'/library/$id': typeof ApiLibraryIdRoute
|
|
||||||
'/login/list': typeof ApiLoginListRoute
|
|
||||||
'/login/manual': typeof ApiLoginManualRoute
|
|
||||||
'/person/$id': typeof ApiPersonIdRoute
|
|
||||||
'/player/audio': typeof ApiPlayerAudioRoute
|
|
||||||
'/playlist/$id': typeof ApiPlaylistIdRoute
|
|
||||||
'/series/$id': typeof ApiSeriesIdRoute
|
|
||||||
'/setup/server/add': typeof SetupServerAddRoute
|
|
||||||
'/setup/server/error': typeof SetupServerErrorRoute
|
|
||||||
'/setup/server/list': typeof SetupServerListRoute
|
|
||||||
'/favorite': typeof ApiFavoriteIndexRoute
|
|
||||||
'/home': typeof ApiHomeIndexRoute
|
|
||||||
'/player': typeof ApiPlayerIndexRoute
|
|
||||||
'/search/': typeof ApiSearchIndexRoute
|
|
||||||
'/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
|
||||||
}
|
|
||||||
|
|
||||||
interface FileRoutesByTo {
|
|
||||||
'/': typeof IndexRoute
|
|
||||||
'': typeof ApiRouteWithChildren
|
|
||||||
'/library': typeof ApiLibraryRouteWithChildren
|
|
||||||
'/login': typeof ApiLoginRouteWithChildren
|
'/login': typeof ApiLoginRouteWithChildren
|
||||||
'/error/$code': typeof ErrorCodeRoute
|
'/error/$code': typeof ErrorCodeRoute
|
||||||
'/album/$id': typeof ApiAlbumIdRoute
|
'/album/$id': typeof ApiAlbumIdRoute
|
||||||
@@ -484,6 +443,7 @@ interface FileRoutesByTo {
|
|||||||
'/login/manual': typeof ApiLoginManualRoute
|
'/login/manual': typeof ApiLoginManualRoute
|
||||||
'/person/$id': typeof ApiPersonIdRoute
|
'/person/$id': typeof ApiPersonIdRoute
|
||||||
'/player/audio': typeof ApiPlayerAudioRoute
|
'/player/audio': typeof ApiPlayerAudioRoute
|
||||||
|
'/player/photos': typeof ApiPlayerPhotosRoute
|
||||||
'/playlist/$id': typeof ApiPlaylistIdRoute
|
'/playlist/$id': typeof ApiPlaylistIdRoute
|
||||||
'/series/$id': typeof ApiSeriesIdRoute
|
'/series/$id': typeof ApiSeriesIdRoute
|
||||||
'/setup/server/add': typeof SetupServerAddRoute
|
'/setup/server/add': typeof SetupServerAddRoute
|
||||||
@@ -496,12 +456,39 @@ interface FileRoutesByTo {
|
|||||||
'/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
'/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FileRoutesById {
|
export interface FileRoutesByTo {
|
||||||
|
'/': typeof IndexRoute
|
||||||
|
'': typeof ApiRouteWithChildren
|
||||||
|
'/login': typeof ApiLoginRouteWithChildren
|
||||||
|
'/error/$code': typeof ErrorCodeRoute
|
||||||
|
'/album/$id': typeof ApiAlbumIdRoute
|
||||||
|
'/artist/$id': typeof ApiArtistIdRoute
|
||||||
|
'/boxset/$id': typeof ApiBoxsetIdRoute
|
||||||
|
'/episode/$id': typeof ApiEpisodeIdRoute
|
||||||
|
'/item/$id': typeof ApiItemIdRoute
|
||||||
|
'/library/$id': typeof ApiLibraryIdRoute
|
||||||
|
'/login/list': typeof ApiLoginListRoute
|
||||||
|
'/login/manual': typeof ApiLoginManualRoute
|
||||||
|
'/person/$id': typeof ApiPersonIdRoute
|
||||||
|
'/player/audio': typeof ApiPlayerAudioRoute
|
||||||
|
'/player/photos': typeof ApiPlayerPhotosRoute
|
||||||
|
'/playlist/$id': typeof ApiPlaylistIdRoute
|
||||||
|
'/series/$id': typeof ApiSeriesIdRoute
|
||||||
|
'/setup/server/add': typeof SetupServerAddRoute
|
||||||
|
'/setup/server/error': typeof SetupServerErrorRoute
|
||||||
|
'/setup/server/list': typeof SetupServerListRoute
|
||||||
|
'/favorite': typeof ApiFavoriteIndexRoute
|
||||||
|
'/home': typeof ApiHomeIndexRoute
|
||||||
|
'/player': typeof ApiPlayerIndexRoute
|
||||||
|
'/search': typeof ApiSearchIndexRoute
|
||||||
|
'/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FileRoutesById {
|
||||||
|
__root__: typeof rootRoute
|
||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'/_api': typeof ApiRouteWithChildren
|
'/_api': typeof ApiRouteWithChildren
|
||||||
'/_api/library': typeof ApiLibraryRouteWithChildren
|
|
||||||
'/_api/login': typeof ApiLoginRouteWithChildren
|
'/_api/login': typeof ApiLoginRouteWithChildren
|
||||||
'/_api/search': typeof ApiSearchRouteWithChildren
|
|
||||||
'/error/$code': typeof ErrorCodeRoute
|
'/error/$code': typeof ErrorCodeRoute
|
||||||
'/_api/album/$id': typeof ApiAlbumIdRoute
|
'/_api/album/$id': typeof ApiAlbumIdRoute
|
||||||
'/_api/artist/$id': typeof ApiArtistIdRoute
|
'/_api/artist/$id': typeof ApiArtistIdRoute
|
||||||
@@ -513,6 +500,7 @@ interface FileRoutesById {
|
|||||||
'/_api/login/manual': typeof ApiLoginManualRoute
|
'/_api/login/manual': typeof ApiLoginManualRoute
|
||||||
'/_api/person/$id': typeof ApiPersonIdRoute
|
'/_api/person/$id': typeof ApiPersonIdRoute
|
||||||
'/_api/player/audio': typeof ApiPlayerAudioRoute
|
'/_api/player/audio': typeof ApiPlayerAudioRoute
|
||||||
|
'/_api/player/photos': typeof ApiPlayerPhotosRoute
|
||||||
'/_api/playlist/$id': typeof ApiPlaylistIdRoute
|
'/_api/playlist/$id': typeof ApiPlaylistIdRoute
|
||||||
'/_api/series/$id': typeof ApiSeriesIdRoute
|
'/_api/series/$id': typeof ApiSeriesIdRoute
|
||||||
'/setup/server/add': typeof SetupServerAddRoute
|
'/setup/server/add': typeof SetupServerAddRoute
|
||||||
@@ -525,14 +513,12 @@ interface FileRoutesById {
|
|||||||
'/_api/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
'/_api/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FileRouteTypes {
|
export interface FileRouteTypes {
|
||||||
fileRoutesByFullPath: FileRoutesByFullPath
|
fileRoutesByFullPath: FileRoutesByFullPath
|
||||||
fullPaths:
|
fullPaths:
|
||||||
| '/'
|
| '/'
|
||||||
| ''
|
| ''
|
||||||
| '/library'
|
|
||||||
| '/login'
|
| '/login'
|
||||||
| '/search'
|
|
||||||
| '/error/$code'
|
| '/error/$code'
|
||||||
| '/album/$id'
|
| '/album/$id'
|
||||||
| '/artist/$id'
|
| '/artist/$id'
|
||||||
@@ -544,6 +530,7 @@ interface FileRouteTypes {
|
|||||||
| '/login/manual'
|
| '/login/manual'
|
||||||
| '/person/$id'
|
| '/person/$id'
|
||||||
| '/player/audio'
|
| '/player/audio'
|
||||||
|
| '/player/photos'
|
||||||
| '/playlist/$id'
|
| '/playlist/$id'
|
||||||
| '/series/$id'
|
| '/series/$id'
|
||||||
| '/setup/server/add'
|
| '/setup/server/add'
|
||||||
@@ -552,13 +539,12 @@ interface FileRouteTypes {
|
|||||||
| '/favorite'
|
| '/favorite'
|
||||||
| '/home'
|
| '/home'
|
||||||
| '/player'
|
| '/player'
|
||||||
| '/search/'
|
| '/search'
|
||||||
| '/login/$userId/$userName'
|
| '/login/$userId/$userName'
|
||||||
fileRoutesByTo: FileRoutesByTo
|
fileRoutesByTo: FileRoutesByTo
|
||||||
to:
|
to:
|
||||||
| '/'
|
| '/'
|
||||||
| ''
|
| ''
|
||||||
| '/library'
|
|
||||||
| '/login'
|
| '/login'
|
||||||
| '/error/$code'
|
| '/error/$code'
|
||||||
| '/album/$id'
|
| '/album/$id'
|
||||||
@@ -571,6 +557,7 @@ interface FileRouteTypes {
|
|||||||
| '/login/manual'
|
| '/login/manual'
|
||||||
| '/person/$id'
|
| '/person/$id'
|
||||||
| '/player/audio'
|
| '/player/audio'
|
||||||
|
| '/player/photos'
|
||||||
| '/playlist/$id'
|
| '/playlist/$id'
|
||||||
| '/series/$id'
|
| '/series/$id'
|
||||||
| '/setup/server/add'
|
| '/setup/server/add'
|
||||||
@@ -582,11 +569,10 @@ interface FileRouteTypes {
|
|||||||
| '/search'
|
| '/search'
|
||||||
| '/login/$userId/$userName'
|
| '/login/$userId/$userName'
|
||||||
id:
|
id:
|
||||||
|
| '__root__'
|
||||||
| '/'
|
| '/'
|
||||||
| '/_api'
|
| '/_api'
|
||||||
| '/_api/library'
|
|
||||||
| '/_api/login'
|
| '/_api/login'
|
||||||
| '/_api/search'
|
|
||||||
| '/error/$code'
|
| '/error/$code'
|
||||||
| '/_api/album/$id'
|
| '/_api/album/$id'
|
||||||
| '/_api/artist/$id'
|
| '/_api/artist/$id'
|
||||||
@@ -598,6 +584,7 @@ interface FileRouteTypes {
|
|||||||
| '/_api/login/manual'
|
| '/_api/login/manual'
|
||||||
| '/_api/person/$id'
|
| '/_api/person/$id'
|
||||||
| '/_api/player/audio'
|
| '/_api/player/audio'
|
||||||
|
| '/_api/player/photos'
|
||||||
| '/_api/playlist/$id'
|
| '/_api/playlist/$id'
|
||||||
| '/_api/series/$id'
|
| '/_api/series/$id'
|
||||||
| '/setup/server/add'
|
| '/setup/server/add'
|
||||||
@@ -611,7 +598,7 @@ interface FileRouteTypes {
|
|||||||
fileRoutesById: FileRoutesById
|
fileRoutesById: FileRoutesById
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RootRouteChildren {
|
export interface RootRouteChildren {
|
||||||
IndexRoute: typeof IndexRoute
|
IndexRoute: typeof IndexRoute
|
||||||
ApiRoute: typeof ApiRouteWithChildren
|
ApiRoute: typeof ApiRouteWithChildren
|
||||||
ErrorCodeRoute: typeof ErrorCodeRoute
|
ErrorCodeRoute: typeof ErrorCodeRoute
|
||||||
@@ -633,8 +620,6 @@ export const routeTree = rootRoute
|
|||||||
._addFileChildren(rootRouteChildren)
|
._addFileChildren(rootRouteChildren)
|
||||||
._addFileTypes<FileRouteTypes>()
|
._addFileTypes<FileRouteTypes>()
|
||||||
|
|
||||||
/* prettier-ignore-end */
|
|
||||||
|
|
||||||
/* ROUTE_MANIFEST_START
|
/* ROUTE_MANIFEST_START
|
||||||
{
|
{
|
||||||
"routes": {
|
"routes": {
|
||||||
@@ -655,28 +640,22 @@ export const routeTree = rootRoute
|
|||||||
"/_api": {
|
"/_api": {
|
||||||
"filePath": "_api.tsx",
|
"filePath": "_api.tsx",
|
||||||
"children": [
|
"children": [
|
||||||
"/_api/library",
|
|
||||||
"/_api/login",
|
"/_api/login",
|
||||||
"/_api/search",
|
|
||||||
"/_api/album/$id",
|
"/_api/album/$id",
|
||||||
"/_api/artist/$id",
|
"/_api/artist/$id",
|
||||||
"/_api/boxset/$id",
|
"/_api/boxset/$id",
|
||||||
"/_api/episode/$id",
|
"/_api/episode/$id",
|
||||||
"/_api/item/$id",
|
"/_api/item/$id",
|
||||||
|
"/_api/library/$id",
|
||||||
"/_api/person/$id",
|
"/_api/person/$id",
|
||||||
"/_api/player/audio",
|
"/_api/player/audio",
|
||||||
|
"/_api/player/photos",
|
||||||
"/_api/playlist/$id",
|
"/_api/playlist/$id",
|
||||||
"/_api/series/$id",
|
"/_api/series/$id",
|
||||||
"/_api/favorite/",
|
"/_api/favorite/",
|
||||||
"/_api/home/",
|
"/_api/home/",
|
||||||
"/_api/player/"
|
"/_api/player/",
|
||||||
]
|
"/_api/search/"
|
||||||
},
|
|
||||||
"/_api/library": {
|
|
||||||
"filePath": "_api/library.tsx",
|
|
||||||
"parent": "/_api",
|
|
||||||
"children": [
|
|
||||||
"/_api/library/$id"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"/_api/login": {
|
"/_api/login": {
|
||||||
@@ -688,13 +667,6 @@ export const routeTree = rootRoute
|
|||||||
"/_api/login/$userId/$userName"
|
"/_api/login/$userId/$userName"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"/_api/search": {
|
|
||||||
"filePath": "_api/search.tsx",
|
|
||||||
"parent": "/_api",
|
|
||||||
"children": [
|
|
||||||
"/_api/search/"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"/error/$code": {
|
"/error/$code": {
|
||||||
"filePath": "error/$code.tsx"
|
"filePath": "error/$code.tsx"
|
||||||
},
|
},
|
||||||
@@ -720,7 +692,7 @@ export const routeTree = rootRoute
|
|||||||
},
|
},
|
||||||
"/_api/library/$id": {
|
"/_api/library/$id": {
|
||||||
"filePath": "_api/library/$id.tsx",
|
"filePath": "_api/library/$id.tsx",
|
||||||
"parent": "/_api/library"
|
"parent": "/_api"
|
||||||
},
|
},
|
||||||
"/_api/login/list": {
|
"/_api/login/list": {
|
||||||
"filePath": "_api/login/list.tsx",
|
"filePath": "_api/login/list.tsx",
|
||||||
@@ -738,8 +710,12 @@ export const routeTree = rootRoute
|
|||||||
"filePath": "_api/player/audio.tsx",
|
"filePath": "_api/player/audio.tsx",
|
||||||
"parent": "/_api"
|
"parent": "/_api"
|
||||||
},
|
},
|
||||||
|
"/_api/player/photos": {
|
||||||
|
"filePath": "_api/player/photos.tsx",
|
||||||
|
"parent": "/_api"
|
||||||
|
},
|
||||||
"/_api/playlist/$id": {
|
"/_api/playlist/$id": {
|
||||||
"filePath": "_api/playlist/$id.jsx",
|
"filePath": "_api/playlist/$id.tsx",
|
||||||
"parent": "/_api"
|
"parent": "/_api"
|
||||||
},
|
},
|
||||||
"/_api/series/$id": {
|
"/_api/series/$id": {
|
||||||
@@ -768,8 +744,8 @@ export const routeTree = rootRoute
|
|||||||
"parent": "/_api"
|
"parent": "/_api"
|
||||||
},
|
},
|
||||||
"/_api/search/": {
|
"/_api/search/": {
|
||||||
"filePath": "_api/search/index.jsx",
|
"filePath": "_api/search/index.tsx",
|
||||||
"parent": "/_api/search"
|
"parent": "/_api"
|
||||||
},
|
},
|
||||||
"/_api/login/$userId/$userName": {
|
"/_api/login/$userId/$userName": {
|
||||||
"filePath": "_api/login/$userId.$userName.tsx",
|
"filePath": "_api/login/$userId.$userName.tsx",
|
||||||
|
|||||||
@@ -3,37 +3,14 @@ import NProgress from "@/components/nProgress";
|
|||||||
import AudioPlayer from "@/components/playback/audioPlayer";
|
import AudioPlayer from "@/components/playback/audioPlayer";
|
||||||
import Settings from "@/components/settings";
|
import Settings from "@/components/settings";
|
||||||
import { EasterEgg } from "@/components/utils/easterEgg";
|
import { EasterEgg } from "@/components/utils/easterEgg";
|
||||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
import { CssBaseline, ThemeProvider } from "@mui/material";
|
||||||
import { LoadingButton } from "@mui/lab";
|
|
||||||
import {
|
|
||||||
Button,
|
|
||||||
Chip,
|
|
||||||
CircularProgress,
|
|
||||||
CssBaseline,
|
|
||||||
Dialog,
|
|
||||||
DialogActions,
|
|
||||||
DialogContent,
|
|
||||||
DialogContentText,
|
|
||||||
DialogTitle,
|
|
||||||
IconButton,
|
|
||||||
SvgIcon,
|
|
||||||
ThemeProvider,
|
|
||||||
} from "@mui/material";
|
|
||||||
import { useIsFetching, useIsMutating } from "@tanstack/react-query";
|
|
||||||
import {
|
import {
|
||||||
Outlet,
|
Outlet,
|
||||||
ScrollRestoration,
|
ScrollRestoration,
|
||||||
createRootRouteWithContext,
|
createRootRouteWithContext,
|
||||||
useRouterState,
|
|
||||||
} from "@tanstack/react-router";
|
} from "@tanstack/react-router";
|
||||||
import { TanStackRouterDevtools } from "@tanstack/router-devtools";
|
import { SnackbarProvider } from "notistack";
|
||||||
import { relaunch } from "@tauri-apps/plugin-process";
|
import React from "react";
|
||||||
import { type Update, check } from "@tauri-apps/plugin-updater";
|
|
||||||
import { AnimatePresence, motion } from "framer-motion";
|
|
||||||
import { SnackbarProvider, useSnackbar } from "notistack";
|
|
||||||
import React, { Suspense, useEffect, useLayoutEffect, useState } from "react";
|
|
||||||
import Markdown from "react-markdown";
|
|
||||||
import remarkGfm from "remark-gfm";
|
|
||||||
|
|
||||||
import "../styles/global.scss";
|
import "../styles/global.scss";
|
||||||
import { theme } from "@/theme";
|
import { theme } from "@/theme";
|
||||||
@@ -41,8 +18,13 @@ import { theme } from "@/theme";
|
|||||||
// Fonts
|
// Fonts
|
||||||
import "@fontsource-variable/jetbrains-mono";
|
import "@fontsource-variable/jetbrains-mono";
|
||||||
import "@fontsource-variable/noto-sans";
|
import "@fontsource-variable/noto-sans";
|
||||||
|
import "@fontsource-variable/plus-jakarta-sans";
|
||||||
|
|
||||||
import "material-symbols/rounded.scss";
|
import "material-symbols/rounded.scss";
|
||||||
|
import Backdrop from "@/components/backdrop";
|
||||||
|
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||||
|
import RouterLoading from "@/components/routerLoading";
|
||||||
|
import Updater from "@/components/updater";
|
||||||
import type { Api, Jellyfin } from "@jellyfin/sdk";
|
import type { Api, Jellyfin } from "@jellyfin/sdk";
|
||||||
import type { UserDto } from "@jellyfin/sdk/lib/generated-client";
|
import type { UserDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||||
@@ -50,225 +32,38 @@ import { DndProvider } from "react-dnd";
|
|||||||
import { HTML5Backend } from "react-dnd-html5-backend";
|
import { HTML5Backend } from "react-dnd-html5-backend";
|
||||||
|
|
||||||
type ApiContext = {
|
type ApiContext = {
|
||||||
api: Api;
|
api: Api | undefined;
|
||||||
createApi: (
|
createApi: (serverAddress: string, accessToken: string | undefined) => void;
|
||||||
serverAddress: string | undefined,
|
|
||||||
accessToken: string | undefined,
|
|
||||||
) => void;
|
|
||||||
user: UserDto | null | undefined;
|
user: UserDto | null | undefined;
|
||||||
jellyfinSDK: Jellyfin;
|
jellyfinSDK: Jellyfin;
|
||||||
|
fetchCurrentUser: (api: Api | undefined) => Promise<void>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Route = createRootRouteWithContext<ApiContext>()({
|
export const Route = createRootRouteWithContext<ApiContext>()({
|
||||||
component: () => {
|
component: () => {
|
||||||
const isQueryFetching = useIsFetching();
|
|
||||||
const isMutating = useIsMutating();
|
|
||||||
const routeIsLoading = useRouterState().isLoading;
|
|
||||||
const [updateDialog, setUpdateDialog] = useState(false);
|
|
||||||
const [updateDialogButton, setUpdateDialogButton] = useState(false);
|
|
||||||
const [updateInfo, setUpdateInfo] = useState<Update | undefined>(undefined);
|
|
||||||
useLayoutEffect(() => {
|
|
||||||
async function checkForUpdates() {
|
|
||||||
try {
|
|
||||||
const update = await check();
|
|
||||||
|
|
||||||
if (update?.available) {
|
|
||||||
setUpdateInfo(update);
|
|
||||||
setUpdateDialog(true);
|
|
||||||
|
|
||||||
console.log(`Update found : ${update.version}, ${update.date}`);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkForUpdates();
|
|
||||||
}, []);
|
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
|
||||||
const [backdropUrl, backdropId] = useBackdropStore((state) => [
|
|
||||||
state.backdropUrl,
|
|
||||||
state.backdropId,
|
|
||||||
]);
|
|
||||||
|
|
||||||
const [backdropLoading, setBackdropLoading] = useState(true);
|
|
||||||
// Reset BackdropImageLoading for every new image
|
|
||||||
useEffect(() => {
|
|
||||||
setBackdropLoading(true);
|
|
||||||
}, [backdropId]);
|
|
||||||
return (
|
return (
|
||||||
<DndProvider backend={HTML5Backend}>
|
<DndProvider backend={HTML5Backend}>
|
||||||
<Suspense fallback={<h1>Loading...</h1>}>
|
<ThemeProvider theme={theme}>
|
||||||
<ThemeProvider theme={theme}>
|
<SnackbarProvider maxSnack={5}>
|
||||||
<SnackbarProvider maxSnack={5}>
|
<CssBaseline />
|
||||||
<CssBaseline />
|
<ScrollRestoration />
|
||||||
<ScrollRestoration />
|
<Settings />
|
||||||
<Settings />
|
<EasterEgg />
|
||||||
<EasterEgg />
|
<NProgress />
|
||||||
<NProgress
|
|
||||||
key={
|
|
||||||
isQueryFetching || isMutating || routeIsLoading
|
|
||||||
? `show${(isQueryFetching ?? 1) * (isMutating ?? 1) * (routeIsLoading ?? 1)}`
|
|
||||||
: "hide"
|
|
||||||
}
|
|
||||||
isAnimating={isQueryFetching || isMutating || routeIsLoading}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{routeIsLoading && (
|
<RouterLoading />
|
||||||
<motion.div
|
|
||||||
initial={{ opacity: 0 }}
|
|
||||||
animate={{ opacity: 1 }}
|
|
||||||
style={{
|
|
||||||
width: "100vw",
|
|
||||||
height: "100vh",
|
|
||||||
display: "flex",
|
|
||||||
justifyContent: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
background: "rgb(0 0 0 / 0.35)",
|
|
||||||
position: "fixed",
|
|
||||||
zIndex: 10000,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<CircularProgress size={72} thickness={2} />
|
|
||||||
</motion.div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Dialog
|
<Updater />
|
||||||
open={updateDialog}
|
<Backdrop />
|
||||||
fullWidth
|
<AppBar />
|
||||||
PaperProps={{
|
<AudioPlayer />
|
||||||
style: {
|
<Outlet />
|
||||||
borderRadius: "14px",
|
<ReactQueryDevtools />
|
||||||
background: "rgb(0 0 0 / 0.5)",
|
{/* <TanStackRouterDevtools /> */}
|
||||||
backdropFilter: "blur(10px)",
|
</SnackbarProvider>
|
||||||
border: "1px solid rgb(255 255 255 / 0.2)",
|
</ThemeProvider>
|
||||||
},
|
|
||||||
}}
|
|
||||||
sx={{
|
|
||||||
"& img": {
|
|
||||||
width: "100%",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{updateInfo !== undefined && (
|
|
||||||
<>
|
|
||||||
<DialogTitle
|
|
||||||
variant="h5"
|
|
||||||
style={{
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
alignItems: "flex-start",
|
|
||||||
gap: "0.4em",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Update Available!
|
|
||||||
<Chip
|
|
||||||
icon={
|
|
||||||
<span className="material-symbols-rounded">
|
|
||||||
update
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
label={`v${updateInfo.version}`}
|
|
||||||
color="success"
|
|
||||||
/>
|
|
||||||
</DialogTitle>
|
|
||||||
<DialogContent dividers>
|
|
||||||
<DialogContentText>
|
|
||||||
<Markdown remarkPlugins={[remarkGfm]}>
|
|
||||||
{updateInfo.body}
|
|
||||||
</Markdown>
|
|
||||||
</DialogContentText>
|
|
||||||
</DialogContent>
|
|
||||||
<DialogActions
|
|
||||||
style={{
|
|
||||||
padding: "1em",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<IconButton
|
|
||||||
disabled={updateDialogButton}
|
|
||||||
target="_blank"
|
|
||||||
href={`https://github.com/prayag17/JellyPlayer/releases/${updateInfo.version}`}
|
|
||||||
>
|
|
||||||
<SvgIcon>
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
width="16"
|
|
||||||
height="16"
|
|
||||||
fill="currentColor"
|
|
||||||
viewBox="0 0 16 16"
|
|
||||||
>
|
|
||||||
<title>Update</title>
|
|
||||||
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8" />
|
|
||||||
</svg>
|
|
||||||
</SvgIcon>
|
|
||||||
</IconButton>
|
|
||||||
<Button
|
|
||||||
size="large"
|
|
||||||
color="error"
|
|
||||||
variant="outlined"
|
|
||||||
disabled={updateDialogButton}
|
|
||||||
onClick={() => setUpdateDialog(false)}
|
|
||||||
>
|
|
||||||
close
|
|
||||||
</Button>
|
|
||||||
<LoadingButton
|
|
||||||
size="large"
|
|
||||||
color="success"
|
|
||||||
variant="contained"
|
|
||||||
loading={updateDialogButton}
|
|
||||||
loadingIndicator="Updating..."
|
|
||||||
onClick={async () => {
|
|
||||||
setUpdateDialogButton(true);
|
|
||||||
await updateInfo.downloadAndInstall();
|
|
||||||
enqueueSnackbar(
|
|
||||||
"Update has been installed! You need to relaunch JellyPlayer.",
|
|
||||||
{
|
|
||||||
variant: "success",
|
|
||||||
},
|
|
||||||
);
|
|
||||||
await relaunch();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Update
|
|
||||||
</LoadingButton>
|
|
||||||
</DialogActions>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</Dialog>
|
|
||||||
<div className="app-backdrop-container">
|
|
||||||
<AnimatePresence>
|
|
||||||
<motion.img
|
|
||||||
key={backdropId}
|
|
||||||
src={backdropUrl}
|
|
||||||
alt=""
|
|
||||||
className="app-backdrop"
|
|
||||||
initial={{
|
|
||||||
opacity: 0,
|
|
||||||
}}
|
|
||||||
animate={{
|
|
||||||
opacity: backdropLoading ? 0 : 1,
|
|
||||||
}}
|
|
||||||
exit={{
|
|
||||||
opacity: 0,
|
|
||||||
}}
|
|
||||||
transition={{
|
|
||||||
opacity: {
|
|
||||||
duration: 1.2,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
onLoad={() => setBackdropLoading(false)}
|
|
||||||
loading="lazy"
|
|
||||||
/>
|
|
||||||
</AnimatePresence>
|
|
||||||
</div>
|
|
||||||
<AppBar />
|
|
||||||
<AudioPlayer />
|
|
||||||
<Outlet />
|
|
||||||
<ReactQueryDevtools />
|
|
||||||
{/* <TanStackRouterDevtools /> */}
|
|
||||||
</SnackbarProvider>
|
|
||||||
</ThemeProvider>
|
|
||||||
</Suspense>
|
|
||||||
</DndProvider>
|
</DndProvider>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
errorComponent: ErrorNotice,
|
||||||
});
|
});
|
||||||
@@ -1,70 +1,64 @@
|
|||||||
import { getDefaultServer, getServer } from "@/utils/storage/servers";
|
import { getDefaultServer, getServer } from "@/utils/storage/servers";
|
||||||
import { getUser } from "@/utils/storage/user";
|
import { getUser } from "@/utils/storage/user";
|
||||||
import { axiosClient } from "@/utils/store/api";
|
|
||||||
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
import { Outlet, createFileRoute, redirect } from "@tanstack/react-router";
|
import { createFileRoute, redirect } from "@tanstack/react-router";
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api")({
|
export const Route = createFileRoute("/_api")({
|
||||||
beforeLoad: async ({ context, location }) => {
|
beforeLoad: async ({ context, location }) => {
|
||||||
// console.log(context.api);
|
|
||||||
if (!context.api) {
|
if (!context.api) {
|
||||||
const currentServerId = await getDefaultServer();
|
const currentServerId = await getDefaultServer();
|
||||||
if (currentServerId) {
|
if (currentServerId) {
|
||||||
const currentServer = await getServer(currentServerId);
|
const currentServer = await getServer(currentServerId);
|
||||||
const apiTemp = context.jellyfinSDK.createApi(
|
if (currentServer?.address) {
|
||||||
currentServer?.address,
|
|
||||||
null,
|
|
||||||
axiosClient,
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
await getSystemApi(apiTemp).getPingSystem();
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
throw redirect({
|
|
||||||
to: "/error/$code",
|
|
||||||
params: {
|
|
||||||
code: "101",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const userOnDisk = await getUser();
|
|
||||||
if (userOnDisk) {
|
|
||||||
if (location.pathname !== "/login/manual") {
|
|
||||||
const apiTemp = context.jellyfinSDK.createApi(
|
|
||||||
currentServer?.address,
|
|
||||||
userOnDisk.AccessToken,
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
await getUserApi(apiTemp).getCurrentUser();
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
throw redirect({
|
|
||||||
to: "/login/manual",
|
|
||||||
search: {
|
|
||||||
redirect: location.href,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// return { api: apiTemp };
|
|
||||||
}
|
|
||||||
context.createApi(currentServer?.address, userOnDisk.AccessToken);
|
|
||||||
} else {
|
|
||||||
const apiTemp = context.jellyfinSDK.createApi(
|
const apiTemp = context.jellyfinSDK.createApi(
|
||||||
currentServer?.address,
|
currentServer?.address,
|
||||||
null,
|
undefined,
|
||||||
);
|
);
|
||||||
context.createApi(currentServer?.address, undefined); // Creates Api
|
try {
|
||||||
// return { api: apiTemp };
|
await getSystemApi(apiTemp).getPingSystem();
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
throw redirect({
|
||||||
|
to: "/error/$code",
|
||||||
|
params: {
|
||||||
|
code: "101",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const userOnDisk = await getUser();
|
||||||
|
if (userOnDisk) {
|
||||||
|
if (location.pathname !== "/login/manual") {
|
||||||
|
const apiTemp = context.jellyfinSDK.createApi(
|
||||||
|
currentServer?.address,
|
||||||
|
userOnDisk.AccessToken,
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
await getUserApi(apiTemp).getCurrentUser();
|
||||||
|
// return { user: user.data };
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
throw redirect({
|
||||||
|
to: "/login/manual",
|
||||||
|
search: {
|
||||||
|
redirect: location.href,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
context.createApi(currentServer?.address, userOnDisk.AccessToken);
|
||||||
|
} else {
|
||||||
|
context.createApi(currentServer?.address, undefined); // Creates Api
|
||||||
|
|
||||||
|
// return { api: apiTemp };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (context.api) {
|
} else if (context.api) {
|
||||||
if (context.api.accessToken && location.pathname !== "/login/manual") {
|
if (context.api.accessToken && location.pathname !== "/login/manual") {
|
||||||
try {
|
try {
|
||||||
return {
|
console.info("AccessToken", context.api.accessToken);
|
||||||
user: await getUserApi(context.api).getCurrentUser(),
|
await getUserApi(context.api).getCurrentUser(); // Verify user is able to authenticate
|
||||||
}; // Verify user is able to authenticate
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
throw redirect({
|
throw redirect({
|
||||||
|
|||||||
@@ -1,87 +1,39 @@
|
|||||||
import PropTypes from "prop-types";
|
import React, { useLayoutEffect, useMemo } from "react";
|
||||||
import React, { useLayoutEffect, useRef } from "react";
|
|
||||||
|
|
||||||
import heroBg from "@/assets/herobg.png";
|
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import Chip from "@mui/material/Chip";
|
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
import Stack from "@mui/material/Stack";
|
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
import useParallax from "@/utils/hooks/useParallax";
|
import { BaseItemKind, SortOrder } from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { motion, useScroll } from "framer-motion";
|
|
||||||
|
|
||||||
import {
|
|
||||||
type BaseItemDto,
|
|
||||||
BaseItemKind,
|
|
||||||
SortOrder,
|
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
|
||||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||||
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";
|
||||||
|
|
||||||
import { Blurhash } from "react-blurhash";
|
|
||||||
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
import {
|
import { getRuntimeCompact } from "@/utils/date/time";
|
||||||
getRuntime,
|
|
||||||
getRuntimeCompact,
|
|
||||||
getRuntimeMusic,
|
|
||||||
} from "@/utils/date/time";
|
|
||||||
|
|
||||||
import { Card } from "@/components/card/card";
|
import { Card } from "@/components/card/card";
|
||||||
import { CardScroller } from "@/components/cardScroller/cardScroller";
|
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||||
|
|
||||||
import LikeButton from "@/components/buttons/likeButton";
|
import LikeButton from "@/components/buttons/likeButton";
|
||||||
import PlayButton from "@/components/buttons/playButton";
|
import PlayButton from "@/components/buttons/playButton";
|
||||||
import TrackList from "@/components/layouts/tracksList";
|
|
||||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||||
import ShowMoreText from "@/components/showMoreText";
|
|
||||||
|
|
||||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||||
import {
|
|
||||||
generateAudioStreamUrl,
|
|
||||||
playAudio,
|
|
||||||
useAudioPlayback,
|
|
||||||
} from "@/utils/store/audioPlayback";
|
|
||||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||||
import "./album.scss";
|
import "./album.scss";
|
||||||
|
|
||||||
|
import AlbumMusicTrack from "@/components/albumMusicTrack";
|
||||||
|
import ShowMoreText from "@/components/showMoreText";
|
||||||
import TagChip from "@/components/tagChip";
|
import TagChip from "@/components/tagChip";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
import { Chip } from "@mui/material";
|
||||||
import { Link, createFileRoute } from "@tanstack/react-router";
|
import { Link, createFileRoute } from "@tanstack/react-router";
|
||||||
import lyricsIcon from "../../../assets/icons/lyrics.svg";
|
import { createPortal } from "react-dom";
|
||||||
|
|
||||||
function TabPanel(props) {
|
|
||||||
const { children, value, index, ...other } = props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
role="tabpanel"
|
|
||||||
hidden={value !== index}
|
|
||||||
id={`full-width-tabpanel-${index}`}
|
|
||||||
aria-labelledby={`full-width-tab-${index}`}
|
|
||||||
{...other}
|
|
||||||
style={{ marginTop: "1em" }}
|
|
||||||
>
|
|
||||||
{value === index && <Box>{children}</Box>}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
TabPanel.propTypes = {
|
|
||||||
children: PropTypes.node,
|
|
||||||
index: PropTypes.number.isRequired,
|
|
||||||
value: PropTypes.number.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
function a11yProps(index) {
|
|
||||||
return {
|
|
||||||
id: `full-width-tab-${index}`,
|
|
||||||
"aria-controls": `full-width-tabpanel-${index}`,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/album/$id")({
|
export const Route = createFileRoute("/_api/album/$id")({
|
||||||
component: MusicAlbumTitlePage,
|
component: MusicAlbumTitlePage,
|
||||||
@@ -89,28 +41,21 @@ export const Route = createFileRoute("/_api/album/$id")({
|
|||||||
|
|
||||||
function MusicAlbumTitlePage() {
|
function MusicAlbumTitlePage() {
|
||||||
const { id } = Route.useParams();
|
const { id } = Route.useParams();
|
||||||
const api = Route.useRouteContext().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",
|
|
||||||
enabled: Boolean(api),
|
|
||||||
});
|
|
||||||
|
|
||||||
const item = useQuery({
|
const item = useQuery({
|
||||||
queryKey: ["item", id],
|
queryKey: ["item", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
itemId: id,
|
itemId: id,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
});
|
});
|
||||||
@@ -118,12 +63,15 @@ function MusicAlbumTitlePage() {
|
|||||||
const similarItems = useQuery({
|
const similarItems = useQuery({
|
||||||
queryKey: ["item", id, "similarItem"],
|
queryKey: ["item", id, "similarItem"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getLibraryApi(api).getSimilarAlbums({
|
if (api && item.data?.Id) {
|
||||||
userId: user.data?.Id,
|
const result = await getLibraryApi(api).getSimilarAlbums({
|
||||||
itemId: item.data?.Id,
|
userId: user?.Id,
|
||||||
limit: 16,
|
itemId: item.data?.Id,
|
||||||
});
|
limit: 16,
|
||||||
return result.data;
|
});
|
||||||
|
return result.data;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
},
|
},
|
||||||
enabled: item.isSuccess,
|
enabled: item.isSuccess,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
@@ -133,52 +81,46 @@ function MusicAlbumTitlePage() {
|
|||||||
const musicTracks = useQuery({
|
const musicTracks = useQuery({
|
||||||
queryKey: ["item", "musicTracks", id],
|
queryKey: ["item", "musicTracks", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
parentId: item.data?.Id,
|
parentId: item.data?.Id,
|
||||||
sortOrder: [SortOrder.Ascending],
|
sortOrder: [SortOrder.Ascending],
|
||||||
sortBy: ["IndexNumber"],
|
sortBy: ["IndexNumber", "ParentIndexNumber"],
|
||||||
|
fields: ["MediaSources"],
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicAlbum,
|
enabled: item.isSuccess && item.data?.Type === BaseItemKind.MusicAlbum,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
||||||
|
|
||||||
|
const allDiscs = useMemo(() => {
|
||||||
|
const discs: number[] = [];
|
||||||
|
if (musicTracks.data?.Items) {
|
||||||
|
for (const track of musicTracks.data.Items) {
|
||||||
|
if (
|
||||||
|
track.ParentIndexNumber &&
|
||||||
|
!discs.includes(track.ParentIndexNumber)
|
||||||
|
) {
|
||||||
|
discs.push(track.ParentIndexNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return discs;
|
||||||
|
}, [musicTracks.data]);
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (item.isSuccess) {
|
if (item.isSuccess) {
|
||||||
setAppBackdrop(
|
setAppBackdrop(
|
||||||
`${api.basePath}/Items/${item.data.ParentBackdropItemId}/Images/Backdrop`,
|
`${api?.basePath}/Items/${item.data?.ParentBackdropItemId}/Images/Backdrop`,
|
||||||
item.data.Id,
|
item.data?.Id,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [item.isSuccess]);
|
}, [item.isSuccess]);
|
||||||
|
|
||||||
const pageRef = useRef(null);
|
|
||||||
const { scrollYProgress } = useScroll({
|
|
||||||
target: pageRef,
|
|
||||||
offset: ["start start", "60vh start"],
|
|
||||||
});
|
|
||||||
const parallax = useParallax(scrollYProgress, 50);
|
|
||||||
|
|
||||||
const handlePlayback = (
|
|
||||||
index: number,
|
|
||||||
item: BaseItemDto,
|
|
||||||
queue: BaseItemDto[],
|
|
||||||
) => {
|
|
||||||
const url = generateAudioStreamUrl(
|
|
||||||
item.Id,
|
|
||||||
user.data?.Id,
|
|
||||||
api.deviceInfo.id,
|
|
||||||
api.basePath,
|
|
||||||
);
|
|
||||||
playAudio(url, item, undefined, queue, index);
|
|
||||||
};
|
|
||||||
|
|
||||||
const currentPlayingItem = useAudioPlayback((s) => s.item);
|
|
||||||
|
|
||||||
if (item.isPending || similarItems.isPending) {
|
if (item.isPending || similarItems.isPending) {
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
@@ -194,125 +136,137 @@ function MusicAlbumTitlePage() {
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (item.isSuccess && similarItems.isSuccess) {
|
if (item.isSuccess && item.data && similarItems.isSuccess) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div key={id} className="scrollY padded-top item item-album">
|
||||||
key={id}
|
<div className="item-info">
|
||||||
className="scrollY padded-top item item-album"
|
<Typography className="item-info-name" variant="h3">
|
||||||
ref={pageRef}
|
{item.data?.Name}
|
||||||
>
|
</Typography>
|
||||||
<div className="item-info-container">
|
<div className="flex flex-align-center item-info-album-info">
|
||||||
<div className="item-info">
|
{/* @ts-ignore - Using Link as component */}
|
||||||
<Typography className="item-info-name" variant="h3">
|
<Link
|
||||||
{item.data.Name}
|
to="/artist/$id"
|
||||||
|
params={{ id: item.data.AlbumArtists?.[0].Id ?? "" }}
|
||||||
|
>
|
||||||
|
<Chip
|
||||||
|
// component={Link}
|
||||||
|
className="flex flex-align-center"
|
||||||
|
style={{
|
||||||
|
color: "white",
|
||||||
|
textDecoration: "none",
|
||||||
|
}}
|
||||||
|
icon={
|
||||||
|
<span
|
||||||
|
className="material-symbols-rounded fill"
|
||||||
|
style={{
|
||||||
|
paddingLeft: "0.25em",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
artist
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
label={item.data.AlbumArtist}
|
||||||
|
/>
|
||||||
|
</Link>
|
||||||
|
<Typography className="opacity-07">
|
||||||
|
{item.data.ProductionYear}
|
||||||
|
</Typography>
|
||||||
|
<Typography className="opacity-07">
|
||||||
|
{(musicTracks.data?.TotalRecordCount ?? 0) > 1
|
||||||
|
? `${musicTracks.data?.TotalRecordCount} songs`
|
||||||
|
: "Single"}
|
||||||
|
</Typography>
|
||||||
|
<Typography className="opacity-07">
|
||||||
|
{getRuntimeCompact(item.data.CumulativeRunTimeTicks ?? 0)}
|
||||||
</Typography>
|
</Typography>
|
||||||
<div className="flex flex-align-center item-info-album-info">
|
|
||||||
<div className="flex flex-align-center">
|
|
||||||
<span
|
|
||||||
className="material-symbols-rounded"
|
|
||||||
style={{
|
|
||||||
opacity: 0.7,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
artist
|
|
||||||
</span>
|
|
||||||
<Typography ml={1}>{item.data.AlbumArtist}</Typography>
|
|
||||||
</div>
|
|
||||||
<Typography className="opacity-07">
|
|
||||||
{item.data.ProductionYear}
|
|
||||||
</Typography>
|
|
||||||
<Typography className="opacity-07">
|
|
||||||
{musicTracks.data?.TotalRecordCount > 1
|
|
||||||
? `${musicTracks.data?.TotalRecordCount} songs`
|
|
||||||
: `1 song`}
|
|
||||||
</Typography>
|
|
||||||
<Typography className="opacity-07">
|
|
||||||
{getRuntimeCompact(item.data.CumulativeRunTimeTicks)}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
<div className="item-info-buttons">
|
|
||||||
<PlayButton
|
|
||||||
item={item}
|
|
||||||
audio
|
|
||||||
itemType={item.data.Type}
|
|
||||||
userId={user.data?.Id}
|
|
||||||
/>
|
|
||||||
<LikeButton
|
|
||||||
itemId={item.data.Id}
|
|
||||||
isFavorite={item.data.UserData?.IsFavorite}
|
|
||||||
queryKey={["item", "musicTracks"]}
|
|
||||||
userId={user.data?.Id}
|
|
||||||
itemName={item.data.Name}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="item-info-track-container">
|
|
||||||
<div className="item-info-track header">
|
|
||||||
<span className="material-symbols-rounded index">tag</span>
|
|
||||||
<Typography variant="subtitle1">Title</Typography>
|
|
||||||
<Typography variant="subtitle1">Duration</Typography>
|
|
||||||
</div>
|
|
||||||
{musicTracks.data?.Items?.map((track, index) => (
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
currentPlayingItem?.Id === track.Id
|
|
||||||
? "item-info-track playing"
|
|
||||||
: "item-info-track"
|
|
||||||
}
|
|
||||||
key={track.Id}
|
|
||||||
onClick={() =>
|
|
||||||
handlePlayback(index, track, musicTracks.data.Items)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<div className="index-container">
|
|
||||||
<span className="material-symbols-rounded fill ">
|
|
||||||
play_arrow
|
|
||||||
</span>
|
|
||||||
<Typography className="index">
|
|
||||||
{track.IndexNumber ?? "-"}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
<div className="item-info-track-info">
|
|
||||||
<Typography className="item-info-track-info-name">
|
|
||||||
{track.Name}
|
|
||||||
</Typography>
|
|
||||||
<Typography
|
|
||||||
variant="subtitle2"
|
|
||||||
style={{
|
|
||||||
opacity: 0.6,
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
gap: "0.6em",
|
|
||||||
}}
|
|
||||||
fontWeight={300}
|
|
||||||
>
|
|
||||||
{track.HasLyrics && <img src={lyricsIcon} alt="lyrics" />}
|
|
||||||
{track.Artists?.join(", ")}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
<Typography>{getRuntimeMusic(track.RunTimeTicks)}</Typography>
|
|
||||||
<div className="flex flex-align-center">
|
|
||||||
<LikeButton
|
|
||||||
itemId={track.Id}
|
|
||||||
isFavorite={track.UserData?.IsFavorite}
|
|
||||||
queryKey={["item", "musicTracks"]}
|
|
||||||
userId={user.data?.Id}
|
|
||||||
itemName={track.Name}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div className="item-info-buttons">
|
||||||
|
<PlayButton
|
||||||
|
item={item.data}
|
||||||
|
audio
|
||||||
|
itemType={item.data.Type ?? "Audio"}
|
||||||
|
userId={user?.Id}
|
||||||
|
/>
|
||||||
|
<LikeButton
|
||||||
|
itemId={item.data.Id}
|
||||||
|
isFavorite={item.data.UserData?.IsFavorite}
|
||||||
|
queryKey={["item", "musicTracks"]}
|
||||||
|
userId={user?.Id}
|
||||||
|
itemName={item.data.Name}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="item-info-track-container ">
|
||||||
|
{allDiscs.length > 1 ? (
|
||||||
|
allDiscs.map((disc) => (
|
||||||
|
<div className="item-info-disc-container" key={disc}>
|
||||||
|
<div
|
||||||
|
className="item-info-disc-header flex flex-row flex-align-center"
|
||||||
|
style={{ marginBottom: "1em" }}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className="material-symbols-rounded"
|
||||||
|
style={{ fontSize: "2em" }}
|
||||||
|
>
|
||||||
|
album
|
||||||
|
</span>
|
||||||
|
<Typography variant="h5">Disc {disc}</Typography>
|
||||||
|
</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>
|
||||||
|
{musicTracks.data?.Items?.map(
|
||||||
|
(track, index) =>
|
||||||
|
track.ParentIndexNumber === disc && (
|
||||||
|
<AlbumMusicTrack
|
||||||
|
key={track.Id}
|
||||||
|
track={track}
|
||||||
|
trackIndex={index}
|
||||||
|
musicTracks={musicTracks.data}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<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>
|
||||||
|
{musicTracks.data?.Items?.map((track, index) => (
|
||||||
|
<AlbumMusicTrack
|
||||||
|
key={track.Id}
|
||||||
|
track={track}
|
||||||
|
trackIndex={index}
|
||||||
|
musicTracks={musicTracks.data}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{createPortal(
|
||||||
<div className="item-info-sidebar">
|
<div className="item-info-sidebar">
|
||||||
<div className="item-info-sidebar-image-container">
|
<div className="item-info-sidebar-image-container">
|
||||||
{item.data.ImageTags?.Primary ? (
|
{item.data.ImageTags?.Primary ? (
|
||||||
<img
|
<img
|
||||||
className="item-info-sidebar-image"
|
className="item-info-sidebar-image"
|
||||||
alt={item.data.Name ?? "Album"}
|
alt={item.data.Name ?? "Album"}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
src={
|
||||||
tag: item.data.ImageTags.Primary,
|
api &&
|
||||||
quality: 90,
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
})}
|
item.data.Id ?? "",
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
|
tag: item.data.ImageTags.Primary,
|
||||||
|
quality: 90,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="item-info-sidebar-icon">
|
<div className="item-info-sidebar-icon">
|
||||||
@@ -325,40 +279,25 @@ function MusicAlbumTitlePage() {
|
|||||||
style={{ gap: "1em", flexWrap: "wrap" }}
|
style={{ gap: "1em", flexWrap: "wrap" }}
|
||||||
>
|
>
|
||||||
{item.data.GenreItems?.map((genre) => (
|
{item.data.GenreItems?.map((genre) => (
|
||||||
<TagChip label={genre.Name} key={genre.Id} />
|
<TagChip label={genre.Name ?? "genre"} key={genre.Id} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-column item-info-sidebar-artist-container">
|
<div className="item-info-sidebar-overview">
|
||||||
{item.data.ArtistItems?.map((artist) => (
|
<ShowMoreText
|
||||||
<Link
|
content={item.data.Overview ?? ""}
|
||||||
to="/artist/$id"
|
collapsedLines={4}
|
||||||
params={{ id: artist.Id }}
|
/>
|
||||||
className="item-info-sidebar-artist"
|
|
||||||
key={artist.Id}
|
|
||||||
>
|
|
||||||
<div className="item-info-sidebar-artist-image-container">
|
|
||||||
<img
|
|
||||||
className="item-info-sidebar-artist-image"
|
|
||||||
alt={artist.Name ?? "Artist"}
|
|
||||||
src={api.getItemImageUrl(artist.Id, "Primary", {
|
|
||||||
quality: 90,
|
|
||||||
})}
|
|
||||||
/>
|
|
||||||
<span className="material-symbols-rounded">artist</span>
|
|
||||||
</div>
|
|
||||||
<Typography>{artist.Name}</Typography>
|
|
||||||
</Link>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>,
|
||||||
</div>
|
document.body,
|
||||||
{similarItems.data.TotalRecordCount > 0 && (
|
)}
|
||||||
|
{(similarItems.data?.TotalRecordCount ?? 0) > 0 && (
|
||||||
<CardScroller
|
<CardScroller
|
||||||
title="You might also like"
|
title="You might also like"
|
||||||
displayCards={7}
|
displayCards={5}
|
||||||
disableDecoration
|
disableDecoration
|
||||||
>
|
>
|
||||||
{similarItems.data.Items.map((similar) => {
|
{similarItems.data?.Items?.map((similar) => {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
key={similar.Id}
|
key={similar.Id}
|
||||||
@@ -390,13 +329,7 @@ function MusicAlbumTitlePage() {
|
|||||||
: "portrait"
|
: "portrait"
|
||||||
}
|
}
|
||||||
queryKey={["item", id, "similarItem"]}
|
queryKey={["item", id, "similarItem"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
|
||||||
!!similar.ImageBlurHashes?.Primary &&
|
|
||||||
similar.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(similar.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -1,131 +1,17 @@
|
|||||||
$border-radius: 20px;
|
$border-radius: 20px;
|
||||||
.item-album {
|
.item-album {
|
||||||
|
width: 70vw;
|
||||||
|
padding-right: 2.2em;
|
||||||
.item-info {
|
.item-info {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
&-container {
|
gap: 1.2em;
|
||||||
|
&-container {
|
||||||
grid-template-columns: 1fr 25%;
|
grid-template-columns: 1fr 25%;
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 3em;
|
gap: 3em;
|
||||||
}
|
}
|
||||||
gap: 1.2em;
|
|
||||||
&-sidebar {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 1em;
|
|
||||||
position: sticky;
|
|
||||||
max-height: 100vh;
|
|
||||||
top: 0;
|
|
||||||
&-image {
|
|
||||||
width: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
border-radius: $border-radius-default;
|
|
||||||
}
|
|
||||||
&-artist {
|
|
||||||
display: flex;
|
|
||||||
gap: 1em;
|
|
||||||
align-items: center;
|
|
||||||
padding: 1em 0;
|
|
||||||
color: rgb(255 255 255 / 0.7);
|
|
||||||
transition: $transition-time-default;
|
|
||||||
cursor: pointer;
|
|
||||||
text-decoration: none;
|
|
||||||
&:hover {
|
|
||||||
color: rgb(255 255 255)
|
|
||||||
}
|
|
||||||
&-image {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
z-index: 1;
|
|
||||||
position: relative;
|
|
||||||
&-container {
|
|
||||||
width: 3em;
|
|
||||||
aspect-ratio: 1;
|
|
||||||
border-radius: 100%;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
.material-symbols-rounded {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background: rgb(255 255 255 / 0.1);
|
|
||||||
z-index: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&-container {
|
|
||||||
// max-height: 20em;/
|
|
||||||
overflow-y: auto;
|
|
||||||
overflow-x: hidden;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&-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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&-album-info {
|
&-album-info {
|
||||||
gap: 1.2em;
|
gap: 1.2em;
|
||||||
}
|
}
|
||||||
@@ -133,8 +19,83 @@ $border-radius: 20px;
|
|||||||
display: flex;
|
display: flex;
|
||||||
gap: 1em;
|
gap: 1em;
|
||||||
}
|
}
|
||||||
|
&-disc-header{
|
||||||
|
padding: 1em 2em;
|
||||||
|
background: hsla(0, 0, 100%, 10%);
|
||||||
|
border-radius: 100px;
|
||||||
|
gap: 1em;
|
||||||
|
margin-top: 1em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.item-info-sidebar {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1em;
|
||||||
|
position: fixed;
|
||||||
|
// max-height: 100vh;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 30vw;
|
||||||
|
padding: 4.4em;
|
||||||
|
padding-left: 2.2em;
|
||||||
|
&-image {
|
||||||
|
width: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: $border-radius-default;
|
||||||
|
}
|
||||||
|
&-artist {
|
||||||
|
display: flex;
|
||||||
|
gap: 1em;
|
||||||
|
align-items: center;
|
||||||
|
padding: 1em 0;
|
||||||
|
color: rgb(255 255 255 / 0.7);
|
||||||
|
transition: $transition-time-default;
|
||||||
|
cursor: pointer;
|
||||||
|
text-decoration: none;
|
||||||
|
&:hover {
|
||||||
|
color: rgb(255 255 255)
|
||||||
|
}
|
||||||
|
&-image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
z-index: 1;
|
||||||
|
position: relative;
|
||||||
|
&-container {
|
||||||
|
width: 3em;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
border-radius: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
.material-symbols-rounded {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: rgb(255 255 255 / 0.1);
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&-container {
|
||||||
|
// max-height: 20em;/
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&-overview {
|
||||||
|
overflow-y: auto;
|
||||||
|
max-height: 28vh;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.item-detail-album {
|
.item-detail-album {
|
||||||
&-track {
|
&-track {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
import PropTypes from "prop-types";
|
import React, {
|
||||||
import React, { useState, useEffect, useLayoutEffect, useRef } from "react";
|
useState,
|
||||||
|
useEffect,
|
||||||
|
useLayoutEffect,
|
||||||
|
useRef,
|
||||||
|
type ReactNode,
|
||||||
|
} from "react";
|
||||||
|
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
@@ -17,7 +22,6 @@ import {
|
|||||||
SortOrder,
|
SortOrder,
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||||
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";
|
||||||
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
@@ -26,19 +30,27 @@ import LikeButton from "@/components/buttons/likeButton";
|
|||||||
import { Card } from "@/components/card/card";
|
import { Card } from "@/components/card/card";
|
||||||
import { Blurhash } from "react-blurhash";
|
import { Blurhash } from "react-blurhash";
|
||||||
|
|
||||||
import meshBg from "@/assets/herobg.png";
|
|
||||||
import { ArtistAlbum } from "@/components/layouts/artist/artistAlbum";
|
import { ArtistAlbum } from "@/components/layouts/artist/artistAlbum";
|
||||||
import MusicTrack from "@/components/musicTrack";
|
import MusicTrack from "@/components/musicTrack";
|
||||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||||
import ShowMoreText from "@/components/showMoreText";
|
import ShowMoreText from "@/components/showMoreText";
|
||||||
import { setBackdrop, useBackdropStore } from "@/utils/store/backdrop";
|
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||||
import "./artist.scss";
|
import "./artist.scss";
|
||||||
|
|
||||||
import IconLink from "@/components/iconLink";
|
import IconLink from "@/components/iconLink";
|
||||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import { createFileRoute } from "@tanstack/react-router";
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
|
|
||||||
function TabPanel(props) {
|
|
||||||
|
type TabPanelProp = {
|
||||||
|
children: ReactNode;
|
||||||
|
index: number;
|
||||||
|
value: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
function TabPanel(props: TabPanelProp) {
|
||||||
const { children, value, index, ...other } = props;
|
const { children, value, index, ...other } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -55,12 +67,6 @@ function TabPanel(props) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
TabPanel.propTypes = {
|
|
||||||
children: PropTypes.node,
|
|
||||||
index: PropTypes.number.isRequired,
|
|
||||||
value: PropTypes.number.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/artist/$id")({
|
export const Route = createFileRoute("/_api/artist/$id")({
|
||||||
component: ArtistTitlePage,
|
component: ArtistTitlePage,
|
||||||
});
|
});
|
||||||
@@ -69,26 +75,19 @@ function ArtistTitlePage() {
|
|||||||
const { id } = Route.useParams();
|
const { id } = Route.useParams();
|
||||||
const api = Route.useRouteContext().api;
|
const api = Route.useRouteContext().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 item = useQuery({
|
const item = useQuery({
|
||||||
queryKey: ["item", id],
|
queryKey: ["item", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: id,
|
itemId: id,
|
||||||
fields: [ItemFields.Crew],
|
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
});
|
});
|
||||||
@@ -96,52 +95,56 @@ function ArtistTitlePage() {
|
|||||||
const artistDiscography = useQuery({
|
const artistDiscography = useQuery({
|
||||||
queryKey: ["item", id, "artist", "discography"],
|
queryKey: ["item", id, "artist", "discography"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
albumArtistIds: [item.data.Id],
|
albumArtistIds: [item.data?.Id ?? ""],
|
||||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||||
sortOrder: [SortOrder.Descending],
|
sortOrder: [SortOrder.Descending],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
includeItemTypes: [BaseItemKind.MusicAlbum],
|
includeItemTypes: [BaseItemKind.MusicAlbum],
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
fields: [ItemFields.Overview],
|
fields: [ItemFields.Overview],
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicArtist,
|
enabled: item.isSuccess && item.data?.Type === BaseItemKind.MusicArtist,
|
||||||
});
|
});
|
||||||
|
|
||||||
const artistSongs = useQuery({
|
const artistSongs = useQuery({
|
||||||
queryKey: ["item", id, "artist", "songs"],
|
queryKey: ["item", id, "artist", "songs"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
|
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
artistIds: [item.data.Id],
|
artistIds: [item.data?.Id ?? ""],
|
||||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||||
sortOrder: [SortOrder.Ascending],
|
sortOrder: [SortOrder.Ascending],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
includeItemTypes: [BaseItemKind.Audio],
|
includeItemTypes: [BaseItemKind.Audio],
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
fields: [ItemFields.Overview],
|
fields: [ItemFields.Overview],
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicArtist,
|
enabled: item.isSuccess && item.data?.Type === BaseItemKind.MusicArtist,
|
||||||
});
|
});
|
||||||
|
|
||||||
const artistAppearances = useQuery({
|
const artistAppearances = useQuery({
|
||||||
queryKey: ["item", id, "artist", "appearences"],
|
queryKey: ["item", id, "artist", "appearences"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
contributingArtistIds: [item.data.Id],
|
contributingArtistIds: [item.data?.Id ?? ""],
|
||||||
excludeItemIds: [item.data.Id],
|
excludeItemIds: [item.data?.Id ?? ""],
|
||||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||||
sortOrder: [SortOrder.Descending],
|
sortOrder: [SortOrder.Descending],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
includeItemTypes: [BaseItemKind.MusicAlbum],
|
includeItemTypes: [BaseItemKind.MusicAlbum],
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicArtist,
|
enabled: item.isSuccess && item.data?.Type === BaseItemKind.MusicArtist,
|
||||||
});
|
});
|
||||||
|
|
||||||
const artistTabs = [
|
const artistTabs = [
|
||||||
@@ -155,7 +158,10 @@ function ArtistTitlePage() {
|
|||||||
if (
|
if (
|
||||||
artistDiscography.isSuccess &&
|
artistDiscography.isSuccess &&
|
||||||
artistSongs.isSuccess &&
|
artistSongs.isSuccess &&
|
||||||
artistAppearances.isSuccess
|
artistAppearances.isSuccess &&
|
||||||
|
artistDiscography.data &&
|
||||||
|
artistSongs.data &&
|
||||||
|
artistAppearances.data
|
||||||
) {
|
) {
|
||||||
if (artistDiscography.data.TotalRecordCount !== 0) {
|
if (artistDiscography.data.TotalRecordCount !== 0) {
|
||||||
setActiveArtistTab(0);
|
setActiveArtistTab(0);
|
||||||
@@ -173,10 +179,11 @@ function ArtistTitlePage() {
|
|||||||
|
|
||||||
const [animationDirection, setAnimationDirection] = useState("forward");
|
const [animationDirection, setAnimationDirection] = useState("forward");
|
||||||
|
|
||||||
|
const { setBackdrop } = useBackdropStore();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (item.isSuccess) {
|
if (item.isSuccess && item.data) {
|
||||||
setBackdrop(
|
setBackdrop(
|
||||||
`${api.basePath}/Items/${item.data.Id}/Images/Backdrop`,
|
`${api?.basePath}/Items/${item.data.Id}/Images/Backdrop`,
|
||||||
item.data.Id,
|
item.data.Id,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -204,7 +211,7 @@ function ArtistTitlePage() {
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (item.isSuccess) {
|
if (item.isSuccess && item.data) {
|
||||||
return (
|
return (
|
||||||
<motion.div
|
<motion.div
|
||||||
key={id}
|
key={id}
|
||||||
@@ -224,13 +231,20 @@ function ArtistTitlePage() {
|
|||||||
<div className="item-hero flex flex-row">
|
<div className="item-hero flex flex-row">
|
||||||
<div className="item-hero-backdrop-container">
|
<div className="item-hero-backdrop-container">
|
||||||
<motion.img
|
<motion.img
|
||||||
alt={item.data.Name}
|
alt={item.data?.Name ?? ""}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
|
src={
|
||||||
tag: item.data.BackdropImageTags[0],
|
api &&
|
||||||
})}
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data?.Id ?? "",
|
||||||
|
"Backdrop",
|
||||||
|
{
|
||||||
|
tag: item.data.BackdropImageTags?.[0],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
className="item-hero-backdrop"
|
className="item-hero-backdrop"
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
y: parallax,
|
y: parallax,
|
||||||
@@ -243,45 +257,59 @@ function ArtistTitlePage() {
|
|||||||
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
|
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{Object.keys(item.data.ImageTags).includes("Primary") ? (
|
{item.data.ImageTags?.Primary ? (
|
||||||
<>
|
<div>
|
||||||
<Blurhash
|
<Blurhash
|
||||||
hash={
|
hash={
|
||||||
item.data.ImageBlurHashes.Primary[
|
item.data.ImageBlurHashes?.Primary?.[
|
||||||
item.data.ImageTags.Primary
|
item.data.ImageTags.Primary
|
||||||
]
|
] ?? ""
|
||||||
}
|
}
|
||||||
className="item-hero-image-blurhash"
|
className="item-hero-image-blurhash"
|
||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
src={
|
||||||
quality: 90,
|
api &&
|
||||||
tag: item.data.ImageTags.Primary,
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
})}
|
item.data.Id ?? "",
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
|
quality: 90,
|
||||||
|
tag: item.data.ImageTags.Primary,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
className="item-hero-image"
|
className="item-hero-image"
|
||||||
/>
|
/>
|
||||||
</>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="item-hero-image-icon">
|
<div className="item-hero-image-icon">
|
||||||
{getTypeIcon(item.data.Type)}
|
{getTypeIcon(item.data.Type ?? "MusicArtist")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="item-hero-detail flex flex-column">
|
<div className="item-hero-detail flex flex-column">
|
||||||
{Object.keys(item.data.ImageTags).includes("Logo") ? (
|
{item.data.ImageTags?.Logo ? (
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Logo", {
|
src={
|
||||||
quality: 90,
|
api &&
|
||||||
fillWidth: 592,
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
fillHeight: 592,
|
item.data.Id ?? "",
|
||||||
})}
|
"Logo",
|
||||||
|
{
|
||||||
|
quality: 90,
|
||||||
|
fillWidth: 592,
|
||||||
|
fillHeight: 592,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
className="item-hero-logo"
|
className="item-hero-logo"
|
||||||
/>
|
/>
|
||||||
@@ -295,8 +323,8 @@ function ArtistTitlePage() {
|
|||||||
itemName={item.data.Name}
|
itemName={item.data.Name}
|
||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isFavorite={item.data.UserData.IsFavorite}
|
isFavorite={item.data.UserData?.IsFavorite}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -314,8 +342,12 @@ function ArtistTitlePage() {
|
|||||||
marginTop: "1em",
|
marginTop: "1em",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{item.data.ExternalUrls.map((url) => (
|
{item.data.ExternalUrls?.map((url) => (
|
||||||
<IconLink url={url.Url} name={url.Name} />
|
<IconLink
|
||||||
|
url={url.Url ?? ""}
|
||||||
|
name={url.Name ?? ""}
|
||||||
|
key={url.Url}
|
||||||
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -325,22 +357,22 @@ function ArtistTitlePage() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{item.data.PremiereDate && (
|
{item.data.PremiereDate && (
|
||||||
<>
|
<div>
|
||||||
<Typography variant="h5">Born</Typography>
|
<Typography variant="h5">Born</Typography>
|
||||||
<Typography sx={{ opacity: 0.8 }}>
|
<Typography sx={{ opacity: 0.8 }}>
|
||||||
{new Date(item.data.PremiereDate).toDateString()}
|
{new Date(item.data.PremiereDate).toDateString()}
|
||||||
</Typography>
|
</Typography>
|
||||||
</>
|
</div>
|
||||||
)}
|
)}
|
||||||
{item.data.EndDate && (
|
{item.data.EndDate && (
|
||||||
<>
|
<div>
|
||||||
<Typography variant="h5" mt={2}>
|
<Typography variant="h5" mt={2}>
|
||||||
Death
|
Death
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography sx={{ opacity: 0.8 }}>
|
<Typography sx={{ opacity: 0.8 }}>
|
||||||
{new Date(item.data.EndDate).toDateString()}
|
{new Date(item.data.EndDate).toDateString()}
|
||||||
</Typography>
|
</Typography>
|
||||||
</>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -349,7 +381,7 @@ function ArtistTitlePage() {
|
|||||||
<Tabs
|
<Tabs
|
||||||
variant="scrollable"
|
variant="scrollable"
|
||||||
value={activeArtistTab}
|
value={activeArtistTab}
|
||||||
onChange={(e, newVal) => {
|
onChange={(_, newVal) => {
|
||||||
if (newVal > activeArtistTab) {
|
if (newVal > activeArtistTab) {
|
||||||
setAnimationDirection("forward");
|
setAnimationDirection("forward");
|
||||||
} else if (newVal < activeArtistTab) {
|
} else if (newVal < activeArtistTab) {
|
||||||
@@ -358,7 +390,7 @@ function ArtistTitlePage() {
|
|||||||
setActiveArtistTab(newVal);
|
setActiveArtistTab(newVal);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{artistTabs.map((tab, index) => {
|
{artistTabs.map((tab) => {
|
||||||
return (
|
return (
|
||||||
<Tab
|
<Tab
|
||||||
key={tab.title}
|
key={tab.title}
|
||||||
@@ -390,12 +422,12 @@ function ArtistTitlePage() {
|
|||||||
ease: "anticipate",
|
ease: "anticipate",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{artistDiscography.isSuccess &&
|
{user &&
|
||||||
artistDiscography.data.Items.map((tabitem) => {
|
artistDiscography.data?.Items?.map((tabitem) => {
|
||||||
return (
|
return (
|
||||||
<ArtistAlbum
|
<ArtistAlbum
|
||||||
key={tabitem.Id}
|
key={tabitem.Id}
|
||||||
user={user.data}
|
user={user}
|
||||||
album={tabitem}
|
album={tabitem}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@@ -422,13 +454,13 @@ function ArtistTitlePage() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{artistSongs.isSuccess &&
|
{artistSongs.isSuccess &&
|
||||||
artistSongs.data.Items.map((tabitem) => {
|
artistSongs.data?.Items?.map((tabitem) => {
|
||||||
return (
|
return (
|
||||||
<MusicTrack
|
<MusicTrack
|
||||||
item={tabitem}
|
item={tabitem}
|
||||||
key={tabitem.Id}
|
key={tabitem.Id}
|
||||||
queryKey={["item", id, "artist", "songs"]}
|
queryKey={["item", id, "artist", "songs"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@@ -455,7 +487,7 @@ function ArtistTitlePage() {
|
|||||||
className="grid"
|
className="grid"
|
||||||
>
|
>
|
||||||
{artistAppearances.isSuccess &&
|
{artistAppearances.isSuccess &&
|
||||||
artistAppearances.data.Items.map((tabitem) => {
|
artistAppearances.data?.Items?.map((tabitem) => {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
key={tabitem.Id}
|
key={tabitem.Id}
|
||||||
@@ -465,13 +497,7 @@ function ArtistTitlePage() {
|
|||||||
cardCaption={tabitem.AlbumArtist}
|
cardCaption={tabitem.AlbumArtist}
|
||||||
cardType={"square"}
|
cardType={"square"}
|
||||||
queryKey={["item", id, "artist", "appearences"]}
|
queryKey={["item", id, "artist", "appearences"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
|
||||||
!!tabitem.ImageBlurHashes?.Primary &&
|
|
||||||
tabitem.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(tabitem.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import PropTypes from "prop-types";
|
import React, { useLayoutEffect, useRef } from "react";
|
||||||
import React, { useEffect, useRef } from "react";
|
|
||||||
|
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import Chip from "@mui/material/Chip";
|
import Chip from "@mui/material/Chip";
|
||||||
@@ -17,17 +16,16 @@ import {
|
|||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||||
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";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
import { Card } from "@/components/card/card";
|
import { Card } from "@/components/card/card";
|
||||||
import { CardScroller } from "@/components/cardScroller/cardScroller";
|
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||||
|
|
||||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||||
import ShowMoreText from "@/components/showMoreText";
|
import ShowMoreText from "@/components/showMoreText";
|
||||||
import { endsAt, getRuntime } from "@/utils/date/time";
|
import { endsAt, getRuntime } from "@/utils/date/time";
|
||||||
import { setBackdrop, useBackdropStore } from "@/utils/store/backdrop";
|
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||||
import { Blurhash } from "react-blurhash";
|
import { Blurhash } from "react-blurhash";
|
||||||
|
|
||||||
import LikeButton from "@/components/buttons/likeButton";
|
import LikeButton from "@/components/buttons/likeButton";
|
||||||
@@ -39,31 +37,11 @@ import "./boxset.scss";
|
|||||||
|
|
||||||
import IconLink from "@/components/iconLink";
|
import IconLink from "@/components/iconLink";
|
||||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
import { green, red, yellow } from "@mui/material/colors";
|
||||||
import { createFileRoute } from "@tanstack/react-router";
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
|
|
||||||
function TabPanel(props) {
|
|
||||||
const { children, value, index, ...other } = props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
role="tabpanel"
|
|
||||||
hidden={value !== index}
|
|
||||||
id={`full-width-tabpanel-${index}`}
|
|
||||||
aria-labelledby={`full-width-tab-${index}`}
|
|
||||||
{...other}
|
|
||||||
style={{ marginTop: "1em" }}
|
|
||||||
>
|
|
||||||
{value === index && <Box>{children}</Box>}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
TabPanel.propTypes = {
|
|
||||||
children: PropTypes.node,
|
|
||||||
index: PropTypes.number.isRequired,
|
|
||||||
value: PropTypes.number.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/boxset/$id")({
|
export const Route = createFileRoute("/_api/boxset/$id")({
|
||||||
component: BoxSetTitlePage,
|
component: BoxSetTitlePage,
|
||||||
});
|
});
|
||||||
@@ -72,27 +50,19 @@ function BoxSetTitlePage() {
|
|||||||
const { id } = Route.useParams();
|
const { id } = Route.useParams();
|
||||||
const api = Route.useRouteContext().api;
|
const api = Route.useRouteContext().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",
|
|
||||||
enabled: Boolean(api),
|
|
||||||
});
|
|
||||||
|
|
||||||
const item = useQuery({
|
const item = useQuery({
|
||||||
queryKey: ["item", id],
|
queryKey: ["item", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: id,
|
itemId: id,
|
||||||
fields: [ItemFields.Crew],
|
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
});
|
});
|
||||||
@@ -100,9 +70,10 @@ function BoxSetTitlePage() {
|
|||||||
const collectionItems = useQuery({
|
const collectionItems = useQuery({
|
||||||
queryKey: ["item", id, "collection"],
|
queryKey: ["item", id, "collection"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
parentId: item.data.Id,
|
parentId: item.data?.Id,
|
||||||
fields: [ItemFields.SeasonUserData, ItemFields.Overview],
|
fields: [ItemFields.SeasonUserData, ItemFields.Overview],
|
||||||
excludeLocationTypes: [LocationType.Virtual],
|
excludeLocationTypes: [LocationType.Virtual],
|
||||||
});
|
});
|
||||||
@@ -114,11 +85,12 @@ function BoxSetTitlePage() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const similarItems = useQuery({
|
const similarItems = useQuery({
|
||||||
queryKey: ["item", id, "similarItem"],
|
queryKey: ["item", "similarItem", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api || !item.data?.Id) return null;
|
||||||
const result = await getLibraryApi(api).getSimilarItems({
|
const result = await getLibraryApi(api).getSimilarItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: item.data.Id,
|
itemId: item.data?.Id,
|
||||||
limit: 16,
|
limit: 16,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
@@ -128,13 +100,19 @@ function BoxSetTitlePage() {
|
|||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||||
if (item.isSuccess) {
|
|
||||||
if (item.data.BackdropImageTags?.length > 0) {
|
useLayoutEffect(() => {
|
||||||
|
if (api && item.isSuccess) {
|
||||||
|
if (item.data?.BackdropImageTags?.length) {
|
||||||
setBackdrop(
|
setBackdrop(
|
||||||
api?.getItemImageUrl(item.data.Id, "Backdrop", {
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
tag: item.data.BackdropImageTags[0],
|
item.data.Id ?? "",
|
||||||
}),
|
"Backdrop",
|
||||||
|
{
|
||||||
|
tag: item.data.BackdropImageTags[0],
|
||||||
|
},
|
||||||
|
),
|
||||||
item.data.Id,
|
item.data.Id,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -147,6 +125,7 @@ function BoxSetTitlePage() {
|
|||||||
const { scrollYProgress } = useScroll({
|
const { scrollYProgress } = useScroll({
|
||||||
target: pageRef,
|
target: pageRef,
|
||||||
offset: ["start start", "60vh start"],
|
offset: ["start start", "60vh start"],
|
||||||
|
layoutEffect: false,
|
||||||
});
|
});
|
||||||
const parallax = useParallax(scrollYProgress, 50);
|
const parallax = useParallax(scrollYProgress, 50);
|
||||||
|
|
||||||
@@ -165,7 +144,7 @@ function BoxSetTitlePage() {
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (item.isSuccess && similarItems.isSuccess) {
|
if (item.isSuccess && item.data && similarItems.isSuccess) {
|
||||||
return (
|
return (
|
||||||
<motion.div
|
<motion.div
|
||||||
key={id}
|
key={id}
|
||||||
@@ -186,13 +165,20 @@ function BoxSetTitlePage() {
|
|||||||
<div className="item-hero-backdrop-container">
|
<div className="item-hero-backdrop-container">
|
||||||
{item.data.BackdropImageTags?.length ? (
|
{item.data.BackdropImageTags?.length ? (
|
||||||
<motion.img
|
<motion.img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
|
src={
|
||||||
tag: item.data.BackdropImageTags[0],
|
api &&
|
||||||
})}
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data.Id ?? "",
|
||||||
|
"Backdrop",
|
||||||
|
{
|
||||||
|
tag: item.data.BackdropImageTags[0],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
className="item-hero-backdrop"
|
className="item-hero-backdrop"
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
y: parallax,
|
y: parallax,
|
||||||
@@ -200,11 +186,11 @@ function BoxSetTitlePage() {
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<motion.img
|
<motion.img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={heroBg}
|
src={heroBg}
|
||||||
className="item-hero-backdrop"
|
className="item-hero-backdrop"
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
y: parallax,
|
y: parallax,
|
||||||
@@ -218,45 +204,60 @@ function BoxSetTitlePage() {
|
|||||||
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
|
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{Object.keys(item.data.ImageTags).includes("Primary") ? (
|
{item.data.ImageTags?.Primary &&
|
||||||
<>
|
item.data.ImageBlurHashes?.Primary ? (
|
||||||
|
<div>
|
||||||
<Blurhash
|
<Blurhash
|
||||||
hash={
|
hash={
|
||||||
item.data.ImageBlurHashes.Primary[
|
item.data.ImageBlurHashes?.Primary?.[
|
||||||
item.data.ImageTags.Primary
|
item.data.ImageTags.Primary
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
className="item-hero-image-blurhash"
|
className="item-hero-image-blurhash"
|
||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
src={
|
||||||
quality: 90,
|
api &&
|
||||||
tag: item.data.ImageTags.Primary,
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
})}
|
item.data.Id ?? "",
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
|
quality: 90,
|
||||||
|
tag: item.data.ImageTags.Primary,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
className="item-hero-image"
|
className="item-hero-image"
|
||||||
/>
|
/>
|
||||||
</>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="item-hero-image-icon">
|
<div className="item-hero-image-icon">
|
||||||
{getTypeIcon(item.data.Type)}
|
{getTypeIcon(item.data.Type ?? "BoxSet")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="item-hero-detail">
|
<div className="item-hero-detail">
|
||||||
{Object.keys(item.data.ImageTags).includes("Logo") ? (
|
{item.data.ImageTags?.Logo ? (
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Logo", {
|
src={
|
||||||
quality: 90,
|
api &&
|
||||||
fillWidth: 592,
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
fillHeight: 592,
|
item.data.Id ?? "",
|
||||||
})}
|
"Logo",
|
||||||
|
{
|
||||||
|
quality: 90,
|
||||||
|
fillWidth: 592,
|
||||||
|
fillHeight: 592,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
className="item-hero-logo"
|
className="item-hero-logo"
|
||||||
/>
|
/>
|
||||||
@@ -351,7 +352,7 @@ function BoxSetTitlePage() {
|
|||||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||||
{endsAt(
|
{endsAt(
|
||||||
item.data.RunTimeTicks -
|
item.data.RunTimeTicks -
|
||||||
item.data.UserData.PlaybackPositionTicks,
|
(item.data.UserData?.PlaybackPositionTicks ?? 0),
|
||||||
)}
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
@@ -364,13 +365,11 @@ function BoxSetTitlePage() {
|
|||||||
<div className="flex flex-row fullWidth">
|
<div className="flex flex-row fullWidth">
|
||||||
<PlayButton
|
<PlayButton
|
||||||
item={item.data}
|
item={item.data}
|
||||||
itemId={item.data.Id}
|
itemType={item.data.Type ?? "BoxSet"}
|
||||||
itemType={item.data.Type}
|
|
||||||
itemUserData={item.data.UserData}
|
|
||||||
currentVideoTrack={0}
|
currentVideoTrack={0}
|
||||||
currentAudioTrack={0}
|
currentAudioTrack={0}
|
||||||
currentSubTrack={0}
|
currentSubTrack={0}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
buttonProps={{
|
buttonProps={{
|
||||||
fullWidth: true,
|
fullWidth: true,
|
||||||
}}
|
}}
|
||||||
@@ -381,15 +380,15 @@ function BoxSetTitlePage() {
|
|||||||
itemName={item.data.Name}
|
itemName={item.data.Name}
|
||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isFavorite={item.data.UserData.IsFavorite}
|
isFavorite={item.data.UserData?.IsFavorite}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
<MarkPlayedButton
|
<MarkPlayedButton
|
||||||
itemName={item.data.Name}
|
itemName={item.data.Name}
|
||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isPlayed={item.data.UserData.Played}
|
isPlayed={item.data.UserData?.Played}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -414,15 +413,19 @@ function BoxSetTitlePage() {
|
|||||||
marginTop: "1em",
|
marginTop: "1em",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{item.data.ExternalUrls.map((url) => (
|
{item.data.ExternalUrls?.map((url) => (
|
||||||
<IconLink url={url.Url} name={url.Name} />
|
<IconLink
|
||||||
|
url={url.Url ?? ""}
|
||||||
|
name={url.Name ?? ""}
|
||||||
|
key={url.Url}
|
||||||
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{collectionItems.data.TotalRecordCount > 0 && (
|
{(collectionItems.data?.TotalRecordCount ?? 0) > 0 && (
|
||||||
<CardScroller title="" displayCards={7} disableDecoration>
|
<CardScroller title="" displayCards={7} disableDecoration>
|
||||||
{collectionItems.data.Items.map((similar, index) => {
|
{collectionItems.data?.Items?.map((similar) => {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
key={similar.Id}
|
key={similar.Id}
|
||||||
@@ -436,26 +439,20 @@ function BoxSetTitlePage() {
|
|||||||
imageType={"Primary"}
|
imageType={"Primary"}
|
||||||
cardCaption={similar.ProductionYear}
|
cardCaption={similar.ProductionYear}
|
||||||
cardType={"portrait"}
|
cardType={"portrait"}
|
||||||
queryKey={["item", id, "collection"]}
|
queryKey={["item", id]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
|
||||||
!!similar.ImageBlurHashes?.Primary &&
|
|
||||||
similar.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(similar.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
)}
|
)}
|
||||||
{similarItems.data.TotalRecordCount > 0 && (
|
{similarItems.data?.TotalRecordCount && (
|
||||||
<CardScroller
|
<CardScroller
|
||||||
title="You might also like"
|
title="You might also like"
|
||||||
displayCards={7}
|
displayCards={7}
|
||||||
disableDecoration
|
disableDecoration
|
||||||
>
|
>
|
||||||
{similarItems.data.Items.map((similar, index) => {
|
{similarItems.data?.Items?.map((similar) => {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
key={similar.Id}
|
key={similar.Id}
|
||||||
@@ -487,13 +484,7 @@ function BoxSetTitlePage() {
|
|||||||
: "portrait"
|
: "portrait"
|
||||||
}
|
}
|
||||||
queryKey={["item", id, "similarItem"]}
|
queryKey={["item", id, "similarItem"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
|
||||||
!!similar.ImageBlurHashes?.Primary &&
|
|
||||||
similar.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(similar.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
import PropTypes from "prop-types";
|
import React, { useState, useRef, useMemo, useEffect } from "react";
|
||||||
import React, { useState, useLayoutEffect, useRef } from "react";
|
|
||||||
|
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import Chip from "@mui/material/Chip";
|
import Chip from "@mui/material/Chip";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
import Divider from "@mui/material/Divider";
|
|
||||||
import LinearProgress from "@mui/material/LinearProgress";
|
|
||||||
import MenuItem from "@mui/material/MenuItem";
|
import MenuItem from "@mui/material/MenuItem";
|
||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import TextField from "@mui/material/TextField";
|
import TextField from "@mui/material/TextField";
|
||||||
@@ -19,18 +16,13 @@ import { motion, useScroll } from "framer-motion";
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
BaseItemKind,
|
BaseItemKind,
|
||||||
ItemFields,
|
|
||||||
MediaStreamType,
|
MediaStreamType,
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
|
||||||
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";
|
||||||
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
import heroBg from "@/assets/herobg.png";
|
import heroBg from "@/assets/herobg.png";
|
||||||
import { Card } from "@/components/card/card";
|
|
||||||
import { CardScroller } from "@/components/cardScroller/cardScroller";
|
|
||||||
|
|
||||||
import LikeButton from "@/components/buttons/likeButton";
|
import LikeButton from "@/components/buttons/likeButton";
|
||||||
import MarkPlayedButton from "@/components/buttons/markPlayedButton";
|
import MarkPlayedButton from "@/components/buttons/markPlayedButton";
|
||||||
@@ -38,7 +30,6 @@ import PlayButton from "@/components/buttons/playButton";
|
|||||||
import TrailerButton from "@/components/buttons/trailerButton";
|
import TrailerButton from "@/components/buttons/trailerButton";
|
||||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||||
import ShowMoreText from "@/components/showMoreText";
|
import ShowMoreText from "@/components/showMoreText";
|
||||||
import TextLink from "@/components/textLink";
|
|
||||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||||
import { endsAt, getRuntime } from "@/utils/date/time";
|
import { endsAt, getRuntime } from "@/utils/date/time";
|
||||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||||
@@ -63,32 +54,14 @@ import sdrIcon from "@/assets/icons/sdr.svg";
|
|||||||
|
|
||||||
import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
|
import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
|
||||||
|
|
||||||
|
import { Card } from "@/components/card/card";
|
||||||
|
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||||
import IconLink from "@/components/iconLink";
|
import IconLink from "@/components/iconLink";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||||
import { Link, createFileRoute } from "@tanstack/react-router";
|
import { Link, createFileRoute } from "@tanstack/react-router";
|
||||||
|
|
||||||
function TabPanel(props) {
|
|
||||||
const { children, value, index, ...other } = props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
role="tabpanel"
|
|
||||||
hidden={value !== index}
|
|
||||||
id={`full-width-tabpanel-${index}`}
|
|
||||||
aria-labelledby={`full-width-tab-${index}`}
|
|
||||||
{...other}
|
|
||||||
style={{ marginTop: "1em" }}
|
|
||||||
>
|
|
||||||
{value === index && <Box>{children}</Box>}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
TabPanel.propTypes = {
|
|
||||||
children: PropTypes.node,
|
|
||||||
index: PropTypes.number.isRequired,
|
|
||||||
value: PropTypes.number.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/episode/$id")({
|
export const Route = createFileRoute("/_api/episode/$id")({
|
||||||
component: EpisodeTitlePage,
|
component: EpisodeTitlePage,
|
||||||
});
|
});
|
||||||
@@ -97,27 +70,19 @@ function EpisodeTitlePage() {
|
|||||||
const { id } = Route.useParams();
|
const { id } = Route.useParams();
|
||||||
const api = Route.useRouteContext().api;
|
const api = Route.useRouteContext().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",
|
|
||||||
enabled: Boolean(api),
|
|
||||||
});
|
|
||||||
|
|
||||||
const item = useQuery({
|
const item = useQuery({
|
||||||
queryKey: ["item", id],
|
queryKey: ["item", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: id,
|
itemId: id,
|
||||||
fields: [ItemFields.Crew],
|
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
});
|
});
|
||||||
@@ -125,191 +90,174 @@ function EpisodeTitlePage() {
|
|||||||
const upcomingEpisodes = useQuery({
|
const upcomingEpisodes = useQuery({
|
||||||
queryKey: ["item", id, "episode", "upcomingEpisodes"],
|
queryKey: ["item", id, "episode", "upcomingEpisodes"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
parentId: item.data.ParentId,
|
parentId: item.data?.ParentId ?? "",
|
||||||
startIndex: item.data.IndexNumber,
|
startIndex: item.data?.IndexNumber ?? 0,
|
||||||
|
excludeLocationTypes: ["Virtual"],
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.Episode,
|
enabled: item.isSuccess && item.data?.Type === BaseItemKind.Episode,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
||||||
|
|
||||||
const [videoTracks, setVideoTracks] = useState([]);
|
const [selectedVideoTrack, setSelectedVideoTrack] = useState(0);
|
||||||
const [audioTracks, setAudioTracks] = useState([]);
|
const [selectedAudioTrack, setSelectedAudioTrack] = useState(0);
|
||||||
const [subtitleTracks, setSubtitleTracks] = useState([]);
|
const [selectedSubtitleTrack, setSelectedSubtitleTrack] = useState(0);
|
||||||
|
|
||||||
const filterMediaStreamVideo = (source) => {
|
const videoTracks = useMemo(() => {
|
||||||
if (source.Type === MediaStreamType.Video) {
|
const result = item.data?.MediaStreams?.filter((source) => {
|
||||||
return true;
|
if (source.Type === MediaStreamType.Video) {
|
||||||
}
|
return true;
|
||||||
return false;
|
}
|
||||||
};
|
return false;
|
||||||
const filterMediaStreamAudio = (source) => {
|
});
|
||||||
if (source.Type === MediaStreamType.Audio) {
|
setSelectedVideoTrack(result?.find((track) => track.IsDefault)?.Index ?? 0);
|
||||||
return true;
|
return result ?? [];
|
||||||
}
|
}, [item.data?.Id]);
|
||||||
return false;
|
const audioTracks = useMemo(() => {
|
||||||
};
|
const result = item.data?.MediaStreams?.filter((source) => {
|
||||||
const filterMediaStreamSubtitle = (source) => {
|
if (source.Type === MediaStreamType.Audio) {
|
||||||
if (source.Type === MediaStreamType.Subtitle) {
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
return false;
|
||||||
return false;
|
});
|
||||||
};
|
setSelectedAudioTrack(result?.find((track) => track.IsDefault)?.Index ?? 0);
|
||||||
|
return result ?? [];
|
||||||
|
}, [item.data?.Id]);
|
||||||
|
const subtitleTracks = useMemo(() => {
|
||||||
|
const result = item.data?.MediaStreams?.filter((source) => {
|
||||||
|
if (source.Type === MediaStreamType.Subtitle) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
setSelectedSubtitleTrack(
|
||||||
|
result?.find((track) => track.IsDefault)?.Index ?? -1,
|
||||||
|
);
|
||||||
|
return result ?? [];
|
||||||
|
}, [item.data?.Id]);
|
||||||
|
|
||||||
const [selectedVideoTrack, setSelectedVideoTrack] = useState(null);
|
const directors = useMemo(() => {
|
||||||
const [selectedAudioTrack, setSelectedAudioTrack] = useState(null);
|
return item.data?.People?.filter((itm) => itm.Type === "Director") ?? [];
|
||||||
const [selectedSubtitleTrack, setSelectedSubtitleTrack] = useState(null);
|
}, [item.data?.Id]);
|
||||||
|
const writers = useMemo(() => {
|
||||||
|
return item.data?.People?.filter((itm) => itm.Type === "Writer") ?? [];
|
||||||
|
}, [item.data?.Id]);
|
||||||
|
const actors = useMemo(() => {
|
||||||
|
return item.data?.People?.filter((itm) => itm.Type === "Actor") ?? [];
|
||||||
|
}, [item.data?.Id]);
|
||||||
|
const producers = useMemo(() => {
|
||||||
|
return item.data?.People?.filter((itm) => itm.Type === "Producer") ?? [];
|
||||||
|
}, [item.data?.Id]);
|
||||||
|
|
||||||
const [directors, setDirectors] = useState([]);
|
|
||||||
const [writers, setWriters] = useState([]);
|
|
||||||
const [actors, setActors] = useState([]);
|
|
||||||
const [producers, setProducers] = useState([]);
|
|
||||||
|
|
||||||
const [mediaQualityInfo, setMediaQualityInfo] = useState<MediaQualityInfo>();
|
const mediaQualityInfo = useMemo<MediaQualityInfo>(() => {
|
||||||
|
const checkAtmos = audioTracks.filter((audio) =>
|
||||||
|
audio.DisplayTitle?.toLocaleLowerCase().includes("atmos"),
|
||||||
|
);
|
||||||
|
const checkDolbyVision = videoTracks.filter(
|
||||||
|
(video) =>
|
||||||
|
video.DisplayTitle?.toLocaleLowerCase().includes("dv") ||
|
||||||
|
video.DisplayTitle?.toLocaleLowerCase().includes("dolby vision") ||
|
||||||
|
!!video.VideoDoViTitle ||
|
||||||
|
video.VideoRangeType === "DOVI",
|
||||||
|
);
|
||||||
|
const checkDD = audioTracks.filter(
|
||||||
|
(audio) =>
|
||||||
|
(audio.DisplayTitle?.toLocaleLowerCase().includes("dd") &&
|
||||||
|
!audio.DisplayTitle?.toLocaleLowerCase().includes("ddp")) ||
|
||||||
|
(audio.DisplayTitle?.toLocaleLowerCase().includes("dolby digital") &&
|
||||||
|
!audio.DisplayTitle?.toLocaleLowerCase().includes("dolby digital+")),
|
||||||
|
);
|
||||||
|
const checkDDP = audioTracks.filter(
|
||||||
|
(audio) =>
|
||||||
|
audio.DisplayTitle?.toLocaleLowerCase().includes("ddp") ||
|
||||||
|
audio.DisplayTitle?.toLocaleLowerCase().includes("dolby digital+"),
|
||||||
|
);
|
||||||
|
const checkDts = audioTracks.filter(
|
||||||
|
(audio) =>
|
||||||
|
audio.DisplayTitle?.toLocaleLowerCase().includes("dts") &&
|
||||||
|
!audio.DisplayTitle?.toLocaleLowerCase().includes("dts-hd ma") &&
|
||||||
|
!audio.DisplayTitle?.toLocaleLowerCase().includes("dts-hd.ma"),
|
||||||
|
);
|
||||||
|
const checkDtsHDMA = audioTracks.filter(
|
||||||
|
(audio) =>
|
||||||
|
audio.DisplayTitle?.toLocaleLowerCase().includes("dts-hd ma") ||
|
||||||
|
audio.DisplayTitle?.toLocaleLowerCase().includes("dts-hd.ma"),
|
||||||
|
);
|
||||||
|
const checkUHD = videoTracks.filter(
|
||||||
|
(video) =>
|
||||||
|
video.DisplayTitle?.toLocaleLowerCase().includes("4k") ||
|
||||||
|
video.DisplayTitle?.toLocaleLowerCase().includes("2160p") ||
|
||||||
|
video.DisplayTitle?.toLocaleLowerCase().includes("uhd"),
|
||||||
|
);
|
||||||
|
const checkHD = videoTracks.filter(
|
||||||
|
(video) =>
|
||||||
|
(video.DisplayTitle?.toLocaleLowerCase().includes("hd") &&
|
||||||
|
!video.DisplayTitle?.toLocaleLowerCase().includes("hdr")) ||
|
||||||
|
video.DisplayTitle?.toLocaleLowerCase().includes("1080p") ||
|
||||||
|
video.DisplayTitle?.toLocaleLowerCase().includes("fhd"),
|
||||||
|
);
|
||||||
|
const checkSD = videoTracks.filter(
|
||||||
|
(video) =>
|
||||||
|
(video.DisplayTitle?.toLocaleLowerCase().includes("sd") &&
|
||||||
|
!video.DisplayTitle?.toLocaleLowerCase().includes("sdr")) ||
|
||||||
|
video.DisplayTitle?.toLocaleLowerCase().includes("720p"),
|
||||||
|
);
|
||||||
|
const checkSDR = videoTracks.filter(
|
||||||
|
(video) => video.VideoRangeType === "SDR",
|
||||||
|
);
|
||||||
|
const checkHDR = videoTracks.filter(
|
||||||
|
(video) =>
|
||||||
|
video.VideoRange === "HDR" ||
|
||||||
|
video.DisplayTitle?.toLocaleLowerCase().includes("dv"),
|
||||||
|
);
|
||||||
|
const checkHDR10 = videoTracks.filter(
|
||||||
|
(video) =>
|
||||||
|
video.VideoRangeType === "HDR10" &&
|
||||||
|
!video.DisplayTitle?.toLocaleLowerCase().includes("hdr10+"),
|
||||||
|
);
|
||||||
|
const checkHDR10Plus = videoTracks.filter(
|
||||||
|
(video) =>
|
||||||
|
video.VideoRangeType === "HDR10Plus" ||
|
||||||
|
video.DisplayTitle?.toLocaleLowerCase().includes("hdr10+"),
|
||||||
|
);
|
||||||
|
const checkTrueHD = audioTracks.filter((audio) =>
|
||||||
|
audio.DisplayTitle?.toLocaleLowerCase().includes("truehd"),
|
||||||
|
);
|
||||||
|
const checkIMAX = videoTracks.filter((video) =>
|
||||||
|
video.DisplayTitle?.toLocaleLowerCase().includes("imax"),
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
isAtmos: checkAtmos.length > 0,
|
||||||
|
isDolbyVision: checkDolbyVision.length > 0,
|
||||||
|
isDts: checkDts.length > 0,
|
||||||
|
isDtsHDMA: checkDtsHDMA.length > 0,
|
||||||
|
isDD: checkDD.length > 0,
|
||||||
|
isDDP: checkDDP.length > 0,
|
||||||
|
isUHD: checkUHD.length > 0,
|
||||||
|
isHD: checkHD.length > 0,
|
||||||
|
isSD: checkSD.length > 0,
|
||||||
|
isSDR: checkSDR.length > 0,
|
||||||
|
isHDR: checkHDR.length > 0,
|
||||||
|
isHDR10: checkHDR10.length > 0,
|
||||||
|
isHDR10Plus: checkHDR10Plus.length > 0,
|
||||||
|
isTrueHD: checkTrueHD.length > 0,
|
||||||
|
isIMAX: checkIMAX.length > 0,
|
||||||
|
};
|
||||||
|
}, [item.data?.Id]);
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useEffect(() => {
|
||||||
if (item.isSuccess) {
|
if (api && item.isSuccess && item.data) {
|
||||||
setAppBackdrop(
|
setAppBackdrop(
|
||||||
item.data.Type === BaseItemKind.MusicAlbum ||
|
`${api.basePath}/Items/${item.data.ParentBackdropItemId}/Images/Backdrop`,
|
||||||
item.data.Type === BaseItemKind.Episode
|
|
||||||
? `${api.basePath}/Items/${item.data.ParentBackdropItemId}/Images/Backdrop`
|
|
||||||
: `${api.basePath}/Items/${item.data.Id}/Images/Backdrop`,
|
|
||||||
item.data.Id,
|
item.data.Id,
|
||||||
);
|
);
|
||||||
const direTp = item.data.People.filter((itm) => itm.Type === "Director");
|
|
||||||
setDirectors(direTp);
|
|
||||||
const writeTp = item.data.People.filter((itm) => itm.Type === "Writer");
|
|
||||||
setWriters(writeTp);
|
|
||||||
const producerTp = item.data.People.filter(
|
|
||||||
(itm) => itm.Type === "Producer",
|
|
||||||
);
|
|
||||||
setProducers(producerTp);
|
|
||||||
const actorTp = item.data.People.filter((itm) => itm.Type === "Actor");
|
|
||||||
setActors(actorTp);
|
|
||||||
if (item.data.MediaStreams && item.data.MediaSources) {
|
|
||||||
const videos = item.data.MediaStreams.filter(filterMediaStreamVideo);
|
|
||||||
const audios = item.data.MediaStreams.filter(filterMediaStreamAudio);
|
|
||||||
const subs = item.data.MediaStreams.filter(filterMediaStreamSubtitle);
|
|
||||||
|
|
||||||
setSelectedVideoTrack(videos[0]?.Index ?? null);
|
|
||||||
setSelectedAudioTrack(
|
|
||||||
item.data.MediaSources[0].DefaultAudioStreamIndex ?? null,
|
|
||||||
);
|
|
||||||
setSelectedSubtitleTrack(
|
|
||||||
item.data.MediaSources[0].DefaultSubtitleStreamIndex === -1 ||
|
|
||||||
!item.data.MediaSources[0].DefaultSubtitleStreamIndex
|
|
||||||
? "nosub"
|
|
||||||
: item.data.MediaSources[0].DefaultSubtitleStreamIndex,
|
|
||||||
);
|
|
||||||
|
|
||||||
setVideoTracks(videos);
|
|
||||||
setAudioTracks(audios);
|
|
||||||
setSubtitleTracks(subs);
|
|
||||||
|
|
||||||
// Analyze item for QualityInfo
|
|
||||||
const checkAtmos = audios.filter((audio) =>
|
|
||||||
audio.DisplayTitle?.toLocaleLowerCase().includes("atmos"),
|
|
||||||
);
|
|
||||||
const checkDolbyVision = videos.filter(
|
|
||||||
(video) =>
|
|
||||||
video.DisplayTitle?.toLocaleLowerCase().includes("dv") ||
|
|
||||||
video.DisplayTitle?.toLocaleLowerCase().includes("dolby vision") ||
|
|
||||||
!!video.VideoDoViTitle ||
|
|
||||||
video.VideoRangeType === "DOVI",
|
|
||||||
);
|
|
||||||
const checkDD = audios.filter(
|
|
||||||
(audio) =>
|
|
||||||
(audio.DisplayTitle?.toLocaleLowerCase().includes("dd") &&
|
|
||||||
!audio.DisplayTitle?.toLocaleLowerCase().includes("ddp")) ||
|
|
||||||
(audio.DisplayTitle?.toLocaleLowerCase().includes(
|
|
||||||
"dolby digital",
|
|
||||||
) &&
|
|
||||||
!audio.DisplayTitle?.toLocaleLowerCase().includes(
|
|
||||||
"dolby digital+",
|
|
||||||
)),
|
|
||||||
);
|
|
||||||
const checkDDP = audios.filter(
|
|
||||||
(audio) =>
|
|
||||||
audio.DisplayTitle?.toLocaleLowerCase().includes("ddp") ||
|
|
||||||
audio.DisplayTitle?.toLocaleLowerCase().includes("dolby digital+"),
|
|
||||||
);
|
|
||||||
const checkDts = audios.filter(
|
|
||||||
(audio) =>
|
|
||||||
audio.DisplayTitle?.toLocaleLowerCase().includes("dts") &&
|
|
||||||
!audio.DisplayTitle?.toLocaleLowerCase().includes("dts-hd ma") &&
|
|
||||||
!audio.DisplayTitle?.toLocaleLowerCase().includes("dts-hd.ma"),
|
|
||||||
);
|
|
||||||
const checkDtsHDMA = audios.filter(
|
|
||||||
(audio) =>
|
|
||||||
audio.DisplayTitle?.toLocaleLowerCase().includes("dts-hd ma") ||
|
|
||||||
audio.DisplayTitle?.toLocaleLowerCase().includes("dts-hd.ma"),
|
|
||||||
);
|
|
||||||
const checkUHD = videos.filter(
|
|
||||||
(video) =>
|
|
||||||
video.DisplayTitle?.toLocaleLowerCase().includes("4k") ||
|
|
||||||
video.DisplayTitle?.toLocaleLowerCase().includes("2160p") ||
|
|
||||||
video.DisplayTitle?.toLocaleLowerCase().includes("uhd"),
|
|
||||||
);
|
|
||||||
const checkHD = videos.filter(
|
|
||||||
(video) =>
|
|
||||||
(video.DisplayTitle?.toLocaleLowerCase().includes("hd") &&
|
|
||||||
!video.DisplayTitle?.toLocaleLowerCase().includes("hdr")) ||
|
|
||||||
video.DisplayTitle?.toLocaleLowerCase().includes("1080p") ||
|
|
||||||
video.DisplayTitle?.toLocaleLowerCase().includes("fhd"),
|
|
||||||
);
|
|
||||||
const checkSD = videos.filter(
|
|
||||||
(video) =>
|
|
||||||
(video.DisplayTitle?.toLocaleLowerCase().includes("sd") &&
|
|
||||||
!video.DisplayTitle?.toLocaleLowerCase().includes("sdr")) ||
|
|
||||||
video.DisplayTitle?.toLocaleLowerCase().includes("720p"),
|
|
||||||
);
|
|
||||||
const checkSDR = videos.filter(
|
|
||||||
(video) => video.VideoRangeType === "SDR",
|
|
||||||
);
|
|
||||||
const checkHDR = videos.filter(
|
|
||||||
(video) =>
|
|
||||||
video.VideoRange === "HDR" ||
|
|
||||||
video.DisplayTitle?.toLocaleLowerCase().includes("dv"),
|
|
||||||
);
|
|
||||||
const checkHDR10 = videos.filter(
|
|
||||||
(video) =>
|
|
||||||
video.VideoRangeType === "HDR10" &&
|
|
||||||
!video.DisplayTitle?.toLocaleLowerCase().includes("hdr10+"),
|
|
||||||
);
|
|
||||||
const checkHDR10Plus = videos.filter(
|
|
||||||
(video) =>
|
|
||||||
video.VideoRangeType === "HDR10+" ||
|
|
||||||
video.DisplayTitle?.toLocaleLowerCase().includes("hdr10+"),
|
|
||||||
);
|
|
||||||
const checkTrueHD = audios.filter((audio) =>
|
|
||||||
audio.DisplayTitle?.toLocaleLowerCase().includes("truehd"),
|
|
||||||
);
|
|
||||||
const checkIMAX = videos.filter((video) =>
|
|
||||||
video.DisplayTitle?.toLocaleLowerCase().includes("imax"),
|
|
||||||
);
|
|
||||||
setMediaQualityInfo({
|
|
||||||
isAtmos: checkAtmos.length > 0,
|
|
||||||
isDolbyVision: checkDolbyVision.length > 0,
|
|
||||||
isDts: checkDts.length > 0,
|
|
||||||
isDtsHDMA: checkDtsHDMA.length > 0,
|
|
||||||
isDD: checkDD.length > 0,
|
|
||||||
isDDP: checkDDP.length > 0,
|
|
||||||
isUHD: checkUHD.length > 0,
|
|
||||||
isHD: checkHD.length > 0,
|
|
||||||
isSD: checkSD.length > 0,
|
|
||||||
isSDR: checkSDR.length > 0,
|
|
||||||
isHDR: checkHDR.length > 0,
|
|
||||||
isHDR10: checkHDR10.length > 0,
|
|
||||||
isHDR10Plus: checkHDR10Plus.length > 0,
|
|
||||||
isTrueHD: checkTrueHD.length > 0,
|
|
||||||
isIMAX: checkIMAX.length > 0,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, [item.isSuccess]);
|
}, [item.isSuccess]);
|
||||||
|
|
||||||
@@ -317,6 +265,7 @@ function EpisodeTitlePage() {
|
|||||||
const { scrollYProgress } = useScroll({
|
const { scrollYProgress } = useScroll({
|
||||||
target: pageRef,
|
target: pageRef,
|
||||||
offset: ["start start", "60vh start"],
|
offset: ["start start", "60vh start"],
|
||||||
|
layoutEffect: false,
|
||||||
});
|
});
|
||||||
const parallax = useParallax(scrollYProgress, 50);
|
const parallax = useParallax(scrollYProgress, 50);
|
||||||
|
|
||||||
@@ -335,7 +284,7 @@ function EpisodeTitlePage() {
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (item.isSuccess) {
|
if (item.isSuccess && item.data) {
|
||||||
return (
|
return (
|
||||||
<motion.div
|
<motion.div
|
||||||
key={id}
|
key={id}
|
||||||
@@ -356,17 +305,20 @@ function EpisodeTitlePage() {
|
|||||||
<div className="item-hero-backdrop-container">
|
<div className="item-hero-backdrop-container">
|
||||||
{item.data.ParentBackdropImageTags?.length ? (
|
{item.data.ParentBackdropImageTags?.length ? (
|
||||||
<motion.img
|
<motion.img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={api.getItemImageUrl(
|
src={
|
||||||
item.data.ParentBackdropItemId,
|
api &&
|
||||||
"Backdrop",
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
{
|
item.data.ParentBackdropItemId ?? "",
|
||||||
tag: item.data.ParentBackdropImageTags[0],
|
"Backdrop",
|
||||||
},
|
{
|
||||||
)}
|
tag: item.data.ParentBackdropImageTags[0],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
className="item-hero-backdrop"
|
className="item-hero-backdrop"
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
y: parallax,
|
y: parallax,
|
||||||
@@ -374,11 +326,11 @@ function EpisodeTitlePage() {
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<motion.img
|
<motion.img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={heroBg}
|
src={heroBg}
|
||||||
className="item-hero-backdrop"
|
className="item-hero-backdrop"
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
y: parallax,
|
y: parallax,
|
||||||
@@ -392,63 +344,80 @@ function EpisodeTitlePage() {
|
|||||||
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
|
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{Object.keys(item.data.ImageTags).includes("Primary") ? (
|
{item.data.ImageTags?.Primary ? (
|
||||||
<>
|
<div>
|
||||||
<Blurhash
|
<Blurhash
|
||||||
hash={
|
hash={
|
||||||
item.data.ImageBlurHashes.Primary[
|
item.data.ImageBlurHashes?.Primary?.[
|
||||||
item.data.ImageTags.Primary
|
item.data.ImageTags.Primary
|
||||||
]
|
] ?? ""
|
||||||
}
|
}
|
||||||
className="item-hero-image-blurhash"
|
className="item-hero-image-blurhash"
|
||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
src={
|
||||||
quality: 90,
|
api &&
|
||||||
tag: item.data.ImageTags.Primary,
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
})}
|
item.data.Id ?? "",
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
|
quality: 90,
|
||||||
|
tag: item.data.ImageTags.Primary,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
className="item-hero-image"
|
className="item-hero-image"
|
||||||
/>
|
/>
|
||||||
</>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="item-hero-image-icon">
|
<div className="item-hero-image-icon">
|
||||||
{getTypeIcon(item.data.Type)}
|
{getTypeIcon(item.data.Type ?? "Episode")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="item-hero-detail">
|
<div className="item-hero-detail">
|
||||||
<TextLink
|
<Typography
|
||||||
otherProps={{
|
variant="h2"
|
||||||
fontWeight: 200,
|
fontWeight="200"
|
||||||
mb: 2,
|
mb={2}
|
||||||
style: {
|
style={{
|
||||||
textDecoration: "none",
|
textDecoration: "none",
|
||||||
},
|
|
||||||
}}
|
}}
|
||||||
variant={"h2"}
|
|
||||||
location={`/series/${item.data.SeriesId}`}
|
|
||||||
>
|
>
|
||||||
{item.data.ParentLogoItemId?.length > 0 ? (
|
<Link
|
||||||
<img
|
style={{ textDecoration: "none", color: "white" }}
|
||||||
alt={item.data.SeriesName}
|
to="/series/$id"
|
||||||
src={api.getItemImageUrl(item.data.ParentLogoItemId, "Logo", {
|
params={{ id: item.data.SeriesId ?? "" }}
|
||||||
quality: 90,
|
>
|
||||||
fillWidth: 592,
|
{item.data.ParentLogoItemId ? (
|
||||||
fillHeight: 592,
|
<img
|
||||||
})}
|
alt={item.data.SeriesName ?? ""}
|
||||||
onLoad={(e) => {
|
src={
|
||||||
e.currentTarget.style.opacity = 1;
|
api &&
|
||||||
}}
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
className="item-hero-logo"
|
item.data.ParentLogoItemId,
|
||||||
/>
|
"Logo",
|
||||||
) : (
|
{
|
||||||
item.data.SeriesName
|
quality: 90,
|
||||||
)}
|
fillWidth: 592,
|
||||||
</TextLink>
|
fillHeight: 592,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
onLoad={(e) => {
|
||||||
|
e.currentTarget.style.opacity = "1";
|
||||||
|
}}
|
||||||
|
className="item-hero-logo"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
item.data.SeriesName
|
||||||
|
)}
|
||||||
|
</Link>
|
||||||
|
</Typography>
|
||||||
<Typography variant="h4" fontWeight={300} mb={2}>
|
<Typography variant="h4" fontWeight={300} mb={2}>
|
||||||
S{item.data.ParentIndexNumber ?? 0}:E
|
S{item.data.ParentIndexNumber ?? 0}:E
|
||||||
{item.data.IndexNumberEnd
|
{item.data.IndexNumberEnd
|
||||||
@@ -588,7 +557,7 @@ function EpisodeTitlePage() {
|
|||||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||||
{endsAt(
|
{endsAt(
|
||||||
item.data.RunTimeTicks -
|
item.data.RunTimeTicks -
|
||||||
item.data.UserData.PlaybackPositionTicks,
|
(item.data.UserData?.PlaybackPositionTicks ?? 0),
|
||||||
)}
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
@@ -682,33 +651,33 @@ function EpisodeTitlePage() {
|
|||||||
<div className="flex flex-row">
|
<div className="flex flex-row">
|
||||||
<PlayButton
|
<PlayButton
|
||||||
item={item.data}
|
item={item.data}
|
||||||
itemId={item.data.Id}
|
itemType="Episode"
|
||||||
itemType={item.data.Type}
|
currentVideoTrack={selectedVideoTrack ?? 0}
|
||||||
itemUserData={item.data.UserData}
|
currentAudioTrack={selectedAudioTrack ?? 0}
|
||||||
currentVideoTrack={selectedVideoTrack}
|
currentSubTrack={selectedSubtitleTrack ?? "nosub"}
|
||||||
currentAudioTrack={selectedAudioTrack}
|
userId={user?.Id}
|
||||||
currentSubTrack={selectedSubtitleTrack}
|
|
||||||
userId={user.data.Id}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-row" style={{ gap: "1em" }}>
|
<div className="flex flex-row" style={{ gap: "1em" }}>
|
||||||
<TrailerButton
|
{item.data.RemoteTrailers && (
|
||||||
trailerItem={item.data.RemoteTrailers}
|
<TrailerButton
|
||||||
disabled={item.data.RemoteTrailers?.length === 0}
|
trailerItem={item.data.RemoteTrailers}
|
||||||
/>
|
disabled={item.data.RemoteTrailers?.length === 0}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<LikeButton
|
<LikeButton
|
||||||
itemName={item.data.Name}
|
itemName={item.data.Name}
|
||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isFavorite={item.data.UserData.IsFavorite}
|
isFavorite={item.data.UserData?.IsFavorite}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
<MarkPlayedButton
|
<MarkPlayedButton
|
||||||
itemName={item.data.Name}
|
itemName={item.data.Name}
|
||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isPlayed={item.data.UserData.Played}
|
isPlayed={item.data.UserData?.Played}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -731,7 +700,7 @@ function EpisodeTitlePage() {
|
|||||||
}}
|
}}
|
||||||
value={selectedVideoTrack}
|
value={selectedVideoTrack}
|
||||||
variant="filled"
|
variant="filled"
|
||||||
onChange={(e) => setSelectedVideoTrack(e.target.value)}
|
onChange={(e) => setSelectedVideoTrack(Number(e.target.value))}
|
||||||
>
|
>
|
||||||
{videoTracks.map((track) => (
|
{videoTracks.map((track) => (
|
||||||
<MenuItem key={track.Index} value={track.Index}>
|
<MenuItem key={track.Index} value={track.Index}>
|
||||||
@@ -750,7 +719,7 @@ function EpisodeTitlePage() {
|
|||||||
}}
|
}}
|
||||||
value={selectedAudioTrack}
|
value={selectedAudioTrack}
|
||||||
variant="filled"
|
variant="filled"
|
||||||
onChange={(e) => setSelectedAudioTrack(e.target.value)}
|
onChange={(e) => setSelectedAudioTrack(Number(e.target.value))}
|
||||||
>
|
>
|
||||||
{audioTracks.map((track) => (
|
{audioTracks.map((track) => (
|
||||||
<MenuItem key={track.Index} value={track.Index}>
|
<MenuItem key={track.Index} value={track.Index}>
|
||||||
@@ -768,9 +737,11 @@ function EpisodeTitlePage() {
|
|||||||
}}
|
}}
|
||||||
value={selectedSubtitleTrack}
|
value={selectedSubtitleTrack}
|
||||||
variant="filled"
|
variant="filled"
|
||||||
onChange={(e) => setSelectedSubtitleTrack(e.target.value)}
|
onChange={(e) =>
|
||||||
|
setSelectedSubtitleTrack(Number(e.target.value))
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<MenuItem key={-1} value={"nosub"}>
|
<MenuItem key={-1} value={-1}>
|
||||||
No Subtitle
|
No Subtitle
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
{subtitleTracks.map((track) => (
|
{subtitleTracks.map((track) => (
|
||||||
@@ -788,43 +759,18 @@ function EpisodeTitlePage() {
|
|||||||
marginTop: "1em",
|
marginTop: "1em",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{item.data.ExternalUrls.map((url) => (
|
{item.data.ExternalUrls?.map((url) => (
|
||||||
<IconLink url={url.Url} name={url.Name} />
|
<IconLink
|
||||||
|
key={url.Url}
|
||||||
|
url={url.Url ?? ""}
|
||||||
|
name={url.Name ?? ""}
|
||||||
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{upcomingEpisodes.isSuccess &&
|
{(item.data.People?.length ?? 0) > 0 && (
|
||||||
upcomingEpisodes.data.Items?.length > 0 && (
|
|
||||||
<CardScroller
|
|
||||||
title="Upcoming Episodes"
|
|
||||||
displayCards={4}
|
|
||||||
disableDecoration
|
|
||||||
>
|
|
||||||
{upcomingEpisodes.data.Items?.map((episode) => {
|
|
||||||
return (
|
|
||||||
<Card
|
|
||||||
key={episode.Id}
|
|
||||||
item={episode}
|
|
||||||
cardTitle={episode.SeriesName}
|
|
||||||
imageType="Primary"
|
|
||||||
cardCaption={`S${episode.ParentIndexNumber}:E${episode.IndexNumber} - ${episode.Name}`}
|
|
||||||
cardType="thumb"
|
|
||||||
queryKey={["item", id, "episode", "upcomingEpisodes"]}
|
|
||||||
userId={user.data.Id}
|
|
||||||
imageBlurhash={
|
|
||||||
!!episode.ImageBlurHashes?.Primary &&
|
|
||||||
episode.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(episode.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</CardScroller>
|
|
||||||
)}
|
|
||||||
{item.data.People?.length > 0 && (
|
|
||||||
<div className="item-detail-cast">
|
<div className="item-detail-cast">
|
||||||
<Typography variant="h5" mb={2}>
|
<Typography variant="h5" mb={2}>
|
||||||
Cast & Crew
|
Cast & Crew
|
||||||
@@ -837,19 +783,26 @@ function EpisodeTitlePage() {
|
|||||||
<Link
|
<Link
|
||||||
className="item-detail-cast-card"
|
className="item-detail-cast-card"
|
||||||
key={actor.Id}
|
key={actor.Id}
|
||||||
to={`/person/$id`}
|
to="/person/$id"
|
||||||
params={{
|
params={{
|
||||||
id: actor.Id,
|
id: actor.Id ?? "",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name ?? ""}
|
||||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
src={
|
||||||
quality: 80,
|
api &&
|
||||||
fillWidth: 200,
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
fillHeight: 200,
|
actor.Id ?? "",
|
||||||
})}
|
"Primary",
|
||||||
|
{
|
||||||
|
quality: 80,
|
||||||
|
fillWidth: 200,
|
||||||
|
fillHeight: 200,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -883,19 +836,26 @@ function EpisodeTitlePage() {
|
|||||||
<Link
|
<Link
|
||||||
className="item-detail-cast-card"
|
className="item-detail-cast-card"
|
||||||
key={actor.Id}
|
key={actor.Id}
|
||||||
to={`/person/$id`}
|
to="/person/$id"
|
||||||
params={{
|
params={{
|
||||||
id: actor.Id,
|
id: actor.Id ?? "",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name ?? ""}
|
||||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
src={
|
||||||
quality: 80,
|
api &&
|
||||||
fillWidth: 200,
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
fillHeight: 200,
|
actor.Id ?? "",
|
||||||
})}
|
"Primary",
|
||||||
|
{
|
||||||
|
quality: 80,
|
||||||
|
fillWidth: 200,
|
||||||
|
fillHeight: 200,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -929,19 +889,26 @@ function EpisodeTitlePage() {
|
|||||||
<Link
|
<Link
|
||||||
className="item-detail-cast-card"
|
className="item-detail-cast-card"
|
||||||
key={actor.Id}
|
key={actor.Id}
|
||||||
to={`/person/$id`}
|
to="/person/$id"
|
||||||
params={{
|
params={{
|
||||||
id: actor.Id,
|
id: actor.Id ?? "",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name ?? ""}
|
||||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
src={
|
||||||
quality: 80,
|
api &&
|
||||||
fillWidth: 200,
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
fillHeight: 200,
|
actor.Id ?? "",
|
||||||
})}
|
"Primary",
|
||||||
|
{
|
||||||
|
quality: 80,
|
||||||
|
fillWidth: 200,
|
||||||
|
fillHeight: 200,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -975,19 +942,26 @@ function EpisodeTitlePage() {
|
|||||||
<Link
|
<Link
|
||||||
className="item-detail-cast-card"
|
className="item-detail-cast-card"
|
||||||
key={actor.Id}
|
key={actor.Id}
|
||||||
to={`/person/$id`}
|
to="/person/$id"
|
||||||
params={{
|
params={{
|
||||||
id: actor.Id,
|
id: actor.Id ?? "",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name ?? ""}
|
||||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
src={
|
||||||
quality: 80,
|
api &&
|
||||||
fillWidth: 200,
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
fillHeight: 200,
|
actor.Id ?? "",
|
||||||
})}
|
"Primary",
|
||||||
|
{
|
||||||
|
quality: 80,
|
||||||
|
fillWidth: 200,
|
||||||
|
fillHeight: 200,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -1015,6 +989,30 @@ function EpisodeTitlePage() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{upcomingEpisodes.isSuccess &&
|
||||||
|
(upcomingEpisodes.data?.Items?.length ?? 0) > 0 && (
|
||||||
|
<CardScroller
|
||||||
|
title="Upcoming Episodes"
|
||||||
|
displayCards={4}
|
||||||
|
disableDecoration
|
||||||
|
>
|
||||||
|
{upcomingEpisodes.data?.Items?.map((episode) => {
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
key={episode.Id}
|
||||||
|
item={episode}
|
||||||
|
cardTitle={episode.SeriesName}
|
||||||
|
imageType="Primary"
|
||||||
|
cardCaption={`S${episode.ParentIndexNumber}:E${episode.IndexNumber} - ${episode.Name}`}
|
||||||
|
cardType="thumb"
|
||||||
|
queryKey={["item", id, "episode", "upcomingEpisodes"]}
|
||||||
|
userId={user?.Id}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</CardScroller>
|
||||||
|
)}
|
||||||
</motion.div>
|
</motion.div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,15 +2,14 @@ import React, { useEffect } from "react";
|
|||||||
|
|
||||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||||
|
|
||||||
import Typography from "@mui/material/Typography";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import "./favorite.scss";
|
import "./favorite.scss";
|
||||||
|
|
||||||
import { Card } from "@/components/card/card";
|
import { Card } from "@/components/card/card";
|
||||||
import { CardScroller } from "@/components/cardScroller/cardScroller";
|
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
|
||||||
import { createFileRoute } from "@tanstack/react-router";
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/favorite/")({
|
export const Route = createFileRoute("/_api/favorite/")({
|
||||||
@@ -21,21 +20,14 @@ function FavoritePage() {
|
|||||||
const api = Route.useRouteContext().api;
|
const api = Route.useRouteContext().api;
|
||||||
const [setBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
const [setBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
enabled: Boolean(api),
|
|
||||||
});
|
|
||||||
|
|
||||||
const movies = useQuery({
|
const movies = useQuery({
|
||||||
queryKey: ["favorite", "movies"],
|
queryKey: ["favorite", "movies"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
isFavorite: true,
|
isFavorite: true,
|
||||||
includeItemTypes: [BaseItemKind.Movie],
|
includeItemTypes: [BaseItemKind.Movie],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -47,8 +39,9 @@ function FavoritePage() {
|
|||||||
const series = useQuery({
|
const series = useQuery({
|
||||||
queryKey: ["favorite", "series"],
|
queryKey: ["favorite", "series"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
isFavorite: true,
|
isFavorite: true,
|
||||||
includeItemTypes: [BaseItemKind.Series],
|
includeItemTypes: [BaseItemKind.Series],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -60,8 +53,9 @@ function FavoritePage() {
|
|||||||
const musicAlbum = useQuery({
|
const musicAlbum = useQuery({
|
||||||
queryKey: ["favorite", "musicAlbum"],
|
queryKey: ["favorite", "musicAlbum"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
isFavorite: true,
|
isFavorite: true,
|
||||||
includeItemTypes: [BaseItemKind.MusicAlbum],
|
includeItemTypes: [BaseItemKind.MusicAlbum],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -73,8 +67,9 @@ function FavoritePage() {
|
|||||||
const audio = useQuery({
|
const audio = useQuery({
|
||||||
queryKey: ["favorite", "audio"],
|
queryKey: ["favorite", "audio"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
isFavorite: true,
|
isFavorite: true,
|
||||||
includeItemTypes: [BaseItemKind.Audio],
|
includeItemTypes: [BaseItemKind.Audio],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -86,8 +81,9 @@ function FavoritePage() {
|
|||||||
const book = useQuery({
|
const book = useQuery({
|
||||||
queryKey: ["favorite", "book"],
|
queryKey: ["favorite", "book"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
isFavorite: true,
|
isFavorite: true,
|
||||||
includeItemTypes: [BaseItemKind.Book],
|
includeItemTypes: [BaseItemKind.Book],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -99,8 +95,9 @@ function FavoritePage() {
|
|||||||
const musicArtists = useQuery({
|
const musicArtists = useQuery({
|
||||||
queryKey: ["favorite", "musicArtist"],
|
queryKey: ["favorite", "musicArtist"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
isFavorite: true,
|
isFavorite: true,
|
||||||
includeItemTypes: [BaseItemKind.MusicArtist],
|
includeItemTypes: [BaseItemKind.MusicArtist],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -112,8 +109,9 @@ function FavoritePage() {
|
|||||||
const person = useQuery({
|
const person = useQuery({
|
||||||
queryKey: ["favorite", "person"],
|
queryKey: ["favorite", "person"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
isFavorite: true,
|
isFavorite: true,
|
||||||
includeItemTypes: [BaseItemKind.Person],
|
includeItemTypes: [BaseItemKind.Person],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -127,7 +125,7 @@ function FavoritePage() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main
|
<div
|
||||||
className="scrollY"
|
className="scrollY"
|
||||||
style={{
|
style={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
@@ -137,9 +135,9 @@ function FavoritePage() {
|
|||||||
paddingTop: "4.2em",
|
paddingTop: "4.2em",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{movies.isSuccess && movies.data.Items.length > 0 && (
|
{movies.isSuccess && (movies.data?.Items?.length ?? 0) > 0 && (
|
||||||
<CardScroller displayCards={8} title="Movies">
|
<CardScroller displayCards={8} title="Movies">
|
||||||
{movies.data.Items.map((item) => (
|
{movies.data?.Items?.map((item) => (
|
||||||
<Card
|
<Card
|
||||||
key={item.Id}
|
key={item.Id}
|
||||||
item={item}
|
item={item}
|
||||||
@@ -148,20 +146,14 @@ function FavoritePage() {
|
|||||||
cardCaption={item.ProductionYear}
|
cardCaption={item.ProductionYear}
|
||||||
cardType="portrait"
|
cardType="portrait"
|
||||||
queryKey={["favorite", "movies"]}
|
queryKey={["favorite", "movies"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
|
||||||
item.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
)}
|
)}
|
||||||
{series.isSuccess && series.data.Items.length > 0 && (
|
{series.isSuccess && (series.data?.Items?.length ?? 0) > 0 && (
|
||||||
<CardScroller title="TV Shows" displayCards={8} disableDecoration>
|
<CardScroller title="TV Shows" displayCards={8} disableDecoration>
|
||||||
{series.data.Items.map((item) => (
|
{series.data?.Items?.map((item) => (
|
||||||
<Card
|
<Card
|
||||||
key={item.Id}
|
key={item.Id}
|
||||||
item={item}
|
item={item}
|
||||||
@@ -176,20 +168,14 @@ function FavoritePage() {
|
|||||||
}`}
|
}`}
|
||||||
cardType="portrait"
|
cardType="portrait"
|
||||||
queryKey={["favorite", "series"]}
|
queryKey={["favorite", "series"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
|
||||||
item.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
)}
|
)}
|
||||||
{audio.isSuccess && audio.data.Items.length > 0 && (
|
{audio.isSuccess && (audio.data?.Items?.length ?? 0) > 0 && (
|
||||||
<CardScroller title="Audio" displayCards={8} disableDecoration>
|
<CardScroller title="Audio" displayCards={8} disableDecoration>
|
||||||
{audio.data.Items.map((item) => (
|
{audio.data?.Items?.map((item) => (
|
||||||
<Card
|
<Card
|
||||||
key={item.Id}
|
key={item.Id}
|
||||||
item={item}
|
item={item}
|
||||||
@@ -198,20 +184,14 @@ function FavoritePage() {
|
|||||||
cardCaption={item.ProductionYear}
|
cardCaption={item.ProductionYear}
|
||||||
cardType="square"
|
cardType="square"
|
||||||
queryKey={["favorite", "audio"]}
|
queryKey={["favorite", "audio"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
|
||||||
item.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
)}
|
)}
|
||||||
{musicAlbum.isSuccess && musicAlbum.data.Items.length > 0 && (
|
{musicAlbum.isSuccess && (musicAlbum.data?.Items?.length ?? 0) > 0 && (
|
||||||
<CardScroller title="Albums" displayCards={8} disableDecoration>
|
<CardScroller title="Albums" displayCards={8} disableDecoration>
|
||||||
{musicAlbum.data.Items.map((item) => (
|
{musicAlbum.data?.Items?.map((item) => (
|
||||||
<Card
|
<Card
|
||||||
key={item.Id}
|
key={item.Id}
|
||||||
item={item}
|
item={item}
|
||||||
@@ -221,20 +201,14 @@ function FavoritePage() {
|
|||||||
cardCaption={item.AlbumArtist}
|
cardCaption={item.AlbumArtist}
|
||||||
cardType={"square"}
|
cardType={"square"}
|
||||||
queryKey={["favorite", "musicAlbum"]}
|
queryKey={["favorite", "musicAlbum"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
|
||||||
item.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
)}
|
)}
|
||||||
{book.isSuccess && book.data.Items.length > 0 && (
|
{book.isSuccess && (book.data?.Items?.length ?? 0) > 0 && (
|
||||||
<CardScroller title="Books" displayCards={8} disableDecoration>
|
<CardScroller title="Books" displayCards={8} disableDecoration>
|
||||||
{book.data.Items.map((item) => (
|
{book.data?.Items?.map((item) => (
|
||||||
<Card
|
<Card
|
||||||
key={item.Id}
|
key={item.Id}
|
||||||
item={item}
|
item={item}
|
||||||
@@ -244,42 +218,31 @@ function FavoritePage() {
|
|||||||
disableOverlay
|
disableOverlay
|
||||||
cardType={"portrait"}
|
cardType={"portrait"}
|
||||||
queryKey={["favorite", "book"]}
|
queryKey={["favorite", "book"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
|
||||||
item.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
)}
|
)}
|
||||||
{musicArtists.isSuccess && musicArtists.data.Items.length > 0 && (
|
{musicArtists.isSuccess &&
|
||||||
<CardScroller title="Artists" displayCards={8} disableDecoration>
|
(musicArtists.data?.Items?.length ?? 0) > 0 && (
|
||||||
{musicArtists.data.Items.map((item) => (
|
<CardScroller title="Artists" displayCards={8} disableDecoration>
|
||||||
<Card
|
{musicArtists.data?.Items?.map((item) => (
|
||||||
key={item.Id}
|
<Card
|
||||||
item={item}
|
key={item.Id}
|
||||||
cardTitle={item.Name}
|
item={item}
|
||||||
imageType={"Primary"}
|
cardTitle={item.Name}
|
||||||
disableOverlay
|
imageType={"Primary"}
|
||||||
cardType={"square"}
|
disableOverlay
|
||||||
queryKey={["favorite", "musicArtist"]}
|
cardType={"square"}
|
||||||
userId={user.data.Id}
|
queryKey={["favorite", "musicArtist"]}
|
||||||
imageBlurhash={
|
userId={user?.Id}
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
/>
|
||||||
item.ImageBlurHashes?.Primary[
|
))}
|
||||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
</CardScroller>
|
||||||
]
|
)}
|
||||||
}
|
{person.isSuccess && (person.data?.Items?.length ?? 0) > 0 && (
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</CardScroller>
|
|
||||||
)}
|
|
||||||
{person.isSuccess && person.data.Items.length > 0 && (
|
|
||||||
<CardScroller title="People" displayCards={8} disableDecoration>
|
<CardScroller title="People" displayCards={8} disableDecoration>
|
||||||
{person.data.Items.map((item) => (
|
{person.data?.Items?.map((item) => (
|
||||||
<Card
|
<Card
|
||||||
key={item.Id}
|
key={item.Id}
|
||||||
item={item}
|
item={item}
|
||||||
@@ -288,18 +251,12 @@ function FavoritePage() {
|
|||||||
disableOverlay
|
disableOverlay
|
||||||
cardType={"square"}
|
cardType={"square"}
|
||||||
queryKey={["favorite", "person"]}
|
queryKey={["favorite", "person"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
|
||||||
item.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
)}
|
)}
|
||||||
</main>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useCallback, useMemo } from "react";
|
||||||
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
@@ -8,24 +8,24 @@ import Carousel from "@/components/carousel";
|
|||||||
|
|
||||||
// Custom Components
|
// Custom Components
|
||||||
import { Card } from "@/components/card/card";
|
import { Card } from "@/components/card/card";
|
||||||
import { CardScroller } from "@/components/cardScroller/cardScroller";
|
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||||
import { LatestMediaSection } from "@/components/layouts/homeSection/latestMediaSection";
|
import { LatestMediaSection } from "@/components/layouts/homeSection/latestMediaSection";
|
||||||
import { CardsSkeleton } from "@/components/skeleton/cards";
|
import { CardsSkeleton } from "@/components/skeleton/cards";
|
||||||
import { CarouselSkeleton } from "@/components/skeleton/carousel";
|
import { CarouselSkeleton } from "@/components/skeleton/carousel";
|
||||||
|
|
||||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||||
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||||
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";
|
||||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||||
|
|
||||||
import { Outlet, createFileRoute, useNavigate } from "@tanstack/react-router";
|
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||||
|
|
||||||
import { setBackdrop } from "@/utils/store/backdrop";
|
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||||
|
|
||||||
import CarouselSlide from "@/components/carouselSlide";
|
|
||||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
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,
|
||||||
@@ -36,41 +36,31 @@ import { ErrorBoundary } from "react-error-boundary";
|
|||||||
|
|
||||||
export const Route = createFileRoute("/_api/home/")({
|
export const Route = createFileRoute("/_api/home/")({
|
||||||
component: Home,
|
component: Home,
|
||||||
onError: (err) => {
|
|
||||||
console.log(err);
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function Home() {
|
function Home() {
|
||||||
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();
|
|
||||||
console.log(usr.data);
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
enabled: Boolean(api),
|
|
||||||
});
|
|
||||||
|
|
||||||
const libraries = useQuery({
|
const libraries = useQuery({
|
||||||
queryKey: ["libraries"],
|
queryKey: ["libraries"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return;
|
||||||
const libs = await getUserViewsApi(api).getUserViews({
|
const libs = await getUserViewsApi(api).getUserViews({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
});
|
});
|
||||||
return libs.data;
|
return libs.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data && !!api.accessToken,
|
enabled: !!user?.Id && !!api?.accessToken,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
const latestMedia = useQuery({
|
const latestMedia = useQuery({
|
||||||
queryKey: ["home", "latestMedia"],
|
queryKey: ["home", "latestMedia"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return;
|
||||||
const media = await getUserLibraryApi(api).getLatestMedia({
|
const media = await getUserLibraryApi(api).getLatestMedia({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
fields: [
|
fields: [
|
||||||
ItemFields.Overview,
|
ItemFields.Overview,
|
||||||
ItemFields.ParentId,
|
ItemFields.ParentId,
|
||||||
@@ -79,19 +69,25 @@ function Home() {
|
|||||||
ItemFields.MediaStreams,
|
ItemFields.MediaStreams,
|
||||||
ItemFields.MediaSources,
|
ItemFields.MediaSources,
|
||||||
],
|
],
|
||||||
|
includeItemTypes: [
|
||||||
|
BaseItemKind.Movie,
|
||||||
|
BaseItemKind.Series,
|
||||||
|
BaseItemKind.MusicAlbum,
|
||||||
|
],
|
||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
enableImages: true,
|
enableImages: true,
|
||||||
});
|
});
|
||||||
return media.data;
|
return media.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
});
|
});
|
||||||
|
|
||||||
const resumeItemsVideo = useQuery({
|
const resumeItemsVideo = useQuery({
|
||||||
queryKey: ["home", "resume", "video"],
|
queryKey: ["home", "resume", "video"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return;
|
||||||
const resumeItems = await getItemsApi(api).getResumeItems({
|
const resumeItems = await getItemsApi(api).getResumeItems({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
mediaTypes: ["Video"],
|
mediaTypes: ["Video"],
|
||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
@@ -99,15 +95,16 @@ function Home() {
|
|||||||
});
|
});
|
||||||
return resumeItems.data;
|
return resumeItems.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
refetchOnMount: true,
|
refetchOnMount: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const resumeItemsAudio = useQuery({
|
const resumeItemsAudio = useQuery({
|
||||||
queryKey: ["home", "resume", "audio"],
|
queryKey: ["home", "resume", "audio"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return;
|
||||||
const resumeItems = await getItemsApi(api).getResumeItems({
|
const resumeItems = await getItemsApi(api).getResumeItems({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
mediaTypes: ["Audio"],
|
mediaTypes: ["Audio"],
|
||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
@@ -115,14 +112,15 @@ function Home() {
|
|||||||
});
|
});
|
||||||
return resumeItems.data;
|
return resumeItems.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
});
|
});
|
||||||
|
|
||||||
const upNextItems = useQuery({
|
const upNextItems = useQuery({
|
||||||
queryKey: ["home", "upNext"],
|
queryKey: ["home", "upNext"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return;
|
||||||
const upNext = await getTvShowsApi(api).getNextUp({
|
const upNext = await getTvShowsApi(api).getNextUp({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
fields: [
|
fields: [
|
||||||
ItemFields.PrimaryImageAspectRatio,
|
ItemFields.PrimaryImageAspectRatio,
|
||||||
ItemFields.MediaStreams,
|
ItemFields.MediaStreams,
|
||||||
@@ -133,274 +131,272 @@ function Home() {
|
|||||||
});
|
});
|
||||||
return upNext.data;
|
return upNext.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
refetchOnMount: true,
|
refetchOnMount: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [latestMediaLibs, setLatestMediaLibs] = useState<
|
const excludeTypes = ["boxsets", "playlists", "livetv", "channels"];
|
||||||
BaseItemDto[] | undefined
|
const latestMediaLibs = useMemo(() => {
|
||||||
>([]);
|
if (libraries.data?.Items?.length) {
|
||||||
|
return libraries.data?.Items?.reduce(
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const [excludeTypes] = useState(
|
|
||||||
() => new Set(["boxsets", "playlists", "livetv", "channels"]),
|
|
||||||
);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (libraries.isSuccess) {
|
|
||||||
const latestMediaLibsTemp = libraries.data.Items?.reduce(
|
|
||||||
(filteredItems: BaseItemDto[], currentItem) => {
|
(filteredItems: BaseItemDto[], currentItem) => {
|
||||||
if (!excludeTypes.has(currentItem.Type)) {
|
if (currentItem.Type && !excludeTypes.includes(currentItem.Type)) {
|
||||||
filteredItems.push(currentItem);
|
filteredItems.push(currentItem);
|
||||||
}
|
}
|
||||||
return filteredItems;
|
return filteredItems;
|
||||||
},
|
},
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
setLatestMediaLibs(latestMediaLibsTemp);
|
|
||||||
}
|
}
|
||||||
}, [libraries.isSuccess]);
|
}, [libraries.data?.Items?.length]);
|
||||||
|
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||||
|
|
||||||
|
const handleOnChangeCarousel = useCallback(
|
||||||
|
(now: number) => {
|
||||||
|
if (api && latestMedia.isSuccess && (latestMedia.data?.length ?? 0) > 0) {
|
||||||
|
if (latestMedia.data?.[now]?.ParentBackdropImageTags) {
|
||||||
|
setBackdrop(
|
||||||
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
latestMedia.data[now].Id ?? "",
|
||||||
|
"Backdrop",
|
||||||
|
{
|
||||||
|
tag: latestMedia.data[now].ParentBackdropImageTags[0],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
latestMedia.data[now]?.ParentBackdropImageTags[0] ??
|
||||||
|
latestMedia.data[now].Id,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
setBackdrop(
|
||||||
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
latestMedia.data?.[now].Id ?? "",
|
||||||
|
"Backdrop",
|
||||||
|
{
|
||||||
|
tag: latestMedia.data?.[now].BackdropImageTags?.[0],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
latestMedia.data?.[now]?.BackdropImageTags?.[0] ??
|
||||||
|
latestMedia.data?.[now].Id,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[latestMedia.data?.map((item) => item.Id).join("")],
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<main
|
||||||
<main
|
className="scrollY home padded-top"
|
||||||
className="scrollY home padded-top"
|
style={{
|
||||||
style={{
|
flexGrow: 1,
|
||||||
flexGrow: 1,
|
position: "relative",
|
||||||
position: "relative",
|
}}
|
||||||
}}
|
>
|
||||||
>
|
<ErrorBoundary FallbackComponent={ErrorNotice}>
|
||||||
<ErrorBoundary FallbackComponent={ErrorNotice}>
|
{latestMedia.isPending ? (
|
||||||
{latestMedia.isPending ? (
|
<CarouselSkeleton />
|
||||||
<CarouselSkeleton />
|
) : (
|
||||||
) : (
|
latestMedia.data?.length && (
|
||||||
latestMedia.data?.length && (
|
<Carousel
|
||||||
<Carousel
|
content={latestMedia.data}
|
||||||
content={latestMedia.data}
|
onChange={handleOnChangeCarousel}
|
||||||
onChange={(now: number) => {
|
/>
|
||||||
if (latestMedia.isSuccess && latestMedia.data.length > 0) {
|
)
|
||||||
if (latestMedia.data[now]?.ParentBackdropImageTags) {
|
)}
|
||||||
setBackdrop(
|
</ErrorBoundary>
|
||||||
api.getItemImageUrl(
|
|
||||||
latestMedia.data[now].Id,
|
|
||||||
"Backdrop",
|
|
||||||
{
|
|
||||||
tag: latestMedia.data[now]
|
|
||||||
.ParentBackdropImageTags[0],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
latestMedia.data[now]?.ParentBackdropImageTags[0] ??
|
|
||||||
latestMedia.data[now].Id,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
setBackdrop(
|
|
||||||
api.getItemImageUrl(
|
|
||||||
latestMedia.data[now].Id,
|
|
||||||
"Backdrop",
|
|
||||||
{
|
|
||||||
tag: latestMedia.data[now].BackdropImageTags[0],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
latestMedia.data[now]?.BackdropImageTags[0] ??
|
|
||||||
latestMedia.data[now].Id,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
)}
|
|
||||||
</ErrorBoundary>
|
|
||||||
|
|
||||||
<ErrorBoundary
|
<ErrorBoundary
|
||||||
fallback={
|
fallback={
|
||||||
<div className="error">
|
<div className="error">
|
||||||
<Typography>Error with Carousel</Typography>
|
<Typography>Error with Carousel</Typography>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{libraries.isPending ? (
|
{libraries.isPending ? (
|
||||||
<CardsSkeleton />
|
<CardsSkeleton />
|
||||||
) : (
|
) : (
|
||||||
<CardScroller displayCards={4} title="Libraries">
|
<CardScroller displayCards={4} title="Libraries">
|
||||||
{libraries.status === "success" &&
|
{libraries.status === "success" &&
|
||||||
libraries.data.Items?.map((item) => {
|
libraries.data?.Items?.map((item) => {
|
||||||
return (
|
|
||||||
<Card
|
|
||||||
key={item.Id}
|
|
||||||
item={item}
|
|
||||||
cardTitle={item.Name}
|
|
||||||
imageType="Primary"
|
|
||||||
cardType="thumb"
|
|
||||||
disableOverlay
|
|
||||||
onClick={() =>
|
|
||||||
navigate({
|
|
||||||
to: "/library/$id",
|
|
||||||
params: { id: item.Id ?? "" },
|
|
||||||
})
|
|
||||||
}
|
|
||||||
overrideIcon={item.CollectionType}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</CardScroller>
|
|
||||||
)}
|
|
||||||
</ErrorBoundary>
|
|
||||||
<ErrorBoundary
|
|
||||||
fallback={
|
|
||||||
<div className="error">
|
|
||||||
<Typography>Error with Libraries</Typography>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{upNextItems.isPending ? (
|
|
||||||
<CardsSkeleton />
|
|
||||||
) : upNextItems.isSuccess && !upNextItems.data.TotalRecordCount ? (
|
|
||||||
<></>
|
|
||||||
) : (
|
|
||||||
<CardScroller displayCards={4} title="Up Next">
|
|
||||||
{upNextItems.data?.Items?.map((item) => {
|
|
||||||
return (
|
|
||||||
<Card
|
|
||||||
key={item.Id}
|
|
||||||
item={item}
|
|
||||||
cardTitle={
|
|
||||||
item.Type === BaseItemKind.Episode
|
|
||||||
? item.SeriesName
|
|
||||||
: item.Name
|
|
||||||
}
|
|
||||||
imageType={
|
|
||||||
item.Type === BaseItemKind.Episode
|
|
||||||
? "Primary"
|
|
||||||
: item.ImageTags?.Thumb
|
|
||||||
? "Thumb"
|
|
||||||
: "Backdrop"
|
|
||||||
}
|
|
||||||
cardCaption={
|
|
||||||
item.Type === BaseItemKind.Episode
|
|
||||||
? item.ParentIndexNumber === 0
|
|
||||||
? `${item.SeasonName} - ${item.Name}`
|
|
||||||
: item.IndexNumberEnd
|
|
||||||
? `${item.IndexNumber}-${item.IndexNumberEnd}. ${item.Name}`
|
|
||||||
: `${item.IndexNumber}. ${item.Name}`
|
|
||||||
: item.Type === BaseItemKind.Series
|
|
||||||
? `${item.ProductionYear} - ${
|
|
||||||
item.EndDate
|
|
||||||
? new Date(item.EndDate).toLocaleString([], {
|
|
||||||
year: "numeric",
|
|
||||||
})
|
|
||||||
: "Present"
|
|
||||||
}`
|
|
||||||
: item.ProductionYear
|
|
||||||
}
|
|
||||||
cardType="thumb"
|
|
||||||
queryKey={["home", "upNext"]}
|
|
||||||
userId={user.data?.Id}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</CardScroller>
|
|
||||||
)}
|
|
||||||
</ErrorBoundary>
|
|
||||||
<ErrorBoundary
|
|
||||||
fallback={
|
|
||||||
<div className="error">
|
|
||||||
<Typography>Error with resumeItemsVideo</Typography>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{resumeItemsVideo.isPending ? (
|
|
||||||
<CardsSkeleton />
|
|
||||||
) : resumeItemsVideo.isSuccess &&
|
|
||||||
!resumeItemsVideo.data.TotalRecordCount ? (
|
|
||||||
<></>
|
|
||||||
) : (
|
|
||||||
<CardScroller displayCards={4} title="Continue Watching">
|
|
||||||
{resumeItemsVideo.data?.Items?.map((item) => {
|
|
||||||
return (
|
|
||||||
<Card
|
|
||||||
key={item.Id}
|
|
||||||
item={item}
|
|
||||||
cardTitle={
|
|
||||||
item.Type === BaseItemKind.Episode
|
|
||||||
? item.SeriesName
|
|
||||||
: item.Name
|
|
||||||
}
|
|
||||||
imageType={
|
|
||||||
item.Type === BaseItemKind.Episode
|
|
||||||
? "Primary"
|
|
||||||
: item.ImageTags?.Thumb
|
|
||||||
? "Thumb"
|
|
||||||
: "Backdrop"
|
|
||||||
}
|
|
||||||
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
|
|
||||||
}
|
|
||||||
cardType="thumb"
|
|
||||||
queryKey={["home", "resume", "video"]}
|
|
||||||
userId={user.data?.Id}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</CardScroller>
|
|
||||||
)}
|
|
||||||
</ErrorBoundary>
|
|
||||||
<ErrorBoundary
|
|
||||||
fallback={
|
|
||||||
<div className="error">
|
|
||||||
<Typography>Error with resumeItemsAudio</Typography>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{resumeItemsAudio.isPending ? (
|
|
||||||
<CardsSkeleton />
|
|
||||||
) : resumeItemsAudio.isSuccess &&
|
|
||||||
!resumeItemsAudio.data.TotalRecordCount ? (
|
|
||||||
<></>
|
|
||||||
) : (
|
|
||||||
<CardScroller displayCards={4} title="Continue Listening">
|
|
||||||
{resumeItemsAudio.data?.Items?.map((item) => {
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
key={item.Id}
|
key={item.Id}
|
||||||
item={item}
|
item={item}
|
||||||
cardTitle={item.Name}
|
cardTitle={item.Name}
|
||||||
imageType="Primary"
|
imageType="Primary"
|
||||||
cardCaption={item.ProductionYear}
|
|
||||||
cardType="thumb"
|
cardType="thumb"
|
||||||
queryKey={["home", "resume", "audio"]}
|
disableOverlay
|
||||||
userId={user.data?.Id}
|
onClick={() => {
|
||||||
|
if (item.Id) {
|
||||||
|
navigate({
|
||||||
|
to: "/library/$id",
|
||||||
|
params: { id: item.Id },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
overrideIcon={item.CollectionType}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
)}
|
)}
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
<ErrorBoundary
|
<ErrorBoundary
|
||||||
fallback={
|
fallback={
|
||||||
<div className="error">
|
<div className="error">
|
||||||
<Typography>Error with LatestMediaSections</Typography>
|
<Typography>Error with Libraries</Typography>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{latestMediaLibs?.map((lib) => {
|
{upNextItems.isPending ? (
|
||||||
return <LatestMediaSection key={lib.Id} latestMediaLib={lib} />;
|
<CardsSkeleton />
|
||||||
})}
|
) : upNextItems.isSuccess && !upNextItems.data?.TotalRecordCount ? (
|
||||||
</ErrorBoundary>
|
<></>
|
||||||
</main>
|
) : (
|
||||||
</>
|
<CardScroller displayCards={4} title="Up Next">
|
||||||
|
{upNextItems.data?.Items?.map((item) => {
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
key={item.Id}
|
||||||
|
item={item}
|
||||||
|
cardTitle={
|
||||||
|
item.Type === BaseItemKind.Episode
|
||||||
|
? item.SeriesName
|
||||||
|
: item.Name
|
||||||
|
}
|
||||||
|
imageType={
|
||||||
|
item.Type === BaseItemKind.Episode
|
||||||
|
? "Primary"
|
||||||
|
: item.ImageTags?.Thumb
|
||||||
|
? "Thumb"
|
||||||
|
: "Backdrop"
|
||||||
|
}
|
||||||
|
cardCaption={
|
||||||
|
item.Type === BaseItemKind.Episode
|
||||||
|
? item.ParentIndexNumber === 0
|
||||||
|
? `${item.SeasonName} - ${item.Name}`
|
||||||
|
: item.IndexNumberEnd
|
||||||
|
? `${item.IndexNumber}-${item.IndexNumberEnd}. ${item.Name}`
|
||||||
|
: `${item.IndexNumber}. ${item.Name}`
|
||||||
|
: item.Type === BaseItemKind.Series
|
||||||
|
? `${item.ProductionYear} - ${
|
||||||
|
item.EndDate
|
||||||
|
? new Date(item.EndDate).toLocaleString([], {
|
||||||
|
year: "numeric",
|
||||||
|
})
|
||||||
|
: "Present"
|
||||||
|
}`
|
||||||
|
: item.ProductionYear
|
||||||
|
}
|
||||||
|
cardType="thumb"
|
||||||
|
queryKey={["home", "upNext"]}
|
||||||
|
userId={user?.Id}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</CardScroller>
|
||||||
|
)}
|
||||||
|
</ErrorBoundary>
|
||||||
|
<ErrorBoundary
|
||||||
|
fallback={
|
||||||
|
<div className="error">
|
||||||
|
<Typography>Error with resumeItemsVideo</Typography>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{resumeItemsVideo.isPending ? (
|
||||||
|
<CardsSkeleton />
|
||||||
|
) : resumeItemsVideo.isSuccess &&
|
||||||
|
!resumeItemsVideo.data?.TotalRecordCount ? (
|
||||||
|
<></>
|
||||||
|
) : (
|
||||||
|
<CardScroller displayCards={4} title="Continue Watching">
|
||||||
|
{resumeItemsVideo.data?.Items?.map((item) => {
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
key={item.Id}
|
||||||
|
item={item}
|
||||||
|
cardTitle={
|
||||||
|
item.Type === BaseItemKind.Episode
|
||||||
|
? item.SeriesName
|
||||||
|
: item.Name
|
||||||
|
}
|
||||||
|
imageType={
|
||||||
|
item.Type === BaseItemKind.Episode
|
||||||
|
? "Primary"
|
||||||
|
: item.ImageTags?.Thumb
|
||||||
|
? "Thumb"
|
||||||
|
: "Backdrop"
|
||||||
|
}
|
||||||
|
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
|
||||||
|
}
|
||||||
|
cardType="thumb"
|
||||||
|
queryKey={["home", "resume", "video"]}
|
||||||
|
userId={user?.Id}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</CardScroller>
|
||||||
|
)}
|
||||||
|
</ErrorBoundary>
|
||||||
|
<ErrorBoundary
|
||||||
|
fallback={
|
||||||
|
<div className="error">
|
||||||
|
<Typography>Error with resumeItemsAudio</Typography>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{resumeItemsAudio.isPending ? (
|
||||||
|
<CardsSkeleton />
|
||||||
|
) : resumeItemsAudio.isSuccess &&
|
||||||
|
!resumeItemsAudio.data?.TotalRecordCount ? (
|
||||||
|
<></>
|
||||||
|
) : (
|
||||||
|
<CardScroller displayCards={4} title="Continue Listening">
|
||||||
|
{resumeItemsAudio.data?.Items?.map((item) => {
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
key={item.Id}
|
||||||
|
item={item}
|
||||||
|
cardTitle={item.Name}
|
||||||
|
imageType="Primary"
|
||||||
|
cardCaption={item.ProductionYear}
|
||||||
|
cardType="thumb"
|
||||||
|
queryKey={["home", "resume", "audio"]}
|
||||||
|
userId={user?.Id}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</CardScroller>
|
||||||
|
)}
|
||||||
|
</ErrorBoundary>
|
||||||
|
<ErrorBoundary
|
||||||
|
fallback={
|
||||||
|
<div className="error">
|
||||||
|
<Typography>Error with LatestMediaSections</Typography>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{latestMediaLibs?.map((lib) => {
|
||||||
|
return <LatestMediaSection key={lib.Id} latestMediaLib={lib} />;
|
||||||
|
})}
|
||||||
|
</ErrorBoundary>
|
||||||
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default React.memo(Home);
|
export default Home;
|
||||||