Compare commits
40
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d08998f7d8 | ||
|
|
0fe7ba0f59 | ||
|
|
c8409d8a01 | ||
|
|
b0e08ce4bd | ||
|
|
60895ceecf | ||
|
|
500a90bcc0 | ||
|
|
24e07df249 | ||
|
|
d641ddfc98 | ||
|
|
e91834ad6d | ||
|
|
9d4d523d9d | ||
|
|
d586c3e38d | ||
|
|
61441b918c | ||
|
|
60b734c615 | ||
|
|
8115f2e9e7 | ||
|
|
78cabc421c | ||
|
|
31aad0f0d7 | ||
|
|
15241dd3d3 | ||
|
|
f0fd4fe353 | ||
|
|
7fb772c3b6 | ||
|
|
3f6bdb392f | ||
|
|
a1bb8f8e23 | ||
|
|
d78676560f | ||
|
|
b83eb3aea9 | ||
|
|
1265e2281b | ||
|
|
b8f2f9ae67 | ||
|
|
bf9ba21f39 | ||
|
|
8038680683 | ||
|
|
647dcc3690 | ||
|
|
e82ff1ff0c | ||
|
|
48af14b64f | ||
|
|
15e78a370c | ||
|
|
a19ea1c52f | ||
|
|
35f6c8f74a | ||
|
|
b73629ce80 | ||
|
|
9afe933d8d | ||
|
|
8f0f7b2218 | ||
|
|
74ea154954 | ||
|
|
cb4af781e2 | ||
|
|
9fd51f10ca | ||
|
|
43bdaa1ae2 |
No files matched your search
@@ -24,15 +24,8 @@ A clear and concise description of what you expected to happen.
|
|||||||
If applicable, add screenshots to help explain your problem.
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
**Desktop (please complete the following information):**
|
**Desktop (please complete the following information):**
|
||||||
- OS: [e.g. iOS]
|
- OS: [e.g. Windows]
|
||||||
- Browser [e.g. chrome, safari]
|
- Version [e.g. v0.0.6-dev]
|
||||||
- Version [e.g. 22]
|
- Jellyfin Version [e.g. 10.9]
|
||||||
|
|
||||||
**Smartphone (please complete the following information):**
|
|
||||||
- Device: [e.g. iPhone6]
|
|
||||||
- OS: [e.g. iOS8.1]
|
|
||||||
- Browser [e.g. stock browser, safari]
|
|
||||||
- Version [e.g. 22]
|
|
||||||
|
|
||||||
**Additional context**
|
**Additional context**
|
||||||
Add any other context about the problem here.
|
Add any other context about the problem here.
|
||||||
+1
-1
@@ -31,7 +31,7 @@ target/
|
|||||||
|
|
||||||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
||||||
Cargo.lock
|
# Cargo.lock
|
||||||
|
|
||||||
# These are backup files generated by rustfmt
|
# These are backup files generated by rustfmt
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
|
|||||||
+1
-1
@@ -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
|
||||||
Vendored
+3
-1
@@ -26,5 +26,7 @@
|
|||||||
"typescript.tsdk": "node_modules/typescript/lib",
|
"typescript.tsdk": "node_modules/typescript/lib",
|
||||||
"[scss]": {
|
"[scss]": {
|
||||||
"editor.defaultFormatter": "vscode.css-language-features"
|
"editor.defaultFormatter": "vscode.css-language-features"
|
||||||
}
|
},
|
||||||
|
"millionLint.theme": "million",
|
||||||
|
"millionLint.disableOutdatedVersionMessage": true
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,41 @@
|
|||||||
|
- # 0.0.7-dev (20/11/2024)
|
||||||
|
- chore(deps): update dependencies
|
||||||
|
- refactor: change UI of login/list and fix Api not being defined in context
|
||||||
|
- fix: player/audio route not able to interact with audioPlayer
|
||||||
|
- fix: audio player info not visible
|
||||||
|
- fix: audio player not playing audio
|
||||||
|
- fix: toggling ssubtitles not working
|
||||||
|
- fix: subtitles not being rendered #401
|
||||||
|
- fix: hero carousel indicators not scrolling
|
||||||
|
- fix: vite build error for safari13
|
||||||
|
- fix: blink not launching or rendering on opening
|
||||||
|
- Merge branch 'main' of https://github.com/prayag17/JellyPlayer
|
||||||
|
- chore(deps): update dependencies
|
||||||
|
- Merge pull request #410 from prayag17/renovate/tauri-plugin-notification-2.x-lockfile
|
||||||
|
- Merge pull request #409 from Blackspirits/patch-1
|
||||||
|
- chore(deps): update dependencies
|
||||||
|
- (origin/renovate/tauri-plugin-notification-2.x-lockfile) fix(deps): update rust crate tauri-plugin-notification to v2.0.1
|
||||||
|
- feat: allow downloading images from ImageViewer
|
||||||
|
- Update index.tsx
|
||||||
|
- feat: implement basic image viewer #338 #240
|
||||||
|
- fix: react infinite depth error
|
||||||
|
- fix: vite config
|
||||||
|
- refactor: remove @million/js and @million/lint
|
||||||
|
- refactor: remove Cargo.lock from .gitignore #400
|
||||||
|
- chore(deps): update dependencies
|
||||||
|
- refactor: code cleanup
|
||||||
|
- fix: bug_report showing extra fields
|
||||||
|
- refactor: remove redundant calls for getCurrentUser
|
||||||
|
- feat: show queue item from currently playing item in queueButton
|
||||||
|
- chore(deps): update dependencies
|
||||||
|
- feat: remember library filters #192
|
||||||
|
- Merge pull request #370 from prayag17/renovate/tauri-apps-plugin-clipboard-manager-2.x
|
||||||
|
- fix(deps): update dependency @tauri-apps/plugin-clipboard-manager to v2.1.0-beta.6
|
||||||
|
- Merge pull request #381 from prayag17/renovate/wavesurfer.js-7.x-lockfile
|
||||||
|
- Merge pull request #342 from prayag17/renovate/tanstack-router-monorepo
|
||||||
|
- Merge pull request #368 from prayag17/renovate/tauri-monorepo
|
||||||
|
- chore(release): update latest.json
|
||||||
|
|
||||||
- # 0.0.6-dev (9/7/2024)
|
- # 0.0.6-dev (9/7/2024)
|
||||||
> **Note** : This is an unstable release
|
> **Note** : This is an unstable release
|
||||||
- feat: add video player slider bubble theming #337
|
- feat: add video player slider bubble theming #337
|
||||||
|
|||||||
+18
-42
@@ -4,61 +4,39 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<!-- <script src="http://localhost:8097"></script> -->
|
<script src="http://localhost:8097"></script>
|
||||||
<title>Jellyplayer</title>
|
<title>Jellyplayer</title>
|
||||||
<style>
|
<style>
|
||||||
.app-loading {
|
.app-loading {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 50%;
|
||||||
left: 0;
|
left: 50%;
|
||||||
bottom: 0;
|
transform: translate(-50%,-50%);
|
||||||
right: 0;
|
width: 10em;
|
||||||
background: #fff;
|
height: 10em;
|
||||||
|
background: rgb(180 180 180);
|
||||||
z-index: 100000;
|
z-index: 100000;
|
||||||
display: flex;
|
mask-image: url("./src/assets/icon-outline.png");
|
||||||
align-items: center;
|
mask-size: contain;
|
||||||
justify-content: center;
|
|
||||||
flex-direction: column;
|
|
||||||
transition: opacity 0.25s ease-in-out;
|
|
||||||
opacity: 0;
|
|
||||||
animation: fadeIn linear 500ms forwards;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-loading.hidden {
|
.app-loading.hidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-loading-logo {
|
|
||||||
width: 5vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-loading-bar-container{
|
.app-loading-anim{
|
||||||
height: 2px;
|
width: 150%;
|
||||||
width: 16vw;
|
|
||||||
position: absolute;
|
|
||||||
left: 50%;
|
|
||||||
bottom: 36vh;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-loading-bar{
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: #101010;
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
background: linear-gradient(to right,transparent,rgb(255 255 255),transparent);
|
||||||
transform: scaleX(0);
|
transform: scaleX(0);
|
||||||
animation: loading 1s ease-in-out infinite both;
|
animation: loading 0.75s linear infinite both;
|
||||||
transform-origin: left;
|
transform-origin: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes fadeIn {
|
|
||||||
0%{
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
100%{
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@keyframes loading {
|
@keyframes loading {
|
||||||
0%{
|
0%{
|
||||||
transform: translate(-100%);
|
transform: translate(-100%);
|
||||||
@@ -75,10 +53,8 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="app-loading">
|
<div class="app-loading">
|
||||||
<img src="./src/assets/icon-outline.svg" class="app-loading-logo" />
|
<!-- <img src="./src/assets/icon-outline.svg" class="app-loading-logo" /> -->
|
||||||
<div class="app-loading-bar-container">
|
<div class="app-loading-anim"></div>
|
||||||
<div class="app-loading-bar"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<svg style="width: 0; height: 0; position: absolute" aria-hidden="true" focusable="false">
|
<svg style="width: 0; height: 0; position: absolute" aria-hidden="true" focusable="false">
|
||||||
|
|||||||
+10
-10
@@ -1,19 +1,19 @@
|
|||||||
{
|
{
|
||||||
"version": "0.0.5-dev",
|
"version": "0.0.6-dev",
|
||||||
"notes": "\n- feat(web): Add new About page (#258) by @prayag17\n- feat(web): Allow managing servers from settings dialog by @prayag17\n- feat(search): Add Episode to search by @prayag17\n- feat(settings-server): Add a refretch button by @prayag17\n- feat(web): Add a global query fetch/mutation status by @prayag17\n- fix(server): Use redirect instead of relaunch when changing or deleting a server by @prayag17\n- refactor(player): Rewrite and improve video playback by @prayag17\n- feat(web): Use season backdrop in series page if available by @prayag17\n- feat(player): Allow selecting subtitles during playback by @prayag17\n- feat(ui): Add new episode layout by @prayag17",
|
"notes": "- feat: add video player slider bubble theming #337\n- feat: add trickplay support #338 #337\n- fix(ci): update env variables\n- fix(ci): fix ubuntu build failing\n- chore(deps): update js and rust deps\n- feat: add chapter markers #337\n- feat: add subtitle support #337\n- fix(ci): invalid tauri build command\n- fix(ci):workflow repo name\n- feat: remember last search query\n- feat: add new audioPlayer route and allow reordering queue\n- chore(deps): update deps\n- chore(deps): cleanup unused dependencies and update dependencies\n- refactor: replace wavesurfer with html audio player\n- feat: add new album page\n- fix: quick connect not working\n- chore: change tauri updater signing keys\n- feat: show upNext card for episode items in player\n- fix: login page not working\n- Merge pull request #332 from pypp/feat/double-click-fullscreen\n- Merge pull request #333 from pypp/feat/scrollwheel-volume-control\n- fix: removed subtitleRenderer state that was added while merging\n- fix: fixed bug caused by merge econflicts\n- Merge remote-tracking branch 'upstream/main' into feat/scrollwheel-volume-control\n- fix: fixed fucntion to use the new API\n- Merge remote-tracking branch 'upstream/main' into feat/double-click-fullscreen\n- Merge branch 'main' of https://github.com/pypp/JellyPlayer into feat/double-click-fullscreen\n- fix(deps): update dependency babel-plugin-react-compiler to v0.0.0\n- fix(deps): update tauri monorepo\n- chore(deps): update dependencies\n- feat: allow toggling subtitles on and off from player\n- fix: playNext and playPrevious logic\n- feat: add intro-skipper\n- refactor: cleanup unused variables in playbackStore\n- chore(deps): update packages\n- refactor: support vtt and ass subtitles\n- refactor: add sorting options to library page for Series and BoxSets\n- style: update hero-carousel styling\n- chore(deps): update deps\n- fix(deps): update dependency framer-motion to v11.2.9\n- refactor: move most routing logic to tanstack\n- refactor: implement new login logic and verify context.api status\n- chore(deps): update dependencies\n- refactor: move to tanstack router\n- fix: videoPlayer not restoring playback position when queueItem is updated\n- fix: Slight UI regression when changing servers on latest version #288\n- fix: eac3 codec support\n- refactor: queueItem playback\n- fix(deps): update rust crate tauri to 1.6.2 (#298)\n- fix: episode playback\n- feat: add queueButton\n- Merge branch 'main' of https://github.com/prayag17/JellyPlayer\n- chore(deps): fix vite 5.2 bundle\n- fix(deps): update dependency @types/react to v18.3.1 (#295)\n- fix: scrollTrigger in libraryView\n- style: improve styling\n- fix: backdrop flashing\n- feat: use tanstack virtual for rendering library items\n- style: improve login notice ui\n- refactor: fetch mediaSource for series\n- refactor: implement new playback method for playbutton (wip)\n- ui: improve glass texture\n- ui: implement new appBar #284\n- feat: display sdr and hdr only videoRange\n- style: improve hdr10 logo spacing\n- chore: update title-movie screenshot in README.md\n- chore: update title-movie.png\n- fix: hdr10 icon height not matching\n- style: update mediainfo icons\n- style: update mediainfo icons\n- fix: no subtitle option not selecting\n- feat: use brand logo for hdr10plus\n- fix: default subtitle not being selected properly\n- style: display backdrops in boxset\n- fix: videoPlayer not exiting if subtitles are disabled\n- chore: add kitsu icon to iconLink\n- fix: carousel not rendering\n- chore: update readme\n- chore: update screenshots\n- fix: improve hdr10+ detection\n- feat: add quality and audio brand labels\n- style: improve page-margin\n- fix(player): unable to play media without subtitles\n- fix: album not displaying if no parent backdrop is found\n- chore: add screenshots and some features of JellyPlayer #242\n- chore: upload screenshots\n- fix(nsis): nsis setup images not displaying correctly\n- style: Improve titlePage styling\n- style: change cardText styling\n- style: Improve overall app component paddings and margins and rollback vite to 5.1.6\n- chore(deps): update dependency vite to v5.2.6 (#286)\n- fix(deps): update material-ui monorepo (#270)\n- fix(deps): update dependency @types/node to v20.11.29 (#292)\n- fix(deps): update dependency @types/react to v18.2.67 (#293)\n- fix(deps): update tanstack-query monorepo to v5.28.6 (#271)\n- fix(deps): update dependency @types/react to v18.2.67 (#272)\n- fix(deps): update dependency @types/node to v20.11.29 (#274)\n- fix(deps): update dependency framer-motion to v11.0.15 (#278)\n- fix(deps): update dependency typescript to v5.4.3 (#287)\n- fix(deps): update dependency material-symbols to v0.17.1 (#289)\n- chore(deps): update dependency @biomejs/biome to v1.6.2 (#290)\n- fix(deps): update rust crate log to ^0.4.21 (#276)\n- chore: update latest.json",
|
||||||
"pub_date": "2024-03-17T11:50:31.121Z",
|
"pub_date": "2024-09-06T20:40:35.324Z",
|
||||||
"platforms": {
|
"platforms": {
|
||||||
"darwin-x86_64": {
|
"darwin-aarch64": {
|
||||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVROHVTNk5NMHU2bVZjYWVCcmxtUk5tRTV0bC9acGxUQkdGMlMrVFdkOVJCS3ZsMlY1aXR0M3BvdnBVTnl6MUVpcWsxUzdFbVNXbHF5S1pQbTZIM0JXallCeklYaUdyWFFBPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzEwNjc1OTMxCWZpbGU6SmVsbHlQbGF5ZXIuYXBwLnRhci5negpGM2xCQnR1YWhDWi9mMCtLZjFHQ0twMUNub3VBTHE2SHZSMnpGOVRWVGVncE42ODZ5Q2M1bm9aa3VGUFhpM245eVhIMDZWWkRyQnVMaWY4c1Z2WE5Edz09Cg==",
|
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSNkxEL1dFMElZL1VsZ01leXRhMXFrek9ENWZCWHZPR3Y1Ky9SZ3BOc2hEeFlMU0pVR1gzL1NNdytOL1hGTzU5enpZNVRlY01JaDNjaTN3azdDMU9BcVVUWEg5RzdOY1FvPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzI1NjU0NzUzCWZpbGU6QmxpbmsuYXBwLnRhci5negphcUh0QXFNUnBEWUFGZGU3V0pzQXN5eXhzSmNOdzNoSDFLV3BlbHNGKzFvWXpJR0V4UmJoYTNNV0tZZ0VKcHdDbERxWFpEYk5kUVVxZWFnWnIrSThBUT09Cg==",
|
||||||
"url": "https://github.com/prayag17/JellyPlayer/releases/download/v0.0.5-dev/JellyPlayer_x64.app.tar.gz"
|
"url": "https://github.com/prayag17/Blink/releases/download/v0.0.6-dev/Blink_aarch64.app.tar.gz"
|
||||||
},
|
},
|
||||||
"linux-x86_64": {
|
"linux-x86_64": {
|
||||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVROHVTNk5NMHU2bVMvOXE1SGNiWmRDVWVMYVBLTnU4MXJheTd4NmY2WWszRjdUcnRySnl5TkdEVThYa1lHNHRXT1FIUzFwelhMZ3U4S2lJTjI4Y1IrV05iOVRmZWgzS1FrPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzEwNjc2MDE4CWZpbGU6amVsbHktcGxheWVyXzAuMC41LWRldl9hbWQ2NC5BcHBJbWFnZS50YXIuZ3oKcko3VUZFZVcwcVVZK0IwY3lZUlk5WThySjI2NEptY1BFb1dYYlRDMTQxZzFJekovS2tHVFMwK0pTS01JV3NSMWxvL2QwNEVqb2VTZVE2MmQ2UFhXQ1E9PQo=",
|
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSNkxEL1dFMElZL1JtYjlPdWJ2WngrU21iV1ZSd3BCWjBSdDVxT0VGcSs5VFZ0YUs1eFlIbnNlUnN1VzJLOUg4K25sdVRWUzhkR0VJWDBIa081R01aUyt4S3VQZHlSQ3d3PQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzI1NjU1MTAxCWZpbGU6QmxpbmtfMC4wLjYtZGV2X2FtZDY0LkFwcEltYWdlLnRhci5nego4ZllLcnRyWW5FM0JRY0dZUkJocFdsNlRzdjdnY3dDUFpGSENNSVNwdkRMZStvZWZTSlFLL25IR1A3a2pzdTlBUjNveVJ5VDFqYkxJdWF5MWFFeWxDdz09Cg==",
|
||||||
"url": "https://github.com/prayag17/JellyPlayer/releases/download/v0.0.5-dev/jelly-player_0.0.5-dev_amd64.AppImage.tar.gz"
|
"url": "https://github.com/prayag17/Blink/releases/download/v0.0.6-dev/Blink_0.0.6-dev_amd64.AppImage.tar.gz"
|
||||||
},
|
},
|
||||||
"windows-x86_64": {
|
"windows-x86_64": {
|
||||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVROHVTNk5NMHU2bVZyK3o0d0FWVURRcDg3QnorYzNDUVNwamJIZ2JDTTNwUjdFUS9jMXN2cVFiVXNKdFNoaVNUUFlSaVI2Z3dyeEdqWmRCekFqSkYwa09xTFZSaG5mb1FRPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzEwNjc2MjIxCWZpbGU6SmVsbHlQbGF5ZXJfMC4wLjUtZGV2X3g2NC1zZXR1cC5uc2lzLnppcApPdGxzdk1aU0pJSC80a2xvYk5TbWhJeUNvVjNDa2piYkNQOTF0bmFWVTJ6TFVNc0trRkhqeUNxdGNNNUQvUXd4TUpXTzNoRHd1QUN2YnN5Y1BUTGVDQT09Cg==",
|
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSNkxEL1dFMElZL2F4bGtQUmxDVjZadzRuNHk0RTd5RmRJbmVsOEwxaTV1U3FzZHAveEhiU0xmcGx2N0toaUR4alRiS2lmTTU0QStHc2JzT2diR1JjRm5VZU1SUWFuS0F3PQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzI1NjU1MjMyCWZpbGU6QmxpbmtfMC4wLjYtZGV2X3g2NC1zZXR1cC5uc2lzLnppcApPdk5zQ0NFcFQySXNjck8zTEM4SitwdTV6UXRKYnpPKzBJQnVJRDkxWjdqWGgwaXBSb1k0aGMvVEhwWWhBTEJzZHRhVy9KU0lCbjl2bG45WUJxOUlBZz09Cg==",
|
||||||
"url": "https://github.com/prayag17/JellyPlayer/releases/download/v0.0.5-dev/JellyPlayer_0.0.5-dev_x64-setup.nsis.zip"
|
"url": "https://github.com/prayag17/Blink/releases/download/v0.0.6-dev/Blink_0.0.6-dev_x64-setup.nsis.zip"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+47
-39
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "blink",
|
"name": "blink",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.6-dev",
|
"version": "0.0.7-dev",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite && tsr watch",
|
"dev": "vite --force && tsr watch",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"tauri": "tauri",
|
"tauri": "tauri",
|
||||||
@@ -13,35 +13,43 @@
|
|||||||
"tanstack-router-dev": "tsr watch"
|
"tanstack-router-dev": "tsr watch"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@dnd-kit/core": "^6.1.0",
|
||||||
|
"@dnd-kit/modifiers": "^7.0.0",
|
||||||
|
"@dnd-kit/sortable": "^8.0.0",
|
||||||
|
"@dnd-kit/utilities": "^3.2.2",
|
||||||
"@emotion/react": "^11.13.3",
|
"@emotion/react": "^11.13.3",
|
||||||
"@emotion/styled": "^11.13.0",
|
"@emotion/styled": "^11.13.0",
|
||||||
"@fontsource-variable/jetbrains-mono": "^5.0.22",
|
"@fontsource-variable/jetbrains-mono": "^5.1.1",
|
||||||
"@fontsource-variable/noto-sans": "^5.0.5",
|
"@fontsource-variable/noto-sans": "^5.1.0",
|
||||||
"@jellyfin/sdk": "0.10.0",
|
"@jellyfin/sdk": "0.11.0",
|
||||||
"@million/lint": "1.0.0-rc.84",
|
"@million/lint": "^1.0.12",
|
||||||
"@mui/lab": "6.0.0-beta.9",
|
"@mui/lab": "6.0.0-beta.15",
|
||||||
"@mui/material": "6.0.2",
|
"@mui/material": "6.1.7",
|
||||||
"@react-spring/web": "^9.7.4",
|
"@react-spring/web": "^9.7.5",
|
||||||
"@tanem/react-nprogress": "^5.0.51",
|
"@tanem/react-nprogress": "^5.0.53",
|
||||||
"@tanstack/react-query": "^5.55.0",
|
"@tanstack/react-query": "^5.60.6",
|
||||||
"@tanstack/react-query-devtools": "^5.55.0",
|
"@tanstack/react-query-devtools": "^5.60.6",
|
||||||
"@tanstack/react-router": "^1.56.1",
|
"@tanstack/react-router": "^1.82.1",
|
||||||
"@tanstack/react-virtual": "^3.10.7",
|
"@tanstack/react-virtual": "^3.10.9",
|
||||||
"@tauri-apps/api": "2.0.0-beta.15",
|
"@tauri-apps/api": "2.1.1",
|
||||||
"@tauri-apps/plugin-clipboard-manager": "2.1.0-beta.5",
|
"@tauri-apps/plugin-clipboard-manager": "2.1.0-beta.6",
|
||||||
"@tauri-apps/plugin-process": "2.0.0-rc.1",
|
"@tauri-apps/plugin-dialog": "2.0.1",
|
||||||
|
"@tauri-apps/plugin-notification": "2.0.0",
|
||||||
|
"@tauri-apps/plugin-process": "2.0.0",
|
||||||
"@tauri-apps/plugin-store": "github:tauri-apps/tauri-plugin-store#v2",
|
"@tauri-apps/plugin-store": "github:tauri-apps/tauri-plugin-store#v2",
|
||||||
"@tauri-apps/plugin-updater": "2.0.0-rc.2",
|
"@tauri-apps/plugin-updater": "2.0.0",
|
||||||
"@types/node": "^22.5.4",
|
"@tauri-apps/plugin-upload": "2.1.0",
|
||||||
"@types/react": "^18.3.5",
|
"@types/node": "^22.9.1",
|
||||||
"@types/react-dom": "^18.3.0",
|
"@types/react": "^18.3.12",
|
||||||
|
"@types/react-dom": "^18.3.1",
|
||||||
"axios": "^1.7.7",
|
"axios": "^1.7.7",
|
||||||
"axios-tauri-api-adapter": "^0.2.2",
|
"axios-tauri-api-adapter": "^2.0.3",
|
||||||
"blurhash": "^2.0.5",
|
"blurhash": "^2.0.5",
|
||||||
"framer-motion": "^11.5.4",
|
"framer-motion": "^11.11.17",
|
||||||
|
"immer": "^10.1.1",
|
||||||
"jassub": "^1.7.17",
|
"jassub": "^1.7.17",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"material-symbols": "^0.23.0",
|
"material-symbols": "^0.27.0",
|
||||||
"million": "^3.1.11",
|
"million": "^3.1.11",
|
||||||
"notistack": "^3.0.1",
|
"notistack": "^3.0.1",
|
||||||
"react": "18.3.1",
|
"react": "18.3.1",
|
||||||
@@ -49,29 +57,29 @@
|
|||||||
"react-dnd": "^16.0.1",
|
"react-dnd": "^16.0.1",
|
||||||
"react-dnd-html5-backend": "^16.0.1",
|
"react-dnd-html5-backend": "^16.0.1",
|
||||||
"react-dom": "18.3.1",
|
"react-dom": "18.3.1",
|
||||||
"react-error-boundary": "^4.0.13",
|
"react-error-boundary": "^4.1.2",
|
||||||
"react-markdown": "^9.0.1",
|
"react-markdown": "^9.0.1",
|
||||||
"react-multi-carousel": "^2.8.5",
|
"react-multi-carousel": "^2.8.5",
|
||||||
"react-player": "^2.16.0",
|
"react-player": "^2.16.0",
|
||||||
"react-use-konami": "^1.1.0",
|
"react-use-konami": "^1.1.0",
|
||||||
"remark-gfm": "^4.0.0",
|
"remark-gfm": "^4.0.0",
|
||||||
"typescript": "^5.5.4",
|
"typescript": "^5.6.3",
|
||||||
"vite-plugin-svgr": "^4.2.0",
|
"vite-plugin-svgr": "^4.3.0",
|
||||||
"wavesurfer.js": "^7.8.4",
|
"wavesurfer.js": "^7.8.8",
|
||||||
"zustand": "^4.5.5"
|
"zustand": "5.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/plugin-proposal-optional-chaining-assign": "^7.24.7",
|
"@babel/plugin-proposal-optional-chaining-assign": "^7.25.9",
|
||||||
"@biomejs/biome": "^1.8.3",
|
"@biomejs/biome": "^1.9.4",
|
||||||
"@tanstack/router-cli": "^1.56.1",
|
"@tanstack/router-cli": "^1.81.9",
|
||||||
"@tanstack/router-devtools": "^1.56.1",
|
"@tanstack/router-devtools": "^1.82.1",
|
||||||
"@tanstack/router-vite-plugin": "^1.56.1",
|
"@tanstack/router-vite-plugin": "^1.81.9",
|
||||||
"@tauri-apps/cli": "2.0.0-beta.22",
|
"@tauri-apps/cli": "2.1.0",
|
||||||
"@types/lodash": "^4.17.7",
|
"@types/lodash": "^4.17.13",
|
||||||
"@vitejs/plugin-react": "^4.3.1",
|
"@vitejs/plugin-react": "^4.3.3",
|
||||||
"prop-types": "^15.8.1",
|
"prop-types": "^15.8.1",
|
||||||
"sass": "^1.78.0",
|
"sass": "^1.81.0",
|
||||||
"vite": "^5.4.3"
|
"vite": "^5.4.11"
|
||||||
},
|
},
|
||||||
"license": "GPL-3.0-only"
|
"license": "GPL-3.0-only"
|
||||||
}
|
}
|
||||||
Generated
+1686
-1370
File diff suppressed because it is too large.
Load diff
Binary file not shown.
|
After Width: | Height: | Size: 287 KiB |
Generated
+6429
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "blink"
|
name = "blink"
|
||||||
version = "0.0.6-dev"
|
version = "0.0.7-dev"
|
||||||
description = "A Modern Jellyfin Client"
|
description = "A Modern Jellyfin Client"
|
||||||
authors = ["prayag17", "JellyPlayer contributors (https://github.com/prayag17/JellyPlayer/graphs/contributors)"]
|
authors = ["prayag17", "JellyPlayer contributors (https://github.com/prayag17/JellyPlayer/graphs/contributors)"]
|
||||||
license = "GPL-3.0-only"
|
license = "GPL-3.0-only"
|
||||||
@@ -27,6 +27,9 @@ portpicker = "0.1" # used in the example to pick a random free port
|
|||||||
tauri-plugin-process = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
tauri-plugin-process = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||||
tauri-plugin-updater = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
tauri-plugin-updater = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||||
tauri-plugin-clipboard-manager = "2.1.0-beta.6"
|
tauri-plugin-clipboard-manager = "2.1.0-beta.6"
|
||||||
|
tauri-plugin-notification = "2.0.0-rc.1"
|
||||||
|
tauri-plugin-upload = "2.0.0"
|
||||||
|
tauri-plugin-dialog = "2.0.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# by default Tauri runs in production mode
|
# by default Tauri runs in production mode
|
||||||
|
|||||||
@@ -12,6 +12,10 @@
|
|||||||
"store:allow-keys",
|
"store:allow-keys",
|
||||||
"store:allow-load",
|
"store:allow-load",
|
||||||
"updater:allow-check",
|
"updater:allow-check",
|
||||||
"updater:allow-download-and-install"
|
"updater:allow-download-and-install",
|
||||||
|
"notification:default",
|
||||||
|
"core:webview:allow-internal-toggle-devtools",
|
||||||
|
"dialog:default",
|
||||||
|
"upload:allow-download"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -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"]},"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"]}}
|
||||||
+1036
-1377
File diff suppressed because it is too large.
Load diff
+1036
-1377
File diff suppressed because it is too large.
Load diff
@@ -4,6 +4,9 @@ use tauri_plugin_log::{fern::colors::ColoredLevelConfig, Target, TargetKind};
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
|
.plugin(tauri_plugin_dialog::init())
|
||||||
|
.plugin(tauri_plugin_upload::init())
|
||||||
|
.plugin(tauri_plugin_notification::init())
|
||||||
.plugin(tauri_plugin_clipboard_manager::init())
|
.plugin(tauri_plugin_clipboard_manager::init())
|
||||||
.plugin(
|
.plugin(
|
||||||
tauri_plugin_log::Builder::default()
|
tauri_plugin_log::Builder::default()
|
||||||
|
|||||||
@@ -47,13 +47,7 @@
|
|||||||
},
|
},
|
||||||
"resources": [],
|
"resources": [],
|
||||||
"shortDescription": "Blink",
|
"shortDescription": "Blink",
|
||||||
"targets": [
|
"targets": ["deb", "appimage", "nsis", "app", "dmg"],
|
||||||
"deb",
|
|
||||||
"appimage",
|
|
||||||
"nsis",
|
|
||||||
"app",
|
|
||||||
"dmg"
|
|
||||||
],
|
|
||||||
"licenseFile": "../LICENSE",
|
"licenseFile": "../LICENSE",
|
||||||
"createUpdaterArtifacts": "v1Compatible"
|
"createUpdaterArtifacts": "v1Compatible"
|
||||||
},
|
},
|
||||||
@@ -64,7 +58,7 @@
|
|||||||
"updater": {
|
"updater": {
|
||||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEZEMTg0MjEzRDYzRjJDN0EKUldSNkxEL1dFMElZL1dxbHA0V2lyVDFEdGpOZXkxMG9XdHVLVnRpVVV5c1Z0OFNRUE45dkpxbFAK",
|
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEZEMTg0MjEzRDYzRjJDN0EKUldSNkxEL1dFMElZL1dxbHA0V2lyVDFEdGpOZXkxMG9XdHVLVnRpVVV5c1Z0OFNRUE45dkpxbFAK",
|
||||||
"endpoints": [
|
"endpoints": [
|
||||||
"https://raw.githack.com/prayag17/JellyPlayer/main/latest.json"
|
"https://rawcdn.githack.com/prayag17/Blink/refs/heads/main/latest.json"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -79,7 +73,8 @@
|
|||||||
"visible": true,
|
"visible": true,
|
||||||
"center": true,
|
"center": true,
|
||||||
"label": "main",
|
"label": "main",
|
||||||
"dragDropEnabled": false
|
"dragDropEnabled": false,
|
||||||
|
"backgroundColor": "#08001f"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"security": {
|
"security": {
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 103 KiB |
@@ -1,3 +1,3 @@
|
|||||||
<svg width="1310" height="1512" viewBox="0 0 1310 1512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg width="1512" height="1512" viewBox="0 0 1512 1512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M654.715 756L52 1103.98L654.715 1451.96L1257.43 1103.98V408.022L654.715 60.0444L52 408.022L654.715 756ZM654.715 0L1309.43 378V1134L654.715 1512L0 1134V1073.96V438.044V378L654.715 0Z" fill="#101010"/>
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M755.715 756L153 1103.98L755.715 1451.96L1358.43 1103.98V408.022L755.715 60.0444L153 408.022L755.715 756ZM755.715 0L1410.43 378V1134L755.715 1512L101 1134V1073.96V438.044V378L755.715 0Z" fill="white"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 360 B After Width: | Height: | Size: 362 B |
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
@@ -1,4 +1,3 @@
|
|||||||
import useDebounce from "@/utils/hooks/useDebounce";
|
|
||||||
import React, {
|
import React, {
|
||||||
type ReactNode,
|
type ReactNode,
|
||||||
useCallback,
|
useCallback,
|
||||||
@@ -11,12 +10,7 @@ import { useSpring } from "@react-spring/web";
|
|||||||
import { debounce } from "lodash";
|
import { debounce } from "lodash";
|
||||||
|
|
||||||
import "./style.scss";
|
import "./style.scss";
|
||||||
import { Button, IconButton } from "@mui/material";
|
import { IconButton } from "@mui/material";
|
||||||
|
|
||||||
enum Direction {
|
|
||||||
RIGHT = 0,
|
|
||||||
LEFT = 1,
|
|
||||||
}
|
|
||||||
|
|
||||||
const Slider = ({
|
const Slider = ({
|
||||||
content,
|
content,
|
||||||
@@ -76,7 +70,7 @@ const Slider = ({
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const slide = (direction: Direction) => {
|
const slideLeft = useCallback(() => {
|
||||||
const clientWidth =
|
const clientWidth =
|
||||||
containerRef.current?.getBoundingClientRect().width ?? 0;
|
containerRef.current?.getBoundingClientRect().width ?? 0;
|
||||||
const cardWidth =
|
const cardWidth =
|
||||||
@@ -86,12 +80,11 @@ const Slider = ({
|
|||||||
const visibleItems = Math.floor(clientWidth / cardWidth);
|
const visibleItems = Math.floor(clientWidth / cardWidth);
|
||||||
const scrollOffset = scrollPosition % cardWidth;
|
const scrollOffset = scrollPosition % cardWidth;
|
||||||
|
|
||||||
if (direction === Direction.LEFT) {
|
|
||||||
const newX = Math.max(
|
const newX = Math.max(
|
||||||
scrollPosition - scrollOffset - visibleItems * cardWidth,
|
scrollPosition - scrollOffset - visibleItems * cardWidth,
|
||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
setX.start({
|
setX({
|
||||||
from: { x: scrollPosition },
|
from: { x: scrollPosition },
|
||||||
to: { x: newX },
|
to: { x: newX },
|
||||||
onChange: (results) => {
|
onChange: (results) => {
|
||||||
@@ -108,12 +101,23 @@ const Slider = ({
|
|||||||
} else {
|
} else {
|
||||||
setScrollPos({ isStart: false, isEnd: false });
|
setScrollPos({ isStart: false, isEnd: false });
|
||||||
}
|
}
|
||||||
} else if (direction === Direction.RIGHT) {
|
}, [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(
|
const newX = Math.min(
|
||||||
scrollPosition - scrollOffset + visibleItems * cardWidth,
|
scrollPosition - scrollOffset + visibleItems * cardWidth,
|
||||||
containerRef.current?.scrollWidth ?? 0 - clientWidth,
|
containerRef.current?.scrollWidth ?? 0 - clientWidth,
|
||||||
);
|
);
|
||||||
setX.start({
|
setX({
|
||||||
from: { x: scrollPosition },
|
from: { x: scrollPosition },
|
||||||
to: { x: newX },
|
to: { x: newX },
|
||||||
onChange: (results) => {
|
onChange: (results) => {
|
||||||
@@ -130,22 +134,21 @@ const Slider = ({
|
|||||||
} else {
|
} else {
|
||||||
setScrollPos({ isStart: false, isEnd: false });
|
setScrollPos({ isStart: false, isEnd: false });
|
||||||
}
|
}
|
||||||
}
|
}, [setX]);
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="slider">
|
<div className="slider">
|
||||||
<IconButton
|
<IconButton
|
||||||
className="slider-button left"
|
className="slider-button left"
|
||||||
onClick={() => slide(Direction.LEFT)}
|
onClick={slideLeft}
|
||||||
disabled={scrollPos.isStart}
|
disabled={scrollPos.isStart}
|
||||||
variant="contained"
|
|
||||||
>
|
>
|
||||||
<span className="material-symbols-rounded">chevron_left</span>
|
<span className="material-symbols-rounded">chevron_left</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<div className="slider-track" ref={containerRef} onScroll={onScroll}>
|
<div className="slider-track" ref={containerRef} onScroll={onScroll}>
|
||||||
{content?.map((item, index) => (
|
{content?.map((item, index) => (
|
||||||
<div
|
<div
|
||||||
|
//biome-ignore lint/suspicious/noArrayIndexKey: item does not have a unique key
|
||||||
key={index}
|
key={index}
|
||||||
className={
|
className={
|
||||||
currentSlide === index
|
currentSlide === index
|
||||||
@@ -159,9 +162,8 @@ const Slider = ({
|
|||||||
</div>
|
</div>
|
||||||
<IconButton
|
<IconButton
|
||||||
className="slider-button right"
|
className="slider-button right"
|
||||||
onClick={() => slide(Direction.RIGHT)}
|
onClick={slideRight}
|
||||||
disabled={scrollPos.isEnd}
|
disabled={scrollPos.isEnd}
|
||||||
variant="contained"
|
|
||||||
>
|
>
|
||||||
<span className="material-symbols-rounded">chevron_right</span>
|
<span className="material-symbols-rounded">chevron_right</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { type ReactNode } from "react";
|
import React, { useCallback, useMemo, type ReactNode } from "react";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
import MuiAppBar from "@mui/material/AppBar";
|
import MuiAppBar from "@mui/material/AppBar";
|
||||||
@@ -11,7 +11,6 @@ import useScrollTrigger from "@mui/material/useScrollTrigger";
|
|||||||
|
|
||||||
import { Link, useLocation, useNavigate } from "@tanstack/react-router";
|
import { Link, useLocation, useNavigate } from "@tanstack/react-router";
|
||||||
|
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
|
||||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||||
|
|
||||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
@@ -22,6 +21,7 @@ import "./appBar.scss";
|
|||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
import { getTypeIcon } from "../utils/iconsCollection";
|
||||||
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import {
|
import {
|
||||||
setSettingsDialogOpen,
|
setSettingsDialogOpen,
|
||||||
setSettingsTabValue,
|
setSettingsTabValue,
|
||||||
@@ -47,6 +47,7 @@ function ListItemLink(props: ListItemLinkProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<li>
|
<li>
|
||||||
|
{/* @ts-ignore */}
|
||||||
<ListItem
|
<ListItem
|
||||||
component={Link}
|
component={Link}
|
||||||
activeClassName="active"
|
activeClassName="active"
|
||||||
@@ -69,6 +70,8 @@ function ListItemLink(props: ListItemLinkProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MemoizeBackButton = React.memo(BackButton);
|
||||||
|
|
||||||
export const AppBar = () => {
|
export const AppBar = () => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -77,24 +80,16 @@ export const AppBar = () => {
|
|||||||
|
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
enabled: display && Boolean(api?.accessToken),
|
|
||||||
throwOnError: true,
|
|
||||||
});
|
|
||||||
const libraries = useQuery({
|
const libraries = useQuery({
|
||||||
queryKey: ["libraries"],
|
queryKey: ["libraries"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const libs = await getUserViewsApi(api).getUserViews({
|
const libs = await getUserViewsApi(api).getUserViews({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
});
|
});
|
||||||
return libs.data;
|
return libs.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data && !!api.accessToken,
|
enabled: !!user?.Id && !!api.accessToken,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -105,13 +100,12 @@ export const AppBar = () => {
|
|||||||
|
|
||||||
const [anchorEl, setAnchorEl] = useState(null);
|
const [anchorEl, setAnchorEl] = useState(null);
|
||||||
const openMenu = Boolean(anchorEl);
|
const openMenu = Boolean(anchorEl);
|
||||||
const handleMenuOpen = (event) => {
|
const handleMenuOpen = useCallback((event) => {
|
||||||
setAnchorEl(event.currentTarget);
|
setAnchorEl(event.currentTarget);
|
||||||
};
|
}, []);
|
||||||
const handleMenuClose = () => {
|
const handleMenuClose = useCallback(() => {
|
||||||
setAnchorEl(null);
|
setAnchorEl(null);
|
||||||
};
|
}, []);
|
||||||
|
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
const handleLogout = async () => {
|
const handleLogout = async () => {
|
||||||
@@ -141,6 +135,43 @@ export const AppBar = () => {
|
|||||||
|
|
||||||
const [showDrawer, setShowDrawer] = useState(false);
|
const [showDrawer, setShowDrawer] = useState(false);
|
||||||
|
|
||||||
|
const appBarStyling = useMemo(() => {
|
||||||
|
return {
|
||||||
|
backgroundColor: "transparent",
|
||||||
|
paddingRight: "0 !important",
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
const menuStyle = useMemo(() => {
|
||||||
|
return { mt: 2 };
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const drawerPaperProps = useMemo(() => {
|
||||||
|
return {
|
||||||
|
className: "glass library-drawer",
|
||||||
|
elevation: 6,
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleNavigateToSearch = useCallback(
|
||||||
|
() => navigate({ to: "/search", search: { query: "" } }),
|
||||||
|
[navigate],
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleDrawerClose = useCallback(() => {
|
||||||
|
setShowDrawer(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleDrawerOpen = useCallback(() => {
|
||||||
|
setShowDrawer(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleNavigateToHome = useCallback(() => navigate({ to: "/home" }), []);
|
||||||
|
const handleNavigateToFavorite = useCallback(() => {
|
||||||
|
navigate({ to: "/favorite" });
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const menuButtonSx = useMemo(() => ({ p: 0 }), []);
|
||||||
|
|
||||||
if (!display) {
|
if (!display) {
|
||||||
return <></>;
|
return <></>;
|
||||||
}
|
}
|
||||||
@@ -148,10 +179,7 @@ export const AppBar = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<MuiAppBar
|
<MuiAppBar
|
||||||
style={{
|
style={appBarStyling}
|
||||||
backgroundColor: "transparent",
|
|
||||||
paddingRight: "0 !important",
|
|
||||||
}}
|
|
||||||
className={
|
className={
|
||||||
trigger
|
trigger
|
||||||
? "appBar flex flex-row flex-justify-spaced-between elevated"
|
? "appBar flex flex-row flex-justify-spaced-between elevated"
|
||||||
@@ -161,11 +189,11 @@ export const AppBar = () => {
|
|||||||
color="transparent"
|
color="transparent"
|
||||||
>
|
>
|
||||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||||
<IconButton onClick={() => setShowDrawer(true)}>
|
<IconButton onClick={handleDrawerOpen}>
|
||||||
<div className="material-symbols-rounded">menu</div>
|
<div className="material-symbols-rounded">menu</div>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<BackButton />
|
<MemoizeBackButton />
|
||||||
<IconButton onClick={() => navigate({ to: "/home" })}>
|
<IconButton onClick={handleNavigateToHome}>
|
||||||
<div
|
<div
|
||||||
className={
|
className={
|
||||||
location.pathname === "/home"
|
location.pathname === "/home"
|
||||||
@@ -179,19 +207,16 @@ export const AppBar = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||||
<IconButton onClick={() => navigate({ to: "/search" })}>
|
<IconButton onClick={handleNavigateToSearch}>
|
||||||
<div className="material-symbols-rounded">search</div>
|
<div className="material-symbols-rounded">search</div>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton onClick={() => navigate({ to: "/favorite" })}>
|
<IconButton onClick={handleNavigateToFavorite}>
|
||||||
<div className="material-symbols-rounded">favorite</div>
|
<div className="material-symbols-rounded">favorite</div>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton sx={{ p: 0 }} onClick={handleMenuOpen}>
|
<IconButton sx={menuButtonSx} onClick={handleMenuOpen}>
|
||||||
{user.isSuccess &&
|
{!!user?.Id &&
|
||||||
(user.data.PrimaryImageTag === undefined ? (
|
(user?.PrimaryImageTag === undefined ? (
|
||||||
<Avatar
|
<Avatar className="appBar-avatar" alt={user?.Name ?? "image"}>
|
||||||
className="appBar-avatar"
|
|
||||||
alt={user.data.Name ?? "image"}
|
|
||||||
>
|
|
||||||
<span className="material-symbols-rounded appBar-avatar-icon">
|
<span className="material-symbols-rounded appBar-avatar-icon">
|
||||||
account_circle
|
account_circle
|
||||||
</span>
|
</span>
|
||||||
@@ -199,8 +224,8 @@ export const AppBar = () => {
|
|||||||
) : (
|
) : (
|
||||||
<Avatar
|
<Avatar
|
||||||
className="appBar-avatar"
|
className="appBar-avatar"
|
||||||
src={`${api.basePath}/Users/${user.data.Id}/Images/Primary`}
|
src={`${api.basePath}/Users/${user?.Id}/Images/Primary`}
|
||||||
alt={user.data.Name ?? "image"}
|
alt={user?.Name ?? "image"}
|
||||||
>
|
>
|
||||||
<span className="material-symbols-rounded appBar-avatar-icon">
|
<span className="material-symbols-rounded appBar-avatar-icon">
|
||||||
account_circle
|
account_circle
|
||||||
@@ -212,7 +237,7 @@ export const AppBar = () => {
|
|||||||
anchorEl={anchorEl}
|
anchorEl={anchorEl}
|
||||||
open={openMenu}
|
open={openMenu}
|
||||||
onClose={handleMenuClose}
|
onClose={handleMenuClose}
|
||||||
sx={{ mt: 2 }}
|
sx={menuStyle}
|
||||||
disableScrollLock
|
disableScrollLock
|
||||||
>
|
>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
@@ -256,17 +281,14 @@ export const AppBar = () => {
|
|||||||
</MuiAppBar>
|
</MuiAppBar>
|
||||||
<Drawer
|
<Drawer
|
||||||
open={showDrawer}
|
open={showDrawer}
|
||||||
PaperProps={{
|
PaperProps={drawerPaperProps}
|
||||||
className: "glass library-drawer",
|
|
||||||
elevation: 6,
|
|
||||||
}}
|
|
||||||
className="library-drawer"
|
className="library-drawer"
|
||||||
onClose={() => setShowDrawer(false)}
|
onClose={handleDrawerClose}
|
||||||
>
|
>
|
||||||
<List>
|
<List>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<ListItemButton
|
<ListItemButton
|
||||||
onClick={() => setShowDrawer(false)}
|
onClick={handleDrawerClose}
|
||||||
style={{
|
style={{
|
||||||
borderRadius: "100px",
|
borderRadius: "100px",
|
||||||
gap: "0.85em",
|
gap: "0.85em",
|
||||||
@@ -281,12 +303,15 @@ export const AppBar = () => {
|
|||||||
<List>
|
<List>
|
||||||
<ListItemLink to="/home" icon="home" primary="Home" />
|
<ListItemLink to="/home" icon="home" primary="Home" />
|
||||||
{libraries.isSuccess &&
|
{libraries.isSuccess &&
|
||||||
libraries.data.Items?.map((library, index) => (
|
libraries.data.Items?.map((library) => (
|
||||||
<ListItemLink
|
<ListItemLink
|
||||||
key={library.Id}
|
key={library.Id}
|
||||||
to={`/library/${library.Id}`}
|
to={`/library/${library.Id}`}
|
||||||
icon={getTypeIcon(library.CollectionType)}
|
icon={
|
||||||
primary={library.Name}
|
library.CollectionType &&
|
||||||
|
getTypeIcon(library.CollectionType)
|
||||||
|
}
|
||||||
|
primary={library.Name ?? "Library"}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import AppBar from "@mui/material/AppBar";
|
|||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import Toolbar from "@mui/material/Toolbar";
|
import Toolbar from "@mui/material/Toolbar";
|
||||||
import { useRouter } from "@tanstack/react-router";
|
import { useRouter } from "@tanstack/react-router";
|
||||||
|
import React from "react";
|
||||||
|
import QuickConnectButton from "../buttons/quickConnectButton";
|
||||||
|
|
||||||
export const AppBarBackOnly = () => {
|
export const AppBarBackOnly = () => {
|
||||||
const { history } = useRouter();
|
const { history } = useRouter();
|
||||||
@@ -16,13 +18,23 @@ export const AppBarBackOnly = () => {
|
|||||||
<IconButton
|
<IconButton
|
||||||
size="large"
|
size="large"
|
||||||
edge="start"
|
edge="start"
|
||||||
|
//@ts-ignore
|
||||||
color="white"
|
color="white"
|
||||||
aria-label="back"
|
aria-label="back"
|
||||||
|
disabled={history.length <= 1}
|
||||||
onClick={handleBack}
|
onClick={handleBack}
|
||||||
sx={{ mr: 2 }}
|
sx={{ mr: 2 }}
|
||||||
>
|
>
|
||||||
<span className="material-symbols-rounded">arrow_back</span>
|
<span className="material-symbols-rounded">arrow_back</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
<QuickConnectButton
|
||||||
|
sx={{
|
||||||
|
marginLeft: "auto",
|
||||||
|
flex: "none !important",
|
||||||
|
borderRadius: "10px",
|
||||||
|
}}
|
||||||
|
color="secondary"
|
||||||
|
/>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
</AppBar>
|
</AppBar>
|
||||||
);
|
);
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import React from "react";
|
import React, { memo } from "react"; // Import memo
|
||||||
|
|
||||||
import Button, {
|
import Button, {
|
||||||
type ButtonProps,
|
type ButtonProps,
|
||||||
@@ -9,12 +9,14 @@ import Fab from "@mui/material/Fab";
|
|||||||
import LinearProgress from "@mui/material/LinearProgress";
|
import LinearProgress from "@mui/material/LinearProgress";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
import { playAudio } from "@/utils/store/audioPlayback";
|
import { generateAudioStreamUrl, playAudio } from "@/utils/store/audioPlayback";
|
||||||
import {
|
import {
|
||||||
type BaseItemDto,
|
type BaseItemDto,
|
||||||
type BaseItemDtoQueryResult,
|
type BaseItemDtoQueryResult,
|
||||||
BaseItemKind,
|
BaseItemKind,
|
||||||
ItemFields,
|
ItemFields,
|
||||||
|
ItemFilter,
|
||||||
|
LocationType,
|
||||||
MediaProtocol,
|
MediaProtocol,
|
||||||
type PlaybackInfoResponse,
|
type PlaybackInfoResponse,
|
||||||
SortOrder,
|
SortOrder,
|
||||||
@@ -37,31 +39,62 @@ import { getRuntimeCompact } from "@/utils/date/time";
|
|||||||
import getSubtitle from "@/utils/methods/getSubtitles";
|
import getSubtitle from "@/utils/methods/getSubtitles";
|
||||||
import playbackProfile from "@/utils/playback-profiles";
|
import playbackProfile from "@/utils/playback-profiles";
|
||||||
import { axiosClient, useApiInContext } from "@/utils/store/api";
|
import { axiosClient, useApiInContext } from "@/utils/store/api";
|
||||||
|
import { usePhotosPlayback } from "@/utils/store/photosPlayback";
|
||||||
import type IntroMediaInfo from "@/utils/types/introMediaInfo";
|
import type IntroMediaInfo from "@/utils/types/introMediaInfo";
|
||||||
import { getMediaInfoApi } from "@jellyfin/sdk/lib/utils/api/media-info-api";
|
import { getMediaInfoApi } from "@jellyfin/sdk/lib/utils/api/media-info-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 type { SxProps } from "@mui/material";
|
import type { SxProps } from "@mui/material";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
|
|
||||||
type PlayButtonProps = {
|
type PlayButtonProps = {
|
||||||
item: BaseItemDto;
|
item: BaseItemDto;
|
||||||
itemId: string;
|
/**
|
||||||
itemUserData: UserItemDataDto;
|
* @deprecated
|
||||||
userId: string;
|
*/
|
||||||
|
itemId?: string;
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
itemUserData?: UserItemDataDto;
|
||||||
|
userId: string | undefined;
|
||||||
itemType: BaseItemKind;
|
itemType: BaseItemKind;
|
||||||
currentAudioTrack: number;
|
currentAudioTrack?: number;
|
||||||
currentVideoTrack: number;
|
currentVideoTrack?: number;
|
||||||
currentSubTrack: number | "nosub";
|
currentSubTrack?: number | "nosub";
|
||||||
className: string;
|
className?: string;
|
||||||
sx: SxProps;
|
sx?: SxProps;
|
||||||
buttonProps: ButtonProps;
|
buttonProps?: ButtonProps;
|
||||||
iconOnly: boolean;
|
iconOnly?: boolean;
|
||||||
audio: boolean;
|
audio?: boolean;
|
||||||
size: ButtonPropsSizeOverrides;
|
size?: ButtonPropsSizeOverrides;
|
||||||
playlistItem: BaseItemDto;
|
playlistItem?: BaseItemDto;
|
||||||
playlistItemId: string;
|
playlistItemId?: string;
|
||||||
trackIndex: number;
|
trackIndex?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Memoized LinearProgress component
|
||||||
|
const MemoizedLinearProgress = memo(({ value }: { value: number }) => (
|
||||||
|
<LinearProgress
|
||||||
|
variant="determinate"
|
||||||
|
value={value}
|
||||||
|
sx={{
|
||||||
|
position: "absolute",
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
bottom: 0,
|
||||||
|
height: "100%",
|
||||||
|
background: "transparent",
|
||||||
|
opacity: 0.2,
|
||||||
|
zIndex: 0,
|
||||||
|
mixBlendMode: "difference",
|
||||||
|
}}
|
||||||
|
color="white"
|
||||||
|
/>
|
||||||
|
));
|
||||||
|
|
||||||
const PlayButton = ({
|
const PlayButton = ({
|
||||||
item,
|
item,
|
||||||
itemId,
|
itemId,
|
||||||
@@ -87,16 +120,17 @@ const PlayButton = ({
|
|||||||
const setPlaybackDataLoading = usePlaybackDataLoadStore(
|
const setPlaybackDataLoading = usePlaybackDataLoadStore(
|
||||||
(state) => state.setisPending,
|
(state) => state.setisPending,
|
||||||
);
|
);
|
||||||
|
const playPhotos = usePhotosPlayback((s) => s.playPhotos);
|
||||||
|
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
|
|
||||||
const itemQuery = useMutation({
|
const itemQuery = useMutation({
|
||||||
mutationKey: ["playButton", itemId, userId],
|
mutationKey: ["playButton", item?.Id, userId],
|
||||||
mutationFn: async () => {
|
mutationFn: async () => {
|
||||||
setPlaybackDataLoading(true);
|
setPlaybackDataLoading(true);
|
||||||
let result: undefined | AxiosResponse<BaseItemDtoQueryResult, any>;
|
let result: undefined | AxiosResponse<BaseItemDtoQueryResult, any>;
|
||||||
let mediaSource: undefined | AxiosResponse<PlaybackInfoResponse, any>;
|
let mediaSource: undefined | AxiosResponse<PlaybackInfoResponse, any>;
|
||||||
let introInfo: undefined | AxiosResponse<IntroMediaInfo, any>;
|
let introInfo: undefined | IntroMediaInfo;
|
||||||
const indexNumber = item.IndexNumber ? item.IndexNumber - 1 : 0;
|
const indexNumber = item.IndexNumber ? item.IndexNumber - 1 : 0;
|
||||||
if (playlistItem) {
|
if (playlistItem) {
|
||||||
result = await getPlaylistsApi(api).getPlaylistItems({
|
result = await getPlaylistsApi(api).getPlaylistItems({
|
||||||
@@ -104,9 +138,9 @@ const PlayButton = ({
|
|||||||
playlistId: playlistItemId,
|
playlistId: playlistItemId,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log(itemType);
|
|
||||||
switch (itemType) {
|
switch (itemType) {
|
||||||
case BaseItemKind.Episode:
|
case BaseItemKind.Episode:
|
||||||
|
if (item.SeriesId && item.SeasonId) {
|
||||||
result = await getTvShowsApi(api).getEpisodes({
|
result = await getTvShowsApi(api).getEpisodes({
|
||||||
seriesId: item.SeriesId,
|
seriesId: item.SeriesId,
|
||||||
fields: [
|
fields: [
|
||||||
@@ -119,7 +153,7 @@ const PlayButton = ({
|
|||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
seasonId: item.SeasonId,
|
seasonId: item.SeasonId,
|
||||||
startItemId: item.Id,
|
// startItemId: item.Id,
|
||||||
});
|
});
|
||||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||||
audioStreamIndex: currentAudioTrack,
|
audioStreamIndex: currentAudioTrack,
|
||||||
@@ -150,10 +184,11 @@ const PlayButton = ({
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case BaseItemKind.Series:
|
case BaseItemKind.Series:
|
||||||
result = await getTvShowsApi(api).getEpisodes({
|
result = await getTvShowsApi(api).getEpisodes({
|
||||||
seriesId: itemId,
|
seriesId: item.Id,
|
||||||
fields: [
|
fields: [
|
||||||
ItemFields.MediaSources,
|
ItemFields.MediaSources,
|
||||||
ItemFields.MediaStreams,
|
ItemFields.MediaStreams,
|
||||||
@@ -164,6 +199,10 @@ const PlayButton = ({
|
|||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
});
|
});
|
||||||
|
if (
|
||||||
|
result.data.Items?.[0].Id &&
|
||||||
|
result.data.Items?.[0].MediaSources?.[0].Id
|
||||||
|
)
|
||||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||||
audioStreamIndex: currentAudioTrack,
|
audioStreamIndex: currentAudioTrack,
|
||||||
subtitleStreamIndex:
|
subtitleStreamIndex:
|
||||||
@@ -200,7 +239,7 @@ const PlayButton = ({
|
|||||||
break;
|
break;
|
||||||
case BaseItemKind.MusicAlbum:
|
case BaseItemKind.MusicAlbum:
|
||||||
result = await getItemsApi(api).getItems({
|
result = await getItemsApi(api).getItems({
|
||||||
parentId: itemId,
|
parentId: item.Id,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
fields: [ItemFields.MediaSources, ItemFields.MediaStreams],
|
fields: [ItemFields.MediaSources, ItemFields.MediaStreams],
|
||||||
sortOrder: [SortOrder.Ascending],
|
sortOrder: [SortOrder.Ascending],
|
||||||
@@ -209,7 +248,7 @@ const PlayButton = ({
|
|||||||
break;
|
break;
|
||||||
case BaseItemKind.MusicArtist:
|
case BaseItemKind.MusicArtist:
|
||||||
result = await getItemsApi(api).getItems({
|
result = await getItemsApi(api).getItems({
|
||||||
artistIds: [itemId],
|
artistIds: [item.Id],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
includeItemTypes: [BaseItemKind.Audio],
|
includeItemTypes: [BaseItemKind.Audio],
|
||||||
userId: userId,
|
userId: userId,
|
||||||
@@ -220,7 +259,7 @@ const PlayButton = ({
|
|||||||
break;
|
break;
|
||||||
case BaseItemKind.BoxSet:
|
case BaseItemKind.BoxSet:
|
||||||
result = await getItemsApi(api).getItems({
|
result = await getItemsApi(api).getItems({
|
||||||
parentId: itemId,
|
parentId: item.Id,
|
||||||
userId,
|
userId,
|
||||||
fields: [
|
fields: [
|
||||||
ItemFields.MediaSources,
|
ItemFields.MediaSources,
|
||||||
@@ -232,9 +271,27 @@ const PlayButton = ({
|
|||||||
sortBy: ["IndexNumber"],
|
sortBy: ["IndexNumber"],
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case BaseItemKind.Photo:
|
||||||
|
if (item.Id) {
|
||||||
|
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:
|
default:
|
||||||
result = await getItemsApi(api).getItems({
|
result = await getItemsApi(api).getItems({
|
||||||
ids: [itemId],
|
ids: [item.Id],
|
||||||
userId: userId,
|
userId: userId,
|
||||||
fields: [
|
fields: [
|
||||||
ItemFields.MediaSources,
|
ItemFields.MediaSources,
|
||||||
@@ -249,7 +306,7 @@ const PlayButton = ({
|
|||||||
audioStreamIndex: currentAudioTrack,
|
audioStreamIndex: currentAudioTrack,
|
||||||
subtitleStreamIndex:
|
subtitleStreamIndex:
|
||||||
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||||
itemId: itemId,
|
itemId: item.Id,
|
||||||
startTimeTicks:
|
startTimeTicks:
|
||||||
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
@@ -269,16 +326,28 @@ const PlayButton = ({
|
|||||||
enqueueSnackbar("Playlist playback is WIP", { variant: "info" });
|
enqueueSnackbar("Playlist playback is WIP", { variant: "info" });
|
||||||
} else if (audio) {
|
} else if (audio) {
|
||||||
// Album/Individual audio track playback
|
// Album/Individual audio track playback
|
||||||
const urlOptions = {
|
const urlOptions: Record<string, string> = {
|
||||||
deviceId: api?.deviceInfo.id,
|
deviceId: api?.deviceInfo.id,
|
||||||
userId,
|
//@ts-ignore
|
||||||
|
userId: userId,
|
||||||
api_key: api?.accessToken,
|
api_key: api?.accessToken,
|
||||||
};
|
};
|
||||||
const urlParams = new URLSearchParams(urlOptions).toString();
|
const urlParams = new URLSearchParams(urlOptions).toString();
|
||||||
|
const playbackUrl = generateAudioStreamUrl(
|
||||||
const playbackUrl = `${api.basePath}/Audio/${result?.item.Items[0].Id}/universal?${urlParams}`;
|
result?.item?.Items?.[0].Id,
|
||||||
playAudio(playbackUrl, result?.item.Items[0], undefined);
|
userId,
|
||||||
setQueue(result?.item.Items ?? [], 0);
|
api?.deviceInfo.id,
|
||||||
|
api.basePath,
|
||||||
|
api.accessToken,
|
||||||
|
);
|
||||||
|
playAudio(playbackUrl, result?.item?.Items?.[0], undefined);
|
||||||
|
setQueue(result?.item?.Items ?? [], 0);
|
||||||
|
} else if (item.Type === "Photo") {
|
||||||
|
const index = result?.item?.Items?.map((i) => i.Id).indexOf(item.Id);
|
||||||
|
if (result?.item?.Items && index) {
|
||||||
|
playPhotos(result?.item?.Items, index);
|
||||||
|
navigate({ to: "/player/photos" });
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const episodeIndex = item.IndexNumber ? item.IndexNumber - 1 : 0;
|
const episodeIndex = item.IndexNumber ? item.IndexNumber - 1 : 0;
|
||||||
// Creates a queue containing all Episodes for a particular season(series) or collection of movies
|
// Creates a queue containing all Episodes for a particular season(series) or collection of movies
|
||||||
@@ -297,7 +366,7 @@ const PlayButton = ({
|
|||||||
result?.mediaSource.MediaSources?.[0].MediaStreams,
|
result?.mediaSource.MediaSources?.[0].MediaStreams,
|
||||||
);
|
);
|
||||||
// URL generation
|
// URL generation
|
||||||
const urlOptions = {
|
const urlOptions: URLSearchParams = {
|
||||||
Static: true,
|
Static: true,
|
||||||
tag: result?.mediaSource.MediaSources?.[0].ETag,
|
tag: result?.mediaSource.MediaSources?.[0].ETag,
|
||||||
mediaSourceId: result?.mediaSource.MediaSources?.[0].Id,
|
mediaSourceId: result?.mediaSource.MediaSources?.[0].Id,
|
||||||
@@ -414,26 +483,13 @@ const PlayButton = ({
|
|||||||
audio
|
audio
|
||||||
? "Play Now"
|
? "Play Now"
|
||||||
: "Watch Now"}
|
: "Watch Now"}
|
||||||
<LinearProgress
|
<MemoizedLinearProgress
|
||||||
variant="determinate"
|
|
||||||
value={
|
value={
|
||||||
100 > itemUserData?.PlayedPercentage > 0
|
100 > itemUserData?.PlayedPercentage &&
|
||||||
|
itemUserData?.PlayedPercentage > 0
|
||||||
? itemUserData?.PlayedPercentage
|
? itemUserData?.PlayedPercentage
|
||||||
: 0
|
: 0
|
||||||
}
|
}
|
||||||
sx={{
|
|
||||||
position: "absolute",
|
|
||||||
top: 0,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
bottom: 0,
|
|
||||||
height: "100%",
|
|
||||||
background: "transparent",
|
|
||||||
opacity: 0.2,
|
|
||||||
zIndex: 0,
|
|
||||||
mixBlendMode: "difference",
|
|
||||||
}}
|
|
||||||
color="white"
|
|
||||||
/>
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
{itemUserData?.PlaybackPositionTicks > 0 && (
|
{itemUserData?.PlaybackPositionTicks > 0 && (
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ $image-size: 5em;
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.2em;
|
gap: 0.2em;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&-item.Mui-disabled {
|
&-item.Mui-disabled {
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import { getTypeIcon } from "../utils/iconsCollection";
|
|||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import "./queueButton.scss";
|
import "./queueButton.scss";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { useRouteContext } from "@tanstack/react-router";
|
|
||||||
const QueueButton = () => {
|
const QueueButton = () => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const [queueItems, currentItemIndex] = useQueue((state) => [
|
const [queueItems, currentItemIndex] = useQueue((state) => [
|
||||||
@@ -29,12 +29,12 @@ const QueueButton = () => {
|
|||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const [buttonEl, setButtonEl] = useState(null);
|
const [buttonEl, setButtonEl] = useState<HTMLButtonElement | null>(null);
|
||||||
|
|
||||||
const handlePlay = useMutation({
|
const handlePlay = useMutation({
|
||||||
mutationKey: ["handlePlayIndex"],
|
mutationKey: ["handlePlayIndex"],
|
||||||
mutationFn: async ({ index }: { index: number }) => {
|
mutationFn: async ({ index }: { index: number }) => {
|
||||||
const result = playItemFromQueue(index, user.data?.Id);
|
const result = playItemFromQueue(index, user.data?.Id, api);
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
@@ -76,44 +76,56 @@ const QueueButton = () => {
|
|||||||
position: "relative",
|
position: "relative",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{queueItems.map((item, index) => {
|
{queueItems[currentItemIndex]?.Id && (
|
||||||
return (
|
<>
|
||||||
|
<Typography px="1em" mb={2} variant="h5" fontWeight={300}>
|
||||||
|
Currently Playing:
|
||||||
|
</Typography>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
className="queue-item"
|
className="queue-item"
|
||||||
disabled={index === currentItemIndex}
|
disabled
|
||||||
onClick={() => handlePlay.mutate({ index })}
|
key={queueItems[currentItemIndex].Id}
|
||||||
key={item.Id}
|
|
||||||
>
|
>
|
||||||
<Typography variant="subtitle2">
|
<Typography variant="subtitle2">
|
||||||
{item.Type === "Audio"
|
{queueItems[currentItemIndex]?.Type === "Audio"
|
||||||
? index + 1
|
? currentItemIndex + 1
|
||||||
: item.IndexNumberEnd
|
: queueItems[currentItemIndex].IndexNumberEnd
|
||||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} / ${item.IndexNumberEnd}`
|
? `S${queueItems[currentItemIndex].ParentIndexNumber}:E${queueItems[currentItemIndex].IndexNumber} / ${queueItems[currentItemIndex].IndexNumberEnd}`
|
||||||
: `S${item.ParentIndexNumber}:E${item.IndexNumber}`}
|
: `S${queueItems[currentItemIndex].ParentIndexNumber}:E${queueItems[currentItemIndex].IndexNumber}`}
|
||||||
</Typography>
|
</Typography>
|
||||||
<div className="queue-item-image-container">
|
<div className="queue-item-image-container">
|
||||||
{item.ImageTags?.Primary ? (
|
{queueItems[currentItemIndex].ImageTags?.Primary ? (
|
||||||
<img
|
<img
|
||||||
className="queue-item-image"
|
className="queue-item-image"
|
||||||
src={api?.getItemImageUrl(item?.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
tag: item.ImageTags?.Primary,
|
queueItems[currentItemIndex]?.Id,
|
||||||
})}
|
"Primary",
|
||||||
alt={item.Name}
|
{
|
||||||
|
tag: queueItems[currentItemIndex].ImageTags?.Primary,
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
alt={queueItems[currentItemIndex].Name ?? "image"}
|
||||||
/>
|
/>
|
||||||
) : item.AlbumPrimaryImageTag?.length > 0 ? (
|
) : (queueItems[currentItemIndex].AlbumPrimaryImageTag
|
||||||
|
?.length ?? -1) > 0 ? (
|
||||||
<img
|
<img
|
||||||
className="queue-item-image"
|
className="queue-item-image"
|
||||||
src={api?.getItemImageUrl(item?.AlbumId, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
tag: item.AlbumPrimaryImageTag[0],
|
queueItems[currentItemIndex]?.AlbumId,
|
||||||
})}
|
"Primary",
|
||||||
alt={item.Name}
|
{
|
||||||
|
tag: queueItems[currentItemIndex]
|
||||||
|
.AlbumPrimaryImageTag[0],
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
alt={queueItems[currentItemIndex].Name ?? "image"}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="queue-item-image-icon">
|
<div className="queue-item-image-icon">
|
||||||
{getTypeIcon(item.Type)}
|
{queueItems[currentItemIndex].Type &&
|
||||||
|
getTypeIcon(queueItems[currentItemIndex].Type)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{index === currentItemIndex && (
|
|
||||||
<span
|
<span
|
||||||
className="material-symbols-rounded"
|
className="material-symbols-rounded"
|
||||||
style={{
|
style={{
|
||||||
@@ -127,12 +139,93 @@ const QueueButton = () => {
|
|||||||
>
|
>
|
||||||
equalizer
|
equalizer
|
||||||
</span>
|
</span>
|
||||||
|
</div>
|
||||||
|
<div className="queue-item-info">
|
||||||
|
{queueItems[currentItemIndex].SeriesName ? (
|
||||||
|
<>
|
||||||
|
<Typography variant="subtitle1" width="100%">
|
||||||
|
{queueItems[currentItemIndex].SeriesName}
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
variant="subtitle2"
|
||||||
|
width="100%"
|
||||||
|
style={{ opacity: 0.6 }}
|
||||||
|
>
|
||||||
|
{queueItems[currentItemIndex].Name}
|
||||||
|
</Typography>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<Typography variant="subtitle1" width="100%">
|
||||||
|
{queueItems[currentItemIndex].Name}
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</MenuItem>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{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={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={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>
|
||||||
<div className="queue-item-info">
|
<div className="queue-item-info">
|
||||||
{item.SeriesName ? (
|
{item.SeriesName ? (
|
||||||
<>
|
<>
|
||||||
<Typography variant="subtitle1" width="100%">
|
<Typography
|
||||||
|
variant="subtitle1"
|
||||||
|
width="100%"
|
||||||
|
sx={{ overflow: "hidden", textOverflow: "ellipsis" }}
|
||||||
|
>
|
||||||
{item.SeriesName}
|
{item.SeriesName}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
@@ -144,9 +237,23 @@ const QueueButton = () => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<Typography variant="subtitle1" width="100%">
|
<>
|
||||||
|
<Typography
|
||||||
|
variant="subtitle1"
|
||||||
|
width="100%"
|
||||||
|
sx={{ overflow: "hidden", textOverflow: "ellipsis" }}
|
||||||
|
>
|
||||||
{item.Name}
|
{item.Name}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
variant="subtitle2"
|
||||||
|
width="100%"
|
||||||
|
style={{ opacity: 0.6 }}
|
||||||
|
sx={{ overflow: "hidden", textOverflow: "ellipsis" }}
|
||||||
|
>
|
||||||
|
{item.Artists?.join(", ")}
|
||||||
|
</Typography>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import { saveUser } from "@/utils/storage/user";
|
import useInterval from "@/utils/hooks/useInterval";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { getQuickConnectApi } from "@jellyfin/sdk/lib/utils/api/quick-connect-api";
|
import { getQuickConnectApi } from "@jellyfin/sdk/lib/utils/api/quick-connect-api";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import { LoadingButton, type LoadingButtonProps } from "@mui/lab";
|
||||||
import { LoadingButton } from "@mui/lab";
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
@@ -11,45 +10,62 @@ import {
|
|||||||
DialogContent,
|
DialogContent,
|
||||||
DialogContentText,
|
DialogContentText,
|
||||||
FormControlLabel,
|
FormControlLabel,
|
||||||
|
Slide,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Typography,
|
Typography,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
import type { TransitionProps } from "@mui/material/transitions";
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
import { skipToken, useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import type { Timeout } from "@tanstack/react-router/dist/esm/utils";
|
|
||||||
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
|
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
|
||||||
import { useSnackbar } from "notistack";
|
import { useSnackbar } from "notistack";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
|
|
||||||
const QuickConnectButton = () => {
|
const Transition = React.forwardRef(function Transition(
|
||||||
const api = useApiInContext((s) => s.api);
|
props: TransitionProps & {
|
||||||
const createApi = useApiInContext((s) => s.createApi);
|
children: React.ReactElement<any, any>;
|
||||||
const headers = {
|
},
|
||||||
"X-Emby-Authorization": `MediaBrowser Client="${api.clientInfo.name}", Device="${api.deviceInfo.name}", DeviceId="${api.deviceInfo.id}", Version="${api.clientInfo.version}"`,
|
ref: React.Ref<unknown>,
|
||||||
};
|
) {
|
||||||
|
return (
|
||||||
|
<Slide
|
||||||
|
direction="up"
|
||||||
|
mountOnEnter
|
||||||
|
unmountOnExit
|
||||||
|
ref={ref}
|
||||||
|
timeout={{ enter: 500, exit: 1500 }}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
const [quickConnectStatusInterval, setQuickConnectStatusInterval] =
|
const QuickConnectButton = (props: LoadingButtonProps) => {
|
||||||
useState<Timeout | null>(null);
|
const api = useApiInContext((s) => s.api);
|
||||||
|
const headers = {
|
||||||
|
"X-Emby-Authorization": `MediaBrowser Client="${api?.clientInfo.name}", Device="${api?.deviceInfo.name}", DeviceId="${api?.deviceInfo.id}", Version="${api?.clientInfo.version}"`,
|
||||||
|
};
|
||||||
|
|
||||||
const quickConnectEnabled = useQuery({
|
const quickConnectEnabled = useQuery({
|
||||||
queryKey: ["quick-connect-button", "check-quick-connect-enabled"],
|
queryKey: ["quick-connect-button", "check-quick-connect-enabled"],
|
||||||
queryFn: async () => await getQuickConnectApi(api).getQuickConnectEnabled(),
|
queryFn: api
|
||||||
|
? async () => await getQuickConnectApi(api).getQuickConnectEnabled()
|
||||||
|
: skipToken,
|
||||||
|
enabled: Boolean(api),
|
||||||
});
|
});
|
||||||
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
const [quickConnectCode, setQuickConnectCode] = useState<string | null>();
|
const [quickConnectCode, setQuickConnectCode] = useState<string | null>();
|
||||||
const [rememberUser, setRememberUser] = useState(true);
|
const [rememberUser, setRememberUser] = useState(true);
|
||||||
const checkQuickConnectStatus = useMutation({
|
const checkQuickConnectStatus = useMutation({
|
||||||
mutationKey: ["quick-connect-button", "check-quick-connect-status"],
|
mutationKey: ["quick-connect-button", "check-quick-connect-status"],
|
||||||
mutationFn: async (secret: string) =>
|
mutationFn: async (secret: string) =>
|
||||||
(
|
api
|
||||||
|
? (
|
||||||
await getQuickConnectApi(api).getQuickConnectState(
|
await getQuickConnectApi(api).getQuickConnectState(
|
||||||
{ secret },
|
{ secret },
|
||||||
{ headers },
|
{ headers },
|
||||||
)
|
)
|
||||||
).data,
|
).data
|
||||||
|
: skipToken,
|
||||||
});
|
});
|
||||||
const initQuickConnect = useMutation({
|
const initQuickConnect = useMutation({
|
||||||
mutationKey: ["quick-connect-button", "initiate-connection"],
|
mutationKey: ["quick-connect-button", "initiate-connection"],
|
||||||
@@ -59,57 +75,42 @@ const QuickConnectButton = () => {
|
|||||||
variant: "error",
|
variant: "error",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (api) {
|
||||||
return await getQuickConnectApi(api).initiateQuickConnect({ headers });
|
return await getQuickConnectApi(api).initiateQuickConnect({ headers });
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onSuccess: (result) => {
|
onSuccess: (result) => {
|
||||||
setQuickConnectCode(result.data.Code);
|
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);
|
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
enqueueSnackbar("Error initiating Quick Connect.", { variant: "error" });
|
enqueueSnackbar("Error initiating Quick Connect.", { variant: "error" });
|
||||||
console.error(error);
|
console.error(error);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useInterval(
|
||||||
|
() => {
|
||||||
|
if (quickConnectCode) {
|
||||||
|
checkQuickConnectStatus.mutate(quickConnectCode);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
quickConnectCode ? 1000 : null,
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<LoadingButton
|
<LoadingButton
|
||||||
|
{...props}
|
||||||
disabled={
|
disabled={
|
||||||
quickConnectEnabled.isPending ||
|
quickConnectEnabled.isPending ||
|
||||||
Boolean(!quickConnectEnabled.data?.data)
|
Boolean(!quickConnectEnabled.data?.data)
|
||||||
}
|
}
|
||||||
loading={
|
loading={Boolean(
|
||||||
initQuickConnect.isPending ||
|
initQuickConnect.isPending ||
|
||||||
checkQuickConnectStatus.isPending ||
|
checkQuickConnectStatus.isPending ||
|
||||||
(quickConnectCode && !checkQuickConnectStatus.data?.Authenticated)
|
(quickConnectCode && !checkQuickConnectStatus.data?.Authenticated),
|
||||||
}
|
)}
|
||||||
variant="contained"
|
variant={props.variant ?? "contained"}
|
||||||
size="large"
|
|
||||||
style={{ flex: 1 }}
|
style={{ flex: 1 }}
|
||||||
onClick={initQuickConnect.mutate}
|
onClick={initQuickConnect.mutate}
|
||||||
>
|
>
|
||||||
@@ -119,10 +120,12 @@ const QuickConnectButton = () => {
|
|||||||
open={Boolean(quickConnectCode)}
|
open={Boolean(quickConnectCode)}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
setQuickConnectCode(null);
|
setQuickConnectCode(null);
|
||||||
clearInterval(quickConnectStatusInterval);
|
initQuickConnect.reset();
|
||||||
|
checkQuickConnectStatus.reset();
|
||||||
}}
|
}}
|
||||||
fullWidth
|
fullWidth
|
||||||
maxWidth="xs"
|
maxWidth="xs"
|
||||||
|
TransitionComponent={Transition}
|
||||||
>
|
>
|
||||||
<DialogContent
|
<DialogContent
|
||||||
style={{
|
style={{
|
||||||
@@ -159,8 +162,8 @@ const QuickConnectButton = () => {
|
|||||||
borderRadius: "10px",
|
borderRadius: "10px",
|
||||||
cursor: "pointer",
|
cursor: "pointer",
|
||||||
}}
|
}}
|
||||||
onClick={async (e) => {
|
onClick={async () => {
|
||||||
await writeText(quickConnectCode);
|
quickConnectCode && (await writeText(quickConnectCode));
|
||||||
enqueueSnackbar("Quick Connect Code copied!", {
|
enqueueSnackbar("Quick Connect Code copied!", {
|
||||||
variant: "info",
|
variant: "info",
|
||||||
key: "copiedText",
|
key: "copiedText",
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import Typography from "@mui/material/Typography";
|
|||||||
import { Blurhash } from "react-blurhash";
|
import { Blurhash } from "react-blurhash";
|
||||||
import { useApi } from "../../utils/store/api";
|
import { useApi } from "../../utils/store/api";
|
||||||
import "./card.scss";
|
import "./card.scss";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} Props
|
* @typedef {Object} Props
|
||||||
@@ -70,7 +71,7 @@ export const ActorCard = ({
|
|||||||
</div>
|
</div>
|
||||||
<img
|
<img
|
||||||
alt={item.Name}
|
alt={item.Name}
|
||||||
src={api.getItemImageUrl(
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
seriesId ? item.SeriesId : item.Id,
|
seriesId ? item.SeriesId : item.Id,
|
||||||
"Primary",
|
"Primary",
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
|
|
||||||
import React, { memo } from "react";
|
import React, { memo } from "react";
|
||||||
import { Component, useState } from "react";
|
|
||||||
|
|
||||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
|
|
||||||
import LinearProgress from "@mui/material/LinearProgress";
|
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -19,22 +17,9 @@ import PlayButton from "../buttons/playButton";
|
|||||||
import ErrorBoundary from "../errorBoundary";
|
import ErrorBoundary from "../errorBoundary";
|
||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
import { getTypeIcon } from "../utils/iconsCollection";
|
||||||
import "./card.scss";
|
import "./card.scss";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
|
||||||
const cardImageAspectRatios = {
|
|
||||||
thumb: 1.777,
|
|
||||||
portrait: 0.666,
|
|
||||||
square: 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
const availableSpecialRoutes = [
|
|
||||||
BaseItemKind.Series,
|
|
||||||
BaseItemKind.BoxSet,
|
|
||||||
BaseItemKind.MusicAlbum,
|
|
||||||
BaseItemKind.Episode,
|
|
||||||
BaseItemKind.Playlist,
|
|
||||||
];
|
|
||||||
|
|
||||||
const CardComponent = ({
|
const CardComponent = ({
|
||||||
item,
|
item,
|
||||||
cardTitle,
|
cardTitle,
|
||||||
@@ -65,7 +50,8 @@ const CardComponent = ({
|
|||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const defaultOnClick = () => {
|
const defaultOnClick = () => {
|
||||||
switch (item.Type) {
|
if (item?.Id) {
|
||||||
|
switch (item?.Type) {
|
||||||
case BaseItemKind.BoxSet:
|
case BaseItemKind.BoxSet:
|
||||||
navigate({ to: "/boxset/$id", params: { id: item.Id } });
|
navigate({ to: "/boxset/$id", params: { id: item.Id } });
|
||||||
break;
|
break;
|
||||||
@@ -91,6 +77,7 @@ const CardComponent = ({
|
|||||||
navigate({ to: "/item/$id", params: { id: item.Id } });
|
navigate({ to: "/item/$id", params: { id: item.Id } });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -121,21 +108,26 @@ const CardComponent = ({
|
|||||||
</div>
|
</div>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
<div className="card-image-icon-container">
|
<div className="card-image-icon-container">
|
||||||
{overrideIcon ? getTypeIcon(overrideIcon) : getTypeIcon(item.Type)}
|
{overrideIcon
|
||||||
|
? getTypeIcon(overrideIcon)
|
||||||
|
: getTypeIcon(item.Type ?? "universal")}
|
||||||
</div>
|
</div>
|
||||||
<img
|
<img
|
||||||
alt={item.Name ?? "blink"}
|
alt={item.Name ?? "blink"}
|
||||||
src={
|
src={
|
||||||
overrideIcon === "User"
|
api
|
||||||
? `${api.basePath}/Users/${item.Id}/Images/Primary`
|
? overrideIcon === "User"
|
||||||
: api.getItemImageUrl(
|
? `${api?.basePath}/Users/${item.Id}/Images/Primary`
|
||||||
seriesId ? item.SeriesId : item.AlbumId ?? item.Id,
|
: getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
(seriesId ? item.SeriesId : (item.AlbumId ?? item.Id)) ??
|
||||||
|
"",
|
||||||
imageType,
|
imageType,
|
||||||
{
|
{
|
||||||
quality: 90,
|
quality: 90,
|
||||||
fillWidth: cardType === "thumb" ? 560 : 280,
|
fillWidth: cardType === "thumb" ? 560 : 280,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
: ""
|
||||||
}
|
}
|
||||||
style={{
|
style={{
|
||||||
height: "100%",
|
height: "100%",
|
||||||
@@ -191,7 +183,7 @@ const CardComponent = ({
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{item.UserData?.PlaybackPositionTicks > 0 && (
|
{(item.UserData?.PlaybackPositionTicks ?? -1) > 0 && (
|
||||||
<div className="card-progress-container">
|
<div className="card-progress-container">
|
||||||
<div
|
<div
|
||||||
className="card-progress"
|
className="card-progress"
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { Blurhash } from "react-blurhash";
|
|||||||
import "./card.scss";
|
import "./card.scss";
|
||||||
|
|
||||||
import { getRuntimeCompact } from "@/utils/date/time";
|
import { getRuntimeCompact } from "@/utils/date/time";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
||||||
import LikeButton from "../buttons/likeButton";
|
import LikeButton from "../buttons/likeButton";
|
||||||
@@ -87,7 +88,7 @@ export const EpisodeCard = ({
|
|||||||
</div>
|
</div>
|
||||||
<img
|
<img
|
||||||
alt={item.Name}
|
alt={item.Name}
|
||||||
src={api.getItemImageUrl(item.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(item.Id, "Primary", {
|
||||||
quality: 90,
|
quality: 90,
|
||||||
fillHeight: 512,
|
fillHeight: 512,
|
||||||
fillWidth: 512,
|
fillWidth: 512,
|
||||||
|
|||||||
@@ -11,6 +11,25 @@ import Typography from "@mui/material/Typography";
|
|||||||
|
|
||||||
import "./cardScroller.scss";
|
import "./cardScroller.scss";
|
||||||
|
|
||||||
|
//@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>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export const CardScroller = ({
|
export const CardScroller = ({
|
||||||
children,
|
children,
|
||||||
displayCards,
|
displayCards,
|
||||||
@@ -53,8 +72,6 @@ export const CardScroller = ({
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const [carouselRef, setCarouselRef] = useState();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box {...boxProps} className="card-scroller-container" mb={1}>
|
<Box {...boxProps} className="card-scroller-container" mb={1}>
|
||||||
<Box
|
<Box
|
||||||
@@ -79,20 +96,11 @@ export const CardScroller = ({
|
|||||||
draggable
|
draggable
|
||||||
responsive={responsive}
|
responsive={responsive}
|
||||||
arrows
|
arrows
|
||||||
ref={(el) => setCarouselRef(el)}
|
|
||||||
className="card-scroller"
|
className="card-scroller"
|
||||||
customTransition="all .6s"
|
customTransition="all .6s"
|
||||||
transitionDuration={600}
|
transitionDuration={600}
|
||||||
customRightArrow={
|
customRightArrow={<RightButton />}
|
||||||
<IconButton className="card-scroller-button right">
|
customLeftArrow={<LeftButton />}
|
||||||
<div className="material-symbols-rounded">chevron_right</div>
|
|
||||||
</IconButton>
|
|
||||||
}
|
|
||||||
customLeftArrow={
|
|
||||||
<IconButton className="card-scroller-button left">
|
|
||||||
<div className="material-symbols-rounded">chevron_left</div>
|
|
||||||
</IconButton>
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</Carousel>
|
</Carousel>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { AnimatePresence, motion } from "framer-motion";
|
import { AnimatePresence, motion } from "framer-motion";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState, useMemo, useCallback } from "react";
|
||||||
|
|
||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
|
|
||||||
@@ -9,6 +9,7 @@ import { useApiInContext } from "@/utils/store/api";
|
|||||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
import CarouselSlide from "../carouselSlide";
|
import CarouselSlide from "../carouselSlide";
|
||||||
|
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import ReactMultiCarousel from "react-multi-carousel";
|
import ReactMultiCarousel from "react-multi-carousel";
|
||||||
import Slider from "../Slider";
|
import Slider from "../Slider";
|
||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
import { getTypeIcon } from "../utils/iconsCollection";
|
||||||
@@ -18,6 +19,12 @@ const swipePower = (offset, velocity) => {
|
|||||||
return Math.abs(offset) * velocity;
|
return Math.abs(offset) * velocity;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Memoize CarouselSlide to prevent unnecessary re-renders
|
||||||
|
const MemoizedCarouselSlide = React.memo(CarouselSlide);
|
||||||
|
|
||||||
|
// Memoize Slider to prevent unnecessary re-renders
|
||||||
|
const MemoizedSlider = React.memo(Slider);
|
||||||
|
|
||||||
const Carousel = ({
|
const Carousel = ({
|
||||||
content,
|
content,
|
||||||
onChange,
|
onChange,
|
||||||
@@ -31,6 +38,7 @@ const Carousel = ({
|
|||||||
state.setDirection,
|
state.setDirection,
|
||||||
state.direction,
|
state.direction,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
onChange(currentSlide);
|
onChange(currentSlide);
|
||||||
}, [content[currentSlide]?.Id]);
|
}, [content[currentSlide]?.Id]);
|
||||||
@@ -39,7 +47,6 @@ const Carousel = ({
|
|||||||
|
|
||||||
const responsive = {
|
const responsive = {
|
||||||
superLargeDesktop: {
|
superLargeDesktop: {
|
||||||
// the naming can be any, depends on you.
|
|
||||||
breakpoint: { max: 4000, min: 3000 },
|
breakpoint: { max: 4000, min: 3000 },
|
||||||
items: 6,
|
items: 6,
|
||||||
},
|
},
|
||||||
@@ -57,49 +64,12 @@ const Carousel = ({
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Memoize the content mapping
|
||||||
|
const sliderContent = useMemo(() => {
|
||||||
|
return content.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<div className="carousel">
|
|
||||||
<AnimatePresence mode="sync">
|
|
||||||
<motion.div
|
|
||||||
key={currentSlide}
|
|
||||||
initial={{ opacity: 0 }}
|
|
||||||
animate={{ opacity: 1 }}
|
|
||||||
exit={{ opacity: 0 }}
|
|
||||||
transition={{
|
|
||||||
duration: 0.25,
|
|
||||||
ease: "linear",
|
|
||||||
}}
|
|
||||||
drag={"x"}
|
|
||||||
dragConstraints={{ left: 0, right: 0 }}
|
|
||||||
dragElastic={1}
|
|
||||||
onDragEnd={(e, { offset, velocity }) => {
|
|
||||||
const swipe = swipePower(offset.x, velocity.x);
|
|
||||||
if (
|
|
||||||
currentSlide !== content.length - 1 &&
|
|
||||||
swipe < -swipeConfidenceThreshold
|
|
||||||
) {
|
|
||||||
setDirection("right");
|
|
||||||
setCurrentSlide((init) => init + 1);
|
|
||||||
} else if (currentSlide !== 0 && swipe > swipeConfidenceThreshold) {
|
|
||||||
setDirection("left");
|
|
||||||
setCurrentSlide((init) => init - 1);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
style={{
|
|
||||||
height: "100%",
|
|
||||||
width: "100%",
|
|
||||||
position: "absolute",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<CarouselSlide
|
|
||||||
item={content[currentSlide]}
|
|
||||||
key={content[currentSlide].Id}
|
|
||||||
/>
|
|
||||||
</motion.div>
|
|
||||||
</AnimatePresence>
|
|
||||||
<Slider
|
|
||||||
currentSlide={currentSlide}
|
|
||||||
content={content.map((item, index) => (
|
|
||||||
<motion.div
|
<motion.div
|
||||||
className={
|
className={
|
||||||
currentSlide === index
|
currentSlide === index
|
||||||
@@ -128,7 +98,7 @@ const Carousel = ({
|
|||||||
>
|
>
|
||||||
{item.ImageTags?.Thumb ? (
|
{item.ImageTags?.Thumb ? (
|
||||||
<img
|
<img
|
||||||
src={api.getItemImageUrl(item.Id, "Thumb", {
|
src={getImageUrlsApi(api).getItemImageUrlById(item.Id, "Thumb", {
|
||||||
tag: item.ImageTags.Primary,
|
tag: item.ImageTags.Primary,
|
||||||
fillWidth: 300,
|
fillWidth: 300,
|
||||||
})}
|
})}
|
||||||
@@ -141,10 +111,58 @@ const Carousel = ({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</motion.div>
|
</motion.div>
|
||||||
))}
|
);
|
||||||
|
});
|
||||||
|
}, [content, currentSlide, api, setDirection]);
|
||||||
|
|
||||||
|
const handleDragEnd = useCallback(
|
||||||
|
(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);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[currentSlide, content.length, setDirection],
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="carousel">
|
||||||
|
<AnimatePresence mode="sync">
|
||||||
|
<motion.div
|
||||||
|
key={currentSlide}
|
||||||
|
initial={{ opacity: 0 }}
|
||||||
|
animate={{ opacity: 1 }}
|
||||||
|
exit={{ opacity: 0 }}
|
||||||
|
transition={{
|
||||||
|
duration: 0.25,
|
||||||
|
ease: "linear",
|
||||||
|
}}
|
||||||
|
drag={"x"}
|
||||||
|
dragConstraints={{ left: 0, right: 0 }}
|
||||||
|
dragElastic={1}
|
||||||
|
onDragEnd={handleDragEnd}
|
||||||
|
style={{
|
||||||
|
height: "100%",
|
||||||
|
width: "100%",
|
||||||
|
position: "absolute",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<MemoizedCarouselSlide
|
||||||
|
item={content[currentSlide]}
|
||||||
|
key={content[currentSlide].Id}
|
||||||
/>
|
/>
|
||||||
|
</motion.div>
|
||||||
|
</AnimatePresence>
|
||||||
|
<MemoizedSlider currentSlide={currentSlide} content={sliderContent} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Carousel;
|
export default React.memo(Carousel);
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import React, { memo } from "react";
|
import React from "react";
|
||||||
import { Blurhash } from "react-blurhash";
|
|
||||||
|
|
||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
|
|
||||||
@@ -13,7 +12,6 @@ import { yellow } from "@mui/material/colors";
|
|||||||
|
|
||||||
import { endsAt, getRuntime } from "@/utils/date/time";
|
import { endsAt, getRuntime } from "@/utils/date/time";
|
||||||
import { green, red } from "@mui/material/colors";
|
import { green, red } from "@mui/material/colors";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
import { getTypeIcon } from "../utils/iconsCollection";
|
||||||
|
|
||||||
@@ -23,41 +21,19 @@ import {
|
|||||||
type BaseItemDto,
|
type BaseItemDto,
|
||||||
BaseItemKind,
|
BaseItemKind,
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
|
||||||
import LikeButton from "../buttons/likeButton";
|
import LikeButton from "../buttons/likeButton";
|
||||||
import MarkPlayedButton from "../buttons/markPlayedButton";
|
import MarkPlayedButton from "../buttons/markPlayedButton";
|
||||||
import PlayButton from "../buttons/playButton";
|
import PlayButton from "../buttons/playButton";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
|
||||||
const availableSpecialRoutes = [
|
|
||||||
BaseItemKind.Series,
|
|
||||||
BaseItemKind.BoxSet,
|
|
||||||
BaseItemKind.MusicAlbum,
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} Props
|
|
||||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemDto} item
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Carousel slide component
|
|
||||||
* @param {Props}
|
|
||||||
* @returns {React.Component}
|
|
||||||
*/
|
|
||||||
const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleMoreInfo = () => {
|
const handleMoreInfo = () => {
|
||||||
|
if (item.Id) {
|
||||||
switch (item.Type) {
|
switch (item.Type) {
|
||||||
case BaseItemKind.BoxSet:
|
case BaseItemKind.BoxSet:
|
||||||
navigate({ to: "/boxset/$id", params: { id: item.Id } });
|
navigate({ to: "/boxset/$id", params: { id: item.Id } });
|
||||||
@@ -84,23 +60,17 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
navigate({ to: "/item/$id", params: { id: item.Id } });
|
navigate({ to: "/item/$id", params: { id: item.Id } });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const [animationDirection] = useCarouselStore((state) => [state.direction]);
|
const [animationDirection] = useCarouselStore((state) => [state.direction]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper
|
<div className="hero-carousel-slide">
|
||||||
className="hero-carousel-slide"
|
|
||||||
sx={{
|
|
||||||
background: "transparent",
|
|
||||||
// px: 3,
|
|
||||||
}}
|
|
||||||
elevation={0}
|
|
||||||
>
|
|
||||||
<div className="hero-carousel-background-container">
|
<div className="hero-carousel-background-container">
|
||||||
{item.BackdropImageTags?.length ? (
|
{item.BackdropImageTags?.length ? (
|
||||||
<img
|
<img
|
||||||
alt={item.Name}
|
alt={item.Name ?? "item"}
|
||||||
className="hero-carousel-background-image"
|
className="hero-carousel-background-image"
|
||||||
src={
|
src={
|
||||||
item.ParentBackdropItemId
|
item.ParentBackdropItemId
|
||||||
@@ -155,7 +125,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
fontWeight={200}
|
fontWeight={200}
|
||||||
overflow="visible"
|
overflow="visible"
|
||||||
>
|
>
|
||||||
{!item.ImageTags.Logo ? (
|
{!item.ImageTags?.Logo ? (
|
||||||
item.Name
|
item.Name
|
||||||
) : (
|
) : (
|
||||||
<img
|
<img
|
||||||
@@ -336,7 +306,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
<PlayButton
|
<PlayButton
|
||||||
item={item}
|
item={item}
|
||||||
itemId={item.Id}
|
itemId={item.Id}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
itemType={item.Type}
|
itemType={item.Type}
|
||||||
currentAudioTrack={0}
|
currentAudioTrack={0}
|
||||||
currentSubTrack={0}
|
currentSubTrack={0}
|
||||||
@@ -377,21 +347,21 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
<LikeButton
|
<LikeButton
|
||||||
itemId={item.Id}
|
itemId={item.Id}
|
||||||
queryKey={["home", "latestMedia"]}
|
queryKey={["home", "latestMedia"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
isFavorite={item.UserData.IsFavorite}
|
isFavorite={item.UserData?.IsFavorite}
|
||||||
itemName={item.Name}
|
itemName={item.Name}
|
||||||
/>
|
/>
|
||||||
<MarkPlayedButton
|
<MarkPlayedButton
|
||||||
itemId={item.Id}
|
itemId={item.Id}
|
||||||
queryKey={["home", "latestMedia"]}
|
queryKey={["home", "latestMedia"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
isPlayed={item.UserData.Played}
|
isPlayed={item.UserData?.Played}
|
||||||
itemName={item.Name}
|
itemName={item.Name}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</div>
|
</div>
|
||||||
</Paper>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { CardScroller } from "../../cardScroller/cardScroller";
|
|||||||
import { CardsSkeleton } from "../../skeleton/cards";
|
import { CardsSkeleton } from "../../skeleton/cards";
|
||||||
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import {
|
import {
|
||||||
type BaseItemDto,
|
type BaseItemDto,
|
||||||
BaseItemKind,
|
BaseItemKind,
|
||||||
@@ -19,27 +20,20 @@ export const LatestMediaSection = ({
|
|||||||
latestMediaLib,
|
latestMediaLib,
|
||||||
}: { latestMediaLib: BaseItemDto }) => {
|
}: { latestMediaLib: BaseItemDto }) => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
});
|
|
||||||
const fetchLatestMedia = async (library: BaseItemDto) => {
|
const fetchLatestMedia = async (library: BaseItemDto) => {
|
||||||
const media = await getUserLibraryApi(api).getLatestMedia({
|
const media = await getUserLibraryApi(api).getLatestMedia({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
parentId: library.Id,
|
parentId: library.Id,
|
||||||
limit: 16,
|
limit: 16,
|
||||||
fields: ["PrimaryImageAspectRatio"],
|
fields: ["PrimaryImageAspectRatio", "ParentId"],
|
||||||
});
|
});
|
||||||
return media.data;
|
return media.data;
|
||||||
};
|
};
|
||||||
const data = useQuery({
|
const data = useQuery({
|
||||||
queryKey: ["home", "latestMedia", latestMediaLib.Id],
|
queryKey: ["home", "latestMedia", latestMediaLib.Id],
|
||||||
queryFn: () => fetchLatestMedia(latestMediaLib),
|
queryFn: () => fetchLatestMedia(latestMediaLib),
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
refetchOnMount: true,
|
refetchOnMount: true,
|
||||||
});
|
});
|
||||||
if (data.isPending) {
|
if (data.isPending) {
|
||||||
@@ -80,7 +74,7 @@ export const LatestMediaSection = ({
|
|||||||
: "portrait"
|
: "portrait"
|
||||||
}
|
}
|
||||||
queryKey={["home", "latestMedia", latestMediaLib.Id]}
|
queryKey={["home", "latestMedia", latestMediaLib.Id]}
|
||||||
userId={user.data?.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
!!item.ImageBlurHashes?.Primary &&
|
||||||
item.ImageBlurHashes?.Primary[
|
item.ImageBlurHashes?.Primary[
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import LikeButton from "../buttons/likeButton";
|
|||||||
import PlayButton from "../buttons/playButton";
|
import PlayButton from "../buttons/playButton";
|
||||||
import TextLink from "../textLink";
|
import TextLink from "../textLink";
|
||||||
import "./musicTrack.scss";
|
import "./musicTrack.scss";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
import type { QueryKey } from "@tanstack/react-query";
|
import type { QueryKey } from "@tanstack/react-query";
|
||||||
@@ -36,13 +37,13 @@ const MusicTrack = ({
|
|||||||
trackIndex,
|
trackIndex,
|
||||||
className = "",
|
className = "",
|
||||||
}: {
|
}: {
|
||||||
item: BaseItemDto;
|
item?: BaseItemDto | null;
|
||||||
queryKey: QueryKey;
|
queryKey?: QueryKey;
|
||||||
userId: string | undefined;
|
userId?: string | undefined;
|
||||||
playlistItem: boolean;
|
playlistItem?: boolean;
|
||||||
playlistItemId: string;
|
playlistItemId?: string;
|
||||||
trackIndex: number;
|
trackIndex?: number;
|
||||||
className: string;
|
className?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const [currentTrackItem] = useAudioPlayback((state) => [state.item]);
|
const [currentTrackItem] = useAudioPlayback((state) => [state.item]);
|
||||||
@@ -60,7 +61,7 @@ const MusicTrack = ({
|
|||||||
</div>
|
</div>
|
||||||
<img
|
<img
|
||||||
alt={item.Name}
|
alt={item.Name}
|
||||||
src={api.getItemImageUrl(
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
Object.keys(item.ImageTags).length === 0 ? item.AlbumId : item.Id,
|
Object.keys(item.ImageTags).length === 0 ? item.AlbumId : item.Id,
|
||||||
"Primary",
|
"Primary",
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
aspect-ratio: 1;
|
aspect-ratio: 1;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 4em;
|
width: 4em;
|
||||||
|
box-shadow: 0 0 10px rgb(0 0 0 / 0.2);
|
||||||
|
transition: opacity $transition-time-default;
|
||||||
&-overlay {
|
&-overlay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
@@ -39,8 +41,6 @@
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity $transition-time-fast;
|
transition: opacity $transition-time-fast;
|
||||||
}
|
}
|
||||||
box-shadow: 0 0 10px rgb(0 0 0 / 0.2);
|
|
||||||
transition: opacity $transition-time-default;
|
|
||||||
}
|
}
|
||||||
&-info {
|
&-info {
|
||||||
justify-self: start;
|
justify-self: start;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { LinearProgress } from "@mui/material";
|
import { LinearProgress } from "@mui/material";
|
||||||
import { useNProgress } from "@tanem/react-nprogress";
|
import { useNProgress } from "@tanem/react-nprogress";
|
||||||
import type React from "react";
|
import React from "react";
|
||||||
|
|
||||||
const NProgress: React.FC<{ isAnimating: boolean | number }> = ({
|
const NProgress: React.FC<{ isAnimating: boolean | number }> = ({
|
||||||
isAnimating,
|
isAnimating,
|
||||||
|
|||||||
+7
-6
@@ -1,11 +1,10 @@
|
|||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import Button from "@mui/material/Button";
|
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import { red } from "@mui/material/colors";
|
import { red } from "@mui/material/colors";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
export const ErrorNotice = ({ error }) => {
|
export const ErrorNotice = ({ error }: { error?: Error }) => {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@@ -23,14 +22,15 @@ export const ErrorNotice = ({ error }) => {
|
|||||||
style={{
|
style={{
|
||||||
fontSize: "10em",
|
fontSize: "10em",
|
||||||
color: red[800],
|
color: red[800],
|
||||||
|
//@ts-ignore
|
||||||
"--clr": "rgb(198 40 40 / 30%)",
|
"--clr": "rgb(198 40 40 / 30%)",
|
||||||
fontVariationSettings: '"FILL" 1, "wght" 400, "GRAD" 25, "opsz" 60',
|
fontVariationSettings: '"FILL" 1, "wght" 400, "GRAD" 25, "opsz" 60',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
error
|
error
|
||||||
</div>
|
</div>
|
||||||
<Typography variant="h3" fontWeight={300}>
|
<Typography variant="h3" color="white" fontWeight={300}>
|
||||||
Something went wrong
|
Something went wrong.
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
fontFamily="JetBrains Mono Variable"
|
fontFamily="JetBrains Mono Variable"
|
||||||
@@ -45,8 +45,9 @@ export const ErrorNotice = ({ error }) => {
|
|||||||
marginTop: "1em",
|
marginTop: "1em",
|
||||||
// opacity: 0.6,
|
// opacity: 0.6,
|
||||||
}}
|
}}
|
||||||
|
color="gray"
|
||||||
>
|
>
|
||||||
{JSON.stringify(error.message)}
|
{JSON.stringify(error?.message)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
@@ -6,6 +6,7 @@ import React from "react";
|
|||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
import { getTypeIcon } from "../utils/iconsCollection";
|
||||||
|
|
||||||
import "./outroCard.scss";
|
import "./outroCard.scss";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ const OutroCard = (props: { handleShowCredits: () => void }) => {
|
|||||||
<img
|
<img
|
||||||
className="outro-card-content-image"
|
className="outro-card-content-image"
|
||||||
alt={item.Name ?? "Cover"}
|
alt={item.Name ?? "Cover"}
|
||||||
src={api.getItemImageUrl(item.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(item.Id, "Primary", {
|
||||||
tag: item.ImageTags.Primary,
|
tag: item.ImageTags.Primary,
|
||||||
quality: 80,
|
quality: 80,
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -1,24 +1,12 @@
|
|||||||
import React, {
|
import React, { useEffect, useMemo, useRef, useState } from "react";
|
||||||
useEffect,
|
|
||||||
useLayoutEffect,
|
|
||||||
useMemo,
|
|
||||||
useRef,
|
|
||||||
useState,
|
|
||||||
} from "react";
|
|
||||||
|
|
||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
|
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
|
||||||
import Fab from "@mui/material/Fab";
|
import Fab from "@mui/material/Fab";
|
||||||
import Grow from "@mui/material/Grow";
|
|
||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import Paper from "@mui/material/Paper";
|
|
||||||
import Popper from "@mui/material/Popper";
|
|
||||||
import Slider from "@mui/material/Slider";
|
import Slider from "@mui/material/Slider";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
import WaveSurfer from "wavesurfer.js";
|
|
||||||
|
|
||||||
import { setAudioRef, useAudioPlayback } from "@/utils/store/audioPlayback";
|
import { setAudioRef, useAudioPlayback } from "@/utils/store/audioPlayback";
|
||||||
import useQueue from "@/utils/store/queue";
|
import useQueue from "@/utils/store/queue";
|
||||||
|
|
||||||
@@ -26,14 +14,17 @@ import { AnimatePresence } from "framer-motion";
|
|||||||
import "./audioPlayer.scss";
|
import "./audioPlayer.scss";
|
||||||
|
|
||||||
import { getRuntimeMusic, secToTicks, ticksToSec } from "@/utils/date/time";
|
import { getRuntimeMusic, secToTicks, ticksToSec } from "@/utils/date/time";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
|
|
||||||
import PlayNextButton from "@/components/buttons/playNextButton";
|
import PlayNextButton from "@/components/buttons/playNextButton";
|
||||||
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
||||||
import QueueButton from "@/components/buttons/queueButton";
|
import QueueButton from "@/components/buttons/queueButton";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
import { playItemFromQueue } from "@/utils/store/playback";
|
||||||
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
|
|
||||||
const AudioPlayer = () => {
|
const AudioPlayer = () => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
@@ -49,17 +40,7 @@ const AudioPlayer = () => {
|
|||||||
state.currentItemIndex,
|
state.currentItemIndex,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
enabled: Boolean(display) && Boolean(api),
|
|
||||||
});
|
|
||||||
|
|
||||||
const waveSurferContainerRef = useRef(null);
|
|
||||||
|
|
||||||
const playing = useMemo(() => {
|
const playing = useMemo(() => {
|
||||||
if (audioRef.current?.paused) return false;
|
if (audioRef.current?.paused) return false;
|
||||||
@@ -70,35 +51,38 @@ const AudioPlayer = () => {
|
|||||||
const [isMuted, setIsMuted] = useState(false);
|
const [isMuted, setIsMuted] = useState(false);
|
||||||
const [progress, setProgress] = useState(0);
|
const [progress, setProgress] = useState(0);
|
||||||
const [isScrubbing, setIsScrubbing] = useState(false);
|
const [isScrubbing, setIsScrubbing] = useState(false);
|
||||||
const [sliderProgress, setSliderProgress] = useState(false);
|
const [sliderProgress, setSliderProgress] = useState(0);
|
||||||
|
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (display) {
|
if (display) {
|
||||||
const audioUrlRequest = new Request(audioRef.current?.dataset.src, {
|
// const audioUrlRequest = new Request(audioRef.current?.dataset.src, {
|
||||||
method: "GET",
|
// method: "GET",
|
||||||
headers: {
|
// headers: {
|
||||||
Authorization: api.authorizationHeader,
|
// Authorization: api.authorizationHeader,
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
fetch(audioUrlRequest)
|
// fetch(audioUrlRequest)
|
||||||
.then((res) => res)
|
// .then((res) => res)
|
||||||
.then(async (result) => {
|
// .then(async (result) => {
|
||||||
const blob = await result.blob();
|
// const blob = await result.blob();
|
||||||
const blobUrl = URL.createObjectURL(blob);
|
// const blobUrl = URL.createObjectURL(blob);
|
||||||
audioRef.current.src = blobUrl;
|
// audioRef.current.src = blobUrl;
|
||||||
audioRef.current.play();
|
// await audioRef.current.play();
|
||||||
setLoading(false);
|
// setLoading(false);
|
||||||
});
|
// });
|
||||||
|
|
||||||
|
// Set the audio ref in the store to allow for global control
|
||||||
setAudioRef(audioRef);
|
setAudioRef(audioRef);
|
||||||
}
|
}
|
||||||
}, [url, tracks[currentTrack]?.Id]);
|
}, [url, tracks?.[currentTrack]?.Id]);
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const info = useMemo(
|
const info = useMemo(
|
||||||
() => (
|
() =>
|
||||||
|
!!api?.configuration && (
|
||||||
<div
|
<div
|
||||||
// initial={{
|
// initial={{
|
||||||
// filter: "opacity(0)",
|
// filter: "opacity(0)",
|
||||||
@@ -113,10 +97,10 @@ const AudioPlayer = () => {
|
|||||||
>
|
>
|
||||||
<div className="audio-player-image-container">
|
<div className="audio-player-image-container">
|
||||||
<img
|
<img
|
||||||
alt={tracks[currentTrack]?.Name}
|
alt={tracks?.[currentTrack]?.Name ?? "track"}
|
||||||
className="audio-player-image"
|
className="audio-player-image"
|
||||||
src={api?.getItemImageUrl(
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
!item?.ImageTags.Primary ? item?.AlbumId : item?.Id,
|
(!item?.ImageTags?.Primary ? item?.AlbumId : item?.Id) ?? "",
|
||||||
"Primary",
|
"Primary",
|
||||||
{
|
{
|
||||||
quality: 85,
|
quality: 85,
|
||||||
@@ -145,12 +129,12 @@ const AudioPlayer = () => {
|
|||||||
}}
|
}}
|
||||||
noWrap
|
noWrap
|
||||||
>
|
>
|
||||||
by {item?.Artists.map((artist) => artist).join(",")}
|
by {item?.Artists?.map((artist) => artist).join(",")}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
[tracks[currentTrack]?.Id, currentTrack],
|
[tracks?.[currentTrack]?.Id, currentTrack, api?.configuration],
|
||||||
);
|
);
|
||||||
|
|
||||||
const controls = useMemo(
|
const controls = useMemo(
|
||||||
@@ -186,7 +170,7 @@ const AudioPlayer = () => {
|
|||||||
<PlayNextButton />
|
<PlayNextButton />
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
[tracks[currentTrack]?.Id, loading, playing, tracks.length],
|
[tracks?.[currentTrack]?.Id, loading, playing, tracks?.length],
|
||||||
);
|
);
|
||||||
|
|
||||||
const buttons = useMemo(
|
const buttons = useMemo(
|
||||||
@@ -215,9 +199,13 @@ const AudioPlayer = () => {
|
|||||||
value={isMuted ? 0 : volume * 100}
|
value={isMuted ? 0 : volume * 100}
|
||||||
step={1}
|
step={1}
|
||||||
max={100}
|
max={100}
|
||||||
onChange={(e, newVal) => {
|
onChange={(_, newVal) => {
|
||||||
setVolume(newVal / 100);
|
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;
|
audioRef.current.volume = newVal / 100;
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
valueLabelDisplay="auto"
|
valueLabelDisplay="auto"
|
||||||
valueLabelFormat={(value) => Math.floor(value)}
|
valueLabelFormat={(value) => Math.floor(value)}
|
||||||
@@ -260,6 +248,14 @@ const AudioPlayer = () => {
|
|||||||
[volume, isMuted, currentTrack],
|
[volume, isMuted, currentTrack],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (audioRef.current) {
|
||||||
|
audioRef.current.addEventListener("ended", () => {
|
||||||
|
if (tracks?.[currentTrack + 1]?.Id) {
|
||||||
|
playItemFromQueue("next", user?.Id, api);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AnimatePresence mode="sync">
|
<AnimatePresence mode="sync">
|
||||||
{display && (
|
{display && (
|
||||||
@@ -287,7 +283,8 @@ const AudioPlayer = () => {
|
|||||||
>
|
>
|
||||||
{info}
|
{info}
|
||||||
<audio
|
<audio
|
||||||
data-src={url}
|
autoPlay
|
||||||
|
src={url}
|
||||||
ref={audioRef}
|
ref={audioRef}
|
||||||
key={item?.Id}
|
key={item?.Id}
|
||||||
onTimeUpdate={(e) =>
|
onTimeUpdate={(e) =>
|
||||||
@@ -319,16 +316,24 @@ const AudioPlayer = () => {
|
|||||||
value={isScrubbing ? sliderProgress : progress}
|
value={isScrubbing ? sliderProgress : progress}
|
||||||
step={1}
|
step={1}
|
||||||
size="small"
|
size="small"
|
||||||
max={item?.RunTimeTicks}
|
max={item?.RunTimeTicks ?? 1}
|
||||||
onChange={(e, value) => {
|
onChange={(_, value) => {
|
||||||
setIsScrubbing(true);
|
setIsScrubbing(true);
|
||||||
setSliderProgress(value);
|
Array.isArray(value)
|
||||||
|
? setSliderProgress(value[0])
|
||||||
|
: setSliderProgress(value);
|
||||||
}}
|
}}
|
||||||
onChangeCommitted={(e, value) => {
|
onChangeCommitted={(_, value) => {
|
||||||
setIsScrubbing(false);
|
setIsScrubbing(false);
|
||||||
// console.log(ticksToSec(value * item?.RunTimeTicks));
|
// console.log(ticksToSec(value * item?.RunTimeTicks));
|
||||||
setProgress(value);
|
Array.isArray(value)
|
||||||
|
? setProgress(value[0])
|
||||||
|
: setProgress(value);
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
audioRef.current.currentTime = ticksToSec(value[0]);
|
||||||
|
} else {
|
||||||
audioRef.current.currentTime = ticksToSec(value);
|
audioRef.current.currentTime = ticksToSec(value);
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Typography
|
<Typography
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
import { getRuntimeMusic } from "@/utils/date/time";
|
import { getRuntimeMusic } from "@/utils/date/time";
|
||||||
import useQueue, { setQueue } from "@/utils/store/queue";
|
import useQueue, { setQueue } from "@/utils/store/queue";
|
||||||
|
|
||||||
|
import { useSortable } from "@dnd-kit/sortable";
|
||||||
|
import { CSS } from "@dnd-kit/utilities";
|
||||||
|
|
||||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { Typography } from "@mui/material";
|
import { Typography } from "@mui/material";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
@@ -7,6 +11,8 @@ import { useCallback, useRef } from "react";
|
|||||||
import { type XYCoord, useDrag, useDrop } from "react-dnd";
|
import { type XYCoord, useDrag, useDrop } from "react-dnd";
|
||||||
import type { Identifier } from "typescript";
|
import type { Identifier } from "typescript";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
track: BaseItemDto;
|
track: BaseItemDto;
|
||||||
index: number;
|
index: number;
|
||||||
@@ -17,85 +23,99 @@ const QueueTrack = (props: Props) => {
|
|||||||
s.tracks,
|
s.tracks,
|
||||||
s.currentItemIndex,
|
s.currentItemIndex,
|
||||||
]);
|
]);
|
||||||
const trackRef = useRef<HTMLDivElement | null>(null);
|
|
||||||
const handleQueueUpdate = useCallback(
|
|
||||||
(dragIndex: number, dropIndex: number) => {
|
|
||||||
const prevState = queue;
|
|
||||||
prevState.splice(dropIndex, 0, prevState.splice(dragIndex, 1)[0]);
|
|
||||||
setQueue(prevState, dropIndex);
|
|
||||||
},
|
|
||||||
[queue],
|
|
||||||
);
|
|
||||||
|
|
||||||
const [{ handlerId }, drop] = useDrop<
|
const { attributes, listeners, setNodeRef, transform, transition } =
|
||||||
{
|
useSortable({
|
||||||
index: number;
|
id: track.Id,
|
||||||
id: string;
|
});
|
||||||
type: string;
|
|
||||||
},
|
// const trackRef = useRef<HTMLDivElement | null>(null);
|
||||||
void,
|
// const handleQueueUpdate = useCallback(
|
||||||
{ handlerId: Identifier | null }
|
// (dragIndex: number, dropIndex: number) => {
|
||||||
>({
|
// const prevState = queue;
|
||||||
accept: "Row",
|
// prevState.splice(dropIndex, 0, prevState.splice(dragIndex, 1)[0]);
|
||||||
collect(monitor) {
|
// setQueue(prevState, dropIndex);
|
||||||
return {
|
// },
|
||||||
handlerId: monitor.getHandlerId(),
|
// [queue],
|
||||||
|
// );
|
||||||
|
|
||||||
|
// 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 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,
|
||||||
};
|
};
|
||||||
},
|
|
||||||
hover(hoverItem, monitor) {
|
|
||||||
console.log(hoverItem);
|
|
||||||
if (!trackRef.current) return;
|
|
||||||
|
|
||||||
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));
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={trackRef}
|
ref={setNodeRef}
|
||||||
style={{ opacity: isDragging ? 0.5 : 1 }}
|
style={style}
|
||||||
className={
|
className={
|
||||||
currentItemIndex === index
|
currentItemIndex === index
|
||||||
? "audio-queue-track active"
|
? "audio-queue-track active"
|
||||||
: "audio-queue-track"
|
: "audio-queue-track"
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<span className="material-symbols-rounded">drag_handle</span>
|
<span {...attributes} {...listeners} className="material-symbols-rounded">
|
||||||
|
drag_handle
|
||||||
|
</span>
|
||||||
<div className="audio-queue-track-info">
|
<div className="audio-queue-track-info">
|
||||||
<Typography className="audio-queue-track-info-name">
|
<Typography className="audio-queue-track-info-name">
|
||||||
{track.Name}
|
{track.Name}
|
||||||
@@ -105,7 +125,7 @@ const QueueTrack = (props: Props) => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
<Typography className="opacity-07">
|
<Typography className="opacity-07">
|
||||||
{getRuntimeMusic(track.RunTimeTicks)}
|
{getRuntimeMusic(track.RunTimeTicks ?? 0)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,21 +10,16 @@ import {
|
|||||||
DialogContent,
|
DialogContent,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
Fab,
|
Fab,
|
||||||
FormControlLabel,
|
|
||||||
IconButton,
|
IconButton,
|
||||||
LinearProgress,
|
|
||||||
Link,
|
Link,
|
||||||
Skeleton,
|
Skeleton,
|
||||||
Switch,
|
|
||||||
Tab,
|
Tab,
|
||||||
Tabs,
|
Tabs,
|
||||||
TextField,
|
TextField,
|
||||||
Typography,
|
Typography,
|
||||||
styled,
|
|
||||||
withStyles,
|
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { AnimatePresence, motion, transform } from "framer-motion";
|
import { AnimatePresence, motion } from "framer-motion";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useState, useMemo, useCallback } from "react";
|
||||||
|
|
||||||
import logo from "@/assets/logo.png";
|
import logo from "@/assets/logo.png";
|
||||||
|
|
||||||
@@ -41,14 +36,14 @@ import {
|
|||||||
setDefaultServer,
|
setDefaultServer,
|
||||||
setServer,
|
setServer,
|
||||||
} from "@/utils/storage/servers";
|
} from "@/utils/storage/servers";
|
||||||
import { allSettings, getSetting, setSetting } from "@/utils/storage/settings";
|
import { allSettings } from "@/utils/storage/settings";
|
||||||
import { delUser } from "@/utils/storage/user";
|
import { delUser } from "@/utils/storage/user";
|
||||||
import type { RecommendedServerInfo } from "@jellyfin/sdk";
|
import type { RecommendedServerInfo } from "@jellyfin/sdk";
|
||||||
import { LoadingButton } from "@mui/lab";
|
import { LoadingButton } from "@mui/lab";
|
||||||
import { red, yellow } from "@mui/material/colors";
|
import { red } from "@mui/material/colors";
|
||||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
import { relaunch } from "@tauri-apps/plugin-process";
|
import { relaunch } from "@tauri-apps/plugin-process";
|
||||||
import { type Update, check } from "@tauri-apps/plugin-updater";
|
import { check } from "@tauri-apps/plugin-updater";
|
||||||
import { useSnackbar } from "notistack";
|
import { useSnackbar } from "notistack";
|
||||||
import SettingOption from "../settingOption";
|
import SettingOption from "../settingOption";
|
||||||
|
|
||||||
@@ -82,10 +77,7 @@ const Settings = () => {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
|
|
||||||
const [applicationVersion, serversOnDiskFn] = useCentralStore((state) => [
|
const [applicationVersion] = useCentralStore((state) => [state.clientVersion]);
|
||||||
state.clientVersion,
|
|
||||||
state.allServersOnDisk,
|
|
||||||
]);
|
|
||||||
|
|
||||||
const serversOnDisk = useQuery({
|
const serversOnDisk = useQuery({
|
||||||
queryKey: ["settings", "serversOnDisk"],
|
queryKey: ["settings", "serversOnDisk"],
|
||||||
@@ -191,22 +183,33 @@ const Settings = () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Memoize PaperProps to prevent unnecessary re-renders
|
||||||
|
const paperProps = useMemo(
|
||||||
|
() => ({
|
||||||
|
className: "settings glass",
|
||||||
|
elevation: 10,
|
||||||
|
}),
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
|
// Memoize onClose function to prevent unnecessary re-renders
|
||||||
|
const handleClose = useCallback(() => {
|
||||||
|
setSettingsDialogOpen(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
open={open}
|
open={open}
|
||||||
fullWidth
|
fullWidth
|
||||||
maxWidth="md"
|
maxWidth="md"
|
||||||
PaperProps={{
|
PaperProps={paperProps}
|
||||||
className: "settings glass",
|
|
||||||
elevation: 10,
|
|
||||||
}}
|
|
||||||
hideBackdrop
|
hideBackdrop
|
||||||
onClose={() => setSettingsDialogOpen(false)}
|
onClose={handleClose}
|
||||||
>
|
>
|
||||||
<Tabs
|
<Tabs
|
||||||
orientation="vertical"
|
orientation="vertical"
|
||||||
value={tabValue}
|
value={tabValue}
|
||||||
onChange={(e, newValue) => {
|
onChange={(_, newValue) => {
|
||||||
setSettingsTabValue(newValue);
|
setSettingsTabValue(newValue);
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
@@ -513,14 +516,6 @@ const Settings = () => {
|
|||||||
{systemInfo.data?.Version}
|
{systemInfo.data?.Version}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
<div className="settings-info">
|
|
||||||
<Typography variant="subtitle2">
|
|
||||||
Operating System:
|
|
||||||
</Typography>
|
|
||||||
<Typography variant="subtitle2">
|
|
||||||
{systemInfo.data?.OperatingSystemDisplayName}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
<div className="settings-info">
|
<div className="settings-info">
|
||||||
<Typography variant="subtitle2">
|
<Typography variant="subtitle2">
|
||||||
Server Architecture:
|
Server Architecture:
|
||||||
@@ -563,9 +558,9 @@ const Settings = () => {
|
|||||||
component={Link}
|
component={Link}
|
||||||
variant="subtitle2"
|
variant="subtitle2"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="https://github.com/prayag17/JellyPlayer"
|
href="https://github.com/prayag17/Blink"
|
||||||
>
|
>
|
||||||
https://github.com/prayag17/JellyPlayer
|
https://github.com/prayag17/Blink
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
component={Link}
|
component={Link}
|
||||||
|
|||||||
@@ -1,28 +1,27 @@
|
|||||||
.settings{
|
.settings {
|
||||||
display: grid !important;
|
display: grid !important;
|
||||||
grid-template-columns: 20% 1fr;
|
grid-template-columns: 20% 1fr;
|
||||||
height: 60vh;
|
height: 60vh;
|
||||||
overflow: hidden !important;
|
overflow: hidden !important;
|
||||||
.MuiTabs-flexContainerVertical{
|
.MuiTabs-flexContainerVertical {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
&-container{
|
&-container {
|
||||||
margin: 14px 0 14px 14px;
|
margin: 14px 0 14px 14px;
|
||||||
}
|
}
|
||||||
&-tab{
|
&-tab {
|
||||||
display: grid !important;
|
display: grid !important;
|
||||||
grid-template-columns: 2em 1fr;
|
grid-template-columns: 2em 1fr;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-items: start !important;
|
justify-items: start !important;
|
||||||
gap:1em;
|
gap: 1em;
|
||||||
& .material-symbols-rounded{
|
& .material-symbols-rounded {
|
||||||
justify-self: center !important;
|
justify-self: center !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
&-scroll{
|
&-scroll {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
scrollbar-gutter:stable ;
|
scrollbar-gutter: stable;
|
||||||
overscroll-behavior: contain;
|
overscroll-behavior: contain;
|
||||||
// Magic scrollbar
|
// Magic scrollbar
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
@@ -37,14 +36,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// About page
|
// About page
|
||||||
&-grid{
|
&-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
||||||
gap:1em;
|
gap: 1em;
|
||||||
}
|
}
|
||||||
&-logo{
|
&-logo {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: rgb(255 255 255 / 1);
|
background: rgb(255 255 255 / 1);
|
||||||
padding: 0em;
|
padding: 0em;
|
||||||
@@ -53,7 +51,7 @@
|
|||||||
border-radius: $border-radius-default;
|
border-radius: $border-radius-default;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
&-info{
|
&-info {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 40% 1fr;
|
grid-template-columns: 40% 1fr;
|
||||||
gap: 1em;
|
gap: 1em;
|
||||||
@@ -61,13 +59,13 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
border-bottom: 1px solid rgb(255 255 255 / 0.1);
|
border-bottom: 1px solid rgb(255 255 255 / 0.1);
|
||||||
padding-bottom: 0.5em;
|
padding-bottom: 0.5em;
|
||||||
&-container{
|
&-container {
|
||||||
background: rgb(0 0 0 / 0.3);
|
background: rgb(0 0 0 / 0.3);
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
border-radius: $border-radius-default;
|
border-radius: $border-radius-default;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap:0.6em;
|
gap: 0.6em;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
&:last-child {
|
&:last-child {
|
||||||
@@ -78,9 +76,8 @@
|
|||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//settings
|
//settings
|
||||||
&-option{
|
&-option {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -88,21 +85,12 @@
|
|||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
margin-bottom: 0.6em !important;
|
margin-bottom: 0.6em !important;
|
||||||
&-info-caption{
|
&-info-caption {
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//serverList
|
//serverList
|
||||||
&-server{
|
&-server {
|
||||||
&-container{
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 1em;
|
|
||||||
align-items: center;
|
|
||||||
padding-bottom: 4.6em;
|
|
||||||
}
|
|
||||||
|
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 3.4em 1fr auto;
|
grid-template-columns: 3.4em 1fr auto;
|
||||||
justify-items: start;
|
justify-items: start;
|
||||||
@@ -112,7 +100,13 @@
|
|||||||
padding: 1em;
|
padding: 1em;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-radius: $border-radius-default;
|
border-radius: $border-radius-default;
|
||||||
|
&-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1em;
|
||||||
|
align-items: center;
|
||||||
|
padding-bottom: 4.6em;
|
||||||
|
}
|
||||||
&-icon {
|
&-icon {
|
||||||
font-size: 3.4em !important;
|
font-size: 3.4em !important;
|
||||||
font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 10, "opsz" 40;
|
font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 10, "opsz" 40;
|
||||||
@@ -124,7 +118,7 @@
|
|||||||
&-version {
|
&-version {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap:0.4em;
|
gap: 0.4em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&-buttons {
|
&-buttons {
|
||||||
@@ -134,7 +128,6 @@
|
|||||||
// width: 100%;
|
// width: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-fab-container {
|
&-fab-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -144,7 +137,6 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 0.8em;
|
gap: 0.8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dialog
|
// Dialog
|
||||||
&-add {
|
&-add {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -154,7 +146,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.Mui-selected .material-symbols-rounded {
|
||||||
.Mui-selected .material-symbols-rounded{
|
|
||||||
font-variation-settings: "FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40;
|
font-variation-settings: "FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40;
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,11 @@ import Button from "@mui/material/Button";
|
|||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
|
||||||
const ShowMoreText = ({ content, collapsedLines, extraProps }) => {
|
const ShowMoreText = ({
|
||||||
|
content,
|
||||||
|
collapsedLines,
|
||||||
|
extraProps,
|
||||||
|
}: { content: string; collapsedLines: number; extraProps?: unknown }) => {
|
||||||
const [displayFull, setDisplayFull] = useState(false);
|
const [displayFull, setDisplayFull] = useState(false);
|
||||||
const [isOverflowing, setIsOverflowing] = useState(false);
|
const [isOverflowing, setIsOverflowing] = useState(false);
|
||||||
const textRef = useRef(null);
|
const textRef = useRef(null);
|
||||||
@@ -34,7 +38,7 @@ const ShowMoreText = ({ content, collapsedLines, extraProps }) => {
|
|||||||
display: "-webkit-box",
|
display: "-webkit-box",
|
||||||
textOverflow: "ellipsis",
|
textOverflow: "ellipsis",
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
WebkitLineClamp: displayFull ? "none" : collapsedLines ?? 2,
|
WebkitLineClamp: displayFull ? "none" : (collapsedLines ?? 2),
|
||||||
WebkitBoxOrient: "vertical",
|
WebkitBoxOrient: "vertical",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
}}
|
}}
|
||||||
@@ -7,7 +7,7 @@ import "./tagChip.scss";
|
|||||||
const TagChip = ({
|
const TagChip = ({
|
||||||
label,
|
label,
|
||||||
linkProps,
|
linkProps,
|
||||||
}: { label: string; linkProps: LinkProps }) => {
|
}: { label: string; linkProps?: LinkProps }) => {
|
||||||
return (
|
return (
|
||||||
<Link className="tag" to="/search" search={{ query: label }} {...linkProps}>
|
<Link className="tag" to="/search" search={{ query: label }} {...linkProps}>
|
||||||
<Typography variant="subtitle2" fontWeight={300}>
|
<Typography variant="subtitle2" fontWeight={300}>
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
import "./textLink.scss";
|
import "./textLink.scss";
|
||||||
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
|
|
||||||
const TextLink = ({ children, location, variant, otherProps }) => {
|
const TextLink = ({ children, location, variant, otherProps }) => {
|
||||||
// const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Typography
|
<Typography
|
||||||
variant={variant}
|
variant={variant}
|
||||||
className="link flex"
|
className="link flex"
|
||||||
// onClick={() => navigate(location)}
|
onClick={() => navigate({ to: location })}
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React from "react";
|
import React, { useCallback, useMemo } from "react";
|
||||||
|
|
||||||
import { Dialog, Slide } from "@mui/material";
|
import { Dialog, Slide } from "@mui/material";
|
||||||
import { useKonamiEasterEgg } from "../../utils/misc/konami";
|
import { useKonamiEasterEgg } from "../../utils/misc/konami";
|
||||||
@@ -6,15 +6,22 @@ import { useKonamiEasterEgg } from "../../utils/misc/konami";
|
|||||||
export const EasterEgg = () => {
|
export const EasterEgg = () => {
|
||||||
const [easterEgg, setEasterEgg] = useKonamiEasterEgg();
|
const [easterEgg, setEasterEgg] = useKonamiEasterEgg();
|
||||||
|
|
||||||
|
// Memoize the onClose function
|
||||||
|
const handleClose = useCallback(() => {
|
||||||
|
setEasterEgg(false);
|
||||||
|
}, [setEasterEgg]);
|
||||||
|
|
||||||
|
// Memoize the sx object
|
||||||
|
const dialogSx = useMemo(
|
||||||
|
() => ({
|
||||||
|
background: "black",
|
||||||
|
}),
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Dialog
|
<Dialog open={easterEgg} onClose={handleClose} sx={dialogSx}>
|
||||||
open={easterEgg}
|
|
||||||
onClose={() => setEasterEgg(false)}
|
|
||||||
sx={{
|
|
||||||
background: "black",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<iframe
|
<iframe
|
||||||
width="560"
|
width="560"
|
||||||
height="315"
|
height="315"
|
||||||
|
|||||||
@@ -1,69 +1,76 @@
|
|||||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
import * as generatedClient from "@jellyfin/sdk/lib/generated-client";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
export const getTypeIcon = (icon: BaseItemKind) => {
|
export const getTypeIcon = (
|
||||||
|
icon:
|
||||||
|
| generatedClient.BaseItemKind
|
||||||
|
| generatedClient.CollectionType
|
||||||
|
| "Home"
|
||||||
|
| "User"
|
||||||
|
| "universal",
|
||||||
|
) => {
|
||||||
switch (icon) {
|
switch (icon) {
|
||||||
case "Home":
|
case "Home":
|
||||||
return <div className="material-symbols-rounded">home</div>;
|
return <div className="material-symbols-rounded">home</div>;
|
||||||
case BaseItemKind.Audio:
|
case generatedClient.BaseItemKind.Audio:
|
||||||
return <div className="material-symbols-rounded">mic</div>;
|
return <div className="material-symbols-rounded">mic</div>;
|
||||||
case BaseItemKind.AudioBook:
|
case generatedClient.BaseItemKind.AudioBook:
|
||||||
return <div className="material-symbols-rounded">speech_to_text</div>;
|
return <div className="material-symbols-rounded">speech_to_text</div>;
|
||||||
case BaseItemKind.Book:
|
case generatedClient.BaseItemKind.Book:
|
||||||
return <div className="material-symbols-rounded">book</div>;
|
return <div className="material-symbols-rounded">book</div>;
|
||||||
case "boxsets":
|
case "boxsets":
|
||||||
case BaseItemKind.BoxSet:
|
case generatedClient.BaseItemKind.BoxSet:
|
||||||
return <div className="material-symbols-rounded">video_library</div>;
|
return <div className="material-symbols-rounded">video_library</div>;
|
||||||
case "livetv":
|
case "livetv":
|
||||||
case BaseItemKind.TvProgram:
|
case generatedClient.BaseItemKind.TvProgram:
|
||||||
case BaseItemKind.TvChannel:
|
case generatedClient.BaseItemKind.TvChannel:
|
||||||
case BaseItemKind.Program:
|
case generatedClient.BaseItemKind.Program:
|
||||||
case BaseItemKind.Recording:
|
case generatedClient.BaseItemKind.Recording:
|
||||||
case BaseItemKind.LiveTvChannel:
|
case generatedClient.BaseItemKind.LiveTvChannel:
|
||||||
case BaseItemKind.LiveTvProgram:
|
case generatedClient.BaseItemKind.LiveTvProgram:
|
||||||
case BaseItemKind.ChannelFolderItem:
|
case generatedClient.BaseItemKind.ChannelFolderItem:
|
||||||
case BaseItemKind.Channel:
|
case generatedClient.BaseItemKind.Channel:
|
||||||
return (
|
return (
|
||||||
<div className="material-symbols-rounded">settings_input_antenna</div>
|
<div className="material-symbols-rounded">settings_input_antenna</div>
|
||||||
);
|
);
|
||||||
case "tvshows":
|
case "tvshows":
|
||||||
case BaseItemKind.Season:
|
case generatedClient.BaseItemKind.Season:
|
||||||
case BaseItemKind.Series:
|
case generatedClient.BaseItemKind.Series:
|
||||||
case BaseItemKind.Episode:
|
case generatedClient.BaseItemKind.Episode:
|
||||||
return <div className="material-symbols-rounded">tv_gen</div>;
|
return <div className="material-symbols-rounded">tv_gen</div>;
|
||||||
case "playlists":
|
case "playlists":
|
||||||
case BaseItemKind.Playlist:
|
case generatedClient.BaseItemKind.Playlist:
|
||||||
case BaseItemKind.PlaylistsFolder:
|
case generatedClient.BaseItemKind.PlaylistsFolder:
|
||||||
case BaseItemKind.ManualPlaylistsFolder:
|
case generatedClient.BaseItemKind.ManualPlaylistsFolder:
|
||||||
return <div className="material-symbols-rounded">queue_music</div>;
|
return <div className="material-symbols-rounded">queue_music</div>;
|
||||||
case "movies":
|
case "movies":
|
||||||
case BaseItemKind.Movie:
|
case generatedClient.BaseItemKind.Movie:
|
||||||
return <div className="material-symbols-rounded">movie</div>;
|
return <div className="material-symbols-rounded">movie</div>;
|
||||||
case BaseItemKind.MusicAlbum:
|
case generatedClient.BaseItemKind.MusicAlbum:
|
||||||
return <div className="material-symbols-rounded">album</div>;
|
return <div className="material-symbols-rounded">album</div>;
|
||||||
case BaseItemKind.MusicArtist:
|
case generatedClient.BaseItemKind.MusicArtist:
|
||||||
return <div className="material-symbols-rounded">artist</div>;
|
return <div className="material-symbols-rounded">artist</div>;
|
||||||
case BaseItemKind.Genre:
|
case generatedClient.BaseItemKind.Genre:
|
||||||
case BaseItemKind.MusicGenre:
|
case generatedClient.BaseItemKind.MusicGenre:
|
||||||
return <div className="material-symbols-rounded">domino_mask</div>;
|
return <div className="material-symbols-rounded">domino_mask</div>;
|
||||||
case "musicvideos":
|
case "musicvideos":
|
||||||
case BaseItemKind.MusicVideo:
|
case generatedClient.BaseItemKind.MusicVideo:
|
||||||
return <div className="material-symbols-rounded">music_video</div>;
|
return <div className="material-symbols-rounded">music_video</div>;
|
||||||
case "User":
|
case "User":
|
||||||
case BaseItemKind.Person:
|
case generatedClient.BaseItemKind.Person:
|
||||||
return <div className="material-symbols-rounded">person</div>;
|
return <div className="material-symbols-rounded">person</div>;
|
||||||
case BaseItemKind.Photo:
|
case generatedClient.BaseItemKind.Photo:
|
||||||
return <div className="material-symbols-rounded">image</div>;
|
return <div className="material-symbols-rounded">image</div>;
|
||||||
case "photos":
|
case "photos":
|
||||||
case BaseItemKind.PhotoAlbum:
|
case generatedClient.BaseItemKind.PhotoAlbum:
|
||||||
return <div className="material-symbols-rounded">photo_library</div>;
|
return <div className="material-symbols-rounded">photo_library</div>;
|
||||||
case "universal":
|
case "universal":
|
||||||
case BaseItemKind.Studio:
|
case generatedClient.BaseItemKind.Studio:
|
||||||
return <div className="material-symbols-rounded">category</div>;
|
return <div className="material-symbols-rounded">category</div>;
|
||||||
case "trailers":
|
case "trailers":
|
||||||
case BaseItemKind.Trailer:
|
case generatedClient.BaseItemKind.Trailer:
|
||||||
return <div className="material-symbols-rounded">smart_display</div>;
|
return <div className="material-symbols-rounded">smart_display</div>;
|
||||||
case BaseItemKind.Video:
|
case generatedClient.BaseItemKind.Video:
|
||||||
return <div className="material-symbols-rounded">theaters</div>;
|
return <div className="material-symbols-rounded">theaters</div>;
|
||||||
case "music":
|
case "music":
|
||||||
return <div className="material-symbols-rounded">library_music</div>;
|
return <div className="material-symbols-rounded">library_music</div>;
|
||||||
|
|||||||
+30
-7
@@ -1,10 +1,6 @@
|
|||||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||||
import {
|
import { RouterProvider, createRouter } from "@tanstack/react-router";
|
||||||
RouterProvider,
|
import React, { Suspense, useEffect } from "react";
|
||||||
createRouteMask,
|
|
||||||
createRouter,
|
|
||||||
} from "@tanstack/react-router";
|
|
||||||
import React, { Suspense } from "react";
|
|
||||||
import ReactDOM from "react-dom/client";
|
import ReactDOM from "react-dom/client";
|
||||||
// Import the generated route tree
|
// Import the generated route tree
|
||||||
import { routeTree } from "./routeTree.gen";
|
import { routeTree } from "./routeTree.gen";
|
||||||
@@ -25,6 +21,7 @@ const router = createRouter({
|
|||||||
createApi: undefined!,
|
createApi: undefined!,
|
||||||
user: undefined,
|
user: undefined,
|
||||||
jellyfinSDK: undefined!,
|
jellyfinSDK: undefined!,
|
||||||
|
fetchCurrentUser: undefined!,
|
||||||
},
|
},
|
||||||
defaultPreload: "intent",
|
defaultPreload: "intent",
|
||||||
});
|
});
|
||||||
@@ -36,7 +33,10 @@ declare module "@tanstack/react-router" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import { ErrorBoundary } from "react-error-boundary";
|
||||||
|
import { ErrorNotice } from "./components/notices/errorNotice/errorNotice";
|
||||||
import { ApiProvider, useApiInContext } from "./utils/store/api";
|
import { ApiProvider, useApiInContext } from "./utils/store/api";
|
||||||
|
import { CentralProvider, useCentralStore } from "./utils/store/central";
|
||||||
|
|
||||||
export const queryClient = new QueryClient({
|
export const queryClient = new QueryClient({
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
@@ -55,8 +55,27 @@ function ProviderWrapper() {
|
|||||||
s.createApi,
|
s.createApi,
|
||||||
s.jellyfin,
|
s.jellyfin,
|
||||||
]);
|
]);
|
||||||
|
const [user, fetchCurrentUser] = useCentralStore((s) => [
|
||||||
|
s.currentUser,
|
||||||
|
s.fetchCurrentUser,
|
||||||
|
]);
|
||||||
|
if (api?.accessToken && !user?.Id) {
|
||||||
|
fetchCurrentUser(api);
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
if (api) {
|
||||||
|
console.log(`API is set - Route ${window.location.pathname}`);
|
||||||
|
console.log(api);
|
||||||
|
} else {
|
||||||
|
console.log(`API is not set - Route ${window.location.pathname}`);
|
||||||
|
}
|
||||||
|
router.invalidate(); // This is a hack to force the router to re-evaluate the routes and re-run the beforeLoad functions
|
||||||
|
}, [api]);
|
||||||
return (
|
return (
|
||||||
<RouterProvider router={router} context={{ api, createApi, jellyfinSDK }} />
|
<RouterProvider
|
||||||
|
router={router}
|
||||||
|
context={{ api, createApi, user, jellyfinSDK, fetchCurrentUser }}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,11 +83,15 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
|
|||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
{/* TODO: Create a proper loading fallback component */}
|
{/* TODO: Create a proper loading fallback component */}
|
||||||
|
<ErrorBoundary FallbackComponent={ErrorNotice}>
|
||||||
<Suspense fallback={<h1>Loading in main.tsx</h1>}>
|
<Suspense fallback={<h1>Loading in main.tsx</h1>}>
|
||||||
|
<CentralProvider>
|
||||||
<ApiProvider>
|
<ApiProvider>
|
||||||
<ProviderWrapper />
|
<ProviderWrapper />
|
||||||
</ApiProvider>
|
</ApiProvider>
|
||||||
|
</CentralProvider>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
</ErrorBoundary>
|
||||||
</QueryClientProvider>
|
</QueryClientProvider>
|
||||||
</React.StrictMode>,
|
</React.StrictMode>,
|
||||||
);
|
);
|
||||||
|
|||||||
+70
-57
@@ -1,12 +1,12 @@
|
|||||||
/* prettier-ignore-start */
|
|
||||||
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
|
||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
// noinspection JSUnusedGlobalSymbols
|
// noinspection JSUnusedGlobalSymbols
|
||||||
|
|
||||||
// This file is auto-generated by TanStack Router
|
// This file was automatically generated by TanStack Router.
|
||||||
|
// You should NOT make any changes in this file as it will be overwritten.
|
||||||
|
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
|
||||||
|
|
||||||
// Import Routes
|
// Import Routes
|
||||||
|
|
||||||
@@ -16,7 +16,6 @@ import { Route as IndexImport } from './routes/index'
|
|||||||
import { Route as ErrorCodeImport } from './routes/error/$code'
|
import { Route as ErrorCodeImport } from './routes/error/$code'
|
||||||
import { Route as ApiSearchImport } from './routes/_api/search'
|
import { Route as ApiSearchImport } from './routes/_api/search'
|
||||||
import { Route as ApiLoginImport } from './routes/_api/login'
|
import { Route as ApiLoginImport } from './routes/_api/login'
|
||||||
import { Route as ApiLibraryImport } from './routes/_api/library'
|
|
||||||
import { Route as ApiSearchIndexImport } from './routes/_api/search/index'
|
import { Route as ApiSearchIndexImport } from './routes/_api/search/index'
|
||||||
import { Route as ApiPlayerIndexImport } from './routes/_api/player/index'
|
import { Route as ApiPlayerIndexImport } from './routes/_api/player/index'
|
||||||
import { Route as ApiHomeIndexImport } from './routes/_api/home/index'
|
import { Route as ApiHomeIndexImport } from './routes/_api/home/index'
|
||||||
@@ -26,6 +25,7 @@ import { Route as SetupServerErrorImport } from './routes/setup/server.error'
|
|||||||
import { Route as SetupServerAddImport } from './routes/setup/server.add'
|
import { Route as SetupServerAddImport } from './routes/setup/server.add'
|
||||||
import { Route as ApiSeriesIdImport } from './routes/_api/series/$id'
|
import { Route as ApiSeriesIdImport } from './routes/_api/series/$id'
|
||||||
import { Route as ApiPlaylistIdImport } from './routes/_api/playlist/$id'
|
import { Route as ApiPlaylistIdImport } from './routes/_api/playlist/$id'
|
||||||
|
import { Route as ApiPlayerPhotosImport } from './routes/_api/player/photos'
|
||||||
import { Route as ApiPlayerAudioImport } from './routes/_api/player/audio'
|
import { Route as ApiPlayerAudioImport } from './routes/_api/player/audio'
|
||||||
import { Route as ApiPersonIdImport } from './routes/_api/person/$id'
|
import { Route as ApiPersonIdImport } from './routes/_api/person/$id'
|
||||||
import { Route as ApiLoginManualImport } from './routes/_api/login/manual'
|
import { Route as ApiLoginManualImport } from './routes/_api/login/manual'
|
||||||
@@ -46,126 +46,151 @@ const ApiRoute = ApiImport.update({
|
|||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const IndexRoute = IndexImport.update({
|
const IndexRoute = IndexImport.update({
|
||||||
|
id: '/',
|
||||||
path: '/',
|
path: '/',
|
||||||
getParentRoute: () => rootRoute,
|
getParentRoute: () => rootRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ErrorCodeRoute = ErrorCodeImport.update({
|
const ErrorCodeRoute = ErrorCodeImport.update({
|
||||||
|
id: '/error/$code',
|
||||||
path: '/error/$code',
|
path: '/error/$code',
|
||||||
getParentRoute: () => rootRoute,
|
getParentRoute: () => rootRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiSearchRoute = ApiSearchImport.update({
|
const ApiSearchRoute = ApiSearchImport.update({
|
||||||
|
id: '/search',
|
||||||
path: '/search',
|
path: '/search',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiLoginRoute = ApiLoginImport.update({
|
const ApiLoginRoute = ApiLoginImport.update({
|
||||||
|
id: '/login',
|
||||||
path: '/login',
|
path: '/login',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiLibraryRoute = ApiLibraryImport.update({
|
|
||||||
path: '/library',
|
|
||||||
getParentRoute: () => ApiRoute,
|
|
||||||
} as any)
|
|
||||||
|
|
||||||
const ApiSearchIndexRoute = ApiSearchIndexImport.update({
|
const ApiSearchIndexRoute = ApiSearchIndexImport.update({
|
||||||
|
id: '/',
|
||||||
path: '/',
|
path: '/',
|
||||||
getParentRoute: () => ApiSearchRoute,
|
getParentRoute: () => ApiSearchRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiPlayerIndexRoute = ApiPlayerIndexImport.update({
|
const ApiPlayerIndexRoute = ApiPlayerIndexImport.update({
|
||||||
|
id: '/player/',
|
||||||
path: '/player/',
|
path: '/player/',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiHomeIndexRoute = ApiHomeIndexImport.update({
|
const ApiHomeIndexRoute = ApiHomeIndexImport.update({
|
||||||
|
id: '/home/',
|
||||||
path: '/home/',
|
path: '/home/',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiFavoriteIndexRoute = ApiFavoriteIndexImport.update({
|
const ApiFavoriteIndexRoute = ApiFavoriteIndexImport.update({
|
||||||
|
id: '/favorite/',
|
||||||
path: '/favorite/',
|
path: '/favorite/',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const SetupServerListRoute = SetupServerListImport.update({
|
const SetupServerListRoute = SetupServerListImport.update({
|
||||||
|
id: '/setup/server/list',
|
||||||
path: '/setup/server/list',
|
path: '/setup/server/list',
|
||||||
getParentRoute: () => rootRoute,
|
getParentRoute: () => rootRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const SetupServerErrorRoute = SetupServerErrorImport.update({
|
const SetupServerErrorRoute = SetupServerErrorImport.update({
|
||||||
|
id: '/setup/server/error',
|
||||||
path: '/setup/server/error',
|
path: '/setup/server/error',
|
||||||
getParentRoute: () => rootRoute,
|
getParentRoute: () => rootRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const SetupServerAddRoute = SetupServerAddImport.update({
|
const SetupServerAddRoute = SetupServerAddImport.update({
|
||||||
|
id: '/setup/server/add',
|
||||||
path: '/setup/server/add',
|
path: '/setup/server/add',
|
||||||
getParentRoute: () => rootRoute,
|
getParentRoute: () => rootRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiSeriesIdRoute = ApiSeriesIdImport.update({
|
const ApiSeriesIdRoute = ApiSeriesIdImport.update({
|
||||||
|
id: '/series/$id',
|
||||||
path: '/series/$id',
|
path: '/series/$id',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiPlaylistIdRoute = ApiPlaylistIdImport.update({
|
const ApiPlaylistIdRoute = ApiPlaylistIdImport.update({
|
||||||
|
id: '/playlist/$id',
|
||||||
path: '/playlist/$id',
|
path: '/playlist/$id',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
|
const ApiPlayerPhotosRoute = ApiPlayerPhotosImport.update({
|
||||||
|
id: '/player/photos',
|
||||||
|
path: '/player/photos',
|
||||||
|
getParentRoute: () => ApiRoute,
|
||||||
|
} as any)
|
||||||
|
|
||||||
const ApiPlayerAudioRoute = ApiPlayerAudioImport.update({
|
const ApiPlayerAudioRoute = ApiPlayerAudioImport.update({
|
||||||
|
id: '/player/audio',
|
||||||
path: '/player/audio',
|
path: '/player/audio',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiPersonIdRoute = ApiPersonIdImport.update({
|
const ApiPersonIdRoute = ApiPersonIdImport.update({
|
||||||
|
id: '/person/$id',
|
||||||
path: '/person/$id',
|
path: '/person/$id',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiLoginManualRoute = ApiLoginManualImport.update({
|
const ApiLoginManualRoute = ApiLoginManualImport.update({
|
||||||
|
id: '/manual',
|
||||||
path: '/manual',
|
path: '/manual',
|
||||||
getParentRoute: () => ApiLoginRoute,
|
getParentRoute: () => ApiLoginRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiLoginListRoute = ApiLoginListImport.update({
|
const ApiLoginListRoute = ApiLoginListImport.update({
|
||||||
|
id: '/list',
|
||||||
path: '/list',
|
path: '/list',
|
||||||
getParentRoute: () => ApiLoginRoute,
|
getParentRoute: () => ApiLoginRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiLibraryIdRoute = ApiLibraryIdImport.update({
|
const ApiLibraryIdRoute = ApiLibraryIdImport.update({
|
||||||
path: '/$id',
|
id: '/library/$id',
|
||||||
getParentRoute: () => ApiLibraryRoute,
|
path: '/library/$id',
|
||||||
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiItemIdRoute = ApiItemIdImport.update({
|
const ApiItemIdRoute = ApiItemIdImport.update({
|
||||||
|
id: '/item/$id',
|
||||||
path: '/item/$id',
|
path: '/item/$id',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiEpisodeIdRoute = ApiEpisodeIdImport.update({
|
const ApiEpisodeIdRoute = ApiEpisodeIdImport.update({
|
||||||
|
id: '/episode/$id',
|
||||||
path: '/episode/$id',
|
path: '/episode/$id',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiBoxsetIdRoute = ApiBoxsetIdImport.update({
|
const ApiBoxsetIdRoute = ApiBoxsetIdImport.update({
|
||||||
|
id: '/boxset/$id',
|
||||||
path: '/boxset/$id',
|
path: '/boxset/$id',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiArtistIdRoute = ApiArtistIdImport.update({
|
const ApiArtistIdRoute = ApiArtistIdImport.update({
|
||||||
|
id: '/artist/$id',
|
||||||
path: '/artist/$id',
|
path: '/artist/$id',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiAlbumIdRoute = ApiAlbumIdImport.update({
|
const ApiAlbumIdRoute = ApiAlbumIdImport.update({
|
||||||
|
id: '/album/$id',
|
||||||
path: '/album/$id',
|
path: '/album/$id',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiLoginUserIdUserNameRoute = ApiLoginUserIdUserNameImport.update({
|
const ApiLoginUserIdUserNameRoute = ApiLoginUserIdUserNameImport.update({
|
||||||
|
id: '/$userId/$userName',
|
||||||
path: '/$userId/$userName',
|
path: '/$userId/$userName',
|
||||||
getParentRoute: () => ApiLoginRoute,
|
getParentRoute: () => ApiLoginRoute,
|
||||||
} as any)
|
} as any)
|
||||||
@@ -188,13 +213,6 @@ declare module '@tanstack/react-router' {
|
|||||||
preLoaderRoute: typeof ApiImport
|
preLoaderRoute: typeof ApiImport
|
||||||
parentRoute: typeof rootRoute
|
parentRoute: typeof rootRoute
|
||||||
}
|
}
|
||||||
'/_api/library': {
|
|
||||||
id: '/_api/library'
|
|
||||||
path: '/library'
|
|
||||||
fullPath: '/library'
|
|
||||||
preLoaderRoute: typeof ApiLibraryImport
|
|
||||||
parentRoute: typeof ApiImport
|
|
||||||
}
|
|
||||||
'/_api/login': {
|
'/_api/login': {
|
||||||
id: '/_api/login'
|
id: '/_api/login'
|
||||||
path: '/login'
|
path: '/login'
|
||||||
@@ -253,10 +271,10 @@ declare module '@tanstack/react-router' {
|
|||||||
}
|
}
|
||||||
'/_api/library/$id': {
|
'/_api/library/$id': {
|
||||||
id: '/_api/library/$id'
|
id: '/_api/library/$id'
|
||||||
path: '/$id'
|
path: '/library/$id'
|
||||||
fullPath: '/library/$id'
|
fullPath: '/library/$id'
|
||||||
preLoaderRoute: typeof ApiLibraryIdImport
|
preLoaderRoute: typeof ApiLibraryIdImport
|
||||||
parentRoute: typeof ApiLibraryImport
|
parentRoute: typeof ApiImport
|
||||||
}
|
}
|
||||||
'/_api/login/list': {
|
'/_api/login/list': {
|
||||||
id: '/_api/login/list'
|
id: '/_api/login/list'
|
||||||
@@ -286,6 +304,13 @@ declare module '@tanstack/react-router' {
|
|||||||
preLoaderRoute: typeof ApiPlayerAudioImport
|
preLoaderRoute: typeof ApiPlayerAudioImport
|
||||||
parentRoute: typeof ApiImport
|
parentRoute: typeof ApiImport
|
||||||
}
|
}
|
||||||
|
'/_api/player/photos': {
|
||||||
|
id: '/_api/player/photos'
|
||||||
|
path: '/player/photos'
|
||||||
|
fullPath: '/player/photos'
|
||||||
|
preLoaderRoute: typeof ApiPlayerPhotosImport
|
||||||
|
parentRoute: typeof ApiImport
|
||||||
|
}
|
||||||
'/_api/playlist/$id': {
|
'/_api/playlist/$id': {
|
||||||
id: '/_api/playlist/$id'
|
id: '/_api/playlist/$id'
|
||||||
path: '/playlist/$id'
|
path: '/playlist/$id'
|
||||||
@@ -361,18 +386,6 @@ declare module '@tanstack/react-router' {
|
|||||||
|
|
||||||
// Create and export the route tree
|
// Create and export the route tree
|
||||||
|
|
||||||
interface ApiLibraryRouteChildren {
|
|
||||||
ApiLibraryIdRoute: typeof ApiLibraryIdRoute
|
|
||||||
}
|
|
||||||
|
|
||||||
const ApiLibraryRouteChildren: ApiLibraryRouteChildren = {
|
|
||||||
ApiLibraryIdRoute: ApiLibraryIdRoute,
|
|
||||||
}
|
|
||||||
|
|
||||||
const ApiLibraryRouteWithChildren = ApiLibraryRoute._addFileChildren(
|
|
||||||
ApiLibraryRouteChildren,
|
|
||||||
)
|
|
||||||
|
|
||||||
interface ApiLoginRouteChildren {
|
interface ApiLoginRouteChildren {
|
||||||
ApiLoginListRoute: typeof ApiLoginListRoute
|
ApiLoginListRoute: typeof ApiLoginListRoute
|
||||||
ApiLoginManualRoute: typeof ApiLoginManualRoute
|
ApiLoginManualRoute: typeof ApiLoginManualRoute
|
||||||
@@ -402,7 +415,6 @@ const ApiSearchRouteWithChildren = ApiSearchRoute._addFileChildren(
|
|||||||
)
|
)
|
||||||
|
|
||||||
interface ApiRouteChildren {
|
interface ApiRouteChildren {
|
||||||
ApiLibraryRoute: typeof ApiLibraryRouteWithChildren
|
|
||||||
ApiLoginRoute: typeof ApiLoginRouteWithChildren
|
ApiLoginRoute: typeof ApiLoginRouteWithChildren
|
||||||
ApiSearchRoute: typeof ApiSearchRouteWithChildren
|
ApiSearchRoute: typeof ApiSearchRouteWithChildren
|
||||||
ApiAlbumIdRoute: typeof ApiAlbumIdRoute
|
ApiAlbumIdRoute: typeof ApiAlbumIdRoute
|
||||||
@@ -410,8 +422,10 @@ interface ApiRouteChildren {
|
|||||||
ApiBoxsetIdRoute: typeof ApiBoxsetIdRoute
|
ApiBoxsetIdRoute: typeof ApiBoxsetIdRoute
|
||||||
ApiEpisodeIdRoute: typeof ApiEpisodeIdRoute
|
ApiEpisodeIdRoute: typeof ApiEpisodeIdRoute
|
||||||
ApiItemIdRoute: typeof ApiItemIdRoute
|
ApiItemIdRoute: typeof ApiItemIdRoute
|
||||||
|
ApiLibraryIdRoute: typeof ApiLibraryIdRoute
|
||||||
ApiPersonIdRoute: typeof ApiPersonIdRoute
|
ApiPersonIdRoute: typeof ApiPersonIdRoute
|
||||||
ApiPlayerAudioRoute: typeof ApiPlayerAudioRoute
|
ApiPlayerAudioRoute: typeof ApiPlayerAudioRoute
|
||||||
|
ApiPlayerPhotosRoute: typeof ApiPlayerPhotosRoute
|
||||||
ApiPlaylistIdRoute: typeof ApiPlaylistIdRoute
|
ApiPlaylistIdRoute: typeof ApiPlaylistIdRoute
|
||||||
ApiSeriesIdRoute: typeof ApiSeriesIdRoute
|
ApiSeriesIdRoute: typeof ApiSeriesIdRoute
|
||||||
ApiFavoriteIndexRoute: typeof ApiFavoriteIndexRoute
|
ApiFavoriteIndexRoute: typeof ApiFavoriteIndexRoute
|
||||||
@@ -420,7 +434,6 @@ interface ApiRouteChildren {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ApiRouteChildren: ApiRouteChildren = {
|
const ApiRouteChildren: ApiRouteChildren = {
|
||||||
ApiLibraryRoute: ApiLibraryRouteWithChildren,
|
|
||||||
ApiLoginRoute: ApiLoginRouteWithChildren,
|
ApiLoginRoute: ApiLoginRouteWithChildren,
|
||||||
ApiSearchRoute: ApiSearchRouteWithChildren,
|
ApiSearchRoute: ApiSearchRouteWithChildren,
|
||||||
ApiAlbumIdRoute: ApiAlbumIdRoute,
|
ApiAlbumIdRoute: ApiAlbumIdRoute,
|
||||||
@@ -428,8 +441,10 @@ const ApiRouteChildren: ApiRouteChildren = {
|
|||||||
ApiBoxsetIdRoute: ApiBoxsetIdRoute,
|
ApiBoxsetIdRoute: ApiBoxsetIdRoute,
|
||||||
ApiEpisodeIdRoute: ApiEpisodeIdRoute,
|
ApiEpisodeIdRoute: ApiEpisodeIdRoute,
|
||||||
ApiItemIdRoute: ApiItemIdRoute,
|
ApiItemIdRoute: ApiItemIdRoute,
|
||||||
|
ApiLibraryIdRoute: ApiLibraryIdRoute,
|
||||||
ApiPersonIdRoute: ApiPersonIdRoute,
|
ApiPersonIdRoute: ApiPersonIdRoute,
|
||||||
ApiPlayerAudioRoute: ApiPlayerAudioRoute,
|
ApiPlayerAudioRoute: ApiPlayerAudioRoute,
|
||||||
|
ApiPlayerPhotosRoute: ApiPlayerPhotosRoute,
|
||||||
ApiPlaylistIdRoute: ApiPlaylistIdRoute,
|
ApiPlaylistIdRoute: ApiPlaylistIdRoute,
|
||||||
ApiSeriesIdRoute: ApiSeriesIdRoute,
|
ApiSeriesIdRoute: ApiSeriesIdRoute,
|
||||||
ApiFavoriteIndexRoute: ApiFavoriteIndexRoute,
|
ApiFavoriteIndexRoute: ApiFavoriteIndexRoute,
|
||||||
@@ -439,10 +454,9 @@ const ApiRouteChildren: ApiRouteChildren = {
|
|||||||
|
|
||||||
const ApiRouteWithChildren = ApiRoute._addFileChildren(ApiRouteChildren)
|
const ApiRouteWithChildren = ApiRoute._addFileChildren(ApiRouteChildren)
|
||||||
|
|
||||||
interface FileRoutesByFullPath {
|
export interface FileRoutesByFullPath {
|
||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'': typeof ApiRouteWithChildren
|
'': typeof ApiRouteWithChildren
|
||||||
'/library': typeof ApiLibraryRouteWithChildren
|
|
||||||
'/login': typeof ApiLoginRouteWithChildren
|
'/login': typeof ApiLoginRouteWithChildren
|
||||||
'/search': typeof ApiSearchRouteWithChildren
|
'/search': typeof ApiSearchRouteWithChildren
|
||||||
'/error/$code': typeof ErrorCodeRoute
|
'/error/$code': typeof ErrorCodeRoute
|
||||||
@@ -456,6 +470,7 @@ interface FileRoutesByFullPath {
|
|||||||
'/login/manual': typeof ApiLoginManualRoute
|
'/login/manual': typeof ApiLoginManualRoute
|
||||||
'/person/$id': typeof ApiPersonIdRoute
|
'/person/$id': typeof ApiPersonIdRoute
|
||||||
'/player/audio': typeof ApiPlayerAudioRoute
|
'/player/audio': typeof ApiPlayerAudioRoute
|
||||||
|
'/player/photos': typeof ApiPlayerPhotosRoute
|
||||||
'/playlist/$id': typeof ApiPlaylistIdRoute
|
'/playlist/$id': typeof ApiPlaylistIdRoute
|
||||||
'/series/$id': typeof ApiSeriesIdRoute
|
'/series/$id': typeof ApiSeriesIdRoute
|
||||||
'/setup/server/add': typeof SetupServerAddRoute
|
'/setup/server/add': typeof SetupServerAddRoute
|
||||||
@@ -468,10 +483,9 @@ interface FileRoutesByFullPath {
|
|||||||
'/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
'/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FileRoutesByTo {
|
export interface FileRoutesByTo {
|
||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'': typeof ApiRouteWithChildren
|
'': typeof ApiRouteWithChildren
|
||||||
'/library': typeof ApiLibraryRouteWithChildren
|
|
||||||
'/login': typeof ApiLoginRouteWithChildren
|
'/login': typeof ApiLoginRouteWithChildren
|
||||||
'/error/$code': typeof ErrorCodeRoute
|
'/error/$code': typeof ErrorCodeRoute
|
||||||
'/album/$id': typeof ApiAlbumIdRoute
|
'/album/$id': typeof ApiAlbumIdRoute
|
||||||
@@ -484,6 +498,7 @@ interface FileRoutesByTo {
|
|||||||
'/login/manual': typeof ApiLoginManualRoute
|
'/login/manual': typeof ApiLoginManualRoute
|
||||||
'/person/$id': typeof ApiPersonIdRoute
|
'/person/$id': typeof ApiPersonIdRoute
|
||||||
'/player/audio': typeof ApiPlayerAudioRoute
|
'/player/audio': typeof ApiPlayerAudioRoute
|
||||||
|
'/player/photos': typeof ApiPlayerPhotosRoute
|
||||||
'/playlist/$id': typeof ApiPlaylistIdRoute
|
'/playlist/$id': typeof ApiPlaylistIdRoute
|
||||||
'/series/$id': typeof ApiSeriesIdRoute
|
'/series/$id': typeof ApiSeriesIdRoute
|
||||||
'/setup/server/add': typeof SetupServerAddRoute
|
'/setup/server/add': typeof SetupServerAddRoute
|
||||||
@@ -496,10 +511,10 @@ interface FileRoutesByTo {
|
|||||||
'/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
'/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FileRoutesById {
|
export interface FileRoutesById {
|
||||||
|
__root__: typeof rootRoute
|
||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'/_api': typeof ApiRouteWithChildren
|
'/_api': typeof ApiRouteWithChildren
|
||||||
'/_api/library': typeof ApiLibraryRouteWithChildren
|
|
||||||
'/_api/login': typeof ApiLoginRouteWithChildren
|
'/_api/login': typeof ApiLoginRouteWithChildren
|
||||||
'/_api/search': typeof ApiSearchRouteWithChildren
|
'/_api/search': typeof ApiSearchRouteWithChildren
|
||||||
'/error/$code': typeof ErrorCodeRoute
|
'/error/$code': typeof ErrorCodeRoute
|
||||||
@@ -513,6 +528,7 @@ interface FileRoutesById {
|
|||||||
'/_api/login/manual': typeof ApiLoginManualRoute
|
'/_api/login/manual': typeof ApiLoginManualRoute
|
||||||
'/_api/person/$id': typeof ApiPersonIdRoute
|
'/_api/person/$id': typeof ApiPersonIdRoute
|
||||||
'/_api/player/audio': typeof ApiPlayerAudioRoute
|
'/_api/player/audio': typeof ApiPlayerAudioRoute
|
||||||
|
'/_api/player/photos': typeof ApiPlayerPhotosRoute
|
||||||
'/_api/playlist/$id': typeof ApiPlaylistIdRoute
|
'/_api/playlist/$id': typeof ApiPlaylistIdRoute
|
||||||
'/_api/series/$id': typeof ApiSeriesIdRoute
|
'/_api/series/$id': typeof ApiSeriesIdRoute
|
||||||
'/setup/server/add': typeof SetupServerAddRoute
|
'/setup/server/add': typeof SetupServerAddRoute
|
||||||
@@ -525,12 +541,11 @@ interface FileRoutesById {
|
|||||||
'/_api/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
'/_api/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FileRouteTypes {
|
export interface FileRouteTypes {
|
||||||
fileRoutesByFullPath: FileRoutesByFullPath
|
fileRoutesByFullPath: FileRoutesByFullPath
|
||||||
fullPaths:
|
fullPaths:
|
||||||
| '/'
|
| '/'
|
||||||
| ''
|
| ''
|
||||||
| '/library'
|
|
||||||
| '/login'
|
| '/login'
|
||||||
| '/search'
|
| '/search'
|
||||||
| '/error/$code'
|
| '/error/$code'
|
||||||
@@ -544,6 +559,7 @@ interface FileRouteTypes {
|
|||||||
| '/login/manual'
|
| '/login/manual'
|
||||||
| '/person/$id'
|
| '/person/$id'
|
||||||
| '/player/audio'
|
| '/player/audio'
|
||||||
|
| '/player/photos'
|
||||||
| '/playlist/$id'
|
| '/playlist/$id'
|
||||||
| '/series/$id'
|
| '/series/$id'
|
||||||
| '/setup/server/add'
|
| '/setup/server/add'
|
||||||
@@ -558,7 +574,6 @@ interface FileRouteTypes {
|
|||||||
to:
|
to:
|
||||||
| '/'
|
| '/'
|
||||||
| ''
|
| ''
|
||||||
| '/library'
|
|
||||||
| '/login'
|
| '/login'
|
||||||
| '/error/$code'
|
| '/error/$code'
|
||||||
| '/album/$id'
|
| '/album/$id'
|
||||||
@@ -571,6 +586,7 @@ interface FileRouteTypes {
|
|||||||
| '/login/manual'
|
| '/login/manual'
|
||||||
| '/person/$id'
|
| '/person/$id'
|
||||||
| '/player/audio'
|
| '/player/audio'
|
||||||
|
| '/player/photos'
|
||||||
| '/playlist/$id'
|
| '/playlist/$id'
|
||||||
| '/series/$id'
|
| '/series/$id'
|
||||||
| '/setup/server/add'
|
| '/setup/server/add'
|
||||||
@@ -582,9 +598,9 @@ interface FileRouteTypes {
|
|||||||
| '/search'
|
| '/search'
|
||||||
| '/login/$userId/$userName'
|
| '/login/$userId/$userName'
|
||||||
id:
|
id:
|
||||||
|
| '__root__'
|
||||||
| '/'
|
| '/'
|
||||||
| '/_api'
|
| '/_api'
|
||||||
| '/_api/library'
|
|
||||||
| '/_api/login'
|
| '/_api/login'
|
||||||
| '/_api/search'
|
| '/_api/search'
|
||||||
| '/error/$code'
|
| '/error/$code'
|
||||||
@@ -598,6 +614,7 @@ interface FileRouteTypes {
|
|||||||
| '/_api/login/manual'
|
| '/_api/login/manual'
|
||||||
| '/_api/person/$id'
|
| '/_api/person/$id'
|
||||||
| '/_api/player/audio'
|
| '/_api/player/audio'
|
||||||
|
| '/_api/player/photos'
|
||||||
| '/_api/playlist/$id'
|
| '/_api/playlist/$id'
|
||||||
| '/_api/series/$id'
|
| '/_api/series/$id'
|
||||||
| '/setup/server/add'
|
| '/setup/server/add'
|
||||||
@@ -611,7 +628,7 @@ interface FileRouteTypes {
|
|||||||
fileRoutesById: FileRoutesById
|
fileRoutesById: FileRoutesById
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RootRouteChildren {
|
export interface RootRouteChildren {
|
||||||
IndexRoute: typeof IndexRoute
|
IndexRoute: typeof IndexRoute
|
||||||
ApiRoute: typeof ApiRouteWithChildren
|
ApiRoute: typeof ApiRouteWithChildren
|
||||||
ErrorCodeRoute: typeof ErrorCodeRoute
|
ErrorCodeRoute: typeof ErrorCodeRoute
|
||||||
@@ -633,8 +650,6 @@ export const routeTree = rootRoute
|
|||||||
._addFileChildren(rootRouteChildren)
|
._addFileChildren(rootRouteChildren)
|
||||||
._addFileTypes<FileRouteTypes>()
|
._addFileTypes<FileRouteTypes>()
|
||||||
|
|
||||||
/* prettier-ignore-end */
|
|
||||||
|
|
||||||
/* ROUTE_MANIFEST_START
|
/* ROUTE_MANIFEST_START
|
||||||
{
|
{
|
||||||
"routes": {
|
"routes": {
|
||||||
@@ -655,7 +670,6 @@ export const routeTree = rootRoute
|
|||||||
"/_api": {
|
"/_api": {
|
||||||
"filePath": "_api.tsx",
|
"filePath": "_api.tsx",
|
||||||
"children": [
|
"children": [
|
||||||
"/_api/library",
|
|
||||||
"/_api/login",
|
"/_api/login",
|
||||||
"/_api/search",
|
"/_api/search",
|
||||||
"/_api/album/$id",
|
"/_api/album/$id",
|
||||||
@@ -663,8 +677,10 @@ export const routeTree = rootRoute
|
|||||||
"/_api/boxset/$id",
|
"/_api/boxset/$id",
|
||||||
"/_api/episode/$id",
|
"/_api/episode/$id",
|
||||||
"/_api/item/$id",
|
"/_api/item/$id",
|
||||||
|
"/_api/library/$id",
|
||||||
"/_api/person/$id",
|
"/_api/person/$id",
|
||||||
"/_api/player/audio",
|
"/_api/player/audio",
|
||||||
|
"/_api/player/photos",
|
||||||
"/_api/playlist/$id",
|
"/_api/playlist/$id",
|
||||||
"/_api/series/$id",
|
"/_api/series/$id",
|
||||||
"/_api/favorite/",
|
"/_api/favorite/",
|
||||||
@@ -672,13 +688,6 @@ export const routeTree = rootRoute
|
|||||||
"/_api/player/"
|
"/_api/player/"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"/_api/library": {
|
|
||||||
"filePath": "_api/library.tsx",
|
|
||||||
"parent": "/_api",
|
|
||||||
"children": [
|
|
||||||
"/_api/library/$id"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"/_api/login": {
|
"/_api/login": {
|
||||||
"filePath": "_api/login.tsx",
|
"filePath": "_api/login.tsx",
|
||||||
"parent": "/_api",
|
"parent": "/_api",
|
||||||
@@ -720,7 +729,7 @@ export const routeTree = rootRoute
|
|||||||
},
|
},
|
||||||
"/_api/library/$id": {
|
"/_api/library/$id": {
|
||||||
"filePath": "_api/library/$id.tsx",
|
"filePath": "_api/library/$id.tsx",
|
||||||
"parent": "/_api/library"
|
"parent": "/_api"
|
||||||
},
|
},
|
||||||
"/_api/login/list": {
|
"/_api/login/list": {
|
||||||
"filePath": "_api/login/list.tsx",
|
"filePath": "_api/login/list.tsx",
|
||||||
@@ -738,6 +747,10 @@ export const routeTree = rootRoute
|
|||||||
"filePath": "_api/player/audio.tsx",
|
"filePath": "_api/player/audio.tsx",
|
||||||
"parent": "/_api"
|
"parent": "/_api"
|
||||||
},
|
},
|
||||||
|
"/_api/player/photos": {
|
||||||
|
"filePath": "_api/player/photos.tsx",
|
||||||
|
"parent": "/_api"
|
||||||
|
},
|
||||||
"/_api/playlist/$id": {
|
"/_api/playlist/$id": {
|
||||||
"filePath": "_api/playlist/$id.jsx",
|
"filePath": "_api/playlist/$id.jsx",
|
||||||
"parent": "/_api"
|
"parent": "/_api"
|
||||||
@@ -768,7 +781,7 @@ export const routeTree = rootRoute
|
|||||||
"parent": "/_api"
|
"parent": "/_api"
|
||||||
},
|
},
|
||||||
"/_api/search/": {
|
"/_api/search/": {
|
||||||
"filePath": "_api/search/index.jsx",
|
"filePath": "_api/search/index.tsx",
|
||||||
"parent": "/_api/search"
|
"parent": "/_api/search"
|
||||||
},
|
},
|
||||||
"/_api/login/$userId/$userName": {
|
"/_api/login/$userId/$userName": {
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import "@fontsource-variable/jetbrains-mono";
|
|||||||
import "@fontsource-variable/noto-sans";
|
import "@fontsource-variable/noto-sans";
|
||||||
|
|
||||||
import "material-symbols/rounded.scss";
|
import "material-symbols/rounded.scss";
|
||||||
|
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||||
import type { Api, Jellyfin } from "@jellyfin/sdk";
|
import type { Api, Jellyfin } from "@jellyfin/sdk";
|
||||||
import type { UserDto } from "@jellyfin/sdk/lib/generated-client";
|
import type { UserDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||||
@@ -50,13 +51,11 @@ import { DndProvider } from "react-dnd";
|
|||||||
import { HTML5Backend } from "react-dnd-html5-backend";
|
import { HTML5Backend } from "react-dnd-html5-backend";
|
||||||
|
|
||||||
type ApiContext = {
|
type ApiContext = {
|
||||||
api: Api;
|
api: Api | undefined;
|
||||||
createApi: (
|
createApi: (serverAddress: string, accessToken: string | undefined) => void;
|
||||||
serverAddress: string | undefined,
|
|
||||||
accessToken: string | undefined,
|
|
||||||
) => void;
|
|
||||||
user: UserDto | null | undefined;
|
user: UserDto | null | undefined;
|
||||||
jellyfinSDK: Jellyfin;
|
jellyfinSDK: Jellyfin;
|
||||||
|
fetchCurrentUser: (api: Api | undefined) => Promise<void>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Route = createRootRouteWithContext<ApiContext>()({
|
export const Route = createRootRouteWithContext<ApiContext>()({
|
||||||
@@ -107,10 +106,10 @@ export const Route = createRootRouteWithContext<ApiContext>()({
|
|||||||
<NProgress
|
<NProgress
|
||||||
key={
|
key={
|
||||||
isQueryFetching || isMutating || routeIsLoading
|
isQueryFetching || isMutating || routeIsLoading
|
||||||
? `show${(isQueryFetching ?? 1) * (isMutating ?? 1) * (routeIsLoading ?? 1)}`
|
? `show${(isQueryFetching ?? 1) * (isMutating ?? 1) * (routeIsLoading ? 1 : 2)}`
|
||||||
: "hide"
|
: "hide"
|
||||||
}
|
}
|
||||||
isAnimating={isQueryFetching || isMutating || routeIsLoading}
|
isAnimating={isQueryFetching && isMutating && routeIsLoading}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{routeIsLoading && (
|
{routeIsLoading && (
|
||||||
@@ -263,7 +262,7 @@ export const Route = createRootRouteWithContext<ApiContext>()({
|
|||||||
<AppBar />
|
<AppBar />
|
||||||
<AudioPlayer />
|
<AudioPlayer />
|
||||||
<Outlet />
|
<Outlet />
|
||||||
<ReactQueryDevtools />
|
{/* <ReactQueryDevtools /> */}
|
||||||
{/* <TanStackRouterDevtools /> */}
|
{/* <TanStackRouterDevtools /> */}
|
||||||
</SnackbarProvider>
|
</SnackbarProvider>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
@@ -271,4 +270,5 @@ export const Route = createRootRouteWithContext<ApiContext>()({
|
|||||||
</DndProvider>
|
</DndProvider>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
errorComponent: ErrorNotice,
|
||||||
});
|
});
|
||||||
+8
-13
@@ -1,22 +1,21 @@
|
|||||||
import { getDefaultServer, getServer } from "@/utils/storage/servers";
|
import { getDefaultServer, getServer } from "@/utils/storage/servers";
|
||||||
import { getUser } from "@/utils/storage/user";
|
import { getUser } from "@/utils/storage/user";
|
||||||
import { axiosClient } from "@/utils/store/api";
|
|
||||||
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
import { Outlet, createFileRoute, redirect } from "@tanstack/react-router";
|
import { createFileRoute, redirect } from "@tanstack/react-router";
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api")({
|
export const Route = createFileRoute("/_api")({
|
||||||
beforeLoad: async ({ context, location }) => {
|
beforeLoad: async ({ context, location }) => {
|
||||||
// console.log(context.api);
|
// console.log(context.api);
|
||||||
|
console.log(context.user);
|
||||||
if (!context.api) {
|
if (!context.api) {
|
||||||
const currentServerId = await getDefaultServer();
|
const currentServerId = await getDefaultServer();
|
||||||
if (currentServerId) {
|
if (currentServerId) {
|
||||||
const currentServer = await getServer(currentServerId);
|
const currentServer = await getServer(currentServerId);
|
||||||
|
if (currentServer?.address) {
|
||||||
const apiTemp = context.jellyfinSDK.createApi(
|
const apiTemp = context.jellyfinSDK.createApi(
|
||||||
currentServer?.address,
|
currentServer?.address,
|
||||||
null,
|
undefined,
|
||||||
axiosClient,
|
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
await getSystemApi(apiTemp).getPingSystem();
|
await getSystemApi(apiTemp).getPingSystem();
|
||||||
@@ -38,6 +37,7 @@ export const Route = createFileRoute("/_api")({
|
|||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
await getUserApi(apiTemp).getCurrentUser();
|
await getUserApi(apiTemp).getCurrentUser();
|
||||||
|
// return { user: user.data };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
throw redirect({
|
throw redirect({
|
||||||
@@ -47,24 +47,19 @@ export const Route = createFileRoute("/_api")({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// return { api: apiTemp };
|
|
||||||
}
|
}
|
||||||
context.createApi(currentServer?.address, userOnDisk.AccessToken);
|
context.createApi(currentServer?.address, userOnDisk.AccessToken);
|
||||||
} else {
|
} else {
|
||||||
const apiTemp = context.jellyfinSDK.createApi(
|
|
||||||
currentServer?.address,
|
|
||||||
null,
|
|
||||||
);
|
|
||||||
context.createApi(currentServer?.address, undefined); // Creates Api
|
context.createApi(currentServer?.address, undefined); // Creates Api
|
||||||
|
|
||||||
// return { api: apiTemp };
|
// return { api: apiTemp };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (context.api) {
|
} else if (context.api) {
|
||||||
if (context.api.accessToken && location.pathname !== "/login/manual") {
|
if (context.api.accessToken && location.pathname !== "/login/manual") {
|
||||||
try {
|
try {
|
||||||
return {
|
await getUserApi(context.api).getCurrentUser(); // Verify user is able to authenticate
|
||||||
user: await getUserApi(context.api).getCurrentUser(),
|
|
||||||
}; // Verify user is able to authenticate
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
throw redirect({
|
throw redirect({
|
||||||
|
|||||||
+162
-93
@@ -1,16 +1,9 @@
|
|||||||
import PropTypes from "prop-types";
|
import React, { useLayoutEffect, useMemo, useRef } from "react";
|
||||||
import React, { useLayoutEffect, useRef } from "react";
|
|
||||||
|
|
||||||
import heroBg from "@/assets/herobg.png";
|
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import Chip from "@mui/material/Chip";
|
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
import Stack from "@mui/material/Stack";
|
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
import useParallax from "@/utils/hooks/useParallax";
|
|
||||||
import { motion, useScroll } from "framer-motion";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
type BaseItemDto,
|
type BaseItemDto,
|
||||||
BaseItemKind,
|
BaseItemKind,
|
||||||
@@ -18,27 +11,19 @@ import {
|
|||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
|
||||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||||
|
|
||||||
import { Blurhash } from "react-blurhash";
|
|
||||||
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
import {
|
import { getRuntimeCompact, getRuntimeMusic } from "@/utils/date/time";
|
||||||
getRuntime,
|
|
||||||
getRuntimeCompact,
|
|
||||||
getRuntimeMusic,
|
|
||||||
} from "@/utils/date/time";
|
|
||||||
|
|
||||||
import { Card } from "@/components/card/card";
|
import { Card } from "@/components/card/card";
|
||||||
import { CardScroller } from "@/components/cardScroller/cardScroller";
|
import { CardScroller } from "@/components/cardScroller/cardScroller";
|
||||||
|
|
||||||
import LikeButton from "@/components/buttons/likeButton";
|
import LikeButton from "@/components/buttons/likeButton";
|
||||||
import PlayButton from "@/components/buttons/playButton";
|
import PlayButton from "@/components/buttons/playButton";
|
||||||
import TrackList from "@/components/layouts/tracksList";
|
|
||||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||||
import ShowMoreText from "@/components/showMoreText";
|
|
||||||
|
|
||||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||||
import {
|
import {
|
||||||
@@ -50,39 +35,12 @@ import { useBackdropStore } from "@/utils/store/backdrop";
|
|||||||
import "./album.scss";
|
import "./album.scss";
|
||||||
|
|
||||||
import TagChip from "@/components/tagChip";
|
import TagChip from "@/components/tagChip";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
import { playItem } from "@/utils/store/playback";
|
||||||
import { Link, createFileRoute } from "@tanstack/react-router";
|
import { Link, createFileRoute } from "@tanstack/react-router";
|
||||||
import lyricsIcon from "../../../assets/icons/lyrics.svg";
|
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}`,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/album/$id")({
|
export const Route = createFileRoute("/_api/album/$id")({
|
||||||
component: MusicAlbumTitlePage,
|
component: MusicAlbumTitlePage,
|
||||||
});
|
});
|
||||||
@@ -91,26 +49,18 @@ function MusicAlbumTitlePage() {
|
|||||||
const { id } = Route.useParams();
|
const { id } = Route.useParams();
|
||||||
const api = Route.useRouteContext().api;
|
const api = Route.useRouteContext().api;
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
enabled: Boolean(api),
|
|
||||||
});
|
|
||||||
|
|
||||||
const item = useQuery({
|
const item = useQuery({
|
||||||
queryKey: ["item", id],
|
queryKey: ["item", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
itemId: id,
|
itemId: id,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
});
|
});
|
||||||
@@ -118,12 +68,14 @@ function MusicAlbumTitlePage() {
|
|||||||
const similarItems = useQuery({
|
const similarItems = useQuery({
|
||||||
queryKey: ["item", id, "similarItem"],
|
queryKey: ["item", id, "similarItem"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (item.data?.Id) {
|
||||||
const result = await getLibraryApi(api).getSimilarAlbums({
|
const result = await getLibraryApi(api).getSimilarAlbums({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
itemId: item.data?.Id,
|
itemId: item.data?.Id,
|
||||||
limit: 16,
|
limit: 16,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
enabled: item.isSuccess,
|
enabled: item.isSuccess,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
@@ -134,10 +86,11 @@ function MusicAlbumTitlePage() {
|
|||||||
queryKey: ["item", "musicTracks", id],
|
queryKey: ["item", "musicTracks", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
parentId: item.data?.Id,
|
parentId: item.data?.Id,
|
||||||
sortOrder: [SortOrder.Ascending],
|
sortOrder: [SortOrder.Ascending],
|
||||||
sortBy: ["IndexNumber"],
|
sortBy: ["IndexNumber"],
|
||||||
|
fields: ["MediaSources"],
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
@@ -147,6 +100,21 @@ function MusicAlbumTitlePage() {
|
|||||||
|
|
||||||
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
||||||
|
|
||||||
|
const allDiscs = useMemo(() => {
|
||||||
|
const discs: number[] = [];
|
||||||
|
if (musicTracks.data?.Items) {
|
||||||
|
for (const track of musicTracks.data.Items) {
|
||||||
|
if (
|
||||||
|
track.ParentIndexNumber &&
|
||||||
|
!discs.includes(track.ParentIndexNumber)
|
||||||
|
) {
|
||||||
|
discs.push(track.ParentIndexNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return discs;
|
||||||
|
}, [musicTracks.data]);
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (item.isSuccess) {
|
if (item.isSuccess) {
|
||||||
setAppBackdrop(
|
setAppBackdrop(
|
||||||
@@ -157,24 +125,22 @@ function MusicAlbumTitlePage() {
|
|||||||
}, [item.isSuccess]);
|
}, [item.isSuccess]);
|
||||||
|
|
||||||
const pageRef = useRef(null);
|
const pageRef = useRef(null);
|
||||||
const { scrollYProgress } = useScroll({
|
|
||||||
target: pageRef,
|
|
||||||
offset: ["start start", "60vh start"],
|
|
||||||
});
|
|
||||||
const parallax = useParallax(scrollYProgress, 50);
|
|
||||||
|
|
||||||
const handlePlayback = (
|
const handlePlayback = (
|
||||||
index: number,
|
index: number,
|
||||||
item: BaseItemDto,
|
item: BaseItemDto,
|
||||||
queue: BaseItemDto[],
|
queue: BaseItemDto[],
|
||||||
) => {
|
) => {
|
||||||
|
if (item.Id && user?.Id) {
|
||||||
const url = generateAudioStreamUrl(
|
const url = generateAudioStreamUrl(
|
||||||
item.Id,
|
item.Id,
|
||||||
user.data?.Id,
|
user?.Id,
|
||||||
api.deviceInfo.id,
|
api.deviceInfo.id,
|
||||||
api.basePath,
|
api.basePath,
|
||||||
|
api.accessToken,
|
||||||
);
|
);
|
||||||
playAudio(url, item, undefined, queue, index);
|
playAudio(url, item, undefined);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const currentPlayingItem = useAudioPlayback((s) => s.item);
|
const currentPlayingItem = useAudioPlayback((s) => s.item);
|
||||||
@@ -222,30 +188,118 @@ function MusicAlbumTitlePage() {
|
|||||||
{item.data.ProductionYear}
|
{item.data.ProductionYear}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography className="opacity-07">
|
<Typography className="opacity-07">
|
||||||
{musicTracks.data?.TotalRecordCount > 1
|
{(musicTracks.data?.TotalRecordCount ?? 0) > 1
|
||||||
? `${musicTracks.data?.TotalRecordCount} songs`
|
? `${musicTracks.data?.TotalRecordCount} songs`
|
||||||
: `1 song`}
|
: "1 song"}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography className="opacity-07">
|
<Typography className="opacity-07">
|
||||||
{getRuntimeCompact(item.data.CumulativeRunTimeTicks)}
|
{getRuntimeCompact(item.data.CumulativeRunTimeTicks ?? 0)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
<div className="item-info-buttons">
|
<div className="item-info-buttons">
|
||||||
<PlayButton
|
<PlayButton
|
||||||
item={item}
|
item={item.data}
|
||||||
audio
|
audio
|
||||||
itemType={item.data.Type}
|
itemType={item.data.Type ?? "Audio"}
|
||||||
userId={user.data?.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
<LikeButton
|
<LikeButton
|
||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
isFavorite={item.data.UserData?.IsFavorite}
|
isFavorite={item.data.UserData?.IsFavorite}
|
||||||
queryKey={["item", "musicTracks"]}
|
queryKey={["item", "musicTracks"]}
|
||||||
userId={user.data?.Id}
|
userId={user?.Id}
|
||||||
itemName={item.data.Name}
|
itemName={item.data.Name}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="item-info-track-container">
|
<div className="item-info-track-container ">
|
||||||
|
{allDiscs.length > 1 ? (
|
||||||
|
allDiscs.map((disc) => (
|
||||||
|
<>
|
||||||
|
<div
|
||||||
|
className="item-info-disc-header flex flex-row flex-align-center"
|
||||||
|
key={disc}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className="material-symbols-rounded"
|
||||||
|
style={{ fontSize: "2em" }}
|
||||||
|
>
|
||||||
|
album
|
||||||
|
</span>
|
||||||
|
<Typography variant="h5">Disc {disc}</Typography>
|
||||||
|
</div>
|
||||||
|
<div key={disc} 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 && (
|
||||||
|
<div
|
||||||
|
className={
|
||||||
|
currentPlayingItem?.Id === track.Id
|
||||||
|
? "item-info-track playing"
|
||||||
|
: "item-info-track"
|
||||||
|
}
|
||||||
|
key={track.Id}
|
||||||
|
onClick={() =>
|
||||||
|
musicTracks.data.Items &&
|
||||||
|
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 ?? 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>
|
||||||
|
),
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
<div className="item-info-track header">
|
<div className="item-info-track header">
|
||||||
<span className="material-symbols-rounded index">tag</span>
|
<span className="material-symbols-rounded index">tag</span>
|
||||||
<Typography variant="subtitle1">Title</Typography>
|
<Typography variant="subtitle1">Title</Typography>
|
||||||
@@ -260,6 +314,7 @@ function MusicAlbumTitlePage() {
|
|||||||
}
|
}
|
||||||
key={track.Id}
|
key={track.Id}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
|
musicTracks.data.Items &&
|
||||||
handlePlayback(index, track, musicTracks.data.Items)
|
handlePlayback(index, track, musicTracks.data.Items)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@@ -285,22 +340,28 @@ function MusicAlbumTitlePage() {
|
|||||||
}}
|
}}
|
||||||
fontWeight={300}
|
fontWeight={300}
|
||||||
>
|
>
|
||||||
{track.HasLyrics && <img src={lyricsIcon} alt="lyrics" />}
|
{track.HasLyrics && (
|
||||||
|
<img src={lyricsIcon} alt="lyrics" />
|
||||||
|
)}
|
||||||
{track.Artists?.join(", ")}
|
{track.Artists?.join(", ")}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
<Typography>{getRuntimeMusic(track.RunTimeTicks)}</Typography>
|
<Typography>
|
||||||
|
{getRuntimeMusic(track.RunTimeTicks ?? 0)}
|
||||||
|
</Typography>
|
||||||
<div className="flex flex-align-center">
|
<div className="flex flex-align-center">
|
||||||
<LikeButton
|
<LikeButton
|
||||||
itemId={track.Id}
|
itemId={track.Id}
|
||||||
isFavorite={track.UserData?.IsFavorite}
|
isFavorite={track.UserData?.IsFavorite}
|
||||||
queryKey={["item", "musicTracks"]}
|
queryKey={["item", "musicTracks"]}
|
||||||
userId={user.data?.Id}
|
userId={user?.Id}
|
||||||
itemName={track.Name}
|
itemName={track.Name}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="item-info-sidebar">
|
<div className="item-info-sidebar">
|
||||||
@@ -309,10 +370,17 @@ function MusicAlbumTitlePage() {
|
|||||||
<img
|
<img
|
||||||
className="item-info-sidebar-image"
|
className="item-info-sidebar-image"
|
||||||
alt={item.data.Name ?? "Album"}
|
alt={item.data.Name ?? "Album"}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
src={
|
||||||
|
item.data.Id &&
|
||||||
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
tag: item.data.ImageTags.Primary,
|
tag: item.data.ImageTags.Primary,
|
||||||
quality: 90,
|
quality: 90,
|
||||||
})}
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="item-info-sidebar-icon">
|
<div className="item-info-sidebar-icon">
|
||||||
@@ -325,14 +393,14 @@ function MusicAlbumTitlePage() {
|
|||||||
style={{ gap: "1em", flexWrap: "wrap" }}
|
style={{ gap: "1em", flexWrap: "wrap" }}
|
||||||
>
|
>
|
||||||
{item.data.GenreItems?.map((genre) => (
|
{item.data.GenreItems?.map((genre) => (
|
||||||
<TagChip label={genre.Name} key={genre.Id} />
|
<TagChip label={genre.Name ?? "genre"} key={genre.Id} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-column item-info-sidebar-artist-container">
|
<div className="flex flex-column item-info-sidebar-artist-container">
|
||||||
{item.data.ArtistItems?.map((artist) => (
|
{item.data.ArtistItems?.map((artist) => (
|
||||||
<Link
|
<Link
|
||||||
to="/artist/$id"
|
to="/artist/$id"
|
||||||
params={{ id: artist.Id }}
|
params={{ id: artist.Id ?? "" }}
|
||||||
className="item-info-sidebar-artist"
|
className="item-info-sidebar-artist"
|
||||||
key={artist.Id}
|
key={artist.Id}
|
||||||
>
|
>
|
||||||
@@ -340,9 +408,16 @@ function MusicAlbumTitlePage() {
|
|||||||
<img
|
<img
|
||||||
className="item-info-sidebar-artist-image"
|
className="item-info-sidebar-artist-image"
|
||||||
alt={artist.Name ?? "Artist"}
|
alt={artist.Name ?? "Artist"}
|
||||||
src={api.getItemImageUrl(artist.Id, "Primary", {
|
src={
|
||||||
|
artist.Id &&
|
||||||
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
artist.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 90,
|
quality: 90,
|
||||||
})}
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<span className="material-symbols-rounded">artist</span>
|
<span className="material-symbols-rounded">artist</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -352,13 +427,13 @@ function MusicAlbumTitlePage() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{similarItems.data.TotalRecordCount > 0 && (
|
{(similarItems.data?.TotalRecordCount ?? -1) > 0 && (
|
||||||
<CardScroller
|
<CardScroller
|
||||||
title="You might also like"
|
title="You might also like"
|
||||||
displayCards={7}
|
displayCards={7}
|
||||||
disableDecoration
|
disableDecoration
|
||||||
>
|
>
|
||||||
{similarItems.data.Items.map((similar) => {
|
{similarItems.data?.Items?.map((similar) => {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
key={similar.Id}
|
key={similar.Id}
|
||||||
@@ -390,13 +465,7 @@ function MusicAlbumTitlePage() {
|
|||||||
: "portrait"
|
: "portrait"
|
||||||
}
|
}
|
||||||
queryKey={["item", id, "similarItem"]}
|
queryKey={["item", id, "similarItem"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
|
||||||
!!similar.ImageBlurHashes?.Primary &&
|
|
||||||
similar.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(similar.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ $border-radius: 20px;
|
|||||||
.item-info {
|
.item-info {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
gap: 1.2em;
|
||||||
&-container {
|
&-container {
|
||||||
grid-template-columns: 1fr 25%;
|
grid-template-columns: 1fr 25%;
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 3em;
|
gap: 3em;
|
||||||
}
|
}
|
||||||
gap: 1.2em;
|
|
||||||
&-sidebar {
|
&-sidebar {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -133,6 +133,13 @@ $border-radius: 20px;
|
|||||||
display: flex;
|
display: flex;
|
||||||
gap: 1em;
|
gap: 1em;
|
||||||
}
|
}
|
||||||
|
&-disc-header{
|
||||||
|
padding: 1em 2em;
|
||||||
|
background: hsla(0, 0, 100%, 10%);
|
||||||
|
border-radius: 100px;
|
||||||
|
gap: 1em;
|
||||||
|
margin-top: 1em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.item-detail-album {
|
.item-detail-album {
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ import "./artist.scss";
|
|||||||
|
|
||||||
import IconLink from "@/components/iconLink";
|
import IconLink from "@/components/iconLink";
|
||||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import { createFileRoute } from "@tanstack/react-router";
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
|
|
||||||
function TabPanel(props) {
|
function TabPanel(props) {
|
||||||
@@ -69,26 +71,19 @@ function ArtistTitlePage() {
|
|||||||
const { id } = Route.useParams();
|
const { id } = Route.useParams();
|
||||||
const api = Route.useRouteContext().api;
|
const api = Route.useRouteContext().api;
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
});
|
|
||||||
|
|
||||||
const item = useQuery({
|
const item = useQuery({
|
||||||
queryKey: ["item", id],
|
queryKey: ["item", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: id,
|
itemId: id,
|
||||||
fields: [ItemFields.Crew],
|
fields: [ItemFields.Crew],
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
});
|
});
|
||||||
@@ -102,7 +97,7 @@ function ArtistTitlePage() {
|
|||||||
sortOrder: [SortOrder.Descending],
|
sortOrder: [SortOrder.Descending],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
includeItemTypes: [BaseItemKind.MusicAlbum],
|
includeItemTypes: [BaseItemKind.MusicAlbum],
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
fields: [ItemFields.Overview],
|
fields: [ItemFields.Overview],
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
@@ -119,7 +114,7 @@ function ArtistTitlePage() {
|
|||||||
sortOrder: [SortOrder.Ascending],
|
sortOrder: [SortOrder.Ascending],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
includeItemTypes: [BaseItemKind.Audio],
|
includeItemTypes: [BaseItemKind.Audio],
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
fields: [ItemFields.Overview],
|
fields: [ItemFields.Overview],
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
@@ -137,7 +132,7 @@ function ArtistTitlePage() {
|
|||||||
sortOrder: [SortOrder.Descending],
|
sortOrder: [SortOrder.Descending],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
includeItemTypes: [BaseItemKind.MusicAlbum],
|
includeItemTypes: [BaseItemKind.MusicAlbum],
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
@@ -225,9 +220,13 @@ function ArtistTitlePage() {
|
|||||||
<div className="item-hero-backdrop-container">
|
<div className="item-hero-backdrop-container">
|
||||||
<motion.img
|
<motion.img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data.Id,
|
||||||
|
"Backdrop",
|
||||||
|
{
|
||||||
tag: item.data.BackdropImageTags[0],
|
tag: item.data.BackdropImageTags[0],
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
className="item-hero-backdrop"
|
className="item-hero-backdrop"
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = 1;
|
||||||
@@ -255,10 +254,14 @@ function ArtistTitlePage() {
|
|||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 90,
|
quality: 90,
|
||||||
tag: item.data.ImageTags.Primary,
|
tag: item.data.ImageTags.Primary,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = 1;
|
||||||
}}
|
}}
|
||||||
@@ -275,11 +278,15 @@ function ArtistTitlePage() {
|
|||||||
{Object.keys(item.data.ImageTags).includes("Logo") ? (
|
{Object.keys(item.data.ImageTags).includes("Logo") ? (
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Logo", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data.Id,
|
||||||
|
"Logo",
|
||||||
|
{
|
||||||
quality: 90,
|
quality: 90,
|
||||||
fillWidth: 592,
|
fillWidth: 592,
|
||||||
fillHeight: 592,
|
fillHeight: 592,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = 1;
|
||||||
}}
|
}}
|
||||||
@@ -295,8 +302,8 @@ function ArtistTitlePage() {
|
|||||||
itemName={item.data.Name}
|
itemName={item.data.Name}
|
||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isFavorite={item.data.UserData.IsFavorite}
|
isFavorite={item.data.UserData?.IsFavorite}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -314,7 +321,7 @@ function ArtistTitlePage() {
|
|||||||
marginTop: "1em",
|
marginTop: "1em",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{item.data.ExternalUrls.map((url) => (
|
{item.data.ExternalUrls?.map((url) => (
|
||||||
<IconLink url={url.Url} name={url.Name} />
|
<IconLink url={url.Url} name={url.Name} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -358,7 +365,7 @@ function ArtistTitlePage() {
|
|||||||
setActiveArtistTab(newVal);
|
setActiveArtistTab(newVal);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{artistTabs.map((tab, index) => {
|
{artistTabs.map((tab) => {
|
||||||
return (
|
return (
|
||||||
<Tab
|
<Tab
|
||||||
key={tab.title}
|
key={tab.title}
|
||||||
@@ -391,11 +398,11 @@ function ArtistTitlePage() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{artistDiscography.isSuccess &&
|
{artistDiscography.isSuccess &&
|
||||||
artistDiscography.data.Items.map((tabitem) => {
|
artistDiscography.data.Items?.map((tabitem) => {
|
||||||
return (
|
return (
|
||||||
<ArtistAlbum
|
<ArtistAlbum
|
||||||
key={tabitem.Id}
|
key={tabitem.Id}
|
||||||
user={user.data}
|
user={user}
|
||||||
album={tabitem}
|
album={tabitem}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@@ -422,13 +429,13 @@ function ArtistTitlePage() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{artistSongs.isSuccess &&
|
{artistSongs.isSuccess &&
|
||||||
artistSongs.data.Items.map((tabitem) => {
|
artistSongs.data.Items?.map((tabitem) => {
|
||||||
return (
|
return (
|
||||||
<MusicTrack
|
<MusicTrack
|
||||||
item={tabitem}
|
item={tabitem}
|
||||||
key={tabitem.Id}
|
key={tabitem.Id}
|
||||||
queryKey={["item", id, "artist", "songs"]}
|
queryKey={["item", id, "artist", "songs"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@@ -455,7 +462,7 @@ function ArtistTitlePage() {
|
|||||||
className="grid"
|
className="grid"
|
||||||
>
|
>
|
||||||
{artistAppearances.isSuccess &&
|
{artistAppearances.isSuccess &&
|
||||||
artistAppearances.data.Items.map((tabitem) => {
|
artistAppearances.data.Items?.map((tabitem) => {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
key={tabitem.Id}
|
key={tabitem.Id}
|
||||||
@@ -465,13 +472,7 @@ function ArtistTitlePage() {
|
|||||||
cardCaption={tabitem.AlbumArtist}
|
cardCaption={tabitem.AlbumArtist}
|
||||||
cardType={"square"}
|
cardType={"square"}
|
||||||
queryKey={["item", id, "artist", "appearences"]}
|
queryKey={["item", id, "artist", "appearences"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
|
||||||
!!tabitem.ImageBlurHashes?.Primary &&
|
|
||||||
tabitem.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(tabitem.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ import "./boxset.scss";
|
|||||||
|
|
||||||
import IconLink from "@/components/iconLink";
|
import IconLink from "@/components/iconLink";
|
||||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import { createFileRoute } from "@tanstack/react-router";
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
|
|
||||||
function TabPanel(props) {
|
function TabPanel(props) {
|
||||||
@@ -72,27 +74,18 @@ function BoxSetTitlePage() {
|
|||||||
const { id } = Route.useParams();
|
const { id } = Route.useParams();
|
||||||
const api = Route.useRouteContext().api;
|
const api = Route.useRouteContext().api;
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
enabled: Boolean(api),
|
|
||||||
});
|
|
||||||
|
|
||||||
const item = useQuery({
|
const item = useQuery({
|
||||||
queryKey: ["item", id],
|
queryKey: ["item", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: id,
|
itemId: id,
|
||||||
fields: [ItemFields.Crew],
|
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
});
|
});
|
||||||
@@ -101,7 +94,7 @@ function BoxSetTitlePage() {
|
|||||||
queryKey: ["item", id, "collection"],
|
queryKey: ["item", id, "collection"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
parentId: item.data.Id,
|
parentId: item.data.Id,
|
||||||
fields: [ItemFields.SeasonUserData, ItemFields.Overview],
|
fields: [ItemFields.SeasonUserData, ItemFields.Overview],
|
||||||
excludeLocationTypes: [LocationType.Virtual],
|
excludeLocationTypes: [LocationType.Virtual],
|
||||||
@@ -117,8 +110,8 @@ function BoxSetTitlePage() {
|
|||||||
queryKey: ["item", id, "similarItem"],
|
queryKey: ["item", id, "similarItem"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getLibraryApi(api).getSimilarItems({
|
const result = await getLibraryApi(api).getSimilarItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: item.data.Id,
|
itemId: item.data?.Id,
|
||||||
limit: 16,
|
limit: 16,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
@@ -187,9 +180,13 @@ function BoxSetTitlePage() {
|
|||||||
{item.data.BackdropImageTags?.length ? (
|
{item.data.BackdropImageTags?.length ? (
|
||||||
<motion.img
|
<motion.img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data.Id,
|
||||||
|
"Backdrop",
|
||||||
|
{
|
||||||
tag: item.data.BackdropImageTags[0],
|
tag: item.data.BackdropImageTags[0],
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
className="item-hero-backdrop"
|
className="item-hero-backdrop"
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = 1;
|
||||||
@@ -230,10 +227,14 @@ function BoxSetTitlePage() {
|
|||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 90,
|
quality: 90,
|
||||||
tag: item.data.ImageTags.Primary,
|
tag: item.data.ImageTags.Primary,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = 1;
|
||||||
}}
|
}}
|
||||||
@@ -250,11 +251,15 @@ function BoxSetTitlePage() {
|
|||||||
{Object.keys(item.data.ImageTags).includes("Logo") ? (
|
{Object.keys(item.data.ImageTags).includes("Logo") ? (
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Logo", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data.Id,
|
||||||
|
"Logo",
|
||||||
|
{
|
||||||
quality: 90,
|
quality: 90,
|
||||||
fillWidth: 592,
|
fillWidth: 592,
|
||||||
fillHeight: 592,
|
fillHeight: 592,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = 1;
|
||||||
}}
|
}}
|
||||||
@@ -370,7 +375,7 @@ function BoxSetTitlePage() {
|
|||||||
currentVideoTrack={0}
|
currentVideoTrack={0}
|
||||||
currentAudioTrack={0}
|
currentAudioTrack={0}
|
||||||
currentSubTrack={0}
|
currentSubTrack={0}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
buttonProps={{
|
buttonProps={{
|
||||||
fullWidth: true,
|
fullWidth: true,
|
||||||
}}
|
}}
|
||||||
@@ -382,14 +387,14 @@ function BoxSetTitlePage() {
|
|||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isFavorite={item.data.UserData.IsFavorite}
|
isFavorite={item.data.UserData.IsFavorite}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
<MarkPlayedButton
|
<MarkPlayedButton
|
||||||
itemName={item.data.Name}
|
itemName={item.data.Name}
|
||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isPlayed={item.data.UserData.Played}
|
isPlayed={item.data.UserData.Played}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -437,7 +442,7 @@ function BoxSetTitlePage() {
|
|||||||
cardCaption={similar.ProductionYear}
|
cardCaption={similar.ProductionYear}
|
||||||
cardType={"portrait"}
|
cardType={"portrait"}
|
||||||
queryKey={["item", id, "collection"]}
|
queryKey={["item", id, "collection"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!similar.ImageBlurHashes?.Primary &&
|
!!similar.ImageBlurHashes?.Primary &&
|
||||||
similar.ImageBlurHashes?.Primary[
|
similar.ImageBlurHashes?.Primary[
|
||||||
@@ -487,7 +492,7 @@ function BoxSetTitlePage() {
|
|||||||
: "portrait"
|
: "portrait"
|
||||||
}
|
}
|
||||||
queryKey={["item", id, "similarItem"]}
|
queryKey={["item", id, "similarItem"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!similar.ImageBlurHashes?.Primary &&
|
!!similar.ImageBlurHashes?.Primary &&
|
||||||
similar.ImageBlurHashes?.Primary[
|
similar.ImageBlurHashes?.Primary[
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ import sdrIcon from "@/assets/icons/sdr.svg";
|
|||||||
import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
|
import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
|
||||||
|
|
||||||
import IconLink from "@/components/iconLink";
|
import IconLink from "@/components/iconLink";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import { Link, createFileRoute } from "@tanstack/react-router";
|
import { Link, createFileRoute } from "@tanstack/react-router";
|
||||||
|
|
||||||
function TabPanel(props) {
|
function TabPanel(props) {
|
||||||
@@ -97,27 +99,19 @@ function EpisodeTitlePage() {
|
|||||||
const { id } = Route.useParams();
|
const { id } = Route.useParams();
|
||||||
const api = Route.useRouteContext().api;
|
const api = Route.useRouteContext().api;
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
enabled: Boolean(api),
|
|
||||||
});
|
|
||||||
|
|
||||||
const item = useQuery({
|
const item = useQuery({
|
||||||
queryKey: ["item", id],
|
queryKey: ["item", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: id,
|
itemId: id,
|
||||||
fields: [ItemFields.Crew],
|
fields: [ItemFields.Crew],
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
});
|
});
|
||||||
@@ -126,9 +120,9 @@ function EpisodeTitlePage() {
|
|||||||
queryKey: ["item", id, "episode", "upcomingEpisodes"],
|
queryKey: ["item", id, "episode", "upcomingEpisodes"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
parentId: item.data.ParentId,
|
parentId: item.data?.ParentId ?? "",
|
||||||
startIndex: item.data.IndexNumber,
|
startIndex: item.data?.IndexNumber ?? 0,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
@@ -357,7 +351,7 @@ function EpisodeTitlePage() {
|
|||||||
{item.data.ParentBackdropImageTags?.length ? (
|
{item.data.ParentBackdropImageTags?.length ? (
|
||||||
<motion.img
|
<motion.img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name}
|
||||||
src={api.getItemImageUrl(
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
item.data.ParentBackdropItemId,
|
item.data.ParentBackdropItemId,
|
||||||
"Backdrop",
|
"Backdrop",
|
||||||
{
|
{
|
||||||
@@ -404,10 +398,14 @@ function EpisodeTitlePage() {
|
|||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 90,
|
quality: 90,
|
||||||
tag: item.data.ImageTags.Primary,
|
tag: item.data.ImageTags.Primary,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = 1;
|
||||||
}}
|
}}
|
||||||
@@ -435,11 +433,15 @@ function EpisodeTitlePage() {
|
|||||||
{item.data.ParentLogoItemId?.length > 0 ? (
|
{item.data.ParentLogoItemId?.length > 0 ? (
|
||||||
<img
|
<img
|
||||||
alt={item.data.SeriesName}
|
alt={item.data.SeriesName}
|
||||||
src={api.getItemImageUrl(item.data.ParentLogoItemId, "Logo", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data.ParentLogoItemId,
|
||||||
|
"Logo",
|
||||||
|
{
|
||||||
quality: 90,
|
quality: 90,
|
||||||
fillWidth: 592,
|
fillWidth: 592,
|
||||||
fillHeight: 592,
|
fillHeight: 592,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = 1;
|
||||||
}}
|
}}
|
||||||
@@ -688,7 +690,7 @@ function EpisodeTitlePage() {
|
|||||||
currentVideoTrack={selectedVideoTrack}
|
currentVideoTrack={selectedVideoTrack}
|
||||||
currentAudioTrack={selectedAudioTrack}
|
currentAudioTrack={selectedAudioTrack}
|
||||||
currentSubTrack={selectedSubtitleTrack}
|
currentSubTrack={selectedSubtitleTrack}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-row" style={{ gap: "1em" }}>
|
<div className="flex flex-row" style={{ gap: "1em" }}>
|
||||||
@@ -701,14 +703,14 @@ function EpisodeTitlePage() {
|
|||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isFavorite={item.data.UserData.IsFavorite}
|
isFavorite={item.data.UserData.IsFavorite}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
<MarkPlayedButton
|
<MarkPlayedButton
|
||||||
itemName={item.data.Name}
|
itemName={item.data.Name}
|
||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isPlayed={item.data.UserData.Played}
|
isPlayed={item.data.UserData.Played}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -812,7 +814,7 @@ function EpisodeTitlePage() {
|
|||||||
cardCaption={`S${episode.ParentIndexNumber}:E${episode.IndexNumber} - ${episode.Name}`}
|
cardCaption={`S${episode.ParentIndexNumber}:E${episode.IndexNumber} - ${episode.Name}`}
|
||||||
cardType="thumb"
|
cardType="thumb"
|
||||||
queryKey={["item", id, "episode", "upcomingEpisodes"]}
|
queryKey={["item", id, "episode", "upcomingEpisodes"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!episode.ImageBlurHashes?.Primary &&
|
!!episode.ImageBlurHashes?.Primary &&
|
||||||
episode.ImageBlurHashes?.Primary[
|
episode.ImageBlurHashes?.Primary[
|
||||||
@@ -845,11 +847,15 @@ function EpisodeTitlePage() {
|
|||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name}
|
||||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
actor.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 80,
|
quality: 80,
|
||||||
fillWidth: 200,
|
fillWidth: 200,
|
||||||
fillHeight: 200,
|
fillHeight: 200,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -891,11 +897,15 @@ function EpisodeTitlePage() {
|
|||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name}
|
||||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
actor.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 80,
|
quality: 80,
|
||||||
fillWidth: 200,
|
fillWidth: 200,
|
||||||
fillHeight: 200,
|
fillHeight: 200,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -937,11 +947,15 @@ function EpisodeTitlePage() {
|
|||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name}
|
||||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
actor.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 80,
|
quality: 80,
|
||||||
fillWidth: 200,
|
fillWidth: 200,
|
||||||
fillHeight: 200,
|
fillHeight: 200,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -983,11 +997,15 @@ function EpisodeTitlePage() {
|
|||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name}
|
||||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
actor.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 80,
|
quality: 80,
|
||||||
fillWidth: 200,
|
fillWidth: 200,
|
||||||
fillHeight: 200,
|
fillHeight: 200,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
|||||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
import { createFileRoute } from "@tanstack/react-router";
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/favorite/")({
|
export const Route = createFileRoute("/_api/favorite/")({
|
||||||
component: FavoritePage,
|
component: FavoritePage,
|
||||||
@@ -21,21 +22,13 @@ function FavoritePage() {
|
|||||||
const api = Route.useRouteContext().api;
|
const api = Route.useRouteContext().api;
|
||||||
const [setBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
const [setBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
enabled: Boolean(api),
|
|
||||||
});
|
|
||||||
|
|
||||||
const movies = useQuery({
|
const movies = useQuery({
|
||||||
queryKey: ["favorite", "movies"],
|
queryKey: ["favorite", "movies"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
isFavorite: true,
|
isFavorite: true,
|
||||||
includeItemTypes: [BaseItemKind.Movie],
|
includeItemTypes: [BaseItemKind.Movie],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -48,7 +41,7 @@ function FavoritePage() {
|
|||||||
queryKey: ["favorite", "series"],
|
queryKey: ["favorite", "series"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
isFavorite: true,
|
isFavorite: true,
|
||||||
includeItemTypes: [BaseItemKind.Series],
|
includeItemTypes: [BaseItemKind.Series],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -61,7 +54,7 @@ function FavoritePage() {
|
|||||||
queryKey: ["favorite", "musicAlbum"],
|
queryKey: ["favorite", "musicAlbum"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
isFavorite: true,
|
isFavorite: true,
|
||||||
includeItemTypes: [BaseItemKind.MusicAlbum],
|
includeItemTypes: [BaseItemKind.MusicAlbum],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -74,7 +67,7 @@ function FavoritePage() {
|
|||||||
queryKey: ["favorite", "audio"],
|
queryKey: ["favorite", "audio"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
isFavorite: true,
|
isFavorite: true,
|
||||||
includeItemTypes: [BaseItemKind.Audio],
|
includeItemTypes: [BaseItemKind.Audio],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -87,7 +80,7 @@ function FavoritePage() {
|
|||||||
queryKey: ["favorite", "book"],
|
queryKey: ["favorite", "book"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
isFavorite: true,
|
isFavorite: true,
|
||||||
includeItemTypes: [BaseItemKind.Book],
|
includeItemTypes: [BaseItemKind.Book],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -100,7 +93,7 @@ function FavoritePage() {
|
|||||||
queryKey: ["favorite", "musicArtist"],
|
queryKey: ["favorite", "musicArtist"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
isFavorite: true,
|
isFavorite: true,
|
||||||
includeItemTypes: [BaseItemKind.MusicArtist],
|
includeItemTypes: [BaseItemKind.MusicArtist],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -113,7 +106,7 @@ function FavoritePage() {
|
|||||||
queryKey: ["favorite", "person"],
|
queryKey: ["favorite", "person"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
isFavorite: true,
|
isFavorite: true,
|
||||||
includeItemTypes: [BaseItemKind.Person],
|
includeItemTypes: [BaseItemKind.Person],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -148,7 +141,7 @@ function FavoritePage() {
|
|||||||
cardCaption={item.ProductionYear}
|
cardCaption={item.ProductionYear}
|
||||||
cardType="portrait"
|
cardType="portrait"
|
||||||
queryKey={["favorite", "movies"]}
|
queryKey={["favorite", "movies"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
!!item.ImageBlurHashes?.Primary &&
|
||||||
item.ImageBlurHashes?.Primary[
|
item.ImageBlurHashes?.Primary[
|
||||||
@@ -176,7 +169,7 @@ function FavoritePage() {
|
|||||||
}`}
|
}`}
|
||||||
cardType="portrait"
|
cardType="portrait"
|
||||||
queryKey={["favorite", "series"]}
|
queryKey={["favorite", "series"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
!!item.ImageBlurHashes?.Primary &&
|
||||||
item.ImageBlurHashes?.Primary[
|
item.ImageBlurHashes?.Primary[
|
||||||
@@ -198,7 +191,7 @@ function FavoritePage() {
|
|||||||
cardCaption={item.ProductionYear}
|
cardCaption={item.ProductionYear}
|
||||||
cardType="square"
|
cardType="square"
|
||||||
queryKey={["favorite", "audio"]}
|
queryKey={["favorite", "audio"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
!!item.ImageBlurHashes?.Primary &&
|
||||||
item.ImageBlurHashes?.Primary[
|
item.ImageBlurHashes?.Primary[
|
||||||
@@ -221,7 +214,7 @@ function FavoritePage() {
|
|||||||
cardCaption={item.AlbumArtist}
|
cardCaption={item.AlbumArtist}
|
||||||
cardType={"square"}
|
cardType={"square"}
|
||||||
queryKey={["favorite", "musicAlbum"]}
|
queryKey={["favorite", "musicAlbum"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
!!item.ImageBlurHashes?.Primary &&
|
||||||
item.ImageBlurHashes?.Primary[
|
item.ImageBlurHashes?.Primary[
|
||||||
@@ -244,7 +237,7 @@ function FavoritePage() {
|
|||||||
disableOverlay
|
disableOverlay
|
||||||
cardType={"portrait"}
|
cardType={"portrait"}
|
||||||
queryKey={["favorite", "book"]}
|
queryKey={["favorite", "book"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
!!item.ImageBlurHashes?.Primary &&
|
||||||
item.ImageBlurHashes?.Primary[
|
item.ImageBlurHashes?.Primary[
|
||||||
@@ -266,7 +259,7 @@ function FavoritePage() {
|
|||||||
disableOverlay
|
disableOverlay
|
||||||
cardType={"square"}
|
cardType={"square"}
|
||||||
queryKey={["favorite", "musicArtist"]}
|
queryKey={["favorite", "musicArtist"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
!!item.ImageBlurHashes?.Primary &&
|
||||||
item.ImageBlurHashes?.Primary[
|
item.ImageBlurHashes?.Primary[
|
||||||
@@ -288,7 +281,7 @@ function FavoritePage() {
|
|||||||
disableOverlay
|
disableOverlay
|
||||||
cardType={"square"}
|
cardType={"square"}
|
||||||
queryKey={["favorite", "person"]}
|
queryKey={["favorite", "person"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
!!item.ImageBlurHashes?.Primary &&
|
||||||
item.ImageBlurHashes?.Primary[
|
item.ImageBlurHashes?.Primary[
|
||||||
|
|||||||
@@ -15,17 +15,17 @@ import { CarouselSkeleton } from "@/components/skeleton/carousel";
|
|||||||
|
|
||||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||||
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
|
||||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||||
|
|
||||||
import { Outlet, createFileRoute, useNavigate } from "@tanstack/react-router";
|
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||||
|
|
||||||
import { setBackdrop } from "@/utils/store/backdrop";
|
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||||
|
|
||||||
import CarouselSlide from "@/components/carouselSlide";
|
|
||||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import {
|
import {
|
||||||
type BaseItemDto,
|
type BaseItemDto,
|
||||||
BaseItemKind,
|
BaseItemKind,
|
||||||
@@ -36,33 +36,21 @@ import { ErrorBoundary } from "react-error-boundary";
|
|||||||
|
|
||||||
export const Route = createFileRoute("/_api/home/")({
|
export const Route = createFileRoute("/_api/home/")({
|
||||||
component: Home,
|
component: Home,
|
||||||
onError: (err) => {
|
|
||||||
console.log(err);
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function Home() {
|
function Home() {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
console.log(usr.data);
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
enabled: Boolean(api),
|
|
||||||
});
|
|
||||||
|
|
||||||
const libraries = useQuery({
|
const libraries = useQuery({
|
||||||
queryKey: ["libraries"],
|
queryKey: ["libraries"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const libs = await getUserViewsApi(api).getUserViews({
|
const libs = await getUserViewsApi(api).getUserViews({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
});
|
});
|
||||||
return libs.data;
|
return libs.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data && !!api.accessToken,
|
enabled: !!user?.Id && !!api.accessToken,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -70,7 +58,7 @@ function Home() {
|
|||||||
queryKey: ["home", "latestMedia"],
|
queryKey: ["home", "latestMedia"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const media = await getUserLibraryApi(api).getLatestMedia({
|
const media = await getUserLibraryApi(api).getLatestMedia({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
fields: [
|
fields: [
|
||||||
ItemFields.Overview,
|
ItemFields.Overview,
|
||||||
ItemFields.ParentId,
|
ItemFields.ParentId,
|
||||||
@@ -79,19 +67,24 @@ function Home() {
|
|||||||
ItemFields.MediaStreams,
|
ItemFields.MediaStreams,
|
||||||
ItemFields.MediaSources,
|
ItemFields.MediaSources,
|
||||||
],
|
],
|
||||||
|
includeItemTypes: [
|
||||||
|
BaseItemKind.Movie,
|
||||||
|
BaseItemKind.Series,
|
||||||
|
BaseItemKind.MusicAlbum,
|
||||||
|
],
|
||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
enableImages: true,
|
enableImages: true,
|
||||||
});
|
});
|
||||||
return media.data;
|
return media.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
});
|
});
|
||||||
|
|
||||||
const resumeItemsVideo = useQuery({
|
const resumeItemsVideo = useQuery({
|
||||||
queryKey: ["home", "resume", "video"],
|
queryKey: ["home", "resume", "video"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const resumeItems = await getItemsApi(api).getResumeItems({
|
const resumeItems = await getItemsApi(api).getResumeItems({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
mediaTypes: ["Video"],
|
mediaTypes: ["Video"],
|
||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
@@ -99,7 +92,7 @@ function Home() {
|
|||||||
});
|
});
|
||||||
return resumeItems.data;
|
return resumeItems.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
refetchOnMount: true,
|
refetchOnMount: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -107,7 +100,7 @@ function Home() {
|
|||||||
queryKey: ["home", "resume", "audio"],
|
queryKey: ["home", "resume", "audio"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const resumeItems = await getItemsApi(api).getResumeItems({
|
const resumeItems = await getItemsApi(api).getResumeItems({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
mediaTypes: ["Audio"],
|
mediaTypes: ["Audio"],
|
||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
@@ -115,14 +108,14 @@ function Home() {
|
|||||||
});
|
});
|
||||||
return resumeItems.data;
|
return resumeItems.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
});
|
});
|
||||||
|
|
||||||
const upNextItems = useQuery({
|
const upNextItems = useQuery({
|
||||||
queryKey: ["home", "upNext"],
|
queryKey: ["home", "upNext"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const upNext = await getTvShowsApi(api).getNextUp({
|
const upNext = await getTvShowsApi(api).getNextUp({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
fields: [
|
fields: [
|
||||||
ItemFields.PrimaryImageAspectRatio,
|
ItemFields.PrimaryImageAspectRatio,
|
||||||
ItemFields.MediaStreams,
|
ItemFields.MediaStreams,
|
||||||
@@ -133,7 +126,7 @@ function Home() {
|
|||||||
});
|
});
|
||||||
return upNext.data;
|
return upNext.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
refetchOnMount: true,
|
refetchOnMount: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -143,6 +136,8 @@ function Home() {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||||
|
|
||||||
const [excludeTypes] = useState(
|
const [excludeTypes] = useState(
|
||||||
() => new Set(["boxsets", "playlists", "livetv", "channels"]),
|
() => new Set(["boxsets", "playlists", "livetv", "channels"]),
|
||||||
);
|
);
|
||||||
@@ -151,7 +146,7 @@ function Home() {
|
|||||||
if (libraries.isSuccess) {
|
if (libraries.isSuccess) {
|
||||||
const latestMediaLibsTemp = libraries.data.Items?.reduce(
|
const latestMediaLibsTemp = libraries.data.Items?.reduce(
|
||||||
(filteredItems: BaseItemDto[], currentItem) => {
|
(filteredItems: BaseItemDto[], currentItem) => {
|
||||||
if (!excludeTypes.has(currentItem.Type)) {
|
if (currentItem.Type && !excludeTypes.has(currentItem.Type)) {
|
||||||
filteredItems.push(currentItem);
|
filteredItems.push(currentItem);
|
||||||
}
|
}
|
||||||
return filteredItems;
|
return filteredItems;
|
||||||
@@ -182,7 +177,7 @@ function Home() {
|
|||||||
if (latestMedia.isSuccess && latestMedia.data.length > 0) {
|
if (latestMedia.isSuccess && latestMedia.data.length > 0) {
|
||||||
if (latestMedia.data[now]?.ParentBackdropImageTags) {
|
if (latestMedia.data[now]?.ParentBackdropImageTags) {
|
||||||
setBackdrop(
|
setBackdrop(
|
||||||
api.getItemImageUrl(
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
latestMedia.data[now].Id,
|
latestMedia.data[now].Id,
|
||||||
"Backdrop",
|
"Backdrop",
|
||||||
{
|
{
|
||||||
@@ -195,7 +190,7 @@ function Home() {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
setBackdrop(
|
setBackdrop(
|
||||||
api.getItemImageUrl(
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
latestMedia.data[now].Id,
|
latestMedia.data[now].Id,
|
||||||
"Backdrop",
|
"Backdrop",
|
||||||
{
|
{
|
||||||
@@ -234,12 +229,14 @@ function Home() {
|
|||||||
imageType="Primary"
|
imageType="Primary"
|
||||||
cardType="thumb"
|
cardType="thumb"
|
||||||
disableOverlay
|
disableOverlay
|
||||||
onClick={() =>
|
onClick={() => {
|
||||||
|
if (item.Id) {
|
||||||
navigate({
|
navigate({
|
||||||
to: "/library/$id",
|
to: "/library/$id",
|
||||||
params: { id: item.Id ?? "" },
|
params: { id: item.Id },
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
}}
|
||||||
overrideIcon={item.CollectionType}
|
overrideIcon={item.CollectionType}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@@ -296,7 +293,7 @@ function Home() {
|
|||||||
}
|
}
|
||||||
cardType="thumb"
|
cardType="thumb"
|
||||||
queryKey={["home", "upNext"]}
|
queryKey={["home", "upNext"]}
|
||||||
userId={user.data?.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@@ -349,7 +346,7 @@ function Home() {
|
|||||||
}
|
}
|
||||||
cardType="thumb"
|
cardType="thumb"
|
||||||
queryKey={["home", "resume", "video"]}
|
queryKey={["home", "resume", "video"]}
|
||||||
userId={user.data?.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@@ -380,7 +377,7 @@ function Home() {
|
|||||||
cardCaption={item.ProductionYear}
|
cardCaption={item.ProductionYear}
|
||||||
cardType="thumb"
|
cardType="thumb"
|
||||||
queryKey={["home", "resume", "audio"]}
|
queryKey={["home", "resume", "audio"]}
|
||||||
userId={user.data?.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import TrailerButton from "@/components/buttons/trailerButton";
|
|||||||
import ShowMoreText from "@/components/showMoreText";
|
import ShowMoreText from "@/components/showMoreText";
|
||||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||||
import { endsAt, getRuntime } from "@/utils/date/time";
|
import { endsAt, getRuntime } from "@/utils/date/time";
|
||||||
import { setBackdrop, useBackdropStore } from "@/utils/store/backdrop";
|
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||||
|
|
||||||
import ItemSkeleton from "@/components/skeleton/item";
|
import ItemSkeleton from "@/components/skeleton/item";
|
||||||
|
|
||||||
@@ -68,6 +68,8 @@ import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
|
|||||||
|
|
||||||
import IconLink from "@/components/iconLink";
|
import IconLink from "@/components/iconLink";
|
||||||
import { queryClient } from "@/main";
|
import { queryClient } from "@/main";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import { Link, createFileRoute } from "@tanstack/react-router";
|
import { Link, createFileRoute } from "@tanstack/react-router";
|
||||||
|
|
||||||
function TabPanel(props) {
|
function TabPanel(props) {
|
||||||
@@ -102,26 +104,18 @@ function ItemDetail() {
|
|||||||
|
|
||||||
const api = Route.useRouteContext().api;
|
const api = Route.useRouteContext().api;
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
enabled: Boolean(api),
|
|
||||||
});
|
|
||||||
|
|
||||||
const item = useQuery({
|
const item = useQuery({
|
||||||
queryKey: ["item", id],
|
queryKey: ["item", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
itemId: id,
|
itemId: id,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
});
|
});
|
||||||
@@ -134,28 +128,28 @@ function ItemDetail() {
|
|||||||
let result;
|
let result;
|
||||||
if (item.data.Type === "Movie") {
|
if (item.data.Type === "Movie") {
|
||||||
result = await getLibraryApi(api).getSimilarMovies({
|
result = await getLibraryApi(api).getSimilarMovies({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: item.data.Id,
|
itemId: item.data.Id,
|
||||||
limit: 16,
|
limit: 16,
|
||||||
});
|
});
|
||||||
} else if (item.data.Type === "Series") {
|
} else if (item.data.Type === "Series") {
|
||||||
result = await getLibraryApi(api).getSimilarShows({
|
result = await getLibraryApi(api).getSimilarShows({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: item.data.Id,
|
itemId: item.data.Id,
|
||||||
});
|
});
|
||||||
} else if (item.data.Type === "MusicAlbum") {
|
} else if (item.data.Type === "MusicAlbum") {
|
||||||
result = await getLibraryApi(api).getSimilarAlbums({
|
result = await getLibraryApi(api).getSimilarAlbums({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: item.data.Id,
|
itemId: item.data.Id,
|
||||||
});
|
});
|
||||||
} else if (item.data.Type === "MusicArtist") {
|
} else if (item.data.Type === "MusicArtist") {
|
||||||
result = await getLibraryApi(api).getSimilarArtists({
|
result = await getLibraryApi(api).getSimilarArtists({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: item.data.Id,
|
itemId: item.data.Id,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
result = await getLibraryApi(api).getSimilarItems({
|
result = await getLibraryApi(api).getSimilarItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: item.data.Id,
|
itemId: item.data.Id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -193,8 +187,6 @@ function ItemDetail() {
|
|||||||
const [selectedAudioTrack, setSelectedAudioTrack] = useState(null);
|
const [selectedAudioTrack, setSelectedAudioTrack] = useState(null);
|
||||||
const [selectedSubtitleTrack, setSelectedSubtitleTrack] = useState(null);
|
const [selectedSubtitleTrack, setSelectedSubtitleTrack] = useState(null);
|
||||||
|
|
||||||
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
|
||||||
|
|
||||||
const [directors, setDirectors] = useState([]);
|
const [directors, setDirectors] = useState([]);
|
||||||
const [writers, setWriters] = useState([]);
|
const [writers, setWriters] = useState([]);
|
||||||
const [actors, setActors] = useState([]);
|
const [actors, setActors] = useState([]);
|
||||||
@@ -202,11 +194,13 @@ function ItemDetail() {
|
|||||||
|
|
||||||
const [mediaQualityInfo, setMediaQualityInfo] = useState<MediaQualityInfo>();
|
const [mediaQualityInfo, setMediaQualityInfo] = useState<MediaQualityInfo>();
|
||||||
|
|
||||||
|
const setBackdrop = useBackdropStore((state) => state.setBackdrop);
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (item.isSuccess) {
|
if (item.isSuccess) {
|
||||||
if (item.data.BackdropImageTags?.length > 0) {
|
if (item.data.BackdropImageTags?.length > 0) {
|
||||||
setBackdrop(
|
setBackdrop(
|
||||||
api?.getItemImageUrl(item.data.Id, "Backdrop", {
|
getImageUrlsApi(api).getItemImageUrlById(item.data.Id, "Backdrop", {
|
||||||
tag: item.data.BackdropImageTags[0],
|
tag: item.data.BackdropImageTags[0],
|
||||||
}),
|
}),
|
||||||
item.data.BackdropImageTags[0],
|
item.data.BackdropImageTags[0],
|
||||||
@@ -381,9 +375,13 @@ function ItemDetail() {
|
|||||||
{item.data.BackdropImageTags?.length ? (
|
{item.data.BackdropImageTags?.length ? (
|
||||||
<motion.img
|
<motion.img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data.Id,
|
||||||
|
"Backdrop",
|
||||||
|
{
|
||||||
tag: item.data.BackdropImageTags[0],
|
tag: item.data.BackdropImageTags[0],
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
className="item-hero-backdrop"
|
className="item-hero-backdrop"
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = 1;
|
||||||
@@ -424,10 +422,14 @@ function ItemDetail() {
|
|||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 90,
|
quality: 90,
|
||||||
tag: item.data.ImageTags.Primary,
|
tag: item.data.ImageTags.Primary,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = 1;
|
||||||
}}
|
}}
|
||||||
@@ -444,12 +446,16 @@ function ItemDetail() {
|
|||||||
{item.data.ImageTags?.Logo ? (
|
{item.data.ImageTags?.Logo ? (
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Logo", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data.Id,
|
||||||
|
"Logo",
|
||||||
|
{
|
||||||
quality: 90,
|
quality: 90,
|
||||||
fillWidth: 592,
|
fillWidth: 592,
|
||||||
fillHeight: 592,
|
fillHeight: 592,
|
||||||
tag: item.data.ImageTags.Logo,
|
tag: item.data.ImageTags.Logo,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = 1;
|
||||||
}}
|
}}
|
||||||
@@ -694,7 +700,7 @@ function ItemDetail() {
|
|||||||
currentVideoTrack={selectedVideoTrack}
|
currentVideoTrack={selectedVideoTrack}
|
||||||
currentAudioTrack={selectedAudioTrack}
|
currentAudioTrack={selectedAudioTrack}
|
||||||
currentSubTrack={selectedSubtitleTrack}
|
currentSubTrack={selectedSubtitleTrack}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
buttonProps={{
|
buttonProps={{
|
||||||
fullWidth: true,
|
fullWidth: true,
|
||||||
}}
|
}}
|
||||||
@@ -710,14 +716,14 @@ function ItemDetail() {
|
|||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isFavorite={item.data.UserData.IsFavorite}
|
isFavorite={item.data.UserData.IsFavorite}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
<MarkPlayedButton
|
<MarkPlayedButton
|
||||||
itemName={item.data.Name}
|
itemName={item.data.Name}
|
||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isPlayed={item.data.UserData.Played}
|
isPlayed={item.data.UserData.Played}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -838,11 +844,15 @@ function ItemDetail() {
|
|||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name}
|
||||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
actor.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 80,
|
quality: 80,
|
||||||
fillWidth: 200,
|
fillWidth: 200,
|
||||||
fillHeight: 200,
|
fillHeight: 200,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -881,11 +891,15 @@ function ItemDetail() {
|
|||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name}
|
||||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
actor.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 80,
|
quality: 80,
|
||||||
fillWidth: 200,
|
fillWidth: 200,
|
||||||
fillHeight: 200,
|
fillHeight: 200,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -927,11 +941,15 @@ function ItemDetail() {
|
|||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name}
|
||||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
actor.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 80,
|
quality: 80,
|
||||||
fillWidth: 200,
|
fillWidth: 200,
|
||||||
fillHeight: 200,
|
fillHeight: 200,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -973,11 +991,15 @@ function ItemDetail() {
|
|||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name}
|
||||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
actor.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 80,
|
quality: 80,
|
||||||
fillWidth: 200,
|
fillWidth: 200,
|
||||||
fillHeight: 200,
|
fillHeight: 200,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -1043,7 +1065,7 @@ function ItemDetail() {
|
|||||||
: "portrait"
|
: "portrait"
|
||||||
}
|
}
|
||||||
queryKey={["item", id, "similarItem"]}
|
queryKey={["item", id, "similarItem"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!similar.ImageBlurHashes?.Primary &&
|
!!similar.ImageBlurHashes?.Primary &&
|
||||||
similar.ImageBlurHashes?.Primary[
|
similar.ImageBlurHashes?.Primary[
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
import type {
|
|
||||||
BaseItemKind,
|
|
||||||
ItemSortBy,
|
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
|
||||||
import { createFileRoute } from "@tanstack/react-router";
|
|
||||||
|
|
||||||
type LibraryParamType = {
|
|
||||||
currentViewType: BaseItemKind;
|
|
||||||
sortAscending: boolean;
|
|
||||||
sortBy: ItemSortBy;
|
|
||||||
filters: {
|
|
||||||
isPlayed: boolean;
|
|
||||||
isUnPlayed: boolean;
|
|
||||||
isResumable: boolean;
|
|
||||||
isFavorite: boolean;
|
|
||||||
isLiked: boolean;
|
|
||||||
isUnliked: boolean;
|
|
||||||
hasSubtitles: boolean;
|
|
||||||
hasTrailer: boolean;
|
|
||||||
hasSpecialFeature: boolean;
|
|
||||||
hasThemeSong: boolean;
|
|
||||||
hasThemeVideo: boolean;
|
|
||||||
isBluRay: boolean;
|
|
||||||
isDVD: boolean;
|
|
||||||
isHD: undefined | boolean;
|
|
||||||
isSD: boolean;
|
|
||||||
is4K: boolean;
|
|
||||||
is3D: boolean;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/library")({
|
|
||||||
validateSearch: (search: Record<string, any>): LibraryParamType => {
|
|
||||||
return {
|
|
||||||
currentViewType: search.viewType,
|
|
||||||
sortAscending: search.sortAscending,
|
|
||||||
sortBy: search.sortBy,
|
|
||||||
filters: search.filters,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
+192
-115
@@ -1,49 +1,38 @@
|
|||||||
import React, {
|
import React, {
|
||||||
useState,
|
useState,
|
||||||
useEffect,
|
useEffect,
|
||||||
useLayoutEffect,
|
|
||||||
type ChangeEvent,
|
type ChangeEvent,
|
||||||
useMemo,
|
useMemo,
|
||||||
useCallback,
|
useCallback,
|
||||||
type MouseEvent,
|
type MouseEvent,
|
||||||
} from "react";
|
} from "react";
|
||||||
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
|
|
||||||
import Accordion from "@mui/material/Accordion";
|
|
||||||
import AccordionDetails from "@mui/material/AccordionDetails";
|
|
||||||
import AccordionSummary from "@mui/material/AccordionSummary";
|
|
||||||
import Box from "@mui/material/Box";
|
|
||||||
import Button from "@mui/material/Button";
|
import Button from "@mui/material/Button";
|
||||||
import Checkbox from "@mui/material/Checkbox";
|
import Checkbox from "@mui/material/Checkbox";
|
||||||
import Chip from "@mui/material/Chip";
|
import Chip from "@mui/material/Chip";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
import Divider from "@mui/material/Divider";
|
import Divider from "@mui/material/Divider";
|
||||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||||
import Grow from "@mui/material/Grow";
|
|
||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import MenuItem from "@mui/material/MenuItem";
|
import MenuItem from "@mui/material/MenuItem";
|
||||||
import Popper from "@mui/material/Popper";
|
|
||||||
import TextField from "@mui/material/TextField";
|
import TextField from "@mui/material/TextField";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
import { Card } from "@/components/card/card";
|
||||||
|
import { EmptyNotice } from "@/components/notices/emptyNotice/emptyNotice";
|
||||||
import { getArtistsApi } from "@jellyfin/sdk/lib/utils/api/artists-api";
|
import { getArtistsApi } from "@jellyfin/sdk/lib/utils/api/artists-api";
|
||||||
import { getGenresApi } from "@jellyfin/sdk/lib/utils/api/genres-api";
|
import { getGenresApi } from "@jellyfin/sdk/lib/utils/api/genres-api";
|
||||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||||
import { getMusicGenresApi } from "@jellyfin/sdk/lib/utils/api/music-genres-api";
|
import { getMusicGenresApi } from "@jellyfin/sdk/lib/utils/api/music-genres-api";
|
||||||
import { getPersonsApi } from "@jellyfin/sdk/lib/utils/api/persons-api";
|
import { getPersonsApi } from "@jellyfin/sdk/lib/utils/api/persons-api";
|
||||||
import { getStudiosApi } from "@jellyfin/sdk/lib/utils/api/studios-api";
|
import { getStudiosApi } from "@jellyfin/sdk/lib/utils/api/studios-api";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
|
||||||
|
|
||||||
import { Card } from "@/components/card/card";
|
|
||||||
import { EmptyNotice } from "@/components/notices/emptyNotice/emptyNotice";
|
|
||||||
|
|
||||||
import GenreView from "@/components/layouts/library/genreView";
|
import GenreView from "@/components/layouts/library/genreView";
|
||||||
import MusicTrack from "@/components/musicTrack";
|
import MusicTrack from "@/components/musicTrack";
|
||||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||||
import { setBackdrop } from "@/utils/store/backdrop";
|
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||||
import {
|
import {
|
||||||
type BaseItemDto,
|
|
||||||
type BaseItemDtoQueryResult,
|
type BaseItemDtoQueryResult,
|
||||||
BaseItemKind,
|
BaseItemKind,
|
||||||
CollectionType,
|
CollectionType,
|
||||||
@@ -57,7 +46,7 @@ import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api"
|
|||||||
import {
|
import {
|
||||||
FormControl,
|
FormControl,
|
||||||
Menu,
|
Menu,
|
||||||
MenuList,
|
Select,
|
||||||
Stack,
|
Stack,
|
||||||
useScrollTrigger,
|
useScrollTrigger,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
@@ -65,12 +54,14 @@ import { useWindowVirtualizer } from "@tanstack/react-virtual";
|
|||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
import "./library.scss";
|
import "./library.scss";
|
||||||
import LibraryItemsSkeleton from "@/components/skeleton/libraryItems";
|
import LibraryItemsSkeleton from "@/components/skeleton/libraryItems";
|
||||||
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
|
|
||||||
type SortByObject = { title: string; value: ItemSortBy };
|
type SortByObject = { title: string; value: ItemSortBy };
|
||||||
type ViewObject = { title: string; value: BaseItemKind | "Artist" };
|
type ViewObject = { title: string; value: BaseItemKind | "Artist" };
|
||||||
// type allowedFilters = ["movies", "tvshows", "music", "books"];
|
// type allowedFilters = ["movies", "tvshows", "music", "books"];
|
||||||
type allowedFilters = Partial<CollectionType>[];
|
|
||||||
|
|
||||||
const useWindowWidth = () => {
|
const useWindowWidth = () => {
|
||||||
const [width, setWidth] = React.useState(window.innerWidth);
|
const [width, setWidth] = React.useState(window.innerWidth);
|
||||||
@@ -96,30 +87,22 @@ export const Route = createFileRoute("/_api/library/$id")({
|
|||||||
});
|
});
|
||||||
|
|
||||||
function LibraryView() {
|
function LibraryView() {
|
||||||
const api = Route.useRouteContext().api;
|
const api = useApiInContext((s) => s.api);
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const { id } = Route.useParams();
|
const { id } = Route.useParams();
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
});
|
|
||||||
|
|
||||||
const currentLib = useQuery({
|
const currentLib = useQuery({
|
||||||
queryKey: ["libraryView", "currentLib", id],
|
queryKey: ["libraryView", "currentLib", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
itemId: id,
|
itemId: id,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
staleTime: 0,
|
staleTime: 0,
|
||||||
});
|
});
|
||||||
@@ -217,16 +200,24 @@ function LibraryView() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const [sortBy, setSortBy] = useState<ItemSortBy>("Name");
|
const [sortBy, setSortBy] = useState<ItemSortBy>("Name");
|
||||||
const [sortAscending, setSortAscending] = useState(true);
|
const [sortAscending, setSortAscending] = useState(
|
||||||
|
() =>
|
||||||
|
JSON.parse(
|
||||||
|
sessionStorage.getItem(
|
||||||
|
`library-${currentLib.data?.Id}-config_sort`,
|
||||||
|
) as string,
|
||||||
|
)?.sortAscending ?? true,
|
||||||
|
);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// I don't know why this works, don't ask...
|
// I don't know why this works, don't ask...
|
||||||
const cachedVal = sessionStorage.getItem(
|
const cachedVal = sessionStorage.getItem(
|
||||||
`library-${currentLib.data?.Id}-config_sort`,
|
`library-${currentLib.data?.Id}-config_sort`,
|
||||||
) as unknown as {
|
) as unknown as {
|
||||||
sortAscending: boolean;
|
sortAscending?: boolean;
|
||||||
sortBy: ItemSortBy;
|
sortBy?: ItemSortBy;
|
||||||
};
|
};
|
||||||
if (cachedVal) {
|
if (cachedVal?.sortAscending) {
|
||||||
|
console.log(cachedVal.sortAscending);
|
||||||
setSortAscending(cachedVal.sortAscending);
|
setSortAscending(cachedVal.sortAscending);
|
||||||
}
|
}
|
||||||
}, [currentLib.data?.Id]);
|
}, [currentLib.data?.Id]);
|
||||||
@@ -440,7 +431,11 @@ function LibraryView() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// And they say typescript makes your code better :|
|
// And they say typescript makes your code better :|
|
||||||
const cachedVal = JSON.parse(sessionStorage.getItem(`library-${currentLib.data?.Id}-config_sort`) as string);
|
const cachedVal = JSON.parse(
|
||||||
|
sessionStorage.getItem(
|
||||||
|
`library-${currentLib.data?.Id}-config_sort`,
|
||||||
|
) as string,
|
||||||
|
);
|
||||||
// as {
|
// as {
|
||||||
// sortAscending: boolean;
|
// sortAscending: boolean;
|
||||||
// sortBy: ItemSortBy;
|
// sortBy: ItemSortBy;
|
||||||
@@ -453,7 +448,15 @@ function LibraryView() {
|
|||||||
return result;
|
return result;
|
||||||
}, [currentLib.data?.CollectionType, currentViewType]);
|
}, [currentLib.data?.CollectionType, currentViewType]);
|
||||||
|
|
||||||
const [filters, setFilters] = useState<Record<string, undefined | boolean>>({
|
const [filters, setFilters] = useState<Record<string, undefined | boolean>>(
|
||||||
|
() => {
|
||||||
|
const cachedVal = sessionStorage.getItem(
|
||||||
|
`library-${currentLib.data?.Id}-config_fliters`,
|
||||||
|
);
|
||||||
|
if (cachedVal !== null) {
|
||||||
|
return JSON.parse(cachedVal);
|
||||||
|
}
|
||||||
|
return {
|
||||||
isPlayed: false,
|
isPlayed: false,
|
||||||
isUnPlayed: false,
|
isUnPlayed: false,
|
||||||
isResumable: false,
|
isResumable: false,
|
||||||
@@ -471,7 +474,15 @@ function LibraryView() {
|
|||||||
isSD: false,
|
isSD: false,
|
||||||
is4K: false,
|
is4K: false,
|
||||||
is3D: false,
|
is3D: false,
|
||||||
});
|
};
|
||||||
|
},
|
||||||
|
);
|
||||||
|
useEffect(() => {
|
||||||
|
sessionStorage.setItem(
|
||||||
|
`library-${currentLib.data?.Id}-config_fliters`,
|
||||||
|
JSON.stringify(filters),
|
||||||
|
);
|
||||||
|
}, [filters, currentLib.data?.Id]);
|
||||||
|
|
||||||
const items = useQuery({
|
const items = useQuery({
|
||||||
queryKey: [
|
queryKey: [
|
||||||
@@ -490,32 +501,32 @@ function LibraryView() {
|
|||||||
let result: AxiosResponse<BaseItemDtoQueryResult, any>;
|
let result: AxiosResponse<BaseItemDtoQueryResult, any>;
|
||||||
if (currentViewType === "MusicArtist") {
|
if (currentViewType === "MusicArtist") {
|
||||||
result = await getArtistsApi(api).getAlbumArtists({
|
result = await getArtistsApi(api).getAlbumArtists({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
parentId: id,
|
parentId: id,
|
||||||
});
|
});
|
||||||
} else if (currentViewType === "Artist") {
|
} else if (currentViewType === "Artist") {
|
||||||
result = await getArtistsApi(api).getArtists({
|
result = await getArtistsApi(api).getArtists({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
parentId: id,
|
parentId: id,
|
||||||
});
|
});
|
||||||
} else if (currentViewType === "Person") {
|
} else if (currentViewType === "Person") {
|
||||||
result = await getPersonsApi(api).getPersons({
|
result = await getPersonsApi(api).getPersons({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
personTypes: ["Actor"],
|
personTypes: ["Actor"],
|
||||||
});
|
});
|
||||||
} else if (currentViewType === "Genre") {
|
} else if (currentViewType === "Genre") {
|
||||||
result = await getGenresApi(api).getGenres({
|
result = await getGenresApi(api).getGenres({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
parentId: id,
|
parentId: id,
|
||||||
});
|
});
|
||||||
} else if (currentViewType === "MusicGenre") {
|
} else if (currentViewType === "MusicGenre") {
|
||||||
result = await getMusicGenresApi(api).getMusicGenres({
|
result = await getMusicGenresApi(api).getMusicGenres({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
parentId: id,
|
parentId: id,
|
||||||
});
|
});
|
||||||
} else if (currentViewType === "Studio") {
|
} else if (currentViewType === "Studio") {
|
||||||
result = await getStudiosApi(api).getStudios({
|
result = await getStudiosApi(api).getStudios({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
parentId: id,
|
parentId: id,
|
||||||
});
|
});
|
||||||
} else if (currentViewType === "BoxSet") {
|
} else if (currentViewType === "BoxSet") {
|
||||||
@@ -532,7 +543,7 @@ function LibraryView() {
|
|||||||
if (filters.isFavorite) filtersArray.push(ItemFilter.IsFavorite);
|
if (filters.isFavorite) filtersArray.push(ItemFilter.IsFavorite);
|
||||||
|
|
||||||
result = await getItemsApi(api).getItems({
|
result = await getItemsApi(api).getItems({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
parentId: currentLib.data?.Id,
|
parentId: currentLib.data?.Id,
|
||||||
recursive:
|
recursive:
|
||||||
currentLib.data?.CollectionType === "boxsets" ? undefined : true,
|
currentLib.data?.CollectionType === "boxsets" ? undefined : true,
|
||||||
@@ -567,7 +578,7 @@ function LibraryView() {
|
|||||||
if (filters.isFavorite) filtersArray.push(ItemFilter.IsFavorite);
|
if (filters.isFavorite) filtersArray.push(ItemFilter.IsFavorite);
|
||||||
|
|
||||||
result = await getItemsApi(api).getItems({
|
result = await getItemsApi(api).getItems({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
parentId: currentLib.data?.Id,
|
parentId: currentLib.data?.Id,
|
||||||
recursive:
|
recursive:
|
||||||
currentLib.data?.CollectionType === "boxsets" ? undefined : true,
|
currentLib.data?.CollectionType === "boxsets" ? undefined : true,
|
||||||
@@ -592,7 +603,7 @@ function LibraryView() {
|
|||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
// enabled: false,
|
// enabled: false,
|
||||||
enabled: user.isSuccess && Boolean(currentViewType) && currentLib.isSuccess,
|
enabled: !!user?.Id && Boolean(currentViewType) && currentLib.isSuccess,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
// gcTime: 0,
|
// gcTime: 0,
|
||||||
});
|
});
|
||||||
@@ -679,17 +690,21 @@ function LibraryView() {
|
|||||||
threshold: 20,
|
threshold: 20,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||||
|
|
||||||
const backdropItems = useMemo(() => {
|
const backdropItems = useMemo(() => {
|
||||||
if (items.isSuccess) {
|
if (items.isSuccess) {
|
||||||
const temp = items.data.Items?.filter(
|
const temp = items.data.Items?.filter(
|
||||||
(item) => item.BackdropImageTags?.length,
|
(item) => item.BackdropImageTags?.length,
|
||||||
);
|
);
|
||||||
|
if (temp?.[0]?.Id) {
|
||||||
setBackdrop(
|
setBackdrop(
|
||||||
api.getItemImageUrl(temp?.[0]?.Id, "Backdrop", {
|
getImageUrlsApi(api).getItemImageUrlById(temp?.[0]?.Id, "Backdrop", {
|
||||||
tag: temp?.[0]?.BackdropImageTags?.[0],
|
tag: temp?.[0]?.BackdropImageTags?.[0],
|
||||||
}),
|
}),
|
||||||
temp?.[0]?.BackdropImageTags?.[0] ?? "none",
|
temp?.[0]?.BackdropImageTags?.[0] ?? "none",
|
||||||
);
|
);
|
||||||
|
}
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
}, [items]);
|
}, [items]);
|
||||||
@@ -701,9 +716,13 @@ function LibraryView() {
|
|||||||
const backdropItem = backdropItems[itemIndex];
|
const backdropItem = backdropItems[itemIndex];
|
||||||
// enqueueSnackbar("Running");
|
// enqueueSnackbar("Running");
|
||||||
setBackdrop(
|
setBackdrop(
|
||||||
api?.getItemImageUrl(backdropItem.Id ?? "", "Backdrop", {
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
backdropItem.Id ?? "",
|
||||||
|
"Backdrop",
|
||||||
|
{
|
||||||
tag: backdropItem.BackdropImageTags?.[0],
|
tag: backdropItem.BackdropImageTags?.[0],
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
backdropItem.BackdropImageTags?.[0] ?? "none",
|
backdropItem.BackdropImageTags?.[0] ?? "none",
|
||||||
);
|
);
|
||||||
}, 14000); // Update backdrop every 14s
|
}, 14000); // Update backdrop every 14s
|
||||||
@@ -711,6 +730,8 @@ function LibraryView() {
|
|||||||
}
|
}
|
||||||
}, [backdropItems]);
|
}, [backdropItems]);
|
||||||
|
|
||||||
|
const [test, setTest] = useState(1);
|
||||||
|
|
||||||
if (items.isError) {
|
if (items.isError) {
|
||||||
console.error(items.error);
|
console.error(items.error);
|
||||||
}
|
}
|
||||||
@@ -792,7 +813,16 @@ function LibraryView() {
|
|||||||
{!disableSort && (
|
{!disableSort && (
|
||||||
<div className="flex flex-row flex-center">
|
<div className="flex flex-row flex-center">
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => setSortAscending((state) => !state)}
|
onClick={() => {
|
||||||
|
sessionStorage.setItem(
|
||||||
|
`library-${currentLib.data?.Id}-config_sort`,
|
||||||
|
JSON.stringify({
|
||||||
|
sortAscending: !sortAscending,
|
||||||
|
sortBy,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
setSortAscending((state: boolean) => !state);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="material-symbols-rounded"
|
className="material-symbols-rounded"
|
||||||
@@ -810,7 +840,8 @@ function LibraryView() {
|
|||||||
value={sortBy ?? "Name"}
|
value={sortBy ?? "Name"}
|
||||||
size="small"
|
size="small"
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setSortBy(e.target.value);
|
setSortBy(e.target.value as ItemSortBy);
|
||||||
|
console.info(e);
|
||||||
sessionStorage.setItem(
|
sessionStorage.setItem(
|
||||||
`library-${currentLib.data?.Id}-config_sort`,
|
`library-${currentLib.data?.Id}-config_sort`,
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
@@ -834,7 +865,7 @@ function LibraryView() {
|
|||||||
value={currentViewType}
|
value={currentViewType}
|
||||||
size="small"
|
size="small"
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setCurrentViewType(e.target.value);
|
setCurrentViewType(e.target.value as BaseItemKind);
|
||||||
sessionStorage.setItem(
|
sessionStorage.setItem(
|
||||||
`library-${currentLib.data?.Id}-config_currentViewType`,
|
`library-${currentLib.data?.Id}-config_currentViewType`,
|
||||||
e.target.value,
|
e.target.value,
|
||||||
@@ -857,6 +888,7 @@ function LibraryView() {
|
|||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
size="large"
|
size="large"
|
||||||
|
//@ts-ignore
|
||||||
color="white"
|
color="white"
|
||||||
onClick={handleFilterDropdown}
|
onClick={handleFilterDropdown}
|
||||||
>
|
>
|
||||||
@@ -892,8 +924,9 @@ function LibraryView() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.isPlayed} />}
|
control={
|
||||||
label="Played"
|
<Checkbox
|
||||||
|
checked={filters.isPlayed}
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
setFilters((s) => ({
|
setFilters((s) => ({
|
||||||
...s,
|
...s,
|
||||||
@@ -901,9 +934,13 @@ function LibraryView() {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
}
|
||||||
|
label="Played"
|
||||||
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.isUnPlayed} />}
|
control={
|
||||||
label="Unplayed"
|
<Checkbox
|
||||||
|
checked={filters.isUnPlayed}
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
setFilters((s) => ({
|
setFilters((s) => ({
|
||||||
...s,
|
...s,
|
||||||
@@ -911,9 +948,13 @@ function LibraryView() {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
}
|
||||||
|
label="Unplayed"
|
||||||
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.isResumable} />}
|
control={
|
||||||
label="Resumable"
|
<Checkbox
|
||||||
|
checked={filters.isResumable}
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
setFilters((s) => ({
|
setFilters((s) => ({
|
||||||
...s,
|
...s,
|
||||||
@@ -921,9 +962,13 @@ function LibraryView() {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
}
|
||||||
|
label="Resumable"
|
||||||
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.isFavorite} />}
|
control={
|
||||||
label="Favorites"
|
<Checkbox
|
||||||
|
checked={filters.isFavorite}
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
setFilters((s) => ({
|
setFilters((s) => ({
|
||||||
...s,
|
...s,
|
||||||
@@ -931,6 +976,9 @@ function LibraryView() {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
}
|
||||||
|
label="Favorites"
|
||||||
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<Typography
|
<Typography
|
||||||
variant="h6"
|
variant="h6"
|
||||||
@@ -949,8 +997,9 @@ function LibraryView() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.hasSubtitles} />}
|
control={
|
||||||
label="Subtitles"
|
<Checkbox
|
||||||
|
checked={filters.hasSubtitles}
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
setFilters((s) => ({
|
setFilters((s) => ({
|
||||||
...s,
|
...s,
|
||||||
@@ -958,9 +1007,13 @@ function LibraryView() {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
}
|
||||||
|
label="Subtitles"
|
||||||
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.hasTrailer} />}
|
control={
|
||||||
label="Trailer"
|
<Checkbox
|
||||||
|
checked={filters.hasTrailer}
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
setFilters((s) => ({
|
setFilters((s) => ({
|
||||||
...s,
|
...s,
|
||||||
@@ -968,11 +1021,13 @@ function LibraryView() {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
}
|
||||||
|
label="Trailer"
|
||||||
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={
|
control={
|
||||||
<Checkbox checked={filters.hasSpecialFeature} />
|
<Checkbox
|
||||||
}
|
checked={filters.hasSpecialFeature}
|
||||||
label="Special Features"
|
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
setFilters((s) => ({
|
setFilters((s) => ({
|
||||||
...s,
|
...s,
|
||||||
@@ -980,9 +1035,13 @@ function LibraryView() {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
}
|
||||||
|
label="Special Features"
|
||||||
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.hasThemeSong} />}
|
control={
|
||||||
label="Theme Song"
|
<Checkbox
|
||||||
|
checked={filters.hasThemeSong}
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
setFilters((s) => ({
|
setFilters((s) => ({
|
||||||
...s,
|
...s,
|
||||||
@@ -990,9 +1049,13 @@ function LibraryView() {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
}
|
||||||
|
label="Theme Song"
|
||||||
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.hasThemeVideo} />}
|
control={
|
||||||
label="Theme Video"
|
<Checkbox
|
||||||
|
checked={filters.hasThemeVideo}
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
setFilters((s) => ({
|
setFilters((s) => ({
|
||||||
...s,
|
...s,
|
||||||
@@ -1000,6 +1063,9 @@ function LibraryView() {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
}
|
||||||
|
label="Theme Video"
|
||||||
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<Typography
|
<Typography
|
||||||
variant="h6"
|
variant="h6"
|
||||||
@@ -1019,9 +1085,8 @@ function LibraryView() {
|
|||||||
>
|
>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={
|
control={
|
||||||
<Checkbox checked={videoTypesState.BluRay} />
|
<Checkbox
|
||||||
}
|
checked={videoTypesState.BluRay}
|
||||||
label="BluRay"
|
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
setVideoTypesState((s) => ({
|
setVideoTypesState((s) => ({
|
||||||
...s,
|
...s,
|
||||||
@@ -1029,9 +1094,13 @@ function LibraryView() {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
}
|
||||||
|
label="BluRay"
|
||||||
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={videoTypesState.Dvd} />}
|
control={
|
||||||
label="DVD"
|
<Checkbox
|
||||||
|
checked={videoTypesState.Dvd}
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
setVideoTypesState((s) => ({
|
setVideoTypesState((s) => ({
|
||||||
...s,
|
...s,
|
||||||
@@ -1039,9 +1108,13 @@ function LibraryView() {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
}
|
||||||
|
label="DVD"
|
||||||
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.isHD} />}
|
control={
|
||||||
label="HD"
|
<Checkbox
|
||||||
|
checked={filters.isHD}
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
||||||
setFilters((s) => ({
|
setFilters((s) => ({
|
||||||
...s,
|
...s,
|
||||||
@@ -1049,9 +1122,13 @@ function LibraryView() {
|
|||||||
}));
|
}));
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
}
|
||||||
|
label="HD"
|
||||||
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={filters.is4K} />}
|
control={
|
||||||
label="4k"
|
<Checkbox
|
||||||
|
checked={filters.is4K}
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||||
setFilters((s) => ({
|
setFilters((s) => ({
|
||||||
...s,
|
...s,
|
||||||
@@ -1059,21 +1136,28 @@ function LibraryView() {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
}
|
||||||
|
label="4k"
|
||||||
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox checked={false} />}
|
control={<Checkbox checked={false} />}
|
||||||
label="SD"
|
label="SD"
|
||||||
disabled
|
disabled
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Checkbox value={filters.is3D} />}
|
control={
|
||||||
label="3D"
|
<Checkbox
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
value={filters.is3D}
|
||||||
|
onChange={(e) =>
|
||||||
setFilters((s) => ({
|
setFilters((s) => ({
|
||||||
...s,
|
...s,
|
||||||
is3D: e.target.checked,
|
is3D: e.target.checked,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
}
|
||||||
|
label="3D"
|
||||||
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Menu>
|
</Menu>
|
||||||
</>
|
</>
|
||||||
@@ -1098,7 +1182,7 @@ function LibraryView() {
|
|||||||
libraryId={currentLib.data.Id}
|
libraryId={currentLib.data.Id}
|
||||||
genreId={item.Id}
|
genreId={item.Id}
|
||||||
genreName={item.Name}
|
genreName={item.Name}
|
||||||
userId={user.data?.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
@@ -1116,10 +1200,10 @@ function LibraryView() {
|
|||||||
const fromIndex = index * itemsPerRow;
|
const fromIndex = index * itemsPerRow;
|
||||||
const toIndex = Math.min(
|
const toIndex = Math.min(
|
||||||
fromIndex + itemsPerRow,
|
fromIndex + itemsPerRow,
|
||||||
items.data?.TotalRecordCount,
|
items.data?.TotalRecordCount ?? 0,
|
||||||
);
|
);
|
||||||
for (let i = fromIndex; i < toIndex; i++) {
|
for (let i = fromIndex; i < toIndex; i++) {
|
||||||
const item = items.data?.Items[i];
|
const item = items.data?.Items?.[i];
|
||||||
displayItems.push(
|
displayItems.push(
|
||||||
<div
|
<div
|
||||||
className="library-virtual-item"
|
className="library-virtual-item"
|
||||||
@@ -1128,18 +1212,18 @@ function LibraryView() {
|
|||||||
ref={virtualizer.measureElement}
|
ref={virtualizer.measureElement}
|
||||||
>
|
>
|
||||||
<Card
|
<Card
|
||||||
item={item}
|
item={item ?? null}
|
||||||
seriesId={item.SeriesId}
|
seriesId={item?.SeriesId}
|
||||||
cardTitle={
|
cardTitle={
|
||||||
item.Type === BaseItemKind.Episode
|
item?.Type === BaseItemKind.Episode
|
||||||
? item.SeriesName
|
? item.SeriesName
|
||||||
: item.Name
|
: item?.Name
|
||||||
}
|
}
|
||||||
imageType={"Primary"}
|
imageType={"Primary"}
|
||||||
cardCaption={
|
cardCaption={
|
||||||
item.Type === BaseItemKind.Episode
|
item?.Type === BaseItemKind.Episode
|
||||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`
|
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`
|
||||||
: item.Type === BaseItemKind.Series
|
: item?.Type === BaseItemKind.Series
|
||||||
? `${item.ProductionYear} - ${
|
? `${item.ProductionYear} - ${
|
||||||
item.EndDate
|
item.EndDate
|
||||||
? new Date(item.EndDate).toLocaleString(
|
? new Date(item.EndDate).toLocaleString(
|
||||||
@@ -1150,32 +1234,26 @@ function LibraryView() {
|
|||||||
)
|
)
|
||||||
: "Present"
|
: "Present"
|
||||||
}`
|
}`
|
||||||
: item.ProductionYear
|
: item?.ProductionYear
|
||||||
}
|
}
|
||||||
disableOverlay={
|
disableOverlay={
|
||||||
item.Type === BaseItemKind.Person ||
|
item?.Type === BaseItemKind.Person ||
|
||||||
item.Type === BaseItemKind.Genre ||
|
item?.Type === BaseItemKind.Genre ||
|
||||||
item.Type === BaseItemKind.MusicGenre ||
|
item?.Type === BaseItemKind.MusicGenre ||
|
||||||
item.Type === BaseItemKind.Studio
|
item?.Type === BaseItemKind.Studio
|
||||||
}
|
}
|
||||||
cardType={
|
cardType={
|
||||||
item.Type === BaseItemKind.MusicAlbum ||
|
item?.Type === BaseItemKind.MusicAlbum ||
|
||||||
item.Type === BaseItemKind.Audio ||
|
item?.Type === BaseItemKind.Audio ||
|
||||||
item.Type === BaseItemKind.Genre ||
|
item?.Type === BaseItemKind.Genre ||
|
||||||
item.Type === BaseItemKind.MusicGenre ||
|
item?.Type === BaseItemKind.MusicGenre ||
|
||||||
item.Type === BaseItemKind.Studio ||
|
item?.Type === BaseItemKind.Studio ||
|
||||||
item.Type === BaseItemKind.Playlist
|
item?.Type === BaseItemKind.Playlist
|
||||||
? "square"
|
? "square"
|
||||||
: "portrait"
|
: "portrait"
|
||||||
}
|
}
|
||||||
// queryKey={items}
|
// queryKey={items}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
|
||||||
item.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</div>,
|
</div>,
|
||||||
);
|
);
|
||||||
@@ -1210,7 +1288,7 @@ function LibraryView() {
|
|||||||
const item = items.data?.Items?.[virtualRow.index];
|
const item = items.data?.Items?.[virtualRow.index];
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={item.Id}
|
key={item?.Id}
|
||||||
style={{
|
style={{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
top: 0,
|
top: 0,
|
||||||
@@ -1221,7 +1299,7 @@ function LibraryView() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<MusicTrack
|
<MusicTrack
|
||||||
item={item}
|
item={item ?? null}
|
||||||
// queryKey={[
|
// queryKey={[
|
||||||
// "libraryView",
|
// "libraryView",
|
||||||
// "currentLibItems",
|
// "currentLibItems",
|
||||||
@@ -1246,7 +1324,7 @@ function LibraryView() {
|
|||||||
// },
|
// },
|
||||||
// },
|
// },
|
||||||
// ]}
|
// ]}
|
||||||
userId={user.data?.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -1260,9 +1338,8 @@ function LibraryView() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (currentLib.isError) {
|
if (currentLib.isError) {
|
||||||
return <h6>{currentLib.error}</h6>;
|
return <ErrorNotice error={currentLib.error} />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default LibraryView;
|
export default LibraryView;
|
||||||
|
|
||||||
@@ -84,6 +84,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
&-filter {
|
&-filter {
|
||||||
|
width: 100%;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin: 0 0.5em !important;
|
||||||
&-container {
|
&-container {
|
||||||
margin-top: 0.75em;
|
margin-top: 0.75em;
|
||||||
width: 22em;
|
width: 22em;
|
||||||
@@ -93,11 +96,6 @@
|
|||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(10px);
|
||||||
overflow-y: overlay;
|
overflow-y: overlay;
|
||||||
}
|
}
|
||||||
|
|
||||||
width: 100%;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin: 0 0.5em !important;
|
|
||||||
|
|
||||||
&-title {
|
&-title {
|
||||||
justify-self: start;
|
justify-self: start;
|
||||||
}
|
}
|
||||||
@@ -131,6 +129,14 @@
|
|||||||
}
|
}
|
||||||
// Layout css for dynamic virtual rows
|
// Layout css for dynamic virtual rows
|
||||||
&-virtual-item{
|
&-virtual-item{
|
||||||
|
width: 14%;
|
||||||
|
flex-basis: 14%;
|
||||||
|
height: fit-content;
|
||||||
|
display: inline-flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0.75em;
|
||||||
&-row{
|
&-row{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
@@ -138,13 +144,5 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
flex-basis: 14%;
|
flex-basis: 14%;
|
||||||
}
|
}
|
||||||
width: 14%;
|
|
||||||
height: fit-content;
|
|
||||||
display: inline-flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
padding: 0.75em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
|
import { CircularProgress, Typography } from "@mui/material";
|
||||||
import { createFileRoute, redirect } from "@tanstack/react-router";
|
import { createFileRoute, redirect } from "@tanstack/react-router";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/login")({
|
export const Route = createFileRoute("/_api/login")({
|
||||||
beforeLoad: async ({ context, location }) => {
|
beforeLoad: async ({ context, location }) => {
|
||||||
@@ -7,13 +9,26 @@ export const Route = createFileRoute("/_api/login")({
|
|||||||
const api = context.api;
|
const api = context.api;
|
||||||
if (!api) {
|
if (!api) {
|
||||||
console.info("Awaiting Api generation.");
|
console.info("Awaiting Api generation.");
|
||||||
return;
|
// throw redirect({ to: "/login/manual" });
|
||||||
}
|
} else {
|
||||||
const publicUsers = (await getUserApi(api).getPublicUsers()).data;
|
const publicUsers = (await getUserApi(api).getPublicUsers()).data;
|
||||||
if (publicUsers.length > 0) {
|
if (publicUsers.length > 0) {
|
||||||
throw redirect({ to: "/login/list" });
|
throw redirect({ to: "/login/list" });
|
||||||
}
|
}
|
||||||
throw redirect({ to: "/login/manual" });
|
throw redirect({ to: "/login/manual" });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
// component: () => {
|
||||||
|
// const data = Route.useRouteContext();
|
||||||
|
// console.log(data);
|
||||||
|
// return (
|
||||||
|
// <div style={{ height: "100vh" }} className="flex flex-column flex-center">
|
||||||
|
// <CircularProgress size={86} thickness={2} />
|
||||||
|
// <Typography mt={4} align="center">
|
||||||
|
// Fetching users...
|
||||||
|
// </Typography>
|
||||||
|
// </div>
|
||||||
|
// );
|
||||||
|
// },
|
||||||
});
|
});
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import React, { useLayoutEffect } from "react";
|
import React, { useLayoutEffect } from "react";
|
||||||
|
|
||||||
import { Grid, Typography } from "@mui/material";
|
import { Chip, IconButton, Typography } from "@mui/material";
|
||||||
import Button from "@mui/material/Button";
|
import Button from "@mui/material/Button";
|
||||||
import Container from "@mui/material/Container";
|
|
||||||
|
|
||||||
import { AppBarBackOnly } from "@/components/appBar/backOnly.jsx";
|
import { AppBarBackOnly } from "@/components/appBar/backOnly.jsx";
|
||||||
import { Card } from "@/components/card/card.js";
|
|
||||||
|
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
|
|
||||||
@@ -15,13 +13,42 @@ import "./login.scss";
|
|||||||
|
|
||||||
import QuickConnectButton from "@/components/buttons/quickConnectButton";
|
import QuickConnectButton from "@/components/buttons/quickConnectButton";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { setBackdrop } from "@/utils/store/backdrop.js";
|
import { useBackdropStore } from "@/utils/store/backdrop.js";
|
||||||
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
import type { UserDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import { Link, createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||||
|
|
||||||
|
import avatar from "../../../assets/icons/avatar.png";
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/login/list")({
|
export const Route = createFileRoute("/_api/login/list")({
|
||||||
component: LoginPublicUsersList,
|
component: LoginPublicUsersList,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const UserCard = ({ user }: { user: UserDto }) => {
|
||||||
|
const api = useApiInContext((s) => s.api);
|
||||||
|
return (
|
||||||
|
<Link
|
||||||
|
to="/login/$userId/$userName"
|
||||||
|
params={{ userId: user.Id ?? "", userName: user.Name ?? "" }}
|
||||||
|
className="user-list-item user-card"
|
||||||
|
>
|
||||||
|
<div className="user-card-image-container">
|
||||||
|
{user.PrimaryImageTag ? (
|
||||||
|
<img
|
||||||
|
className="user-card-image"
|
||||||
|
alt={"user"}
|
||||||
|
src={`${api.basePath}/Users/${user.Id}/Images/Primary?quality=80&tag=${user.PrimaryImageTag}`}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<img className="user-card-image" alt="user" src={avatar} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<Typography mt={1} align="center">
|
||||||
|
{user.Name}
|
||||||
|
</Typography>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function LoginPublicUsersList() {
|
function LoginPublicUsersList() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
@@ -30,18 +57,18 @@ function LoginPublicUsersList() {
|
|||||||
const handleChangeServer = () => {
|
const handleChangeServer = () => {
|
||||||
navigate({ to: "/setup/server/list" });
|
navigate({ to: "/setup/server/list" });
|
||||||
};
|
};
|
||||||
const handleManualLogin = () => {
|
|
||||||
navigate({ to: "/login/manual" });
|
|
||||||
};
|
|
||||||
const users = useQuery({
|
const users = useQuery({
|
||||||
queryKey: ["login", "public-users"],
|
queryKey: ["login", "public-users"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return [];
|
||||||
const result = await getUserApi(api).getPublicUsers();
|
const result = await getUserApi(api).getPublicUsers();
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: Boolean(api),
|
enabled: Boolean(api),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const setBackdrop = useBackdropStore((state) => state.setBackdrop);
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
setBackdrop("", "");
|
setBackdrop("", "");
|
||||||
}, []);
|
}, []);
|
||||||
@@ -49,66 +76,18 @@ function LoginPublicUsersList() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AppBarBackOnly />
|
<AppBarBackOnly />
|
||||||
<Container
|
<div className="login-container">
|
||||||
maxWidth="md"
|
<Typography variant="h4" align="center">
|
||||||
sx={{
|
|
||||||
height: "100vh",
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
justifyContent: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Typography variant="h3" mb={2}>
|
|
||||||
Users
|
Users
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<Grid
|
<div className="user-list-container roundedScrollbar">
|
||||||
container
|
{users.data.map((item) => {
|
||||||
columns={{
|
return <UserCard user={item} key={item.Id} />;
|
||||||
xs: 2,
|
|
||||||
sm: 3,
|
|
||||||
md: 4,
|
|
||||||
}}
|
|
||||||
wrap="nowrap"
|
|
||||||
alignItems="center"
|
|
||||||
overflow="auto"
|
|
||||||
width="100%"
|
|
||||||
mb={3}
|
|
||||||
paddingBottom={2}
|
|
||||||
className="roundedScrollbar"
|
|
||||||
>
|
|
||||||
{users.data.map((item, index) => {
|
|
||||||
return (
|
|
||||||
<Grid
|
|
||||||
key={item.Id}
|
|
||||||
flexShrink={0}
|
|
||||||
flexGrow={1}
|
|
||||||
xs={1}
|
|
||||||
sm={1}
|
|
||||||
md={1}
|
|
||||||
>
|
|
||||||
<Card
|
|
||||||
cardTitle={item.Name}
|
|
||||||
item={item}
|
|
||||||
disableOverlay
|
|
||||||
itemType="User"
|
|
||||||
cardType="square"
|
|
||||||
onClick={() =>
|
|
||||||
navigate({
|
|
||||||
to: "/login/$userId/$userName",
|
|
||||||
params: { userId: item.Id, userName: item.Name },
|
|
||||||
})
|
|
||||||
}
|
|
||||||
overrideIcon="User"
|
|
||||||
imageType="Primary"
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
);
|
|
||||||
})}
|
})}
|
||||||
</Grid>
|
</div>
|
||||||
|
|
||||||
<div className="buttons">
|
{/* <div className="buttons">
|
||||||
<Button
|
<Button
|
||||||
color="secondary"
|
color="secondary"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
@@ -118,20 +97,22 @@ function LoginPublicUsersList() {
|
|||||||
Change Server
|
Change Server
|
||||||
</Button>
|
</Button>
|
||||||
<QuickConnectButton />
|
<QuickConnectButton />
|
||||||
<Button
|
</div> */}
|
||||||
variant="contained"
|
<Chip
|
||||||
className="userEventButton"
|
style={{ marginLeft: "50%", transform: "translateX(-50%)" }}
|
||||||
onClick={handleManualLogin}
|
label={
|
||||||
size="small"
|
<Typography variant="body2" align="center">
|
||||||
>
|
Don't see your user? Try using{" "}
|
||||||
Manual Login
|
<Link to="/login/manual">Manual Login</Link> or{" "}
|
||||||
</Button>
|
<Link to="/setup/server/list">Changing Server</Link>
|
||||||
|
</Typography>
|
||||||
|
}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Container>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (users.isError) {
|
if (users.isError) {
|
||||||
return <ErrorNotice error="" />;
|
return <ErrorNotice />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,35 @@
|
|||||||
|
|
||||||
.user {
|
.user {
|
||||||
&List {
|
&-list {
|
||||||
|
&-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-flow: row wrap;
|
||||||
gap: 1em;
|
gap: 1em;
|
||||||
width: min(60vw, 45em);
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 30em;
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
scroll-snap-type: y mandatory;
|
||||||
|
margin: 2em 0;
|
||||||
}
|
}
|
||||||
&Card {
|
}
|
||||||
border-radius: $border-radius-default;
|
&-card {
|
||||||
display: flex;
|
width: fit-content;
|
||||||
flex-flow: column;
|
scroll-snap-align: start;
|
||||||
flex: 1 1 0px;
|
text-decoration: none !important;
|
||||||
|
color: white !important;
|
||||||
|
&-image{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
&-container{
|
||||||
|
aspect-ratio: 1;
|
||||||
|
width: 8em;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
border-radius: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
&Icon {
|
&Icon {
|
||||||
font-size: 5em;
|
font-size: 5em;
|
||||||
@@ -31,13 +50,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.login {
|
.login {
|
||||||
width: 100vw;
|
// width: 50em;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
|
&-container{
|
||||||
|
width: min(40em,80vw);
|
||||||
|
height: 100vh;
|
||||||
|
margin: auto;
|
||||||
|
padding-top: 4em;
|
||||||
|
padding-bottom: 4em;
|
||||||
|
}
|
||||||
|
|
||||||
&-form {
|
&-form {
|
||||||
width: 28em;
|
width: 28em;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ import ShowMoreText from "@/components/showMoreText";
|
|||||||
import "./person.scss";
|
import "./person.scss";
|
||||||
|
|
||||||
import IconLink from "@/components/iconLink";
|
import IconLink from "@/components/iconLink";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import { createFileRoute } from "@tanstack/react-router";
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
|
|
||||||
function TabPanel(props) {
|
function TabPanel(props) {
|
||||||
@@ -74,27 +76,18 @@ function PersonTitlePage() {
|
|||||||
const { id } = Route.useParams();
|
const { id } = Route.useParams();
|
||||||
const api = Route.useRouteContext().api;
|
const api = Route.useRouteContext().api;
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
enabled: Boolean(api),
|
|
||||||
});
|
|
||||||
|
|
||||||
const item = useQuery({
|
const item = useQuery({
|
||||||
queryKey: ["item", id],
|
queryKey: ["item", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: id,
|
itemId: id,
|
||||||
fields: [ItemFields.Crew],
|
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
});
|
});
|
||||||
@@ -103,7 +96,7 @@ function PersonTitlePage() {
|
|||||||
queryKey: ["item", id, "personMovies"],
|
queryKey: ["item", id, "personMovies"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
personIds: [id],
|
personIds: [id],
|
||||||
includeItemTypes: [BaseItemKind.Movie],
|
includeItemTypes: [BaseItemKind.Movie],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -120,7 +113,7 @@ function PersonTitlePage() {
|
|||||||
queryKey: ["item", id, "personShows"],
|
queryKey: ["item", id, "personShows"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
personIds: [id],
|
personIds: [id],
|
||||||
includeItemTypes: [BaseItemKind.Series],
|
includeItemTypes: [BaseItemKind.Series],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -138,7 +131,7 @@ function PersonTitlePage() {
|
|||||||
queryKey: ["item", id, "personBooks"],
|
queryKey: ["item", id, "personBooks"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
personIds: [id],
|
personIds: [id],
|
||||||
includeItemTypes: [BaseItemKind.Book],
|
includeItemTypes: [BaseItemKind.Book],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -155,7 +148,7 @@ function PersonTitlePage() {
|
|||||||
queryKey: ["item", id, "personPhotos"],
|
queryKey: ["item", id, "personPhotos"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
personIds: [id],
|
personIds: [id],
|
||||||
includeItemTypes: [BaseItemKind.Photo],
|
includeItemTypes: [BaseItemKind.Photo],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -171,7 +164,7 @@ function PersonTitlePage() {
|
|||||||
queryKey: ["item", id, "personEpisodes"],
|
queryKey: ["item", id, "personEpisodes"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
personIds: [id],
|
personIds: [id],
|
||||||
includeItemTypes: [BaseItemKind.Episode],
|
includeItemTypes: [BaseItemKind.Episode],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -319,10 +312,14 @@ function PersonTitlePage() {
|
|||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 90,
|
quality: 90,
|
||||||
tag: item.data.ImageTags.Primary,
|
tag: item.data.ImageTags.Primary,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = 1;
|
||||||
}}
|
}}
|
||||||
@@ -343,7 +340,7 @@ function PersonTitlePage() {
|
|||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isFavorite={item.data.UserData.IsFavorite}
|
isFavorite={item.data.UserData.IsFavorite}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -480,7 +477,7 @@ function PersonTitlePage() {
|
|||||||
: "portrait"
|
: "portrait"
|
||||||
}
|
}
|
||||||
queryKey={tab.queryKey}
|
queryKey={tab.queryKey}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!tabitem.ImageBlurHashes?.Primary &&
|
!!tabitem.ImageBlurHashes?.Primary &&
|
||||||
tabitem.ImageBlurHashes?.Primary[
|
tabitem.ImageBlurHashes?.Primary[
|
||||||
|
|||||||
@@ -48,15 +48,19 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 1em;
|
|
||||||
margin-top: 2em;
|
margin-top: 2em;
|
||||||
&-track {
|
&-track {
|
||||||
|
padding: 1em;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 3em 1fr 6em;
|
grid-template-columns: 3em 1fr 6em;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
gap: 1em;
|
gap: 1em;
|
||||||
|
.material-symbols-rounded{
|
||||||
|
cursor: grab;
|
||||||
|
}
|
||||||
&-info-name {
|
&-info-name {
|
||||||
transition: $transition-time-fast;
|
transition: $transition-time-fast;
|
||||||
}
|
}
|
||||||
@@ -66,11 +70,17 @@
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&.dragging {
|
||||||
|
background: black;
|
||||||
|
border-radius: 10px;
|
||||||
|
width: calc(100% + 2em);
|
||||||
|
cursor: grabbing;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&-lyrics {
|
&-lyrics {
|
||||||
max-height: 40vh;
|
max-height: 40vh;
|
||||||
overflow:visible;
|
overflow: visible;
|
||||||
background: rgb(255 255 255 / 0.05);
|
background: rgb(255 255 255 / 0.05);
|
||||||
// border: 1px solid rgb(255 255 255 / 0.2);
|
// border: 1px solid rgb(255 255 255 / 0.2);
|
||||||
padding: 2em;
|
padding: 2em;
|
||||||
|
|||||||
@@ -1,25 +1,40 @@
|
|||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { useAudioPlayback } from "@/utils/store/audioPlayback";
|
import { useAudioPlayback } from "@/utils/store/audioPlayback";
|
||||||
import useQueue from "@/utils/store/queue";
|
import useQueue, { setQueue } from "@/utils/store/queue";
|
||||||
import { Fab, IconButton, Slider, Typography } from "@mui/material";
|
import { Fab, IconButton, Slider, Typography } from "@mui/material";
|
||||||
import { createFileRoute } from "@tanstack/react-router";
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
import React, {
|
import React, { useEffect, useMemo, useRef, useState } from "react";
|
||||||
useCallback,
|
|
||||||
useEffect,
|
|
||||||
useMemo,
|
|
||||||
useRef,
|
|
||||||
useState,
|
|
||||||
} from "react";
|
|
||||||
|
|
||||||
import "./audio.scss";
|
import "./audio.scss";
|
||||||
import LikeButton from "@/components/buttons/likeButton";
|
|
||||||
import PlayNextButton from "@/components/buttons/playNextButton";
|
import PlayNextButton from "@/components/buttons/playNextButton";
|
||||||
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
||||||
import QueueTrack from "@/components/queueTrack";
|
import QueueTrack from "@/components/queueTrack";
|
||||||
import { getRuntimeMusic, secToTicks, ticksToSec } from "@/utils/date/time";
|
import { getRuntimeMusic, secToTicks, ticksToSec } from "@/utils/date/time";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import { getLyricsApi } from "@jellyfin/sdk/lib/utils/api/lyrics-api";
|
import { getLyricsApi } from "@jellyfin/sdk/lib/utils/api/lyrics-api";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
import {
|
||||||
|
DndContext,
|
||||||
|
type DragEndEvent,
|
||||||
|
DragOverlay,
|
||||||
|
KeyboardSensor,
|
||||||
|
PointerSensor,
|
||||||
|
closestCenter,
|
||||||
|
useSensor,
|
||||||
|
useSensors,
|
||||||
|
} from "@dnd-kit/core";
|
||||||
|
import {
|
||||||
|
restrictToVerticalAxis,
|
||||||
|
restrictToWindowEdges,
|
||||||
|
} from "@dnd-kit/modifiers";
|
||||||
|
import {
|
||||||
|
SortableContext,
|
||||||
|
arrayMove,
|
||||||
|
sortableKeyboardCoordinates,
|
||||||
|
verticalListSortingStrategy,
|
||||||
|
} from "@dnd-kit/sortable";
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/player/audio")({
|
export const Route = createFileRoute("/_api/player/audio")({
|
||||||
component: AudioPlayerRoute,
|
component: AudioPlayerRoute,
|
||||||
});
|
});
|
||||||
@@ -29,11 +44,19 @@ const SEEK_AMOUNT = 10; // seconds to skip on fast_rewind or fast_forward button
|
|||||||
function AudioPlayerRoute() {
|
function AudioPlayerRoute() {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const [queue, currentTrack] = useQueue((s) => [s.tracks, s.currentItemIndex]);
|
const [queue, currentTrack] = useQueue((s) => [s.tracks, s.currentItemIndex]);
|
||||||
const [item] = useAudioPlayback((s) => [s.item]);
|
const [item, audioPlayerRef] = useAudioPlayback((s) => [
|
||||||
const audioPlayer: HTMLAudioElement | null = useMemo(
|
s.item,
|
||||||
() => document.querySelector("#audio-player"),
|
s.player.ref,
|
||||||
[item],
|
]);
|
||||||
|
const [audioPlayer, setAudioPlayer] = useState<HTMLAudioElement | null>(
|
||||||
|
audioPlayerRef?.current,
|
||||||
);
|
);
|
||||||
|
useEffect(() => {
|
||||||
|
console.log(audioPlayerRef);
|
||||||
|
setAudioPlayer(audioPlayerRef.current);
|
||||||
|
}, [audioPlayerRef?.current]);
|
||||||
|
|
||||||
|
console.log(audioPlayer?.paused);
|
||||||
|
|
||||||
const [isScrubbing, setIsScrubbing] = useState(false);
|
const [isScrubbing, setIsScrubbing] = useState(false);
|
||||||
const [sliderProgress, setSliderProgress] = useState<number | number[]>(0); // this state hold the slider scrubbing value allowing user to scrub track without changing current time
|
const [sliderProgress, setSliderProgress] = useState<number | number[]>(0); // this state hold the slider scrubbing value allowing user to scrub track without changing current time
|
||||||
@@ -55,10 +78,14 @@ function AudioPlayerRoute() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
audioPlayer?.addEventListener("timeupdate", () => {
|
audioPlayerRef?.current?.addEventListener("timeupdate", () => {
|
||||||
setProgress(audioPlayer.currentTime ?? 0);
|
setProgress(audioPlayerRef?.current?.currentTime ?? 0);
|
||||||
});
|
});
|
||||||
console.log(audioPlayer);
|
return () => {
|
||||||
|
audioPlayerRef?.current?.removeEventListener("timeupdate", () => {
|
||||||
|
setProgress(audioPlayerRef?.current?.currentTime ?? 0);
|
||||||
|
});
|
||||||
|
};
|
||||||
}, [item?.Id, currentTrack]);
|
}, [item?.Id, currentTrack]);
|
||||||
|
|
||||||
const lyricsContainer = useRef<HTMLDivElement | null>(null);
|
const lyricsContainer = useRef<HTMLDivElement | null>(null);
|
||||||
@@ -73,20 +100,52 @@ function AudioPlayerRoute() {
|
|||||||
}
|
}
|
||||||
}, [showLyrics, audioPlayer?.currentTime]);
|
}, [showLyrics, audioPlayer?.currentTime]);
|
||||||
|
|
||||||
|
const sensors = useSensors(
|
||||||
|
useSensor(PointerSensor),
|
||||||
|
useSensor(KeyboardSensor, {
|
||||||
|
coordinateGetter: sortableKeyboardCoordinates,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
const handleDragEnd = (event: DragEndEvent) => {
|
||||||
|
const { active, over } = event;
|
||||||
|
if (active.id !== over?.id) {
|
||||||
|
const prevState = queue;
|
||||||
|
const oldIndex = prevState?.map((item) => item.Id).indexOf(active.id);
|
||||||
|
const newIndex = prevState?.map((item) => item.Id).indexOf(over.id);
|
||||||
|
|
||||||
|
const newState = prevState
|
||||||
|
? arrayMove(prevState, oldIndex, newIndex)
|
||||||
|
: prevState;
|
||||||
|
|
||||||
|
const currentTrack = newState?.map((item) => item.Id).indexOf(item?.Id);
|
||||||
|
|
||||||
|
setQueue(newState, currentTrack);
|
||||||
|
// setQueue(newState);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const [currentDraggingIndex, setCurrentDraggingIndex] = useState<
|
||||||
|
number | null
|
||||||
|
>(null);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="scrollY padded-top flex flex-column"
|
className="scrollY padded-top flex flex-column"
|
||||||
style={{ gap: "1em" }}
|
style={{ gap: "1em" }}
|
||||||
key={queue[currentTrack]?.Id}
|
key={item?.Id}
|
||||||
>
|
>
|
||||||
<div className="audio-info-container">
|
<div className="audio-info-container">
|
||||||
<div className="audio-info-image-container">
|
<div className="audio-info-image-container">
|
||||||
{item?.ImageTags?.Primary ? (
|
{item?.ImageTags?.Primary ? (
|
||||||
<img
|
<img
|
||||||
alt={item.Name ?? "Music"}
|
alt={item.Name ?? "Music"}
|
||||||
src={api.getItemImageUrl(item.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.Id ?? "",
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
tag: item.ImageTags.Primary,
|
tag: item.ImageTags.Primary,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
className="audio-info-image"
|
className="audio-info-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -117,6 +176,7 @@ function AudioPlayerRoute() {
|
|||||||
value={isScrubbing ? sliderProgress : secToTicks(progress)}
|
value={isScrubbing ? sliderProgress : secToTicks(progress)}
|
||||||
max={item?.RunTimeTicks ?? 1}
|
max={item?.RunTimeTicks ?? 1}
|
||||||
step={1}
|
step={1}
|
||||||
|
key={item?.Id}
|
||||||
onChange={(_, newVal) => {
|
onChange={(_, newVal) => {
|
||||||
setIsScrubbing(true);
|
setIsScrubbing(true);
|
||||||
setSliderProgress(newVal);
|
setSliderProgress(newVal);
|
||||||
@@ -126,9 +186,11 @@ function AudioPlayerRoute() {
|
|||||||
Array.isArray(newVal)
|
Array.isArray(newVal)
|
||||||
? setProgress(ticksToSec(newVal[0]))
|
? setProgress(ticksToSec(newVal[0]))
|
||||||
: setProgress(ticksToSec(newVal));
|
: setProgress(ticksToSec(newVal));
|
||||||
audioPlayer?.currentTime = Array.isArray(newVal)
|
if (audioPlayerRef?.current) {
|
||||||
|
audioPlayerRef.current.currentTime = Array.isArray(newVal)
|
||||||
? ticksToSec(newVal[0])
|
? ticksToSec(newVal[0])
|
||||||
: ticksToSec(newVal);
|
: ticksToSec(newVal);
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
sx={{
|
sx={{
|
||||||
"& .MuiSlider-thumb": {
|
"& .MuiSlider-thumb": {
|
||||||
@@ -167,19 +229,22 @@ function AudioPlayerRoute() {
|
|||||||
<PlayPreviousButton />
|
<PlayPreviousButton />
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
audioPlayer?.currentTime -= SEEK_AMOUNT;
|
if (audioPlayer) {
|
||||||
|
audioPlayer.currentTime -= SEEK_AMOUNT;
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span className="material-symbols-rounded">fast_rewind</span>
|
<span className="material-symbols-rounded">fast_rewind</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<Fab
|
<Fab
|
||||||
disabled={!audioPlayer?.readyState}
|
disabled={!audioPlayerRef?.current?.readyState}
|
||||||
|
//@ts-ignore
|
||||||
color="white"
|
color="white"
|
||||||
size="large"
|
size="large"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
audioPlayer?.paused
|
audioPlayerRef?.current?.paused
|
||||||
? audioPlayer.play()
|
? audioPlayerRef?.current?.play()
|
||||||
: audioPlayer?.pause()
|
: audioPlayerRef?.current?.pause()
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
@@ -188,12 +253,14 @@ function AudioPlayerRoute() {
|
|||||||
fontSize: "2.4em",
|
fontSize: "2.4em",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{audioPlayer?.paused ? "play_arrow" : "pause"}
|
{audioPlayerRef?.current?.paused ? "play_arrow" : "pause"}
|
||||||
</span>
|
</span>
|
||||||
</Fab>
|
</Fab>
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
audioPlayer?.currentTime += SEEK_AMOUNT;
|
if (audioPlayer) {
|
||||||
|
audioPlayer.currentTime += SEEK_AMOUNT;
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span className="material-symbols-rounded">fast_forward</span>
|
<span className="material-symbols-rounded">fast_forward</span>
|
||||||
@@ -227,7 +294,7 @@ function AudioPlayerRoute() {
|
|||||||
className="audio-lyrics-line"
|
className="audio-lyrics-line"
|
||||||
key={`${lyric.Text}${index}`}
|
key={`${lyric.Text}${index}`}
|
||||||
data-active-lyric={
|
data-active-lyric={
|
||||||
secToTicks(audioPlayer?.currentTime) >= lyric.Start &&
|
secToTicks(audioPlayer?.currentTime) >= (lyric.Start ?? 0) &&
|
||||||
secToTicks(audioPlayer?.currentTime) <
|
secToTicks(audioPlayer?.currentTime) <
|
||||||
(lyrics.data?.[0]?.Lyrics?.Lyrics?.[index + 1]?.Start ?? 0)
|
(lyrics.data?.[0]?.Lyrics?.Lyrics?.[index + 1]?.Start ?? 0)
|
||||||
}
|
}
|
||||||
@@ -252,14 +319,58 @@ function AudioPlayerRoute() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
<DndContext
|
||||||
|
sensors={sensors}
|
||||||
|
collisionDetection={closestCenter}
|
||||||
|
onDragEnd={handleDragEnd}
|
||||||
|
onDragStart={(event) => {
|
||||||
|
const { active } = event;
|
||||||
|
setCurrentDraggingIndex(
|
||||||
|
queue?.map((item) => item.Id).indexOf(active.id),
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
modifiers={[restrictToVerticalAxis]}
|
||||||
|
>
|
||||||
|
{queue && (
|
||||||
<div className="audio-queue-container">
|
<div className="audio-queue-container">
|
||||||
<Typography variant="h5">Queue:</Typography>
|
<Typography variant="h5">Queue:</Typography>
|
||||||
|
<SortableContext
|
||||||
|
items={queue?.map((track) => track.Id)}
|
||||||
|
strategy={verticalListSortingStrategy}
|
||||||
|
>
|
||||||
<div className="audio-queue">
|
<div className="audio-queue">
|
||||||
{queue.map((track, index) => (
|
{queue?.map((track, index) => (
|
||||||
<QueueTrack key={track.Id} track={track} index={index} />
|
<QueueTrack key={track.Id} track={track} index={index} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
</SortableContext>
|
||||||
|
<DragOverlay modifiers={[restrictToWindowEdges]}>
|
||||||
|
{(currentDraggingIndex ?? -1) >= 0 && (
|
||||||
|
<div className="audio-queue-track dragging">
|
||||||
|
<span className="material-symbols-rounded">drag_handle</span>
|
||||||
|
<div className="audio-queue-track-info">
|
||||||
|
<Typography className="audio-queue-track-info-name">
|
||||||
|
{queue[currentDraggingIndex].Name}
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
fontWeight={300}
|
||||||
|
className="opacity-07"
|
||||||
|
variant="subtitle2"
|
||||||
|
>
|
||||||
|
{queue[currentDraggingIndex].Artists?.join(", ")}
|
||||||
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
|
<Typography className="opacity-07">
|
||||||
|
{getRuntimeMusic(
|
||||||
|
queue[currentDraggingIndex].RunTimeTicks ?? 0,
|
||||||
|
)}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</DragOverlay>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</DndContext>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { WebviewWindow as appWindow } from "@tauri-apps/api/webviewWindow";
|
import { WebviewWindow as appWindow } from "@tauri-apps/api/webviewWindow";
|
||||||
import React from "react";
|
import React, { type ChangeEventHandler, useTransition } from "react";
|
||||||
import { useLayoutEffect, useMemo } from "react";
|
import { useLayoutEffect, useMemo } from "react";
|
||||||
|
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
@@ -13,6 +13,7 @@ import ReactPlayer from "react-player";
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
changeSubtitleTrack,
|
changeSubtitleTrack,
|
||||||
|
playItemFromQueue,
|
||||||
toggleSubtitleTrack,
|
toggleSubtitleTrack,
|
||||||
usePlaybackStore,
|
usePlaybackStore,
|
||||||
} from "@/utils/store/playback";
|
} from "@/utils/store/playback";
|
||||||
@@ -33,7 +34,7 @@ import {
|
|||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { AnimatePresence, motion } from "framer-motion";
|
import { AnimatePresence, motion } from "framer-motion";
|
||||||
|
|
||||||
import { setBackdrop } from "@/utils/store/backdrop";
|
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||||
|
|
||||||
import { Button, LinearProgress, TextField } from "@mui/material";
|
import { Button, LinearProgress, TextField } from "@mui/material";
|
||||||
import JASSUB from "jassub";
|
import JASSUB from "jassub";
|
||||||
@@ -47,10 +48,14 @@ import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
|||||||
import QueueButton from "@/components/buttons/queueButton";
|
import QueueButton from "@/components/buttons/queueButton";
|
||||||
import OutroCard from "@/components/outroCard";
|
import OutroCard from "@/components/outroCard";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import useQueue from "@/utils/store/queue";
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
import useQueue, { clearQueue } from "@/utils/store/queue";
|
||||||
import { createFileRoute, useRouter } from "@tanstack/react-router";
|
import { createFileRoute, useRouter } from "@tanstack/react-router";
|
||||||
import { toNumber } from "lodash";
|
import { toNumber } from "lodash";
|
||||||
import type { OnProgressProps } from "react-player/base";
|
import type { OnProgressProps } from "react-player/base";
|
||||||
|
import type { TrackProps } from "react-player/file";
|
||||||
|
|
||||||
|
import font from "./Noto-Sans-Indosphere.ttf?url";
|
||||||
|
|
||||||
const ticksDisplay = (ticks: number) => {
|
const ticksDisplay = (ticks: number) => {
|
||||||
const time = Math.round(ticks / 10000);
|
const time = Math.round(ticks / 10000);
|
||||||
@@ -75,17 +80,58 @@ const ticksDisplay = (ticks: number) => {
|
|||||||
};
|
};
|
||||||
const VOLUME_SCROLL_INTERVAL = 0.02;
|
const VOLUME_SCROLL_INTERVAL = 0.02;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is used to add a subtitle track (.vtt and .srt) to the react player instance.
|
||||||
|
*/
|
||||||
|
function addSubtitleTrackToReactPlayer(
|
||||||
|
videoElem: HTMLMediaElement,
|
||||||
|
subtitleTracks,
|
||||||
|
baseUrl: string,
|
||||||
|
) {
|
||||||
|
if (subtitleTracks.url && subtitleTracks.allTracks) {
|
||||||
|
const reqSubTrack = subtitleTracks.allTracks.filter(
|
||||||
|
(val) => val.Index === subtitleTracks.track,
|
||||||
|
);
|
||||||
|
const track = document.createElement("track");
|
||||||
|
track.src = `${baseUrl}${subtitleTracks.url}`;
|
||||||
|
track.kind = "subtitles";
|
||||||
|
track.srclang = reqSubTrack[0].Language ?? "en";
|
||||||
|
track.label = reqSubTrack[0].DisplayTitle ?? "Subtitle";
|
||||||
|
track.default = true;
|
||||||
|
|
||||||
|
track.addEventListener("load", () => {
|
||||||
|
console.log("Track loaded");
|
||||||
|
const a = track.track;
|
||||||
|
a.mode = "showing";
|
||||||
|
});
|
||||||
|
track.addEventListener("error", (e) => {
|
||||||
|
console.error(e);
|
||||||
|
});
|
||||||
|
|
||||||
|
videoElem.appendChild(track);
|
||||||
|
|
||||||
|
for (const i of videoElem.textTracks) {
|
||||||
|
if (i.label === reqSubTrack[0].DisplayTitle) {
|
||||||
|
i.mode = "showing";
|
||||||
|
} else {
|
||||||
|
i.mode = "hidden";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/player/")({
|
export const Route = createFileRoute("/_api/player/")({
|
||||||
component: VideoPlayer,
|
component: VideoPlayer,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function VideoPlayer() {
|
function VideoPlayer() {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const { history } = useRouter();
|
const { history } = useRouter();
|
||||||
const [hoveringOsd, setHoveringOsd] = useState(false);
|
const [hoveringOsd, setHoveringOsd] = useState(false);
|
||||||
const player = useRef<ReactPlayer | null>(null);
|
const player = useRef<ReactPlayer | null>(null);
|
||||||
|
|
||||||
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
|
|
||||||
const [
|
const [
|
||||||
playbackStream,
|
playbackStream,
|
||||||
item,
|
item,
|
||||||
@@ -130,6 +176,7 @@ function VideoPlayer() {
|
|||||||
const [volume, setVolume] = useState(1);
|
const [volume, setVolume] = useState(1);
|
||||||
const [muted, setMuted] = useState(false);
|
const [muted, setMuted] = useState(false);
|
||||||
|
|
||||||
|
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||||
useEffect(() => setBackdrop("", ""), []);
|
useEffect(() => setBackdrop("", ""), []);
|
||||||
|
|
||||||
const [clickTimeout, setClickTimeout] = useState<NodeJS.Timeout>(null!);
|
const [clickTimeout, setClickTimeout] = useState<NodeJS.Timeout>(null!);
|
||||||
@@ -194,6 +241,7 @@ function VideoPlayer() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
usePlaybackStore.setState(usePlaybackStore.getInitialState());
|
usePlaybackStore.setState(usePlaybackStore.getInitialState());
|
||||||
|
clearQueue();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleShowOsd = () => {
|
const handleShowOsd = () => {
|
||||||
@@ -247,7 +295,6 @@ function VideoPlayer() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// attach the event listener
|
// attach the event listener
|
||||||
document.addEventListener("keydown", handleKeyPress);
|
document.addEventListener("keydown", handleKeyPress);
|
||||||
@@ -258,6 +305,7 @@ function VideoPlayer() {
|
|||||||
};
|
};
|
||||||
}, [handleKeyPress]);
|
}, [handleKeyPress]);
|
||||||
|
|
||||||
|
// Volume control with mouse wheel
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleMouseWheel = (event: WheelEvent) => {
|
const handleMouseWheel = (event: WheelEvent) => {
|
||||||
if (event.deltaY < 0) {
|
if (event.deltaY < 0) {
|
||||||
@@ -278,44 +326,59 @@ function VideoPlayer() {
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// Set playing state to true when a new item is loaded
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
setPlaying(true);
|
setPlaying(true);
|
||||||
setIsReady(false);
|
setIsReady(false);
|
||||||
}, [item?.Id]);
|
}, [item?.Id]);
|
||||||
|
|
||||||
const reactPlayerCaptions = useMemo(() => {
|
|
||||||
if (
|
|
||||||
(mediaSource.subtitle.format === "vtt" ||
|
|
||||||
mediaSource.subtitle.format === "subrip") &&
|
|
||||||
mediaSource.subtitle.enable
|
|
||||||
) {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
kind: "subtitles",
|
|
||||||
src: `${api.basePath}${mediaSource.subtitle.url}`,
|
|
||||||
srcLang: "en",
|
|
||||||
default: true,
|
|
||||||
label: mediaSource.subtitle.url,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
}, [mediaSource.subtitle.track, mediaSource.subtitle.enable]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log(mediaSource.subtitle.enable);
|
||||||
|
|
||||||
if (player.current?.getInternalPlayer() && mediaSource.subtitle.enable) {
|
if (player.current?.getInternalPlayer() && mediaSource.subtitle.enable) {
|
||||||
|
let jassubRenderer: JASSUB | undefined;
|
||||||
if (
|
if (
|
||||||
mediaSource.subtitle.format === "ass" ||
|
mediaSource.subtitle.format === "ass" ||
|
||||||
mediaSource.subtitle.format === "ssa"
|
mediaSource.subtitle.format === "ssa"
|
||||||
) {
|
) {
|
||||||
const jassubRenderer = new JASSUB({
|
jassubRenderer = new JASSUB({
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
video: player.current?.getInternalPlayer(),
|
video: player.current?.getInternalPlayer(),
|
||||||
workerUrl,
|
workerUrl,
|
||||||
wasmUrl,
|
wasmUrl,
|
||||||
subUrl: `${api.basePath}${mediaSource.subtitle.url}`,
|
subUrl: `${api.basePath}${mediaSource.subtitle.url}`,
|
||||||
|
availableFonts: { "noto sans": font },
|
||||||
|
fallbackFont: "noto sans",
|
||||||
});
|
});
|
||||||
return () => jassubRenderer.destroy(); // Remove JASSUB renderer when track changes to fix duplicate renders
|
} else if (
|
||||||
|
mediaSource.subtitle.format === "subrip" ||
|
||||||
|
mediaSource.subtitle.format === "vtt"
|
||||||
|
) {
|
||||||
|
// @ts-ignore internalPlayer here provides the HTML video player element
|
||||||
|
const videoElem: HTMLMediaElement =
|
||||||
|
player.current.getInternalPlayer() as HTMLMediaElement;
|
||||||
|
addSubtitleTrackToReactPlayer(
|
||||||
|
player.current.getInternalPlayer() as HTMLMediaElement,
|
||||||
|
mediaSource.subtitle,
|
||||||
|
api.basePath,
|
||||||
|
);
|
||||||
|
console.log(videoElem.textTracks);
|
||||||
|
}
|
||||||
|
return () => {
|
||||||
|
if (jassubRenderer) {
|
||||||
|
jassubRenderer.destroy();
|
||||||
|
} // Remove JASSUB renderer when track changes to fix duplicate renders
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
player.current?.getInternalPlayer() &&
|
||||||
|
mediaSource.subtitle.enable === false
|
||||||
|
) {
|
||||||
|
// @ts-ignore internalPlayer here provides the HTML video player element
|
||||||
|
const videoElem: HTMLMediaElement =
|
||||||
|
player.current.getInternalPlayer() as HTMLMediaElement;
|
||||||
|
for (const i of videoElem.textTracks) {
|
||||||
|
i.mode = "hidden";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
@@ -520,6 +583,27 @@ function VideoPlayer() {
|
|||||||
return () => clearTimeout(timeout);
|
return () => clearTimeout(timeout);
|
||||||
}, [volume]);
|
}, [volume]);
|
||||||
|
|
||||||
|
const handlePlaybackEnded = () => {
|
||||||
|
if (queue[currentQueueItemIndex + 1].Id) {
|
||||||
|
playItemFromQueue("next", user?.Id, api);
|
||||||
|
} else {
|
||||||
|
handleExitPlayer(); // Exit player if playback has finished and the queue is empty
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const [subtitleIsChanging, startSubtitleChange] = useTransition();
|
||||||
|
const handleSubtitleChange = (
|
||||||
|
e: ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>,
|
||||||
|
) => {
|
||||||
|
startSubtitleChange(() => {
|
||||||
|
if (mediaSource.subtitle.allTracks) {
|
||||||
|
changeSubtitleTrack(toNumber(e.target.value), mediaSource.subtitle.allTracks);
|
||||||
|
console.log(mediaSource.subtitle);
|
||||||
|
setSettingsMenu(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="video-player">
|
<div className="video-player">
|
||||||
<AnimatePresence>
|
<AnimatePresence>
|
||||||
@@ -654,16 +738,9 @@ function VideoPlayer() {
|
|||||||
label="Subtitles"
|
label="Subtitles"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
value={mediaSource.subtitle.track}
|
value={mediaSource.subtitle.track}
|
||||||
onChange={(e) => {
|
onChange={handleSubtitleChange}
|
||||||
if (mediaSource.subtitle.allTracks) {
|
|
||||||
changeSubtitleTrack(
|
|
||||||
toNumber(e.target.value),
|
|
||||||
mediaSource.subtitle.allTracks,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
fullWidth
|
fullWidth
|
||||||
disabled={mediaSource.subtitle.track === -2}
|
disabled={mediaSource.subtitle.track === -2 || subtitleIsChanging}
|
||||||
>
|
>
|
||||||
<MenuItem key={-1} value={-1}>
|
<MenuItem key={-1} value={-1}>
|
||||||
No Subtitle
|
No Subtitle
|
||||||
@@ -836,8 +913,10 @@ function VideoPlayer() {
|
|||||||
</IconButton>
|
</IconButton>
|
||||||
<QueueButton />
|
<QueueButton />
|
||||||
<IconButton
|
<IconButton
|
||||||
disabled={mediaSource.subtitle.track === -2}
|
disabled={
|
||||||
onClick={toggleSubtitleTrack}
|
mediaSource.subtitle.track === -2 || subtitleIsChanging
|
||||||
|
}
|
||||||
|
onClick={() => startSubtitleChange(toggleSubtitleTrack)}
|
||||||
>
|
>
|
||||||
<span className={"material-symbols-rounded"}>
|
<span className={"material-symbols-rounded"}>
|
||||||
{mediaSource.subtitle.enable
|
{mediaSource.subtitle.enable
|
||||||
@@ -864,7 +943,7 @@ function VideoPlayer() {
|
|||||||
)}
|
)}
|
||||||
</motion.div>
|
</motion.div>
|
||||||
<ReactPlayer
|
<ReactPlayer
|
||||||
key={item?.Id}
|
key={`${item?.Id}${mediaSource.id}`}
|
||||||
playing={playing}
|
playing={playing}
|
||||||
url={playbackStream}
|
url={playbackStream}
|
||||||
ref={player}
|
ref={player}
|
||||||
@@ -875,24 +954,25 @@ function VideoPlayer() {
|
|||||||
console.error(hls);
|
console.error(hls);
|
||||||
console.error(hlsG);
|
console.error(hlsG);
|
||||||
}}
|
}}
|
||||||
|
onEnded={handlePlaybackEnded}
|
||||||
width="100vw"
|
width="100vw"
|
||||||
height="100vh"
|
height="100vh"
|
||||||
style={{
|
style={{
|
||||||
position: "fixed",
|
position: "fixed",
|
||||||
zIndex: 1,
|
zIndex: 1,
|
||||||
}}
|
}}
|
||||||
config={{
|
|
||||||
file: {
|
|
||||||
attributes: {
|
|
||||||
crossOrigin: "true",
|
|
||||||
},
|
|
||||||
tracks: reactPlayerCaptions,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
volume={muted ? 0 : volume}
|
volume={muted ? 0 : volume}
|
||||||
onReady={handleReady}
|
onReady={handleReady}
|
||||||
onBuffer={() => setLoading(true)}
|
onBuffer={() => setLoading(true)}
|
||||||
onBufferEnd={() => setLoading(false)}
|
onBufferEnd={() => setLoading(false)}
|
||||||
|
config={{
|
||||||
|
file: {
|
||||||
|
attributes: {
|
||||||
|
crossOrigin: "anonymous",
|
||||||
|
},
|
||||||
|
tracks: [],
|
||||||
|
},
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
.photos {
|
||||||
|
background: black;
|
||||||
|
overflow: hidden;
|
||||||
|
height: 100vh;
|
||||||
|
&-currentPhoto {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
&-overlay {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100vw;
|
||||||
|
z-index: 1;
|
||||||
|
opacity: 0.5;
|
||||||
|
transform: translateY(80%);
|
||||||
|
transition: $transition-time-default;
|
||||||
|
will-change: opacity, transform;
|
||||||
|
&:hover {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&-preview {
|
||||||
|
// width: 10vw;
|
||||||
|
height: 10vh;
|
||||||
|
object-fit: cover;
|
||||||
|
border: 2px;
|
||||||
|
border: 2px solid transparent;
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: border $transition-time-default, filter $transition-time-default;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
filter: brightness(1.2) !important;
|
||||||
|
}
|
||||||
|
&-container {
|
||||||
|
width: 90vw;
|
||||||
|
overflow-y: hidden;
|
||||||
|
overflow-x: auto;
|
||||||
|
display: flex;
|
||||||
|
gap: 4px;
|
||||||
|
margin: 0 auto;
|
||||||
|
bottom: 0;
|
||||||
|
left: 5vw;
|
||||||
|
&:hover .photos-preview {
|
||||||
|
filter: brightness(0.7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.active {
|
||||||
|
border-color: $clr-accent-default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&-actions {
|
||||||
|
position: fixed;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 1em;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { usePhotosPlayback } from "@/utils/store/photosPlayback";
|
||||||
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
|
import React, { type MouseEvent, useCallback, useMemo, useState } from "react";
|
||||||
|
|
||||||
|
import { AnimatePresence, motion } from "framer-motion";
|
||||||
|
//@ts-ignore
|
||||||
|
import brokenImage from "/assetsStatic/broken-image.png?url";
|
||||||
|
|
||||||
|
import { save } from "@tauri-apps/plugin-dialog";
|
||||||
|
|
||||||
|
import "./photos.scss";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
CircularProgress,
|
||||||
|
IconButton,
|
||||||
|
ListItemIcon,
|
||||||
|
ListItemText,
|
||||||
|
Menu,
|
||||||
|
MenuItem,
|
||||||
|
} from "@mui/material";
|
||||||
|
import { download } from "@tauri-apps/plugin-upload";
|
||||||
|
import { useSnackbar } from "notistack";
|
||||||
|
|
||||||
|
export const Route = createFileRoute("/_api/player/photos")({
|
||||||
|
component: PhotosPlayer,
|
||||||
|
});
|
||||||
|
|
||||||
|
function PhotosPlayer() {
|
||||||
|
const api = useApiInContext((s) => s.api);
|
||||||
|
const [photos, startIndex] = usePhotosPlayback((s) => [s.photos, s.index]);
|
||||||
|
const [currentIndex, setCurrentIndex] = useState(startIndex);
|
||||||
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
|
const currentPhoto = useMemo(
|
||||||
|
() => photos?.[currentIndex],
|
||||||
|
[photos, currentIndex],
|
||||||
|
);
|
||||||
|
const allPhotos = useMemo(
|
||||||
|
() =>
|
||||||
|
photos?.map((item, index) => (
|
||||||
|
<div
|
||||||
|
onClick={() => setCurrentIndex(index)}
|
||||||
|
key={item?.Id ?? "noPhoto"}
|
||||||
|
className={
|
||||||
|
index === currentIndex ? "photos-preview active" : "photos-preview"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src={
|
||||||
|
item.Id
|
||||||
|
? getImageUrlsApi(api).getItemImageUrlById(item.Id, "Primary", {
|
||||||
|
// width: 250,
|
||||||
|
fillWidth: 250,
|
||||||
|
quality: 70,
|
||||||
|
})
|
||||||
|
: brokenImage
|
||||||
|
}
|
||||||
|
style={{
|
||||||
|
width: "auto",
|
||||||
|
height: "100%",
|
||||||
|
borderRadius: "2px",
|
||||||
|
}}
|
||||||
|
alt="Item"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)),
|
||||||
|
[photos, currentIndex],
|
||||||
|
);
|
||||||
|
|
||||||
|
const handlePhotosChangePrev = useCallback(() => {
|
||||||
|
setCurrentIndex(currentIndex - 1);
|
||||||
|
}, [currentIndex]);
|
||||||
|
const handlePhotosChangeNext = useCallback(() => {
|
||||||
|
setCurrentIndex(currentIndex + 1);
|
||||||
|
}, [currentIndex]);
|
||||||
|
|
||||||
|
const [contextMenu, setContextMenu] = useState<{
|
||||||
|
mouseX: number;
|
||||||
|
mouseY: number;
|
||||||
|
} | null>(null);
|
||||||
|
const handleShowContextMenu = (e: MouseEvent) => {
|
||||||
|
e.preventDefault();
|
||||||
|
if (contextMenu === null) {
|
||||||
|
setContextMenu({ mouseX: e.clientX + 2, mouseY: e.clientY - 6 });
|
||||||
|
} else {
|
||||||
|
setContextMenu(null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleContextMenuClose = useCallback(() => {
|
||||||
|
setContextMenu(null);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleImageDownload = useCallback(async () => {
|
||||||
|
const pathToSave = await save({
|
||||||
|
filters: [
|
||||||
|
{
|
||||||
|
name: "Image",
|
||||||
|
extensions: ["png", "jpeg"],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
if (pathToSave) {
|
||||||
|
download(
|
||||||
|
`${api.basePath}/Items/${currentPhoto?.Id}/Download?api_key=${api.accessToken}`,
|
||||||
|
pathToSave,
|
||||||
|
);
|
||||||
|
enqueueSnackbar("Image download queued.", { variant: "info" });
|
||||||
|
}
|
||||||
|
}, [currentIndex]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="photos">
|
||||||
|
<AnimatePresence mode="wait">
|
||||||
|
<motion.img
|
||||||
|
initial={{ opacity: 0 }}
|
||||||
|
animate={{ opacity: 1 }}
|
||||||
|
exit={{ opacity: 0 }}
|
||||||
|
key={currentPhoto?.Id ?? "noPhoto"}
|
||||||
|
src={
|
||||||
|
currentPhoto
|
||||||
|
? `${api.basePath}/Items/${currentPhoto.Id}/Download?api_key=${api.accessToken}`
|
||||||
|
: brokenImage
|
||||||
|
}
|
||||||
|
alt="Item"
|
||||||
|
transition={{ duration: 0.1 }}
|
||||||
|
className="photos-currentPhoto"
|
||||||
|
/>
|
||||||
|
</AnimatePresence>
|
||||||
|
<div className="photos-actions" onContextMenu={handleShowContextMenu}>
|
||||||
|
<IconButton onClick={handlePhotosChangePrev}>
|
||||||
|
<span className="material-symbols-rounded">chevron_left</span>
|
||||||
|
</IconButton>
|
||||||
|
<IconButton onClick={handlePhotosChangeNext}>
|
||||||
|
<span className="material-symbols-rounded">chevron_right</span>
|
||||||
|
</IconButton>
|
||||||
|
</div>
|
||||||
|
<Menu
|
||||||
|
open={!!contextMenu?.mouseX}
|
||||||
|
onClose={handleContextMenuClose}
|
||||||
|
anchorReference="anchorPosition"
|
||||||
|
anchorPosition={
|
||||||
|
contextMenu !== null
|
||||||
|
? { left: contextMenu.mouseX, top: contextMenu.mouseY }
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<MenuItem onClick={handleImageDownload}>
|
||||||
|
<ListItemIcon>
|
||||||
|
<span className="material-symbols-rounded">download</span>
|
||||||
|
</ListItemIcon>
|
||||||
|
<ListItemText>Download</ListItemText>
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
||||||
|
<div className="photos-overlay">
|
||||||
|
<div className="photos-preview-container">{allPhotos}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
.video {
|
.video {
|
||||||
&-osd {
|
&-osd {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
@@ -8,6 +7,7 @@
|
|||||||
&-name {
|
&-name {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
gap: 0.5em;
|
||||||
margin-left: 1.2em;
|
margin-left: 1.2em;
|
||||||
&-logo {
|
&-logo {
|
||||||
width: 16em;
|
width: 16em;
|
||||||
@@ -16,9 +16,8 @@
|
|||||||
object-position: left top;
|
object-position: left top;
|
||||||
filter: drop-shadow(0 0 10px black);
|
filter: drop-shadow(0 0 10px black);
|
||||||
}
|
}
|
||||||
gap: 0.5em;
|
|
||||||
}
|
}
|
||||||
&-trick-bubble{
|
&-trick-bubble {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: $border-radius-default;
|
border-radius: $border-radius-default;
|
||||||
}
|
}
|
||||||
@@ -36,7 +35,7 @@
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
&-volume-indicator{
|
&-volume-indicator {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 12em;
|
width: 12em;
|
||||||
@@ -50,13 +49,12 @@
|
|||||||
right: 2em;
|
right: 2em;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
border-radius: 2em;
|
border-radius: 2em;
|
||||||
.material-symbols-rounded{
|
.material-symbols-rounded {
|
||||||
font-size: 3em;
|
font-size: 3em;
|
||||||
--fill:1;
|
--fill: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
video {
|
video {
|
||||||
&::-webkit-media-text-track-display {
|
&::-webkit-media-text-track-display {
|
||||||
overflow: visible !important;
|
overflow: visible !important;
|
||||||
@@ -69,7 +67,6 @@ video {
|
|||||||
text-shadow: 0 2px 10px rgb(0 0 0 / 0.8);
|
text-shadow: 0 2px 10px rgb(0 0 0 / 0.8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.video-player {
|
.video-player {
|
||||||
background: black;
|
background: black;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -77,7 +74,7 @@ video {
|
|||||||
height: 100vh;
|
height: 100vh;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
&-osd{
|
&-osd {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
@@ -90,22 +87,22 @@ video {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 1em 2em;
|
padding: 1em 2em;
|
||||||
background: linear-gradient(to top, rgb(0 0 0 / 0.7) 5vh, transparent 26vh 90vh, rgb(0 0 0 / 0.7));
|
background: linear-gradient(to top, rgb(0 0 0 / 0.7) 5vh, transparent 26vh 90vh, rgb(0 0 0 / 0.7));
|
||||||
&.hovering{
|
&.hovering {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
&-controls{
|
&-controls {
|
||||||
&-progress{
|
&-progress {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.2em;
|
gap: 0.2em;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
&-text{
|
margin-bottom: 0.5em;
|
||||||
|
&-text {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
margin-bottom: 0.5em;
|
|
||||||
}
|
}
|
||||||
&-buttons {
|
&-buttons {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
|||||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||||
import "./playlist.scss";
|
import "./playlist.scss";
|
||||||
import { createFileRoute } from "@tanstack/react-router";
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
function TabPanel(props) {
|
function TabPanel(props) {
|
||||||
const { children, value, index, ...other } = props;
|
const { children, value, index, ...other } = props;
|
||||||
|
|
||||||
@@ -58,27 +59,18 @@ function PlaylistTitlePage() {
|
|||||||
const { id } = Route.useParams();
|
const { id } = Route.useParams();
|
||||||
const api = Route.useRouteContext().api;
|
const api = Route.useRouteContext().api;
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
enabled: Boolean(api),
|
|
||||||
});
|
|
||||||
|
|
||||||
const item = useQuery({
|
const item = useQuery({
|
||||||
queryKey: ["item", id],
|
queryKey: ["item", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: id,
|
itemId: id,
|
||||||
fields: [ItemFields.Crew],
|
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
});
|
});
|
||||||
@@ -87,7 +79,7 @@ function PlaylistTitlePage() {
|
|||||||
queryKey: ["item", id, "similarItem"],
|
queryKey: ["item", id, "similarItem"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getLibraryApi(api).getSimilarAlbums({
|
const result = await getLibraryApi(api).getSimilarAlbums({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: item.data.Id,
|
itemId: item.data.Id,
|
||||||
limit: 16,
|
limit: 16,
|
||||||
});
|
});
|
||||||
@@ -102,7 +94,7 @@ function PlaylistTitlePage() {
|
|||||||
queryKey: ["item", id, "musicTracks"],
|
queryKey: ["item", id, "musicTracks"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getPlaylistsApi(api).getPlaylistItems({
|
const result = await getPlaylistsApi(api).getPlaylistItems({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
playlistId: item.data.Id,
|
playlistId: item.data.Id,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
@@ -161,7 +153,7 @@ function PlaylistTitlePage() {
|
|||||||
item={track}
|
item={track}
|
||||||
key={track.Id}
|
key={track.Id}
|
||||||
queryKey={["item", id, "musicTracks"]}
|
queryKey={["item", id, "musicTracks"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
playlistItem
|
playlistItem
|
||||||
playlistItemId={item.data.Id}
|
playlistItemId={item.data.Id}
|
||||||
trackIndex={index}
|
trackIndex={index}
|
||||||
@@ -208,7 +200,7 @@ function PlaylistTitlePage() {
|
|||||||
: "portrait"
|
: "portrait"
|
||||||
}
|
}
|
||||||
queryKey={["item", id, "similarItem"]}
|
queryKey={["item", id, "similarItem"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!similar.ImageBlurHashes?.Primary &&
|
!!similar.ImageBlurHashes?.Primary &&
|
||||||
similar.ImageBlurHashes?.Primary[
|
similar.ImageBlurHashes?.Primary[
|
||||||
|
|||||||
@@ -21,11 +21,15 @@ import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
|||||||
import { getPersonsApi } from "@jellyfin/sdk/lib/utils/api/persons-api";
|
import { getPersonsApi } from "@jellyfin/sdk/lib/utils/api/persons-api";
|
||||||
import { getSearchApi } from "@jellyfin/sdk/lib/utils/api/search-api";
|
import { getSearchApi } from "@jellyfin/sdk/lib/utils/api/search-api";
|
||||||
import "./search.scss";
|
import "./search.scss";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import { Dialog, Fab } from "@mui/material";
|
import { Dialog, Fab } from "@mui/material";
|
||||||
import { Outlet, createFileRoute, useNavigate } from "@tanstack/react-router";
|
import { Outlet, createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/search/")({
|
export const Route = createFileRoute("/_api/search/")({
|
||||||
component: SearchPage,
|
component: SearchPage,
|
||||||
|
validateSearch: (search: Record<string, unknown>): { query: string } => {
|
||||||
|
return { query: search.query as string };
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function SearchPage() {
|
function SearchPage() {
|
||||||
@@ -37,15 +41,7 @@ function SearchPage() {
|
|||||||
const [searchTerm, setSearchTerm] = useState("");
|
const [searchTerm, setSearchTerm] = useState("");
|
||||||
// const searchParam = useDebounce(query, 500);
|
// const searchParam = useDebounce(query, 500);
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
enabled: Boolean(api),
|
|
||||||
});
|
|
||||||
|
|
||||||
const itemLimit = 12;
|
const itemLimit = 12;
|
||||||
|
|
||||||
@@ -53,7 +49,7 @@ function SearchPage() {
|
|||||||
queryKey: ["search", "items", "Movie", query],
|
queryKey: ["search", "items", "Movie", query],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
searchTerm: query,
|
searchTerm: query,
|
||||||
includeItemTypes: [BaseItemKind.Movie],
|
includeItemTypes: [BaseItemKind.Movie],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -61,13 +57,13 @@ function SearchPage() {
|
|||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: user.isSuccess,
|
enabled: !!user?.Id,
|
||||||
});
|
});
|
||||||
const series = useQuery({
|
const series = useQuery({
|
||||||
queryKey: ["search", "items", "Series", query],
|
queryKey: ["search", "items", "Series", query],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
searchTerm: query,
|
searchTerm: query,
|
||||||
includeItemTypes: [BaseItemKind.Series],
|
includeItemTypes: [BaseItemKind.Series],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -75,13 +71,13 @@ function SearchPage() {
|
|||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: user.isSuccess,
|
enabled: !!user?.Id,
|
||||||
});
|
});
|
||||||
const musicAlbum = useQuery({
|
const musicAlbum = useQuery({
|
||||||
queryKey: ["search", "items", "MusicAlbum", query],
|
queryKey: ["search", "items", "MusicAlbum", query],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
searchTerm: query,
|
searchTerm: query,
|
||||||
includeItemTypes: [BaseItemKind.MusicAlbum],
|
includeItemTypes: [BaseItemKind.MusicAlbum],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -89,13 +85,13 @@ function SearchPage() {
|
|||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: user.isSuccess,
|
enabled: !!user?.Id,
|
||||||
});
|
});
|
||||||
const audio = useQuery({
|
const audio = useQuery({
|
||||||
queryKey: ["search", "items", "Audio", query],
|
queryKey: ["search", "items", "Audio", query],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
searchTerm: query,
|
searchTerm: query,
|
||||||
includeItemTypes: [BaseItemKind.Audio],
|
includeItemTypes: [BaseItemKind.Audio],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -103,13 +99,13 @@ function SearchPage() {
|
|||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: user.isSuccess,
|
enabled: !!user?.Id,
|
||||||
});
|
});
|
||||||
const book = useQuery({
|
const book = useQuery({
|
||||||
queryKey: ["search", "items", "Book", query],
|
queryKey: ["search", "items", "Book", query],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
searchTerm: query,
|
searchTerm: query,
|
||||||
includeItemTypes: [BaseItemKind.Book],
|
includeItemTypes: [BaseItemKind.Book],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -117,13 +113,13 @@ function SearchPage() {
|
|||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: user.isSuccess,
|
enabled: !!user?.Id,
|
||||||
});
|
});
|
||||||
const musicArtists = useQuery({
|
const musicArtists = useQuery({
|
||||||
queryKey: ["search", "items", "MusicArtists", query],
|
queryKey: ["search", "items", "MusicArtists", query],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
searchTerm: query,
|
searchTerm: query,
|
||||||
includeItemTypes: [BaseItemKind.MusicArtist],
|
includeItemTypes: [BaseItemKind.MusicArtist],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -131,32 +127,32 @@ function SearchPage() {
|
|||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: user.isSuccess,
|
enabled: !!user?.Id,
|
||||||
});
|
});
|
||||||
const person = useQuery({
|
const person = useQuery({
|
||||||
queryKey: ["search", "items", "Person", query],
|
queryKey: ["search", "items", "Person", query],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getPersonsApi(api).getPersons({
|
const result = await getPersonsApi(api).getPersons({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
searchTerm: query,
|
searchTerm: query,
|
||||||
limit: itemLimit,
|
limit: itemLimit,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: user.isSuccess,
|
enabled: !!user?.Id,
|
||||||
});
|
});
|
||||||
const episodes = useQuery({
|
const episodes = useQuery({
|
||||||
queryKey: ["search", "items", "Episodes", query],
|
queryKey: ["search", "items", "Episodes", query],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getSearchApi(api).getSearchHints({
|
const result = await getSearchApi(api).getSearchHints({
|
||||||
userId: user.data?.Id,
|
userId: user?.Id,
|
||||||
searchTerm: query,
|
searchTerm: query,
|
||||||
limit: itemLimit,
|
limit: itemLimit,
|
||||||
includeItemTypes: ["Episode"],
|
includeItemTypes: ["Episode"],
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: user.isSuccess,
|
enabled: !!user?.Id,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [setBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
const [setBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
||||||
@@ -224,7 +220,7 @@ function SearchPage() {
|
|||||||
cardCaption={item.ProductionYear}
|
cardCaption={item.ProductionYear}
|
||||||
cardType="portrait"
|
cardType="portrait"
|
||||||
queryKey={["search", "items", "Movie", query]}
|
queryKey={["search", "items", "Movie", query]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
!!item.ImageBlurHashes?.Primary &&
|
||||||
item.ImageBlurHashes?.Primary[
|
item.ImageBlurHashes?.Primary[
|
||||||
@@ -252,7 +248,7 @@ function SearchPage() {
|
|||||||
}`}
|
}`}
|
||||||
cardType="portrait"
|
cardType="portrait"
|
||||||
queryKey={["search", "items", "Series", query]}
|
queryKey={["search", "items", "Series", query]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
!!item.ImageBlurHashes?.Primary &&
|
||||||
item.ImageBlurHashes?.Primary[
|
item.ImageBlurHashes?.Primary[
|
||||||
@@ -273,7 +269,7 @@ function SearchPage() {
|
|||||||
cardTitle={episode.Series}
|
cardTitle={episode.Series}
|
||||||
cardCaption={`S${episode.ParentIndexNumber}:E${episode.IndexNumber} - ${episode.Name}`}
|
cardCaption={`S${episode.ParentIndexNumber}:E${episode.IndexNumber} - ${episode.Name}`}
|
||||||
queryKey={["search", "items", "Episodes", query]}
|
queryKey={["search", "items", "Episodes", query]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
disableRunTime
|
disableRunTime
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@@ -291,7 +287,7 @@ function SearchPage() {
|
|||||||
cardCaption={item.ProductionYear}
|
cardCaption={item.ProductionYear}
|
||||||
cardType="square"
|
cardType="square"
|
||||||
queryKey={["search", "items", "Audio", query]}
|
queryKey={["search", "items", "Audio", query]}
|
||||||
userId={user.data?.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
@@ -308,7 +304,7 @@ function SearchPage() {
|
|||||||
cardCaption={item.AlbumArtist}
|
cardCaption={item.AlbumArtist}
|
||||||
cardType={"square"}
|
cardType={"square"}
|
||||||
queryKey={["search", "items", "MusicAlbum", query]}
|
queryKey={["search", "items", "MusicAlbum", query]}
|
||||||
userId={user.data?.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
@@ -325,7 +321,7 @@ function SearchPage() {
|
|||||||
disableOverlay
|
disableOverlay
|
||||||
cardType={"portrait"}
|
cardType={"portrait"}
|
||||||
queryKey={["search", "items", "Book", query]}
|
queryKey={["search", "items", "Book", query]}
|
||||||
userId={user.data?.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
@@ -341,7 +337,7 @@ function SearchPage() {
|
|||||||
disableOverlay
|
disableOverlay
|
||||||
cardType={"square"}
|
cardType={"square"}
|
||||||
queryKey={["search", "items", "MusicArtists", query]}
|
queryKey={["search", "items", "MusicArtists", query]}
|
||||||
userId={user.data?.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
@@ -357,7 +353,7 @@ function SearchPage() {
|
|||||||
disableOverlay
|
disableOverlay
|
||||||
cardType={"square"}
|
cardType={"square"}
|
||||||
queryKey={["search", "items", "Person", query]}
|
queryKey={["search", "items", "Person", query]}
|
||||||
userId={user.data?.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
@@ -59,6 +59,8 @@ import { setBackdrop, useBackdropStore } from "@/utils/store/backdrop";
|
|||||||
|
|
||||||
import IconLink from "@/components/iconLink";
|
import IconLink from "@/components/iconLink";
|
||||||
import EpisodeSkeleton from "@/components/skeleton/episode";
|
import EpisodeSkeleton from "@/components/skeleton/episode";
|
||||||
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||||
import { Link } from "@tanstack/react-router";
|
import { Link } from "@tanstack/react-router";
|
||||||
|
|
||||||
@@ -101,27 +103,18 @@ function SeriesTitlePage() {
|
|||||||
|
|
||||||
const api = Route.useRouteContext().api;
|
const api = Route.useRouteContext().api;
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const usr = await getUserApi(api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
networkMode: "always",
|
|
||||||
enabled: Boolean(api),
|
|
||||||
});
|
|
||||||
|
|
||||||
const item = useQuery({
|
const item = useQuery({
|
||||||
queryKey: ["item", id],
|
queryKey: ["item", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: id,
|
itemId: id,
|
||||||
fields: [ItemFields.Crew],
|
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user?.Id,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
});
|
});
|
||||||
@@ -130,7 +123,7 @@ function SeriesTitlePage() {
|
|||||||
queryKey: ["item", id, "similarItem"],
|
queryKey: ["item", id, "similarItem"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getLibraryApi(api).getSimilarShows({
|
const result = await getLibraryApi(api).getSimilarShows({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: item.data.Id,
|
itemId: item.data.Id,
|
||||||
limit: 16,
|
limit: 16,
|
||||||
});
|
});
|
||||||
@@ -145,7 +138,7 @@ function SeriesTitlePage() {
|
|||||||
queryKey: ["item", id, "seasons"],
|
queryKey: ["item", id, "seasons"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getTvShowsApi(api).getSeasons({
|
const result = await getTvShowsApi(api).getSeasons({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
seriesId: item.data.Id,
|
seriesId: item.data.Id,
|
||||||
// isSpecialSeason: false,
|
// isSpecialSeason: false,
|
||||||
});
|
});
|
||||||
@@ -160,7 +153,7 @@ function SeriesTitlePage() {
|
|||||||
queryKey: ["item", id, "nextUp"],
|
queryKey: ["item", id, "nextUp"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getTvShowsApi(api).getNextUp({
|
const result = await getTvShowsApi(api).getNextUp({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
limit: 1,
|
limit: 1,
|
||||||
parentId: item.data.Id,
|
parentId: item.data.Id,
|
||||||
disableFirstEpisode: true,
|
disableFirstEpisode: true,
|
||||||
@@ -189,7 +182,7 @@ function SeriesTitlePage() {
|
|||||||
queryKey: ["item", id, "season", currentSeason],
|
queryKey: ["item", id, "season", currentSeason],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
itemId: seasons.data.Items[currentSeason].Id,
|
itemId: seasons.data.Items[currentSeason].Id,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
@@ -203,7 +196,7 @@ function SeriesTitlePage() {
|
|||||||
queryKey: ["item", id, "season", currentSeason, "episodes"],
|
queryKey: ["item", id, "season", currentSeason, "episodes"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getTvShowsApi(api).getEpisodes({
|
const result = await getTvShowsApi(api).getEpisodes({
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
seriesId: item.data.Id,
|
seriesId: item.data.Id,
|
||||||
seasonId: seasons.data.Items[currentSeason].Id,
|
seasonId: seasons.data.Items[currentSeason].Id,
|
||||||
fields: [ItemFields.Overview],
|
fields: [ItemFields.Overview],
|
||||||
@@ -221,7 +214,7 @@ function SeriesTitlePage() {
|
|||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getUserLibraryApi(api).getSpecialFeatures({
|
const result = await getUserLibraryApi(api).getSpecialFeatures({
|
||||||
itemId: item.data.Id,
|
itemId: item.data.Id,
|
||||||
userId: user.data.Id,
|
userId: user?.Id,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
@@ -236,13 +229,13 @@ function SeriesTitlePage() {
|
|||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (item.isSuccess) {
|
if (item.isSuccess) {
|
||||||
// setBackdropImage({
|
// setBackdropImage({
|
||||||
// url: api.getItemImageUrl(item.data?.Id, "Backdrop", {
|
// url: getImageUrlsApi(api).getItemImageUrlById(item.data?.Id, "Backdrop", {
|
||||||
// tag: item.data?.BackdropImageTags[0],
|
// tag: item.data?.BackdropImageTags[0],
|
||||||
// }),
|
// }),
|
||||||
// key: item.data?.BackdropImageTags[0],
|
// key: item.data?.BackdropImageTags[0],
|
||||||
// });
|
// });
|
||||||
// setBackdrop(
|
// setBackdrop(
|
||||||
// api.getItemImageUrl(item.data?.Id, "Backdrop", {
|
// getImageUrlsApi(api).getItemImageUrlById(item.data?.Id, "Backdrop", {
|
||||||
// tag: item.data?.BackdropImageTags[0],
|
// tag: item.data?.BackdropImageTags[0],
|
||||||
// }),
|
// }),
|
||||||
// item.data.Id,
|
// item.data.Id,
|
||||||
@@ -283,31 +276,43 @@ function SeriesTitlePage() {
|
|||||||
) {
|
) {
|
||||||
sessionStorage.setItem(
|
sessionStorage.setItem(
|
||||||
`backdrop-${item.data?.Id}`,
|
`backdrop-${item.data?.Id}`,
|
||||||
api.getItemImageUrl(currentSeasonItem.data.Id, "Backdrop", {
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
currentSeasonItem.data.Id,
|
||||||
|
"Backdrop",
|
||||||
|
{
|
||||||
tag: currentSeasonItem.data.BackdropImageTags?.[0],
|
tag: currentSeasonItem.data.BackdropImageTags?.[0],
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
sessionStorage.setItem(
|
sessionStorage.setItem(
|
||||||
`backdrop-${item.data?.Id}-key`,
|
`backdrop-${item.data?.Id}-key`,
|
||||||
currentSeasonItem.data.BackdropImageTags?.[0],
|
currentSeasonItem.data.BackdropImageTags?.[0],
|
||||||
);
|
);
|
||||||
setBackdropImage({
|
setBackdropImage({
|
||||||
url: api.getItemImageUrl(currentSeasonItem.data.Id, "Backdrop", {
|
url: getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
currentSeasonItem.data.Id,
|
||||||
|
"Backdrop",
|
||||||
|
{
|
||||||
tag: currentSeasonItem.data.BackdropImageTags?.[0],
|
tag: currentSeasonItem.data.BackdropImageTags?.[0],
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
key: currentSeasonItem.data.BackdropImageTags?.[0],
|
key: currentSeasonItem.data.BackdropImageTags?.[0],
|
||||||
});
|
});
|
||||||
setBackdrop(
|
setBackdrop(
|
||||||
api.getItemImageUrl(currentSeasonItem.data.Id, "Backdrop", {
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
currentSeasonItem.data.Id,
|
||||||
|
"Backdrop",
|
||||||
|
{
|
||||||
tag: currentSeasonItem.data.BackdropImageTags?.[0],
|
tag: currentSeasonItem.data.BackdropImageTags?.[0],
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
currentSeasonItem.data.BackdropImageTags?.[0],
|
currentSeasonItem.data.BackdropImageTags?.[0],
|
||||||
);
|
);
|
||||||
setBackdropImageLoaded(false);
|
setBackdropImageLoaded(false);
|
||||||
} else if (item.isSuccess && item.data?.BackdropImageTags?.length > 0) {
|
} else if (item.isSuccess && item.data?.BackdropImageTags?.length > 0) {
|
||||||
sessionStorage.setItem(
|
sessionStorage.setItem(
|
||||||
`backdrop-${item.data?.Id}`,
|
`backdrop-${item.data?.Id}`,
|
||||||
api.getItemImageUrl(item.data.Id, "Backdrop", {
|
getImageUrlsApi(api).getItemImageUrlById(item.data.Id, "Backdrop", {
|
||||||
tag: item.data.BackdropImageTags?.[0],
|
tag: item.data.BackdropImageTags?.[0],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@@ -319,13 +324,17 @@ function SeriesTitlePage() {
|
|||||||
setBackdropImageLoaded(false); // Reset Backdrop image load status if previous image is diff then new image
|
setBackdropImageLoaded(false); // Reset Backdrop image load status if previous image is diff then new image
|
||||||
}
|
}
|
||||||
setBackdropImage({
|
setBackdropImage({
|
||||||
url: api.getItemImageUrl(item.data?.Id, "Backdrop", {
|
url: getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data?.Id,
|
||||||
|
"Backdrop",
|
||||||
|
{
|
||||||
tag: item.data?.BackdropImageTags?.[0],
|
tag: item.data?.BackdropImageTags?.[0],
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
key: item.data?.BackdropImageTags?.[0],
|
key: item.data?.BackdropImageTags?.[0],
|
||||||
});
|
});
|
||||||
setBackdrop(
|
setBackdrop(
|
||||||
api.getItemImageUrl(item.data.Id, "Backdrop", {
|
getImageUrlsApi(api).getItemImageUrlById(item.data.Id, "Backdrop", {
|
||||||
tag: item.data.BackdropImageTags?.[0],
|
tag: item.data.BackdropImageTags?.[0],
|
||||||
}),
|
}),
|
||||||
item.data.BackdropImageTags?.[0],
|
item.data.BackdropImageTags?.[0],
|
||||||
@@ -438,10 +447,14 @@ function SeriesTitlePage() {
|
|||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 90,
|
quality: 90,
|
||||||
tag: item.data.ImageTags.Primary,
|
tag: item.data.ImageTags.Primary,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = 1;
|
||||||
}}
|
}}
|
||||||
@@ -458,11 +471,15 @@ function SeriesTitlePage() {
|
|||||||
{Object.keys(item.data.ImageTags).includes("Logo") ? (
|
{Object.keys(item.data.ImageTags).includes("Logo") ? (
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Logo", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data.Id,
|
||||||
|
"Logo",
|
||||||
|
{
|
||||||
quality: 90,
|
quality: 90,
|
||||||
fillWidth: 592,
|
fillWidth: 592,
|
||||||
fillHeight: 592,
|
fillHeight: 592,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = 1;
|
||||||
}}
|
}}
|
||||||
@@ -594,7 +611,7 @@ function SeriesTitlePage() {
|
|||||||
currentAudioTrack={0}
|
currentAudioTrack={0}
|
||||||
currentVideoTrack={0}
|
currentVideoTrack={0}
|
||||||
currentSubTrack="nosub"
|
currentSubTrack="nosub"
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
buttonProps={{
|
buttonProps={{
|
||||||
fullWidth: true,
|
fullWidth: true,
|
||||||
}}
|
}}
|
||||||
@@ -610,14 +627,14 @@ function SeriesTitlePage() {
|
|||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isFavorite={item.data.UserData.IsFavorite}
|
isFavorite={item.data.UserData.IsFavorite}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
<MarkPlayedButton
|
<MarkPlayedButton
|
||||||
itemName={item.data.Name}
|
itemName={item.data.Name}
|
||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isPlayed={item.data.UserData.Played}
|
isPlayed={item.data.UserData.Played}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -672,11 +689,15 @@ function SeriesTitlePage() {
|
|||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name}
|
||||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
actor.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 80,
|
quality: 80,
|
||||||
fillWidth: 200,
|
fillWidth: 200,
|
||||||
fillHeight: 200,
|
fillHeight: 200,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -720,11 +741,15 @@ function SeriesTitlePage() {
|
|||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name}
|
||||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
actor.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 80,
|
quality: 80,
|
||||||
fillWidth: 200,
|
fillWidth: 200,
|
||||||
fillHeight: 200,
|
fillHeight: 200,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -768,11 +793,15 @@ function SeriesTitlePage() {
|
|||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name}
|
||||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
actor.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 80,
|
quality: 80,
|
||||||
fillWidth: 200,
|
fillWidth: 200,
|
||||||
fillHeight: 200,
|
fillHeight: 200,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -816,11 +845,15 @@ function SeriesTitlePage() {
|
|||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name}
|
||||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
actor.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
quality: 80,
|
quality: 80,
|
||||||
fillWidth: 200,
|
fillWidth: 200,
|
||||||
fillHeight: 200,
|
fillHeight: 200,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -870,7 +903,7 @@ function SeriesTitlePage() {
|
|||||||
`season ${currentSeason + 1}`,
|
`season ${currentSeason + 1}`,
|
||||||
"episodes",
|
"episodes",
|
||||||
]}
|
]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@@ -927,7 +960,7 @@ function SeriesTitlePage() {
|
|||||||
itemId={currentSeasonItem.data.Id}
|
itemId={currentSeasonItem.data.Id}
|
||||||
isFavorite={currentSeasonItem.data.UserData.IsFavorite}
|
isFavorite={currentSeasonItem.data.UserData.IsFavorite}
|
||||||
queryKey={["item", id, "season", currentSeason]}
|
queryKey={["item", id, "season", currentSeason]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
itemName={currentSeasonItem.data.Name}
|
itemName={currentSeasonItem.data.Name}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -937,7 +970,7 @@ function SeriesTitlePage() {
|
|||||||
itemId={currentSeasonItem.data.Id}
|
itemId={currentSeasonItem.data.Id}
|
||||||
isPlayed={currentSeasonItem.data.UserData.Played}
|
isPlayed={currentSeasonItem.data.UserData.Played}
|
||||||
queryKey={["item", id, "season", currentSeason]}
|
queryKey={["item", id, "season", currentSeason]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
itemName={currentSeasonItem.data.Name}
|
itemName={currentSeasonItem.data.Name}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
@@ -1007,7 +1040,7 @@ function SeriesTitlePage() {
|
|||||||
<Typography variant="subtitle1" textAlign="center">
|
<Typography variant="subtitle1" textAlign="center">
|
||||||
{episode.IndexNumberEnd
|
{episode.IndexNumberEnd
|
||||||
? `${episode.IndexNumber} / ${episode.IndexNumberEnd}`
|
? `${episode.IndexNumber} / ${episode.IndexNumberEnd}`
|
||||||
: episode.IndexNumber ?? 0}
|
: (episode.IndexNumber ?? 0)}
|
||||||
</Typography>
|
</Typography>
|
||||||
<div
|
<div
|
||||||
className={
|
className={
|
||||||
@@ -1022,7 +1055,7 @@ function SeriesTitlePage() {
|
|||||||
itemId={episode.Id}
|
itemId={episode.Id}
|
||||||
itemType={BaseItemKind.Episode}
|
itemType={BaseItemKind.Episode}
|
||||||
itemUserData={episode.UserData}
|
itemUserData={episode.UserData}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
currentAudioTrack={0}
|
currentAudioTrack={0}
|
||||||
currentVideoTrack={0}
|
currentVideoTrack={0}
|
||||||
currentSubTrack="nosub"
|
currentSubTrack="nosub"
|
||||||
@@ -1043,10 +1076,14 @@ function SeriesTitlePage() {
|
|||||||
</div>
|
</div>
|
||||||
<img
|
<img
|
||||||
alt={episode.Name}
|
alt={episode.Name}
|
||||||
src={api.getItemImageUrl(episode.Id, "Primary", {
|
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
episode.Id,
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
tag: episode.ImageTags.Primary,
|
tag: episode.ImageTags.Primary,
|
||||||
fillHeight: 300,
|
fillHeight: 300,
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
className="item-detail-episode-image"
|
className="item-detail-episode-image"
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.target.style.opacity = 1;
|
e.target.style.opacity = 1;
|
||||||
@@ -1112,7 +1149,7 @@ function SeriesTitlePage() {
|
|||||||
`season ${currentSeason + 1}`,
|
`season ${currentSeason + 1}`,
|
||||||
"episodes",
|
"episodes",
|
||||||
]}
|
]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
<MarkPlayedButton
|
<MarkPlayedButton
|
||||||
itemId={episode.Id}
|
itemId={episode.Id}
|
||||||
@@ -1124,7 +1161,7 @@ function SeriesTitlePage() {
|
|||||||
`season ${currentSeason + 1}`,
|
`season ${currentSeason + 1}`,
|
||||||
"episodes",
|
"episodes",
|
||||||
]}
|
]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
@@ -1157,7 +1194,7 @@ function SeriesTitlePage() {
|
|||||||
Object.keys(special.ImageBlurHashes.Primary)[0]
|
Object.keys(special.ImageBlurHashes.Primary)[0]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
onClick={() => {}}
|
onClick={() => {}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@@ -1202,7 +1239,7 @@ function SeriesTitlePage() {
|
|||||||
: "portrait"
|
: "portrait"
|
||||||
}
|
}
|
||||||
queryKey={["item", id, "similarItem"]}
|
queryKey={["item", id, "similarItem"]}
|
||||||
userId={user.data.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!similar.ImageBlurHashes?.Primary &&
|
!!similar.ImageBlurHashes?.Primary &&
|
||||||
similar.ImageBlurHashes?.Primary[
|
similar.ImageBlurHashes?.Primary[
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { getDefaultServer } from "@/utils/storage/servers";
|
import { getDefaultServer } from "@/utils/storage/servers";
|
||||||
import { getUser } from "@/utils/storage/user";
|
import { getUser } from "@/utils/storage/user";
|
||||||
import { createFileRoute, redirect } from "@tanstack/react-router";
|
import { useQueryErrorResetBoundary } from "@tanstack/react-query";
|
||||||
|
import { createFileRoute, redirect, useRouter } from "@tanstack/react-router";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
export const Route = createFileRoute("/")({
|
export const Route = createFileRoute("/")({
|
||||||
errorComponent: (error) => {
|
|
||||||
console.error(error.error);
|
|
||||||
},
|
|
||||||
beforeLoad: async () => {
|
beforeLoad: async () => {
|
||||||
|
console.log("Hello");
|
||||||
const currentServerId = await getDefaultServer();
|
const currentServerId = await getDefaultServer();
|
||||||
const userOnDisk = await getUser();
|
const userOnDisk = await getUser();
|
||||||
if (currentServerId) {
|
if (currentServerId) {
|
||||||
|
|||||||
@@ -299,3 +299,7 @@ h1 {
|
|||||||
.opacity-07{
|
.opacity-07{
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: $clr-accent-default;
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { useEffect, useRef } from "react";
|
||||||
|
|
||||||
|
function useInterval(callback: () => void, delay) {
|
||||||
|
const savedCallback = useRef(null);
|
||||||
|
|
||||||
|
// Remember the latest callback.
|
||||||
|
useEffect(() => {
|
||||||
|
savedCallback.current = callback;
|
||||||
|
}, [callback]);
|
||||||
|
|
||||||
|
// Set up the interval.
|
||||||
|
useEffect(() => {
|
||||||
|
function tick() {
|
||||||
|
savedCallback.current();
|
||||||
|
}
|
||||||
|
if (delay !== null) {
|
||||||
|
const id = setInterval(tick, delay);
|
||||||
|
return () => clearInterval(id);
|
||||||
|
}
|
||||||
|
}, [delay]);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default useInterval;
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import type { Api } from "@jellyfin/sdk";
|
||||||
|
import { ImageUrlsApi } from "@jellyfin/sdk/lib/utils/api/image-urls-api";
|
||||||
|
|
||||||
|
const getImageUrlsApi = (api: Api) => new ImageUrlsApi(api.configuration);
|
||||||
|
|
||||||
|
export default getImageUrlsApi;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { RecommendedServerInfo } from "@jellyfin/sdk";
|
import type { RecommendedServerInfo } from "@jellyfin/sdk";
|
||||||
import { Store } from "@tauri-apps/plugin-store";
|
import { load } from "@tauri-apps/plugin-store";
|
||||||
|
|
||||||
export interface ServerInfo extends RecommendedServerInfo {
|
export interface ServerInfo extends RecommendedServerInfo {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -10,7 +10,7 @@ export interface ServerStore {
|
|||||||
servers: ServerInfo[];
|
servers: ServerInfo[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const store = new Store(".servers.dat");
|
const store = await load(".servers.dat", { autoSave: true });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set server in .servers.dat
|
* Set server in .servers.dat
|
||||||
@@ -40,10 +40,12 @@ export const setDefaultServer = async (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a Server
|
* Get a Server
|
||||||
|
* @returns {ServerInfo}
|
||||||
*/
|
*/
|
||||||
export const getServer = async (serverId: string | null) => {
|
export const getServer = async (
|
||||||
|
serverId: string | null,
|
||||||
|
): Promise<ServerInfo | undefined> => {
|
||||||
const servers = await getAllServers();
|
const servers = await getAllServers();
|
||||||
|
|
||||||
return servers.find((server) => server.id === serverId);
|
return servers.find((server) => server.id === serverId);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Store } from "@tauri-apps/plugin-store";
|
import { load } from "@tauri-apps/plugin-store";
|
||||||
|
|
||||||
const SettingsStore = new Store(".settings.dat");
|
const SettingsStore = await load(".settings.dat", { autoSave: true });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* settingKey should be of type:
|
* settingKey should be of type:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Store } from "@tauri-apps/plugin-store";
|
import { load } from "@tauri-apps/plugin-store";
|
||||||
|
|
||||||
export interface UserStore {
|
export interface UserStore {
|
||||||
user: {
|
user: {
|
||||||
@@ -7,7 +7,7 @@ export interface UserStore {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = new Store(".user.dat");
|
const user = await load(".user.dat", { autoSave: true });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set User details to .user.dat
|
* Set User details to .user.dat
|
||||||
|
|||||||
+10
-10
@@ -1,7 +1,9 @@
|
|||||||
import { type Api, Jellyfin } from "@jellyfin/sdk";
|
import { type Api, Jellyfin } from "@jellyfin/sdk";
|
||||||
import React, { type ReactNode } from "react";
|
import React, { type ReactNode } from "react";
|
||||||
import { createContext, useContext, useState } from "react";
|
import { createContext, useContext, useState } from "react";
|
||||||
import { type StoreApi, createStore, useStore } from "zustand";
|
import { type StoreApi, createStore } from "zustand";
|
||||||
|
import { shallow } from "zustand/shallow";
|
||||||
|
import { useStoreWithEqualityFn } from "zustand/traditional";
|
||||||
import { version as appVer } from "../../../package.json";
|
import { version as appVer } from "../../../package.json";
|
||||||
|
|
||||||
// Initial custom axios client to use tauri's http module
|
// Initial custom axios client to use tauri's http module
|
||||||
@@ -9,12 +11,15 @@ import axios from "axios";
|
|||||||
import axiosTauriApiAdapter from "axios-tauri-api-adapter";
|
import axiosTauriApiAdapter from "axios-tauri-api-adapter";
|
||||||
|
|
||||||
type ApiStore = {
|
type ApiStore = {
|
||||||
api: Api;
|
api: Api | undefined;
|
||||||
deviceId: string | null;
|
deviceId: string | null;
|
||||||
jellyfin: Jellyfin;
|
jellyfin: Jellyfin;
|
||||||
createApi: (serverAddress: string, accessToken?: string | undefined) => void;
|
createApi: (serverAddress: string, accessToken?: string | undefined) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
export const axiosClient = axios.create({
|
export const axiosClient = axios.create({
|
||||||
// adapter: axiosTauriApiAdapter,
|
// adapter: axiosTauriApiAdapter,
|
||||||
headers: {
|
headers: {
|
||||||
@@ -50,12 +55,7 @@ export const ApiProvider = ({ children }: { children: ReactNode }) => {
|
|||||||
jellyfin: jellyfin,
|
jellyfin: jellyfin,
|
||||||
createApi: (serverAddress, accessToken?) =>
|
createApi: (serverAddress, accessToken?) =>
|
||||||
set((state) => {
|
set((state) => {
|
||||||
const apiTemp = state.jellyfin.createApi(
|
const apiTemp = state.jellyfin.createApi(serverAddress, accessToken);
|
||||||
serverAddress,
|
|
||||||
accessToken,
|
|
||||||
axiosClient,
|
|
||||||
);
|
|
||||||
console.info(apiTemp);
|
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
api: apiTemp,
|
api: apiTemp,
|
||||||
@@ -69,7 +69,7 @@ export const ApiProvider = ({ children }: { children: ReactNode }) => {
|
|||||||
export function useApiInContext<T>(selector?: (state: ApiStore) => T) {
|
export function useApiInContext<T>(selector?: (state: ApiStore) => T) {
|
||||||
const store = useContext(ApiContext);
|
const store = useContext(ApiContext);
|
||||||
if (!store) {
|
if (!store) {
|
||||||
throw new Error("Missing StoreProvider");
|
throw new Error("Missing ApiProvider");
|
||||||
}
|
}
|
||||||
return useStore(store, selector!);
|
return useStoreWithEqualityFn(store, selector!, shallow);
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,13 @@ import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
|||||||
import { create } from "zustand";
|
import { create } from "zustand";
|
||||||
import { setQueue } from "./queue";
|
import { setQueue } from "./queue";
|
||||||
|
|
||||||
|
import { start } from "repl";
|
||||||
|
import { max } from "lodash";
|
||||||
import type React from "react";
|
import type React from "react";
|
||||||
|
import { shallow } from "zustand/shallow";
|
||||||
|
import { createWithEqualityFn } from "zustand/traditional";
|
||||||
import { secToTicks } from "../date/time";
|
import { secToTicks } from "../date/time";
|
||||||
|
import playbackProfile from "../playback-profiles";
|
||||||
|
|
||||||
type AudioPlaybackStore = {
|
type AudioPlaybackStore = {
|
||||||
display: boolean;
|
display: boolean;
|
||||||
@@ -16,7 +21,8 @@ type AudioPlaybackStore = {
|
|||||||
ref: React.Ref<HTMLAudioElement> | null;
|
ref: React.Ref<HTMLAudioElement> | null;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
export const useAudioPlayback = create<AudioPlaybackStore>(() => ({
|
export const useAudioPlayback = createWithEqualityFn<AudioPlaybackStore>(
|
||||||
|
() => ({
|
||||||
display: false,
|
display: false,
|
||||||
url: "",
|
url: "",
|
||||||
item: undefined,
|
item: undefined,
|
||||||
@@ -26,14 +32,14 @@ export const useAudioPlayback = create<AudioPlaybackStore>(() => ({
|
|||||||
playing: false,
|
playing: false,
|
||||||
ref: null,
|
ref: null,
|
||||||
},
|
},
|
||||||
}));
|
}),
|
||||||
|
shallow,
|
||||||
|
);
|
||||||
|
|
||||||
export const playAudio = (
|
export const playAudio = (
|
||||||
url: string,
|
url: string,
|
||||||
item: BaseItemDto | undefined | null,
|
item: BaseItemDto | undefined | null,
|
||||||
playlistItemId: string | undefined,
|
playlistItemId: string | undefined,
|
||||||
queue: BaseItemDto[] | undefined,
|
|
||||||
queueItemIndex: number,
|
|
||||||
): void => {
|
): void => {
|
||||||
useAudioPlayback.setState({
|
useAudioPlayback.setState({
|
||||||
display: true,
|
display: true,
|
||||||
@@ -41,7 +47,6 @@ export const playAudio = (
|
|||||||
item,
|
item,
|
||||||
playlistItemId,
|
playlistItemId,
|
||||||
});
|
});
|
||||||
setQueue(queue, queueItemIndex);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const generateAudioStreamUrl = (
|
export const generateAudioStreamUrl = (
|
||||||
@@ -49,10 +54,41 @@ export const generateAudioStreamUrl = (
|
|||||||
userId: string,
|
userId: string,
|
||||||
deviceId: string,
|
deviceId: string,
|
||||||
basePath: string,
|
basePath: string,
|
||||||
|
api_key: string,
|
||||||
) => {
|
) => {
|
||||||
|
const transcodingProfile = playbackProfile.TranscodingProfiles?.filter(
|
||||||
|
(val) => val.Type === "Audio" && val.Context === "Streaming",
|
||||||
|
)[0];
|
||||||
|
|
||||||
|
let directPlayContainers = "";
|
||||||
|
if (playbackProfile.DirectPlayProfiles) {
|
||||||
|
for (const p of playbackProfile.DirectPlayProfiles) {
|
||||||
|
if (p.Type === "Audio") {
|
||||||
|
if (directPlayContainers) {
|
||||||
|
directPlayContainers += `, ${p.Container}`;
|
||||||
|
} else {
|
||||||
|
directPlayContainers = p.Container ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p.AudioCodec) {
|
||||||
|
directPlayContainers += `| ${p.AudioCodec}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
const urlOptions = {
|
const urlOptions = {
|
||||||
userId,
|
userId,
|
||||||
deviceId,
|
deviceId,
|
||||||
|
api_key,
|
||||||
|
container: directPlayContainers,
|
||||||
|
maxAudioChannels: transcodingProfile?.MaxAudioChannels,
|
||||||
|
transcodingContainer: transcodingProfile?.Container,
|
||||||
|
transcodingProtocol: transcodingProfile?.Protocol,
|
||||||
|
audioCodec: transcodingProfile?.AudioCodec,
|
||||||
|
playSessionId: new Date().getTime(),
|
||||||
|
startTimeTicks: 0,
|
||||||
|
enableRemoteMedia: false,
|
||||||
|
enableAudioVbrEncoding: true,
|
||||||
};
|
};
|
||||||
const urlParams = new URLSearchParams(urlOptions).toString();
|
const urlParams = new URLSearchParams(urlOptions).toString();
|
||||||
return `${basePath}/Audio/${itemId}/universal?${urlParams}`;
|
return `${basePath}/Audio/${itemId}/universal?${urlParams}`;
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
import { create } from "zustand";
|
|
||||||
|
|
||||||
export const useBackdropStore = create((set) => ({
|
|
||||||
backdropUrl: "",
|
|
||||||
backdropId: "",
|
|
||||||
setBackdrop: (url, id) =>
|
|
||||||
set((state) => ({ backdropUrl: url, backdropId: id })),
|
|
||||||
}));
|
|
||||||
|
|
||||||
export const setBackdrop = (url, id) => {
|
|
||||||
useBackdropStore.setState(() => ({ backdropUrl: url, backdropId: id }));
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import { createStore } from "zustand";
|
||||||
|
import { shallow } from "zustand/shallow";
|
||||||
|
import { useStoreWithEqualityFn } from "zustand/traditional";
|
||||||
|
|
||||||
|
type BackdropStore = {
|
||||||
|
backdropUrl: string;
|
||||||
|
backdropId: string;
|
||||||
|
setBackdrop: (
|
||||||
|
url: string | undefined | null,
|
||||||
|
id: string | undefined | null,
|
||||||
|
) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const backdropStore = createStore((set) => ({
|
||||||
|
backdropUrl: "",
|
||||||
|
backdropId: "",
|
||||||
|
setBackdrop: (
|
||||||
|
url: string | undefined | null,
|
||||||
|
id: string | undefined | null,
|
||||||
|
) => set(() => ({ backdropUrl: url, backdropId: id })),
|
||||||
|
}));
|
||||||
|
|
||||||
|
export function useBackdropStore<T>(selector?: (state: BackdropStore) => T) {
|
||||||
|
return useStoreWithEqualityFn(backdropStore, selector!, shallow);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @deprecated Please use setBackdrop method from the store
|
||||||
|
*/
|
||||||
|
export const setBackdrop = () => {
|
||||||
|
// useBackdropStore.setState(() => ({ backdropUrl: url, backdropId: id }));
|
||||||
|
};
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
import { create } from "zustand";
|
import { create } from "zustand";
|
||||||
|
import { shallow } from "zustand/shallow";
|
||||||
|
import { createWithEqualityFn } from "zustand/traditional";
|
||||||
|
|
||||||
export const useCarouselStore = create((set) => ({
|
export const useCarouselStore = createWithEqualityFn(
|
||||||
|
(set) => ({
|
||||||
direction: "right",
|
direction: "right",
|
||||||
setDirection: (dir) => set(() => ({ direction: dir })),
|
setDirection: (dir) => set(() => ({ direction: dir })),
|
||||||
}));
|
}),
|
||||||
|
shallow,
|
||||||
|
);
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
import { create } from "zustand";
|
|
||||||
import { version } from "../../../package.json";
|
|
||||||
import { getAllServers, getDefaultServer, getServer } from "../storage/servers";
|
|
||||||
import { getUser } from "../storage/user";
|
|
||||||
/**
|
|
||||||
* Central Store controls the base state required by the app
|
|
||||||
*/
|
|
||||||
export const useCentralStore = create(() => ({
|
|
||||||
defaultServerOnDisk: async () => await getDefaultServer(),
|
|
||||||
defaultServerInfoOnDisk: async () => {
|
|
||||||
const a = await getDefaultServer();
|
|
||||||
return await getServer(a);
|
|
||||||
},
|
|
||||||
allServersOnDisk: async () => await getAllServers(),
|
|
||||||
userOnDisk: async () => await getUser(),
|
|
||||||
/** This is the initial route that app goes to just after app startups */
|
|
||||||
initialRoute: null,
|
|
||||||
clientVersion: version,
|
|
||||||
appReady: false,
|
|
||||||
}));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets app inital route
|
|
||||||
* @param {string} route
|
|
||||||
*/
|
|
||||||
export const setInitialRoute = (route) => {
|
|
||||||
useCentralStore.setState((state) => ({ ...state, initialRoute: route }));
|
|
||||||
};
|
|
||||||
|
|
||||||
export const setAppReady = (appReady) => {
|
|
||||||
useCentralStore.setState((state) => ({ ...state, appReady }));
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
import type { Api } from "@jellyfin/sdk";
|
||||||
|
import type { UserDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
|
import React, { type ReactNode } from "react";
|
||||||
|
import { createContext, useContext, useState } from "react";
|
||||||
|
import { type StoreApi, createStore } from "zustand";
|
||||||
|
import { shallow } from "zustand/shallow";
|
||||||
|
import { useStoreWithEqualityFn } from "zustand/traditional";
|
||||||
|
import { version } from "../../../package.json";
|
||||||
|
import {
|
||||||
|
type ServerInfo,
|
||||||
|
getAllServers,
|
||||||
|
getDefaultServer,
|
||||||
|
getServer,
|
||||||
|
} from "../storage/servers";
|
||||||
|
import { getUser } from "../storage/user";
|
||||||
|
|
||||||
|
type CentralStore = {
|
||||||
|
defaultServerOnDisk: () => Promise<string | null>;
|
||||||
|
defaultServerInfoOnDisk: () => Promise<ServerInfo | undefined>;
|
||||||
|
allServersOnDisk: () => Promise<ServerInfo[]>;
|
||||||
|
userOnDisk: () => Promise<{
|
||||||
|
Name: string;
|
||||||
|
AccessToken: string;
|
||||||
|
} | null>;
|
||||||
|
clientVersion: string;
|
||||||
|
currentUser: null | UserDto;
|
||||||
|
fetchCurrentUser: (api: Api | undefined) => Promise<void>;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets app inital route
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
export const setInitialRoute = () => {
|
||||||
|
// useCentralStore.setState((state) => ({ ...state, initialRoute: route }));
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
export const setAppReady = () => {
|
||||||
|
// useCentralStore.setState((state) => ({ ...state, appReady }));
|
||||||
|
};
|
||||||
|
|
||||||
|
const CentralContext = createContext<StoreApi<CentralStore>>(null!);
|
||||||
|
|
||||||
|
export const CentralProvider = ({ children }: { children: ReactNode }) => {
|
||||||
|
const [store] = useState(() =>
|
||||||
|
createStore<CentralStore>()((set) => ({
|
||||||
|
defaultServerOnDisk: async () => await getDefaultServer(),
|
||||||
|
defaultServerInfoOnDisk: async () => {
|
||||||
|
const a = await getDefaultServer();
|
||||||
|
return await getServer(a);
|
||||||
|
},
|
||||||
|
allServersOnDisk: async () => await getAllServers(),
|
||||||
|
userOnDisk: async () => await getUser(),
|
||||||
|
clientVersion: version,
|
||||||
|
currentUser: null,
|
||||||
|
fetchCurrentUser: async (api) => {
|
||||||
|
if (api) {
|
||||||
|
const user = (await getUserApi(api).getCurrentUser()).data;
|
||||||
|
set((s) => ({ ...s, currentUser: user }));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
<CentralContext.Provider value={store}>{children}</CentralContext.Provider>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export function useCentralStore<T>(selector?: (state: CentralStore) => T) {
|
||||||
|
const store = useContext(CentralContext);
|
||||||
|
if (!store) {
|
||||||
|
throw new Error("Missing CentralProvider");
|
||||||
|
}
|
||||||
|
return useStoreWithEqualityFn(store, selector!, shallow);
|
||||||
|
}
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
import { create } from "zustand";
|
import { shallow } from "zustand/shallow";
|
||||||
|
import { createWithEqualityFn } from "zustand/traditional";
|
||||||
|
|
||||||
export const useDrawerStore = create((set) => ({
|
export const useDrawerStore = createWithEqualityFn(
|
||||||
|
(set) => ({
|
||||||
open: false,
|
open: false,
|
||||||
setOpen: (sopen) => set((state) => ({ ...state, open: sopen })),
|
setOpen: (sopen) => set((state) => ({ ...state, open: sopen })),
|
||||||
}));
|
}),
|
||||||
|
shallow,
|
||||||
|
);
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import { create } from "zustand";
|
||||||
|
import { devtools } from "zustand/middleware";
|
||||||
|
import { immer } from "zustand/middleware/immer";
|
||||||
|
import { shallow } from "zustand/shallow";
|
||||||
|
import { createWithEqualityFn } from "zustand/traditional";
|
||||||
|
import { usePlaybackStore } from "./playback";
|
||||||
|
|
||||||
|
type PhotosPlaybackStore = {
|
||||||
|
photos: BaseItemDto[] | null;
|
||||||
|
index: number;
|
||||||
|
playPhotos: (photos: BaseItemDto[], index: number) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
type PhotosPlaybackStoreActions = {
|
||||||
|
playPhotos: (photos: BaseItemDto[]) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const usePhotosPlayback = createWithEqualityFn<PhotosPlaybackStore>()(
|
||||||
|
devtools(
|
||||||
|
immer((set) => ({
|
||||||
|
photos: null,
|
||||||
|
playPhotos: (photos, index) =>
|
||||||
|
set((state) => {
|
||||||
|
state.photos = photos;
|
||||||
|
state.index = index;
|
||||||
|
}),
|
||||||
|
index: 0,
|
||||||
|
})),
|
||||||
|
),
|
||||||
|
shallow,
|
||||||
|
);
|
||||||
+22
-16
@@ -6,13 +6,14 @@ import type {
|
|||||||
import { getMediaInfoApi } from "@jellyfin/sdk/lib/utils/api/media-info-api";
|
import { getMediaInfoApi } from "@jellyfin/sdk/lib/utils/api/media-info-api";
|
||||||
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
import { create } from "zustand";
|
import { shallow } from "zustand/shallow";
|
||||||
|
import { createWithEqualityFn } from "zustand/traditional";
|
||||||
import getSubtitle from "../methods/getSubtitles";
|
import getSubtitle from "../methods/getSubtitles";
|
||||||
import playbackProfile from "../playback-profiles";
|
import playbackProfile from "../playback-profiles";
|
||||||
import type IntroMediaInfo from "../types/introMediaInfo";
|
import type IntroMediaInfo from "../types/introMediaInfo";
|
||||||
import type subtitlePlaybackInfo from "../types/subtitlePlaybackInfo";
|
import type subtitlePlaybackInfo from "../types/subtitlePlaybackInfo";
|
||||||
import { axiosClient, useApiInContext } from "./api";
|
import { axiosClient } from "./api";
|
||||||
import { playAudio } from "./audioPlayback";
|
import { generateAudioStreamUrl, playAudio } from "./audioPlayback";
|
||||||
import useQueue, { setQueue, setTrackIndex } from "./queue";
|
import useQueue, { setQueue, setTrackIndex } from "./queue";
|
||||||
|
|
||||||
type PlaybackStore = {
|
type PlaybackStore = {
|
||||||
@@ -34,7 +35,8 @@ type PlaybackStore = {
|
|||||||
intro: IntroMediaInfo | undefined;
|
intro: IntroMediaInfo | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const usePlaybackStore = create<PlaybackStore>(() => ({
|
export const usePlaybackStore = createWithEqualityFn<PlaybackStore>(
|
||||||
|
() => ({
|
||||||
itemName: undefined!,
|
itemName: undefined!,
|
||||||
episodeTitle: "",
|
episodeTitle: "",
|
||||||
mediaSource: {
|
mediaSource: {
|
||||||
@@ -58,7 +60,9 @@ export const usePlaybackStore = create<PlaybackStore>(() => ({
|
|||||||
item: null,
|
item: null,
|
||||||
playsessionId: "",
|
playsessionId: "",
|
||||||
intro: undefined,
|
intro: undefined,
|
||||||
}));
|
}),
|
||||||
|
shallow,
|
||||||
|
);
|
||||||
|
|
||||||
export const playItem = (
|
export const playItem = (
|
||||||
itemName: string | React.Component | undefined | null,
|
itemName: string | React.Component | undefined | null,
|
||||||
@@ -135,16 +139,16 @@ export const playItemFromQueue = async (
|
|||||||
const prevMediaSourceId = usePlaybackStore.getState().mediaSource.id;
|
const prevMediaSourceId = usePlaybackStore.getState().mediaSource.id;
|
||||||
const item = queueItems[requestedItemIndex];
|
const item = queueItems[requestedItemIndex];
|
||||||
if (item.Type === "Audio") {
|
if (item.Type === "Audio") {
|
||||||
const urlOptions = {
|
const playbackUrl = generateAudioStreamUrl(
|
||||||
deviceId: api?.deviceInfo.id,
|
item.Id,
|
||||||
userId,
|
userId,
|
||||||
api_key: api?.accessToken,
|
api?.deviceInfo.id,
|
||||||
};
|
api?.basePath,
|
||||||
const urlParams = new URLSearchParams(urlOptions).toString();
|
api?.accessToken,
|
||||||
|
);
|
||||||
const playbackUrl = `${api.basePath}/Audio/${item?.Id}/universal?${urlParams}`;
|
|
||||||
console.log(item);
|
console.log(item);
|
||||||
playAudio(playbackUrl, item, undefined, queueItems, requestedItemIndex);
|
playAudio(playbackUrl, item, undefined);
|
||||||
|
setQueue(queueItems, requestedItemIndex);
|
||||||
} else {
|
} else {
|
||||||
const mediaSource = (
|
const mediaSource = (
|
||||||
await getMediaInfoApi(api).getPostedPlaybackInfo({
|
await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||||
@@ -249,7 +253,8 @@ interface PlaybackDataLoadState {
|
|||||||
setisPending: (loading: boolean) => void;
|
setisPending: (loading: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const usePlaybackDataLoadStore = create<PlaybackDataLoadState>(
|
export const usePlaybackDataLoadStore =
|
||||||
|
createWithEqualityFn<PlaybackDataLoadState>(
|
||||||
(set) => ({
|
(set) => ({
|
||||||
isPending: false,
|
isPending: false,
|
||||||
setisPending: (loading: boolean) =>
|
setisPending: (loading: boolean) =>
|
||||||
@@ -258,7 +263,8 @@ export const usePlaybackDataLoadStore = create<PlaybackDataLoadState>(
|
|||||||
isPending: loading,
|
isPending: loading,
|
||||||
})),
|
})),
|
||||||
}),
|
}),
|
||||||
);
|
shallow,
|
||||||
|
);
|
||||||
|
|
||||||
export const changeSubtitleTrack = (
|
export const changeSubtitleTrack = (
|
||||||
trackIndex: number,
|
trackIndex: number,
|
||||||
@@ -273,7 +279,7 @@ export const changeSubtitleTrack = (
|
|||||||
track: trackIndex,
|
track: trackIndex,
|
||||||
format: requiredSubtitle?.[0]?.Codec,
|
format: requiredSubtitle?.[0]?.Codec,
|
||||||
allTracks,
|
allTracks,
|
||||||
enable: true,
|
enable: trackIndex !== -1,
|
||||||
};
|
};
|
||||||
usePlaybackStore.setState(prevState);
|
usePlaybackStore.setState(prevState);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
import { create } from "zustand";
|
|
||||||
import { getRuntimeMusic, secToTicks } from "../date/time";
|
|
||||||
|
|
||||||
const usePlayer = create(() => ({
|
|
||||||
timeString: 0,
|
|
||||||
}));
|
|
||||||
|
|
||||||
export const setTime = (sec: number) => {
|
|
||||||
const a = getRuntimeMusic(secToTicks(sec));
|
|
||||||
console.log(a);
|
|
||||||
usePlayer.setState(() => ({ timeString: a }));
|
|
||||||
};
|
|
||||||
|
|
||||||
export default usePlayer;
|
|
||||||
@@ -1,15 +1,19 @@
|
|||||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { create } from "zustand";
|
import { shallow } from "zustand/shallow";
|
||||||
|
import { createWithEqualityFn } from "zustand/traditional";
|
||||||
|
|
||||||
interface QueueStore {
|
interface QueueStore {
|
||||||
tracks: BaseItemDto[];
|
tracks: BaseItemDto[] | undefined;
|
||||||
currentItemIndex: number;
|
currentItemIndex: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const useQueue = create<QueueStore>(() => ({
|
const useQueue = createWithEqualityFn<QueueStore>(
|
||||||
|
() => ({
|
||||||
tracks: [],
|
tracks: [],
|
||||||
currentItemIndex: 0,
|
currentItemIndex: 0,
|
||||||
}));
|
}),
|
||||||
|
shallow,
|
||||||
|
);
|
||||||
|
|
||||||
export const setQueue = (
|
export const setQueue = (
|
||||||
tracks: BaseItemDto[] | undefined,
|
tracks: BaseItemDto[] | undefined,
|
||||||
@@ -23,4 +27,12 @@ export const setTrackIndex = (index: number) => {
|
|||||||
useQueue.setState((state) => ({ ...state, currentItemIndex: index }));
|
useQueue.setState((state) => ({ ...state, currentItemIndex: index }));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets the Queue store
|
||||||
|
*/
|
||||||
|
export const clearQueue = () => {
|
||||||
|
useQueue.setState(useQueue.getInitialState());
|
||||||
|
};
|
||||||
|
|
||||||
export default useQueue;
|
export default useQueue;
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import { create } from "zustand";
|
|
||||||
|
|
||||||
export const useServerStore = create(() => ({
|
|
||||||
reachable: true,
|
|
||||||
}));
|
|
||||||
export const setServerReachability = (reach) =>
|
|
||||||
useServerStore.setState(() => ({ reachable: reach }));
|
|
||||||
@@ -1,9 +1,13 @@
|
|||||||
import { create } from "zustand";
|
import { shallow } from "zustand/shallow";
|
||||||
|
import { createWithEqualityFn } from "zustand/traditional";
|
||||||
|
|
||||||
const useSettingsStore = create(() => ({
|
const useSettingsStore = createWithEqualityFn(
|
||||||
|
() => ({
|
||||||
dialogOpen: false,
|
dialogOpen: false,
|
||||||
tabValue: 0,
|
tabValue: 0,
|
||||||
}));
|
}),
|
||||||
|
shallow,
|
||||||
|
);
|
||||||
|
|
||||||
const setDialogOpen = (dialog: boolean) =>
|
const setDialogOpen = (dialog: boolean) =>
|
||||||
useSettingsStore.setState((state) => ({ ...state, dialogOpen: dialog }));
|
useSettingsStore.setState((state) => ({ ...state, dialogOpen: dialog }));
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import type {
|
|||||||
import type IntroMediaInfo from "./introMediaInfo";
|
import type IntroMediaInfo from "./introMediaInfo";
|
||||||
|
|
||||||
interface PlayResult {
|
interface PlayResult {
|
||||||
item: BaseItemDtoQueryResult;
|
item: BaseItemDtoQueryResult | undefined;
|
||||||
mediaSource: PlaybackInfoResponse;
|
mediaSource: PlaybackInfoResponse | undefined;
|
||||||
introInfo: IntroMediaInfo | undefined;
|
introInfo: IntroMediaInfo | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loaded 100 of 102 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user