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.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**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]
|
||||
|
||||
- OS: [e.g. Windows]
|
||||
- Version [e.g. v0.0.6-dev]
|
||||
- Jellyfin Version [e.g. 10.9]
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
@@ -107,7 +107,7 @@ jobs:
|
||||
run: pnpm install --no-frozen-lockfile
|
||||
|
||||
- name: Build app
|
||||
run: pnpm run tauri build
|
||||
run: pnpm run tauri build --debug
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
|
||||
@@ -119,4 +119,4 @@ jobs:
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
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
|
||||
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
|
||||
uses: swatinem/rust-cache@v2
|
||||
@@ -78,3 +81,4 @@ jobs:
|
||||
releaseBody: "See the assets to download and install this version."
|
||||
releaseDraft: true
|
||||
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
|
||||
# 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
|
||||
**/*.rs.bk
|
||||
|
||||
# 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",
|
||||
"[scss]": {
|
||||
"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)
|
||||
> **Note** : This is an unstable release
|
||||
- feat: add video player slider bubble theming #337
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||

|
||||
<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 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 License" src="https://img.shields.io/github/license/prayag17/JellyPlayer?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 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/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/Blink?style=for-the-badge&labelColor=000">
|
||||
<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>
|
||||
|
||||
###
|
||||
@@ -42,7 +42,7 @@
|
||||
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
|
||||
|
||||
@@ -64,17 +64,17 @@
|
||||
## 📷 Screenshots
|
||||
|
||||
- Home
|
||||

|
||||

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

|
||||

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

|
||||

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

|
||||

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

|
||||

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

|
||||

|
||||
|
||||
## 📃 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": {
|
||||
"enabled": true
|
||||
},
|
||||
@@ -21,6 +21,9 @@
|
||||
},
|
||||
"suspicious": {
|
||||
"noExplicitAny": "off"
|
||||
},
|
||||
"nursery": {
|
||||
"useComponentExportOnlyModules": "error"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -4,61 +4,39 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<!-- <script src="http://localhost:8097"></script> -->
|
||||
<title>Jellyplayer</title>
|
||||
<script src="http://localhost:8097"></script>
|
||||
<title>Blink</title>
|
||||
<style>
|
||||
.app-loading {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
background: #fff;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%,-50%);
|
||||
width: 10em;
|
||||
height: 10em;
|
||||
background: rgb(180 180 180);
|
||||
z-index: 100000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
transition: opacity 0.25s ease-in-out;
|
||||
opacity: 0;
|
||||
animation: fadeIn linear 500ms forwards;
|
||||
mask-image: url("./src/assets/icon-outline.png");
|
||||
mask-size: contain;
|
||||
}
|
||||
|
||||
.app-loading.hidden {
|
||||
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{
|
||||
width: 100%;
|
||||
.app-loading-anim{
|
||||
width: 150%;
|
||||
height: 100%;
|
||||
background: #101010;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background: linear-gradient(to right,transparent,rgb(255 255 255),transparent);
|
||||
transform: scaleX(0);
|
||||
animation: loading 1s ease-in-out infinite both;
|
||||
animation: loading 0.75s linear infinite both;
|
||||
transform-origin: left;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
0%{
|
||||
opacity: 0;
|
||||
}
|
||||
100%{
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@keyframes loading {
|
||||
0%{
|
||||
transform: translate(-100%);
|
||||
@@ -75,10 +53,8 @@
|
||||
|
||||
<body>
|
||||
<div class="app-loading">
|
||||
<img src="./src/assets/icon-outline.svg" class="app-loading-logo" />
|
||||
<div class="app-loading-bar-container">
|
||||
<div class="app-loading-bar"></div>
|
||||
</div>
|
||||
<!-- <img src="./src/assets/icon-outline.svg" class="app-loading-logo" /> -->
|
||||
<div class="app-loading-anim"></div>
|
||||
</div>
|
||||
<div id="root"></div>
|
||||
<svg style="width: 0; height: 0; position: absolute" aria-hidden="true" focusable="false">
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
{
|
||||
"version": "0.0.5-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",
|
||||
"pub_date": "2024-03-17T11:50:31.121Z",
|
||||
"platforms": {
|
||||
"darwin-x86_64": {
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVROHVTNk5NMHU2bVZjYWVCcmxtUk5tRTV0bC9acGxUQkdGMlMrVFdkOVJCS3ZsMlY1aXR0M3BvdnBVTnl6MUVpcWsxUzdFbVNXbHF5S1pQbTZIM0JXallCeklYaUdyWFFBPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzEwNjc1OTMxCWZpbGU6SmVsbHlQbGF5ZXIuYXBwLnRhci5negpGM2xCQnR1YWhDWi9mMCtLZjFHQ0twMUNub3VBTHE2SHZSMnpGOVRWVGVncE42ODZ5Q2M1bm9aa3VGUFhpM245eVhIMDZWWkRyQnVMaWY4c1Z2WE5Edz09Cg==",
|
||||
"url": "https://github.com/prayag17/JellyPlayer/releases/download/v0.0.5-dev/JellyPlayer_x64.app.tar.gz"
|
||||
},
|
||||
"linux-x86_64": {
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVROHVTNk5NMHU2bVMvOXE1SGNiWmRDVWVMYVBLTnU4MXJheTd4NmY2WWszRjdUcnRySnl5TkdEVThYa1lHNHRXT1FIUzFwelhMZ3U4S2lJTjI4Y1IrV05iOVRmZWgzS1FrPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzEwNjc2MDE4CWZpbGU6amVsbHktcGxheWVyXzAuMC41LWRldl9hbWQ2NC5BcHBJbWFnZS50YXIuZ3oKcko3VUZFZVcwcVVZK0IwY3lZUlk5WThySjI2NEptY1BFb1dYYlRDMTQxZzFJekovS2tHVFMwK0pTS01JV3NSMWxvL2QwNEVqb2VTZVE2MmQ2UFhXQ1E9PQo=",
|
||||
"url": "https://github.com/prayag17/JellyPlayer/releases/download/v0.0.5-dev/jelly-player_0.0.5-dev_amd64.AppImage.tar.gz"
|
||||
},
|
||||
"windows-x86_64": {
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVROHVTNk5NMHU2bVZyK3o0d0FWVURRcDg3QnorYzNDUVNwamJIZ2JDTTNwUjdFUS9jMXN2cVFiVXNKdFNoaVNUUFlSaVI2Z3dyeEdqWmRCekFqSkYwa09xTFZSaG5mb1FRPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzEwNjc2MjIxCWZpbGU6SmVsbHlQbGF5ZXJfMC4wLjUtZGV2X3g2NC1zZXR1cC5uc2lzLnppcApPdGxzdk1aU0pJSC80a2xvYk5TbWhJeUNvVjNDa2piYkNQOTF0bmFWVTJ6TFVNc0trRkhqeUNxdGNNNUQvUXd4TUpXTzNoRHd1QUN2YnN5Y1BUTGVDQT09Cg==",
|
||||
"url": "https://github.com/prayag17/JellyPlayer/releases/download/v0.0.5-dev/JellyPlayer_0.0.5-dev_x64-setup.nsis.zip"
|
||||
}
|
||||
}
|
||||
"version": "0.0.7-dev",
|
||||
"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-11-20T07:04:53.965Z",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSNkxEL1dFMElZL2RHaC9wc3VMQzJxeFRYaHVVN0xEZW91WWgwZkluYkYrdW5hUWl2UFlSeEUyRk93dm13WUdmQVZETWhmNW9MZ2lPUFdOdERzbGFibkpPNHJWMU1BYlFrPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzMyMDg1ODYyCWZpbGU6QmxpbmsuYXBwLnRhci5negpjK0VIaW9oVzlrUU92UWZudzcvRGlZNExwM0NOdmpHVGd1QUc2WWZ0bnRkU2NsWkdqQUJrR01ucVVRTktvR0RaV0l0L09KQ2luZHNUdjMvTGVlM2RCUT09Cg==",
|
||||
"url": "https://github.com/prayag17/Blink/releases/download/v0.0.7-dev/Blink_aarch64.app.tar.gz"
|
||||
},
|
||||
"linux-x86_64": {
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSNkxEL1dFMElZL1hKZGoxZFUvZzl5SmNnUEFRTGQ2TmFNMlphK25lTU9MTjJEM0JYQWt0Sy91Um9yRmk4QTl6dEtUSmRuRmFNODRwajJ2YW4rTGJzYVZjcmhFb1IxZkFnPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzMyMDg2MTQxCWZpbGU6QmxpbmtfMC4wLjctZGV2X2FtZDY0LkFwcEltYWdlCndKZURUdjF0bkNna1VCVDNEMFNodEZBZGkzZFBKVWx2cThSNE5najBmd2U5Rzh5SDFIbUxqRHlKOWdxMnY2QU9NdTRiQmtWY2VVaVlhNjRrNDVHMUFRPT0K",
|
||||
"url": "https://github.com/prayag17/Blink/releases/download/v0.0.7-dev/Blink_0.0.7-dev_amd64.AppImage"
|
||||
},
|
||||
"windows-x86_64": {
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSNkxEL1dFMElZL1MwRVJ0UXBUUEYvd01JbXhBalFwQ0w5bEdkZkdlblZNeW1EMXQxajhYeVd0cERWcnhWOWFOaXV4Q0hDU1VRTEhabXF1ekFIbzB0KzRmL0pxdEIzMEFrPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzMyMDg2Mjg5CWZpbGU6QmxpbmtfMC4wLjctZGV2X3g2NC1zZXR1cC5uc2lzLnppcApJMmRORUFhV3NKV3BCTTliQkIwcWtSZStKTzEwY002QndCWmxKb0ZRd2p2K0cvek90dmdsbmQ0MHhNOVJsWnE3Y29qQmNDckdxdUNabWpTWjJ3d0xBUT09Cg==",
|
||||
"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",
|
||||
"private": true,
|
||||
"version": "0.0.6-dev",
|
||||
"version": "1.0.0-alpha.3",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite && tsr watch",
|
||||
"dev": "vite --force && tsr watch",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"tauri": "tauri",
|
||||
@@ -13,35 +13,46 @@
|
||||
"tanstack-router-dev": "tsr watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.13.3",
|
||||
"@emotion/styled": "^11.13.0",
|
||||
"@fontsource-variable/jetbrains-mono": "^5.0.22",
|
||||
"@fontsource-variable/noto-sans": "^5.0.5",
|
||||
"@jellyfin/sdk": "0.10.0",
|
||||
"@million/lint": "1.0.0-rc.84",
|
||||
"@mui/lab": "6.0.0-beta.9",
|
||||
"@mui/material": "6.0.2",
|
||||
"@react-spring/web": "^9.7.4",
|
||||
"@tanem/react-nprogress": "^5.0.51",
|
||||
"@tanstack/react-query": "^5.55.0",
|
||||
"@tanstack/react-query-devtools": "^5.55.0",
|
||||
"@tanstack/react-router": "^1.56.1",
|
||||
"@tanstack/react-virtual": "^3.10.7",
|
||||
"@tauri-apps/api": "2.0.0-beta.15",
|
||||
"@tauri-apps/plugin-clipboard-manager": "2.1.0-beta.5",
|
||||
"@tauri-apps/plugin-process": "2.0.0-rc.1",
|
||||
"@dnd-kit/core": "^6.2.0",
|
||||
"@dnd-kit/modifiers": "^8.0.0",
|
||||
"@dnd-kit/sortable": "^9.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@emotion/react": "^11.13.5",
|
||||
"@emotion/styled": "^11.13.5",
|
||||
"@fontsource-variable/jetbrains-mono": "^5.1.1",
|
||||
"@fontsource-variable/noto-sans": "^5.1.0",
|
||||
"@fontsource-variable/plus-jakarta-sans": "^5.1.0",
|
||||
"@fontsource-variable/space-grotesk": "^5.1.0",
|
||||
"@jellyfin/sdk": "0.11.0",
|
||||
"@million/lint": "^1.0.13",
|
||||
"@mui/lab": "6.0.0-beta.17",
|
||||
"@mui/material": "6.1.9",
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@react-spring/web": "^9.7.5",
|
||||
"@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-updater": "2.0.0-rc.2",
|
||||
"@types/node": "^22.5.4",
|
||||
"@types/react": "^18.3.5",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"axios": "^1.7.7",
|
||||
"axios-tauri-api-adapter": "^0.2.2",
|
||||
"@tauri-apps/plugin-updater": "2.0.0",
|
||||
"@tauri-apps/plugin-upload": "2.1.0",
|
||||
"@types/node": "^22.10.1",
|
||||
"@types/react": "^18.3.12",
|
||||
"@types/react-dom": "^18.3.1",
|
||||
"axios": "^1.7.8",
|
||||
"axios-tauri-api-adapter": "^2.0.3",
|
||||
"blurhash": "^2.0.5",
|
||||
"framer-motion": "^11.5.4",
|
||||
"framer-motion": "^11.12.0",
|
||||
"immer": "^10.1.1",
|
||||
"jassub": "^1.7.17",
|
||||
"lodash": "^4.17.21",
|
||||
"material-symbols": "^0.23.0",
|
||||
"material-symbols": "^0.27.1",
|
||||
"million": "^3.1.11",
|
||||
"notistack": "^3.0.1",
|
||||
"react": "18.3.1",
|
||||
@@ -49,29 +60,31 @@
|
||||
"react-dnd": "^16.0.1",
|
||||
"react-dnd-html5-backend": "^16.0.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-multi-carousel": "^2.8.5",
|
||||
"react-player": "^2.16.0",
|
||||
"react-popper": "^2.3.0",
|
||||
"react-use-konami": "^1.1.0",
|
||||
"remark-gfm": "^4.0.0",
|
||||
"typescript": "^5.5.4",
|
||||
"vite-plugin-svgr": "^4.2.0",
|
||||
"wavesurfer.js": "^7.8.4",
|
||||
"zustand": "^4.5.5"
|
||||
"typescript": "^5.7.2",
|
||||
"vite-plugin-svgr": "^4.3.0",
|
||||
"wavesurfer.js": "^7.8.10",
|
||||
"zustand": "5.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/plugin-proposal-optional-chaining-assign": "^7.24.7",
|
||||
"@biomejs/biome": "^1.8.3",
|
||||
"@tanstack/router-cli": "^1.56.1",
|
||||
"@tanstack/router-devtools": "^1.56.1",
|
||||
"@tanstack/router-vite-plugin": "^1.56.1",
|
||||
"@tauri-apps/cli": "2.0.0-beta.22",
|
||||
"@types/lodash": "^4.17.7",
|
||||
"@vitejs/plugin-react": "^4.3.1",
|
||||
"@babel/plugin-proposal-optional-chaining-assign": "^7.25.9",
|
||||
"@biomejs/biome": "^1.9.4",
|
||||
"@tanstack/router-cli": "^1.84.4",
|
||||
"@tanstack/router-devtools": "^1.85.0",
|
||||
"@tanstack/router-vite-plugin": "^1.84.4",
|
||||
"@tauri-apps/cli": "2.1.0",
|
||||
"@types/lodash": "^4.17.13",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"prop-types": "^15.8.1",
|
||||
"sass": "^1.78.0",
|
||||
"vite": "^5.4.3"
|
||||
"sass": "^1.81.0",
|
||||
"vite": "^6.0.2"
|
||||
},
|
||||
"license": "GPL-3.0-only"
|
||||
}
|
||||
|
After Width: | Height: | Size: 287 KiB |
@@ -1,10 +1,10 @@
|
||||
[package]
|
||||
name = "blink"
|
||||
version = "0.0.6-dev"
|
||||
version = "1.0.0-alpha.3"
|
||||
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"
|
||||
repository = "https://github.com/prayag17/JellyPlayer/"
|
||||
repository = "https://github.com/prayag17/Blink/"
|
||||
default-run = "blink"
|
||||
edition = "2021"
|
||||
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-updater = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||
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]
|
||||
# by default Tauri runs in production mode
|
||||
|
||||
@@ -12,6 +12,11 @@
|
||||
"store:allow-keys",
|
||||
"store:allow-load",
|
||||
"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() {
|
||||
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_log::Builder::default()
|
||||
@@ -15,5 +18,5 @@ fn main() {
|
||||
.plugin(tauri_plugin_updater::Builder::default().build())
|
||||
// .plugin(tauri_plugin_window_state::Builder::default().build())
|
||||
.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": {
|
||||
"beforeBuildCommand": "pnpm run build",
|
||||
"beforeDevCommand": "pnpm run dev",
|
||||
"frontendDist": "../dist",
|
||||
"devUrl": "http://localhost:5173"
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"category": "Video",
|
||||
"copyright": "GPL-3.0-only",
|
||||
"windows": {
|
||||
"certificateThumbprint": null,
|
||||
"digestAlgorithm": "sha256",
|
||||
"timestampUrl": "",
|
||||
"nsis": {
|
||||
"sidebarImage": "../public/installerSideBarImage.bmp",
|
||||
"headerImage": "../public/installerHeaderImage.bmp",
|
||||
"installerIcon": "icons/icon.ico",
|
||||
"displayLanguageSelector": true
|
||||
}
|
||||
},
|
||||
"externalBin": [],
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"linux": {
|
||||
"deb": {
|
||||
"depends": []
|
||||
},
|
||||
"appimage": {
|
||||
"bundleMediaFramework": true
|
||||
}
|
||||
},
|
||||
"longDescription": "A modern desktop client for Jellyfin",
|
||||
"macOS": {
|
||||
"entitlements": null,
|
||||
"exceptionDomain": "",
|
||||
"frameworks": [],
|
||||
"providerShortName": null,
|
||||
"signingIdentity": null
|
||||
},
|
||||
"resources": [],
|
||||
"shortDescription": "Blink",
|
||||
"targets": [
|
||||
"deb",
|
||||
"appimage",
|
||||
"nsis",
|
||||
"app",
|
||||
"dmg"
|
||||
],
|
||||
"licenseFile": "../LICENSE",
|
||||
"createUpdaterArtifacts": "v1Compatible"
|
||||
},
|
||||
"productName": "Blink",
|
||||
"version": "../package.json",
|
||||
"identifier": "com.blink.prayag17",
|
||||
"plugins": {
|
||||
"updater": {
|
||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEZEMTg0MjEzRDYzRjJDN0EKUldSNkxEL1dFMElZL1dxbHA0V2lyVDFEdGpOZXkxMG9XdHVLVnRpVVV5c1Z0OFNRUE45dkpxbFAK",
|
||||
"endpoints": [
|
||||
"https://raw.githack.com/prayag17/JellyPlayer/main/latest.json"
|
||||
]
|
||||
}
|
||||
},
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"fullscreen": false,
|
||||
"height": 600,
|
||||
"width": 800,
|
||||
"resizable": true,
|
||||
"title": "Blink",
|
||||
"visible": true,
|
||||
"center": true,
|
||||
"label": "main",
|
||||
"dragDropEnabled": false
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
"csp": null
|
||||
}
|
||||
}
|
||||
}
|
||||
"build": {
|
||||
"beforeBuildCommand": "pnpm run build",
|
||||
"beforeDevCommand": "pnpm run dev",
|
||||
"frontendDist": "../dist",
|
||||
"devUrl": "http://localhost:5173"
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"category": "Video",
|
||||
"copyright": "GPL-3.0-only",
|
||||
"windows": {
|
||||
"certificateThumbprint": null,
|
||||
"digestAlgorithm": "sha256",
|
||||
"timestampUrl": "",
|
||||
"nsis": {
|
||||
"sidebarImage": "../public/installerSideBarImage.bmp",
|
||||
"headerImage": "../public/installerHeaderImage.bmp",
|
||||
"installerIcon": "icons/icon.ico",
|
||||
"displayLanguageSelector": true
|
||||
}
|
||||
},
|
||||
"externalBin": [],
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"linux": {
|
||||
"deb": {
|
||||
"depends": []
|
||||
},
|
||||
"appimage": {
|
||||
"bundleMediaFramework": true
|
||||
}
|
||||
},
|
||||
"longDescription": "A modern desktop client for Jellyfin",
|
||||
"macOS": {
|
||||
"entitlements": null,
|
||||
"exceptionDomain": "",
|
||||
"frameworks": [],
|
||||
"providerShortName": null,
|
||||
"signingIdentity": null
|
||||
},
|
||||
"resources": [],
|
||||
"shortDescription": "Blink",
|
||||
"targets": ["deb", "appimage", "nsis", "app", "dmg"],
|
||||
"licenseFile": "../LICENSE",
|
||||
"createUpdaterArtifacts": "v1Compatible"
|
||||
},
|
||||
"productName": "Blink",
|
||||
"version": "../package.json",
|
||||
"identifier": "com.blink.prayag17",
|
||||
"plugins": {
|
||||
"updater": {
|
||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEZEMTg0MjEzRDYzRjJDN0EKUldSNkxEL1dFMElZL1dxbHA0V2lyVDFEdGpOZXkxMG9XdHVLVnRpVVV5c1Z0OFNRUE45dkpxbFAK",
|
||||
"endpoints": [
|
||||
"https://rawcdn.githack.com/prayag17/Blink/refs/heads/main/latest.json"
|
||||
],
|
||||
"windows": {
|
||||
"installMode": "passive"
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"fullscreen": false,
|
||||
"height": 600,
|
||||
"width": 800,
|
||||
"resizable": true,
|
||||
"title": "Blink",
|
||||
"visible": true,
|
||||
"center": true,
|
||||
"label": "main",
|
||||
"dragDropEnabled": false,
|
||||
"backgroundColor": "#08001f"
|
||||
}
|
||||
],
|
||||
"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">
|
||||
<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"/>
|
||||
<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="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>
|
||||
|
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, {
|
||||
type ReactNode,
|
||||
useCallback,
|
||||
@@ -11,12 +10,7 @@ import { useSpring } from "@react-spring/web";
|
||||
import { debounce } from "lodash";
|
||||
|
||||
import "./style.scss";
|
||||
import { Button, IconButton } from "@mui/material";
|
||||
|
||||
enum Direction {
|
||||
RIGHT = 0,
|
||||
LEFT = 1,
|
||||
}
|
||||
import { IconButton } from "@mui/material";
|
||||
|
||||
const Slider = ({
|
||||
content,
|
||||
@@ -76,7 +70,7 @@ const Slider = ({
|
||||
},
|
||||
}));
|
||||
|
||||
const slide = (direction: Direction) => {
|
||||
const slideLeft = useCallback(() => {
|
||||
const clientWidth =
|
||||
containerRef.current?.getBoundingClientRect().width ?? 0;
|
||||
const cardWidth =
|
||||
@@ -86,66 +80,75 @@ const Slider = ({
|
||||
const visibleItems = Math.floor(clientWidth / cardWidth);
|
||||
const scrollOffset = scrollPosition % cardWidth;
|
||||
|
||||
if (direction === Direction.LEFT) {
|
||||
const newX = Math.max(
|
||||
scrollPosition - scrollOffset - visibleItems * cardWidth,
|
||||
0,
|
||||
);
|
||||
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: 1000, velocity: 2 },
|
||||
});
|
||||
const newX = Math.max(
|
||||
scrollPosition - scrollOffset - visibleItems * cardWidth,
|
||||
0,
|
||||
);
|
||||
setX({
|
||||
from: { x: scrollPosition },
|
||||
to: { x: newX },
|
||||
onChange: (results) => {
|
||||
if (containerRef.current) {
|
||||
containerRef.current.scrollLeft = results.value.x;
|
||||
}
|
||||
},
|
||||
reset: true,
|
||||
config: { friction: 60, tension: 1000, velocity: 2 },
|
||||
});
|
||||
|
||||
if (newX === 0) {
|
||||
setScrollPos({ isStart: true, isEnd: false });
|
||||
} else {
|
||||
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 });
|
||||
}
|
||||
if (newX === 0) {
|
||||
setScrollPos({ isStart: true, isEnd: false });
|
||||
} 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 (
|
||||
<div className="slider">
|
||||
<IconButton
|
||||
className="slider-button left"
|
||||
onClick={() => slide(Direction.LEFT)}
|
||||
onClick={slideLeft}
|
||||
disabled={scrollPos.isStart}
|
||||
variant="contained"
|
||||
>
|
||||
<span className="material-symbols-rounded">chevron_left</span>
|
||||
</IconButton>
|
||||
<div className="slider-track" ref={containerRef} onScroll={onScroll}>
|
||||
{content?.map((item, index) => (
|
||||
<div
|
||||
//biome-ignore lint/suspicious/noArrayIndexKey: item does not have a unique key
|
||||
key={index}
|
||||
className={
|
||||
currentSlide === index
|
||||
@@ -159,9 +162,8 @@ const Slider = ({
|
||||
</div>
|
||||
<IconButton
|
||||
className="slider-button right"
|
||||
onClick={() => slide(Direction.RIGHT)}
|
||||
onClick={slideRight}
|
||||
disabled={scrollPos.isEnd}
|
||||
variant="contained"
|
||||
>
|
||||
<span className="material-symbols-rounded">chevron_right</span>
|
||||
</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 MuiAppBar from "@mui/material/AppBar";
|
||||
@@ -9,9 +14,13 @@ import Menu from "@mui/material/Menu";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
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 { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
@@ -22,6 +31,7 @@ import "./appBar.scss";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import {
|
||||
setSettingsDialogOpen,
|
||||
setSettingsTabValue,
|
||||
@@ -47,6 +57,7 @@ function ListItemLink(props: ListItemLinkProps) {
|
||||
|
||||
return (
|
||||
<li>
|
||||
{/* @ts-ignore */}
|
||||
<ListItem
|
||||
component={Link}
|
||||
activeClassName="active"
|
||||
@@ -69,32 +80,35 @@ function ListItemLink(props: ListItemLinkProps) {
|
||||
);
|
||||
}
|
||||
|
||||
const MemoizeBackButton = React.memo(BackButton);
|
||||
|
||||
export const AppBar = () => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const createApi = useApiInContext((s) => s.createApi);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [display, setDisplay] = useState(false);
|
||||
|
||||
const location = useLocation();
|
||||
const router = useRouter();
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
enabled: display && Boolean(api?.accessToken),
|
||||
throwOnError: true,
|
||||
});
|
||||
const [user, resetCurrentUser] = useCentralStore((s) => [
|
||||
s.currentUser,
|
||||
s.resetCurrentUser,
|
||||
]);
|
||||
const libraries = useQuery({
|
||||
queryKey: ["libraries"],
|
||||
queryFn: async () => {
|
||||
if (!user?.Id || !api?.accessToken) {
|
||||
return;
|
||||
}
|
||||
const libs = await getUserViewsApi(api).getUserViews({
|
||||
userId: user.data?.Id,
|
||||
userId: user.Id,
|
||||
});
|
||||
return libs.data;
|
||||
},
|
||||
enabled: !!user.data && !!api.accessToken,
|
||||
enabled: !!user?.Id && !!api?.accessToken,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
@@ -103,22 +117,28 @@ export const AppBar = () => {
|
||||
threshold: 20,
|
||||
});
|
||||
|
||||
const [anchorEl, setAnchorEl] = useState(null);
|
||||
const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);
|
||||
const openMenu = Boolean(anchorEl);
|
||||
const handleMenuOpen = (event) => {
|
||||
setAnchorEl(event.currentTarget);
|
||||
};
|
||||
const handleMenuClose = () => {
|
||||
const handleMenuOpen: MouseEventHandler<HTMLButtonElement> = useCallback(
|
||||
(event) => {
|
||||
setAnchorEl(event.currentTarget);
|
||||
},
|
||||
[],
|
||||
);
|
||||
const handleMenuClose = useCallback(() => {
|
||||
setAnchorEl(null);
|
||||
};
|
||||
|
||||
}, []);
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const handleLogout = async () => {
|
||||
console.log("Logging out user...");
|
||||
await api.logout();
|
||||
await api?.logout();
|
||||
createApi(api?.basePath ?? "", undefined);
|
||||
console.log(api);
|
||||
resetCurrentUser();
|
||||
delUser();
|
||||
sessionStorage.removeItem("accessToken");
|
||||
await router.invalidate();
|
||||
queryClient.clear();
|
||||
setAnchorEl(null);
|
||||
navigate({ to: "/login" });
|
||||
@@ -141,6 +161,43 @@ export const AppBar = () => {
|
||||
|
||||
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) {
|
||||
return <></>;
|
||||
}
|
||||
@@ -148,10 +205,7 @@ export const AppBar = () => {
|
||||
return (
|
||||
<>
|
||||
<MuiAppBar
|
||||
style={{
|
||||
backgroundColor: "transparent",
|
||||
paddingRight: "0 !important",
|
||||
}}
|
||||
style={appBarStyling}
|
||||
className={
|
||||
trigger
|
||||
? "appBar flex flex-row flex-justify-spaced-between elevated"
|
||||
@@ -161,11 +215,11 @@ export const AppBar = () => {
|
||||
color="transparent"
|
||||
>
|
||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||
<IconButton onClick={() => setShowDrawer(true)}>
|
||||
<IconButton onClick={handleDrawerOpen}>
|
||||
<div className="material-symbols-rounded">menu</div>
|
||||
</IconButton>
|
||||
<BackButton />
|
||||
<IconButton onClick={() => navigate({ to: "/home" })}>
|
||||
<MemoizeBackButton />
|
||||
<IconButton onClick={handleNavigateToHome}>
|
||||
<div
|
||||
className={
|
||||
location.pathname === "/home"
|
||||
@@ -179,19 +233,16 @@ export const AppBar = () => {
|
||||
</div>
|
||||
|
||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||
<IconButton onClick={() => navigate({ to: "/search" })}>
|
||||
<IconButton onClick={handleNavigateToSearch}>
|
||||
<div className="material-symbols-rounded">search</div>
|
||||
</IconButton>
|
||||
<IconButton onClick={() => navigate({ to: "/favorite" })}>
|
||||
<IconButton onClick={handleNavigateToFavorite}>
|
||||
<div className="material-symbols-rounded">favorite</div>
|
||||
</IconButton>
|
||||
<IconButton sx={{ p: 0 }} onClick={handleMenuOpen}>
|
||||
{user.isSuccess &&
|
||||
(user.data.PrimaryImageTag === undefined ? (
|
||||
<Avatar
|
||||
className="appBar-avatar"
|
||||
alt={user.data.Name ?? "image"}
|
||||
>
|
||||
<IconButton sx={menuButtonSx} onClick={handleMenuOpen}>
|
||||
{!!user?.Id &&
|
||||
(user?.PrimaryImageTag === undefined ? (
|
||||
<Avatar className="appBar-avatar" alt={user?.Name ?? "image"}>
|
||||
<span className="material-symbols-rounded appBar-avatar-icon">
|
||||
account_circle
|
||||
</span>
|
||||
@@ -199,8 +250,8 @@ export const AppBar = () => {
|
||||
) : (
|
||||
<Avatar
|
||||
className="appBar-avatar"
|
||||
src={`${api.basePath}/Users/${user.data.Id}/Images/Primary`}
|
||||
alt={user.data.Name ?? "image"}
|
||||
src={`${api?.basePath}/Users/${user?.Id}/Images/Primary`}
|
||||
alt={user?.Name ?? "image"}
|
||||
>
|
||||
<span className="material-symbols-rounded appBar-avatar-icon">
|
||||
account_circle
|
||||
@@ -212,7 +263,7 @@ export const AppBar = () => {
|
||||
anchorEl={anchorEl}
|
||||
open={openMenu}
|
||||
onClose={handleMenuClose}
|
||||
sx={{ mt: 2 }}
|
||||
sx={menuStyle}
|
||||
disableScrollLock
|
||||
>
|
||||
<MenuItem
|
||||
@@ -256,17 +307,14 @@ export const AppBar = () => {
|
||||
</MuiAppBar>
|
||||
<Drawer
|
||||
open={showDrawer}
|
||||
PaperProps={{
|
||||
className: "glass library-drawer",
|
||||
elevation: 6,
|
||||
}}
|
||||
PaperProps={drawerPaperProps}
|
||||
className="library-drawer"
|
||||
onClose={() => setShowDrawer(false)}
|
||||
onClose={handleDrawerClose}
|
||||
>
|
||||
<List>
|
||||
<ListItem>
|
||||
<ListItemButton
|
||||
onClick={() => setShowDrawer(false)}
|
||||
onClick={handleDrawerClose}
|
||||
style={{
|
||||
borderRadius: "100px",
|
||||
gap: "0.85em",
|
||||
@@ -281,12 +329,15 @@ export const AppBar = () => {
|
||||
<List>
|
||||
<ListItemLink to="/home" icon="home" primary="Home" />
|
||||
{libraries.isSuccess &&
|
||||
libraries.data.Items?.map((library, index) => (
|
||||
libraries.data?.Items?.map((library) => (
|
||||
<ListItemLink
|
||||
key={library.Id}
|
||||
to={`/library/${library.Id}`}
|
||||
icon={getTypeIcon(library.CollectionType)}
|
||||
primary={library.Name}
|
||||
icon={
|
||||
library.CollectionType &&
|
||||
getTypeIcon(library.CollectionType)
|
||||
}
|
||||
primary={library.Name ?? "Library"}
|
||||
/>
|
||||
))}
|
||||
</List>
|
||||
|
||||
@@ -1,28 +1,45 @@
|
||||
import AppBar from "@mui/material/AppBar";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
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 location = useLocation();
|
||||
|
||||
const handleBack = () => {
|
||||
history.go(-1);
|
||||
};
|
||||
|
||||
const hideQuickConnect = location.pathname === "/setup/server/list";
|
||||
|
||||
return (
|
||||
<AppBar elevation={0} color="transparent" position="fixed">
|
||||
<Toolbar>
|
||||
<IconButton
|
||||
size="large"
|
||||
edge="start"
|
||||
//@ts-ignore
|
||||
color="white"
|
||||
aria-label="back"
|
||||
disabled={history.length <= 1}
|
||||
onClick={handleBack}
|
||||
sx={{ mr: 2 }}
|
||||
>
|
||||
<span className="material-symbols-rounded">arrow_back</span>
|
||||
</IconButton>
|
||||
{!hideQuickConnect && (
|
||||
<QuickConnectButton
|
||||
sx={{
|
||||
marginLeft: "auto",
|
||||
flex: "none !important",
|
||||
borderRadius: "10px",
|
||||
}}
|
||||
color="secondary"
|
||||
/>
|
||||
)}
|
||||
</Toolbar>
|
||||
</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 (
|
||||
<IconButton onClick={handleClick}>
|
||||
<IconButton onClick={handleClick} disabled={history.length === 0}>
|
||||
<span className="material-symbols-rounded">arrow_back</span>
|
||||
</IconButton>
|
||||
);
|
||||
|
||||
@@ -1,50 +1,57 @@
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import React, { useEffect } from "react";
|
||||
import React from "react";
|
||||
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
|
||||
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 CircularProgress from "@mui/material/CircularProgress";
|
||||
import { pink } from "@mui/material/colors";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
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 queryClient = useQueryClient();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
const handleLiking = async () => {
|
||||
let result = null;
|
||||
let result: UserItemDataDto = null!;
|
||||
if (!api) return;
|
||||
if (!userId) return;
|
||||
if (!itemId) return;
|
||||
if (!itemName) return;
|
||||
if (isFavorite) {
|
||||
result = await getUserLibraryApi(api).unmarkFavoriteItem({
|
||||
userId: userId,
|
||||
itemId: itemId,
|
||||
});
|
||||
result = (
|
||||
await getUserLibraryApi(api).unmarkFavoriteItem({
|
||||
userId: userId,
|
||||
itemId: itemId,
|
||||
})
|
||||
).data;
|
||||
} else if (!isFavorite) {
|
||||
result = await getUserLibraryApi(api).markFavoriteItem({
|
||||
userId: userId,
|
||||
itemId: itemId,
|
||||
});
|
||||
result = (
|
||||
await getUserLibraryApi(api).markFavoriteItem({
|
||||
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({
|
||||
// mutationFn: async () => {
|
||||
// new Promise((resolve, reject) => {
|
||||
// setTimeout(() => {
|
||||
// resolve("foo");
|
||||
// }, 4000);
|
||||
// });
|
||||
// },
|
||||
mutationFn: handleLiking,
|
||||
onError: (error) => {
|
||||
enqueueSnackbar(`${error}`, {
|
||||
variant: "error",
|
||||
});
|
||||
enqueueSnackbar(`An error occured while updating "${itemName}"`, {
|
||||
variant: "error",
|
||||
});
|
||||
@@ -76,27 +83,19 @@ const LikeButton = ({ itemId, isFavorite, queryKey, userId, itemName }) => {
|
||||
style={
|
||||
isFavorite
|
||||
? {
|
||||
//@ts-ignore
|
||||
"--fill": mutation.isPending ? 0 : 1,
|
||||
color: mutation.isPending ? "white" : pink.A700,
|
||||
}
|
||||
}
|
||||
: {
|
||||
//@ts-ignore
|
||||
"--fill": mutation.isPending ? 1 : 0,
|
||||
color: mutation.isPending ? pink.A700 : "white",
|
||||
}
|
||||
}
|
||||
}
|
||||
>
|
||||
favorite
|
||||
</div>
|
||||
</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 CircularProgress from "@mui/material/CircularProgress";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
|
||||
import { green } from "@mui/material/colors";
|
||||
@@ -10,10 +7,21 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
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 queryClient = useQueryClient();
|
||||
@@ -21,6 +29,12 @@ const MarkPlayedButton = ({ itemId, isPlayed, queryKey, userId, itemName }) => {
|
||||
|
||||
const handleMarking = async () => {
|
||||
let result = null;
|
||||
if (!api) return;
|
||||
if (!api) return;
|
||||
if (!userId) return;
|
||||
if (!itemId) return;
|
||||
if (!itemName) return;
|
||||
|
||||
if (!isPlayed) {
|
||||
result = await getPlaystateApi(api).markPlayedItem({
|
||||
userId: userId,
|
||||
@@ -32,11 +46,11 @@ const MarkPlayedButton = ({ itemId, isPlayed, queryKey, userId, itemName }) => {
|
||||
itemId: itemId,
|
||||
});
|
||||
}
|
||||
return result;
|
||||
return result; // We need to return the result so that the onSettled function can invalidate the query
|
||||
};
|
||||
const mutation = useMutation({
|
||||
mutationFn: handleMarking,
|
||||
onError: (error, a, context) => {
|
||||
onError: (error) => {
|
||||
enqueueSnackbar(`${error}`, {
|
||||
variant: "error",
|
||||
});
|
||||
@@ -73,21 +87,12 @@ const MarkPlayedButton = ({ itemId, isPlayed, queryKey, userId, itemName }) => {
|
||||
? "white"
|
||||
: green.A700
|
||||
: mutation.isPending
|
||||
? green.A700
|
||||
: "white",
|
||||
? green.A700
|
||||
: "white",
|
||||
}}
|
||||
>
|
||||
done
|
||||
</div>
|
||||
</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 from "react";
|
||||
import React, { memo, type MouseEvent } from "react"; // Import memo
|
||||
|
||||
import Button, {
|
||||
type ButtonProps,
|
||||
type ButtonPropsSizeOverrides,
|
||||
} from "@mui/material/Button";
|
||||
import Button, { type ButtonProps } from "@mui/material/Button";
|
||||
import Fab from "@mui/material/Fab";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
import { playAudio } from "@/utils/store/audioPlayback";
|
||||
import { generateAudioStreamUrl, playAudio } from "@/utils/store/audioPlayback";
|
||||
import {
|
||||
type BaseItemDto,
|
||||
type BaseItemDtoQueryResult,
|
||||
BaseItemKind,
|
||||
ItemFields,
|
||||
MediaProtocol,
|
||||
ItemFilter,
|
||||
LocationType,
|
||||
type MediaSegmentDtoQueryResult,
|
||||
type PlaybackInfoResponse,
|
||||
SortOrder,
|
||||
type UserItemDataDto,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getDlnaApi } from "@jellyfin/sdk/lib/utils/api/dlna-api";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getPlaylistsApi } from "@jellyfin/sdk/lib/utils/api/playlists-api";
|
||||
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { useNavigate } from "@tanstack/react-router";
|
||||
import { useSnackbar } from "notistack";
|
||||
|
||||
import useQueue, { setQueue } from "@/utils/store/queue";
|
||||
import { setQueue } from "@/utils/store/queue";
|
||||
|
||||
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 getSubtitle from "@/utils/methods/getSubtitles";
|
||||
import playbackProfile from "@/utils/playback-profiles";
|
||||
import { axiosClient, useApiInContext } from "@/utils/store/api";
|
||||
import type IntroMediaInfo from "@/utils/types/introMediaInfo";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { usePhotosPlayback } from "@/utils/store/photosPlayback";
|
||||
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 { AxiosResponse } from "axios";
|
||||
|
||||
type PlayButtonProps = {
|
||||
item: BaseItemDto;
|
||||
itemId: string;
|
||||
itemUserData: UserItemDataDto;
|
||||
userId: string;
|
||||
userId: string | undefined;
|
||||
itemType: BaseItemKind;
|
||||
currentAudioTrack: number;
|
||||
currentVideoTrack: number;
|
||||
currentSubTrack: number | "nosub";
|
||||
className: string;
|
||||
sx: SxProps;
|
||||
buttonProps: ButtonProps;
|
||||
iconOnly: boolean;
|
||||
audio: boolean;
|
||||
size: ButtonPropsSizeOverrides;
|
||||
playlistItem: BaseItemDto;
|
||||
playlistItemId: string;
|
||||
trackIndex: number;
|
||||
currentAudioTrack?: number | "auto";
|
||||
currentVideoTrack?: number;
|
||||
currentSubTrack?: number | "nosub";
|
||||
className?: string;
|
||||
sx?: SxProps;
|
||||
buttonProps?: ButtonProps;
|
||||
iconOnly?: boolean;
|
||||
audio?: boolean;
|
||||
size?: "small" | "large" | "medium";
|
||||
playlistItem?: boolean;
|
||||
playlistItemId?: string;
|
||||
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 = ({
|
||||
item,
|
||||
itemId,
|
||||
itemUserData,
|
||||
userId,
|
||||
itemType,
|
||||
currentAudioTrack,
|
||||
@@ -79,7 +96,6 @@ const PlayButton = ({
|
||||
size = "large",
|
||||
playlistItem,
|
||||
playlistItemId = "",
|
||||
trackIndex,
|
||||
}: PlayButtonProps) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
|
||||
@@ -87,73 +103,105 @@ const PlayButton = ({
|
||||
const setPlaybackDataLoading = usePlaybackDataLoadStore(
|
||||
(state) => state.setisPending,
|
||||
);
|
||||
const playPhotos = usePhotosPlayback((s) => s.playPhotos);
|
||||
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
const itemQuery = useMutation({
|
||||
mutationKey: ["playButton", itemId, userId],
|
||||
mutationFn: async () => {
|
||||
mutationKey: ["playButton", item?.Id, userId],
|
||||
mutationFn: async (currentEpisodeId?: string) => {
|
||||
setPlaybackDataLoading(true);
|
||||
let result: undefined | AxiosResponse<BaseItemDtoQueryResult, any>;
|
||||
let mediaSource: undefined | AxiosResponse<PlaybackInfoResponse, any>;
|
||||
let introInfo: undefined | AxiosResponse<IntroMediaInfo, any>;
|
||||
const indexNumber = item.IndexNumber ? item.IndexNumber - 1 : 0;
|
||||
let introInfo: undefined | MediaSegmentDtoQueryResult;
|
||||
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) {
|
||||
result = await getPlaylistsApi(api).getPlaylistItems({
|
||||
userId: userId,
|
||||
playlistId: playlistItemId,
|
||||
});
|
||||
} else {
|
||||
console.log(itemType);
|
||||
switch (itemType) {
|
||||
case BaseItemKind.Episode:
|
||||
result = await getTvShowsApi(api).getEpisodes({
|
||||
seriesId: item.SeriesId,
|
||||
fields: [
|
||||
ItemFields.MediaSources,
|
||||
ItemFields.MediaStreams,
|
||||
ItemFields.Overview,
|
||||
ItemFields.Chapters,
|
||||
ItemFields.Trickplay,
|
||||
],
|
||||
enableUserData: true,
|
||||
userId: userId,
|
||||
seasonId: item.SeasonId,
|
||||
startItemId: item.Id,
|
||||
});
|
||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||
audioStreamIndex: currentAudioTrack,
|
||||
subtitleStreamIndex:
|
||||
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||
itemId: result.data.Items?.[indexNumber].Id,
|
||||
startTimeTicks:
|
||||
result.data.Items?.[indexNumber].UserData
|
||||
?.PlaybackPositionTicks,
|
||||
userId: userId,
|
||||
mediaSourceId:
|
||||
result.data.Items?.[indexNumber].MediaSources?.[0].Id,
|
||||
playbackInfoDto: {
|
||||
DeviceProfile: playbackProfile,
|
||||
},
|
||||
});
|
||||
try {
|
||||
introInfo = (
|
||||
await axiosClient.get(
|
||||
`${api.basePath}/Episode/${result.data.Items?.[0]?.Id}/IntroSkipperSegments`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `MediaBrowser Token=${api.accessToken}`,
|
||||
},
|
||||
if (item.SeriesId && item.SeasonId) {
|
||||
result = await getTvShowsApi(api).getEpisodes({
|
||||
seriesId: item.SeriesId,
|
||||
fields: [
|
||||
ItemFields.MediaSources,
|
||||
ItemFields.MediaStreams,
|
||||
ItemFields.Overview,
|
||||
ItemFields.Chapters,
|
||||
ItemFields.Trickplay,
|
||||
],
|
||||
enableUserData: true,
|
||||
userId: userId,
|
||||
seasonId: item.SeasonId,
|
||||
isMissing: false,
|
||||
// startItemId: item.Id,
|
||||
});
|
||||
|
||||
if (
|
||||
result.data.Items?.map((i) => i.Id).indexOf(
|
||||
currentEpisodeId,
|
||||
) === -1
|
||||
) {
|
||||
throw new Error(
|
||||
`Episode having id ${currentEpisodeId} not found, index return -1`,
|
||||
);
|
||||
}
|
||||
index =
|
||||
result.data.Items?.map((i) => i.Id).indexOf(currentEpisodeId) ??
|
||||
0;
|
||||
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?.[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;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
break;
|
||||
case BaseItemKind.Series:
|
||||
result = await getTvShowsApi(api).getEpisodes({
|
||||
seriesId: itemId,
|
||||
seriesId: item.Id,
|
||||
fields: [
|
||||
ItemFields.MediaSources,
|
||||
ItemFields.MediaStreams,
|
||||
@@ -163,44 +211,78 @@ const PlayButton = ({
|
||||
],
|
||||
enableUserData: true,
|
||||
userId: userId,
|
||||
isMissing: false,
|
||||
});
|
||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||
audioStreamIndex: currentAudioTrack,
|
||||
subtitleStreamIndex:
|
||||
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||
itemId: result.data.Items?.[0].Id,
|
||||
startTimeTicks:
|
||||
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
||||
userId: userId,
|
||||
mediaSourceId: result.data.Items?.[0].MediaSources?.[0].Id,
|
||||
playbackInfoDto: {
|
||||
DeviceProfile: playbackProfile,
|
||||
},
|
||||
});
|
||||
try {
|
||||
introInfo = (
|
||||
await axiosClient.get(
|
||||
`${api.basePath}/Episode/${result.data.Items?.[0]?.Id}/IntroSkipperSegments`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `MediaBrowser Token=${api.accessToken}`,
|
||||
},
|
||||
if (
|
||||
currentEpisodeId &&
|
||||
result.data.Items?.map((i) => i.Id).indexOf(currentEpisodeId) ===
|
||||
-1
|
||||
) {
|
||||
throw new Error(
|
||||
`Episode having id=${currentEpisodeId} not found, index return -1`,
|
||||
);
|
||||
}
|
||||
if (!currentEpisodeId) {
|
||||
index = 0;
|
||||
} else {
|
||||
index =
|
||||
result.data.Items?.map((i) => i.Id).indexOf(currentEpisodeId) ??
|
||||
0;
|
||||
}
|
||||
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,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
introInfo = (
|
||||
await getMediaSegmentsApi(api).getItemSegments({
|
||||
itemId: result.data.Items?.[index].Id ?? "",
|
||||
})
|
||||
)?.data;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
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;
|
||||
case BaseItemKind.Playlist:
|
||||
result = await getPlaylistsApi(api).getPlaylistItems({
|
||||
userId: userId,
|
||||
playlistId: playlistItemId,
|
||||
});
|
||||
break;
|
||||
case BaseItemKind.MusicAlbum:
|
||||
result = await getItemsApi(api).getItems({
|
||||
parentId: itemId,
|
||||
parentId: item.Id,
|
||||
userId: userId,
|
||||
fields: [ItemFields.MediaSources, ItemFields.MediaStreams],
|
||||
sortOrder: [SortOrder.Ascending],
|
||||
@@ -209,7 +291,7 @@ const PlayButton = ({
|
||||
break;
|
||||
case BaseItemKind.MusicArtist:
|
||||
result = await getItemsApi(api).getItems({
|
||||
artistIds: [itemId],
|
||||
artistIds: [item.Id ?? ""],
|
||||
recursive: true,
|
||||
includeItemTypes: [BaseItemKind.Audio],
|
||||
userId: userId,
|
||||
@@ -220,7 +302,7 @@ const PlayButton = ({
|
||||
break;
|
||||
case BaseItemKind.BoxSet:
|
||||
result = await getItemsApi(api).getItems({
|
||||
parentId: itemId,
|
||||
parentId: item.Id,
|
||||
userId,
|
||||
fields: [
|
||||
ItemFields.MediaSources,
|
||||
@@ -231,10 +313,67 @@ const PlayButton = ({
|
||||
sortOrder: [SortOrder.Ascending],
|
||||
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;
|
||||
default:
|
||||
result = await getItemsApi(api).getItems({
|
||||
ids: [itemId],
|
||||
ids: [item.Id ?? ""],
|
||||
userId: userId,
|
||||
fields: [
|
||||
ItemFields.MediaSources,
|
||||
@@ -245,59 +384,131 @@ const PlayButton = ({
|
||||
sortOrder: [SortOrder.Ascending],
|
||||
sortBy: ["IndexNumber"],
|
||||
});
|
||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||
audioStreamIndex: currentAudioTrack,
|
||||
subtitleStreamIndex:
|
||||
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||
itemId: itemId,
|
||||
startTimeTicks:
|
||||
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
||||
userId: userId,
|
||||
mediaSourceId: result.data.Items?.[0].MediaSources?.[0].Id,
|
||||
playbackInfoDto: {
|
||||
DeviceProfile: playbackProfile,
|
||||
},
|
||||
});
|
||||
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: item.Id ?? "",
|
||||
startTimeTicks:
|
||||
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;
|
||||
}
|
||||
}
|
||||
return { item: result?.data, mediaSource: mediaSource?.data, introInfo };
|
||||
return {
|
||||
item: result?.data,
|
||||
mediaSource: mediaSource?.data,
|
||||
introInfo,
|
||||
episodeIndex: index,
|
||||
};
|
||||
},
|
||||
onSuccess: (result: PlayResult | null) => {
|
||||
if (trackIndex) {
|
||||
// Playlist Playback
|
||||
enqueueSnackbar("Playlist playback is WIP", { variant: "info" });
|
||||
} else if (audio) {
|
||||
// Album/Individual audio track playback
|
||||
const urlOptions = {
|
||||
deviceId: api?.deviceInfo.id,
|
||||
userId,
|
||||
api_key: api?.accessToken,
|
||||
};
|
||||
const urlParams = new URLSearchParams(urlOptions).toString();
|
||||
if (!api) {
|
||||
console.error("API is not available");
|
||||
enqueueSnackbar("API is not available", { variant: "error" });
|
||||
return;
|
||||
}
|
||||
if (!userId) {
|
||||
console.error("User ID is not available");
|
||||
enqueueSnackbar("User ID is not available", { variant: "error" });
|
||||
return;
|
||||
}
|
||||
if (!result?.item?.Items?.length) {
|
||||
console.error("No items found");
|
||||
enqueueSnackbar("No items found", { variant: "error" });
|
||||
return;
|
||||
}
|
||||
if (!result?.item?.Items?.[0]?.Id) {
|
||||
console.error("No item ID found");
|
||||
enqueueSnackbar("No item ID found", { variant: "error" });
|
||||
return;
|
||||
}
|
||||
|
||||
const playbackUrl = `${api.basePath}/Audio/${result?.item.Items[0].Id}/universal?${urlParams}`;
|
||||
playAudio(playbackUrl, result?.item.Items[0], undefined);
|
||||
setQueue(result?.item.Items ?? [], 0);
|
||||
if (audio) {
|
||||
// Album/Individual audio track playback
|
||||
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 {
|
||||
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
|
||||
const queue = result?.item.Items;
|
||||
const queue = result?.item?.Items;
|
||||
|
||||
let itemName = item.Name;
|
||||
let episodeTitle = "";
|
||||
if (result?.item.Items?.[episodeIndex].SeriesId) {
|
||||
if (result?.item?.Items?.[episodeIndex].SeriesId) {
|
||||
itemName = result?.item.Items[episodeIndex].SeriesName;
|
||||
episodeTitle = `S${result?.item.Items[episodeIndex].ParentIndexNumber ?? 0}:E${
|
||||
result?.item.Items[episodeIndex].IndexNumber ?? 0
|
||||
} ${result?.item.Items[episodeIndex].Name}`;
|
||||
}
|
||||
|
||||
if (itemType === "BoxSet") {
|
||||
itemName = result.item.Items[0].Name;
|
||||
}
|
||||
|
||||
// Subtitle
|
||||
const subtitle = getSubtitle(
|
||||
currentSubTrack,
|
||||
result?.mediaSource.MediaSources?.[0].MediaStreams,
|
||||
result.mediaSource.MediaSources?.[0].DefaultSubtitleStreamIndex ?? -1,
|
||||
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
|
||||
const urlOptions = {
|
||||
const urlOptions: URLSearchParams = {
|
||||
//@ts-ignore
|
||||
Static: true,
|
||||
tag: result?.mediaSource.MediaSources?.[0].ETag,
|
||||
mediaSourceId: result?.mediaSource.MediaSources?.[0].Id,
|
||||
@@ -312,28 +523,32 @@ const PlayButton = ({
|
||||
) {
|
||||
playbackUrl = `${api.basePath}${result.mediaSource.MediaSources[0].TranscodingUrl}`;
|
||||
}
|
||||
let playItemValue = item;
|
||||
let playItemValue = result?.item?.Items?.[episodeIndex];
|
||||
if (itemType === BaseItemKind.Movie) {
|
||||
playItemValue = result?.item.Items?.[0];
|
||||
}
|
||||
playItemValue = result?.item?.Items?.[0];
|
||||
}
|
||||
|
||||
const startPosition =
|
||||
result?.item?.Items?.[episodeIndex].UserData?.PlaybackPositionTicks;
|
||||
|
||||
playItem(
|
||||
itemName,
|
||||
episodeTitle,
|
||||
currentVideoTrack,
|
||||
currentAudioTrack,
|
||||
currentVideoTrack ?? 0,
|
||||
Number(result.mediaSource.MediaSources?.[0].DefaultAudioStreamIndex),
|
||||
result?.mediaSource?.MediaSources?.[0].Container ?? "mkv",
|
||||
playbackUrl,
|
||||
userId,
|
||||
item.UserData?.PlaybackPositionTicks,
|
||||
item.RunTimeTicks,
|
||||
playItemValue,
|
||||
userId ?? "",
|
||||
startPosition,
|
||||
result?.item?.Items?.[episodeIndex].RunTimeTicks,
|
||||
playItemValue ?? item,
|
||||
queue,
|
||||
episodeIndex,
|
||||
result?.mediaSource.MediaSources?.[0]?.Id,
|
||||
result?.mediaSource.PlaySessionId,
|
||||
result?.mediaSource?.MediaSources?.[0]?.Id,
|
||||
result?.mediaSource?.PlaySessionId,
|
||||
subtitle,
|
||||
result?.introInfo,
|
||||
audio,
|
||||
);
|
||||
navigate({ to: "/player" });
|
||||
}
|
||||
@@ -348,17 +563,23 @@ const PlayButton = ({
|
||||
});
|
||||
},
|
||||
});
|
||||
const handleClick = (e) => {
|
||||
const handleClick = (
|
||||
e: MouseEvent<HTMLAnchorElement | MouseEvent>,
|
||||
currentEpisodeId?: string | undefined,
|
||||
) => {
|
||||
e.stopPropagation();
|
||||
itemQuery.mutate();
|
||||
itemQuery.mutate(currentEpisodeId);
|
||||
};
|
||||
if (iconOnly) {
|
||||
return (
|
||||
//@ts-ignore
|
||||
<Fab
|
||||
color="primary"
|
||||
aria-label="Play"
|
||||
className={className}
|
||||
onClick={handleClick}
|
||||
onClick={(e) =>
|
||||
item.Type === "Episode" ? handleClick(e, item.Id) : handleClick(e)
|
||||
}
|
||||
sx={sx}
|
||||
size={size}
|
||||
{...buttonProps}
|
||||
@@ -374,6 +595,116 @@ const PlayButton = ({
|
||||
</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 (
|
||||
<div
|
||||
className="play-button"
|
||||
@@ -385,7 +716,9 @@ const PlayButton = ({
|
||||
<Button
|
||||
className={className ?? "play-button"}
|
||||
variant="contained"
|
||||
onClick={handleClick}
|
||||
onClick={(e) =>
|
||||
item.Type === "Episode" ? handleClick(e, item.Id) : handleClick(e)
|
||||
}
|
||||
startIcon={
|
||||
<div
|
||||
className="material-symbols-rounded fill"
|
||||
@@ -402,10 +735,11 @@ const PlayButton = ({
|
||||
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}
|
||||
>
|
||||
{itemUserData?.PlaybackPositionTicks
|
||||
{item.UserData?.PlaybackPositionTicks
|
||||
? "Continue Watching"
|
||||
: item?.Type === "MusicAlbum" ||
|
||||
item?.Type === "Audio" ||
|
||||
@@ -414,29 +748,17 @@ const PlayButton = ({
|
||||
audio
|
||||
? "Play Now"
|
||||
: "Watch Now"}
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
<MemoizedLinearProgress
|
||||
//@ts-ignore
|
||||
value={
|
||||
100 > itemUserData?.PlayedPercentage > 0
|
||||
? itemUserData?.PlayedPercentage
|
||||
100 > (item.UserData?.PlayedPercentage ?? 100) &&
|
||||
(item.UserData?.PlayedPercentage ?? 0) > 0
|
||||
? item.UserData?.PlayedPercentage
|
||||
: 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>
|
||||
{itemUserData?.PlaybackPositionTicks > 0 && (
|
||||
{(item.UserData?.PlaybackPositionTicks ?? 0) > 0 && (
|
||||
<Typography
|
||||
sx={{
|
||||
opacity: 0.8,
|
||||
@@ -448,7 +770,8 @@ const PlayButton = ({
|
||||
variant="caption"
|
||||
>
|
||||
{getRuntimeCompact(
|
||||
item.RunTimeTicks - itemUserData.PlaybackPositionTicks,
|
||||
(item.RunTimeTicks ?? 0) -
|
||||
(item.UserData?.PlaybackPositionTicks ?? 0),
|
||||
)}{" "}
|
||||
left
|
||||
</Typography>
|
||||
|
||||
@@ -4,23 +4,23 @@ import useQueue from "@/utils/store/queue";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { IconButton } from "@mui/material";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
||||
import React from "react";
|
||||
|
||||
const PlayNextButton = () => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
if (!api) return;
|
||||
const result = await getUserApi(api).getCurrentUser();
|
||||
return result.data;
|
||||
},
|
||||
});
|
||||
const navigate = useNavigate();
|
||||
const handlePlayNext = useMutation({
|
||||
mutationKey: ["playNextButton"],
|
||||
mutationFn: () => playItemFromQueue("next", user.data?.Id, api),
|
||||
onError: (error) => [console.error(error)],
|
||||
onError: (error) => console.error(error),
|
||||
});
|
||||
const [queueItems, currentItemIndex] = useQueue((state) => [
|
||||
state.tracks,
|
||||
@@ -28,7 +28,7 @@ const PlayNextButton = () => {
|
||||
]);
|
||||
return (
|
||||
<IconButton
|
||||
disabled={queueItems.length === currentItemIndex + 1}
|
||||
disabled={queueItems?.length === currentItemIndex + 1}
|
||||
onClick={() => handlePlayNext.mutate()}
|
||||
>
|
||||
<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 { IconButton } from "@mui/material";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
import React from "react";
|
||||
|
||||
const PlayPreviousButton = () => {
|
||||
@@ -12,6 +11,7 @@ const PlayPreviousButton = () => {
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
if (!api) return;
|
||||
const result = await getUserApi(api).getCurrentUser();
|
||||
return result.data;
|
||||
},
|
||||
@@ -21,10 +21,7 @@ const PlayPreviousButton = () => {
|
||||
mutationFn: () => playItemFromQueue("previous", user.data?.Id, api),
|
||||
onError: (error) => [console.error(error)],
|
||||
});
|
||||
const [queueItems, currentItemIndex] = useQueue((state) => [
|
||||
state.tracks,
|
||||
state.currentItemIndex,
|
||||
]);
|
||||
const [currentItemIndex] = useQueue((state) => [state.currentItemIndex]);
|
||||
return (
|
||||
<IconButton
|
||||
disabled={currentItemIndex === 0}
|
||||
|
||||
@@ -44,6 +44,7 @@ $image-size: 5em;
|
||||
flex-direction: column;
|
||||
gap: 0.2em;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
&-item.Mui-disabled {
|
||||
|
||||
@@ -13,10 +13,11 @@ import { getTypeIcon } from "../utils/iconsCollection";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import "./queueButton.scss";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
const QueueButton = () => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
|
||||
const [queueItems, currentItemIndex] = useQueue((state) => [
|
||||
state.tracks,
|
||||
state.currentItemIndex,
|
||||
@@ -25,16 +26,17 @@ const QueueButton = () => {
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
if (!api) return;
|
||||
const result = await getUserApi(api).getCurrentUser();
|
||||
return result.data;
|
||||
},
|
||||
});
|
||||
const [buttonEl, setButtonEl] = useState(null);
|
||||
const [buttonEl, setButtonEl] = useState<HTMLButtonElement | null>(null);
|
||||
|
||||
const handlePlay = useMutation({
|
||||
mutationKey: ["handlePlayIndex"],
|
||||
mutationFn: async ({ index }: { index: number }) => {
|
||||
const result = playItemFromQueue(index, user.data?.Id);
|
||||
const result = playItemFromQueue(index, user.data?.Id, api);
|
||||
return result;
|
||||
},
|
||||
onSuccess: () => {
|
||||
@@ -76,82 +78,204 @@ const QueueButton = () => {
|
||||
position: "relative",
|
||||
}}
|
||||
>
|
||||
{queueItems.map((item, index) => {
|
||||
return (
|
||||
{queueItems?.[currentItemIndex]?.Id && (
|
||||
<>
|
||||
<Typography px="1em" mb={2} variant="h5" fontWeight={300}>
|
||||
Currently Playing:
|
||||
</Typography>
|
||||
<MenuItem
|
||||
className="queue-item"
|
||||
disabled={index === currentItemIndex}
|
||||
onClick={() => handlePlay.mutate({ index })}
|
||||
key={item.Id}
|
||||
disabled
|
||||
key={queueItems[currentItemIndex].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}`}
|
||||
{queueItems[currentItemIndex]?.Type === "Audio"
|
||||
? currentItemIndex + 1
|
||||
: queueItems[currentItemIndex].IndexNumberEnd
|
||||
? `S${queueItems[currentItemIndex].ParentIndexNumber}:E${queueItems[currentItemIndex].IndexNumber} / ${queueItems[currentItemIndex].IndexNumberEnd}`
|
||||
: `S${queueItems[currentItemIndex].ParentIndexNumber}:E${queueItems[currentItemIndex].IndexNumber}`}
|
||||
</Typography>
|
||||
<div className="queue-item-image-container">
|
||||
{item.ImageTags?.Primary ? (
|
||||
{queueItems[currentItemIndex].ImageTags?.Primary ? (
|
||||
<img
|
||||
className="queue-item-image"
|
||||
src={api?.getItemImageUrl(item?.Id, "Primary", {
|
||||
tag: item.ImageTags?.Primary,
|
||||
})}
|
||||
alt={item.Name}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
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
|
||||
className="queue-item-image"
|
||||
src={api?.getItemImageUrl(item?.AlbumId, "Primary", {
|
||||
tag: item.AlbumPrimaryImageTag[0],
|
||||
})}
|
||||
alt={item.Name}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
queueItems?.[currentItemIndex]?.AlbumId ?? "",
|
||||
"Primary",
|
||||
{
|
||||
tag: queueItems?.[currentItemIndex]
|
||||
.AlbumPrimaryImageTag?.[0],
|
||||
},
|
||||
)
|
||||
}
|
||||
alt={queueItems[currentItemIndex].Name ?? "image"}
|
||||
/>
|
||||
) : (
|
||||
<div className="queue-item-image-icon">
|
||||
{getTypeIcon(item.Type)}
|
||||
{queueItems[currentItemIndex].Type &&
|
||||
getTypeIcon(queueItems[currentItemIndex].Type)}
|
||||
</div>
|
||||
)}
|
||||
{index === currentItemIndex && (
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{
|
||||
position: "absolute",
|
||||
top: "50%",
|
||||
left: "50%",
|
||||
transform: "translate(-50%,-50%)",
|
||||
fontSize: "2em",
|
||||
"--wght": "100",
|
||||
}}
|
||||
>
|
||||
equalizer
|
||||
</span>
|
||||
)}
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{
|
||||
position: "absolute",
|
||||
top: "50%",
|
||||
left: "50%",
|
||||
transform: "translate(-50%,-50%)",
|
||||
fontSize: "2em",
|
||||
//@ts-ignore
|
||||
"--wght": "100",
|
||||
}}
|
||||
>
|
||||
equalizer
|
||||
</span>
|
||||
</div>
|
||||
<div className="queue-item-info">
|
||||
{item.SeriesName ? (
|
||||
{queueItems[currentItemIndex].SeriesName ? (
|
||||
<>
|
||||
<Typography variant="subtitle1" width="100%">
|
||||
{item.SeriesName}
|
||||
{queueItems[currentItemIndex].SeriesName}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
width="100%"
|
||||
style={{ opacity: 0.6 }}
|
||||
>
|
||||
{item.Name}
|
||||
{queueItems[currentItemIndex].Name}
|
||||
</Typography>
|
||||
</>
|
||||
) : (
|
||||
<Typography variant="subtitle1" width="100%">
|
||||
{item.Name}
|
||||
{queueItems[currentItemIndex].Name}
|
||||
</Typography>
|
||||
)}
|
||||
</div>
|
||||
</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>
|
||||
</Menu>
|
||||
<IconButton onClick={(e) => setButtonEl(e.currentTarget)}>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import useInterval from "@/utils/hooks/useInterval";
|
||||
import { saveUser } from "@/utils/storage/user";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { getQuickConnectApi } from "@jellyfin/sdk/lib/utils/api/quick-connect-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { LoadingButton } from "@mui/lab";
|
||||
import { LoadingButton, type LoadingButtonProps } from "@mui/lab";
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
@@ -11,45 +12,111 @@ import {
|
||||
DialogContent,
|
||||
DialogContentText,
|
||||
FormControlLabel,
|
||||
Slide,
|
||||
Tooltip,
|
||||
Typography,
|
||||
} 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 type { Timeout } from "@tanstack/react-router/dist/esm/utils";
|
||||
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
|
||||
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 createApi = useApiInContext((s) => s.createApi);
|
||||
// if (!api) {
|
||||
// console.error(
|
||||
// "Unable to display quick connect button, api is not available",
|
||||
// );
|
||||
// return null;
|
||||
// }
|
||||
|
||||
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 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 [quickConnectCode, setQuickConnectCode] = useState<string | null>();
|
||||
const [quickConnectSecret, setQuickConnectSecret] = useState<string | null>();
|
||||
const [checkForQuickConnect, setCheckForQuickConnect] = useState(false);
|
||||
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({
|
||||
mutationKey: ["quick-connect-button", "check-quick-connect-status"],
|
||||
mutationFn: async (secret: string) =>
|
||||
api &&
|
||||
(
|
||||
await getQuickConnectApi(api).getQuickConnectState(
|
||||
{ secret },
|
||||
{ headers },
|
||||
)
|
||||
).data,
|
||||
onSuccess: (result) => {
|
||||
if (result?.Authenticated) {
|
||||
setQuickConnectCode(null);
|
||||
initQuickConnect.reset();
|
||||
checkQuickConnectStatus.reset();
|
||||
authenticateUser.mutate();
|
||||
}
|
||||
},
|
||||
});
|
||||
const initQuickConnect = useMutation({
|
||||
mutationKey: ["quick-connect-button", "initiate-connection"],
|
||||
@@ -59,70 +126,65 @@ const QuickConnectButton = () => {
|
||||
variant: "error",
|
||||
});
|
||||
}
|
||||
return await getQuickConnectApi(api).initiateQuickConnect({ headers });
|
||||
if (api) {
|
||||
return await getQuickConnectApi(api).initiateQuickConnect({ headers });
|
||||
}
|
||||
},
|
||||
onSuccess: (result) => {
|
||||
setQuickConnectCode(result.data.Code);
|
||||
const authAwaitInterval = setInterval(async () => {
|
||||
// Check if user has been authenticated by the server
|
||||
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);
|
||||
setQuickConnectCode(result?.data.Code);
|
||||
setQuickConnectSecret(result?.data.Secret);
|
||||
setCheckForQuickConnect(true);
|
||||
},
|
||||
onError: (error) => {
|
||||
enqueueSnackbar("Error initiating Quick Connect.", { variant: "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 (
|
||||
<>
|
||||
<div style={{ marginLeft: "auto" }}>
|
||||
{/* @ts-ignore */}
|
||||
<LoadingButton
|
||||
{...props}
|
||||
disabled={
|
||||
quickConnectEnabled.isPending ||
|
||||
Boolean(!quickConnectEnabled.data?.data)
|
||||
}
|
||||
loading={
|
||||
loading={Boolean(
|
||||
initQuickConnect.isPending ||
|
||||
checkQuickConnectStatus.isPending ||
|
||||
(quickConnectCode && !checkQuickConnectStatus.data?.Authenticated)
|
||||
}
|
||||
variant="contained"
|
||||
size="large"
|
||||
style={{ flex: 1 }}
|
||||
checkQuickConnectStatus.isPending ||
|
||||
(quickConnectCode && !checkQuickConnectStatus.data?.Authenticated),
|
||||
)}
|
||||
variant={props.variant ?? "contained"}
|
||||
onClick={initQuickConnect.mutate}
|
||||
>
|
||||
Quick Connect
|
||||
{quickConnectEnabled.data?.data
|
||||
? "Use Quick Connect"
|
||||
: "Quick Connect Disabled"}
|
||||
</LoadingButton>
|
||||
<Dialog
|
||||
open={Boolean(quickConnectCode)}
|
||||
onClose={() => {
|
||||
setQuickConnectCode(null);
|
||||
clearInterval(quickConnectStatusInterval);
|
||||
}}
|
||||
onClose={handleQuickConnectClose}
|
||||
fullWidth
|
||||
maxWidth="xs"
|
||||
TransitionComponent={Transition}
|
||||
>
|
||||
<DialogContent
|
||||
style={{
|
||||
@@ -159,8 +221,8 @@ const QuickConnectButton = () => {
|
||||
borderRadius: "10px",
|
||||
cursor: "pointer",
|
||||
}}
|
||||
onClick={async (e) => {
|
||||
await writeText(quickConnectCode);
|
||||
onClick={async () => {
|
||||
quickConnectCode && (await writeText(quickConnectCode));
|
||||
enqueueSnackbar("Quick Connect Code copied!", {
|
||||
variant: "info",
|
||||
key: "copiedText",
|
||||
@@ -188,17 +250,12 @@ const QuickConnectButton = () => {
|
||||
}
|
||||
label="Remember device"
|
||||
/>
|
||||
<Button
|
||||
variant="contained"
|
||||
onClick={() => {
|
||||
setQuickConnectCode(null);
|
||||
}}
|
||||
>
|
||||
<Button variant="contained" onClick={handleQuickConnectClose}>
|
||||
Close
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ type TrailerButtonType = {
|
||||
const TrailerButton = (props: TrailerButtonType) => {
|
||||
const [dialog, setDialog] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<IconButton
|
||||
disabled={props.disabled ?? false}
|
||||
onClick={() => setDialog(true)}
|
||||
@@ -29,18 +29,20 @@ const TrailerButton = (props: TrailerButtonType) => {
|
||||
}}
|
||||
onClose={() => setDialog(false)}
|
||||
>
|
||||
<ReactPlayer
|
||||
playing={false}
|
||||
url={props.trailerItem[0]?.Url}
|
||||
width="100%"
|
||||
height="auto"
|
||||
style={{
|
||||
aspectRatio: "16/9",
|
||||
}}
|
||||
controls
|
||||
/>
|
||||
{props.trailerItem[0]?.Url && (
|
||||
<ReactPlayer
|
||||
playing={false}
|
||||
url={props.trailerItem[0]?.Url}
|
||||
width="100%"
|
||||
height="auto"
|
||||
style={{
|
||||
aspectRatio: "16/9",
|
||||
}}
|
||||
controls
|
||||
/>
|
||||
)}
|
||||
</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 */
|
||||
|
||||
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 {
|
||||
@@ -13,27 +11,16 @@ import {
|
||||
BaseItemKind,
|
||||
type ImageType,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { ErrorBoundary } from "react-error-boundary";
|
||||
import LikeButton from "../buttons/likeButton";
|
||||
import MarkPlayedButton from "../buttons/markPlayedButton";
|
||||
import PlayButton from "../buttons/playButton";
|
||||
import ErrorBoundary from "../errorBoundary";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
import "./card.scss";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
|
||||
const cardImageAspectRatios = {
|
||||
thumb: 1.777,
|
||||
portrait: 0.666,
|
||||
square: 1,
|
||||
};
|
||||
|
||||
const availableSpecialRoutes = [
|
||||
BaseItemKind.Series,
|
||||
BaseItemKind.BoxSet,
|
||||
BaseItemKind.MusicAlbum,
|
||||
BaseItemKind.Episode,
|
||||
BaseItemKind.Playlist,
|
||||
];
|
||||
import { useInView } from "react-intersection-observer";
|
||||
|
||||
const CardComponent = ({
|
||||
item,
|
||||
@@ -52,8 +39,8 @@ const CardComponent = ({
|
||||
item: BaseItemDto;
|
||||
cardTitle: string | undefined | null;
|
||||
cardCaption?: string | null | number;
|
||||
imageType: ImageType;
|
||||
cardType: string;
|
||||
imageType?: ImageType;
|
||||
cardType: "square" | "thumb" | "portrait";
|
||||
queryKey?: string[];
|
||||
userId?: string;
|
||||
seriesId?: string | null;
|
||||
@@ -65,36 +52,46 @@ const CardComponent = ({
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const navigate = useNavigate();
|
||||
const defaultOnClick = () => {
|
||||
switch (item.Type) {
|
||||
case BaseItemKind.BoxSet:
|
||||
navigate({ to: "/boxset/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Episode:
|
||||
navigate({ to: "/episode/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicAlbum:
|
||||
navigate({ to: "/album/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicArtist:
|
||||
navigate({ to: "/artist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Person:
|
||||
navigate({ to: "/person/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Series:
|
||||
navigate({ to: "/series/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Playlist:
|
||||
navigate({ to: "/playlist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
default:
|
||||
navigate({ to: "/item/$id", params: { id: item.Id } });
|
||||
break;
|
||||
if (item?.Id) {
|
||||
switch (item?.Type) {
|
||||
case BaseItemKind.BoxSet:
|
||||
navigate({ to: "/boxset/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Episode:
|
||||
navigate({ to: "/episode/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicAlbum:
|
||||
navigate({ to: "/album/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicArtist:
|
||||
navigate({ to: "/artist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Person:
|
||||
navigate({ to: "/person/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Series:
|
||||
navigate({ to: "/series/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Playlist:
|
||||
navigate({ to: "/playlist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
default:
|
||||
navigate({ to: "/item/$id", params: { id: item.Id } });
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const { ref, inView } = useInView({
|
||||
threshold: 0,
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="card" onClick={onClick ? onClick : defaultOnClick}>
|
||||
<div
|
||||
className="card"
|
||||
ref={ref}
|
||||
onClick={onClick ? onClick : defaultOnClick}
|
||||
>
|
||||
<div className={`card-image-container ${cardType}`}>
|
||||
<ErrorBoundary fallback>
|
||||
<div
|
||||
@@ -121,77 +118,79 @@ const CardComponent = ({
|
||||
</div>
|
||||
</ErrorBoundary>
|
||||
<div className="card-image-icon-container">
|
||||
{overrideIcon ? getTypeIcon(overrideIcon) : getTypeIcon(item.Type)}
|
||||
{overrideIcon
|
||||
? getTypeIcon(overrideIcon)
|
||||
: getTypeIcon(item.Type ?? "universal")}
|
||||
</div>
|
||||
<img
|
||||
alt={item.Name ?? "blink"}
|
||||
src={
|
||||
overrideIcon === "User"
|
||||
? `${api.basePath}/Users/${item.Id}/Images/Primary`
|
||||
: api.getItemImageUrl(
|
||||
seriesId ? item.SeriesId : item.AlbumId ?? item.Id,
|
||||
imageType,
|
||||
{
|
||||
quality: 90,
|
||||
fillWidth: cardType === "thumb" ? 560 : 280,
|
||||
},
|
||||
)
|
||||
}
|
||||
style={{
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
opacity: 0,
|
||||
}}
|
||||
loading="lazy"
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.setProperty("opacity", "1");
|
||||
}}
|
||||
onLoadStart={(e) => console.log(e)}
|
||||
className="card-image"
|
||||
/>
|
||||
<div className="card-overlay">
|
||||
{!disableOverlay && (
|
||||
<>
|
||||
<PlayButton
|
||||
itemId={item.Id}
|
||||
item={item}
|
||||
userId={userId}
|
||||
itemType={item.Type}
|
||||
currentAudioTrack={0}
|
||||
currentSubTrack="nosub"
|
||||
currentVideoTrack={0}
|
||||
className="card-play-button"
|
||||
iconProps={{
|
||||
style: { fontSize: "2.5em" },
|
||||
}}
|
||||
iconOnly
|
||||
audio={
|
||||
item.Type === BaseItemKind.MusicAlbum ||
|
||||
item.Type === BaseItemKind.Audio ||
|
||||
item.Type === BaseItemKind.AudioBook ||
|
||||
item.Type === BaseItemKind.Playlist
|
||||
}
|
||||
playlistItem={item.Type === BaseItemKind.Playlist}
|
||||
playlistItemId={item.Id}
|
||||
/>
|
||||
<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>
|
||||
{item.UserData?.PlaybackPositionTicks > 0 && (
|
||||
{inView && (
|
||||
<img
|
||||
alt={item.Name ?? "blink"}
|
||||
src={
|
||||
api
|
||||
? overrideIcon === "User"
|
||||
? `${api?.basePath}/Users/${item.Id}/Images/Primary`
|
||||
: getImageUrlsApi(api).getItemImageUrlById(
|
||||
(seriesId ? item.SeriesId : (item.AlbumId ?? item.Id)) ??
|
||||
"",
|
||||
imageType,
|
||||
{
|
||||
quality: 90,
|
||||
fillWidth: cardType === "thumb" ? 560 : 320,
|
||||
},
|
||||
)
|
||||
: ""
|
||||
}
|
||||
style={{
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
opacity: 0,
|
||||
}}
|
||||
loading="lazy"
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.setProperty("opacity", "1");
|
||||
}}
|
||||
onLoadStart={(e) => console.log(e)}
|
||||
className="card-image"
|
||||
/>
|
||||
)}
|
||||
|
||||
{inView && !disableOverlay && (
|
||||
<div className="card-overlay">
|
||||
<PlayButton
|
||||
item={item}
|
||||
userId={userId}
|
||||
itemType={item.Type ?? "Movie"}
|
||||
currentAudioTrack="auto"
|
||||
currentSubTrack={-1}
|
||||
currentVideoTrack={0}
|
||||
className="card-play-button"
|
||||
iconOnly
|
||||
audio={
|
||||
item.Type === BaseItemKind.MusicAlbum ||
|
||||
item.Type === BaseItemKind.Audio ||
|
||||
item.Type === BaseItemKind.AudioBook ||
|
||||
item.Type === BaseItemKind.Playlist
|
||||
}
|
||||
playlistItem={item.Type === BaseItemKind.Playlist}
|
||||
playlistItemId={item.Id}
|
||||
/>
|
||||
<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>
|
||||
)}
|
||||
{(item.UserData?.PlaybackPositionTicks ?? -1) > 0 && (
|
||||
<div className="card-progress-container">
|
||||
<div
|
||||
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, { useState } from "react";
|
||||
import React, { type ReactNode } from "react";
|
||||
|
||||
import Carousel from "react-multi-carousel";
|
||||
import "react-multi-carousel/lib/styles.css";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import ButtonGroup from "@mui/material/ButtonGroup";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
import "./cardScroller.scss";
|
||||
|
||||
export const CardScroller = ({
|
||||
//@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,
|
||||
displayCards,
|
||||
title,
|
||||
headingProps,
|
||||
disableDecoration = false,
|
||||
boxProps,
|
||||
}) => {
|
||||
}: CardScrollerProps) {
|
||||
const responsive = {
|
||||
superLargeDesktop: {
|
||||
// the naming can be any, depends on you.
|
||||
@@ -53,12 +78,14 @@ export const CardScroller = ({
|
||||
},
|
||||
};
|
||||
|
||||
const [carouselRef, setCarouselRef] = useState();
|
||||
|
||||
return (
|
||||
<Box {...boxProps} className="card-scroller-container" mb={1}>
|
||||
<Box
|
||||
sx={{ mb: 1 }}
|
||||
<div
|
||||
{...boxProps}
|
||||
className="card-scroller-container"
|
||||
style={{ marginBottom: "1.2em" }}
|
||||
>
|
||||
<div
|
||||
style={{ marginBottom: "1.2em" }}
|
||||
className={
|
||||
disableDecoration
|
||||
? "card-scroller-header-container hidden-decoration"
|
||||
@@ -73,35 +100,20 @@ export const CardScroller = ({
|
||||
>
|
||||
<div className="card-scroller-heading-decoration" /> {title}
|
||||
</Typography>
|
||||
</Box>
|
||||
</div>
|
||||
<Carousel
|
||||
swipeable
|
||||
draggable
|
||||
responsive={responsive}
|
||||
arrows
|
||||
ref={(el) => setCarouselRef(el)}
|
||||
className="card-scroller"
|
||||
customTransition="all .6s"
|
||||
transitionDuration={600}
|
||||
customRightArrow={
|
||||
<IconButton className="card-scroller-button right">
|
||||
<div className="material-symbols-rounded">chevron_right</div>
|
||||
</IconButton>
|
||||
}
|
||||
customLeftArrow={
|
||||
<IconButton className="card-scroller-button left">
|
||||
<div className="material-symbols-rounded">chevron_left</div>
|
||||
</IconButton>
|
||||
}
|
||||
customRightArrow={<RightButton />}
|
||||
customLeftArrow={<LeftButton />}
|
||||
>
|
||||
{children}
|
||||
</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 React, { useEffect, useState } from "react";
|
||||
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import type { PanInfo } from "framer-motion";
|
||||
import React, { useEffect, useState, useMemo, useCallback } from "react";
|
||||
import type { MouseEvent, PointerEvent } from "react";
|
||||
|
||||
import { useCarouselStore } from "../../utils/store/carousel";
|
||||
import "./carousel.scss";
|
||||
@@ -9,53 +9,113 @@ import { useApiInContext } from "@/utils/store/api";
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import CarouselSlide from "../carouselSlide";
|
||||
|
||||
import ReactMultiCarousel from "react-multi-carousel";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import Slider from "../Slider";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
|
||||
const swipeConfidenceThreshold = 8000;
|
||||
const swipePower = (offset, velocity) => {
|
||||
const swipePower = (offset: number, velocity: number) => {
|
||||
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 = ({
|
||||
content,
|
||||
onChange,
|
||||
}: {
|
||||
content: BaseItemDto[];
|
||||
onChange: () => void;
|
||||
onChange: (currentSlide: number) => void;
|
||||
}) => {
|
||||
const [currentSlide, setCurrentSlide] = useState(0);
|
||||
|
||||
const [setDirection, dir] = useCarouselStore((state) => [
|
||||
state.setDirection,
|
||||
state.direction,
|
||||
]);
|
||||
const [setDirection] = useCarouselStore((state) => [state.setDirection]);
|
||||
|
||||
useEffect(() => {
|
||||
onChange(currentSlide);
|
||||
}, [content[currentSlide]?.Id]);
|
||||
|
||||
const api = useApiInContext((s) => s.api);
|
||||
|
||||
const responsive = {
|
||||
superLargeDesktop: {
|
||||
// the naming can be any, depends on you.
|
||||
breakpoint: { max: 4000, min: 3000 },
|
||||
items: 6,
|
||||
// Memoize the content mapping
|
||||
const sliderContent = useMemo(() => {
|
||||
return content.map((item, index) => {
|
||||
return (
|
||||
<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: {
|
||||
breakpoint: { max: 3000, min: 1024 },
|
||||
items: 6,
|
||||
},
|
||||
tablet: {
|
||||
breakpoint: { max: 1024, min: 464 },
|
||||
items: 4,
|
||||
},
|
||||
mobile: {
|
||||
breakpoint: { max: 464, min: 0 },
|
||||
items: 1,
|
||||
},
|
||||
};
|
||||
[currentSlide, content.length, setDirection],
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="carousel">
|
||||
@@ -72,79 +132,23 @@ const Carousel = ({
|
||||
drag={"x"}
|
||||
dragConstraints={{ left: 0, right: 0 }}
|
||||
dragElastic={1}
|
||||
onDragEnd={(e, { offset, velocity }) => {
|
||||
const swipe = swipePower(offset.x, velocity.x);
|
||||
if (
|
||||
currentSlide !== content.length - 1 &&
|
||||
swipe < -swipeConfidenceThreshold
|
||||
) {
|
||||
setDirection("right");
|
||||
setCurrentSlide((init) => init + 1);
|
||||
} else if (currentSlide !== 0 && swipe > swipeConfidenceThreshold) {
|
||||
setDirection("left");
|
||||
setCurrentSlide((init) => init - 1);
|
||||
}
|
||||
}}
|
||||
//@ts-ignore
|
||||
onDragEnd={handleDragEnd}
|
||||
style={{
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
position: "absolute",
|
||||
}}
|
||||
>
|
||||
<CarouselSlide
|
||||
<MemoizedCarouselSlide
|
||||
item={content[currentSlide]}
|
||||
key={content[currentSlide].Id}
|
||||
/>
|
||||
</motion.div>
|
||||
</AnimatePresence>
|
||||
<Slider
|
||||
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>
|
||||
))}
|
||||
/>
|
||||
<MemoizedSlider currentSlide={currentSlide} content={sliderContent} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Carousel;
|
||||
export default React.memo(Carousel);
|
||||
@@ -1,11 +1,9 @@
|
||||
import React, { memo } from "react";
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import React from "react";
|
||||
|
||||
import { motion } from "framer-motion";
|
||||
|
||||
import Button from "@mui/material/Button";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
@@ -13,111 +11,82 @@ import { yellow } from "@mui/material/colors";
|
||||
|
||||
import { endsAt, getRuntime } from "@/utils/date/time";
|
||||
import { green, red } from "@mui/material/colors";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useNavigate } from "@tanstack/react-router";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCarouselStore } from "@/utils/store/carousel";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import {
|
||||
type BaseItemDto,
|
||||
BaseItemKind,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import LikeButton from "../buttons/likeButton";
|
||||
import MarkPlayedButton from "../buttons/markPlayedButton";
|
||||
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 api = useApiInContext((s) => s.api);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const handleMoreInfo = () => {
|
||||
switch (item.Type) {
|
||||
case BaseItemKind.BoxSet:
|
||||
navigate({ to: "/boxset/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Episode:
|
||||
navigate({ to: "/episode/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicAlbum:
|
||||
navigate({ to: "/album/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicArtist:
|
||||
navigate({ to: "/artist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Person:
|
||||
navigate({ to: "/person/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Series:
|
||||
navigate({ to: "/series/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Playlist:
|
||||
navigate({ to: "/playlist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
default:
|
||||
navigate({ to: "/item/$id", params: { id: item.Id } });
|
||||
break;
|
||||
if (item.Id) {
|
||||
switch (item.Type) {
|
||||
case BaseItemKind.BoxSet:
|
||||
navigate({ to: "/boxset/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Episode:
|
||||
navigate({ to: "/episode/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicAlbum:
|
||||
navigate({ to: "/album/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicArtist:
|
||||
navigate({ to: "/artist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Person:
|
||||
navigate({ to: "/person/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Series:
|
||||
navigate({ to: "/series/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Playlist:
|
||||
navigate({ to: "/playlist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
default:
|
||||
navigate({ to: "/item/$id", params: { id: item.Id } });
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const [animationDirection] = useCarouselStore((state) => [state.direction]);
|
||||
|
||||
return (
|
||||
<Paper
|
||||
className="hero-carousel-slide"
|
||||
sx={{
|
||||
background: "transparent",
|
||||
// px: 3,
|
||||
}}
|
||||
elevation={0}
|
||||
>
|
||||
<div className="hero-carousel-slide">
|
||||
<div className="hero-carousel-background-container">
|
||||
{item.BackdropImageTags?.length ? (
|
||||
<img
|
||||
alt={item.Name}
|
||||
alt={item.Name ?? "item"}
|
||||
className="hero-carousel-background-image"
|
||||
src={
|
||||
item.ParentBackdropItemId
|
||||
? `${api.basePath}/Items/${item.ParentBackdropItemId}/Images/Backdrop?quality=80`
|
||||
: `${api.basePath}/Items/${item.Id}/Images/Backdrop?quality=80&fillHeight=1400`
|
||||
? `${api?.basePath}/Items/${item.ParentBackdropItemId}/Images/Backdrop?quality=80`
|
||||
: `${api?.basePath}/Items/${item.Id}/Images/Backdrop?quality=80&fillHeight=1400`
|
||||
}
|
||||
style={{
|
||||
opacity: 0,
|
||||
}}
|
||||
onLoad={(e) => {
|
||||
e.target.style.opacity = 1;
|
||||
e.currentTarget.style.opacity = "1";
|
||||
}}
|
||||
loading="eager"
|
||||
/>
|
||||
) : (
|
||||
<div className="hero-carousel-background-icon-container">
|
||||
{getTypeIcon(item.Type)}
|
||||
{getTypeIcon(item.Type ?? "Movie")}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -155,20 +124,20 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||
fontWeight={200}
|
||||
overflow="visible"
|
||||
>
|
||||
{!item.ImageTags.Logo ? (
|
||||
{!item.ImageTags?.Logo ? (
|
||||
item.Name
|
||||
) : (
|
||||
<img
|
||||
alt={item.Name}
|
||||
alt={item.Name ?? "Item"}
|
||||
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={{
|
||||
opacity: 0,
|
||||
transition: "opacity 0.2s",
|
||||
objectFit: "contain",
|
||||
}}
|
||||
onLoad={(e) => {
|
||||
e.target.style.opacity = 1;
|
||||
e.currentTarget.style.opacity = "1";
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
@@ -207,7 +176,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||
>
|
||||
{item.PremiereDate && (
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||
{item.ProductionYear ?? ""}
|
||||
{item.ProductionYear}
|
||||
</Typography>
|
||||
)}
|
||||
{item.OfficialRating && (
|
||||
@@ -270,15 +239,21 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{item.RunTimeTicks && (
|
||||
{item.RunTimeTicks ? (
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||
{getRuntime(item.RunTimeTicks)}
|
||||
</Typography>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
{item.RunTimeTicks && (
|
||||
{item.RunTimeTicks ? (
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||
{endsAt(item.RunTimeTicks - item.UserData.PlaybackPositionTicks)}
|
||||
{endsAt(
|
||||
item.RunTimeTicks - (item.UserData?.PlaybackPositionTicks ?? 0),
|
||||
)}
|
||||
</Typography>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
<Typography variant="subtitle2" style={{ opacity: 0.8 }}>
|
||||
{item.Genres?.slice(0, 4).join(" / ")}
|
||||
@@ -335,16 +310,14 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||
>
|
||||
<PlayButton
|
||||
item={item}
|
||||
itemId={item.Id}
|
||||
userId={user.data.Id}
|
||||
itemType={item.Type}
|
||||
userId={user?.Id}
|
||||
itemType={item.Type ?? "Movie"}
|
||||
currentAudioTrack={0}
|
||||
currentSubTrack={0}
|
||||
currentVideoTrack={0}
|
||||
buttonProps={{
|
||||
size: "large",
|
||||
}}
|
||||
itemUserData={item.UserData}
|
||||
audio={
|
||||
item.Type === BaseItemKind.MusicAlbum ||
|
||||
item.Type === BaseItemKind.Audio ||
|
||||
@@ -357,6 +330,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||
|
||||
<Button
|
||||
size="large"
|
||||
//@ts-ignore
|
||||
color="white"
|
||||
variant="outlined"
|
||||
endIcon={
|
||||
@@ -377,21 +351,21 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||
<LikeButton
|
||||
itemId={item.Id}
|
||||
queryKey={["home", "latestMedia"]}
|
||||
userId={user.data.Id}
|
||||
isFavorite={item.UserData.IsFavorite}
|
||||
userId={user?.Id}
|
||||
isFavorite={item.UserData?.IsFavorite}
|
||||
itemName={item.Name}
|
||||
/>
|
||||
<MarkPlayedButton
|
||||
itemId={item.Id}
|
||||
queryKey={["home", "latestMedia"]}
|
||||
userId={user.data.Id}
|
||||
isPlayed={item.UserData.Played}
|
||||
userId={user?.Id}
|
||||
isPlayed={item.UserData?.Played}
|
||||
itemName={item.Name}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</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 React from "react";
|
||||
import React, { memo } from "react";
|
||||
|
||||
import anidbIcon from "../../assets/icons/anidb.png";
|
||||
import anilistIcon from "../../assets/icons/anilist.svg";
|
||||
@@ -25,7 +25,7 @@ const knownIcons = [
|
||||
"kitsu",
|
||||
];
|
||||
|
||||
const IconLink = ({ name, url }: { name: string; url: string }) => {
|
||||
const IconLink = memo(({ name, url }: { name: string; url: string }) => {
|
||||
return (
|
||||
<Link target="_blank" href={url} className="item-detail-link">
|
||||
{name.toLocaleLowerCase() === "imdb" && <img src={imdbIcon} alt="IMDb" />}
|
||||
@@ -61,6 +61,6 @@ const IconLink = ({ name, url }: { name: string; url: string }) => {
|
||||
)}
|
||||
</Link>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
export default IconLink;
|
||||
@@ -8,6 +8,7 @@
|
||||
height: 16em;
|
||||
box-shadow: $shadow-card-image;
|
||||
position: relative;
|
||||
flex-shrink: 0;
|
||||
&-icon {
|
||||
color: rgb(255 255 255 / 0.5);
|
||||
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 React from "react";
|
||||
import { Card } from "../../card/card";
|
||||
import { CardScroller } from "../../cardScroller/cardScroller";
|
||||
import CardScroller from "../../cardScroller/cardScroller";
|
||||
import { CardsSkeleton } from "../../skeleton/cards";
|
||||
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import {
|
||||
type BaseItemDto,
|
||||
BaseItemKind,
|
||||
} 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";
|
||||
|
||||
/**
|
||||
@@ -19,36 +19,30 @@ export const LatestMediaSection = ({
|
||||
latestMediaLib,
|
||||
}: { latestMediaLib: BaseItemDto }) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const fetchLatestMedia = async (library: BaseItemDto) => {
|
||||
if (!api || !user?.Id) return null;
|
||||
const media = await getUserLibraryApi(api).getLatestMedia({
|
||||
userId: user.data?.Id,
|
||||
userId: user.Id,
|
||||
parentId: library.Id,
|
||||
limit: 16,
|
||||
fields: ["PrimaryImageAspectRatio"],
|
||||
fields: ["PrimaryImageAspectRatio", "ParentId"],
|
||||
});
|
||||
return media.data;
|
||||
};
|
||||
const data = useQuery({
|
||||
queryKey: ["home", "latestMedia", latestMediaLib.Id],
|
||||
queryFn: () => fetchLatestMedia(latestMediaLib),
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
refetchOnMount: true,
|
||||
});
|
||||
if (data.isPending) {
|
||||
return <CardsSkeleton />;
|
||||
}
|
||||
if (data.isSuccess && data.data.length >= 1) {
|
||||
if (data.isSuccess && (data.data?.length ?? 0) >= 1) {
|
||||
return (
|
||||
<CardScroller displayCards={7} title={`Latest ${latestMediaLib.Name}`}>
|
||||
{data.data.map((item) => {
|
||||
{data.data?.map((item) => {
|
||||
return (
|
||||
<Card
|
||||
key={item.Id}
|
||||
@@ -79,14 +73,8 @@ export const LatestMediaSection = ({
|
||||
? "square"
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={["home", "latestMedia", latestMediaLib.Id]}
|
||||
userId={user.data?.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
queryKey={["home", "latestMedia", latestMediaLib.Id ?? ""]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -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 LikeButton from "../buttons/likeButton";
|
||||
import PlayButton from "../buttons/playButton";
|
||||
import TextLink from "../textLink";
|
||||
import "./musicTrack.scss";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
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";
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @param {Props}
|
||||
* @returns {React.Component}
|
||||
*/
|
||||
|
||||
const MusicTrack = ({
|
||||
item,
|
||||
queryKey,
|
||||
@@ -37,12 +24,12 @@ const MusicTrack = ({
|
||||
className = "",
|
||||
}: {
|
||||
item: BaseItemDto;
|
||||
queryKey: QueryKey;
|
||||
userId: string | undefined;
|
||||
playlistItem: boolean;
|
||||
playlistItemId: string;
|
||||
trackIndex: number;
|
||||
className: string;
|
||||
queryKey: string[];
|
||||
userId?: string | undefined;
|
||||
playlistItem?: boolean;
|
||||
playlistItemId?: string;
|
||||
trackIndex?: number;
|
||||
className?: string;
|
||||
}) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const [currentTrackItem] = useAudioPlayback((state) => [state.item]);
|
||||
@@ -59,16 +46,21 @@ const MusicTrack = ({
|
||||
</span>
|
||||
</div>
|
||||
<img
|
||||
alt={item.Name}
|
||||
src={api.getItemImageUrl(
|
||||
Object.keys(item.ImageTags).length === 0 ? item.AlbumId : item.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 70,
|
||||
fillHeight: 128,
|
||||
fillWidth: 128,
|
||||
},
|
||||
)}
|
||||
alt={item.Name ?? "Music Track"}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
(Object.keys(item.ImageTags ?? {}).length === 0
|
||||
? item.AlbumId
|
||||
: item.Id) ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 70,
|
||||
fillHeight: 128,
|
||||
fillWidth: 128,
|
||||
},
|
||||
)
|
||||
}
|
||||
style={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
@@ -76,14 +68,14 @@ const MusicTrack = ({
|
||||
opacity: 0,
|
||||
}}
|
||||
onLoad={(e) => {
|
||||
e.target.style.opacity = 1;
|
||||
e.currentTarget.style.opacity = "1";
|
||||
}}
|
||||
/>
|
||||
<div className="music-track-image-overlay">
|
||||
<PlayButton
|
||||
itemId={item.Id}
|
||||
item={item}
|
||||
itemType="Audio"
|
||||
userId={userId}
|
||||
itemType={item.Type}
|
||||
size="small"
|
||||
iconOnly
|
||||
audio
|
||||
@@ -118,21 +110,26 @@ const MusicTrack = ({
|
||||
/>
|
||||
)}
|
||||
{item.ArtistItems?.map((artist, index) => (
|
||||
<>
|
||||
<TextLink
|
||||
key={index}
|
||||
variant={"subtitle2"}
|
||||
location={`/artist/${artist.Id}`}
|
||||
otherProps={{
|
||||
fontWeight: 400,
|
||||
style: {
|
||||
textDecoration: "none",
|
||||
},
|
||||
<span
|
||||
style={{ display: "inline-flex", alignItems: "center" }}
|
||||
key={artist.Id}
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
fontWeight="400"
|
||||
style={{
|
||||
textDecoration: "none",
|
||||
}}
|
||||
>
|
||||
{artist.Name}
|
||||
</TextLink>
|
||||
{index !== item.ArtistItems.length - 1 && (
|
||||
<Link
|
||||
style={{ textDecoration: "none", color: "white" }}
|
||||
to="/artist/$id"
|
||||
params={{ id: artist.Id ?? "" }}
|
||||
>
|
||||
{artist.Name}
|
||||
</Link>
|
||||
</Typography>
|
||||
{index !== (item.ArtistItems?.length ?? 0) - 1 && (
|
||||
<span
|
||||
style={{
|
||||
whiteSpace: "pre",
|
||||
@@ -141,12 +138,12 @@ const MusicTrack = ({
|
||||
,{" "}
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<Typography variant="subtitl1">
|
||||
{getRuntimeMusic(item.RunTimeTicks)}
|
||||
<Typography variant="subtitle1">
|
||||
{getRuntimeMusic(item.RunTimeTicks ?? 0)}
|
||||
</Typography>
|
||||
<LikeButton
|
||||
itemId={item.Id}
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
aspect-ratio: 1;
|
||||
position: relative;
|
||||
width: 4em;
|
||||
box-shadow: 0 0 10px rgb(0 0 0 / 0.2);
|
||||
transition: opacity $transition-time-default;
|
||||
&-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
@@ -39,8 +41,6 @@
|
||||
opacity: 0;
|
||||
transition: opacity $transition-time-fast;
|
||||
}
|
||||
box-shadow: 0 0 10px rgb(0 0 0 / 0.2);
|
||||
transition: opacity $transition-time-default;
|
||||
}
|
||||
&-info {
|
||||
justify-self: start;
|
||||
|
||||
@@ -1,27 +1,40 @@
|
||||
import { LinearProgress } from "@mui/material";
|
||||
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({
|
||||
isAnimating,
|
||||
});
|
||||
|
||||
if (isAnimating) {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
pointerEvents: "none",
|
||||
transition: `opacity ${animationDuration}ms linear`,
|
||||
position: "fixed",
|
||||
top: "0",
|
||||
left: "0",
|
||||
right: "0",
|
||||
zIndex: "10001",
|
||||
}}
|
||||
>
|
||||
return createPortal(
|
||||
<div
|
||||
style={{
|
||||
pointerEvents: "none",
|
||||
transition: "opacity 250ms linear",
|
||||
position: "fixed",
|
||||
top: "0",
|
||||
left: "0",
|
||||
right: "0",
|
||||
zIndex: "10001",
|
||||
opacity: isFinished ? 0 : 1,
|
||||
}}
|
||||
>
|
||||
{isAnimating && (
|
||||
<LinearProgress
|
||||
sx={{
|
||||
height: 3,
|
||||
@@ -30,9 +43,9 @@ const NProgress: React.FC<{ isAnimating: boolean | number }> = ({
|
||||
value={progress * 100}
|
||||
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 React from "react";
|
||||
|
||||
export const EmptyNotice = ({ extraMsg }) => {
|
||||
export const EmptyNotice = ({ extraMsg }: { extraMsg?: string }) => {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -1,11 +1,10 @@
|
||||
import Box from "@mui/material/Box";
|
||||
import Button from "@mui/material/Button";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { red } from "@mui/material/colors";
|
||||
import React from "react";
|
||||
|
||||
export const ErrorNotice = ({ error }) => {
|
||||
console.log(error);
|
||||
export const ErrorNotice = ({ error }: { error?: Error }) => {
|
||||
console.error(error);
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -23,14 +22,15 @@ export const ErrorNotice = ({ error }) => {
|
||||
style={{
|
||||
fontSize: "10em",
|
||||
color: red[800],
|
||||
//@ts-ignore
|
||||
"--clr": "rgb(198 40 40 / 30%)",
|
||||
fontVariationSettings: '"FILL" 1, "wght" 400, "GRAD" 25, "opsz" 60',
|
||||
}}
|
||||
>
|
||||
error
|
||||
</div>
|
||||
<Typography variant="h3" fontWeight={300}>
|
||||
Something went wrong
|
||||
<Typography variant="h3" color="white" fontWeight={300}>
|
||||
Something went wrong.
|
||||
</Typography>
|
||||
<Typography
|
||||
fontFamily="JetBrains Mono Variable"
|
||||
@@ -42,11 +42,14 @@ export const ErrorNotice = ({ error }) => {
|
||||
borderRadius: "8px",
|
||||
border: "2px dashed rgb(255 255 255 / 0.5)",
|
||||
maxWidth: "40em",
|
||||
maxHeight: "20em",
|
||||
overflow: "auto",
|
||||
marginTop: "1em",
|
||||
// opacity: 0.6,
|
||||
}}
|
||||
color="gray"
|
||||
>
|
||||
{JSON.stringify(error.message)}
|
||||
{JSON.stringify(error?.stack)}
|
||||
</Typography>
|
||||
</Box>
|
||||
);
|
||||
@@ -1,13 +1,14 @@
|
||||
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 { Button, Typography } from "@mui/material";
|
||||
import React from "react";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
|
||||
import "./outroCard.scss";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
|
||||
const OutroCard = (props: { handleShowCredits: () => void }) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
@@ -15,19 +16,14 @@ const OutroCard = (props: { handleShowCredits: () => void }) => {
|
||||
s.currentItemIndex,
|
||||
s.tracks,
|
||||
]);
|
||||
const item = queueItems[nextItemIndex + 1];
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const result = await getUserApi(api).getCurrentUser();
|
||||
return result.data;
|
||||
},
|
||||
});
|
||||
const item = queueItems?.[nextItemIndex + 1];
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const handlePlayNext = useMutation({
|
||||
mutationKey: ["playNextButton"],
|
||||
mutationFn: () => playItemFromQueue("next", user.data?.Id, api),
|
||||
mutationFn: () => playItemFromQueue("next", user?.Id, api),
|
||||
onError: (error) => [console.error(error)],
|
||||
});
|
||||
if (!item || !item.Type) return null;
|
||||
return (
|
||||
<div className="outro-card">
|
||||
<Typography variant="h4">Up Next</Typography>
|
||||
@@ -36,14 +32,21 @@ const OutroCard = (props: { handleShowCredits: () => void }) => {
|
||||
<img
|
||||
className="outro-card-content-image"
|
||||
alt={item.Name ?? "Cover"}
|
||||
src={api.getItemImageUrl(item.Id, "Primary", {
|
||||
tag: item.ImageTags.Primary,
|
||||
quality: 80,
|
||||
})}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
tag: item.ImageTags.Primary,
|
||||
quality: 80,
|
||||
},
|
||||
)
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<div className="outro-card-content-image icon">
|
||||
{getTypeIcon(item?.Type)}
|
||||
{getTypeIcon(item.Type)}
|
||||
</div>
|
||||
)}
|
||||
<Typography variant="h5" className="outro-card-content-title">
|
||||
@@ -55,6 +58,7 @@ const OutroCard = (props: { handleShowCredits: () => void }) => {
|
||||
<div className="outro-card-content-buttons">
|
||||
<Button
|
||||
onClick={handlePlayNext.mutate}
|
||||
//@ts-ignore
|
||||
color="white"
|
||||
variant="contained"
|
||||
startIcon={
|
||||
@@ -73,6 +77,7 @@ const OutroCard = (props: { handleShowCredits: () => void }) => {
|
||||
</Button>
|
||||
<Button
|
||||
onClick={props.handleShowCredits}
|
||||
//@ts-ignore
|
||||
color="white"
|
||||
variant="outlined"
|
||||
>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
&-image {
|
||||
grid-area: img;
|
||||
max-height: 14em;
|
||||
aspect-ratio: 16/9;
|
||||
width: 20em;
|
||||
object-fit: cover;
|
||||
border-radius: $border-radius-default;
|
||||
|
||||
@@ -1,24 +1,12 @@
|
||||
import React, {
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import React, { useEffect, useMemo, useRef, useState } from "react";
|
||||
|
||||
import { motion } from "framer-motion";
|
||||
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Fab from "@mui/material/Fab";
|
||||
import Grow from "@mui/material/Grow";
|
||||
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 Typography from "@mui/material/Typography";
|
||||
|
||||
import WaveSurfer from "wavesurfer.js";
|
||||
|
||||
import { setAudioRef, useAudioPlayback } from "@/utils/store/audioPlayback";
|
||||
import useQueue from "@/utils/store/queue";
|
||||
|
||||
@@ -26,18 +14,20 @@ import { AnimatePresence } from "framer-motion";
|
||||
import "./audioPlayer.scss";
|
||||
|
||||
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 PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
||||
import QueueButton from "@/components/buttons/queueButton";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
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 api = useApiInContext((s) => s.api);
|
||||
const audioRef = useRef<HTMLAudioElement>(null!);
|
||||
|
||||
const audioRef = useRef<HTMLAudioElement | null>(null);
|
||||
const [url, display, item] = useAudioPlayback((state) => [
|
||||
state.url,
|
||||
state.display,
|
||||
@@ -49,108 +39,98 @@ const AudioPlayer = () => {
|
||||
state.currentItemIndex,
|
||||
]);
|
||||
|
||||
const user = useQuery({
|
||||
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 user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const playing = useMemo(() => {
|
||||
if (audioRef.current?.paused) return false;
|
||||
return true;
|
||||
}, [audioRef.current?.paused]);
|
||||
const [playerReady, setPlayerReady] = useState(false);
|
||||
const [volume, setVolume] = useState(0.8);
|
||||
const [isMuted, setIsMuted] = useState(false);
|
||||
const [progress, setProgress] = useState(0);
|
||||
const [isScrubbing, setIsScrubbing] = useState(false);
|
||||
const [sliderProgress, setSliderProgress] = useState(false);
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [sliderProgress, setSliderProgress] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
if (display) {
|
||||
const audioUrlRequest = new Request(audioRef.current?.dataset.src, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: api.authorizationHeader,
|
||||
},
|
||||
});
|
||||
fetch(audioUrlRequest)
|
||||
.then((res) => res)
|
||||
.then(async (result) => {
|
||||
const blob = await result.blob();
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
audioRef.current.src = blobUrl;
|
||||
audioRef.current.play();
|
||||
setLoading(false);
|
||||
});
|
||||
// const audioUrlRequest = new Request(audioRef.current?.dataset.src, {
|
||||
// method: "GET",
|
||||
// headers: {
|
||||
// Authorization: api.authorizationHeader,
|
||||
// },
|
||||
// });
|
||||
// fetch(audioUrlRequest)
|
||||
// .then((res) => res)
|
||||
// .then(async (result) => {
|
||||
// const blob = await result.blob();
|
||||
// const blobUrl = URL.createObjectURL(blob);
|
||||
// audioRef.current.src = blobUrl;
|
||||
// await audioRef.current.play();
|
||||
// setLoading(false);
|
||||
// });
|
||||
|
||||
// Set the audio ref in the store to allow for global control
|
||||
setAudioRef(audioRef);
|
||||
}
|
||||
}, [url, tracks[currentTrack]?.Id]);
|
||||
}, [url, tracks?.[currentTrack]?.Id]);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const info = useMemo(
|
||||
() => (
|
||||
<div
|
||||
// initial={{
|
||||
// filter: "opacity(0)",
|
||||
// }}
|
||||
// animate={{
|
||||
// filter: "opacity(1)",
|
||||
// }}
|
||||
// exit={{
|
||||
// filter: "opacity(0)",
|
||||
// }}
|
||||
className="audio-player-info"
|
||||
>
|
||||
<div className="audio-player-image-container">
|
||||
<img
|
||||
alt={tracks[currentTrack]?.Name}
|
||||
className="audio-player-image"
|
||||
src={api?.getItemImageUrl(
|
||||
!item?.ImageTags.Primary ? item?.AlbumId : item?.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 85,
|
||||
fillHeight: 462,
|
||||
fillWidth: 462,
|
||||
},
|
||||
)}
|
||||
/>
|
||||
<span className="material-symbols-rounded audio-player-image-icon">
|
||||
music_note
|
||||
</span>
|
||||
() =>
|
||||
api && (
|
||||
<div
|
||||
// initial={{
|
||||
// filter: "opacity(0)",
|
||||
// }}
|
||||
// animate={{
|
||||
// filter: "opacity(1)",
|
||||
// }}
|
||||
// exit={{
|
||||
// filter: "opacity(0)",
|
||||
// }}
|
||||
className="audio-player-info"
|
||||
>
|
||||
<div className="audio-player-image-container">
|
||||
<img
|
||||
alt={tracks?.[currentTrack]?.Name ?? "track"}
|
||||
className="audio-player-image"
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
(!item?.ImageTags?.Primary ? item?.AlbumId : item.Id) ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 85,
|
||||
fillHeight: 462,
|
||||
fillWidth: 462,
|
||||
},
|
||||
)}
|
||||
/>
|
||||
<span className="material-symbols-rounded audio-player-image-icon">
|
||||
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 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>
|
||||
),
|
||||
[tracks[currentTrack]?.Id, currentTrack],
|
||||
),
|
||||
[tracks?.[currentTrack]?.Id, currentTrack, api?.configuration],
|
||||
);
|
||||
|
||||
const controls = useMemo(
|
||||
@@ -168,9 +148,9 @@ const AudioPlayer = () => {
|
||||
<Fab
|
||||
size="small"
|
||||
onClick={() =>
|
||||
audioRef.current.paused
|
||||
audioRef.current?.paused
|
||||
? audioRef.current.play()
|
||||
: audioRef.current.pause()
|
||||
: audioRef.current?.pause()
|
||||
}
|
||||
>
|
||||
<div
|
||||
@@ -186,7 +166,7 @@ const AudioPlayer = () => {
|
||||
<PlayNextButton />
|
||||
</div>
|
||||
),
|
||||
[tracks[currentTrack]?.Id, loading, playing, tracks.length],
|
||||
[tracks?.[currentTrack]?.Id, playing, tracks?.length],
|
||||
);
|
||||
|
||||
const buttons = useMemo(
|
||||
@@ -203,7 +183,7 @@ const AudioPlayer = () => {
|
||||
</IconButton>
|
||||
<QueueButton />
|
||||
<IconButton
|
||||
onClick={(e) => {
|
||||
onClick={() => {
|
||||
setIsMuted(!isMuted);
|
||||
}}
|
||||
>
|
||||
@@ -215,9 +195,19 @@ const AudioPlayer = () => {
|
||||
value={isMuted ? 0 : volume * 100}
|
||||
step={1}
|
||||
max={100}
|
||||
onChange={(e, newVal) => {
|
||||
setVolume(newVal / 100);
|
||||
audioRef.current.volume = newVal / 100;
|
||||
onChange={(_, newVal) => {
|
||||
if (!audioRef.current) {
|
||||
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"
|
||||
valueLabelFormat={(value) => Math.floor(value)}
|
||||
@@ -260,6 +250,15 @@ const AudioPlayer = () => {
|
||||
[volume, isMuted, currentTrack],
|
||||
);
|
||||
|
||||
// if (audioRef.current) {
|
||||
// audioRef.current.addEventListener("change", () => {
|
||||
// console.log("Audio Player changed state : ", currentTrack);
|
||||
// });
|
||||
// audioRef.current.addEventListener("ended", () => {
|
||||
|
||||
// });
|
||||
// }
|
||||
|
||||
return (
|
||||
<AnimatePresence mode="sync">
|
||||
{display && (
|
||||
@@ -287,12 +286,18 @@ const AudioPlayer = () => {
|
||||
>
|
||||
{info}
|
||||
<audio
|
||||
data-src={url}
|
||||
autoPlay
|
||||
src={url}
|
||||
ref={audioRef}
|
||||
key={item?.Id}
|
||||
key={item?.Id ?? "noItem"}
|
||||
onTimeUpdate={(e) =>
|
||||
setProgress(secToTicks(e.currentTarget.currentTime))
|
||||
}
|
||||
onEnded={() => {
|
||||
if (tracks?.[currentTrack + 1]?.Id && api && user?.Id) {
|
||||
playItemFromQueue("next", user.Id, api);
|
||||
}
|
||||
}}
|
||||
id="audio-player"
|
||||
/>
|
||||
<div className="audio-player-controls">
|
||||
@@ -319,16 +324,28 @@ const AudioPlayer = () => {
|
||||
value={isScrubbing ? sliderProgress : progress}
|
||||
step={1}
|
||||
size="small"
|
||||
max={item?.RunTimeTicks}
|
||||
onChange={(e, value) => {
|
||||
max={item?.RunTimeTicks ?? 1}
|
||||
onChange={(_, value) => {
|
||||
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);
|
||||
// console.log(ticksToSec(value * item?.RunTimeTicks));
|
||||
setProgress(value);
|
||||
audioRef.current.currentTime = ticksToSec(value);
|
||||
// console.log(ticksToSec(value * item.RunTimeTicks));
|
||||
Array.isArray(value)
|
||||
? setProgress(value[0])
|
||||
: setProgress(value);
|
||||
if (Array.isArray(value)) {
|
||||
audioRef.current.currentTime = ticksToSec(value[0]);
|
||||
} else {
|
||||
audioRef.current.currentTime = ticksToSec(value);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Typography
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
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 { Typography } from "@mui/material";
|
||||
import React from "react";
|
||||
import { useCallback, useRef } from "react";
|
||||
import { type XYCoord, useDrag, useDrop } from "react-dnd";
|
||||
import type { Identifier } from "typescript";
|
||||
|
||||
|
||||
|
||||
type Props = {
|
||||
track: BaseItemDto;
|
||||
@@ -13,89 +16,32 @@ type Props = {
|
||||
};
|
||||
const QueueTrack = (props: Props) => {
|
||||
const { track, index } = props;
|
||||
const [queue, currentItemIndex] = useQueue((s) => [
|
||||
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 [currentItemIndex] = useQueue((s) => [s.currentItemIndex]);
|
||||
|
||||
const [{ handlerId }, drop] = useDrop<
|
||||
{
|
||||
index: number;
|
||||
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 { attributes, listeners, setNodeRef, transform, transition } =
|
||||
useSortable({
|
||||
id: track.Id ?? "",
|
||||
});
|
||||
|
||||
const dragIndex = hoverItem.index;
|
||||
const dropIndex = index;
|
||||
|
||||
if (dragIndex === dropIndex) return;
|
||||
|
||||
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));
|
||||
const style = {
|
||||
// opacity: isDragging ? 0.5 : 1,
|
||||
transform: CSS.Transform.toString(transform),
|
||||
transition,
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={trackRef}
|
||||
style={{ opacity: isDragging ? 0.5 : 1 }}
|
||||
ref={setNodeRef}
|
||||
style={style}
|
||||
className={
|
||||
currentItemIndex === index
|
||||
? "audio-queue-track active"
|
||||
: "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">
|
||||
<Typography className="audio-queue-track-info-name">
|
||||
{track.Name}
|
||||
@@ -105,7 +51,7 @@ const QueueTrack = (props: Props) => {
|
||||
</Typography>
|
||||
</div>
|
||||
<Typography className="opacity-07">
|
||||
{getRuntimeMusic(track.RunTimeTicks)}
|
||||
{getRuntimeMusic(track.RunTimeTicks ?? 0)}
|
||||
</Typography>
|
||||
</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 { FormControlLabel, Switch, Typography } from "@mui/material";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import React, { useState } from "react";
|
||||
|
||||
const SettingOption = ({
|
||||
setting,
|
||||
}: { setting: { key: string; name: string; description: string } }) => {
|
||||
const [settingVal, setSettingVal] = useState(
|
||||
async () => (await getSetting(setting.key)) ?? false,
|
||||
);
|
||||
const initValue = useQuery({
|
||||
queryKey: ["setting", setting.key],
|
||||
queryFn: async () => {
|
||||
const result = await getSetting(setting.key);
|
||||
return Boolean(result);
|
||||
},
|
||||
});
|
||||
const [settingVal, setSettingVal] = useState(initValue.data ?? false);
|
||||
return (
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Switch
|
||||
color="primary"
|
||||
checked={settingVal}
|
||||
onChange={(e) => {
|
||||
setSetting(setting.key, e.target.checked);
|
||||
setSettingVal(e.target.checked);
|
||||
checked={Boolean(settingVal)}
|
||||
onChange={(_, checked) => {
|
||||
setSetting(setting.key, checked);
|
||||
setSettingVal(Boolean(checked));
|
||||
}}
|
||||
disabled={initValue.isLoading}
|
||||
name={setting.name}
|
||||
/>
|
||||
}
|
||||
|
||||
@@ -10,21 +10,16 @@ import {
|
||||
DialogContent,
|
||||
DialogTitle,
|
||||
Fab,
|
||||
FormControlLabel,
|
||||
IconButton,
|
||||
LinearProgress,
|
||||
Link,
|
||||
Skeleton,
|
||||
Switch,
|
||||
Tab,
|
||||
Tabs,
|
||||
TextField,
|
||||
Typography,
|
||||
styled,
|
||||
withStyles,
|
||||
} from "@mui/material";
|
||||
import { AnimatePresence, motion, transform } from "framer-motion";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { AnimatePresence, motion } from "framer-motion";
|
||||
import React, { useState, useMemo, useCallback } from "react";
|
||||
|
||||
import logo from "@/assets/logo.png";
|
||||
|
||||
@@ -41,14 +36,14 @@ import {
|
||||
setDefaultServer,
|
||||
setServer,
|
||||
} 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 type { RecommendedServerInfo } from "@jellyfin/sdk";
|
||||
import { LoadingButton } from "@mui/lab";
|
||||
import { red, yellow } from "@mui/material/colors";
|
||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
||||
import { red } from "@mui/material/colors";
|
||||
import { useNavigate } from "@tanstack/react-router";
|
||||
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 SettingOption from "../settingOption";
|
||||
|
||||
@@ -73,6 +68,7 @@ const Settings = () => {
|
||||
const systemInfo = useQuery({
|
||||
queryKey: ["about", "systemInfo"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getSystemApi(api).getSystemInfo();
|
||||
return result.data;
|
||||
},
|
||||
@@ -82,10 +78,7 @@ const Settings = () => {
|
||||
const navigate = useNavigate();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
const [applicationVersion, serversOnDiskFn] = useCentralStore((state) => [
|
||||
state.clientVersion,
|
||||
state.allServersOnDisk,
|
||||
]);
|
||||
const [applicationVersion] = useCentralStore((state) => [state.clientVersion]);
|
||||
|
||||
const serversOnDisk = useQuery({
|
||||
queryKey: ["settings", "serversOnDisk"],
|
||||
@@ -114,7 +107,7 @@ const Settings = () => {
|
||||
const handleServerChange = useMutation({
|
||||
mutationFn: async (server: RecommendedServerInfo) => {
|
||||
await delUser();
|
||||
await setDefaultServer(server.id);
|
||||
await setDefaultServer(server.systemInfo?.Id ?? "");
|
||||
await defaultServer.refetch();
|
||||
createApi(server.address, undefined);
|
||||
queryClient.removeQueries();
|
||||
@@ -134,15 +127,15 @@ const Settings = () => {
|
||||
const handleDelete = useMutation({
|
||||
mutationKey: ["server-delete"],
|
||||
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 serversOnDisk.refetch();
|
||||
|
||||
if (serversOnDisk.data.length > 0) {
|
||||
if (serversOnDisk.data?.length) {
|
||||
setDefaultServer(serversOnDisk.data[0].id);
|
||||
createApi(serversOnDisk.data[0].address, null);
|
||||
createApi(serversOnDisk.data[0].address, undefined);
|
||||
} else {
|
||||
// TODO: Reset api in context
|
||||
// useApi.setState(useApi.getInitialState());
|
||||
@@ -166,7 +159,7 @@ const Settings = () => {
|
||||
},
|
||||
onSuccess: async (bestServer) => {
|
||||
if (bestServer) {
|
||||
await setServer(bestServer.systemInfo.Id, bestServer);
|
||||
await setServer(bestServer.systemInfo?.Id ?? "", bestServer);
|
||||
setAddServerDialog(false);
|
||||
enqueueSnackbar(
|
||||
"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 (
|
||||
<Dialog
|
||||
open={open}
|
||||
fullWidth
|
||||
maxWidth="md"
|
||||
PaperProps={{
|
||||
className: "settings glass",
|
||||
elevation: 10,
|
||||
}}
|
||||
PaperProps={paperProps}
|
||||
hideBackdrop
|
||||
onClose={() => setSettingsDialogOpen(false)}
|
||||
onClose={handleClose}
|
||||
>
|
||||
<Tabs
|
||||
orientation="vertical"
|
||||
value={tabValue}
|
||||
onChange={(e, newValue) => {
|
||||
onChange={(_, newValue) => {
|
||||
setSettingsTabValue(newValue);
|
||||
}}
|
||||
style={{
|
||||
@@ -410,7 +414,7 @@ const Settings = () => {
|
||||
{/* About */}
|
||||
{tabValue === 10 && (
|
||||
<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-info-container">
|
||||
<div className="settings-info">
|
||||
@@ -419,10 +423,10 @@ const Settings = () => {
|
||||
icon={
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{ "--wght": 500 }}
|
||||
// style={{ "--wght": 500 }}
|
||||
>
|
||||
{updateInfo.data?.available
|
||||
? "new_release"
|
||||
? "release_alert"
|
||||
: "new_releases"}
|
||||
</span>
|
||||
}
|
||||
@@ -481,7 +485,7 @@ const Settings = () => {
|
||||
setUpdating(true);
|
||||
await updateInfo.data?.downloadAndInstall();
|
||||
enqueueSnackbar(
|
||||
"Update has been installed! You need to relaunch JellyPlayer.",
|
||||
"Update has been installed! You need to relaunch Blink.",
|
||||
{
|
||||
variant: "success",
|
||||
},
|
||||
@@ -513,14 +517,6 @@ const Settings = () => {
|
||||
{systemInfo.data?.Version}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="settings-info">
|
||||
<Typography variant="subtitle2">
|
||||
Operating System:
|
||||
</Typography>
|
||||
<Typography variant="subtitle2">
|
||||
{systemInfo.data?.OperatingSystemDisplayName}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="settings-info">
|
||||
<Typography variant="subtitle2">
|
||||
Server Architecture:
|
||||
@@ -563,9 +559,9 @@ const Settings = () => {
|
||||
component={Link}
|
||||
variant="subtitle2"
|
||||
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
|
||||
component={Link}
|
||||
@@ -625,6 +621,7 @@ const Settings = () => {
|
||||
>
|
||||
Close
|
||||
</Button>
|
||||
{/* @ts-ignore */}
|
||||
<LoadingButton
|
||||
startIcon={
|
||||
<span
|
||||
|
||||
@@ -1,28 +1,27 @@
|
||||
.settings{
|
||||
.settings {
|
||||
display: grid !important;
|
||||
grid-template-columns: 20% 1fr;
|
||||
height: 60vh;
|
||||
overflow: hidden !important;
|
||||
.MuiTabs-flexContainerVertical{
|
||||
.MuiTabs-flexContainerVertical {
|
||||
height: 100%;
|
||||
}
|
||||
&-container{
|
||||
&-container {
|
||||
margin: 14px 0 14px 14px;
|
||||
}
|
||||
&-tab{
|
||||
&-tab {
|
||||
display: grid !important;
|
||||
grid-template-columns: 2em 1fr;
|
||||
align-items: center;
|
||||
justify-items: start !important;
|
||||
gap:1em;
|
||||
& .material-symbols-rounded{
|
||||
gap: 1em;
|
||||
& .material-symbols-rounded {
|
||||
justify-self: center !important;
|
||||
}
|
||||
|
||||
}
|
||||
&-scroll{
|
||||
&-scroll {
|
||||
overflow-y: auto;
|
||||
scrollbar-gutter:stable ;
|
||||
scrollbar-gutter: stable;
|
||||
overscroll-behavior: contain;
|
||||
// Magic scrollbar
|
||||
&::-webkit-scrollbar {
|
||||
@@ -37,14 +36,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// About page
|
||||
&-grid{
|
||||
&-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
||||
gap:1em;
|
||||
gap: 1em;
|
||||
}
|
||||
&-logo{
|
||||
&-logo {
|
||||
width: 100%;
|
||||
background: rgb(255 255 255 / 1);
|
||||
padding: 0em;
|
||||
@@ -53,7 +51,7 @@
|
||||
border-radius: $border-radius-default;
|
||||
object-fit: contain;
|
||||
}
|
||||
&-info{
|
||||
&-info {
|
||||
display: grid;
|
||||
grid-template-columns: 40% 1fr;
|
||||
gap: 1em;
|
||||
@@ -61,13 +59,13 @@
|
||||
align-items: center;
|
||||
border-bottom: 1px solid rgb(255 255 255 / 0.1);
|
||||
padding-bottom: 0.5em;
|
||||
&-container{
|
||||
&-container {
|
||||
background: rgb(0 0 0 / 0.3);
|
||||
padding: 1em;
|
||||
border-radius: $border-radius-default;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap:0.6em;
|
||||
gap: 0.6em;
|
||||
width: 100%;
|
||||
}
|
||||
&:last-child {
|
||||
@@ -78,9 +76,8 @@
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
|
||||
//settings
|
||||
&-option{
|
||||
&-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
@@ -88,21 +85,12 @@
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
margin-bottom: 0.6em !important;
|
||||
&-info-caption{
|
||||
&-info-caption {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
//serverList
|
||||
&-server{
|
||||
&-container{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
align-items: center;
|
||||
padding-bottom: 4.6em;
|
||||
}
|
||||
|
||||
&-server {
|
||||
display: grid;
|
||||
grid-template-columns: 3.4em 1fr auto;
|
||||
justify-items: start;
|
||||
@@ -112,7 +100,13 @@
|
||||
padding: 1em;
|
||||
width: 100%;
|
||||
border-radius: $border-radius-default;
|
||||
|
||||
&-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
align-items: center;
|
||||
padding-bottom: 4.6em;
|
||||
}
|
||||
&-icon {
|
||||
font-size: 3.4em !important;
|
||||
font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 10, "opsz" 40;
|
||||
@@ -124,7 +118,7 @@
|
||||
&-version {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap:0.4em;
|
||||
gap: 0.4em;
|
||||
}
|
||||
}
|
||||
&-buttons {
|
||||
@@ -134,7 +128,6 @@
|
||||
// width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
&-fab-container {
|
||||
display: flex;
|
||||
position: absolute;
|
||||
@@ -144,7 +137,6 @@
|
||||
justify-content: center;
|
||||
gap: 0.8em;
|
||||
}
|
||||
|
||||
// Dialog
|
||||
&-add {
|
||||
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;
|
||||
}
|
||||
@@ -1,11 +1,20 @@
|
||||
import Button from "@mui/material/Button";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import React 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 [isOverflowing, setIsOverflowing] = useState(false);
|
||||
const textRef = useRef(null);
|
||||
const textRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (textRef.current) {
|
||||
@@ -29,12 +38,12 @@ const ShowMoreText = ({ content, collapsedLines, extraProps }) => {
|
||||
>
|
||||
<Typography
|
||||
ref={textRef}
|
||||
key={displayFull}
|
||||
key={displayFull ? "full" : "collapsed"}
|
||||
style={{
|
||||
display: "-webkit-box",
|
||||
textOverflow: "ellipsis",
|
||||
overflow: "hidden",
|
||||
WebkitLineClamp: displayFull ? "none" : collapsedLines ?? 2,
|
||||
WebkitLineClamp: displayFull ? "none" : (collapsedLines ?? 2),
|
||||
WebkitBoxOrient: "vertical",
|
||||
width: "100%",
|
||||
}}
|
||||
@@ -45,6 +54,7 @@ const ShowMoreText = ({ content, collapsedLines, extraProps }) => {
|
||||
</Typography>
|
||||
{content.length > 0 && isOverflowing && (
|
||||
<Button
|
||||
//@ts-ignore
|
||||
color="white"
|
||||
variant="outlined"
|
||||
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 Typography from "@mui/material/Typography";
|
||||
import React from "react";
|
||||
import { theme } from "../../theme";
|
||||
export const CarouselSkeleton = () => {
|
||||
return (
|
||||
<Paper
|
||||
className="hero-carousel-skeleton"
|
||||
elevation={0}
|
||||
sx={{
|
||||
<div
|
||||
className="hero-carousel hero-carousel-skeleton"
|
||||
style={{
|
||||
height: "70vh",
|
||||
marginBottom: "3.2em",
|
||||
position: "relative",
|
||||
background: "black",
|
||||
border: "1px solid rgb(255 255 255 / 0.2)",
|
||||
borderRadius: "10px",
|
||||
overflow: "hidden",
|
||||
width: "100vw",
|
||||
marginLeft: "-4.4em",
|
||||
}}
|
||||
>
|
||||
<div className="hero-carousel-detail">
|
||||
@@ -29,9 +22,13 @@ export const CarouselSkeleton = () => {
|
||||
/>
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="p"
|
||||
variant="body1"
|
||||
className="hero-carousel-text"
|
||||
style={{ display: "flex", flexDirection: "column" }}
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
paddingBottom: "4.4em",
|
||||
}}
|
||||
>
|
||||
<Skeleton
|
||||
variant="text"
|
||||
@@ -53,6 +50,6 @@ export const CarouselSkeleton = () => {
|
||||
/>
|
||||
</Typography>
|
||||
</div>
|
||||
</Paper>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -2,66 +2,96 @@ import { Divider, Skeleton, Typography } from "@mui/material";
|
||||
import React from "react";
|
||||
|
||||
const EpisodeSkeleton = () => {
|
||||
return Array.from(new Array(8)).map((a, index) => {
|
||||
return <>
|
||||
<div
|
||||
key={index}
|
||||
style={{
|
||||
width: "100%",
|
||||
}}
|
||||
className="item-detail-episode"
|
||||
>
|
||||
<Typography variant="h6"><Skeleton variant="circular" sx={{
|
||||
animationDelay: `${index * 0.2}s`,
|
||||
animationDuration: "1.4s",
|
||||
animationName: "pulse",
|
||||
opacity: 0.1,
|
||||
}} /></Typography>
|
||||
<div className="item-detail-episode-image-container">
|
||||
<Skeleton className="item-detail-episode-image" variant="rectangular" sx={{
|
||||
animationDelay: `${index * 0.2}s`,
|
||||
animationDuration: "1.4s",
|
||||
animationName: "pulse",
|
||||
opacity: 0.1,
|
||||
}} />
|
||||
</div>
|
||||
<div className="item-detail-episode-info">
|
||||
<Typography variant="h4">
|
||||
<Skeleton variant="text" width="10em" sx={{
|
||||
animationDelay: `${index * 0.2}s`,
|
||||
animationDuration: "1.4s",
|
||||
animationName: "pulse",
|
||||
opacity: 0.1,
|
||||
}} />
|
||||
</Typography>
|
||||
<Skeleton variant="rounded" width="5em" style={{ borderRadius: "100px" }} sx={{
|
||||
animationDelay: `${index * 0.2}s`,
|
||||
animationDuration: "1.4s",
|
||||
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 />}
|
||||
|
||||
</>
|
||||
})
|
||||
return Array.from(new Array(8)).map((_, index) => {
|
||||
return (
|
||||
<div
|
||||
// biome-ignore lint/suspicious/noArrayIndexKey: this is a skeleton
|
||||
key={index}
|
||||
style={{
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
<div className="item-detail-episode">
|
||||
<Typography variant="h6">
|
||||
<Skeleton
|
||||
variant="circular"
|
||||
sx={{
|
||||
animationDelay: `${index * 0.25}s`,
|
||||
animationDuration: "1.4s",
|
||||
animationName: "pulse",
|
||||
opacity: 0.1,
|
||||
aspectRatio: 1,
|
||||
width: "3rem",
|
||||
height: "3rem",
|
||||
}}
|
||||
/>
|
||||
</Typography>
|
||||
<div className="item-detail-episode-image-container">
|
||||
<Skeleton
|
||||
className="item-detail-episode-image"
|
||||
variant="rectangular"
|
||||
sx={{
|
||||
animationDelay: `${index * 0.2}s`,
|
||||
animationDuration: "1.4s",
|
||||
animationName: "pulse",
|
||||
opacity: 0.1,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="item-detail-episode-info">
|
||||
<Typography variant="h4">
|
||||
<Skeleton
|
||||
variant="text"
|
||||
width="10em"
|
||||
sx={{
|
||||
animationDelay: `${index * 0.2}s`,
|
||||
animationDuration: "1.4s",
|
||||
animationName: "pulse",
|
||||
opacity: 0.1,
|
||||
}}
|
||||
/>
|
||||
</Typography>
|
||||
<Skeleton
|
||||
variant="rounded"
|
||||
width="5em"
|
||||
style={{ borderRadius: "100px" }}
|
||||
sx={{
|
||||
animationDelay: `${index * 0.2}s`,
|
||||
animationDuration: "1.4s",
|
||||
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
|
||||
@@ -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 { Divider, LinearProgress, Skeleton } from "@mui/material";
|
||||
import { Skeleton } from "@mui/material";
|
||||
import { motion } from "framer-motion";
|
||||
|
||||
const ItemSkeleton = () => {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
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 Typography from "@mui/material/Typography";
|
||||
import React from "react";
|
||||
import EpisodeSkeleton from "./episode";
|
||||
|
||||
export const SeasonSelectorSkeleton = () => {
|
||||
return (
|
||||
<Grid
|
||||
<Grid2
|
||||
container
|
||||
columns={{
|
||||
xs: 2,
|
||||
@@ -44,8 +45,8 @@ export const SeasonSelectorSkeleton = () => {
|
||||
}}
|
||||
/>
|
||||
<div className="item-detail-episode-container">
|
||||
<EpisodeSkeleton/>
|
||||
<EpisodeSkeleton />
|
||||
</div>
|
||||
</Grid>
|
||||
</Grid2>
|
||||
);
|
||||
};
|
||||
@@ -7,7 +7,7 @@ import "./tagChip.scss";
|
||||
const TagChip = ({
|
||||
label,
|
||||
linkProps,
|
||||
}: { label: string; linkProps: LinkProps }) => {
|
||||
}: { label: string; linkProps?: LinkProps }) => {
|
||||
return (
|
||||
<Link className="tag" to="/search" search={{ query: label }} {...linkProps}>
|
||||
<Typography variant="subtitle2" fontWeight={300}>
|
||||
|
||||
@@ -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 { useKonamiEasterEgg } from "../../utils/misc/konami";
|
||||
@@ -6,15 +6,22 @@ import { useKonamiEasterEgg } from "../../utils/misc/konami";
|
||||
export const EasterEgg = () => {
|
||||
const [easterEgg, setEasterEgg] = useKonamiEasterEgg();
|
||||
|
||||
// Memoize the onClose function
|
||||
const handleClose = useCallback(() => {
|
||||
setEasterEgg(false);
|
||||
}, [setEasterEgg]);
|
||||
|
||||
// Memoize the sx object
|
||||
const dialogSx = useMemo(
|
||||
() => ({
|
||||
background: "black",
|
||||
}),
|
||||
[],
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Dialog
|
||||
open={easterEgg}
|
||||
onClose={() => setEasterEgg(false)}
|
||||
sx={{
|
||||
background: "black",
|
||||
}}
|
||||
>
|
||||
<Dialog open={easterEgg} onClose={handleClose} sx={dialogSx}>
|
||||
<iframe
|
||||
width="560"
|
||||
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";
|
||||
|
||||
export const getTypeIcon = (icon: BaseItemKind) => {
|
||||
export const getTypeIcon = (
|
||||
icon:
|
||||
| generatedClient.BaseItemKind
|
||||
| generatedClient.CollectionType
|
||||
| "Home"
|
||||
| "User"
|
||||
| "universal",
|
||||
) => {
|
||||
switch (icon) {
|
||||
case "Home":
|
||||
return <div className="material-symbols-rounded">home</div>;
|
||||
case BaseItemKind.Audio:
|
||||
case generatedClient.BaseItemKind.Audio:
|
||||
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>;
|
||||
case BaseItemKind.Book:
|
||||
case generatedClient.BaseItemKind.Book:
|
||||
return <div className="material-symbols-rounded">book</div>;
|
||||
case "boxsets":
|
||||
case BaseItemKind.BoxSet:
|
||||
case generatedClient.BaseItemKind.BoxSet:
|
||||
return <div className="material-symbols-rounded">video_library</div>;
|
||||
case "livetv":
|
||||
case BaseItemKind.TvProgram:
|
||||
case BaseItemKind.TvChannel:
|
||||
case BaseItemKind.Program:
|
||||
case BaseItemKind.Recording:
|
||||
case BaseItemKind.LiveTvChannel:
|
||||
case BaseItemKind.LiveTvProgram:
|
||||
case BaseItemKind.ChannelFolderItem:
|
||||
case BaseItemKind.Channel:
|
||||
case generatedClient.BaseItemKind.TvProgram:
|
||||
case generatedClient.BaseItemKind.TvChannel:
|
||||
case generatedClient.BaseItemKind.Program:
|
||||
case generatedClient.BaseItemKind.Recording:
|
||||
case generatedClient.BaseItemKind.LiveTvChannel:
|
||||
case generatedClient.BaseItemKind.LiveTvProgram:
|
||||
case generatedClient.BaseItemKind.ChannelFolderItem:
|
||||
case generatedClient.BaseItemKind.Channel:
|
||||
return (
|
||||
<div className="material-symbols-rounded">settings_input_antenna</div>
|
||||
);
|
||||
case "tvshows":
|
||||
case BaseItemKind.Season:
|
||||
case BaseItemKind.Series:
|
||||
case BaseItemKind.Episode:
|
||||
case generatedClient.BaseItemKind.Season:
|
||||
case generatedClient.BaseItemKind.Series:
|
||||
case generatedClient.BaseItemKind.Episode:
|
||||
return <div className="material-symbols-rounded">tv_gen</div>;
|
||||
case "playlists":
|
||||
case BaseItemKind.Playlist:
|
||||
case BaseItemKind.PlaylistsFolder:
|
||||
case BaseItemKind.ManualPlaylistsFolder:
|
||||
case generatedClient.BaseItemKind.Playlist:
|
||||
case generatedClient.BaseItemKind.PlaylistsFolder:
|
||||
case generatedClient.BaseItemKind.ManualPlaylistsFolder:
|
||||
return <div className="material-symbols-rounded">queue_music</div>;
|
||||
case "movies":
|
||||
case BaseItemKind.Movie:
|
||||
case generatedClient.BaseItemKind.Movie:
|
||||
return <div className="material-symbols-rounded">movie</div>;
|
||||
case BaseItemKind.MusicAlbum:
|
||||
case generatedClient.BaseItemKind.MusicAlbum:
|
||||
return <div className="material-symbols-rounded">album</div>;
|
||||
case BaseItemKind.MusicArtist:
|
||||
case generatedClient.BaseItemKind.MusicArtist:
|
||||
return <div className="material-symbols-rounded">artist</div>;
|
||||
case BaseItemKind.Genre:
|
||||
case BaseItemKind.MusicGenre:
|
||||
case generatedClient.BaseItemKind.Genre:
|
||||
case generatedClient.BaseItemKind.MusicGenre:
|
||||
return <div className="material-symbols-rounded">domino_mask</div>;
|
||||
case "musicvideos":
|
||||
case BaseItemKind.MusicVideo:
|
||||
case generatedClient.BaseItemKind.MusicVideo:
|
||||
return <div className="material-symbols-rounded">music_video</div>;
|
||||
case "User":
|
||||
case BaseItemKind.Person:
|
||||
case generatedClient.BaseItemKind.Person:
|
||||
return <div className="material-symbols-rounded">person</div>;
|
||||
case BaseItemKind.Photo:
|
||||
case generatedClient.BaseItemKind.Photo:
|
||||
return <div className="material-symbols-rounded">image</div>;
|
||||
case "photos":
|
||||
case BaseItemKind.PhotoAlbum:
|
||||
case generatedClient.BaseItemKind.PhotoAlbum:
|
||||
return <div className="material-symbols-rounded">photo_library</div>;
|
||||
case "universal":
|
||||
case BaseItemKind.Studio:
|
||||
case generatedClient.BaseItemKind.Studio:
|
||||
return <div className="material-symbols-rounded">category</div>;
|
||||
case "trailers":
|
||||
case BaseItemKind.Trailer:
|
||||
case generatedClient.BaseItemKind.Trailer:
|
||||
return <div className="material-symbols-rounded">smart_display</div>;
|
||||
case BaseItemKind.Video:
|
||||
case generatedClient.BaseItemKind.Video:
|
||||
return <div className="material-symbols-rounded">theaters</div>;
|
||||
case "music":
|
||||
return <div className="material-symbols-rounded">library_music</div>;
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import {
|
||||
RouterProvider,
|
||||
createRouteMask,
|
||||
createRouter,
|
||||
} from "@tanstack/react-router";
|
||||
import React, { Suspense } from "react";
|
||||
import { RouterProvider, createRouter } from "@tanstack/react-router";
|
||||
import React, { Suspense, useEffect } from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
// Import the generated route tree
|
||||
import { routeTree } from "./routeTree.gen";
|
||||
@@ -25,6 +21,7 @@ const router = createRouter({
|
||||
createApi: undefined!,
|
||||
user: undefined,
|
||||
jellyfinSDK: undefined!,
|
||||
fetchCurrentUser: undefined!,
|
||||
},
|
||||
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 { CentralProvider, useCentralStore } from "./utils/store/central";
|
||||
|
||||
export const queryClient = new QueryClient({
|
||||
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() {
|
||||
const [api, createApi, jellyfinSDK] = useApiInContext((s) => [
|
||||
s.api,
|
||||
s.createApi,
|
||||
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 (
|
||||
<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>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
{/* TODO: Create a proper loading fallback component */}
|
||||
<Suspense fallback={<h1>Loading in main.tsx</h1>}>
|
||||
<ApiProvider>
|
||||
<ProviderWrapper />
|
||||
</ApiProvider>
|
||||
</Suspense>
|
||||
<ErrorBoundary FallbackComponent={ErrorNotice}>
|
||||
<Suspense fallback={<h1>Loading in main.tsx</h1>}>
|
||||
<CentralProvider>
|
||||
<ApiProvider>
|
||||
<ProviderWrapper />
|
||||
</ApiProvider>
|
||||
</CentralProvider>
|
||||
</Suspense>
|
||||
</ErrorBoundary>
|
||||
</QueryClientProvider>
|
||||
</React.StrictMode>,
|
||||
);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* prettier-ignore-start */
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
// @ts-nocheck
|
||||
|
||||
// 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
|
||||
|
||||
@@ -14,9 +14,7 @@ import { Route as rootRoute } from './routes/__root'
|
||||
import { Route as ApiImport } from './routes/_api'
|
||||
import { Route as IndexImport } from './routes/index'
|
||||
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 ApiLibraryImport } from './routes/_api/library'
|
||||
import { Route as ApiSearchIndexImport } from './routes/_api/search/index'
|
||||
import { Route as ApiPlayerIndexImport } from './routes/_api/player/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 ApiSeriesIdImport } from './routes/_api/series/$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 ApiPersonIdImport } from './routes/_api/person/$id'
|
||||
import { Route as ApiLoginManualImport } from './routes/_api/login/manual'
|
||||
@@ -46,126 +45,145 @@ const ApiRoute = ApiImport.update({
|
||||
} as any)
|
||||
|
||||
const IndexRoute = IndexImport.update({
|
||||
id: '/',
|
||||
path: '/',
|
||||
getParentRoute: () => rootRoute,
|
||||
} as any)
|
||||
|
||||
const ErrorCodeRoute = ErrorCodeImport.update({
|
||||
id: '/error/$code',
|
||||
path: '/error/$code',
|
||||
getParentRoute: () => rootRoute,
|
||||
} as any)
|
||||
|
||||
const ApiSearchRoute = ApiSearchImport.update({
|
||||
path: '/search',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiLoginRoute = ApiLoginImport.update({
|
||||
id: '/login',
|
||||
path: '/login',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiLibraryRoute = ApiLibraryImport.update({
|
||||
path: '/library',
|
||||
const ApiSearchIndexRoute = ApiSearchIndexImport.update({
|
||||
id: '/search/',
|
||||
path: '/search/',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiSearchIndexRoute = ApiSearchIndexImport.update({
|
||||
path: '/',
|
||||
getParentRoute: () => ApiSearchRoute,
|
||||
} as any)
|
||||
|
||||
const ApiPlayerIndexRoute = ApiPlayerIndexImport.update({
|
||||
id: '/player/',
|
||||
path: '/player/',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiHomeIndexRoute = ApiHomeIndexImport.update({
|
||||
id: '/home/',
|
||||
path: '/home/',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiFavoriteIndexRoute = ApiFavoriteIndexImport.update({
|
||||
id: '/favorite/',
|
||||
path: '/favorite/',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const SetupServerListRoute = SetupServerListImport.update({
|
||||
id: '/setup/server/list',
|
||||
path: '/setup/server/list',
|
||||
getParentRoute: () => rootRoute,
|
||||
} as any)
|
||||
|
||||
const SetupServerErrorRoute = SetupServerErrorImport.update({
|
||||
id: '/setup/server/error',
|
||||
path: '/setup/server/error',
|
||||
getParentRoute: () => rootRoute,
|
||||
} as any)
|
||||
|
||||
const SetupServerAddRoute = SetupServerAddImport.update({
|
||||
id: '/setup/server/add',
|
||||
path: '/setup/server/add',
|
||||
getParentRoute: () => rootRoute,
|
||||
} as any)
|
||||
|
||||
const ApiSeriesIdRoute = ApiSeriesIdImport.update({
|
||||
id: '/series/$id',
|
||||
path: '/series/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiPlaylistIdRoute = ApiPlaylistIdImport.update({
|
||||
id: '/playlist/$id',
|
||||
path: '/playlist/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiPlayerPhotosRoute = ApiPlayerPhotosImport.update({
|
||||
id: '/player/photos',
|
||||
path: '/player/photos',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiPlayerAudioRoute = ApiPlayerAudioImport.update({
|
||||
id: '/player/audio',
|
||||
path: '/player/audio',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiPersonIdRoute = ApiPersonIdImport.update({
|
||||
id: '/person/$id',
|
||||
path: '/person/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiLoginManualRoute = ApiLoginManualImport.update({
|
||||
id: '/manual',
|
||||
path: '/manual',
|
||||
getParentRoute: () => ApiLoginRoute,
|
||||
} as any)
|
||||
|
||||
const ApiLoginListRoute = ApiLoginListImport.update({
|
||||
id: '/list',
|
||||
path: '/list',
|
||||
getParentRoute: () => ApiLoginRoute,
|
||||
} as any)
|
||||
|
||||
const ApiLibraryIdRoute = ApiLibraryIdImport.update({
|
||||
path: '/$id',
|
||||
getParentRoute: () => ApiLibraryRoute,
|
||||
id: '/library/$id',
|
||||
path: '/library/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiItemIdRoute = ApiItemIdImport.update({
|
||||
id: '/item/$id',
|
||||
path: '/item/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiEpisodeIdRoute = ApiEpisodeIdImport.update({
|
||||
id: '/episode/$id',
|
||||
path: '/episode/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiBoxsetIdRoute = ApiBoxsetIdImport.update({
|
||||
id: '/boxset/$id',
|
||||
path: '/boxset/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiArtistIdRoute = ApiArtistIdImport.update({
|
||||
id: '/artist/$id',
|
||||
path: '/artist/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiAlbumIdRoute = ApiAlbumIdImport.update({
|
||||
id: '/album/$id',
|
||||
path: '/album/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiLoginUserIdUserNameRoute = ApiLoginUserIdUserNameImport.update({
|
||||
id: '/$userId/$userName',
|
||||
path: '/$userId/$userName',
|
||||
getParentRoute: () => ApiLoginRoute,
|
||||
} as any)
|
||||
@@ -188,13 +206,6 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof ApiImport
|
||||
parentRoute: typeof rootRoute
|
||||
}
|
||||
'/_api/library': {
|
||||
id: '/_api/library'
|
||||
path: '/library'
|
||||
fullPath: '/library'
|
||||
preLoaderRoute: typeof ApiLibraryImport
|
||||
parentRoute: typeof ApiImport
|
||||
}
|
||||
'/_api/login': {
|
||||
id: '/_api/login'
|
||||
path: '/login'
|
||||
@@ -202,13 +213,6 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof ApiLoginImport
|
||||
parentRoute: typeof ApiImport
|
||||
}
|
||||
'/_api/search': {
|
||||
id: '/_api/search'
|
||||
path: '/search'
|
||||
fullPath: '/search'
|
||||
preLoaderRoute: typeof ApiSearchImport
|
||||
parentRoute: typeof ApiImport
|
||||
}
|
||||
'/error/$code': {
|
||||
id: '/error/$code'
|
||||
path: '/error/$code'
|
||||
@@ -253,10 +257,10 @@ declare module '@tanstack/react-router' {
|
||||
}
|
||||
'/_api/library/$id': {
|
||||
id: '/_api/library/$id'
|
||||
path: '/$id'
|
||||
path: '/library/$id'
|
||||
fullPath: '/library/$id'
|
||||
preLoaderRoute: typeof ApiLibraryIdImport
|
||||
parentRoute: typeof ApiLibraryImport
|
||||
parentRoute: typeof ApiImport
|
||||
}
|
||||
'/_api/login/list': {
|
||||
id: '/_api/login/list'
|
||||
@@ -286,6 +290,13 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof ApiPlayerAudioImport
|
||||
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': {
|
||||
id: '/_api/playlist/$id'
|
||||
path: '/playlist/$id'
|
||||
@@ -344,10 +355,10 @@ declare module '@tanstack/react-router' {
|
||||
}
|
||||
'/_api/search/': {
|
||||
id: '/_api/search/'
|
||||
path: '/'
|
||||
fullPath: '/search/'
|
||||
path: '/search'
|
||||
fullPath: '/search'
|
||||
preLoaderRoute: typeof ApiSearchIndexImport
|
||||
parentRoute: typeof ApiSearchImport
|
||||
parentRoute: typeof ApiImport
|
||||
}
|
||||
'/_api/login/$userId/$userName': {
|
||||
id: '/_api/login/$userId/$userName'
|
||||
@@ -361,18 +372,6 @@ declare module '@tanstack/react-router' {
|
||||
|
||||
// Create and export the route tree
|
||||
|
||||
interface ApiLibraryRouteChildren {
|
||||
ApiLibraryIdRoute: typeof ApiLibraryIdRoute
|
||||
}
|
||||
|
||||
const ApiLibraryRouteChildren: ApiLibraryRouteChildren = {
|
||||
ApiLibraryIdRoute: ApiLibraryIdRoute,
|
||||
}
|
||||
|
||||
const ApiLibraryRouteWithChildren = ApiLibraryRoute._addFileChildren(
|
||||
ApiLibraryRouteChildren,
|
||||
)
|
||||
|
||||
interface ApiLoginRouteChildren {
|
||||
ApiLoginListRoute: typeof ApiLoginListRoute
|
||||
ApiLoginManualRoute: typeof ApiLoginManualRoute
|
||||
@@ -389,89 +388,49 @@ const ApiLoginRouteWithChildren = ApiLoginRoute._addFileChildren(
|
||||
ApiLoginRouteChildren,
|
||||
)
|
||||
|
||||
interface ApiSearchRouteChildren {
|
||||
ApiSearchIndexRoute: typeof ApiSearchIndexRoute
|
||||
}
|
||||
|
||||
const ApiSearchRouteChildren: ApiSearchRouteChildren = {
|
||||
ApiSearchIndexRoute: ApiSearchIndexRoute,
|
||||
}
|
||||
|
||||
const ApiSearchRouteWithChildren = ApiSearchRoute._addFileChildren(
|
||||
ApiSearchRouteChildren,
|
||||
)
|
||||
|
||||
interface ApiRouteChildren {
|
||||
ApiLibraryRoute: typeof ApiLibraryRouteWithChildren
|
||||
ApiLoginRoute: typeof ApiLoginRouteWithChildren
|
||||
ApiSearchRoute: typeof ApiSearchRouteWithChildren
|
||||
ApiAlbumIdRoute: typeof ApiAlbumIdRoute
|
||||
ApiArtistIdRoute: typeof ApiArtistIdRoute
|
||||
ApiBoxsetIdRoute: typeof ApiBoxsetIdRoute
|
||||
ApiEpisodeIdRoute: typeof ApiEpisodeIdRoute
|
||||
ApiItemIdRoute: typeof ApiItemIdRoute
|
||||
ApiLibraryIdRoute: typeof ApiLibraryIdRoute
|
||||
ApiPersonIdRoute: typeof ApiPersonIdRoute
|
||||
ApiPlayerAudioRoute: typeof ApiPlayerAudioRoute
|
||||
ApiPlayerPhotosRoute: typeof ApiPlayerPhotosRoute
|
||||
ApiPlaylistIdRoute: typeof ApiPlaylistIdRoute
|
||||
ApiSeriesIdRoute: typeof ApiSeriesIdRoute
|
||||
ApiFavoriteIndexRoute: typeof ApiFavoriteIndexRoute
|
||||
ApiHomeIndexRoute: typeof ApiHomeIndexRoute
|
||||
ApiPlayerIndexRoute: typeof ApiPlayerIndexRoute
|
||||
ApiSearchIndexRoute: typeof ApiSearchIndexRoute
|
||||
}
|
||||
|
||||
const ApiRouteChildren: ApiRouteChildren = {
|
||||
ApiLibraryRoute: ApiLibraryRouteWithChildren,
|
||||
ApiLoginRoute: ApiLoginRouteWithChildren,
|
||||
ApiSearchRoute: ApiSearchRouteWithChildren,
|
||||
ApiAlbumIdRoute: ApiAlbumIdRoute,
|
||||
ApiArtistIdRoute: ApiArtistIdRoute,
|
||||
ApiBoxsetIdRoute: ApiBoxsetIdRoute,
|
||||
ApiEpisodeIdRoute: ApiEpisodeIdRoute,
|
||||
ApiItemIdRoute: ApiItemIdRoute,
|
||||
ApiLibraryIdRoute: ApiLibraryIdRoute,
|
||||
ApiPersonIdRoute: ApiPersonIdRoute,
|
||||
ApiPlayerAudioRoute: ApiPlayerAudioRoute,
|
||||
ApiPlayerPhotosRoute: ApiPlayerPhotosRoute,
|
||||
ApiPlaylistIdRoute: ApiPlaylistIdRoute,
|
||||
ApiSeriesIdRoute: ApiSeriesIdRoute,
|
||||
ApiFavoriteIndexRoute: ApiFavoriteIndexRoute,
|
||||
ApiHomeIndexRoute: ApiHomeIndexRoute,
|
||||
ApiPlayerIndexRoute: ApiPlayerIndexRoute,
|
||||
ApiSearchIndexRoute: ApiSearchIndexRoute,
|
||||
}
|
||||
|
||||
const ApiRouteWithChildren = ApiRoute._addFileChildren(ApiRouteChildren)
|
||||
|
||||
interface FileRoutesByFullPath {
|
||||
export interface FileRoutesByFullPath {
|
||||
'/': typeof IndexRoute
|
||||
'': 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
|
||||
'/error/$code': typeof ErrorCodeRoute
|
||||
'/album/$id': typeof ApiAlbumIdRoute
|
||||
@@ -484,6 +443,7 @@ interface FileRoutesByTo {
|
||||
'/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
|
||||
@@ -496,12 +456,39 @@ interface FileRoutesByTo {
|
||||
'/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
|
||||
'/_api': typeof ApiRouteWithChildren
|
||||
'/_api/library': typeof ApiLibraryRouteWithChildren
|
||||
'/_api/login': typeof ApiLoginRouteWithChildren
|
||||
'/_api/search': typeof ApiSearchRouteWithChildren
|
||||
'/error/$code': typeof ErrorCodeRoute
|
||||
'/_api/album/$id': typeof ApiAlbumIdRoute
|
||||
'/_api/artist/$id': typeof ApiArtistIdRoute
|
||||
@@ -513,6 +500,7 @@ interface FileRoutesById {
|
||||
'/_api/login/manual': typeof ApiLoginManualRoute
|
||||
'/_api/person/$id': typeof ApiPersonIdRoute
|
||||
'/_api/player/audio': typeof ApiPlayerAudioRoute
|
||||
'/_api/player/photos': typeof ApiPlayerPhotosRoute
|
||||
'/_api/playlist/$id': typeof ApiPlaylistIdRoute
|
||||
'/_api/series/$id': typeof ApiSeriesIdRoute
|
||||
'/setup/server/add': typeof SetupServerAddRoute
|
||||
@@ -525,14 +513,12 @@ interface FileRoutesById {
|
||||
'/_api/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
||||
}
|
||||
|
||||
interface FileRouteTypes {
|
||||
export interface FileRouteTypes {
|
||||
fileRoutesByFullPath: FileRoutesByFullPath
|
||||
fullPaths:
|
||||
| '/'
|
||||
| ''
|
||||
| '/library'
|
||||
| '/login'
|
||||
| '/search'
|
||||
| '/error/$code'
|
||||
| '/album/$id'
|
||||
| '/artist/$id'
|
||||
@@ -544,6 +530,7 @@ interface FileRouteTypes {
|
||||
| '/login/manual'
|
||||
| '/person/$id'
|
||||
| '/player/audio'
|
||||
| '/player/photos'
|
||||
| '/playlist/$id'
|
||||
| '/series/$id'
|
||||
| '/setup/server/add'
|
||||
@@ -552,13 +539,12 @@ interface FileRouteTypes {
|
||||
| '/favorite'
|
||||
| '/home'
|
||||
| '/player'
|
||||
| '/search/'
|
||||
| '/search'
|
||||
| '/login/$userId/$userName'
|
||||
fileRoutesByTo: FileRoutesByTo
|
||||
to:
|
||||
| '/'
|
||||
| ''
|
||||
| '/library'
|
||||
| '/login'
|
||||
| '/error/$code'
|
||||
| '/album/$id'
|
||||
@@ -571,6 +557,7 @@ interface FileRouteTypes {
|
||||
| '/login/manual'
|
||||
| '/person/$id'
|
||||
| '/player/audio'
|
||||
| '/player/photos'
|
||||
| '/playlist/$id'
|
||||
| '/series/$id'
|
||||
| '/setup/server/add'
|
||||
@@ -582,11 +569,10 @@ interface FileRouteTypes {
|
||||
| '/search'
|
||||
| '/login/$userId/$userName'
|
||||
id:
|
||||
| '__root__'
|
||||
| '/'
|
||||
| '/_api'
|
||||
| '/_api/library'
|
||||
| '/_api/login'
|
||||
| '/_api/search'
|
||||
| '/error/$code'
|
||||
| '/_api/album/$id'
|
||||
| '/_api/artist/$id'
|
||||
@@ -598,6 +584,7 @@ interface FileRouteTypes {
|
||||
| '/_api/login/manual'
|
||||
| '/_api/person/$id'
|
||||
| '/_api/player/audio'
|
||||
| '/_api/player/photos'
|
||||
| '/_api/playlist/$id'
|
||||
| '/_api/series/$id'
|
||||
| '/setup/server/add'
|
||||
@@ -611,7 +598,7 @@ interface FileRouteTypes {
|
||||
fileRoutesById: FileRoutesById
|
||||
}
|
||||
|
||||
interface RootRouteChildren {
|
||||
export interface RootRouteChildren {
|
||||
IndexRoute: typeof IndexRoute
|
||||
ApiRoute: typeof ApiRouteWithChildren
|
||||
ErrorCodeRoute: typeof ErrorCodeRoute
|
||||
@@ -633,8 +620,6 @@ export const routeTree = rootRoute
|
||||
._addFileChildren(rootRouteChildren)
|
||||
._addFileTypes<FileRouteTypes>()
|
||||
|
||||
/* prettier-ignore-end */
|
||||
|
||||
/* ROUTE_MANIFEST_START
|
||||
{
|
||||
"routes": {
|
||||
@@ -655,28 +640,22 @@ export const routeTree = rootRoute
|
||||
"/_api": {
|
||||
"filePath": "_api.tsx",
|
||||
"children": [
|
||||
"/_api/library",
|
||||
"/_api/login",
|
||||
"/_api/search",
|
||||
"/_api/album/$id",
|
||||
"/_api/artist/$id",
|
||||
"/_api/boxset/$id",
|
||||
"/_api/episode/$id",
|
||||
"/_api/item/$id",
|
||||
"/_api/library/$id",
|
||||
"/_api/person/$id",
|
||||
"/_api/player/audio",
|
||||
"/_api/player/photos",
|
||||
"/_api/playlist/$id",
|
||||
"/_api/series/$id",
|
||||
"/_api/favorite/",
|
||||
"/_api/home/",
|
||||
"/_api/player/"
|
||||
]
|
||||
},
|
||||
"/_api/library": {
|
||||
"filePath": "_api/library.tsx",
|
||||
"parent": "/_api",
|
||||
"children": [
|
||||
"/_api/library/$id"
|
||||
"/_api/player/",
|
||||
"/_api/search/"
|
||||
]
|
||||
},
|
||||
"/_api/login": {
|
||||
@@ -688,13 +667,6 @@ export const routeTree = rootRoute
|
||||
"/_api/login/$userId/$userName"
|
||||
]
|
||||
},
|
||||
"/_api/search": {
|
||||
"filePath": "_api/search.tsx",
|
||||
"parent": "/_api",
|
||||
"children": [
|
||||
"/_api/search/"
|
||||
]
|
||||
},
|
||||
"/error/$code": {
|
||||
"filePath": "error/$code.tsx"
|
||||
},
|
||||
@@ -720,7 +692,7 @@ export const routeTree = rootRoute
|
||||
},
|
||||
"/_api/library/$id": {
|
||||
"filePath": "_api/library/$id.tsx",
|
||||
"parent": "/_api/library"
|
||||
"parent": "/_api"
|
||||
},
|
||||
"/_api/login/list": {
|
||||
"filePath": "_api/login/list.tsx",
|
||||
@@ -738,8 +710,12 @@ export const routeTree = rootRoute
|
||||
"filePath": "_api/player/audio.tsx",
|
||||
"parent": "/_api"
|
||||
},
|
||||
"/_api/player/photos": {
|
||||
"filePath": "_api/player/photos.tsx",
|
||||
"parent": "/_api"
|
||||
},
|
||||
"/_api/playlist/$id": {
|
||||
"filePath": "_api/playlist/$id.jsx",
|
||||
"filePath": "_api/playlist/$id.tsx",
|
||||
"parent": "/_api"
|
||||
},
|
||||
"/_api/series/$id": {
|
||||
@@ -768,8 +744,8 @@ export const routeTree = rootRoute
|
||||
"parent": "/_api"
|
||||
},
|
||||
"/_api/search/": {
|
||||
"filePath": "_api/search/index.jsx",
|
||||
"parent": "/_api/search"
|
||||
"filePath": "_api/search/index.tsx",
|
||||
"parent": "/_api"
|
||||
},
|
||||
"/_api/login/$userId/$userName": {
|
||||
"filePath": "_api/login/$userId.$userName.tsx",
|
||||
|
||||
@@ -3,37 +3,14 @@ import NProgress from "@/components/nProgress";
|
||||
import AudioPlayer from "@/components/playback/audioPlayer";
|
||||
import Settings from "@/components/settings";
|
||||
import { EasterEgg } from "@/components/utils/easterEgg";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
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 { CssBaseline, ThemeProvider } from "@mui/material";
|
||||
import {
|
||||
Outlet,
|
||||
ScrollRestoration,
|
||||
createRootRouteWithContext,
|
||||
useRouterState,
|
||||
} from "@tanstack/react-router";
|
||||
import { TanStackRouterDevtools } from "@tanstack/router-devtools";
|
||||
import { relaunch } from "@tauri-apps/plugin-process";
|
||||
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 { SnackbarProvider } from "notistack";
|
||||
import React from "react";
|
||||
|
||||
import "../styles/global.scss";
|
||||
import { theme } from "@/theme";
|
||||
@@ -41,8 +18,13 @@ import { theme } from "@/theme";
|
||||
// Fonts
|
||||
import "@fontsource-variable/jetbrains-mono";
|
||||
import "@fontsource-variable/noto-sans";
|
||||
import "@fontsource-variable/plus-jakarta-sans";
|
||||
|
||||
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 { UserDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||
@@ -50,225 +32,38 @@ import { DndProvider } from "react-dnd";
|
||||
import { HTML5Backend } from "react-dnd-html5-backend";
|
||||
|
||||
type ApiContext = {
|
||||
api: Api;
|
||||
createApi: (
|
||||
serverAddress: string | undefined,
|
||||
accessToken: string | undefined,
|
||||
) => void;
|
||||
api: Api | undefined;
|
||||
createApi: (serverAddress: string, accessToken: string | undefined) => void;
|
||||
user: UserDto | null | undefined;
|
||||
jellyfinSDK: Jellyfin;
|
||||
fetchCurrentUser: (api: Api | undefined) => Promise<void>;
|
||||
};
|
||||
|
||||
export const Route = createRootRouteWithContext<ApiContext>()({
|
||||
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 (
|
||||
<DndProvider backend={HTML5Backend}>
|
||||
<Suspense fallback={<h1>Loading...</h1>}>
|
||||
<ThemeProvider theme={theme}>
|
||||
<SnackbarProvider maxSnack={5}>
|
||||
<CssBaseline />
|
||||
<ScrollRestoration />
|
||||
<Settings />
|
||||
<EasterEgg />
|
||||
<NProgress
|
||||
key={
|
||||
isQueryFetching || isMutating || routeIsLoading
|
||||
? `show${(isQueryFetching ?? 1) * (isMutating ?? 1) * (routeIsLoading ?? 1)}`
|
||||
: "hide"
|
||||
}
|
||||
isAnimating={isQueryFetching || isMutating || routeIsLoading}
|
||||
/>
|
||||
<ThemeProvider theme={theme}>
|
||||
<SnackbarProvider maxSnack={5}>
|
||||
<CssBaseline />
|
||||
<ScrollRestoration />
|
||||
<Settings />
|
||||
<EasterEgg />
|
||||
<NProgress />
|
||||
|
||||
{routeIsLoading && (
|
||||
<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>
|
||||
)}
|
||||
<RouterLoading />
|
||||
|
||||
<Dialog
|
||||
open={updateDialog}
|
||||
fullWidth
|
||||
PaperProps={{
|
||||
style: {
|
||||
borderRadius: "14px",
|
||||
background: "rgb(0 0 0 / 0.5)",
|
||||
backdropFilter: "blur(10px)",
|
||||
border: "1px solid rgb(255 255 255 / 0.2)",
|
||||
},
|
||||
}}
|
||||
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>
|
||||
<Updater />
|
||||
<Backdrop />
|
||||
<AppBar />
|
||||
<AudioPlayer />
|
||||
<Outlet />
|
||||
<ReactQueryDevtools />
|
||||
{/* <TanStackRouterDevtools /> */}
|
||||
</SnackbarProvider>
|
||||
</ThemeProvider>
|
||||
</DndProvider>
|
||||
);
|
||||
},
|
||||
errorComponent: ErrorNotice,
|
||||
});
|
||||
@@ -1,70 +1,64 @@
|
||||
import { getDefaultServer, getServer } from "@/utils/storage/servers";
|
||||
import { getUser } from "@/utils/storage/user";
|
||||
import { axiosClient } from "@/utils/store/api";
|
||||
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { Outlet, createFileRoute, redirect } from "@tanstack/react-router";
|
||||
import React from "react";
|
||||
import { createFileRoute, redirect } from "@tanstack/react-router";
|
||||
|
||||
export const Route = createFileRoute("/_api")({
|
||||
beforeLoad: async ({ context, location }) => {
|
||||
// console.log(context.api);
|
||||
if (!context.api) {
|
||||
const currentServerId = await getDefaultServer();
|
||||
if (currentServerId) {
|
||||
const currentServer = await getServer(currentServerId);
|
||||
const apiTemp = context.jellyfinSDK.createApi(
|
||||
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 {
|
||||
if (currentServer?.address) {
|
||||
const apiTemp = context.jellyfinSDK.createApi(
|
||||
currentServer?.address,
|
||||
null,
|
||||
undefined,
|
||||
);
|
||||
context.createApi(currentServer?.address, undefined); // Creates Api
|
||||
// return { api: apiTemp };
|
||||
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();
|
||||
// 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) {
|
||||
if (context.api.accessToken && location.pathname !== "/login/manual") {
|
||||
try {
|
||||
return {
|
||||
user: await getUserApi(context.api).getCurrentUser(),
|
||||
}; // Verify user is able to authenticate
|
||||
console.info("AccessToken", context.api.accessToken);
|
||||
await getUserApi(context.api).getCurrentUser(); // Verify user is able to authenticate
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw redirect({
|
||||
|
||||
@@ -1,87 +1,39 @@
|
||||
import PropTypes from "prop-types";
|
||||
import React, { useLayoutEffect, useRef } from "react";
|
||||
import React, { useLayoutEffect, useMemo } from "react";
|
||||
|
||||
import heroBg from "@/assets/herobg.png";
|
||||
import Box from "@mui/material/Box";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
import useParallax from "@/utils/hooks/useParallax";
|
||||
import { motion, useScroll } from "framer-motion";
|
||||
|
||||
import {
|
||||
type BaseItemDto,
|
||||
BaseItemKind,
|
||||
SortOrder,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { BaseItemKind, SortOrder } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import {
|
||||
getRuntime,
|
||||
getRuntimeCompact,
|
||||
getRuntimeMusic,
|
||||
} from "@/utils/date/time";
|
||||
import { getRuntimeCompact } from "@/utils/date/time";
|
||||
|
||||
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 PlayButton from "@/components/buttons/playButton";
|
||||
import TrackList from "@/components/layouts/tracksList";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
|
||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||
import {
|
||||
generateAudioStreamUrl,
|
||||
playAudio,
|
||||
useAudioPlayback,
|
||||
} from "@/utils/store/audioPlayback";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import "./album.scss";
|
||||
|
||||
import AlbumMusicTrack from "@/components/albumMusicTrack";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
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 lyricsIcon from "../../../assets/icons/lyrics.svg";
|
||||
|
||||
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}`,
|
||||
};
|
||||
}
|
||||
import { createPortal } from "react-dom";
|
||||
|
||||
export const Route = createFileRoute("/_api/album/$id")({
|
||||
component: MusicAlbumTitlePage,
|
||||
@@ -89,28 +41,21 @@ export const Route = createFileRoute("/_api/album/$id")({
|
||||
|
||||
function MusicAlbumTitlePage() {
|
||||
const { id } = Route.useParams();
|
||||
const api = Route.useRouteContext().api;
|
||||
const api = useApiInContext((s) => s.api);
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
@@ -118,12 +63,15 @@ function MusicAlbumTitlePage() {
|
||||
const similarItems = useQuery({
|
||||
queryKey: ["item", id, "similarItem"],
|
||||
queryFn: async () => {
|
||||
const result = await getLibraryApi(api).getSimilarAlbums({
|
||||
userId: user.data?.Id,
|
||||
itemId: item.data?.Id,
|
||||
limit: 16,
|
||||
});
|
||||
return result.data;
|
||||
if (api && item.data?.Id) {
|
||||
const result = await getLibraryApi(api).getSimilarAlbums({
|
||||
userId: user?.Id,
|
||||
itemId: item.data?.Id,
|
||||
limit: 16,
|
||||
});
|
||||
return result.data;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
enabled: item.isSuccess,
|
||||
networkMode: "always",
|
||||
@@ -133,52 +81,46 @@ function MusicAlbumTitlePage() {
|
||||
const musicTracks = useQuery({
|
||||
queryKey: ["item", "musicTracks", id],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
parentId: item.data?.Id,
|
||||
sortOrder: [SortOrder.Ascending],
|
||||
sortBy: ["IndexNumber"],
|
||||
sortBy: ["IndexNumber", "ParentIndexNumber"],
|
||||
fields: ["MediaSources"],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicAlbum,
|
||||
enabled: item.isSuccess && item.data?.Type === BaseItemKind.MusicAlbum,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
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(() => {
|
||||
if (item.isSuccess) {
|
||||
setAppBackdrop(
|
||||
`${api.basePath}/Items/${item.data.ParentBackdropItemId}/Images/Backdrop`,
|
||||
item.data.Id,
|
||||
`${api?.basePath}/Items/${item.data?.ParentBackdropItemId}/Images/Backdrop`,
|
||||
item.data?.Id,
|
||||
);
|
||||
}
|
||||
}, [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) {
|
||||
return (
|
||||
<Box
|
||||
@@ -194,125 +136,137 @@ function MusicAlbumTitlePage() {
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
if (item.isSuccess && similarItems.isSuccess) {
|
||||
if (item.isSuccess && item.data && similarItems.isSuccess) {
|
||||
return (
|
||||
<div
|
||||
key={id}
|
||||
className="scrollY padded-top item item-album"
|
||||
ref={pageRef}
|
||||
>
|
||||
<div className="item-info-container">
|
||||
<div className="item-info">
|
||||
<Typography className="item-info-name" variant="h3">
|
||||
{item.data.Name}
|
||||
<div key={id} className="scrollY padded-top item item-album">
|
||||
<div className="item-info">
|
||||
<Typography className="item-info-name" variant="h3">
|
||||
{item.data?.Name}
|
||||
</Typography>
|
||||
<div className="flex flex-align-center item-info-album-info">
|
||||
{/* @ts-ignore - Using Link as component */}
|
||||
<Link
|
||||
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>
|
||||
<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 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-image-container">
|
||||
{item.data.ImageTags?.Primary ? (
|
||||
<img
|
||||
className="item-info-sidebar-image"
|
||||
alt={item.data.Name ?? "Album"}
|
||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
||||
tag: item.data.ImageTags.Primary,
|
||||
quality: 90,
|
||||
})}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
tag: item.data.ImageTags.Primary,
|
||||
quality: 90,
|
||||
},
|
||||
)
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<div className="item-info-sidebar-icon">
|
||||
@@ -325,40 +279,25 @@ function MusicAlbumTitlePage() {
|
||||
style={{ gap: "1em", flexWrap: "wrap" }}
|
||||
>
|
||||
{item.data.GenreItems?.map((genre) => (
|
||||
<TagChip label={genre.Name} key={genre.Id} />
|
||||
<TagChip label={genre.Name ?? "genre"} key={genre.Id} />
|
||||
))}
|
||||
</div>
|
||||
<div className="flex flex-column item-info-sidebar-artist-container">
|
||||
{item.data.ArtistItems?.map((artist) => (
|
||||
<Link
|
||||
to="/artist/$id"
|
||||
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 className="item-info-sidebar-overview">
|
||||
<ShowMoreText
|
||||
content={item.data.Overview ?? ""}
|
||||
collapsedLines={4}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{similarItems.data.TotalRecordCount > 0 && (
|
||||
</div>,
|
||||
document.body,
|
||||
)}
|
||||
{(similarItems.data?.TotalRecordCount ?? 0) > 0 && (
|
||||
<CardScroller
|
||||
title="You might also like"
|
||||
displayCards={7}
|
||||
displayCards={5}
|
||||
disableDecoration
|
||||
>
|
||||
{similarItems.data.Items.map((similar) => {
|
||||
{similarItems.data?.Items?.map((similar) => {
|
||||
return (
|
||||
<Card
|
||||
key={similar.Id}
|
||||
@@ -390,13 +329,7 @@ function MusicAlbumTitlePage() {
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!similar.ImageBlurHashes?.Primary &&
|
||||
similar.ImageBlurHashes?.Primary[
|
||||
Object.keys(similar.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -1,131 +1,17 @@
|
||||
$border-radius: 20px;
|
||||
.item-album {
|
||||
width: 70vw;
|
||||
padding-right: 2.2em;
|
||||
.item-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
&-container {
|
||||
gap: 1.2em;
|
||||
&-container {
|
||||
grid-template-columns: 1fr 25%;
|
||||
display: grid;
|
||||
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 {
|
||||
gap: 1.2em;
|
||||
}
|
||||
@@ -133,8 +19,83 @@ $border-radius: 20px;
|
||||
display: flex;
|
||||
gap: 1em;
|
||||
}
|
||||
&-disc-header{
|
||||
padding: 1em 2em;
|
||||
background: hsla(0, 0, 100%, 10%);
|
||||
border-radius: 100px;
|
||||
gap: 1em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-info-sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
position: fixed;
|
||||
// max-height: 100vh;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 30vw;
|
||||
padding: 4.4em;
|
||||
padding-left: 2.2em;
|
||||
&-image {
|
||||
width: 100%;
|
||||
object-fit: cover;
|
||||
border-radius: $border-radius-default;
|
||||
}
|
||||
&-artist {
|
||||
display: flex;
|
||||
gap: 1em;
|
||||
align-items: center;
|
||||
padding: 1em 0;
|
||||
color: rgb(255 255 255 / 0.7);
|
||||
transition: $transition-time-default;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
&:hover {
|
||||
color: rgb(255 255 255)
|
||||
}
|
||||
&-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
&-container {
|
||||
width: 3em;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 100%;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
.material-symbols-rounded {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
z-index: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
&-container {
|
||||
// max-height: 20em;/
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
}
|
||||
&-overview {
|
||||
overflow-y: auto;
|
||||
max-height: 28vh;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.item-detail-album {
|
||||
&-track {
|
||||
display: grid;
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import PropTypes from "prop-types";
|
||||
import React, { useState, useEffect, useLayoutEffect, useRef } from "react";
|
||||
import React, {
|
||||
useState,
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useRef,
|
||||
type ReactNode,
|
||||
} from "react";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
@@ -17,7 +22,6 @@ import {
|
||||
SortOrder,
|
||||
} 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 { useQuery } from "@tanstack/react-query";
|
||||
@@ -26,19 +30,27 @@ import LikeButton from "@/components/buttons/likeButton";
|
||||
import { Card } from "@/components/card/card";
|
||||
import { Blurhash } from "react-blurhash";
|
||||
|
||||
import meshBg from "@/assets/herobg.png";
|
||||
import { ArtistAlbum } from "@/components/layouts/artist/artistAlbum";
|
||||
import MusicTrack from "@/components/musicTrack";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
import { setBackdrop, useBackdropStore } from "@/utils/store/backdrop";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import "./artist.scss";
|
||||
|
||||
import IconLink from "@/components/iconLink";
|
||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
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;
|
||||
|
||||
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")({
|
||||
component: ArtistTitlePage,
|
||||
});
|
||||
@@ -69,26 +75,19 @@ function ArtistTitlePage() {
|
||||
const { id } = Route.useParams();
|
||||
const api = Route.useRouteContext().api;
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
fields: [ItemFields.Crew],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
@@ -96,52 +95,56 @@ function ArtistTitlePage() {
|
||||
const artistDiscography = useQuery({
|
||||
queryKey: ["item", id, "artist", "discography"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
albumArtistIds: [item.data.Id],
|
||||
albumArtistIds: [item.data?.Id ?? ""],
|
||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||
sortOrder: [SortOrder.Descending],
|
||||
recursive: true,
|
||||
includeItemTypes: [BaseItemKind.MusicAlbum],
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
fields: [ItemFields.Overview],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicArtist,
|
||||
enabled: item.isSuccess && item.data?.Type === BaseItemKind.MusicArtist,
|
||||
});
|
||||
|
||||
const artistSongs = useQuery({
|
||||
queryKey: ["item", id, "artist", "songs"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
|
||||
const result = await getItemsApi(api).getItems({
|
||||
artistIds: [item.data.Id],
|
||||
artistIds: [item.data?.Id ?? ""],
|
||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||
sortOrder: [SortOrder.Ascending],
|
||||
recursive: true,
|
||||
includeItemTypes: [BaseItemKind.Audio],
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
fields: [ItemFields.Overview],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicArtist,
|
||||
enabled: item.isSuccess && item.data?.Type === BaseItemKind.MusicArtist,
|
||||
});
|
||||
|
||||
const artistAppearances = useQuery({
|
||||
queryKey: ["item", id, "artist", "appearences"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
contributingArtistIds: [item.data.Id],
|
||||
excludeItemIds: [item.data.Id],
|
||||
contributingArtistIds: [item.data?.Id ?? ""],
|
||||
excludeItemIds: [item.data?.Id ?? ""],
|
||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||
sortOrder: [SortOrder.Descending],
|
||||
recursive: true,
|
||||
includeItemTypes: [BaseItemKind.MusicAlbum],
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicArtist,
|
||||
enabled: item.isSuccess && item.data?.Type === BaseItemKind.MusicArtist,
|
||||
});
|
||||
|
||||
const artistTabs = [
|
||||
@@ -155,7 +158,10 @@ function ArtistTitlePage() {
|
||||
if (
|
||||
artistDiscography.isSuccess &&
|
||||
artistSongs.isSuccess &&
|
||||
artistAppearances.isSuccess
|
||||
artistAppearances.isSuccess &&
|
||||
artistDiscography.data &&
|
||||
artistSongs.data &&
|
||||
artistAppearances.data
|
||||
) {
|
||||
if (artistDiscography.data.TotalRecordCount !== 0) {
|
||||
setActiveArtistTab(0);
|
||||
@@ -173,10 +179,11 @@ function ArtistTitlePage() {
|
||||
|
||||
const [animationDirection, setAnimationDirection] = useState("forward");
|
||||
|
||||
const { setBackdrop } = useBackdropStore();
|
||||
useEffect(() => {
|
||||
if (item.isSuccess) {
|
||||
if (item.isSuccess && item.data) {
|
||||
setBackdrop(
|
||||
`${api.basePath}/Items/${item.data.Id}/Images/Backdrop`,
|
||||
`${api?.basePath}/Items/${item.data.Id}/Images/Backdrop`,
|
||||
item.data.Id,
|
||||
);
|
||||
}
|
||||
@@ -204,7 +211,7 @@ function ArtistTitlePage() {
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
if (item.isSuccess) {
|
||||
if (item.isSuccess && item.data) {
|
||||
return (
|
||||
<motion.div
|
||||
key={id}
|
||||
@@ -224,13 +231,20 @@ function ArtistTitlePage() {
|
||||
<div className="item-hero flex flex-row">
|
||||
<div className="item-hero-backdrop-container">
|
||||
<motion.img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
|
||||
tag: item.data.BackdropImageTags[0],
|
||||
})}
|
||||
alt={item.data?.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data?.Id ?? "",
|
||||
"Backdrop",
|
||||
{
|
||||
tag: item.data.BackdropImageTags?.[0],
|
||||
},
|
||||
)
|
||||
}
|
||||
className="item-hero-backdrop"
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
e.currentTarget.style.opacity = "1";
|
||||
}}
|
||||
style={{
|
||||
y: parallax,
|
||||
@@ -243,45 +257,59 @@ function ArtistTitlePage() {
|
||||
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
|
||||
}}
|
||||
>
|
||||
{Object.keys(item.data.ImageTags).includes("Primary") ? (
|
||||
<>
|
||||
{item.data.ImageTags?.Primary ? (
|
||||
<div>
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data.ImageBlurHashes.Primary[
|
||||
item.data.ImageBlurHashes?.Primary?.[
|
||||
item.data.ImageTags.Primary
|
||||
]
|
||||
] ?? ""
|
||||
}
|
||||
className="item-hero-image-blurhash"
|
||||
/>
|
||||
<img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
})}
|
||||
alt={item.data.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
},
|
||||
)
|
||||
}
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
e.currentTarget.style.opacity = "1";
|
||||
}}
|
||||
className="item-hero-image"
|
||||
/>
|
||||
</>
|
||||
</div>
|
||||
) : (
|
||||
<div className="item-hero-image-icon">
|
||||
{getTypeIcon(item.data.Type)}
|
||||
{getTypeIcon(item.data.Type ?? "MusicArtist")}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="item-hero-detail flex flex-column">
|
||||
{Object.keys(item.data.ImageTags).includes("Logo") ? (
|
||||
{item.data.ImageTags?.Logo ? (
|
||||
<img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Logo", {
|
||||
quality: 90,
|
||||
fillWidth: 592,
|
||||
fillHeight: 592,
|
||||
})}
|
||||
alt={item.data.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id ?? "",
|
||||
"Logo",
|
||||
{
|
||||
quality: 90,
|
||||
fillWidth: 592,
|
||||
fillHeight: 592,
|
||||
},
|
||||
)
|
||||
}
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
e.currentTarget.style.opacity = "1";
|
||||
}}
|
||||
className="item-hero-logo"
|
||||
/>
|
||||
@@ -295,8 +323,8 @@ function ArtistTitlePage() {
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isFavorite={item.data.UserData.IsFavorite}
|
||||
userId={user.data.Id}
|
||||
isFavorite={item.data.UserData?.IsFavorite}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -314,8 +342,12 @@ function ArtistTitlePage() {
|
||||
marginTop: "1em",
|
||||
}}
|
||||
>
|
||||
{item.data.ExternalUrls.map((url) => (
|
||||
<IconLink url={url.Url} name={url.Name} />
|
||||
{item.data.ExternalUrls?.map((url) => (
|
||||
<IconLink
|
||||
url={url.Url ?? ""}
|
||||
name={url.Name ?? ""}
|
||||
key={url.Url}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
@@ -325,22 +357,22 @@ function ArtistTitlePage() {
|
||||
}}
|
||||
>
|
||||
{item.data.PremiereDate && (
|
||||
<>
|
||||
<div>
|
||||
<Typography variant="h5">Born</Typography>
|
||||
<Typography sx={{ opacity: 0.8 }}>
|
||||
{new Date(item.data.PremiereDate).toDateString()}
|
||||
</Typography>
|
||||
</>
|
||||
</div>
|
||||
)}
|
||||
{item.data.EndDate && (
|
||||
<>
|
||||
<div>
|
||||
<Typography variant="h5" mt={2}>
|
||||
Death
|
||||
</Typography>
|
||||
<Typography sx={{ opacity: 0.8 }}>
|
||||
{new Date(item.data.EndDate).toDateString()}
|
||||
</Typography>
|
||||
</>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
@@ -349,7 +381,7 @@ function ArtistTitlePage() {
|
||||
<Tabs
|
||||
variant="scrollable"
|
||||
value={activeArtistTab}
|
||||
onChange={(e, newVal) => {
|
||||
onChange={(_, newVal) => {
|
||||
if (newVal > activeArtistTab) {
|
||||
setAnimationDirection("forward");
|
||||
} else if (newVal < activeArtistTab) {
|
||||
@@ -358,7 +390,7 @@ function ArtistTitlePage() {
|
||||
setActiveArtistTab(newVal);
|
||||
}}
|
||||
>
|
||||
{artistTabs.map((tab, index) => {
|
||||
{artistTabs.map((tab) => {
|
||||
return (
|
||||
<Tab
|
||||
key={tab.title}
|
||||
@@ -390,12 +422,12 @@ function ArtistTitlePage() {
|
||||
ease: "anticipate",
|
||||
}}
|
||||
>
|
||||
{artistDiscography.isSuccess &&
|
||||
artistDiscography.data.Items.map((tabitem) => {
|
||||
{user &&
|
||||
artistDiscography.data?.Items?.map((tabitem) => {
|
||||
return (
|
||||
<ArtistAlbum
|
||||
key={tabitem.Id}
|
||||
user={user.data}
|
||||
user={user}
|
||||
album={tabitem}
|
||||
/>
|
||||
);
|
||||
@@ -422,13 +454,13 @@ function ArtistTitlePage() {
|
||||
}}
|
||||
>
|
||||
{artistSongs.isSuccess &&
|
||||
artistSongs.data.Items.map((tabitem) => {
|
||||
artistSongs.data?.Items?.map((tabitem) => {
|
||||
return (
|
||||
<MusicTrack
|
||||
item={tabitem}
|
||||
key={tabitem.Id}
|
||||
queryKey={["item", id, "artist", "songs"]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
@@ -455,7 +487,7 @@ function ArtistTitlePage() {
|
||||
className="grid"
|
||||
>
|
||||
{artistAppearances.isSuccess &&
|
||||
artistAppearances.data.Items.map((tabitem) => {
|
||||
artistAppearances.data?.Items?.map((tabitem) => {
|
||||
return (
|
||||
<Card
|
||||
key={tabitem.Id}
|
||||
@@ -465,13 +497,7 @@ function ArtistTitlePage() {
|
||||
cardCaption={tabitem.AlbumArtist}
|
||||
cardType={"square"}
|
||||
queryKey={["item", id, "artist", "appearences"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!tabitem.ImageBlurHashes?.Primary &&
|
||||
tabitem.ImageBlurHashes?.Primary[
|
||||
Object.keys(tabitem.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import PropTypes from "prop-types";
|
||||
import React, { useEffect, useRef } from "react";
|
||||
import React, { useLayoutEffect, useRef } from "react";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import Chip from "@mui/material/Chip";
|
||||
@@ -17,17 +16,16 @@ import {
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
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 ShowMoreText from "@/components/showMoreText";
|
||||
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 LikeButton from "@/components/buttons/likeButton";
|
||||
@@ -39,31 +37,11 @@ import "./boxset.scss";
|
||||
|
||||
import IconLink from "@/components/iconLink";
|
||||
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";
|
||||
|
||||
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")({
|
||||
component: BoxSetTitlePage,
|
||||
});
|
||||
@@ -72,27 +50,19 @@ function BoxSetTitlePage() {
|
||||
const { id } = Route.useParams();
|
||||
const api = Route.useRouteContext().api;
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
fields: [ItemFields.Crew],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
@@ -100,9 +70,10 @@ function BoxSetTitlePage() {
|
||||
const collectionItems = useQuery({
|
||||
queryKey: ["item", id, "collection"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
parentId: item.data.Id,
|
||||
userId: user?.Id,
|
||||
parentId: item.data?.Id,
|
||||
fields: [ItemFields.SeasonUserData, ItemFields.Overview],
|
||||
excludeLocationTypes: [LocationType.Virtual],
|
||||
});
|
||||
@@ -114,11 +85,12 @@ function BoxSetTitlePage() {
|
||||
});
|
||||
|
||||
const similarItems = useQuery({
|
||||
queryKey: ["item", id, "similarItem"],
|
||||
queryKey: ["item", "similarItem", id],
|
||||
queryFn: async () => {
|
||||
if (!api || !item.data?.Id) return null;
|
||||
const result = await getLibraryApi(api).getSimilarItems({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: item.data?.Id,
|
||||
limit: 16,
|
||||
});
|
||||
return result.data;
|
||||
@@ -128,13 +100,19 @@ function BoxSetTitlePage() {
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (item.isSuccess) {
|
||||
if (item.data.BackdropImageTags?.length > 0) {
|
||||
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (api && item.isSuccess) {
|
||||
if (item.data?.BackdropImageTags?.length) {
|
||||
setBackdrop(
|
||||
api?.getItemImageUrl(item.data.Id, "Backdrop", {
|
||||
tag: item.data.BackdropImageTags[0],
|
||||
}),
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id ?? "",
|
||||
"Backdrop",
|
||||
{
|
||||
tag: item.data.BackdropImageTags[0],
|
||||
},
|
||||
),
|
||||
item.data.Id,
|
||||
);
|
||||
} else {
|
||||
@@ -147,6 +125,7 @@ function BoxSetTitlePage() {
|
||||
const { scrollYProgress } = useScroll({
|
||||
target: pageRef,
|
||||
offset: ["start start", "60vh start"],
|
||||
layoutEffect: false,
|
||||
});
|
||||
const parallax = useParallax(scrollYProgress, 50);
|
||||
|
||||
@@ -165,7 +144,7 @@ function BoxSetTitlePage() {
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
if (item.isSuccess && similarItems.isSuccess) {
|
||||
if (item.isSuccess && item.data && similarItems.isSuccess) {
|
||||
return (
|
||||
<motion.div
|
||||
key={id}
|
||||
@@ -186,13 +165,20 @@ function BoxSetTitlePage() {
|
||||
<div className="item-hero-backdrop-container">
|
||||
{item.data.BackdropImageTags?.length ? (
|
||||
<motion.img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
|
||||
tag: item.data.BackdropImageTags[0],
|
||||
})}
|
||||
alt={item.data.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id ?? "",
|
||||
"Backdrop",
|
||||
{
|
||||
tag: item.data.BackdropImageTags[0],
|
||||
},
|
||||
)
|
||||
}
|
||||
className="item-hero-backdrop"
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
e.currentTarget.style.opacity = "1";
|
||||
}}
|
||||
style={{
|
||||
y: parallax,
|
||||
@@ -200,11 +186,11 @@ function BoxSetTitlePage() {
|
||||
/>
|
||||
) : (
|
||||
<motion.img
|
||||
alt={item.data.Name}
|
||||
alt={item.data.Name ?? ""}
|
||||
src={heroBg}
|
||||
className="item-hero-backdrop"
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
e.currentTarget.style.opacity = "1";
|
||||
}}
|
||||
style={{
|
||||
y: parallax,
|
||||
@@ -218,45 +204,60 @@ function BoxSetTitlePage() {
|
||||
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
|
||||
}}
|
||||
>
|
||||
{Object.keys(item.data.ImageTags).includes("Primary") ? (
|
||||
<>
|
||||
{item.data.ImageTags?.Primary &&
|
||||
item.data.ImageBlurHashes?.Primary ? (
|
||||
<div>
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data.ImageBlurHashes.Primary[
|
||||
item.data.ImageBlurHashes?.Primary?.[
|
||||
item.data.ImageTags.Primary
|
||||
]
|
||||
}
|
||||
className="item-hero-image-blurhash"
|
||||
/>
|
||||
<img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
})}
|
||||
alt={item.data.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
},
|
||||
)
|
||||
}
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
e.currentTarget.style.opacity = "1";
|
||||
}}
|
||||
className="item-hero-image"
|
||||
/>
|
||||
</>
|
||||
</div>
|
||||
) : (
|
||||
<div className="item-hero-image-icon">
|
||||
{getTypeIcon(item.data.Type)}
|
||||
{getTypeIcon(item.data.Type ?? "BoxSet")}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="item-hero-detail">
|
||||
{Object.keys(item.data.ImageTags).includes("Logo") ? (
|
||||
{item.data.ImageTags?.Logo ? (
|
||||
<img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Logo", {
|
||||
quality: 90,
|
||||
fillWidth: 592,
|
||||
fillHeight: 592,
|
||||
})}
|
||||
alt={item.data.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id ?? "",
|
||||
"Logo",
|
||||
{
|
||||
quality: 90,
|
||||
fillWidth: 592,
|
||||
fillHeight: 592,
|
||||
},
|
||||
)
|
||||
}
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
e.currentTarget.style.opacity = "1";
|
||||
}}
|
||||
className="item-hero-logo"
|
||||
/>
|
||||
@@ -351,7 +352,7 @@ function BoxSetTitlePage() {
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||
{endsAt(
|
||||
item.data.RunTimeTicks -
|
||||
item.data.UserData.PlaybackPositionTicks,
|
||||
(item.data.UserData?.PlaybackPositionTicks ?? 0),
|
||||
)}
|
||||
</Typography>
|
||||
)}
|
||||
@@ -364,13 +365,11 @@ function BoxSetTitlePage() {
|
||||
<div className="flex flex-row fullWidth">
|
||||
<PlayButton
|
||||
item={item.data}
|
||||
itemId={item.data.Id}
|
||||
itemType={item.data.Type}
|
||||
itemUserData={item.data.UserData}
|
||||
itemType={item.data.Type ?? "BoxSet"}
|
||||
currentVideoTrack={0}
|
||||
currentAudioTrack={0}
|
||||
currentSubTrack={0}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
buttonProps={{
|
||||
fullWidth: true,
|
||||
}}
|
||||
@@ -381,15 +380,15 @@ function BoxSetTitlePage() {
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isFavorite={item.data.UserData.IsFavorite}
|
||||
userId={user.data.Id}
|
||||
isFavorite={item.data.UserData?.IsFavorite}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
<MarkPlayedButton
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isPlayed={item.data.UserData.Played}
|
||||
userId={user.data.Id}
|
||||
isPlayed={item.data.UserData?.Played}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -414,15 +413,19 @@ function BoxSetTitlePage() {
|
||||
marginTop: "1em",
|
||||
}}
|
||||
>
|
||||
{item.data.ExternalUrls.map((url) => (
|
||||
<IconLink url={url.Url} name={url.Name} />
|
||||
{item.data.ExternalUrls?.map((url) => (
|
||||
<IconLink
|
||||
url={url.Url ?? ""}
|
||||
name={url.Name ?? ""}
|
||||
key={url.Url}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{collectionItems.data.TotalRecordCount > 0 && (
|
||||
{(collectionItems.data?.TotalRecordCount ?? 0) > 0 && (
|
||||
<CardScroller title="" displayCards={7} disableDecoration>
|
||||
{collectionItems.data.Items.map((similar, index) => {
|
||||
{collectionItems.data?.Items?.map((similar) => {
|
||||
return (
|
||||
<Card
|
||||
key={similar.Id}
|
||||
@@ -436,26 +439,20 @@ function BoxSetTitlePage() {
|
||||
imageType={"Primary"}
|
||||
cardCaption={similar.ProductionYear}
|
||||
cardType={"portrait"}
|
||||
queryKey={["item", id, "collection"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!similar.ImageBlurHashes?.Primary &&
|
||||
similar.ImageBlurHashes?.Primary[
|
||||
Object.keys(similar.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
queryKey={["item", id]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
{similarItems.data.TotalRecordCount > 0 && (
|
||||
{similarItems.data?.TotalRecordCount && (
|
||||
<CardScroller
|
||||
title="You might also like"
|
||||
displayCards={7}
|
||||
disableDecoration
|
||||
>
|
||||
{similarItems.data.Items.map((similar, index) => {
|
||||
{similarItems.data?.Items?.map((similar) => {
|
||||
return (
|
||||
<Card
|
||||
key={similar.Id}
|
||||
@@ -487,13 +484,7 @@ function BoxSetTitlePage() {
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!similar.ImageBlurHashes?.Primary &&
|
||||
similar.ImageBlurHashes?.Primary[
|
||||
Object.keys(similar.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import PropTypes from "prop-types";
|
||||
import React, { useState, useLayoutEffect, useRef } from "react";
|
||||
import React, { useState, useRef, useMemo, useEffect } from "react";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import Chip from "@mui/material/Chip";
|
||||
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 Stack from "@mui/material/Stack";
|
||||
import TextField from "@mui/material/TextField";
|
||||
@@ -19,18 +16,13 @@ import { motion, useScroll } from "framer-motion";
|
||||
|
||||
import {
|
||||
BaseItemKind,
|
||||
ItemFields,
|
||||
MediaStreamType,
|
||||
} 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 { useQuery } from "@tanstack/react-query";
|
||||
|
||||
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 MarkPlayedButton from "@/components/buttons/markPlayedButton";
|
||||
@@ -38,7 +30,6 @@ import PlayButton from "@/components/buttons/playButton";
|
||||
import TrailerButton from "@/components/buttons/trailerButton";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
import TextLink from "@/components/textLink";
|
||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||
import { endsAt, getRuntime } from "@/utils/date/time";
|
||||
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 { Card } from "@/components/card/card";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
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";
|
||||
|
||||
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")({
|
||||
component: EpisodeTitlePage,
|
||||
});
|
||||
@@ -97,27 +70,19 @@ function EpisodeTitlePage() {
|
||||
const { id } = Route.useParams();
|
||||
const api = Route.useRouteContext().api;
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
fields: [ItemFields.Crew],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
@@ -125,191 +90,174 @@ function EpisodeTitlePage() {
|
||||
const upcomingEpisodes = useQuery({
|
||||
queryKey: ["item", id, "episode", "upcomingEpisodes"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
parentId: item.data.ParentId,
|
||||
startIndex: item.data.IndexNumber,
|
||||
userId: user?.Id,
|
||||
parentId: item.data?.ParentId ?? "",
|
||||
startIndex: item.data?.IndexNumber ?? 0,
|
||||
excludeLocationTypes: ["Virtual"],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.Episode,
|
||||
enabled: item.isSuccess && item.data?.Type === BaseItemKind.Episode,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
||||
|
||||
const [videoTracks, setVideoTracks] = useState([]);
|
||||
const [audioTracks, setAudioTracks] = useState([]);
|
||||
const [subtitleTracks, setSubtitleTracks] = useState([]);
|
||||
const [selectedVideoTrack, setSelectedVideoTrack] = useState(0);
|
||||
const [selectedAudioTrack, setSelectedAudioTrack] = useState(0);
|
||||
const [selectedSubtitleTrack, setSelectedSubtitleTrack] = useState(0);
|
||||
|
||||
const filterMediaStreamVideo = (source) => {
|
||||
if (source.Type === MediaStreamType.Video) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const filterMediaStreamAudio = (source) => {
|
||||
if (source.Type === MediaStreamType.Audio) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const filterMediaStreamSubtitle = (source) => {
|
||||
if (source.Type === MediaStreamType.Subtitle) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const videoTracks = useMemo(() => {
|
||||
const result = item.data?.MediaStreams?.filter((source) => {
|
||||
if (source.Type === MediaStreamType.Video) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
setSelectedVideoTrack(result?.find((track) => track.IsDefault)?.Index ?? 0);
|
||||
return result ?? [];
|
||||
}, [item.data?.Id]);
|
||||
const audioTracks = useMemo(() => {
|
||||
const result = item.data?.MediaStreams?.filter((source) => {
|
||||
if (source.Type === MediaStreamType.Audio) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
setSelectedAudioTrack(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 [selectedAudioTrack, setSelectedAudioTrack] = useState(null);
|
||||
const [selectedSubtitleTrack, setSelectedSubtitleTrack] = useState(null);
|
||||
const directors = useMemo(() => {
|
||||
return item.data?.People?.filter((itm) => itm.Type === "Director") ?? [];
|
||||
}, [item.data?.Id]);
|
||||
const writers = useMemo(() => {
|
||||
return item.data?.People?.filter((itm) => itm.Type === "Writer") ?? [];
|
||||
}, [item.data?.Id]);
|
||||
const actors = useMemo(() => {
|
||||
return item.data?.People?.filter((itm) => itm.Type === "Actor") ?? [];
|
||||
}, [item.data?.Id]);
|
||||
const producers = useMemo(() => {
|
||||
return item.data?.People?.filter((itm) => itm.Type === "Producer") ?? [];
|
||||
}, [item.data?.Id]);
|
||||
|
||||
const [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(() => {
|
||||
if (item.isSuccess) {
|
||||
useEffect(() => {
|
||||
if (api && item.isSuccess && item.data) {
|
||||
setAppBackdrop(
|
||||
item.data.Type === BaseItemKind.MusicAlbum ||
|
||||
item.data.Type === BaseItemKind.Episode
|
||||
? `${api.basePath}/Items/${item.data.ParentBackdropItemId}/Images/Backdrop`
|
||||
: `${api.basePath}/Items/${item.data.Id}/Images/Backdrop`,
|
||||
`${api.basePath}/Items/${item.data.ParentBackdropItemId}/Images/Backdrop`,
|
||||
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]);
|
||||
|
||||
@@ -317,6 +265,7 @@ function EpisodeTitlePage() {
|
||||
const { scrollYProgress } = useScroll({
|
||||
target: pageRef,
|
||||
offset: ["start start", "60vh start"],
|
||||
layoutEffect: false,
|
||||
});
|
||||
const parallax = useParallax(scrollYProgress, 50);
|
||||
|
||||
@@ -335,7 +284,7 @@ function EpisodeTitlePage() {
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
if (item.isSuccess) {
|
||||
if (item.isSuccess && item.data) {
|
||||
return (
|
||||
<motion.div
|
||||
key={id}
|
||||
@@ -356,17 +305,20 @@ function EpisodeTitlePage() {
|
||||
<div className="item-hero-backdrop-container">
|
||||
{item.data.ParentBackdropImageTags?.length ? (
|
||||
<motion.img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(
|
||||
item.data.ParentBackdropItemId,
|
||||
"Backdrop",
|
||||
{
|
||||
tag: item.data.ParentBackdropImageTags[0],
|
||||
},
|
||||
)}
|
||||
alt={item.data.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.ParentBackdropItemId ?? "",
|
||||
"Backdrop",
|
||||
{
|
||||
tag: item.data.ParentBackdropImageTags[0],
|
||||
},
|
||||
)
|
||||
}
|
||||
className="item-hero-backdrop"
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
e.currentTarget.style.opacity = "1";
|
||||
}}
|
||||
style={{
|
||||
y: parallax,
|
||||
@@ -374,11 +326,11 @@ function EpisodeTitlePage() {
|
||||
/>
|
||||
) : (
|
||||
<motion.img
|
||||
alt={item.data.Name}
|
||||
alt={item.data.Name ?? ""}
|
||||
src={heroBg}
|
||||
className="item-hero-backdrop"
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
e.currentTarget.style.opacity = "1";
|
||||
}}
|
||||
style={{
|
||||
y: parallax,
|
||||
@@ -392,63 +344,80 @@ function EpisodeTitlePage() {
|
||||
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
|
||||
}}
|
||||
>
|
||||
{Object.keys(item.data.ImageTags).includes("Primary") ? (
|
||||
<>
|
||||
{item.data.ImageTags?.Primary ? (
|
||||
<div>
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data.ImageBlurHashes.Primary[
|
||||
item.data.ImageBlurHashes?.Primary?.[
|
||||
item.data.ImageTags.Primary
|
||||
]
|
||||
] ?? ""
|
||||
}
|
||||
className="item-hero-image-blurhash"
|
||||
/>
|
||||
<img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
})}
|
||||
alt={item.data.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
},
|
||||
)
|
||||
}
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
e.currentTarget.style.opacity = "1";
|
||||
}}
|
||||
className="item-hero-image"
|
||||
/>
|
||||
</>
|
||||
</div>
|
||||
) : (
|
||||
<div className="item-hero-image-icon">
|
||||
{getTypeIcon(item.data.Type)}
|
||||
{getTypeIcon(item.data.Type ?? "Episode")}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="item-hero-detail">
|
||||
<TextLink
|
||||
otherProps={{
|
||||
fontWeight: 200,
|
||||
mb: 2,
|
||||
style: {
|
||||
textDecoration: "none",
|
||||
},
|
||||
<Typography
|
||||
variant="h2"
|
||||
fontWeight="200"
|
||||
mb={2}
|
||||
style={{
|
||||
textDecoration: "none",
|
||||
}}
|
||||
variant={"h2"}
|
||||
location={`/series/${item.data.SeriesId}`}
|
||||
>
|
||||
{item.data.ParentLogoItemId?.length > 0 ? (
|
||||
<img
|
||||
alt={item.data.SeriesName}
|
||||
src={api.getItemImageUrl(item.data.ParentLogoItemId, "Logo", {
|
||||
quality: 90,
|
||||
fillWidth: 592,
|
||||
fillHeight: 592,
|
||||
})}
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
}}
|
||||
className="item-hero-logo"
|
||||
/>
|
||||
) : (
|
||||
item.data.SeriesName
|
||||
)}
|
||||
</TextLink>
|
||||
<Link
|
||||
style={{ textDecoration: "none", color: "white" }}
|
||||
to="/series/$id"
|
||||
params={{ id: item.data.SeriesId ?? "" }}
|
||||
>
|
||||
{item.data.ParentLogoItemId ? (
|
||||
<img
|
||||
alt={item.data.SeriesName ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.ParentLogoItemId,
|
||||
"Logo",
|
||||
{
|
||||
quality: 90,
|
||||
fillWidth: 592,
|
||||
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}>
|
||||
S{item.data.ParentIndexNumber ?? 0}:E
|
||||
{item.data.IndexNumberEnd
|
||||
@@ -588,7 +557,7 @@ function EpisodeTitlePage() {
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||
{endsAt(
|
||||
item.data.RunTimeTicks -
|
||||
item.data.UserData.PlaybackPositionTicks,
|
||||
(item.data.UserData?.PlaybackPositionTicks ?? 0),
|
||||
)}
|
||||
</Typography>
|
||||
)}
|
||||
@@ -682,33 +651,33 @@ function EpisodeTitlePage() {
|
||||
<div className="flex flex-row">
|
||||
<PlayButton
|
||||
item={item.data}
|
||||
itemId={item.data.Id}
|
||||
itemType={item.data.Type}
|
||||
itemUserData={item.data.UserData}
|
||||
currentVideoTrack={selectedVideoTrack}
|
||||
currentAudioTrack={selectedAudioTrack}
|
||||
currentSubTrack={selectedSubtitleTrack}
|
||||
userId={user.data.Id}
|
||||
itemType="Episode"
|
||||
currentVideoTrack={selectedVideoTrack ?? 0}
|
||||
currentAudioTrack={selectedAudioTrack ?? 0}
|
||||
currentSubTrack={selectedSubtitleTrack ?? "nosub"}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-row" style={{ gap: "1em" }}>
|
||||
<TrailerButton
|
||||
trailerItem={item.data.RemoteTrailers}
|
||||
disabled={item.data.RemoteTrailers?.length === 0}
|
||||
/>
|
||||
{item.data.RemoteTrailers && (
|
||||
<TrailerButton
|
||||
trailerItem={item.data.RemoteTrailers}
|
||||
disabled={item.data.RemoteTrailers?.length === 0}
|
||||
/>
|
||||
)}
|
||||
<LikeButton
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isFavorite={item.data.UserData.IsFavorite}
|
||||
userId={user.data.Id}
|
||||
isFavorite={item.data.UserData?.IsFavorite}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
<MarkPlayedButton
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isPlayed={item.data.UserData.Played}
|
||||
userId={user.data.Id}
|
||||
isPlayed={item.data.UserData?.Played}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -731,7 +700,7 @@ function EpisodeTitlePage() {
|
||||
}}
|
||||
value={selectedVideoTrack}
|
||||
variant="filled"
|
||||
onChange={(e) => setSelectedVideoTrack(e.target.value)}
|
||||
onChange={(e) => setSelectedVideoTrack(Number(e.target.value))}
|
||||
>
|
||||
{videoTracks.map((track) => (
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
@@ -750,7 +719,7 @@ function EpisodeTitlePage() {
|
||||
}}
|
||||
value={selectedAudioTrack}
|
||||
variant="filled"
|
||||
onChange={(e) => setSelectedAudioTrack(e.target.value)}
|
||||
onChange={(e) => setSelectedAudioTrack(Number(e.target.value))}
|
||||
>
|
||||
{audioTracks.map((track) => (
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
@@ -768,9 +737,11 @@ function EpisodeTitlePage() {
|
||||
}}
|
||||
value={selectedSubtitleTrack}
|
||||
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
|
||||
</MenuItem>
|
||||
{subtitleTracks.map((track) => (
|
||||
@@ -788,43 +759,18 @@ function EpisodeTitlePage() {
|
||||
marginTop: "1em",
|
||||
}}
|
||||
>
|
||||
{item.data.ExternalUrls.map((url) => (
|
||||
<IconLink url={url.Url} name={url.Name} />
|
||||
{item.data.ExternalUrls?.map((url) => (
|
||||
<IconLink
|
||||
key={url.Url}
|
||||
url={url.Url ?? ""}
|
||||
name={url.Name ?? ""}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{upcomingEpisodes.isSuccess &&
|
||||
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 && (
|
||||
{(item.data.People?.length ?? 0) > 0 && (
|
||||
<div className="item-detail-cast">
|
||||
<Typography variant="h5" mb={2}>
|
||||
Cast & Crew
|
||||
@@ -837,19 +783,26 @@ function EpisodeTitlePage() {
|
||||
<Link
|
||||
className="item-detail-cast-card"
|
||||
key={actor.Id}
|
||||
to={`/person/$id`}
|
||||
to="/person/$id"
|
||||
params={{
|
||||
id: actor.Id,
|
||||
id: actor.Id ?? "",
|
||||
}}
|
||||
>
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
alt={actor.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)
|
||||
}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
@@ -883,19 +836,26 @@ function EpisodeTitlePage() {
|
||||
<Link
|
||||
className="item-detail-cast-card"
|
||||
key={actor.Id}
|
||||
to={`/person/$id`}
|
||||
to="/person/$id"
|
||||
params={{
|
||||
id: actor.Id,
|
||||
id: actor.Id ?? "",
|
||||
}}
|
||||
>
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
alt={actor.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)
|
||||
}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
@@ -929,19 +889,26 @@ function EpisodeTitlePage() {
|
||||
<Link
|
||||
className="item-detail-cast-card"
|
||||
key={actor.Id}
|
||||
to={`/person/$id`}
|
||||
to="/person/$id"
|
||||
params={{
|
||||
id: actor.Id,
|
||||
id: actor.Id ?? "",
|
||||
}}
|
||||
>
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
alt={actor.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)
|
||||
}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
@@ -975,19 +942,26 @@ function EpisodeTitlePage() {
|
||||
<Link
|
||||
className="item-detail-cast-card"
|
||||
key={actor.Id}
|
||||
to={`/person/$id`}
|
||||
to="/person/$id"
|
||||
params={{
|
||||
id: actor.Id,
|
||||
id: actor.Id ?? "",
|
||||
}}
|
||||
>
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
alt={actor.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)
|
||||
}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
@@ -1015,6 +989,30 @@ function EpisodeTitlePage() {
|
||||
)}
|
||||
</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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,15 +2,14 @@ import React, { useEffect } from "react";
|
||||
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import "./favorite.scss";
|
||||
|
||||
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 { 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";
|
||||
|
||||
export const Route = createFileRoute("/_api/favorite/")({
|
||||
@@ -21,21 +20,14 @@ function FavoritePage() {
|
||||
const api = Route.useRouteContext().api;
|
||||
const [setBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const movies = useQuery({
|
||||
queryKey: ["favorite", "movies"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.Movie],
|
||||
recursive: true,
|
||||
@@ -47,8 +39,9 @@ function FavoritePage() {
|
||||
const series = useQuery({
|
||||
queryKey: ["favorite", "series"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.Series],
|
||||
recursive: true,
|
||||
@@ -60,8 +53,9 @@ function FavoritePage() {
|
||||
const musicAlbum = useQuery({
|
||||
queryKey: ["favorite", "musicAlbum"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.MusicAlbum],
|
||||
recursive: true,
|
||||
@@ -73,8 +67,9 @@ function FavoritePage() {
|
||||
const audio = useQuery({
|
||||
queryKey: ["favorite", "audio"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.Audio],
|
||||
recursive: true,
|
||||
@@ -86,8 +81,9 @@ function FavoritePage() {
|
||||
const book = useQuery({
|
||||
queryKey: ["favorite", "book"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.Book],
|
||||
recursive: true,
|
||||
@@ -99,8 +95,9 @@ function FavoritePage() {
|
||||
const musicArtists = useQuery({
|
||||
queryKey: ["favorite", "musicArtist"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.MusicArtist],
|
||||
recursive: true,
|
||||
@@ -112,8 +109,9 @@ function FavoritePage() {
|
||||
const person = useQuery({
|
||||
queryKey: ["favorite", "person"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.Person],
|
||||
recursive: true,
|
||||
@@ -127,7 +125,7 @@ function FavoritePage() {
|
||||
});
|
||||
|
||||
return (
|
||||
<main
|
||||
<div
|
||||
className="scrollY"
|
||||
style={{
|
||||
display: "flex",
|
||||
@@ -137,9 +135,9 @@ function FavoritePage() {
|
||||
paddingTop: "4.2em",
|
||||
}}
|
||||
>
|
||||
{movies.isSuccess && movies.data.Items.length > 0 && (
|
||||
{movies.isSuccess && (movies.data?.Items?.length ?? 0) > 0 && (
|
||||
<CardScroller displayCards={8} title="Movies">
|
||||
{movies.data.Items.map((item) => (
|
||||
{movies.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
@@ -148,20 +146,14 @@ function FavoritePage() {
|
||||
cardCaption={item.ProductionYear}
|
||||
cardType="portrait"
|
||||
queryKey={["favorite", "movies"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{series.isSuccess && series.data.Items.length > 0 && (
|
||||
{series.isSuccess && (series.data?.Items?.length ?? 0) > 0 && (
|
||||
<CardScroller title="TV Shows" displayCards={8} disableDecoration>
|
||||
{series.data.Items.map((item) => (
|
||||
{series.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
@@ -176,20 +168,14 @@ function FavoritePage() {
|
||||
}`}
|
||||
cardType="portrait"
|
||||
queryKey={["favorite", "series"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{audio.isSuccess && audio.data.Items.length > 0 && (
|
||||
{audio.isSuccess && (audio.data?.Items?.length ?? 0) > 0 && (
|
||||
<CardScroller title="Audio" displayCards={8} disableDecoration>
|
||||
{audio.data.Items.map((item) => (
|
||||
{audio.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
@@ -198,20 +184,14 @@ function FavoritePage() {
|
||||
cardCaption={item.ProductionYear}
|
||||
cardType="square"
|
||||
queryKey={["favorite", "audio"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{musicAlbum.isSuccess && musicAlbum.data.Items.length > 0 && (
|
||||
{musicAlbum.isSuccess && (musicAlbum.data?.Items?.length ?? 0) > 0 && (
|
||||
<CardScroller title="Albums" displayCards={8} disableDecoration>
|
||||
{musicAlbum.data.Items.map((item) => (
|
||||
{musicAlbum.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
@@ -221,20 +201,14 @@ function FavoritePage() {
|
||||
cardCaption={item.AlbumArtist}
|
||||
cardType={"square"}
|
||||
queryKey={["favorite", "musicAlbum"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{book.isSuccess && book.data.Items.length > 0 && (
|
||||
{book.isSuccess && (book.data?.Items?.length ?? 0) > 0 && (
|
||||
<CardScroller title="Books" displayCards={8} disableDecoration>
|
||||
{book.data.Items.map((item) => (
|
||||
{book.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
@@ -244,42 +218,31 @@ function FavoritePage() {
|
||||
disableOverlay
|
||||
cardType={"portrait"}
|
||||
queryKey={["favorite", "book"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{musicArtists.isSuccess && musicArtists.data.Items.length > 0 && (
|
||||
<CardScroller title="Artists" displayCards={8} disableDecoration>
|
||||
{musicArtists.data.Items.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType={"Primary"}
|
||||
disableOverlay
|
||||
cardType={"square"}
|
||||
queryKey={["favorite", "musicArtist"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{person.isSuccess && person.data.Items.length > 0 && (
|
||||
{musicArtists.isSuccess &&
|
||||
(musicArtists.data?.Items?.length ?? 0) > 0 && (
|
||||
<CardScroller title="Artists" displayCards={8} disableDecoration>
|
||||
{musicArtists.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType={"Primary"}
|
||||
disableOverlay
|
||||
cardType={"square"}
|
||||
queryKey={["favorite", "musicArtist"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{person.isSuccess && (person.data?.Items?.length ?? 0) > 0 && (
|
||||
<CardScroller title="People" displayCards={8} disableDecoration>
|
||||
{person.data.Items.map((item) => (
|
||||
{person.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
@@ -288,18 +251,12 @@ function FavoritePage() {
|
||||
disableOverlay
|
||||
cardType={"square"}
|
||||
queryKey={["favorite", "person"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</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";
|
||||
|
||||
@@ -8,24 +8,24 @@ import Carousel from "@/components/carousel";
|
||||
|
||||
// Custom Components
|
||||
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 { CardsSkeleton } from "@/components/skeleton/cards";
|
||||
import { CarouselSkeleton } from "@/components/skeleton/carousel";
|
||||
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-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 { 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 getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import {
|
||||
type BaseItemDto,
|
||||
BaseItemKind,
|
||||
@@ -36,41 +36,31 @@ import { ErrorBoundary } from "react-error-boundary";
|
||||
|
||||
export const Route = createFileRoute("/_api/home/")({
|
||||
component: Home,
|
||||
onError: (err) => {
|
||||
console.log(err);
|
||||
},
|
||||
});
|
||||
|
||||
function Home() {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
console.log(usr.data);
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const libraries = useQuery({
|
||||
queryKey: ["libraries"],
|
||||
queryFn: async () => {
|
||||
if (!api) return;
|
||||
const libs = await getUserViewsApi(api).getUserViews({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
});
|
||||
return libs.data;
|
||||
},
|
||||
enabled: !!user.data && !!api.accessToken,
|
||||
enabled: !!user?.Id && !!api?.accessToken,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const latestMedia = useQuery({
|
||||
queryKey: ["home", "latestMedia"],
|
||||
queryFn: async () => {
|
||||
if (!api) return;
|
||||
const media = await getUserLibraryApi(api).getLatestMedia({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
fields: [
|
||||
ItemFields.Overview,
|
||||
ItemFields.ParentId,
|
||||
@@ -79,19 +69,25 @@ function Home() {
|
||||
ItemFields.MediaStreams,
|
||||
ItemFields.MediaSources,
|
||||
],
|
||||
includeItemTypes: [
|
||||
BaseItemKind.Movie,
|
||||
BaseItemKind.Series,
|
||||
BaseItemKind.MusicAlbum,
|
||||
],
|
||||
enableUserData: true,
|
||||
enableImages: true,
|
||||
});
|
||||
return media.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
|
||||
const resumeItemsVideo = useQuery({
|
||||
queryKey: ["home", "resume", "video"],
|
||||
queryFn: async () => {
|
||||
if (!api) return;
|
||||
const resumeItems = await getItemsApi(api).getResumeItems({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
limit: 10,
|
||||
mediaTypes: ["Video"],
|
||||
enableUserData: true,
|
||||
@@ -99,15 +95,16 @@ function Home() {
|
||||
});
|
||||
return resumeItems.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
refetchOnMount: true,
|
||||
});
|
||||
|
||||
const resumeItemsAudio = useQuery({
|
||||
queryKey: ["home", "resume", "audio"],
|
||||
queryFn: async () => {
|
||||
if (!api) return;
|
||||
const resumeItems = await getItemsApi(api).getResumeItems({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
limit: 10,
|
||||
mediaTypes: ["Audio"],
|
||||
enableUserData: true,
|
||||
@@ -115,14 +112,15 @@ function Home() {
|
||||
});
|
||||
return resumeItems.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
|
||||
const upNextItems = useQuery({
|
||||
queryKey: ["home", "upNext"],
|
||||
queryFn: async () => {
|
||||
if (!api) return;
|
||||
const upNext = await getTvShowsApi(api).getNextUp({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
fields: [
|
||||
ItemFields.PrimaryImageAspectRatio,
|
||||
ItemFields.MediaStreams,
|
||||
@@ -133,274 +131,272 @@ function Home() {
|
||||
});
|
||||
return upNext.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
refetchOnMount: true,
|
||||
});
|
||||
|
||||
const [latestMediaLibs, setLatestMediaLibs] = useState<
|
||||
BaseItemDto[] | undefined
|
||||
>([]);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [excludeTypes] = useState(
|
||||
() => new Set(["boxsets", "playlists", "livetv", "channels"]),
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (libraries.isSuccess) {
|
||||
const latestMediaLibsTemp = libraries.data.Items?.reduce(
|
||||
const excludeTypes = ["boxsets", "playlists", "livetv", "channels"];
|
||||
const latestMediaLibs = useMemo(() => {
|
||||
if (libraries.data?.Items?.length) {
|
||||
return libraries.data?.Items?.reduce(
|
||||
(filteredItems: BaseItemDto[], currentItem) => {
|
||||
if (!excludeTypes.has(currentItem.Type)) {
|
||||
if (currentItem.Type && !excludeTypes.includes(currentItem.Type)) {
|
||||
filteredItems.push(currentItem);
|
||||
}
|
||||
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 (
|
||||
<>
|
||||
<main
|
||||
className="scrollY home padded-top"
|
||||
style={{
|
||||
flexGrow: 1,
|
||||
position: "relative",
|
||||
}}
|
||||
>
|
||||
<ErrorBoundary FallbackComponent={ErrorNotice}>
|
||||
{latestMedia.isPending ? (
|
||||
<CarouselSkeleton />
|
||||
) : (
|
||||
latestMedia.data?.length && (
|
||||
<Carousel
|
||||
content={latestMedia.data}
|
||||
onChange={(now: number) => {
|
||||
if (latestMedia.isSuccess && latestMedia.data.length > 0) {
|
||||
if (latestMedia.data[now]?.ParentBackdropImageTags) {
|
||||
setBackdrop(
|
||||
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>
|
||||
<main
|
||||
className="scrollY home padded-top"
|
||||
style={{
|
||||
flexGrow: 1,
|
||||
position: "relative",
|
||||
}}
|
||||
>
|
||||
<ErrorBoundary FallbackComponent={ErrorNotice}>
|
||||
{latestMedia.isPending ? (
|
||||
<CarouselSkeleton />
|
||||
) : (
|
||||
latestMedia.data?.length && (
|
||||
<Carousel
|
||||
content={latestMedia.data}
|
||||
onChange={handleOnChangeCarousel}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
</ErrorBoundary>
|
||||
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
<div className="error">
|
||||
<Typography>Error with Carousel</Typography>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{libraries.isPending ? (
|
||||
<CardsSkeleton />
|
||||
) : (
|
||||
<CardScroller displayCards={4} title="Libraries">
|
||||
{libraries.status === "success" &&
|
||||
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) => {
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
<div className="error">
|
||||
<Typography>Error with Carousel</Typography>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{libraries.isPending ? (
|
||||
<CardsSkeleton />
|
||||
) : (
|
||||
<CardScroller displayCards={4} title="Libraries">
|
||||
{libraries.status === "success" &&
|
||||
libraries.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.data?.Id}
|
||||
disableOverlay
|
||||
onClick={() => {
|
||||
if (item.Id) {
|
||||
navigate({
|
||||
to: "/library/$id",
|
||||
params: { id: item.Id },
|
||||
});
|
||||
}
|
||||
}}
|
||||
overrideIcon={item.CollectionType}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</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>
|
||||
</>
|
||||
</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?.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;
|
||||