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.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
- OS: [e.g. Windows]
|
||||
- Version [e.g. v0.0.6-dev]
|
||||
- Jellyfin Version [e.g. 10.9]
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
+1
-1
@@ -31,7 +31,7 @@ target/
|
||||
|
||||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
||||
Cargo.lock
|
||||
# Cargo.lock
|
||||
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
|
||||
+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",
|
||||
"[scss]": {
|
||||
"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)
|
||||
> **Note** : This is an unstable release
|
||||
- feat: add video player slider bubble theming #337
|
||||
|
||||
+18
-42
@@ -4,61 +4,39 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<!-- <script src="http://localhost:8097"></script> -->
|
||||
<script src="http://localhost:8097"></script>
|
||||
<title>Jellyplayer</title>
|
||||
<style>
|
||||
.app-loading {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
background: #fff;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%,-50%);
|
||||
width: 10em;
|
||||
height: 10em;
|
||||
background: rgb(180 180 180);
|
||||
z-index: 100000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
transition: opacity 0.25s ease-in-out;
|
||||
opacity: 0;
|
||||
animation: fadeIn linear 500ms forwards;
|
||||
mask-image: url("./src/assets/icon-outline.png");
|
||||
mask-size: contain;
|
||||
}
|
||||
|
||||
.app-loading.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.app-loading-logo {
|
||||
width: 5vw;
|
||||
}
|
||||
|
||||
.app-loading-bar-container{
|
||||
height: 2px;
|
||||
width: 16vw;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: 36vh;
|
||||
transform: translateX(-50%);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.app-loading-bar{
|
||||
width: 100%;
|
||||
.app-loading-anim{
|
||||
width: 150%;
|
||||
height: 100%;
|
||||
background: #101010;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background: linear-gradient(to right,transparent,rgb(255 255 255),transparent);
|
||||
transform: scaleX(0);
|
||||
animation: loading 1s ease-in-out infinite both;
|
||||
animation: loading 0.75s linear infinite both;
|
||||
transform-origin: left;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
0%{
|
||||
opacity: 0;
|
||||
}
|
||||
100%{
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@keyframes loading {
|
||||
0%{
|
||||
transform: translate(-100%);
|
||||
@@ -75,10 +53,8 @@
|
||||
|
||||
<body>
|
||||
<div class="app-loading">
|
||||
<img src="./src/assets/icon-outline.svg" class="app-loading-logo" />
|
||||
<div class="app-loading-bar-container">
|
||||
<div class="app-loading-bar"></div>
|
||||
</div>
|
||||
<!-- <img src="./src/assets/icon-outline.svg" class="app-loading-logo" /> -->
|
||||
<div class="app-loading-anim"></div>
|
||||
</div>
|
||||
<div id="root"></div>
|
||||
<svg style="width: 0; height: 0; position: absolute" aria-hidden="true" focusable="false">
|
||||
|
||||
+17
-17
@@ -1,19 +1,19 @@
|
||||
{
|
||||
"version": "0.0.5-dev",
|
||||
"notes": "\n- feat(web): Add new About page (#258) by @prayag17\n- feat(web): Allow managing servers from settings dialog by @prayag17\n- feat(search): Add Episode to search by @prayag17\n- feat(settings-server): Add a refretch button by @prayag17\n- feat(web): Add a global query fetch/mutation status by @prayag17\n- fix(server): Use redirect instead of relaunch when changing or deleting a server by @prayag17\n- refactor(player): Rewrite and improve video playback by @prayag17\n- feat(web): Use season backdrop in series page if available by @prayag17\n- feat(player): Allow selecting subtitles during playback by @prayag17\n- feat(ui): Add new episode layout by @prayag17",
|
||||
"pub_date": "2024-03-17T11:50:31.121Z",
|
||||
"platforms": {
|
||||
"darwin-x86_64": {
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVROHVTNk5NMHU2bVZjYWVCcmxtUk5tRTV0bC9acGxUQkdGMlMrVFdkOVJCS3ZsMlY1aXR0M3BvdnBVTnl6MUVpcWsxUzdFbVNXbHF5S1pQbTZIM0JXallCeklYaUdyWFFBPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzEwNjc1OTMxCWZpbGU6SmVsbHlQbGF5ZXIuYXBwLnRhci5negpGM2xCQnR1YWhDWi9mMCtLZjFHQ0twMUNub3VBTHE2SHZSMnpGOVRWVGVncE42ODZ5Q2M1bm9aa3VGUFhpM245eVhIMDZWWkRyQnVMaWY4c1Z2WE5Edz09Cg==",
|
||||
"url": "https://github.com/prayag17/JellyPlayer/releases/download/v0.0.5-dev/JellyPlayer_x64.app.tar.gz"
|
||||
},
|
||||
"linux-x86_64": {
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVROHVTNk5NMHU2bVMvOXE1SGNiWmRDVWVMYVBLTnU4MXJheTd4NmY2WWszRjdUcnRySnl5TkdEVThYa1lHNHRXT1FIUzFwelhMZ3U4S2lJTjI4Y1IrV05iOVRmZWgzS1FrPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzEwNjc2MDE4CWZpbGU6amVsbHktcGxheWVyXzAuMC41LWRldl9hbWQ2NC5BcHBJbWFnZS50YXIuZ3oKcko3VUZFZVcwcVVZK0IwY3lZUlk5WThySjI2NEptY1BFb1dYYlRDMTQxZzFJekovS2tHVFMwK0pTS01JV3NSMWxvL2QwNEVqb2VTZVE2MmQ2UFhXQ1E9PQo=",
|
||||
"url": "https://github.com/prayag17/JellyPlayer/releases/download/v0.0.5-dev/jelly-player_0.0.5-dev_amd64.AppImage.tar.gz"
|
||||
},
|
||||
"windows-x86_64": {
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVROHVTNk5NMHU2bVZyK3o0d0FWVURRcDg3QnorYzNDUVNwamJIZ2JDTTNwUjdFUS9jMXN2cVFiVXNKdFNoaVNUUFlSaVI2Z3dyeEdqWmRCekFqSkYwa09xTFZSaG5mb1FRPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzEwNjc2MjIxCWZpbGU6SmVsbHlQbGF5ZXJfMC4wLjUtZGV2X3g2NC1zZXR1cC5uc2lzLnppcApPdGxzdk1aU0pJSC80a2xvYk5TbWhJeUNvVjNDa2piYkNQOTF0bmFWVTJ6TFVNc0trRkhqeUNxdGNNNUQvUXd4TUpXTzNoRHd1QUN2YnN5Y1BUTGVDQT09Cg==",
|
||||
"url": "https://github.com/prayag17/JellyPlayer/releases/download/v0.0.5-dev/JellyPlayer_0.0.5-dev_x64-setup.nsis.zip"
|
||||
}
|
||||
}
|
||||
"version": "0.0.6-dev",
|
||||
"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-09-06T20:40:35.324Z",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSNkxEL1dFMElZL1VsZ01leXRhMXFrek9ENWZCWHZPR3Y1Ky9SZ3BOc2hEeFlMU0pVR1gzL1NNdytOL1hGTzU5enpZNVRlY01JaDNjaTN3azdDMU9BcVVUWEg5RzdOY1FvPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzI1NjU0NzUzCWZpbGU6QmxpbmsuYXBwLnRhci5negphcUh0QXFNUnBEWUFGZGU3V0pzQXN5eXhzSmNOdzNoSDFLV3BlbHNGKzFvWXpJR0V4UmJoYTNNV0tZZ0VKcHdDbERxWFpEYk5kUVVxZWFnWnIrSThBUT09Cg==",
|
||||
"url": "https://github.com/prayag17/Blink/releases/download/v0.0.6-dev/Blink_aarch64.app.tar.gz"
|
||||
},
|
||||
"linux-x86_64": {
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSNkxEL1dFMElZL1JtYjlPdWJ2WngrU21iV1ZSd3BCWjBSdDVxT0VGcSs5VFZ0YUs1eFlIbnNlUnN1VzJLOUg4K25sdVRWUzhkR0VJWDBIa081R01aUyt4S3VQZHlSQ3d3PQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzI1NjU1MTAxCWZpbGU6QmxpbmtfMC4wLjYtZGV2X2FtZDY0LkFwcEltYWdlLnRhci5nego4ZllLcnRyWW5FM0JRY0dZUkJocFdsNlRzdjdnY3dDUFpGSENNSVNwdkRMZStvZWZTSlFLL25IR1A3a2pzdTlBUjNveVJ5VDFqYkxJdWF5MWFFeWxDdz09Cg==",
|
||||
"url": "https://github.com/prayag17/Blink/releases/download/v0.0.6-dev/Blink_0.0.6-dev_amd64.AppImage.tar.gz"
|
||||
},
|
||||
"windows-x86_64": {
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSNkxEL1dFMElZL2F4bGtQUmxDVjZadzRuNHk0RTd5RmRJbmVsOEwxaTV1U3FzZHAveEhiU0xmcGx2N0toaUR4alRiS2lmTTU0QStHc2JzT2diR1JjRm5VZU1SUWFuS0F3PQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzI1NjU1MjMyCWZpbGU6QmxpbmtfMC4wLjYtZGV2X3g2NC1zZXR1cC5uc2lzLnppcApPdk5zQ0NFcFQySXNjck8zTEM4SitwdTV6UXRKYnpPKzBJQnVJRDkxWjdqWGgwaXBSb1k0aGMvVEhwWWhBTEJzZHRhVy9KU0lCbjl2bG45WUJxOUlBZz09Cg==",
|
||||
"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",
|
||||
"private": true,
|
||||
"version": "0.0.6-dev",
|
||||
"version": "0.0.7-dev",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite && tsr watch",
|
||||
"dev": "vite --force && tsr watch",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"tauri": "tauri",
|
||||
@@ -13,35 +13,43 @@
|
||||
"tanstack-router-dev": "tsr watch"
|
||||
},
|
||||
"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/styled": "^11.13.0",
|
||||
"@fontsource-variable/jetbrains-mono": "^5.0.22",
|
||||
"@fontsource-variable/noto-sans": "^5.0.5",
|
||||
"@jellyfin/sdk": "0.10.0",
|
||||
"@million/lint": "1.0.0-rc.84",
|
||||
"@mui/lab": "6.0.0-beta.9",
|
||||
"@mui/material": "6.0.2",
|
||||
"@react-spring/web": "^9.7.4",
|
||||
"@tanem/react-nprogress": "^5.0.51",
|
||||
"@tanstack/react-query": "^5.55.0",
|
||||
"@tanstack/react-query-devtools": "^5.55.0",
|
||||
"@tanstack/react-router": "^1.56.1",
|
||||
"@tanstack/react-virtual": "^3.10.7",
|
||||
"@tauri-apps/api": "2.0.0-beta.15",
|
||||
"@tauri-apps/plugin-clipboard-manager": "2.1.0-beta.5",
|
||||
"@tauri-apps/plugin-process": "2.0.0-rc.1",
|
||||
"@fontsource-variable/jetbrains-mono": "^5.1.1",
|
||||
"@fontsource-variable/noto-sans": "^5.1.0",
|
||||
"@jellyfin/sdk": "0.11.0",
|
||||
"@million/lint": "^1.0.12",
|
||||
"@mui/lab": "6.0.0-beta.15",
|
||||
"@mui/material": "6.1.7",
|
||||
"@react-spring/web": "^9.7.5",
|
||||
"@tanem/react-nprogress": "^5.0.53",
|
||||
"@tanstack/react-query": "^5.60.6",
|
||||
"@tanstack/react-query-devtools": "^5.60.6",
|
||||
"@tanstack/react-router": "^1.82.1",
|
||||
"@tanstack/react-virtual": "^3.10.9",
|
||||
"@tauri-apps/api": "2.1.1",
|
||||
"@tauri-apps/plugin-clipboard-manager": "2.1.0-beta.6",
|
||||
"@tauri-apps/plugin-dialog": "2.0.1",
|
||||
"@tauri-apps/plugin-notification": "2.0.0",
|
||||
"@tauri-apps/plugin-process": "2.0.0",
|
||||
"@tauri-apps/plugin-store": "github:tauri-apps/tauri-plugin-store#v2",
|
||||
"@tauri-apps/plugin-updater": "2.0.0-rc.2",
|
||||
"@types/node": "^22.5.4",
|
||||
"@types/react": "^18.3.5",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@tauri-apps/plugin-updater": "2.0.0",
|
||||
"@tauri-apps/plugin-upload": "2.1.0",
|
||||
"@types/node": "^22.9.1",
|
||||
"@types/react": "^18.3.12",
|
||||
"@types/react-dom": "^18.3.1",
|
||||
"axios": "^1.7.7",
|
||||
"axios-tauri-api-adapter": "^0.2.2",
|
||||
"axios-tauri-api-adapter": "^2.0.3",
|
||||
"blurhash": "^2.0.5",
|
||||
"framer-motion": "^11.5.4",
|
||||
"framer-motion": "^11.11.17",
|
||||
"immer": "^10.1.1",
|
||||
"jassub": "^1.7.17",
|
||||
"lodash": "^4.17.21",
|
||||
"material-symbols": "^0.23.0",
|
||||
"material-symbols": "^0.27.0",
|
||||
"million": "^3.1.11",
|
||||
"notistack": "^3.0.1",
|
||||
"react": "18.3.1",
|
||||
@@ -49,29 +57,29 @@
|
||||
"react-dnd": "^16.0.1",
|
||||
"react-dnd-html5-backend": "^16.0.1",
|
||||
"react-dom": "18.3.1",
|
||||
"react-error-boundary": "^4.0.13",
|
||||
"react-error-boundary": "^4.1.2",
|
||||
"react-markdown": "^9.0.1",
|
||||
"react-multi-carousel": "^2.8.5",
|
||||
"react-player": "^2.16.0",
|
||||
"react-use-konami": "^1.1.0",
|
||||
"remark-gfm": "^4.0.0",
|
||||
"typescript": "^5.5.4",
|
||||
"vite-plugin-svgr": "^4.2.0",
|
||||
"wavesurfer.js": "^7.8.4",
|
||||
"zustand": "^4.5.5"
|
||||
"typescript": "^5.6.3",
|
||||
"vite-plugin-svgr": "^4.3.0",
|
||||
"wavesurfer.js": "^7.8.8",
|
||||
"zustand": "5.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/plugin-proposal-optional-chaining-assign": "^7.24.7",
|
||||
"@biomejs/biome": "^1.8.3",
|
||||
"@tanstack/router-cli": "^1.56.1",
|
||||
"@tanstack/router-devtools": "^1.56.1",
|
||||
"@tanstack/router-vite-plugin": "^1.56.1",
|
||||
"@tauri-apps/cli": "2.0.0-beta.22",
|
||||
"@types/lodash": "^4.17.7",
|
||||
"@vitejs/plugin-react": "^4.3.1",
|
||||
"@babel/plugin-proposal-optional-chaining-assign": "^7.25.9",
|
||||
"@biomejs/biome": "^1.9.4",
|
||||
"@tanstack/router-cli": "^1.81.9",
|
||||
"@tanstack/router-devtools": "^1.82.1",
|
||||
"@tanstack/router-vite-plugin": "^1.81.9",
|
||||
"@tauri-apps/cli": "2.1.0",
|
||||
"@types/lodash": "^4.17.13",
|
||||
"@vitejs/plugin-react": "^4.3.3",
|
||||
"prop-types": "^15.8.1",
|
||||
"sass": "^1.78.0",
|
||||
"vite": "^5.4.3"
|
||||
"sass": "^1.81.0",
|
||||
"vite": "^5.4.11"
|
||||
},
|
||||
"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]
|
||||
name = "blink"
|
||||
version = "0.0.6-dev"
|
||||
version = "0.0.7-dev"
|
||||
description = "A Modern Jellyfin Client"
|
||||
authors = ["prayag17", "JellyPlayer contributors (https://github.com/prayag17/JellyPlayer/graphs/contributors)"]
|
||||
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-updater = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||
tauri-plugin-clipboard-manager = "2.1.0-beta.6"
|
||||
tauri-plugin-notification = "2.0.0-rc.1"
|
||||
tauri-plugin-upload = "2.0.0"
|
||||
tauri-plugin-dialog = "2.0.0"
|
||||
|
||||
[features]
|
||||
# by default Tauri runs in production mode
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
"store:allow-keys",
|
||||
"store:allow-load",
|
||||
"updater:allow-check",
|
||||
"updater:allow-download-and-install"
|
||||
"updater:allow-download-and-install",
|
||||
"notification:default",
|
||||
"core:webview:allow-internal-toggle-devtools",
|
||||
"dialog:default",
|
||||
"upload:allow-download"
|
||||
]
|
||||
}
|
||||
@@ -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"]}}
|
||||
+1063
-1404
File diff suppressed because it is too large.
Load diff
+1063
-1404
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() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_upload::init())
|
||||
.plugin(tauri_plugin_notification::init())
|
||||
.plugin(tauri_plugin_clipboard_manager::init())
|
||||
.plugin(
|
||||
tauri_plugin_log::Builder::default()
|
||||
|
||||
+83
-88
@@ -1,89 +1,84 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
|
||||
"build": {
|
||||
"beforeBuildCommand": "pnpm run build",
|
||||
"beforeDevCommand": "pnpm run dev",
|
||||
"frontendDist": "../dist",
|
||||
"devUrl": "http://localhost:5173"
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"category": "Video",
|
||||
"copyright": "GPL-3.0-only",
|
||||
"windows": {
|
||||
"certificateThumbprint": null,
|
||||
"digestAlgorithm": "sha256",
|
||||
"timestampUrl": "",
|
||||
"nsis": {
|
||||
"sidebarImage": "../public/installerSideBarImage.bmp",
|
||||
"headerImage": "../public/installerHeaderImage.bmp",
|
||||
"installerIcon": "icons/icon.ico",
|
||||
"displayLanguageSelector": true
|
||||
}
|
||||
},
|
||||
"externalBin": [],
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"linux": {
|
||||
"deb": {
|
||||
"depends": []
|
||||
},
|
||||
"appimage": {
|
||||
"bundleMediaFramework": true
|
||||
}
|
||||
},
|
||||
"longDescription": "A modern desktop client for Jellyfin",
|
||||
"macOS": {
|
||||
"entitlements": null,
|
||||
"exceptionDomain": "",
|
||||
"frameworks": [],
|
||||
"providerShortName": null,
|
||||
"signingIdentity": null
|
||||
},
|
||||
"resources": [],
|
||||
"shortDescription": "Blink",
|
||||
"targets": [
|
||||
"deb",
|
||||
"appimage",
|
||||
"nsis",
|
||||
"app",
|
||||
"dmg"
|
||||
],
|
||||
"licenseFile": "../LICENSE",
|
||||
"createUpdaterArtifacts": "v1Compatible"
|
||||
},
|
||||
"productName": "Blink",
|
||||
"version": "../package.json",
|
||||
"identifier": "com.blink.prayag17",
|
||||
"plugins": {
|
||||
"updater": {
|
||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEZEMTg0MjEzRDYzRjJDN0EKUldSNkxEL1dFMElZL1dxbHA0V2lyVDFEdGpOZXkxMG9XdHVLVnRpVVV5c1Z0OFNRUE45dkpxbFAK",
|
||||
"endpoints": [
|
||||
"https://raw.githack.com/prayag17/JellyPlayer/main/latest.json"
|
||||
]
|
||||
}
|
||||
},
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"fullscreen": false,
|
||||
"height": 600,
|
||||
"width": 800,
|
||||
"resizable": true,
|
||||
"title": "Blink",
|
||||
"visible": true,
|
||||
"center": true,
|
||||
"label": "main",
|
||||
"dragDropEnabled": false
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
"csp": null
|
||||
}
|
||||
}
|
||||
}
|
||||
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
|
||||
"build": {
|
||||
"beforeBuildCommand": "pnpm run build",
|
||||
"beforeDevCommand": "pnpm run dev",
|
||||
"frontendDist": "../dist",
|
||||
"devUrl": "http://localhost:5173"
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"category": "Video",
|
||||
"copyright": "GPL-3.0-only",
|
||||
"windows": {
|
||||
"certificateThumbprint": null,
|
||||
"digestAlgorithm": "sha256",
|
||||
"timestampUrl": "",
|
||||
"nsis": {
|
||||
"sidebarImage": "../public/installerSideBarImage.bmp",
|
||||
"headerImage": "../public/installerHeaderImage.bmp",
|
||||
"installerIcon": "icons/icon.ico",
|
||||
"displayLanguageSelector": true
|
||||
}
|
||||
},
|
||||
"externalBin": [],
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"linux": {
|
||||
"deb": {
|
||||
"depends": []
|
||||
},
|
||||
"appimage": {
|
||||
"bundleMediaFramework": true
|
||||
}
|
||||
},
|
||||
"longDescription": "A modern desktop client for Jellyfin",
|
||||
"macOS": {
|
||||
"entitlements": null,
|
||||
"exceptionDomain": "",
|
||||
"frameworks": [],
|
||||
"providerShortName": null,
|
||||
"signingIdentity": null
|
||||
},
|
||||
"resources": [],
|
||||
"shortDescription": "Blink",
|
||||
"targets": ["deb", "appimage", "nsis", "app", "dmg"],
|
||||
"licenseFile": "../LICENSE",
|
||||
"createUpdaterArtifacts": "v1Compatible"
|
||||
},
|
||||
"productName": "Blink",
|
||||
"version": "../package.json",
|
||||
"identifier": "com.blink.prayag17",
|
||||
"plugins": {
|
||||
"updater": {
|
||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEZEMTg0MjEzRDYzRjJDN0EKUldSNkxEL1dFMElZL1dxbHA0V2lyVDFEdGpOZXkxMG9XdHVLVnRpVVV5c1Z0OFNRUE45dkpxbFAK",
|
||||
"endpoints": [
|
||||
"https://rawcdn.githack.com/prayag17/Blink/refs/heads/main/latest.json"
|
||||
]
|
||||
}
|
||||
},
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"fullscreen": false,
|
||||
"height": 600,
|
||||
"width": 800,
|
||||
"resizable": true,
|
||||
"title": "Blink",
|
||||
"visible": true,
|
||||
"center": true,
|
||||
"label": "main",
|
||||
"dragDropEnabled": false,
|
||||
"backgroundColor": "#08001f"
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
"csp": null
|
||||
}
|
||||
}
|
||||
}
|
||||
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">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M654.715 756L52 1103.98L654.715 1451.96L1257.43 1103.98V408.022L654.715 60.0444L52 408.022L654.715 756ZM654.715 0L1309.43 378V1134L654.715 1512L0 1134V1073.96V438.044V378L654.715 0Z" fill="#101010"/>
|
||||
<svg width="1512" height="1512" viewBox="0 0 1512 1512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M755.715 756L153 1103.98L755.715 1451.96L1358.43 1103.98V408.022L755.715 60.0444L153 408.022L755.715 756ZM755.715 0L1410.43 378V1134L755.715 1512L101 1134V1073.96V438.044V378L755.715 0Z" fill="white"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 360 B After Width: | Height: | Size: 362 B |
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
@@ -1,4 +1,3 @@
|
||||
import useDebounce from "@/utils/hooks/useDebounce";
|
||||
import React, {
|
||||
type ReactNode,
|
||||
useCallback,
|
||||
@@ -11,12 +10,7 @@ import { useSpring } from "@react-spring/web";
|
||||
import { debounce } from "lodash";
|
||||
|
||||
import "./style.scss";
|
||||
import { Button, IconButton } from "@mui/material";
|
||||
|
||||
enum Direction {
|
||||
RIGHT = 0,
|
||||
LEFT = 1,
|
||||
}
|
||||
import { IconButton } from "@mui/material";
|
||||
|
||||
const Slider = ({
|
||||
content,
|
||||
@@ -76,7 +70,7 @@ const Slider = ({
|
||||
},
|
||||
}));
|
||||
|
||||
const slide = (direction: Direction) => {
|
||||
const slideLeft = useCallback(() => {
|
||||
const clientWidth =
|
||||
containerRef.current?.getBoundingClientRect().width ?? 0;
|
||||
const cardWidth =
|
||||
@@ -86,66 +80,75 @@ const Slider = ({
|
||||
const visibleItems = Math.floor(clientWidth / cardWidth);
|
||||
const scrollOffset = scrollPosition % cardWidth;
|
||||
|
||||
if (direction === Direction.LEFT) {
|
||||
const newX = Math.max(
|
||||
scrollPosition - scrollOffset - visibleItems * cardWidth,
|
||||
0,
|
||||
);
|
||||
setX.start({
|
||||
from: { x: scrollPosition },
|
||||
to: { x: newX },
|
||||
onChange: (results) => {
|
||||
if (containerRef.current) {
|
||||
containerRef.current.scrollLeft = results.value.x;
|
||||
}
|
||||
},
|
||||
reset: true,
|
||||
config: { friction: 60, tension: 1000, velocity: 2 },
|
||||
});
|
||||
const newX = Math.max(
|
||||
scrollPosition - scrollOffset - visibleItems * cardWidth,
|
||||
0,
|
||||
);
|
||||
setX({
|
||||
from: { x: scrollPosition },
|
||||
to: { x: newX },
|
||||
onChange: (results) => {
|
||||
if (containerRef.current) {
|
||||
containerRef.current.scrollLeft = results.value.x;
|
||||
}
|
||||
},
|
||||
reset: true,
|
||||
config: { friction: 60, tension: 1000, velocity: 2 },
|
||||
});
|
||||
|
||||
if (newX === 0) {
|
||||
setScrollPos({ isStart: true, isEnd: false });
|
||||
} else {
|
||||
setScrollPos({ isStart: false, isEnd: false });
|
||||
}
|
||||
} else if (direction === Direction.RIGHT) {
|
||||
const newX = Math.min(
|
||||
scrollPosition - scrollOffset + visibleItems * cardWidth,
|
||||
containerRef.current?.scrollWidth ?? 0 - clientWidth,
|
||||
);
|
||||
setX.start({
|
||||
from: { x: scrollPosition },
|
||||
to: { x: newX },
|
||||
onChange: (results) => {
|
||||
if (containerRef.current) {
|
||||
containerRef.current.scrollLeft = results.value.x;
|
||||
}
|
||||
},
|
||||
reset: true,
|
||||
config: { friction: 60, tension: 500, velocity: 2 },
|
||||
});
|
||||
|
||||
if (newX >= (containerRef.current?.scrollWidth ?? 0) - clientWidth) {
|
||||
setScrollPos({ isStart: false, isEnd: true });
|
||||
} else {
|
||||
setScrollPos({ isStart: false, isEnd: false });
|
||||
}
|
||||
if (newX === 0) {
|
||||
setScrollPos({ isStart: true, isEnd: false });
|
||||
} else {
|
||||
setScrollPos({ isStart: false, isEnd: false });
|
||||
}
|
||||
};
|
||||
}, [setX]);
|
||||
|
||||
const slideRight = useCallback(() => {
|
||||
const clientWidth =
|
||||
containerRef.current?.getBoundingClientRect().width ?? 0;
|
||||
const cardWidth =
|
||||
containerRef.current?.firstElementChild?.getBoundingClientRect().width ??
|
||||
0;
|
||||
const scrollPosition = containerRef.current?.scrollLeft ?? 0;
|
||||
const visibleItems = Math.floor(clientWidth / cardWidth);
|
||||
const scrollOffset = scrollPosition % cardWidth;
|
||||
|
||||
const newX = Math.min(
|
||||
scrollPosition - scrollOffset + visibleItems * cardWidth,
|
||||
containerRef.current?.scrollWidth ?? 0 - clientWidth,
|
||||
);
|
||||
setX({
|
||||
from: { x: scrollPosition },
|
||||
to: { x: newX },
|
||||
onChange: (results) => {
|
||||
if (containerRef.current) {
|
||||
containerRef.current.scrollLeft = results.value.x;
|
||||
}
|
||||
},
|
||||
reset: true,
|
||||
config: { friction: 60, tension: 500, velocity: 2 },
|
||||
});
|
||||
|
||||
if (newX >= (containerRef.current?.scrollWidth ?? 0) - clientWidth) {
|
||||
setScrollPos({ isStart: false, isEnd: true });
|
||||
} else {
|
||||
setScrollPos({ isStart: false, isEnd: false });
|
||||
}
|
||||
}, [setX]);
|
||||
|
||||
return (
|
||||
<div className="slider">
|
||||
<IconButton
|
||||
className="slider-button left"
|
||||
onClick={() => slide(Direction.LEFT)}
|
||||
onClick={slideLeft}
|
||||
disabled={scrollPos.isStart}
|
||||
variant="contained"
|
||||
>
|
||||
<span className="material-symbols-rounded">chevron_left</span>
|
||||
</IconButton>
|
||||
<div className="slider-track" ref={containerRef} onScroll={onScroll}>
|
||||
{content?.map((item, index) => (
|
||||
<div
|
||||
//biome-ignore lint/suspicious/noArrayIndexKey: item does not have a unique key
|
||||
key={index}
|
||||
className={
|
||||
currentSlide === index
|
||||
@@ -159,9 +162,8 @@ const Slider = ({
|
||||
</div>
|
||||
<IconButton
|
||||
className="slider-button right"
|
||||
onClick={() => slide(Direction.RIGHT)}
|
||||
onClick={slideRight}
|
||||
disabled={scrollPos.isEnd}
|
||||
variant="contained"
|
||||
>
|
||||
<span className="material-symbols-rounded">chevron_right</span>
|
||||
</IconButton>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { type ReactNode } from "react";
|
||||
import React, { useCallback, useMemo, type ReactNode } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
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 { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
@@ -22,6 +21,7 @@ import "./appBar.scss";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import {
|
||||
setSettingsDialogOpen,
|
||||
setSettingsTabValue,
|
||||
@@ -47,6 +47,7 @@ function ListItemLink(props: ListItemLinkProps) {
|
||||
|
||||
return (
|
||||
<li>
|
||||
{/* @ts-ignore */}
|
||||
<ListItem
|
||||
component={Link}
|
||||
activeClassName="active"
|
||||
@@ -69,6 +70,8 @@ function ListItemLink(props: ListItemLinkProps) {
|
||||
);
|
||||
}
|
||||
|
||||
const MemoizeBackButton = React.memo(BackButton);
|
||||
|
||||
export const AppBar = () => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const navigate = useNavigate();
|
||||
@@ -77,24 +80,16 @@ export const AppBar = () => {
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
enabled: display && Boolean(api?.accessToken),
|
||||
throwOnError: true,
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const libraries = useQuery({
|
||||
queryKey: ["libraries"],
|
||||
queryFn: async () => {
|
||||
const libs = await getUserViewsApi(api).getUserViews({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
});
|
||||
return libs.data;
|
||||
},
|
||||
enabled: !!user.data && !!api.accessToken,
|
||||
enabled: !!user?.Id && !!api.accessToken,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
@@ -105,13 +100,12 @@ export const AppBar = () => {
|
||||
|
||||
const [anchorEl, setAnchorEl] = useState(null);
|
||||
const openMenu = Boolean(anchorEl);
|
||||
const handleMenuOpen = (event) => {
|
||||
const handleMenuOpen = useCallback((event) => {
|
||||
setAnchorEl(event.currentTarget);
|
||||
};
|
||||
const handleMenuClose = () => {
|
||||
}, []);
|
||||
const handleMenuClose = useCallback(() => {
|
||||
setAnchorEl(null);
|
||||
};
|
||||
|
||||
}, []);
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const handleLogout = async () => {
|
||||
@@ -141,6 +135,43 @@ export const AppBar = () => {
|
||||
|
||||
const [showDrawer, setShowDrawer] = useState(false);
|
||||
|
||||
const appBarStyling = useMemo(() => {
|
||||
return {
|
||||
backgroundColor: "transparent",
|
||||
paddingRight: "0 !important",
|
||||
};
|
||||
}, []);
|
||||
const menuStyle = useMemo(() => {
|
||||
return { mt: 2 };
|
||||
}, []);
|
||||
|
||||
const drawerPaperProps = useMemo(() => {
|
||||
return {
|
||||
className: "glass library-drawer",
|
||||
elevation: 6,
|
||||
};
|
||||
}, []);
|
||||
|
||||
const handleNavigateToSearch = useCallback(
|
||||
() => navigate({ to: "/search", search: { query: "" } }),
|
||||
[navigate],
|
||||
);
|
||||
|
||||
const handleDrawerClose = useCallback(() => {
|
||||
setShowDrawer(false);
|
||||
}, []);
|
||||
|
||||
const handleDrawerOpen = useCallback(() => {
|
||||
setShowDrawer(true);
|
||||
}, []);
|
||||
|
||||
const handleNavigateToHome = useCallback(() => navigate({ to: "/home" }), []);
|
||||
const handleNavigateToFavorite = useCallback(() => {
|
||||
navigate({ to: "/favorite" });
|
||||
}, []);
|
||||
|
||||
const menuButtonSx = useMemo(() => ({ p: 0 }), []);
|
||||
|
||||
if (!display) {
|
||||
return <></>;
|
||||
}
|
||||
@@ -148,10 +179,7 @@ export const AppBar = () => {
|
||||
return (
|
||||
<>
|
||||
<MuiAppBar
|
||||
style={{
|
||||
backgroundColor: "transparent",
|
||||
paddingRight: "0 !important",
|
||||
}}
|
||||
style={appBarStyling}
|
||||
className={
|
||||
trigger
|
||||
? "appBar flex flex-row flex-justify-spaced-between elevated"
|
||||
@@ -161,11 +189,11 @@ export const AppBar = () => {
|
||||
color="transparent"
|
||||
>
|
||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||
<IconButton onClick={() => setShowDrawer(true)}>
|
||||
<IconButton onClick={handleDrawerOpen}>
|
||||
<div className="material-symbols-rounded">menu</div>
|
||||
</IconButton>
|
||||
<BackButton />
|
||||
<IconButton onClick={() => navigate({ to: "/home" })}>
|
||||
<MemoizeBackButton />
|
||||
<IconButton onClick={handleNavigateToHome}>
|
||||
<div
|
||||
className={
|
||||
location.pathname === "/home"
|
||||
@@ -179,19 +207,16 @@ export const AppBar = () => {
|
||||
</div>
|
||||
|
||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||
<IconButton onClick={() => navigate({ to: "/search" })}>
|
||||
<IconButton onClick={handleNavigateToSearch}>
|
||||
<div className="material-symbols-rounded">search</div>
|
||||
</IconButton>
|
||||
<IconButton onClick={() => navigate({ to: "/favorite" })}>
|
||||
<IconButton onClick={handleNavigateToFavorite}>
|
||||
<div className="material-symbols-rounded">favorite</div>
|
||||
</IconButton>
|
||||
<IconButton sx={{ p: 0 }} onClick={handleMenuOpen}>
|
||||
{user.isSuccess &&
|
||||
(user.data.PrimaryImageTag === undefined ? (
|
||||
<Avatar
|
||||
className="appBar-avatar"
|
||||
alt={user.data.Name ?? "image"}
|
||||
>
|
||||
<IconButton sx={menuButtonSx} onClick={handleMenuOpen}>
|
||||
{!!user?.Id &&
|
||||
(user?.PrimaryImageTag === undefined ? (
|
||||
<Avatar className="appBar-avatar" alt={user?.Name ?? "image"}>
|
||||
<span className="material-symbols-rounded appBar-avatar-icon">
|
||||
account_circle
|
||||
</span>
|
||||
@@ -199,8 +224,8 @@ export const AppBar = () => {
|
||||
) : (
|
||||
<Avatar
|
||||
className="appBar-avatar"
|
||||
src={`${api.basePath}/Users/${user.data.Id}/Images/Primary`}
|
||||
alt={user.data.Name ?? "image"}
|
||||
src={`${api.basePath}/Users/${user?.Id}/Images/Primary`}
|
||||
alt={user?.Name ?? "image"}
|
||||
>
|
||||
<span className="material-symbols-rounded appBar-avatar-icon">
|
||||
account_circle
|
||||
@@ -212,7 +237,7 @@ export const AppBar = () => {
|
||||
anchorEl={anchorEl}
|
||||
open={openMenu}
|
||||
onClose={handleMenuClose}
|
||||
sx={{ mt: 2 }}
|
||||
sx={menuStyle}
|
||||
disableScrollLock
|
||||
>
|
||||
<MenuItem
|
||||
@@ -256,17 +281,14 @@ export const AppBar = () => {
|
||||
</MuiAppBar>
|
||||
<Drawer
|
||||
open={showDrawer}
|
||||
PaperProps={{
|
||||
className: "glass library-drawer",
|
||||
elevation: 6,
|
||||
}}
|
||||
PaperProps={drawerPaperProps}
|
||||
className="library-drawer"
|
||||
onClose={() => setShowDrawer(false)}
|
||||
onClose={handleDrawerClose}
|
||||
>
|
||||
<List>
|
||||
<ListItem>
|
||||
<ListItemButton
|
||||
onClick={() => setShowDrawer(false)}
|
||||
onClick={handleDrawerClose}
|
||||
style={{
|
||||
borderRadius: "100px",
|
||||
gap: "0.85em",
|
||||
@@ -281,12 +303,15 @@ export const AppBar = () => {
|
||||
<List>
|
||||
<ListItemLink to="/home" icon="home" primary="Home" />
|
||||
{libraries.isSuccess &&
|
||||
libraries.data.Items?.map((library, index) => (
|
||||
libraries.data.Items?.map((library) => (
|
||||
<ListItemLink
|
||||
key={library.Id}
|
||||
to={`/library/${library.Id}`}
|
||||
icon={getTypeIcon(library.CollectionType)}
|
||||
primary={library.Name}
|
||||
icon={
|
||||
library.CollectionType &&
|
||||
getTypeIcon(library.CollectionType)
|
||||
}
|
||||
primary={library.Name ?? "Library"}
|
||||
/>
|
||||
))}
|
||||
</List>
|
||||
|
||||
@@ -2,6 +2,8 @@ import AppBar from "@mui/material/AppBar";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Toolbar from "@mui/material/Toolbar";
|
||||
import { useRouter } from "@tanstack/react-router";
|
||||
import React from "react";
|
||||
import QuickConnectButton from "../buttons/quickConnectButton";
|
||||
|
||||
export const AppBarBackOnly = () => {
|
||||
const { history } = useRouter();
|
||||
@@ -16,13 +18,23 @@ export const AppBarBackOnly = () => {
|
||||
<IconButton
|
||||
size="large"
|
||||
edge="start"
|
||||
//@ts-ignore
|
||||
color="white"
|
||||
aria-label="back"
|
||||
disabled={history.length <= 1}
|
||||
onClick={handleBack}
|
||||
sx={{ mr: 2 }}
|
||||
>
|
||||
<span className="material-symbols-rounded">arrow_back</span>
|
||||
</IconButton>
|
||||
<QuickConnectButton
|
||||
sx={{
|
||||
marginLeft: "auto",
|
||||
flex: "none !important",
|
||||
borderRadius: "10px",
|
||||
}}
|
||||
color="secondary"
|
||||
/>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
);
|
||||
@@ -1,5 +1,5 @@
|
||||
import PropTypes from "prop-types";
|
||||
import React from "react";
|
||||
import React, { memo } from "react"; // Import memo
|
||||
|
||||
import Button, {
|
||||
type ButtonProps,
|
||||
@@ -9,12 +9,14 @@ import Fab from "@mui/material/Fab";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
import { playAudio } from "@/utils/store/audioPlayback";
|
||||
import { generateAudioStreamUrl, playAudio } from "@/utils/store/audioPlayback";
|
||||
import {
|
||||
type BaseItemDto,
|
||||
type BaseItemDtoQueryResult,
|
||||
BaseItemKind,
|
||||
ItemFields,
|
||||
ItemFilter,
|
||||
LocationType,
|
||||
MediaProtocol,
|
||||
type PlaybackInfoResponse,
|
||||
SortOrder,
|
||||
@@ -37,31 +39,62 @@ import { getRuntimeCompact } from "@/utils/date/time";
|
||||
import getSubtitle from "@/utils/methods/getSubtitles";
|
||||
import playbackProfile from "@/utils/playback-profiles";
|
||||
import { axiosClient, useApiInContext } from "@/utils/store/api";
|
||||
import { usePhotosPlayback } from "@/utils/store/photosPlayback";
|
||||
import type IntroMediaInfo from "@/utils/types/introMediaInfo";
|
||||
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 { AxiosResponse } from "axios";
|
||||
|
||||
type PlayButtonProps = {
|
||||
item: BaseItemDto;
|
||||
itemId: string;
|
||||
itemUserData: UserItemDataDto;
|
||||
userId: string;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
itemId?: string;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
itemUserData?: UserItemDataDto;
|
||||
userId: string | undefined;
|
||||
itemType: BaseItemKind;
|
||||
currentAudioTrack: number;
|
||||
currentVideoTrack: number;
|
||||
currentSubTrack: number | "nosub";
|
||||
className: string;
|
||||
sx: SxProps;
|
||||
buttonProps: ButtonProps;
|
||||
iconOnly: boolean;
|
||||
audio: boolean;
|
||||
size: ButtonPropsSizeOverrides;
|
||||
playlistItem: BaseItemDto;
|
||||
playlistItemId: string;
|
||||
trackIndex: number;
|
||||
currentAudioTrack?: number;
|
||||
currentVideoTrack?: number;
|
||||
currentSubTrack?: number | "nosub";
|
||||
className?: string;
|
||||
sx?: SxProps;
|
||||
buttonProps?: ButtonProps;
|
||||
iconOnly?: boolean;
|
||||
audio?: boolean;
|
||||
size?: ButtonPropsSizeOverrides;
|
||||
playlistItem?: BaseItemDto;
|
||||
playlistItemId?: string;
|
||||
trackIndex?: number;
|
||||
};
|
||||
|
||||
// Memoized LinearProgress component
|
||||
const MemoizedLinearProgress = memo(({ value }: { value: number }) => (
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={value}
|
||||
sx={{
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
height: "100%",
|
||||
background: "transparent",
|
||||
opacity: 0.2,
|
||||
zIndex: 0,
|
||||
mixBlendMode: "difference",
|
||||
}}
|
||||
color="white"
|
||||
/>
|
||||
));
|
||||
|
||||
const PlayButton = ({
|
||||
item,
|
||||
itemId,
|
||||
@@ -87,16 +120,17 @@ const PlayButton = ({
|
||||
const setPlaybackDataLoading = usePlaybackDataLoadStore(
|
||||
(state) => state.setisPending,
|
||||
);
|
||||
const playPhotos = usePhotosPlayback((s) => s.playPhotos);
|
||||
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
const itemQuery = useMutation({
|
||||
mutationKey: ["playButton", itemId, userId],
|
||||
mutationKey: ["playButton", item?.Id, userId],
|
||||
mutationFn: async () => {
|
||||
setPlaybackDataLoading(true);
|
||||
let result: undefined | AxiosResponse<BaseItemDtoQueryResult, 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;
|
||||
if (playlistItem) {
|
||||
result = await getPlaylistsApi(api).getPlaylistItems({
|
||||
@@ -104,56 +138,57 @@ const PlayButton = ({
|
||||
playlistId: playlistItemId,
|
||||
});
|
||||
} else {
|
||||
console.log(itemType);
|
||||
switch (itemType) {
|
||||
case BaseItemKind.Episode:
|
||||
result = await getTvShowsApi(api).getEpisodes({
|
||||
seriesId: item.SeriesId,
|
||||
fields: [
|
||||
ItemFields.MediaSources,
|
||||
ItemFields.MediaStreams,
|
||||
ItemFields.Overview,
|
||||
ItemFields.Chapters,
|
||||
ItemFields.Trickplay,
|
||||
],
|
||||
enableUserData: true,
|
||||
userId: userId,
|
||||
seasonId: item.SeasonId,
|
||||
startItemId: item.Id,
|
||||
});
|
||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||
audioStreamIndex: currentAudioTrack,
|
||||
subtitleStreamIndex:
|
||||
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||
itemId: result.data.Items?.[indexNumber].Id,
|
||||
startTimeTicks:
|
||||
result.data.Items?.[indexNumber].UserData
|
||||
?.PlaybackPositionTicks,
|
||||
userId: userId,
|
||||
mediaSourceId:
|
||||
result.data.Items?.[indexNumber].MediaSources?.[0].Id,
|
||||
playbackInfoDto: {
|
||||
DeviceProfile: playbackProfile,
|
||||
},
|
||||
});
|
||||
try {
|
||||
introInfo = (
|
||||
await axiosClient.get(
|
||||
`${api.basePath}/Episode/${result.data.Items?.[0]?.Id}/IntroSkipperSegments`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `MediaBrowser Token=${api.accessToken}`,
|
||||
if (item.SeriesId && item.SeasonId) {
|
||||
result = await getTvShowsApi(api).getEpisodes({
|
||||
seriesId: item.SeriesId,
|
||||
fields: [
|
||||
ItemFields.MediaSources,
|
||||
ItemFields.MediaStreams,
|
||||
ItemFields.Overview,
|
||||
ItemFields.Chapters,
|
||||
ItemFields.Trickplay,
|
||||
],
|
||||
enableUserData: true,
|
||||
userId: userId,
|
||||
seasonId: item.SeasonId,
|
||||
// startItemId: item.Id,
|
||||
});
|
||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||
audioStreamIndex: currentAudioTrack,
|
||||
subtitleStreamIndex:
|
||||
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||
itemId: result.data.Items?.[indexNumber].Id,
|
||||
startTimeTicks:
|
||||
result.data.Items?.[indexNumber].UserData
|
||||
?.PlaybackPositionTicks,
|
||||
userId: userId,
|
||||
mediaSourceId:
|
||||
result.data.Items?.[indexNumber].MediaSources?.[0].Id,
|
||||
playbackInfoDto: {
|
||||
DeviceProfile: playbackProfile,
|
||||
},
|
||||
});
|
||||
try {
|
||||
introInfo = (
|
||||
await axiosClient.get(
|
||||
`${api.basePath}/Episode/${result.data.Items?.[0]?.Id}/IntroSkipperSegments`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `MediaBrowser Token=${api.accessToken}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
)?.data;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
)
|
||||
)?.data;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BaseItemKind.Series:
|
||||
result = await getTvShowsApi(api).getEpisodes({
|
||||
seriesId: itemId,
|
||||
seriesId: item.Id,
|
||||
fields: [
|
||||
ItemFields.MediaSources,
|
||||
ItemFields.MediaStreams,
|
||||
@@ -164,19 +199,23 @@ const PlayButton = ({
|
||||
enableUserData: true,
|
||||
userId: userId,
|
||||
});
|
||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||
audioStreamIndex: currentAudioTrack,
|
||||
subtitleStreamIndex:
|
||||
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||
itemId: result.data.Items?.[0].Id,
|
||||
startTimeTicks:
|
||||
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
||||
userId: userId,
|
||||
mediaSourceId: result.data.Items?.[0].MediaSources?.[0].Id,
|
||||
playbackInfoDto: {
|
||||
DeviceProfile: playbackProfile,
|
||||
},
|
||||
});
|
||||
if (
|
||||
result.data.Items?.[0].Id &&
|
||||
result.data.Items?.[0].MediaSources?.[0].Id
|
||||
)
|
||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||
audioStreamIndex: currentAudioTrack,
|
||||
subtitleStreamIndex:
|
||||
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||
itemId: result.data.Items?.[0].Id,
|
||||
startTimeTicks:
|
||||
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
||||
userId: userId,
|
||||
mediaSourceId: result.data.Items?.[0].MediaSources?.[0].Id,
|
||||
playbackInfoDto: {
|
||||
DeviceProfile: playbackProfile,
|
||||
},
|
||||
});
|
||||
try {
|
||||
introInfo = (
|
||||
await axiosClient.get(
|
||||
@@ -200,7 +239,7 @@ const PlayButton = ({
|
||||
break;
|
||||
case BaseItemKind.MusicAlbum:
|
||||
result = await getItemsApi(api).getItems({
|
||||
parentId: itemId,
|
||||
parentId: item.Id,
|
||||
userId: userId,
|
||||
fields: [ItemFields.MediaSources, ItemFields.MediaStreams],
|
||||
sortOrder: [SortOrder.Ascending],
|
||||
@@ -209,7 +248,7 @@ const PlayButton = ({
|
||||
break;
|
||||
case BaseItemKind.MusicArtist:
|
||||
result = await getItemsApi(api).getItems({
|
||||
artistIds: [itemId],
|
||||
artistIds: [item.Id],
|
||||
recursive: true,
|
||||
includeItemTypes: [BaseItemKind.Audio],
|
||||
userId: userId,
|
||||
@@ -220,7 +259,7 @@ const PlayButton = ({
|
||||
break;
|
||||
case BaseItemKind.BoxSet:
|
||||
result = await getItemsApi(api).getItems({
|
||||
parentId: itemId,
|
||||
parentId: item.Id,
|
||||
userId,
|
||||
fields: [
|
||||
ItemFields.MediaSources,
|
||||
@@ -232,9 +271,27 @@ const PlayButton = ({
|
||||
sortBy: ["IndexNumber"],
|
||||
});
|
||||
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:
|
||||
result = await getItemsApi(api).getItems({
|
||||
ids: [itemId],
|
||||
ids: [item.Id],
|
||||
userId: userId,
|
||||
fields: [
|
||||
ItemFields.MediaSources,
|
||||
@@ -249,7 +306,7 @@ const PlayButton = ({
|
||||
audioStreamIndex: currentAudioTrack,
|
||||
subtitleStreamIndex:
|
||||
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||
itemId: itemId,
|
||||
itemId: item.Id,
|
||||
startTimeTicks:
|
||||
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
||||
userId: userId,
|
||||
@@ -269,16 +326,28 @@ const PlayButton = ({
|
||||
enqueueSnackbar("Playlist playback is WIP", { variant: "info" });
|
||||
} else if (audio) {
|
||||
// Album/Individual audio track playback
|
||||
const urlOptions = {
|
||||
const urlOptions: Record<string, string> = {
|
||||
deviceId: api?.deviceInfo.id,
|
||||
userId,
|
||||
//@ts-ignore
|
||||
userId: userId,
|
||||
api_key: api?.accessToken,
|
||||
};
|
||||
const urlParams = new URLSearchParams(urlOptions).toString();
|
||||
|
||||
const playbackUrl = `${api.basePath}/Audio/${result?.item.Items[0].Id}/universal?${urlParams}`;
|
||||
playAudio(playbackUrl, result?.item.Items[0], undefined);
|
||||
setQueue(result?.item.Items ?? [], 0);
|
||||
const playbackUrl = generateAudioStreamUrl(
|
||||
result?.item?.Items?.[0].Id,
|
||||
userId,
|
||||
api?.deviceInfo.id,
|
||||
api.basePath,
|
||||
api.accessToken,
|
||||
);
|
||||
playAudio(playbackUrl, result?.item?.Items?.[0], undefined);
|
||||
setQueue(result?.item?.Items ?? [], 0);
|
||||
} else if (item.Type === "Photo") {
|
||||
const index = result?.item?.Items?.map((i) => i.Id).indexOf(item.Id);
|
||||
if (result?.item?.Items && index) {
|
||||
playPhotos(result?.item?.Items, index);
|
||||
navigate({ to: "/player/photos" });
|
||||
}
|
||||
} else {
|
||||
const episodeIndex = item.IndexNumber ? item.IndexNumber - 1 : 0;
|
||||
// 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,
|
||||
);
|
||||
// URL generation
|
||||
const urlOptions = {
|
||||
const urlOptions: URLSearchParams = {
|
||||
Static: true,
|
||||
tag: result?.mediaSource.MediaSources?.[0].ETag,
|
||||
mediaSourceId: result?.mediaSource.MediaSources?.[0].Id,
|
||||
@@ -315,7 +384,7 @@ const PlayButton = ({
|
||||
let playItemValue = item;
|
||||
if (itemType === BaseItemKind.Movie) {
|
||||
playItemValue = result?.item.Items?.[0];
|
||||
}
|
||||
}
|
||||
|
||||
playItem(
|
||||
itemName,
|
||||
@@ -414,26 +483,13 @@ const PlayButton = ({
|
||||
audio
|
||||
? "Play Now"
|
||||
: "Watch Now"}
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
<MemoizedLinearProgress
|
||||
value={
|
||||
100 > itemUserData?.PlayedPercentage > 0
|
||||
100 > itemUserData?.PlayedPercentage &&
|
||||
itemUserData?.PlayedPercentage > 0
|
||||
? itemUserData?.PlayedPercentage
|
||||
: 0
|
||||
}
|
||||
sx={{
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
height: "100%",
|
||||
background: "transparent",
|
||||
opacity: 0.2,
|
||||
zIndex: 0,
|
||||
mixBlendMode: "difference",
|
||||
}}
|
||||
color="white"
|
||||
/>
|
||||
</Button>
|
||||
{itemUserData?.PlaybackPositionTicks > 0 && (
|
||||
|
||||
@@ -44,6 +44,7 @@ $image-size: 5em;
|
||||
flex-direction: column;
|
||||
gap: 0.2em;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
&-item.Mui-disabled {
|
||||
|
||||
@@ -13,8 +13,8 @@ import { getTypeIcon } from "../utils/iconsCollection";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import "./queueButton.scss";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
const QueueButton = () => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const [queueItems, currentItemIndex] = useQueue((state) => [
|
||||
@@ -29,12 +29,12 @@ const QueueButton = () => {
|
||||
return result.data;
|
||||
},
|
||||
});
|
||||
const [buttonEl, setButtonEl] = useState(null);
|
||||
const [buttonEl, setButtonEl] = useState<HTMLButtonElement | null>(null);
|
||||
|
||||
const handlePlay = useMutation({
|
||||
mutationKey: ["handlePlayIndex"],
|
||||
mutationFn: async ({ index }: { index: number }) => {
|
||||
const result = playItemFromQueue(index, user.data?.Id);
|
||||
const result = playItemFromQueue(index, user.data?.Id, api);
|
||||
return result;
|
||||
},
|
||||
onSuccess: () => {
|
||||
@@ -76,82 +76,189 @@ const QueueButton = () => {
|
||||
position: "relative",
|
||||
}}
|
||||
>
|
||||
{queueItems.map((item, index) => {
|
||||
return (
|
||||
{queueItems[currentItemIndex]?.Id && (
|
||||
<>
|
||||
<Typography px="1em" mb={2} variant="h5" fontWeight={300}>
|
||||
Currently Playing:
|
||||
</Typography>
|
||||
<MenuItem
|
||||
className="queue-item"
|
||||
disabled={index === currentItemIndex}
|
||||
onClick={() => handlePlay.mutate({ index })}
|
||||
key={item.Id}
|
||||
disabled
|
||||
key={queueItems[currentItemIndex].Id}
|
||||
>
|
||||
<Typography variant="subtitle2">
|
||||
{item.Type === "Audio"
|
||||
? index + 1
|
||||
: item.IndexNumberEnd
|
||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} / ${item.IndexNumberEnd}`
|
||||
: `S${item.ParentIndexNumber}:E${item.IndexNumber}`}
|
||||
{queueItems[currentItemIndex]?.Type === "Audio"
|
||||
? currentItemIndex + 1
|
||||
: queueItems[currentItemIndex].IndexNumberEnd
|
||||
? `S${queueItems[currentItemIndex].ParentIndexNumber}:E${queueItems[currentItemIndex].IndexNumber} / ${queueItems[currentItemIndex].IndexNumberEnd}`
|
||||
: `S${queueItems[currentItemIndex].ParentIndexNumber}:E${queueItems[currentItemIndex].IndexNumber}`}
|
||||
</Typography>
|
||||
<div className="queue-item-image-container">
|
||||
{item.ImageTags?.Primary ? (
|
||||
{queueItems[currentItemIndex].ImageTags?.Primary ? (
|
||||
<img
|
||||
className="queue-item-image"
|
||||
src={api?.getItemImageUrl(item?.Id, "Primary", {
|
||||
tag: item.ImageTags?.Primary,
|
||||
})}
|
||||
alt={item.Name}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
queueItems[currentItemIndex]?.Id,
|
||||
"Primary",
|
||||
{
|
||||
tag: queueItems[currentItemIndex].ImageTags?.Primary,
|
||||
},
|
||||
)}
|
||||
alt={queueItems[currentItemIndex].Name ?? "image"}
|
||||
/>
|
||||
) : item.AlbumPrimaryImageTag?.length > 0 ? (
|
||||
) : (queueItems[currentItemIndex].AlbumPrimaryImageTag
|
||||
?.length ?? -1) > 0 ? (
|
||||
<img
|
||||
className="queue-item-image"
|
||||
src={api?.getItemImageUrl(item?.AlbumId, "Primary", {
|
||||
tag: item.AlbumPrimaryImageTag[0],
|
||||
})}
|
||||
alt={item.Name}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
queueItems[currentItemIndex]?.AlbumId,
|
||||
"Primary",
|
||||
{
|
||||
tag: queueItems[currentItemIndex]
|
||||
.AlbumPrimaryImageTag[0],
|
||||
},
|
||||
)}
|
||||
alt={queueItems[currentItemIndex].Name ?? "image"}
|
||||
/>
|
||||
) : (
|
||||
<div className="queue-item-image-icon">
|
||||
{getTypeIcon(item.Type)}
|
||||
{queueItems[currentItemIndex].Type &&
|
||||
getTypeIcon(queueItems[currentItemIndex].Type)}
|
||||
</div>
|
||||
)}
|
||||
{index === currentItemIndex && (
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{
|
||||
position: "absolute",
|
||||
top: "50%",
|
||||
left: "50%",
|
||||
transform: "translate(-50%,-50%)",
|
||||
fontSize: "2em",
|
||||
"--wght": "100",
|
||||
}}
|
||||
>
|
||||
equalizer
|
||||
</span>
|
||||
)}
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{
|
||||
position: "absolute",
|
||||
top: "50%",
|
||||
left: "50%",
|
||||
transform: "translate(-50%,-50%)",
|
||||
fontSize: "2em",
|
||||
"--wght": "100",
|
||||
}}
|
||||
>
|
||||
equalizer
|
||||
</span>
|
||||
</div>
|
||||
<div className="queue-item-info">
|
||||
{item.SeriesName ? (
|
||||
{queueItems[currentItemIndex].SeriesName ? (
|
||||
<>
|
||||
<Typography variant="subtitle1" width="100%">
|
||||
{item.SeriesName}
|
||||
{queueItems[currentItemIndex].SeriesName}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
width="100%"
|
||||
style={{ opacity: 0.6 }}
|
||||
>
|
||||
{item.Name}
|
||||
{queueItems[currentItemIndex].Name}
|
||||
</Typography>
|
||||
</>
|
||||
) : (
|
||||
<Typography variant="subtitle1" width="100%">
|
||||
{item.Name}
|
||||
{queueItems[currentItemIndex].Name}
|
||||
</Typography>
|
||||
)}
|
||||
</div>
|
||||
</MenuItem>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
)}
|
||||
{queueItems.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 className="queue-item-info">
|
||||
{item.SeriesName ? (
|
||||
<>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
width="100%"
|
||||
sx={{ overflow: "hidden", textOverflow: "ellipsis" }}
|
||||
>
|
||||
{item.SeriesName}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
width="100%"
|
||||
style={{ opacity: 0.6 }}
|
||||
>
|
||||
{item.Name}
|
||||
</Typography>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
width="100%"
|
||||
sx={{ overflow: "hidden", textOverflow: "ellipsis" }}
|
||||
>
|
||||
{item.Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
width="100%"
|
||||
style={{ opacity: 0.6 }}
|
||||
sx={{ overflow: "hidden", textOverflow: "ellipsis" }}
|
||||
>
|
||||
{item.Artists?.join(", ")}
|
||||
</Typography>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</MenuItem>
|
||||
);
|
||||
})}
|
||||
</MenuList>
|
||||
</Menu>
|
||||
<IconButton onClick={(e) => setButtonEl(e.currentTarget)}>
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { saveUser } from "@/utils/storage/user";
|
||||
import useInterval from "@/utils/hooks/useInterval";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { getQuickConnectApi } from "@jellyfin/sdk/lib/utils/api/quick-connect-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { LoadingButton } from "@mui/lab";
|
||||
import { LoadingButton, type LoadingButtonProps } from "@mui/lab";
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
@@ -11,45 +10,62 @@ import {
|
||||
DialogContent,
|
||||
DialogContentText,
|
||||
FormControlLabel,
|
||||
Slide,
|
||||
Tooltip,
|
||||
Typography,
|
||||
} from "@mui/material";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { useNavigate } from "@tanstack/react-router";
|
||||
import type { Timeout } from "@tanstack/react-router/dist/esm/utils";
|
||||
import type { TransitionProps } from "@mui/material/transitions";
|
||||
import { skipToken, useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
|
||||
import { useSnackbar } from "notistack";
|
||||
import React, { useState } from "react";
|
||||
|
||||
const QuickConnectButton = () => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const createApi = useApiInContext((s) => s.createApi);
|
||||
const headers = {
|
||||
"X-Emby-Authorization": `MediaBrowser Client="${api.clientInfo.name}", Device="${api.deviceInfo.name}", DeviceId="${api.deviceInfo.id}", Version="${api.clientInfo.version}"`,
|
||||
};
|
||||
const Transition = React.forwardRef(function Transition(
|
||||
props: TransitionProps & {
|
||||
children: React.ReactElement<any, any>;
|
||||
},
|
||||
ref: React.Ref<unknown>,
|
||||
) {
|
||||
return (
|
||||
<Slide
|
||||
direction="up"
|
||||
mountOnEnter
|
||||
unmountOnExit
|
||||
ref={ref}
|
||||
timeout={{ enter: 500, exit: 1500 }}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
const [quickConnectStatusInterval, setQuickConnectStatusInterval] =
|
||||
useState<Timeout | null>(null);
|
||||
const QuickConnectButton = (props: LoadingButtonProps) => {
|
||||
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({
|
||||
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 [quickConnectCode, setQuickConnectCode] = useState<string | null>();
|
||||
const [rememberUser, setRememberUser] = useState(true);
|
||||
const checkQuickConnectStatus = useMutation({
|
||||
mutationKey: ["quick-connect-button", "check-quick-connect-status"],
|
||||
mutationFn: async (secret: string) =>
|
||||
(
|
||||
await getQuickConnectApi(api).getQuickConnectState(
|
||||
{ secret },
|
||||
{ headers },
|
||||
)
|
||||
).data,
|
||||
api
|
||||
? (
|
||||
await getQuickConnectApi(api).getQuickConnectState(
|
||||
{ secret },
|
||||
{ headers },
|
||||
)
|
||||
).data
|
||||
: skipToken,
|
||||
});
|
||||
const initQuickConnect = useMutation({
|
||||
mutationKey: ["quick-connect-button", "initiate-connection"],
|
||||
@@ -59,57 +75,42 @@ const QuickConnectButton = () => {
|
||||
variant: "error",
|
||||
});
|
||||
}
|
||||
return await getQuickConnectApi(api).initiateQuickConnect({ headers });
|
||||
if (api) {
|
||||
return await getQuickConnectApi(api).initiateQuickConnect({ headers });
|
||||
}
|
||||
},
|
||||
onSuccess: (result) => {
|
||||
setQuickConnectCode(result.data.Code);
|
||||
const authAwaitInterval = setInterval(async () => {
|
||||
// Check if user has been authenticated by the server
|
||||
const quickConnectCheck = await checkQuickConnectStatus.mutateAsync(
|
||||
result.data.Secret,
|
||||
);
|
||||
if (quickConnectCheck.Authenticated) {
|
||||
const userAuth = await getUserApi(api).authenticateWithQuickConnect({
|
||||
quickConnectDto: {
|
||||
Secret: quickConnectCheck.Secret,
|
||||
},
|
||||
});
|
||||
enqueueSnackbar(`Logged in as ${userAuth.data.User?.Name}!`, {
|
||||
variant: "success",
|
||||
});
|
||||
sessionStorage.setItem("accessToken", userAuth.data.AccessToken);
|
||||
createApi(api.basePath, userAuth.data.AccessToken);
|
||||
|
||||
if (rememberUser) {
|
||||
await saveUser(userAuth.data.User?.Name, userAuth.data.AccessToken);
|
||||
}
|
||||
|
||||
clearInterval(authAwaitInterval);
|
||||
|
||||
navigate({ to: "/home" });
|
||||
}
|
||||
}, 1000);
|
||||
setQuickConnectStatusInterval(authAwaitInterval);
|
||||
setQuickConnectCode(result?.data.Code);
|
||||
},
|
||||
onError: (error) => {
|
||||
enqueueSnackbar("Error initiating Quick Connect.", { variant: "error" });
|
||||
console.error(error);
|
||||
},
|
||||
});
|
||||
|
||||
useInterval(
|
||||
() => {
|
||||
if (quickConnectCode) {
|
||||
checkQuickConnectStatus.mutate(quickConnectCode);
|
||||
}
|
||||
},
|
||||
quickConnectCode ? 1000 : null,
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<LoadingButton
|
||||
{...props}
|
||||
disabled={
|
||||
quickConnectEnabled.isPending ||
|
||||
Boolean(!quickConnectEnabled.data?.data)
|
||||
}
|
||||
loading={
|
||||
loading={Boolean(
|
||||
initQuickConnect.isPending ||
|
||||
checkQuickConnectStatus.isPending ||
|
||||
(quickConnectCode && !checkQuickConnectStatus.data?.Authenticated)
|
||||
}
|
||||
variant="contained"
|
||||
size="large"
|
||||
checkQuickConnectStatus.isPending ||
|
||||
(quickConnectCode && !checkQuickConnectStatus.data?.Authenticated),
|
||||
)}
|
||||
variant={props.variant ?? "contained"}
|
||||
style={{ flex: 1 }}
|
||||
onClick={initQuickConnect.mutate}
|
||||
>
|
||||
@@ -119,10 +120,12 @@ const QuickConnectButton = () => {
|
||||
open={Boolean(quickConnectCode)}
|
||||
onClose={() => {
|
||||
setQuickConnectCode(null);
|
||||
clearInterval(quickConnectStatusInterval);
|
||||
initQuickConnect.reset();
|
||||
checkQuickConnectStatus.reset();
|
||||
}}
|
||||
fullWidth
|
||||
maxWidth="xs"
|
||||
TransitionComponent={Transition}
|
||||
>
|
||||
<DialogContent
|
||||
style={{
|
||||
@@ -159,8 +162,8 @@ const QuickConnectButton = () => {
|
||||
borderRadius: "10px",
|
||||
cursor: "pointer",
|
||||
}}
|
||||
onClick={async (e) => {
|
||||
await writeText(quickConnectCode);
|
||||
onClick={async () => {
|
||||
quickConnectCode && (await writeText(quickConnectCode));
|
||||
enqueueSnackbar("Quick Connect Code copied!", {
|
||||
variant: "info",
|
||||
key: "copiedText",
|
||||
|
||||
@@ -8,6 +8,7 @@ import Typography from "@mui/material/Typography";
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import { useApi } from "../../utils/store/api";
|
||||
import "./card.scss";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
|
||||
/**
|
||||
* @typedef {Object} Props
|
||||
@@ -70,7 +71,7 @@ export const ActorCard = ({
|
||||
</div>
|
||||
<img
|
||||
alt={item.Name}
|
||||
src={api.getItemImageUrl(
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
seriesId ? item.SeriesId : item.Id,
|
||||
"Primary",
|
||||
{
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
/** @format */
|
||||
|
||||
import React, { memo } from "react";
|
||||
import { Component, useState } from "react";
|
||||
|
||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
||||
import { useNavigate } from "@tanstack/react-router";
|
||||
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
import {
|
||||
@@ -19,22 +17,9 @@ import PlayButton from "../buttons/playButton";
|
||||
import ErrorBoundary from "../errorBoundary";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
import "./card.scss";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
|
||||
const cardImageAspectRatios = {
|
||||
thumb: 1.777,
|
||||
portrait: 0.666,
|
||||
square: 1,
|
||||
};
|
||||
|
||||
const availableSpecialRoutes = [
|
||||
BaseItemKind.Series,
|
||||
BaseItemKind.BoxSet,
|
||||
BaseItemKind.MusicAlbum,
|
||||
BaseItemKind.Episode,
|
||||
BaseItemKind.Playlist,
|
||||
];
|
||||
|
||||
const CardComponent = ({
|
||||
item,
|
||||
cardTitle,
|
||||
@@ -65,31 +50,33 @@ const CardComponent = ({
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const navigate = useNavigate();
|
||||
const defaultOnClick = () => {
|
||||
switch (item.Type) {
|
||||
case BaseItemKind.BoxSet:
|
||||
navigate({ to: "/boxset/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Episode:
|
||||
navigate({ to: "/episode/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicAlbum:
|
||||
navigate({ to: "/album/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicArtist:
|
||||
navigate({ to: "/artist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Person:
|
||||
navigate({ to: "/person/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Series:
|
||||
navigate({ to: "/series/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Playlist:
|
||||
navigate({ to: "/playlist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
default:
|
||||
navigate({ to: "/item/$id", params: { id: item.Id } });
|
||||
break;
|
||||
if (item?.Id) {
|
||||
switch (item?.Type) {
|
||||
case BaseItemKind.BoxSet:
|
||||
navigate({ to: "/boxset/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Episode:
|
||||
navigate({ to: "/episode/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicAlbum:
|
||||
navigate({ to: "/album/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicArtist:
|
||||
navigate({ to: "/artist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Person:
|
||||
navigate({ to: "/person/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Series:
|
||||
navigate({ to: "/series/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Playlist:
|
||||
navigate({ to: "/playlist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
default:
|
||||
navigate({ to: "/item/$id", params: { id: item.Id } });
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -121,21 +108,26 @@ const CardComponent = ({
|
||||
</div>
|
||||
</ErrorBoundary>
|
||||
<div className="card-image-icon-container">
|
||||
{overrideIcon ? getTypeIcon(overrideIcon) : getTypeIcon(item.Type)}
|
||||
{overrideIcon
|
||||
? getTypeIcon(overrideIcon)
|
||||
: getTypeIcon(item.Type ?? "universal")}
|
||||
</div>
|
||||
<img
|
||||
alt={item.Name ?? "blink"}
|
||||
src={
|
||||
overrideIcon === "User"
|
||||
? `${api.basePath}/Users/${item.Id}/Images/Primary`
|
||||
: api.getItemImageUrl(
|
||||
seriesId ? item.SeriesId : item.AlbumId ?? item.Id,
|
||||
imageType,
|
||||
{
|
||||
quality: 90,
|
||||
fillWidth: cardType === "thumb" ? 560 : 280,
|
||||
},
|
||||
)
|
||||
api
|
||||
? overrideIcon === "User"
|
||||
? `${api?.basePath}/Users/${item.Id}/Images/Primary`
|
||||
: getImageUrlsApi(api).getItemImageUrlById(
|
||||
(seriesId ? item.SeriesId : (item.AlbumId ?? item.Id)) ??
|
||||
"",
|
||||
imageType,
|
||||
{
|
||||
quality: 90,
|
||||
fillWidth: cardType === "thumb" ? 560 : 280,
|
||||
},
|
||||
)
|
||||
: ""
|
||||
}
|
||||
style={{
|
||||
height: "100%",
|
||||
@@ -191,7 +183,7 @@ const CardComponent = ({
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{item.UserData?.PlaybackPositionTicks > 0 && (
|
||||
{(item.UserData?.PlaybackPositionTicks ?? -1) > 0 && (
|
||||
<div className="card-progress-container">
|
||||
<div
|
||||
className="card-progress"
|
||||
|
||||
@@ -10,6 +10,7 @@ import { Blurhash } from "react-blurhash";
|
||||
import "./card.scss";
|
||||
|
||||
import { getRuntimeCompact } from "@/utils/date/time";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
||||
import LikeButton from "../buttons/likeButton";
|
||||
@@ -87,7 +88,7 @@ export const EpisodeCard = ({
|
||||
</div>
|
||||
<img
|
||||
alt={item.Name}
|
||||
src={api.getItemImageUrl(item.Id, "Primary", {
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(item.Id, "Primary", {
|
||||
quality: 90,
|
||||
fillHeight: 512,
|
||||
fillWidth: 512,
|
||||
|
||||
@@ -11,6 +11,25 @@ import Typography from "@mui/material/Typography";
|
||||
|
||||
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 = ({
|
||||
children,
|
||||
displayCards,
|
||||
@@ -53,8 +72,6 @@ export const CardScroller = ({
|
||||
},
|
||||
};
|
||||
|
||||
const [carouselRef, setCarouselRef] = useState();
|
||||
|
||||
return (
|
||||
<Box {...boxProps} className="card-scroller-container" mb={1}>
|
||||
<Box
|
||||
@@ -79,20 +96,11 @@ export const CardScroller = ({
|
||||
draggable
|
||||
responsive={responsive}
|
||||
arrows
|
||||
ref={(el) => setCarouselRef(el)}
|
||||
className="card-scroller"
|
||||
customTransition="all .6s"
|
||||
transitionDuration={600}
|
||||
customRightArrow={
|
||||
<IconButton className="card-scroller-button right">
|
||||
<div className="material-symbols-rounded">chevron_right</div>
|
||||
</IconButton>
|
||||
}
|
||||
customLeftArrow={
|
||||
<IconButton className="card-scroller-button left">
|
||||
<div className="material-symbols-rounded">chevron_left</div>
|
||||
</IconButton>
|
||||
}
|
||||
customRightArrow={<RightButton />}
|
||||
customLeftArrow={<LeftButton />}
|
||||
>
|
||||
{children}
|
||||
</Carousel>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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";
|
||||
|
||||
@@ -9,6 +9,7 @@ import { useApiInContext } from "@/utils/store/api";
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import CarouselSlide from "../carouselSlide";
|
||||
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import ReactMultiCarousel from "react-multi-carousel";
|
||||
import Slider from "../Slider";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
@@ -18,6 +19,12 @@ const swipePower = (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 = ({
|
||||
content,
|
||||
onChange,
|
||||
@@ -31,6 +38,7 @@ const Carousel = ({
|
||||
state.setDirection,
|
||||
state.direction,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
onChange(currentSlide);
|
||||
}, [content[currentSlide]?.Id]);
|
||||
@@ -39,7 +47,6 @@ const Carousel = ({
|
||||
|
||||
const responsive = {
|
||||
superLargeDesktop: {
|
||||
// the naming can be any, depends on you.
|
||||
breakpoint: { max: 4000, min: 3000 },
|
||||
items: 6,
|
||||
},
|
||||
@@ -57,6 +64,74 @@ const Carousel = ({
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Memoize the content mapping
|
||||
const sliderContent = useMemo(() => {
|
||||
return content.map((item, index) => {
|
||||
return (
|
||||
<motion.div
|
||||
className={
|
||||
currentSlide === index
|
||||
? "carousel-indicator active"
|
||||
: "carousel-indicator"
|
||||
}
|
||||
layout
|
||||
initial={{
|
||||
height: "4.6em",
|
||||
}}
|
||||
whileHover={{
|
||||
height: "5.5em",
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.05,
|
||||
}}
|
||||
key={item.Id}
|
||||
onClick={() => {
|
||||
if (currentSlide > index) {
|
||||
setDirection("left");
|
||||
} else if (currentSlide <= index) {
|
||||
setDirection("right");
|
||||
}
|
||||
setCurrentSlide(index);
|
||||
}}
|
||||
>
|
||||
{item.ImageTags?.Thumb ? (
|
||||
<img
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(item.Id, "Thumb", {
|
||||
tag: item.ImageTags.Primary,
|
||||
fillWidth: 300,
|
||||
})}
|
||||
alt={item.Name ?? "item-image"}
|
||||
className="carousel-indicator-image"
|
||||
/>
|
||||
) : (
|
||||
<div className="carousel-indicator-icon">
|
||||
{getTypeIcon(item.Type)}
|
||||
</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">
|
||||
@@ -72,79 +147,22 @@ const Carousel = ({
|
||||
drag={"x"}
|
||||
dragConstraints={{ left: 0, right: 0 }}
|
||||
dragElastic={1}
|
||||
onDragEnd={(e, { offset, velocity }) => {
|
||||
const swipe = swipePower(offset.x, velocity.x);
|
||||
if (
|
||||
currentSlide !== content.length - 1 &&
|
||||
swipe < -swipeConfidenceThreshold
|
||||
) {
|
||||
setDirection("right");
|
||||
setCurrentSlide((init) => init + 1);
|
||||
} else if (currentSlide !== 0 && swipe > swipeConfidenceThreshold) {
|
||||
setDirection("left");
|
||||
setCurrentSlide((init) => init - 1);
|
||||
}
|
||||
}}
|
||||
onDragEnd={handleDragEnd}
|
||||
style={{
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
position: "absolute",
|
||||
}}
|
||||
>
|
||||
<CarouselSlide
|
||||
<MemoizedCarouselSlide
|
||||
item={content[currentSlide]}
|
||||
key={content[currentSlide].Id}
|
||||
/>
|
||||
</motion.div>
|
||||
</AnimatePresence>
|
||||
<Slider
|
||||
currentSlide={currentSlide}
|
||||
content={content.map((item, index) => (
|
||||
<motion.div
|
||||
className={
|
||||
currentSlide === index
|
||||
? "carousel-indicator active"
|
||||
: "carousel-indicator"
|
||||
}
|
||||
layout
|
||||
initial={{
|
||||
height: "4.6em",
|
||||
}}
|
||||
whileHover={{
|
||||
height: "5.5em",
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.05,
|
||||
}}
|
||||
key={item.Id}
|
||||
onClick={() => {
|
||||
if (currentSlide > index) {
|
||||
setDirection("left");
|
||||
} else if (currentSlide <= index) {
|
||||
setDirection("right");
|
||||
}
|
||||
setCurrentSlide(index);
|
||||
}}
|
||||
>
|
||||
{item.ImageTags?.Thumb ? (
|
||||
<img
|
||||
src={api.getItemImageUrl(item.Id, "Thumb", {
|
||||
tag: item.ImageTags.Primary,
|
||||
fillWidth: 300,
|
||||
})}
|
||||
alt={item.Name ?? "item-image"}
|
||||
className="carousel-indicator-image"
|
||||
/>
|
||||
) : (
|
||||
<div className="carousel-indicator-icon">
|
||||
{getTypeIcon(item.Type)}
|
||||
</div>
|
||||
)}
|
||||
</motion.div>
|
||||
))}
|
||||
/>
|
||||
<MemoizedSlider currentSlide={currentSlide} content={sliderContent} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Carousel;
|
||||
export default React.memo(Carousel);
|
||||
@@ -1,5 +1,4 @@
|
||||
import React, { memo } from "react";
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import React from "react";
|
||||
|
||||
import { motion } from "framer-motion";
|
||||
|
||||
@@ -13,7 +12,6 @@ import { yellow } from "@mui/material/colors";
|
||||
|
||||
import { endsAt, getRuntime } from "@/utils/date/time";
|
||||
import { green, red } from "@mui/material/colors";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useNavigate } from "@tanstack/react-router";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
|
||||
@@ -23,84 +21,56 @@ import {
|
||||
type BaseItemDto,
|
||||
BaseItemKind,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import LikeButton from "../buttons/likeButton";
|
||||
import MarkPlayedButton from "../buttons/markPlayedButton";
|
||||
import PlayButton from "../buttons/playButton";
|
||||
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 api = useApiInContext((s) => s.api);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const handleMoreInfo = () => {
|
||||
switch (item.Type) {
|
||||
case BaseItemKind.BoxSet:
|
||||
navigate({ to: "/boxset/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Episode:
|
||||
navigate({ to: "/episode/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicAlbum:
|
||||
navigate({ to: "/album/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicArtist:
|
||||
navigate({ to: "/artist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Person:
|
||||
navigate({ to: "/person/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Series:
|
||||
navigate({ to: "/series/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Playlist:
|
||||
navigate({ to: "/playlist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
default:
|
||||
navigate({ to: "/item/$id", params: { id: item.Id } });
|
||||
break;
|
||||
if (item.Id) {
|
||||
switch (item.Type) {
|
||||
case BaseItemKind.BoxSet:
|
||||
navigate({ to: "/boxset/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Episode:
|
||||
navigate({ to: "/episode/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicAlbum:
|
||||
navigate({ to: "/album/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.MusicArtist:
|
||||
navigate({ to: "/artist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Person:
|
||||
navigate({ to: "/person/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Series:
|
||||
navigate({ to: "/series/$id", params: { id: item.Id } });
|
||||
break;
|
||||
case BaseItemKind.Playlist:
|
||||
navigate({ to: "/playlist/$id", params: { id: item.Id } });
|
||||
break;
|
||||
default:
|
||||
navigate({ to: "/item/$id", params: { id: item.Id } });
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const [animationDirection] = useCarouselStore((state) => [state.direction]);
|
||||
|
||||
return (
|
||||
<Paper
|
||||
className="hero-carousel-slide"
|
||||
sx={{
|
||||
background: "transparent",
|
||||
// px: 3,
|
||||
}}
|
||||
elevation={0}
|
||||
>
|
||||
<div className="hero-carousel-slide">
|
||||
<div className="hero-carousel-background-container">
|
||||
{item.BackdropImageTags?.length ? (
|
||||
<img
|
||||
alt={item.Name}
|
||||
alt={item.Name ?? "item"}
|
||||
className="hero-carousel-background-image"
|
||||
src={
|
||||
item.ParentBackdropItemId
|
||||
@@ -155,7 +125,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||
fontWeight={200}
|
||||
overflow="visible"
|
||||
>
|
||||
{!item.ImageTags.Logo ? (
|
||||
{!item.ImageTags?.Logo ? (
|
||||
item.Name
|
||||
) : (
|
||||
<img
|
||||
@@ -336,7 +306,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||
<PlayButton
|
||||
item={item}
|
||||
itemId={item.Id}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
itemType={item.Type}
|
||||
currentAudioTrack={0}
|
||||
currentSubTrack={0}
|
||||
@@ -377,21 +347,21 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||
<LikeButton
|
||||
itemId={item.Id}
|
||||
queryKey={["home", "latestMedia"]}
|
||||
userId={user.data.Id}
|
||||
isFavorite={item.UserData.IsFavorite}
|
||||
userId={user?.Id}
|
||||
isFavorite={item.UserData?.IsFavorite}
|
||||
itemName={item.Name}
|
||||
/>
|
||||
<MarkPlayedButton
|
||||
itemId={item.Id}
|
||||
queryKey={["home", "latestMedia"]}
|
||||
userId={user.data.Id}
|
||||
isPlayed={item.UserData.Played}
|
||||
userId={user?.Id}
|
||||
isPlayed={item.UserData?.Played}
|
||||
itemName={item.Name}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</div>
|
||||
</Paper>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import { CardScroller } from "../../cardScroller/cardScroller";
|
||||
import { CardsSkeleton } from "../../skeleton/cards";
|
||||
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import {
|
||||
type BaseItemDto,
|
||||
BaseItemKind,
|
||||
@@ -19,27 +20,20 @@ export const LatestMediaSection = ({
|
||||
latestMediaLib,
|
||||
}: { latestMediaLib: BaseItemDto }) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const fetchLatestMedia = async (library: BaseItemDto) => {
|
||||
const media = await getUserLibraryApi(api).getLatestMedia({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
parentId: library.Id,
|
||||
limit: 16,
|
||||
fields: ["PrimaryImageAspectRatio"],
|
||||
fields: ["PrimaryImageAspectRatio", "ParentId"],
|
||||
});
|
||||
return media.data;
|
||||
};
|
||||
const data = useQuery({
|
||||
queryKey: ["home", "latestMedia", latestMediaLib.Id],
|
||||
queryFn: () => fetchLatestMedia(latestMediaLib),
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
refetchOnMount: true,
|
||||
});
|
||||
if (data.isPending) {
|
||||
@@ -80,7 +74,7 @@ export const LatestMediaSection = ({
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={["home", "latestMedia", latestMediaLib.Id]}
|
||||
userId={user.data?.Id}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
|
||||
@@ -6,6 +6,7 @@ import LikeButton from "../buttons/likeButton";
|
||||
import PlayButton from "../buttons/playButton";
|
||||
import TextLink from "../textLink";
|
||||
import "./musicTrack.scss";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import type { QueryKey } from "@tanstack/react-query";
|
||||
@@ -36,13 +37,13 @@ const MusicTrack = ({
|
||||
trackIndex,
|
||||
className = "",
|
||||
}: {
|
||||
item: BaseItemDto;
|
||||
queryKey: QueryKey;
|
||||
userId: string | undefined;
|
||||
playlistItem: boolean;
|
||||
playlistItemId: string;
|
||||
trackIndex: number;
|
||||
className: string;
|
||||
item?: BaseItemDto | null;
|
||||
queryKey?: QueryKey;
|
||||
userId?: string | undefined;
|
||||
playlistItem?: boolean;
|
||||
playlistItemId?: string;
|
||||
trackIndex?: number;
|
||||
className?: string;
|
||||
}) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const [currentTrackItem] = useAudioPlayback((state) => [state.item]);
|
||||
@@ -60,7 +61,7 @@ const MusicTrack = ({
|
||||
</div>
|
||||
<img
|
||||
alt={item.Name}
|
||||
src={api.getItemImageUrl(
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
Object.keys(item.ImageTags).length === 0 ? item.AlbumId : item.Id,
|
||||
"Primary",
|
||||
{
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
aspect-ratio: 1;
|
||||
position: relative;
|
||||
width: 4em;
|
||||
box-shadow: 0 0 10px rgb(0 0 0 / 0.2);
|
||||
transition: opacity $transition-time-default;
|
||||
&-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
@@ -39,8 +41,6 @@
|
||||
opacity: 0;
|
||||
transition: opacity $transition-time-fast;
|
||||
}
|
||||
box-shadow: 0 0 10px rgb(0 0 0 / 0.2);
|
||||
transition: opacity $transition-time-default;
|
||||
}
|
||||
&-info {
|
||||
justify-self: start;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { LinearProgress } from "@mui/material";
|
||||
import { useNProgress } from "@tanem/react-nprogress";
|
||||
import type React from "react";
|
||||
import React from "react";
|
||||
|
||||
const NProgress: React.FC<{ isAnimating: boolean | number }> = ({
|
||||
isAnimating,
|
||||
|
||||
+7
-6
@@ -1,11 +1,10 @@
|
||||
import Box from "@mui/material/Box";
|
||||
import Button from "@mui/material/Button";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { red } from "@mui/material/colors";
|
||||
import React from "react";
|
||||
|
||||
export const ErrorNotice = ({ error }) => {
|
||||
console.log(error);
|
||||
export const ErrorNotice = ({ error }: { error?: Error }) => {
|
||||
console.error(error);
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -23,14 +22,15 @@ export const ErrorNotice = ({ error }) => {
|
||||
style={{
|
||||
fontSize: "10em",
|
||||
color: red[800],
|
||||
//@ts-ignore
|
||||
"--clr": "rgb(198 40 40 / 30%)",
|
||||
fontVariationSettings: '"FILL" 1, "wght" 400, "GRAD" 25, "opsz" 60',
|
||||
}}
|
||||
>
|
||||
error
|
||||
</div>
|
||||
<Typography variant="h3" fontWeight={300}>
|
||||
Something went wrong
|
||||
<Typography variant="h3" color="white" fontWeight={300}>
|
||||
Something went wrong.
|
||||
</Typography>
|
||||
<Typography
|
||||
fontFamily="JetBrains Mono Variable"
|
||||
@@ -45,8 +45,9 @@ export const ErrorNotice = ({ error }) => {
|
||||
marginTop: "1em",
|
||||
// opacity: 0.6,
|
||||
}}
|
||||
color="gray"
|
||||
>
|
||||
{JSON.stringify(error.message)}
|
||||
{JSON.stringify(error?.message)}
|
||||
</Typography>
|
||||
</Box>
|
||||
);
|
||||
@@ -6,6 +6,7 @@ import React from "react";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
|
||||
import "./outroCard.scss";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
|
||||
@@ -36,7 +37,7 @@ const OutroCard = (props: { handleShowCredits: () => void }) => {
|
||||
<img
|
||||
className="outro-card-content-image"
|
||||
alt={item.Name ?? "Cover"}
|
||||
src={api.getItemImageUrl(item.Id, "Primary", {
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(item.Id, "Primary", {
|
||||
tag: item.ImageTags.Primary,
|
||||
quality: 80,
|
||||
})}
|
||||
|
||||
@@ -1,24 +1,12 @@
|
||||
import React, {
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import React, { useEffect, useMemo, useRef, useState } from "react";
|
||||
|
||||
import { motion } from "framer-motion";
|
||||
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Fab from "@mui/material/Fab";
|
||||
import Grow from "@mui/material/Grow";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import Popper from "@mui/material/Popper";
|
||||
import Slider from "@mui/material/Slider";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
import WaveSurfer from "wavesurfer.js";
|
||||
|
||||
import { setAudioRef, useAudioPlayback } from "@/utils/store/audioPlayback";
|
||||
import useQueue from "@/utils/store/queue";
|
||||
|
||||
@@ -26,14 +14,17 @@ import { AnimatePresence } from "framer-motion";
|
||||
import "./audioPlayer.scss";
|
||||
|
||||
import { getRuntimeMusic, secToTicks, ticksToSec } from "@/utils/date/time";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import PlayNextButton from "@/components/buttons/playNextButton";
|
||||
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
||||
import QueueButton from "@/components/buttons/queueButton";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { playItemFromQueue } from "@/utils/store/playback";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useNavigate } from "@tanstack/react-router";
|
||||
|
||||
const AudioPlayer = () => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
@@ -49,17 +40,7 @@ const AudioPlayer = () => {
|
||||
state.currentItemIndex,
|
||||
]);
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
enabled: Boolean(display) && Boolean(api),
|
||||
});
|
||||
|
||||
const waveSurferContainerRef = useRef(null);
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const playing = useMemo(() => {
|
||||
if (audioRef.current?.paused) return false;
|
||||
@@ -70,87 +51,90 @@ const AudioPlayer = () => {
|
||||
const [isMuted, setIsMuted] = useState(false);
|
||||
const [progress, setProgress] = useState(0);
|
||||
const [isScrubbing, setIsScrubbing] = useState(false);
|
||||
const [sliderProgress, setSliderProgress] = useState(false);
|
||||
const [sliderProgress, setSliderProgress] = useState(0);
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
if (display) {
|
||||
const audioUrlRequest = new Request(audioRef.current?.dataset.src, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: api.authorizationHeader,
|
||||
},
|
||||
});
|
||||
fetch(audioUrlRequest)
|
||||
.then((res) => res)
|
||||
.then(async (result) => {
|
||||
const blob = await result.blob();
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
audioRef.current.src = blobUrl;
|
||||
audioRef.current.play();
|
||||
setLoading(false);
|
||||
});
|
||||
// const audioUrlRequest = new Request(audioRef.current?.dataset.src, {
|
||||
// method: "GET",
|
||||
// headers: {
|
||||
// Authorization: api.authorizationHeader,
|
||||
// },
|
||||
// });
|
||||
// fetch(audioUrlRequest)
|
||||
// .then((res) => res)
|
||||
// .then(async (result) => {
|
||||
// const blob = await result.blob();
|
||||
// const blobUrl = URL.createObjectURL(blob);
|
||||
// audioRef.current.src = blobUrl;
|
||||
// await audioRef.current.play();
|
||||
// setLoading(false);
|
||||
// });
|
||||
|
||||
// Set the audio ref in the store to allow for global control
|
||||
setAudioRef(audioRef);
|
||||
}
|
||||
}, [url, tracks[currentTrack]?.Id]);
|
||||
}, [url, tracks?.[currentTrack]?.Id]);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const info = useMemo(
|
||||
() => (
|
||||
<div
|
||||
// initial={{
|
||||
// filter: "opacity(0)",
|
||||
// }}
|
||||
// animate={{
|
||||
// filter: "opacity(1)",
|
||||
// }}
|
||||
// exit={{
|
||||
// filter: "opacity(0)",
|
||||
// }}
|
||||
className="audio-player-info"
|
||||
>
|
||||
<div className="audio-player-image-container">
|
||||
<img
|
||||
alt={tracks[currentTrack]?.Name}
|
||||
className="audio-player-image"
|
||||
src={api?.getItemImageUrl(
|
||||
!item?.ImageTags.Primary ? item?.AlbumId : item?.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 85,
|
||||
fillHeight: 462,
|
||||
fillWidth: 462,
|
||||
},
|
||||
)}
|
||||
/>
|
||||
<span className="material-symbols-rounded audio-player-image-icon">
|
||||
music_note
|
||||
</span>
|
||||
() =>
|
||||
!!api?.configuration && (
|
||||
<div
|
||||
// initial={{
|
||||
// filter: "opacity(0)",
|
||||
// }}
|
||||
// animate={{
|
||||
// filter: "opacity(1)",
|
||||
// }}
|
||||
// exit={{
|
||||
// filter: "opacity(0)",
|
||||
// }}
|
||||
className="audio-player-info"
|
||||
>
|
||||
<div className="audio-player-image-container">
|
||||
<img
|
||||
alt={tracks?.[currentTrack]?.Name ?? "track"}
|
||||
className="audio-player-image"
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
(!item?.ImageTags?.Primary ? item?.AlbumId : item?.Id) ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 85,
|
||||
fillHeight: 462,
|
||||
fillWidth: 462,
|
||||
},
|
||||
)}
|
||||
/>
|
||||
<span className="material-symbols-rounded audio-player-image-icon">
|
||||
music_note
|
||||
</span>
|
||||
</div>
|
||||
<div className="audio-player-info-text">
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
{item?.Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="caption"
|
||||
style={{
|
||||
opacity: 0.5,
|
||||
}}
|
||||
noWrap
|
||||
>
|
||||
by {item?.Artists?.map((artist) => artist).join(",")}
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
<div className="audio-player-info-text">
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
{item?.Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="caption"
|
||||
style={{
|
||||
opacity: 0.5,
|
||||
}}
|
||||
noWrap
|
||||
>
|
||||
by {item?.Artists.map((artist) => artist).join(",")}
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
[tracks[currentTrack]?.Id, currentTrack],
|
||||
),
|
||||
[tracks?.[currentTrack]?.Id, currentTrack, api?.configuration],
|
||||
);
|
||||
|
||||
const controls = useMemo(
|
||||
@@ -186,7 +170,7 @@ const AudioPlayer = () => {
|
||||
<PlayNextButton />
|
||||
</div>
|
||||
),
|
||||
[tracks[currentTrack]?.Id, loading, playing, tracks.length],
|
||||
[tracks?.[currentTrack]?.Id, loading, playing, tracks?.length],
|
||||
);
|
||||
|
||||
const buttons = useMemo(
|
||||
@@ -215,9 +199,13 @@ const AudioPlayer = () => {
|
||||
value={isMuted ? 0 : volume * 100}
|
||||
step={1}
|
||||
max={100}
|
||||
onChange={(e, newVal) => {
|
||||
setVolume(newVal / 100);
|
||||
audioRef.current.volume = newVal / 100;
|
||||
onChange={(_, newVal) => {
|
||||
Array.isArray(newVal) ? setVolume(newVal[0] / 100) : setVolume(newVal / 100);
|
||||
if (Array.isArray(newVal)) {
|
||||
audioRef.current.volume = newVal[0] / 100;
|
||||
} else {
|
||||
audioRef.current.volume = newVal / 100;
|
||||
}
|
||||
}}
|
||||
valueLabelDisplay="auto"
|
||||
valueLabelFormat={(value) => Math.floor(value)}
|
||||
@@ -260,6 +248,14 @@ const AudioPlayer = () => {
|
||||
[volume, isMuted, currentTrack],
|
||||
);
|
||||
|
||||
if (audioRef.current) {
|
||||
audioRef.current.addEventListener("ended", () => {
|
||||
if (tracks?.[currentTrack + 1]?.Id) {
|
||||
playItemFromQueue("next", user?.Id, api);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<AnimatePresence mode="sync">
|
||||
{display && (
|
||||
@@ -287,7 +283,8 @@ const AudioPlayer = () => {
|
||||
>
|
||||
{info}
|
||||
<audio
|
||||
data-src={url}
|
||||
autoPlay
|
||||
src={url}
|
||||
ref={audioRef}
|
||||
key={item?.Id}
|
||||
onTimeUpdate={(e) =>
|
||||
@@ -319,16 +316,24 @@ const AudioPlayer = () => {
|
||||
value={isScrubbing ? sliderProgress : progress}
|
||||
step={1}
|
||||
size="small"
|
||||
max={item?.RunTimeTicks}
|
||||
onChange={(e, value) => {
|
||||
max={item?.RunTimeTicks ?? 1}
|
||||
onChange={(_, value) => {
|
||||
setIsScrubbing(true);
|
||||
setSliderProgress(value);
|
||||
Array.isArray(value)
|
||||
? setSliderProgress(value[0])
|
||||
: setSliderProgress(value);
|
||||
}}
|
||||
onChangeCommitted={(e, value) => {
|
||||
onChangeCommitted={(_, value) => {
|
||||
setIsScrubbing(false);
|
||||
// console.log(ticksToSec(value * item?.RunTimeTicks));
|
||||
setProgress(value);
|
||||
audioRef.current.currentTime = ticksToSec(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);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Typography
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { getRuntimeMusic } from "@/utils/date/time";
|
||||
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 { Typography } from "@mui/material";
|
||||
import React from "react";
|
||||
@@ -7,6 +11,8 @@ import { useCallback, useRef } from "react";
|
||||
import { type XYCoord, useDrag, useDrop } from "react-dnd";
|
||||
import type { Identifier } from "typescript";
|
||||
|
||||
|
||||
|
||||
type Props = {
|
||||
track: BaseItemDto;
|
||||
index: number;
|
||||
@@ -17,85 +23,99 @@ const QueueTrack = (props: Props) => {
|
||||
s.tracks,
|
||||
s.currentItemIndex,
|
||||
]);
|
||||
const trackRef = useRef<HTMLDivElement | null>(null);
|
||||
const handleQueueUpdate = useCallback(
|
||||
(dragIndex: number, dropIndex: number) => {
|
||||
const prevState = queue;
|
||||
prevState.splice(dropIndex, 0, prevState.splice(dragIndex, 1)[0]);
|
||||
setQueue(prevState, dropIndex);
|
||||
},
|
||||
[queue],
|
||||
);
|
||||
|
||||
const [{ handlerId }, drop] = useDrop<
|
||||
{
|
||||
index: number;
|
||||
id: string;
|
||||
type: string;
|
||||
},
|
||||
void,
|
||||
{ handlerId: Identifier | null }
|
||||
>({
|
||||
accept: "Row",
|
||||
collect(monitor) {
|
||||
return {
|
||||
handlerId: monitor.getHandlerId(),
|
||||
};
|
||||
},
|
||||
hover(hoverItem, monitor) {
|
||||
console.log(hoverItem);
|
||||
if (!trackRef.current) return;
|
||||
const { attributes, listeners, setNodeRef, transform, transition } =
|
||||
useSortable({
|
||||
id: track.Id,
|
||||
});
|
||||
|
||||
const dragIndex = hoverItem.index;
|
||||
const dropIndex = index;
|
||||
// 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],
|
||||
// );
|
||||
|
||||
if (dragIndex === dropIndex) return;
|
||||
// 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 hoverBoundingRect = trackRef.current?.getBoundingClientRect();
|
||||
const hoverMiddleY =
|
||||
(hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;
|
||||
// const dragIndex = hoverItem.index;
|
||||
// const dropIndex = index;
|
||||
|
||||
const clientOffset = monitor.getClientOffset();
|
||||
// if (dragIndex === dropIndex) return;
|
||||
|
||||
const hoverClientY = (clientOffset as XYCoord).y - hoverBoundingRect.top;
|
||||
// const hoverBoundingRect = trackRef.current?.getBoundingClientRect();
|
||||
// const hoverMiddleY =
|
||||
// (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;
|
||||
|
||||
if (dragIndex < dropIndex && hoverClientY < hoverMiddleY) {
|
||||
return;
|
||||
}
|
||||
// const clientOffset = monitor.getClientOffset();
|
||||
|
||||
if (dragIndex > dropIndex && hoverClientY > hoverMiddleY) {
|
||||
return;
|
||||
}
|
||||
// const hoverClientY = (clientOffset as XYCoord).y - hoverBoundingRect.top;
|
||||
|
||||
handleQueueUpdate(dragIndex, dropIndex);
|
||||
hoverItem.index = dropIndex;
|
||||
},
|
||||
});
|
||||
// if (dragIndex < dropIndex && hoverClientY < hoverMiddleY) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
const [{ isDragging }, drag] = useDrag({
|
||||
type: "Row",
|
||||
item: () => {
|
||||
const id = track.Id;
|
||||
return { id, index };
|
||||
},
|
||||
collect: (monitor) => ({
|
||||
isDragging: monitor.isDragging(),
|
||||
}),
|
||||
});
|
||||
// if (dragIndex > dropIndex && hoverClientY > hoverMiddleY) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
drag(drop(trackRef));
|
||||
// handleQueueUpdate(dragIndex, dropIndex);
|
||||
// hoverItem.index = dropIndex;
|
||||
// },
|
||||
// });
|
||||
|
||||
// const [{ isDragging }, drag] = useDrag({
|
||||
// type: "Row",
|
||||
// item: () => {
|
||||
// const id = track.Id;
|
||||
// return { id, index };
|
||||
// },
|
||||
// collect: (monitor) => ({
|
||||
// isDragging: monitor.isDragging(),
|
||||
// }),
|
||||
// });
|
||||
|
||||
// drag(drop(trackRef));
|
||||
|
||||
const style = {
|
||||
// opacity: isDragging ? 0.5 : 1,
|
||||
transform: CSS.Transform.toString(transform),
|
||||
transition,
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={trackRef}
|
||||
style={{ opacity: isDragging ? 0.5 : 1 }}
|
||||
ref={setNodeRef}
|
||||
style={style}
|
||||
className={
|
||||
currentItemIndex === index
|
||||
? "audio-queue-track active"
|
||||
: "audio-queue-track"
|
||||
}
|
||||
>
|
||||
<span className="material-symbols-rounded">drag_handle</span>
|
||||
<span {...attributes} {...listeners} className="material-symbols-rounded">
|
||||
drag_handle
|
||||
</span>
|
||||
<div className="audio-queue-track-info">
|
||||
<Typography className="audio-queue-track-info-name">
|
||||
{track.Name}
|
||||
@@ -105,7 +125,7 @@ const QueueTrack = (props: Props) => {
|
||||
</Typography>
|
||||
</div>
|
||||
<Typography className="opacity-07">
|
||||
{getRuntimeMusic(track.RunTimeTicks)}
|
||||
{getRuntimeMusic(track.RunTimeTicks ?? 0)}
|
||||
</Typography>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -10,21 +10,16 @@ import {
|
||||
DialogContent,
|
||||
DialogTitle,
|
||||
Fab,
|
||||
FormControlLabel,
|
||||
IconButton,
|
||||
LinearProgress,
|
||||
Link,
|
||||
Skeleton,
|
||||
Switch,
|
||||
Tab,
|
||||
Tabs,
|
||||
TextField,
|
||||
Typography,
|
||||
styled,
|
||||
withStyles,
|
||||
} from "@mui/material";
|
||||
import { AnimatePresence, motion, transform } from "framer-motion";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { AnimatePresence, motion } from "framer-motion";
|
||||
import React, { useState, useMemo, useCallback } from "react";
|
||||
|
||||
import logo from "@/assets/logo.png";
|
||||
|
||||
@@ -41,14 +36,14 @@ import {
|
||||
setDefaultServer,
|
||||
setServer,
|
||||
} from "@/utils/storage/servers";
|
||||
import { allSettings, getSetting, setSetting } from "@/utils/storage/settings";
|
||||
import { allSettings } from "@/utils/storage/settings";
|
||||
import { delUser } from "@/utils/storage/user";
|
||||
import type { RecommendedServerInfo } from "@jellyfin/sdk";
|
||||
import { LoadingButton } from "@mui/lab";
|
||||
import { red, yellow } from "@mui/material/colors";
|
||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
||||
import { red } from "@mui/material/colors";
|
||||
import { useNavigate } from "@tanstack/react-router";
|
||||
import { relaunch } from "@tauri-apps/plugin-process";
|
||||
import { type Update, check } from "@tauri-apps/plugin-updater";
|
||||
import { check } from "@tauri-apps/plugin-updater";
|
||||
import { useSnackbar } from "notistack";
|
||||
import SettingOption from "../settingOption";
|
||||
|
||||
@@ -82,10 +77,7 @@ const Settings = () => {
|
||||
const navigate = useNavigate();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
const [applicationVersion, serversOnDiskFn] = useCentralStore((state) => [
|
||||
state.clientVersion,
|
||||
state.allServersOnDisk,
|
||||
]);
|
||||
const [applicationVersion] = useCentralStore((state) => [state.clientVersion]);
|
||||
|
||||
const serversOnDisk = useQuery({
|
||||
queryKey: ["settings", "serversOnDisk"],
|
||||
@@ -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 (
|
||||
<Dialog
|
||||
open={open}
|
||||
fullWidth
|
||||
maxWidth="md"
|
||||
PaperProps={{
|
||||
className: "settings glass",
|
||||
elevation: 10,
|
||||
}}
|
||||
PaperProps={paperProps}
|
||||
hideBackdrop
|
||||
onClose={() => setSettingsDialogOpen(false)}
|
||||
onClose={handleClose}
|
||||
>
|
||||
<Tabs
|
||||
orientation="vertical"
|
||||
value={tabValue}
|
||||
onChange={(e, newValue) => {
|
||||
onChange={(_, newValue) => {
|
||||
setSettingsTabValue(newValue);
|
||||
}}
|
||||
style={{
|
||||
@@ -513,14 +516,6 @@ const Settings = () => {
|
||||
{systemInfo.data?.Version}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="settings-info">
|
||||
<Typography variant="subtitle2">
|
||||
Operating System:
|
||||
</Typography>
|
||||
<Typography variant="subtitle2">
|
||||
{systemInfo.data?.OperatingSystemDisplayName}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="settings-info">
|
||||
<Typography variant="subtitle2">
|
||||
Server Architecture:
|
||||
@@ -563,9 +558,9 @@ const Settings = () => {
|
||||
component={Link}
|
||||
variant="subtitle2"
|
||||
target="_blank"
|
||||
href="https://github.com/prayag17/JellyPlayer"
|
||||
href="https://github.com/prayag17/Blink"
|
||||
>
|
||||
https://github.com/prayag17/JellyPlayer
|
||||
https://github.com/prayag17/Blink
|
||||
</Typography>
|
||||
<Typography
|
||||
component={Link}
|
||||
|
||||
@@ -1,28 +1,27 @@
|
||||
.settings{
|
||||
.settings {
|
||||
display: grid !important;
|
||||
grid-template-columns: 20% 1fr;
|
||||
height: 60vh;
|
||||
overflow: hidden !important;
|
||||
.MuiTabs-flexContainerVertical{
|
||||
.MuiTabs-flexContainerVertical {
|
||||
height: 100%;
|
||||
}
|
||||
&-container{
|
||||
&-container {
|
||||
margin: 14px 0 14px 14px;
|
||||
}
|
||||
&-tab{
|
||||
&-tab {
|
||||
display: grid !important;
|
||||
grid-template-columns: 2em 1fr;
|
||||
align-items: center;
|
||||
justify-items: start !important;
|
||||
gap:1em;
|
||||
& .material-symbols-rounded{
|
||||
gap: 1em;
|
||||
& .material-symbols-rounded {
|
||||
justify-self: center !important;
|
||||
}
|
||||
|
||||
}
|
||||
&-scroll{
|
||||
&-scroll {
|
||||
overflow-y: auto;
|
||||
scrollbar-gutter:stable ;
|
||||
scrollbar-gutter: stable;
|
||||
overscroll-behavior: contain;
|
||||
// Magic scrollbar
|
||||
&::-webkit-scrollbar {
|
||||
@@ -37,14 +36,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// About page
|
||||
&-grid{
|
||||
&-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
||||
gap:1em;
|
||||
gap: 1em;
|
||||
}
|
||||
&-logo{
|
||||
&-logo {
|
||||
width: 100%;
|
||||
background: rgb(255 255 255 / 1);
|
||||
padding: 0em;
|
||||
@@ -53,7 +51,7 @@
|
||||
border-radius: $border-radius-default;
|
||||
object-fit: contain;
|
||||
}
|
||||
&-info{
|
||||
&-info {
|
||||
display: grid;
|
||||
grid-template-columns: 40% 1fr;
|
||||
gap: 1em;
|
||||
@@ -61,13 +59,13 @@
|
||||
align-items: center;
|
||||
border-bottom: 1px solid rgb(255 255 255 / 0.1);
|
||||
padding-bottom: 0.5em;
|
||||
&-container{
|
||||
&-container {
|
||||
background: rgb(0 0 0 / 0.3);
|
||||
padding: 1em;
|
||||
border-radius: $border-radius-default;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap:0.6em;
|
||||
gap: 0.6em;
|
||||
width: 100%;
|
||||
}
|
||||
&:last-child {
|
||||
@@ -78,9 +76,8 @@
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
|
||||
//settings
|
||||
&-option{
|
||||
&-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
@@ -88,21 +85,12 @@
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
margin-bottom: 0.6em !important;
|
||||
&-info-caption{
|
||||
&-info-caption {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
//serverList
|
||||
&-server{
|
||||
&-container{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
align-items: center;
|
||||
padding-bottom: 4.6em;
|
||||
}
|
||||
|
||||
&-server {
|
||||
display: grid;
|
||||
grid-template-columns: 3.4em 1fr auto;
|
||||
justify-items: start;
|
||||
@@ -112,7 +100,13 @@
|
||||
padding: 1em;
|
||||
width: 100%;
|
||||
border-radius: $border-radius-default;
|
||||
|
||||
&-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
align-items: center;
|
||||
padding-bottom: 4.6em;
|
||||
}
|
||||
&-icon {
|
||||
font-size: 3.4em !important;
|
||||
font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 10, "opsz" 40;
|
||||
@@ -124,7 +118,7 @@
|
||||
&-version {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap:0.4em;
|
||||
gap: 0.4em;
|
||||
}
|
||||
}
|
||||
&-buttons {
|
||||
@@ -134,7 +128,6 @@
|
||||
// width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
&-fab-container {
|
||||
display: flex;
|
||||
position: absolute;
|
||||
@@ -144,7 +137,6 @@
|
||||
justify-content: center;
|
||||
gap: 0.8em;
|
||||
}
|
||||
|
||||
// Dialog
|
||||
&-add {
|
||||
display: flex;
|
||||
@@ -154,7 +146,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.Mui-selected .material-symbols-rounded{
|
||||
.Mui-selected .material-symbols-rounded {
|
||||
font-variation-settings: "FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40;
|
||||
}
|
||||
@@ -2,7 +2,11 @@ import Button from "@mui/material/Button";
|
||||
import Typography from "@mui/material/Typography";
|
||||
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 [isOverflowing, setIsOverflowing] = useState(false);
|
||||
const textRef = useRef(null);
|
||||
@@ -34,7 +38,7 @@ const ShowMoreText = ({ content, collapsedLines, extraProps }) => {
|
||||
display: "-webkit-box",
|
||||
textOverflow: "ellipsis",
|
||||
overflow: "hidden",
|
||||
WebkitLineClamp: displayFull ? "none" : collapsedLines ?? 2,
|
||||
WebkitLineClamp: displayFull ? "none" : (collapsedLines ?? 2),
|
||||
WebkitBoxOrient: "vertical",
|
||||
width: "100%",
|
||||
}}
|
||||
@@ -7,7 +7,7 @@ import "./tagChip.scss";
|
||||
const TagChip = ({
|
||||
label,
|
||||
linkProps,
|
||||
}: { label: string; linkProps: LinkProps }) => {
|
||||
}: { label: string; linkProps?: LinkProps }) => {
|
||||
return (
|
||||
<Link className="tag" to="/search" search={{ query: label }} {...linkProps}>
|
||||
<Typography variant="subtitle2" fontWeight={300}>
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
import "./textLink.scss";
|
||||
import { useNavigate } from "@tanstack/react-router";
|
||||
|
||||
const TextLink = ({ children, location, variant, otherProps }) => {
|
||||
// const navigate = useNavigate();
|
||||
const navigate = useNavigate();
|
||||
|
||||
return (
|
||||
<Typography
|
||||
variant={variant}
|
||||
className="link flex"
|
||||
// onClick={() => navigate(location)}
|
||||
onClick={() => navigate({ to: location })}
|
||||
{...otherProps}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from "react";
|
||||
import React, { useCallback, useMemo } from "react";
|
||||
|
||||
import { Dialog, Slide } from "@mui/material";
|
||||
import { useKonamiEasterEgg } from "../../utils/misc/konami";
|
||||
@@ -6,15 +6,22 @@ import { useKonamiEasterEgg } from "../../utils/misc/konami";
|
||||
export const EasterEgg = () => {
|
||||
const [easterEgg, setEasterEgg] = useKonamiEasterEgg();
|
||||
|
||||
// Memoize the onClose function
|
||||
const handleClose = useCallback(() => {
|
||||
setEasterEgg(false);
|
||||
}, [setEasterEgg]);
|
||||
|
||||
// Memoize the sx object
|
||||
const dialogSx = useMemo(
|
||||
() => ({
|
||||
background: "black",
|
||||
}),
|
||||
[],
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Dialog
|
||||
open={easterEgg}
|
||||
onClose={() => setEasterEgg(false)}
|
||||
sx={{
|
||||
background: "black",
|
||||
}}
|
||||
>
|
||||
<Dialog open={easterEgg} onClose={handleClose} sx={dialogSx}>
|
||||
<iframe
|
||||
width="560"
|
||||
height="315"
|
||||
|
||||
@@ -1,69 +1,76 @@
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import * as generatedClient from "@jellyfin/sdk/lib/generated-client";
|
||||
import React from "react";
|
||||
|
||||
export const getTypeIcon = (icon: BaseItemKind) => {
|
||||
export const getTypeIcon = (
|
||||
icon:
|
||||
| generatedClient.BaseItemKind
|
||||
| generatedClient.CollectionType
|
||||
| "Home"
|
||||
| "User"
|
||||
| "universal",
|
||||
) => {
|
||||
switch (icon) {
|
||||
case "Home":
|
||||
return <div className="material-symbols-rounded">home</div>;
|
||||
case BaseItemKind.Audio:
|
||||
case generatedClient.BaseItemKind.Audio:
|
||||
return <div className="material-symbols-rounded">mic</div>;
|
||||
case BaseItemKind.AudioBook:
|
||||
case generatedClient.BaseItemKind.AudioBook:
|
||||
return <div className="material-symbols-rounded">speech_to_text</div>;
|
||||
case BaseItemKind.Book:
|
||||
case generatedClient.BaseItemKind.Book:
|
||||
return <div className="material-symbols-rounded">book</div>;
|
||||
case "boxsets":
|
||||
case BaseItemKind.BoxSet:
|
||||
case generatedClient.BaseItemKind.BoxSet:
|
||||
return <div className="material-symbols-rounded">video_library</div>;
|
||||
case "livetv":
|
||||
case BaseItemKind.TvProgram:
|
||||
case BaseItemKind.TvChannel:
|
||||
case BaseItemKind.Program:
|
||||
case BaseItemKind.Recording:
|
||||
case BaseItemKind.LiveTvChannel:
|
||||
case BaseItemKind.LiveTvProgram:
|
||||
case BaseItemKind.ChannelFolderItem:
|
||||
case BaseItemKind.Channel:
|
||||
case generatedClient.BaseItemKind.TvProgram:
|
||||
case generatedClient.BaseItemKind.TvChannel:
|
||||
case generatedClient.BaseItemKind.Program:
|
||||
case generatedClient.BaseItemKind.Recording:
|
||||
case generatedClient.BaseItemKind.LiveTvChannel:
|
||||
case generatedClient.BaseItemKind.LiveTvProgram:
|
||||
case generatedClient.BaseItemKind.ChannelFolderItem:
|
||||
case generatedClient.BaseItemKind.Channel:
|
||||
return (
|
||||
<div className="material-symbols-rounded">settings_input_antenna</div>
|
||||
);
|
||||
case "tvshows":
|
||||
case BaseItemKind.Season:
|
||||
case BaseItemKind.Series:
|
||||
case BaseItemKind.Episode:
|
||||
case generatedClient.BaseItemKind.Season:
|
||||
case generatedClient.BaseItemKind.Series:
|
||||
case generatedClient.BaseItemKind.Episode:
|
||||
return <div className="material-symbols-rounded">tv_gen</div>;
|
||||
case "playlists":
|
||||
case BaseItemKind.Playlist:
|
||||
case BaseItemKind.PlaylistsFolder:
|
||||
case BaseItemKind.ManualPlaylistsFolder:
|
||||
case generatedClient.BaseItemKind.Playlist:
|
||||
case generatedClient.BaseItemKind.PlaylistsFolder:
|
||||
case generatedClient.BaseItemKind.ManualPlaylistsFolder:
|
||||
return <div className="material-symbols-rounded">queue_music</div>;
|
||||
case "movies":
|
||||
case BaseItemKind.Movie:
|
||||
case generatedClient.BaseItemKind.Movie:
|
||||
return <div className="material-symbols-rounded">movie</div>;
|
||||
case BaseItemKind.MusicAlbum:
|
||||
case generatedClient.BaseItemKind.MusicAlbum:
|
||||
return <div className="material-symbols-rounded">album</div>;
|
||||
case BaseItemKind.MusicArtist:
|
||||
case generatedClient.BaseItemKind.MusicArtist:
|
||||
return <div className="material-symbols-rounded">artist</div>;
|
||||
case BaseItemKind.Genre:
|
||||
case BaseItemKind.MusicGenre:
|
||||
case generatedClient.BaseItemKind.Genre:
|
||||
case generatedClient.BaseItemKind.MusicGenre:
|
||||
return <div className="material-symbols-rounded">domino_mask</div>;
|
||||
case "musicvideos":
|
||||
case BaseItemKind.MusicVideo:
|
||||
case generatedClient.BaseItemKind.MusicVideo:
|
||||
return <div className="material-symbols-rounded">music_video</div>;
|
||||
case "User":
|
||||
case BaseItemKind.Person:
|
||||
case generatedClient.BaseItemKind.Person:
|
||||
return <div className="material-symbols-rounded">person</div>;
|
||||
case BaseItemKind.Photo:
|
||||
case generatedClient.BaseItemKind.Photo:
|
||||
return <div className="material-symbols-rounded">image</div>;
|
||||
case "photos":
|
||||
case BaseItemKind.PhotoAlbum:
|
||||
case generatedClient.BaseItemKind.PhotoAlbum:
|
||||
return <div className="material-symbols-rounded">photo_library</div>;
|
||||
case "universal":
|
||||
case BaseItemKind.Studio:
|
||||
case generatedClient.BaseItemKind.Studio:
|
||||
return <div className="material-symbols-rounded">category</div>;
|
||||
case "trailers":
|
||||
case BaseItemKind.Trailer:
|
||||
case generatedClient.BaseItemKind.Trailer:
|
||||
return <div className="material-symbols-rounded">smart_display</div>;
|
||||
case BaseItemKind.Video:
|
||||
case generatedClient.BaseItemKind.Video:
|
||||
return <div className="material-symbols-rounded">theaters</div>;
|
||||
case "music":
|
||||
return <div className="material-symbols-rounded">library_music</div>;
|
||||
|
||||
+35
-12
@@ -1,10 +1,6 @@
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import {
|
||||
RouterProvider,
|
||||
createRouteMask,
|
||||
createRouter,
|
||||
} from "@tanstack/react-router";
|
||||
import React, { Suspense } from "react";
|
||||
import { RouterProvider, createRouter } from "@tanstack/react-router";
|
||||
import React, { Suspense, useEffect } from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
// Import the generated route tree
|
||||
import { routeTree } from "./routeTree.gen";
|
||||
@@ -25,6 +21,7 @@ const router = createRouter({
|
||||
createApi: undefined!,
|
||||
user: undefined,
|
||||
jellyfinSDK: undefined!,
|
||||
fetchCurrentUser: undefined!,
|
||||
},
|
||||
defaultPreload: "intent",
|
||||
});
|
||||
@@ -36,7 +33,10 @@ declare module "@tanstack/react-router" {
|
||||
}
|
||||
}
|
||||
|
||||
import { ErrorBoundary } from "react-error-boundary";
|
||||
import { ErrorNotice } from "./components/notices/errorNotice/errorNotice";
|
||||
import { ApiProvider, useApiInContext } from "./utils/store/api";
|
||||
import { CentralProvider, useCentralStore } from "./utils/store/central";
|
||||
|
||||
export const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
@@ -55,8 +55,27 @@ function ProviderWrapper() {
|
||||
s.createApi,
|
||||
s.jellyfin,
|
||||
]);
|
||||
const [user, fetchCurrentUser] = useCentralStore((s) => [
|
||||
s.currentUser,
|
||||
s.fetchCurrentUser,
|
||||
]);
|
||||
if (api?.accessToken && !user?.Id) {
|
||||
fetchCurrentUser(api);
|
||||
}
|
||||
useEffect(() => {
|
||||
if (api) {
|
||||
console.log(`API is set - Route ${window.location.pathname}`);
|
||||
console.log(api);
|
||||
} else {
|
||||
console.log(`API is not set - Route ${window.location.pathname}`);
|
||||
}
|
||||
router.invalidate(); // This is a hack to force the router to re-evaluate the routes and re-run the beforeLoad functions
|
||||
}, [api]);
|
||||
return (
|
||||
<RouterProvider router={router} context={{ api, createApi, jellyfinSDK }} />
|
||||
<RouterProvider
|
||||
router={router}
|
||||
context={{ api, createApi, user, jellyfinSDK, fetchCurrentUser }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -64,11 +83,15 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
|
||||
<React.StrictMode>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
{/* TODO: Create a proper loading fallback component */}
|
||||
<Suspense fallback={<h1>Loading in main.tsx</h1>}>
|
||||
<ApiProvider>
|
||||
<ProviderWrapper />
|
||||
</ApiProvider>
|
||||
</Suspense>
|
||||
<ErrorBoundary FallbackComponent={ErrorNotice}>
|
||||
<Suspense fallback={<h1>Loading in main.tsx</h1>}>
|
||||
<CentralProvider>
|
||||
<ApiProvider>
|
||||
<ProviderWrapper />
|
||||
</ApiProvider>
|
||||
</CentralProvider>
|
||||
</Suspense>
|
||||
</ErrorBoundary>
|
||||
</QueryClientProvider>
|
||||
</React.StrictMode>,
|
||||
);
|
||||
|
||||
+70
-57
@@ -1,12 +1,12 @@
|
||||
/* prettier-ignore-start */
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
// @ts-nocheck
|
||||
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
|
||||
// This file is auto-generated by TanStack Router
|
||||
// This file was automatically generated by TanStack Router.
|
||||
// You should NOT make any changes in this file as it will be overwritten.
|
||||
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
|
||||
|
||||
// Import Routes
|
||||
|
||||
@@ -16,7 +16,6 @@ import { Route as IndexImport } from './routes/index'
|
||||
import { Route as ErrorCodeImport } from './routes/error/$code'
|
||||
import { Route as ApiSearchImport } from './routes/_api/search'
|
||||
import { Route as ApiLoginImport } from './routes/_api/login'
|
||||
import { Route as ApiLibraryImport } from './routes/_api/library'
|
||||
import { Route as ApiSearchIndexImport } from './routes/_api/search/index'
|
||||
import { Route as ApiPlayerIndexImport } from './routes/_api/player/index'
|
||||
import { Route as ApiHomeIndexImport } from './routes/_api/home/index'
|
||||
@@ -26,6 +25,7 @@ import { Route as SetupServerErrorImport } from './routes/setup/server.error'
|
||||
import { Route as SetupServerAddImport } from './routes/setup/server.add'
|
||||
import { Route as ApiSeriesIdImport } from './routes/_api/series/$id'
|
||||
import { Route as ApiPlaylistIdImport } from './routes/_api/playlist/$id'
|
||||
import { Route as ApiPlayerPhotosImport } from './routes/_api/player/photos'
|
||||
import { Route as ApiPlayerAudioImport } from './routes/_api/player/audio'
|
||||
import { Route as ApiPersonIdImport } from './routes/_api/person/$id'
|
||||
import { Route as ApiLoginManualImport } from './routes/_api/login/manual'
|
||||
@@ -46,126 +46,151 @@ const ApiRoute = ApiImport.update({
|
||||
} as any)
|
||||
|
||||
const IndexRoute = IndexImport.update({
|
||||
id: '/',
|
||||
path: '/',
|
||||
getParentRoute: () => rootRoute,
|
||||
} as any)
|
||||
|
||||
const ErrorCodeRoute = ErrorCodeImport.update({
|
||||
id: '/error/$code',
|
||||
path: '/error/$code',
|
||||
getParentRoute: () => rootRoute,
|
||||
} as any)
|
||||
|
||||
const ApiSearchRoute = ApiSearchImport.update({
|
||||
id: '/search',
|
||||
path: '/search',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiLoginRoute = ApiLoginImport.update({
|
||||
id: '/login',
|
||||
path: '/login',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiLibraryRoute = ApiLibraryImport.update({
|
||||
path: '/library',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiSearchIndexRoute = ApiSearchIndexImport.update({
|
||||
id: '/',
|
||||
path: '/',
|
||||
getParentRoute: () => ApiSearchRoute,
|
||||
} as any)
|
||||
|
||||
const ApiPlayerIndexRoute = ApiPlayerIndexImport.update({
|
||||
id: '/player/',
|
||||
path: '/player/',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiHomeIndexRoute = ApiHomeIndexImport.update({
|
||||
id: '/home/',
|
||||
path: '/home/',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiFavoriteIndexRoute = ApiFavoriteIndexImport.update({
|
||||
id: '/favorite/',
|
||||
path: '/favorite/',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const SetupServerListRoute = SetupServerListImport.update({
|
||||
id: '/setup/server/list',
|
||||
path: '/setup/server/list',
|
||||
getParentRoute: () => rootRoute,
|
||||
} as any)
|
||||
|
||||
const SetupServerErrorRoute = SetupServerErrorImport.update({
|
||||
id: '/setup/server/error',
|
||||
path: '/setup/server/error',
|
||||
getParentRoute: () => rootRoute,
|
||||
} as any)
|
||||
|
||||
const SetupServerAddRoute = SetupServerAddImport.update({
|
||||
id: '/setup/server/add',
|
||||
path: '/setup/server/add',
|
||||
getParentRoute: () => rootRoute,
|
||||
} as any)
|
||||
|
||||
const ApiSeriesIdRoute = ApiSeriesIdImport.update({
|
||||
id: '/series/$id',
|
||||
path: '/series/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiPlaylistIdRoute = ApiPlaylistIdImport.update({
|
||||
id: '/playlist/$id',
|
||||
path: '/playlist/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiPlayerPhotosRoute = ApiPlayerPhotosImport.update({
|
||||
id: '/player/photos',
|
||||
path: '/player/photos',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiPlayerAudioRoute = ApiPlayerAudioImport.update({
|
||||
id: '/player/audio',
|
||||
path: '/player/audio',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiPersonIdRoute = ApiPersonIdImport.update({
|
||||
id: '/person/$id',
|
||||
path: '/person/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiLoginManualRoute = ApiLoginManualImport.update({
|
||||
id: '/manual',
|
||||
path: '/manual',
|
||||
getParentRoute: () => ApiLoginRoute,
|
||||
} as any)
|
||||
|
||||
const ApiLoginListRoute = ApiLoginListImport.update({
|
||||
id: '/list',
|
||||
path: '/list',
|
||||
getParentRoute: () => ApiLoginRoute,
|
||||
} as any)
|
||||
|
||||
const ApiLibraryIdRoute = ApiLibraryIdImport.update({
|
||||
path: '/$id',
|
||||
getParentRoute: () => ApiLibraryRoute,
|
||||
id: '/library/$id',
|
||||
path: '/library/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiItemIdRoute = ApiItemIdImport.update({
|
||||
id: '/item/$id',
|
||||
path: '/item/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiEpisodeIdRoute = ApiEpisodeIdImport.update({
|
||||
id: '/episode/$id',
|
||||
path: '/episode/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiBoxsetIdRoute = ApiBoxsetIdImport.update({
|
||||
id: '/boxset/$id',
|
||||
path: '/boxset/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiArtistIdRoute = ApiArtistIdImport.update({
|
||||
id: '/artist/$id',
|
||||
path: '/artist/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiAlbumIdRoute = ApiAlbumIdImport.update({
|
||||
id: '/album/$id',
|
||||
path: '/album/$id',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiLoginUserIdUserNameRoute = ApiLoginUserIdUserNameImport.update({
|
||||
id: '/$userId/$userName',
|
||||
path: '/$userId/$userName',
|
||||
getParentRoute: () => ApiLoginRoute,
|
||||
} as any)
|
||||
@@ -188,13 +213,6 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof ApiImport
|
||||
parentRoute: typeof rootRoute
|
||||
}
|
||||
'/_api/library': {
|
||||
id: '/_api/library'
|
||||
path: '/library'
|
||||
fullPath: '/library'
|
||||
preLoaderRoute: typeof ApiLibraryImport
|
||||
parentRoute: typeof ApiImport
|
||||
}
|
||||
'/_api/login': {
|
||||
id: '/_api/login'
|
||||
path: '/login'
|
||||
@@ -253,10 +271,10 @@ declare module '@tanstack/react-router' {
|
||||
}
|
||||
'/_api/library/$id': {
|
||||
id: '/_api/library/$id'
|
||||
path: '/$id'
|
||||
path: '/library/$id'
|
||||
fullPath: '/library/$id'
|
||||
preLoaderRoute: typeof ApiLibraryIdImport
|
||||
parentRoute: typeof ApiLibraryImport
|
||||
parentRoute: typeof ApiImport
|
||||
}
|
||||
'/_api/login/list': {
|
||||
id: '/_api/login/list'
|
||||
@@ -286,6 +304,13 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof ApiPlayerAudioImport
|
||||
parentRoute: typeof ApiImport
|
||||
}
|
||||
'/_api/player/photos': {
|
||||
id: '/_api/player/photos'
|
||||
path: '/player/photos'
|
||||
fullPath: '/player/photos'
|
||||
preLoaderRoute: typeof ApiPlayerPhotosImport
|
||||
parentRoute: typeof ApiImport
|
||||
}
|
||||
'/_api/playlist/$id': {
|
||||
id: '/_api/playlist/$id'
|
||||
path: '/playlist/$id'
|
||||
@@ -361,18 +386,6 @@ declare module '@tanstack/react-router' {
|
||||
|
||||
// Create and export the route tree
|
||||
|
||||
interface ApiLibraryRouteChildren {
|
||||
ApiLibraryIdRoute: typeof ApiLibraryIdRoute
|
||||
}
|
||||
|
||||
const ApiLibraryRouteChildren: ApiLibraryRouteChildren = {
|
||||
ApiLibraryIdRoute: ApiLibraryIdRoute,
|
||||
}
|
||||
|
||||
const ApiLibraryRouteWithChildren = ApiLibraryRoute._addFileChildren(
|
||||
ApiLibraryRouteChildren,
|
||||
)
|
||||
|
||||
interface ApiLoginRouteChildren {
|
||||
ApiLoginListRoute: typeof ApiLoginListRoute
|
||||
ApiLoginManualRoute: typeof ApiLoginManualRoute
|
||||
@@ -402,7 +415,6 @@ const ApiSearchRouteWithChildren = ApiSearchRoute._addFileChildren(
|
||||
)
|
||||
|
||||
interface ApiRouteChildren {
|
||||
ApiLibraryRoute: typeof ApiLibraryRouteWithChildren
|
||||
ApiLoginRoute: typeof ApiLoginRouteWithChildren
|
||||
ApiSearchRoute: typeof ApiSearchRouteWithChildren
|
||||
ApiAlbumIdRoute: typeof ApiAlbumIdRoute
|
||||
@@ -410,8 +422,10 @@ interface ApiRouteChildren {
|
||||
ApiBoxsetIdRoute: typeof ApiBoxsetIdRoute
|
||||
ApiEpisodeIdRoute: typeof ApiEpisodeIdRoute
|
||||
ApiItemIdRoute: typeof ApiItemIdRoute
|
||||
ApiLibraryIdRoute: typeof ApiLibraryIdRoute
|
||||
ApiPersonIdRoute: typeof ApiPersonIdRoute
|
||||
ApiPlayerAudioRoute: typeof ApiPlayerAudioRoute
|
||||
ApiPlayerPhotosRoute: typeof ApiPlayerPhotosRoute
|
||||
ApiPlaylistIdRoute: typeof ApiPlaylistIdRoute
|
||||
ApiSeriesIdRoute: typeof ApiSeriesIdRoute
|
||||
ApiFavoriteIndexRoute: typeof ApiFavoriteIndexRoute
|
||||
@@ -420,7 +434,6 @@ interface ApiRouteChildren {
|
||||
}
|
||||
|
||||
const ApiRouteChildren: ApiRouteChildren = {
|
||||
ApiLibraryRoute: ApiLibraryRouteWithChildren,
|
||||
ApiLoginRoute: ApiLoginRouteWithChildren,
|
||||
ApiSearchRoute: ApiSearchRouteWithChildren,
|
||||
ApiAlbumIdRoute: ApiAlbumIdRoute,
|
||||
@@ -428,8 +441,10 @@ const ApiRouteChildren: ApiRouteChildren = {
|
||||
ApiBoxsetIdRoute: ApiBoxsetIdRoute,
|
||||
ApiEpisodeIdRoute: ApiEpisodeIdRoute,
|
||||
ApiItemIdRoute: ApiItemIdRoute,
|
||||
ApiLibraryIdRoute: ApiLibraryIdRoute,
|
||||
ApiPersonIdRoute: ApiPersonIdRoute,
|
||||
ApiPlayerAudioRoute: ApiPlayerAudioRoute,
|
||||
ApiPlayerPhotosRoute: ApiPlayerPhotosRoute,
|
||||
ApiPlaylistIdRoute: ApiPlaylistIdRoute,
|
||||
ApiSeriesIdRoute: ApiSeriesIdRoute,
|
||||
ApiFavoriteIndexRoute: ApiFavoriteIndexRoute,
|
||||
@@ -439,10 +454,9 @@ const ApiRouteChildren: ApiRouteChildren = {
|
||||
|
||||
const ApiRouteWithChildren = ApiRoute._addFileChildren(ApiRouteChildren)
|
||||
|
||||
interface FileRoutesByFullPath {
|
||||
export interface FileRoutesByFullPath {
|
||||
'/': typeof IndexRoute
|
||||
'': typeof ApiRouteWithChildren
|
||||
'/library': typeof ApiLibraryRouteWithChildren
|
||||
'/login': typeof ApiLoginRouteWithChildren
|
||||
'/search': typeof ApiSearchRouteWithChildren
|
||||
'/error/$code': typeof ErrorCodeRoute
|
||||
@@ -456,6 +470,7 @@ interface FileRoutesByFullPath {
|
||||
'/login/manual': typeof ApiLoginManualRoute
|
||||
'/person/$id': typeof ApiPersonIdRoute
|
||||
'/player/audio': typeof ApiPlayerAudioRoute
|
||||
'/player/photos': typeof ApiPlayerPhotosRoute
|
||||
'/playlist/$id': typeof ApiPlaylistIdRoute
|
||||
'/series/$id': typeof ApiSeriesIdRoute
|
||||
'/setup/server/add': typeof SetupServerAddRoute
|
||||
@@ -468,10 +483,9 @@ interface FileRoutesByFullPath {
|
||||
'/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
||||
}
|
||||
|
||||
interface FileRoutesByTo {
|
||||
export interface FileRoutesByTo {
|
||||
'/': typeof IndexRoute
|
||||
'': typeof ApiRouteWithChildren
|
||||
'/library': typeof ApiLibraryRouteWithChildren
|
||||
'/login': typeof ApiLoginRouteWithChildren
|
||||
'/error/$code': typeof ErrorCodeRoute
|
||||
'/album/$id': typeof ApiAlbumIdRoute
|
||||
@@ -484,6 +498,7 @@ interface FileRoutesByTo {
|
||||
'/login/manual': typeof ApiLoginManualRoute
|
||||
'/person/$id': typeof ApiPersonIdRoute
|
||||
'/player/audio': typeof ApiPlayerAudioRoute
|
||||
'/player/photos': typeof ApiPlayerPhotosRoute
|
||||
'/playlist/$id': typeof ApiPlaylistIdRoute
|
||||
'/series/$id': typeof ApiSeriesIdRoute
|
||||
'/setup/server/add': typeof SetupServerAddRoute
|
||||
@@ -496,10 +511,10 @@ interface FileRoutesByTo {
|
||||
'/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
||||
}
|
||||
|
||||
interface FileRoutesById {
|
||||
export interface FileRoutesById {
|
||||
__root__: typeof rootRoute
|
||||
'/': typeof IndexRoute
|
||||
'/_api': typeof ApiRouteWithChildren
|
||||
'/_api/library': typeof ApiLibraryRouteWithChildren
|
||||
'/_api/login': typeof ApiLoginRouteWithChildren
|
||||
'/_api/search': typeof ApiSearchRouteWithChildren
|
||||
'/error/$code': typeof ErrorCodeRoute
|
||||
@@ -513,6 +528,7 @@ interface FileRoutesById {
|
||||
'/_api/login/manual': typeof ApiLoginManualRoute
|
||||
'/_api/person/$id': typeof ApiPersonIdRoute
|
||||
'/_api/player/audio': typeof ApiPlayerAudioRoute
|
||||
'/_api/player/photos': typeof ApiPlayerPhotosRoute
|
||||
'/_api/playlist/$id': typeof ApiPlaylistIdRoute
|
||||
'/_api/series/$id': typeof ApiSeriesIdRoute
|
||||
'/setup/server/add': typeof SetupServerAddRoute
|
||||
@@ -525,12 +541,11 @@ interface FileRoutesById {
|
||||
'/_api/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
||||
}
|
||||
|
||||
interface FileRouteTypes {
|
||||
export interface FileRouteTypes {
|
||||
fileRoutesByFullPath: FileRoutesByFullPath
|
||||
fullPaths:
|
||||
| '/'
|
||||
| ''
|
||||
| '/library'
|
||||
| '/login'
|
||||
| '/search'
|
||||
| '/error/$code'
|
||||
@@ -544,6 +559,7 @@ interface FileRouteTypes {
|
||||
| '/login/manual'
|
||||
| '/person/$id'
|
||||
| '/player/audio'
|
||||
| '/player/photos'
|
||||
| '/playlist/$id'
|
||||
| '/series/$id'
|
||||
| '/setup/server/add'
|
||||
@@ -558,7 +574,6 @@ interface FileRouteTypes {
|
||||
to:
|
||||
| '/'
|
||||
| ''
|
||||
| '/library'
|
||||
| '/login'
|
||||
| '/error/$code'
|
||||
| '/album/$id'
|
||||
@@ -571,6 +586,7 @@ interface FileRouteTypes {
|
||||
| '/login/manual'
|
||||
| '/person/$id'
|
||||
| '/player/audio'
|
||||
| '/player/photos'
|
||||
| '/playlist/$id'
|
||||
| '/series/$id'
|
||||
| '/setup/server/add'
|
||||
@@ -582,9 +598,9 @@ interface FileRouteTypes {
|
||||
| '/search'
|
||||
| '/login/$userId/$userName'
|
||||
id:
|
||||
| '__root__'
|
||||
| '/'
|
||||
| '/_api'
|
||||
| '/_api/library'
|
||||
| '/_api/login'
|
||||
| '/_api/search'
|
||||
| '/error/$code'
|
||||
@@ -598,6 +614,7 @@ interface FileRouteTypes {
|
||||
| '/_api/login/manual'
|
||||
| '/_api/person/$id'
|
||||
| '/_api/player/audio'
|
||||
| '/_api/player/photos'
|
||||
| '/_api/playlist/$id'
|
||||
| '/_api/series/$id'
|
||||
| '/setup/server/add'
|
||||
@@ -611,7 +628,7 @@ interface FileRouteTypes {
|
||||
fileRoutesById: FileRoutesById
|
||||
}
|
||||
|
||||
interface RootRouteChildren {
|
||||
export interface RootRouteChildren {
|
||||
IndexRoute: typeof IndexRoute
|
||||
ApiRoute: typeof ApiRouteWithChildren
|
||||
ErrorCodeRoute: typeof ErrorCodeRoute
|
||||
@@ -633,8 +650,6 @@ export const routeTree = rootRoute
|
||||
._addFileChildren(rootRouteChildren)
|
||||
._addFileTypes<FileRouteTypes>()
|
||||
|
||||
/* prettier-ignore-end */
|
||||
|
||||
/* ROUTE_MANIFEST_START
|
||||
{
|
||||
"routes": {
|
||||
@@ -655,7 +670,6 @@ export const routeTree = rootRoute
|
||||
"/_api": {
|
||||
"filePath": "_api.tsx",
|
||||
"children": [
|
||||
"/_api/library",
|
||||
"/_api/login",
|
||||
"/_api/search",
|
||||
"/_api/album/$id",
|
||||
@@ -663,8 +677,10 @@ export const routeTree = rootRoute
|
||||
"/_api/boxset/$id",
|
||||
"/_api/episode/$id",
|
||||
"/_api/item/$id",
|
||||
"/_api/library/$id",
|
||||
"/_api/person/$id",
|
||||
"/_api/player/audio",
|
||||
"/_api/player/photos",
|
||||
"/_api/playlist/$id",
|
||||
"/_api/series/$id",
|
||||
"/_api/favorite/",
|
||||
@@ -672,13 +688,6 @@ export const routeTree = rootRoute
|
||||
"/_api/player/"
|
||||
]
|
||||
},
|
||||
"/_api/library": {
|
||||
"filePath": "_api/library.tsx",
|
||||
"parent": "/_api",
|
||||
"children": [
|
||||
"/_api/library/$id"
|
||||
]
|
||||
},
|
||||
"/_api/login": {
|
||||
"filePath": "_api/login.tsx",
|
||||
"parent": "/_api",
|
||||
@@ -720,7 +729,7 @@ export const routeTree = rootRoute
|
||||
},
|
||||
"/_api/library/$id": {
|
||||
"filePath": "_api/library/$id.tsx",
|
||||
"parent": "/_api/library"
|
||||
"parent": "/_api"
|
||||
},
|
||||
"/_api/login/list": {
|
||||
"filePath": "_api/login/list.tsx",
|
||||
@@ -738,6 +747,10 @@ export const routeTree = rootRoute
|
||||
"filePath": "_api/player/audio.tsx",
|
||||
"parent": "/_api"
|
||||
},
|
||||
"/_api/player/photos": {
|
||||
"filePath": "_api/player/photos.tsx",
|
||||
"parent": "/_api"
|
||||
},
|
||||
"/_api/playlist/$id": {
|
||||
"filePath": "_api/playlist/$id.jsx",
|
||||
"parent": "/_api"
|
||||
@@ -768,7 +781,7 @@ export const routeTree = rootRoute
|
||||
"parent": "/_api"
|
||||
},
|
||||
"/_api/search/": {
|
||||
"filePath": "_api/search/index.jsx",
|
||||
"filePath": "_api/search/index.tsx",
|
||||
"parent": "/_api/search"
|
||||
},
|
||||
"/_api/login/$userId/$userName": {
|
||||
|
||||
@@ -43,6 +43,7 @@ import "@fontsource-variable/jetbrains-mono";
|
||||
import "@fontsource-variable/noto-sans";
|
||||
|
||||
import "material-symbols/rounded.scss";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import type { Api, Jellyfin } from "@jellyfin/sdk";
|
||||
import type { UserDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||
@@ -50,13 +51,11 @@ import { DndProvider } from "react-dnd";
|
||||
import { HTML5Backend } from "react-dnd-html5-backend";
|
||||
|
||||
type ApiContext = {
|
||||
api: Api;
|
||||
createApi: (
|
||||
serverAddress: string | undefined,
|
||||
accessToken: string | undefined,
|
||||
) => void;
|
||||
api: Api | undefined;
|
||||
createApi: (serverAddress: string, accessToken: string | undefined) => void;
|
||||
user: UserDto | null | undefined;
|
||||
jellyfinSDK: Jellyfin;
|
||||
fetchCurrentUser: (api: Api | undefined) => Promise<void>;
|
||||
};
|
||||
|
||||
export const Route = createRootRouteWithContext<ApiContext>()({
|
||||
@@ -107,10 +106,10 @@ export const Route = createRootRouteWithContext<ApiContext>()({
|
||||
<NProgress
|
||||
key={
|
||||
isQueryFetching || isMutating || routeIsLoading
|
||||
? `show${(isQueryFetching ?? 1) * (isMutating ?? 1) * (routeIsLoading ?? 1)}`
|
||||
? `show${(isQueryFetching ?? 1) * (isMutating ?? 1) * (routeIsLoading ? 1 : 2)}`
|
||||
: "hide"
|
||||
}
|
||||
isAnimating={isQueryFetching || isMutating || routeIsLoading}
|
||||
isAnimating={isQueryFetching && isMutating && routeIsLoading}
|
||||
/>
|
||||
|
||||
{routeIsLoading && (
|
||||
@@ -263,7 +262,7 @@ export const Route = createRootRouteWithContext<ApiContext>()({
|
||||
<AppBar />
|
||||
<AudioPlayer />
|
||||
<Outlet />
|
||||
<ReactQueryDevtools />
|
||||
{/* <ReactQueryDevtools /> */}
|
||||
{/* <TanStackRouterDevtools /> */}
|
||||
</SnackbarProvider>
|
||||
</ThemeProvider>
|
||||
@@ -271,4 +270,5 @@ export const Route = createRootRouteWithContext<ApiContext>()({
|
||||
</DndProvider>
|
||||
);
|
||||
},
|
||||
errorComponent: ErrorNotice,
|
||||
});
|
||||
+42
-47
@@ -1,70 +1,65 @@
|
||||
import { getDefaultServer, getServer } from "@/utils/storage/servers";
|
||||
import { getUser } from "@/utils/storage/user";
|
||||
import { axiosClient } from "@/utils/store/api";
|
||||
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { Outlet, createFileRoute, redirect } from "@tanstack/react-router";
|
||||
import React from "react";
|
||||
import { createFileRoute, redirect } from "@tanstack/react-router";
|
||||
|
||||
export const Route = createFileRoute("/_api")({
|
||||
beforeLoad: async ({ context, location }) => {
|
||||
// console.log(context.api);
|
||||
console.log(context.user);
|
||||
if (!context.api) {
|
||||
const currentServerId = await getDefaultServer();
|
||||
if (currentServerId) {
|
||||
const currentServer = await getServer(currentServerId);
|
||||
const apiTemp = context.jellyfinSDK.createApi(
|
||||
currentServer?.address,
|
||||
null,
|
||||
axiosClient,
|
||||
);
|
||||
try {
|
||||
await getSystemApi(apiTemp).getPingSystem();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw redirect({
|
||||
to: "/error/$code",
|
||||
params: {
|
||||
code: "101",
|
||||
},
|
||||
});
|
||||
}
|
||||
const userOnDisk = await getUser();
|
||||
if (userOnDisk) {
|
||||
if (location.pathname !== "/login/manual") {
|
||||
const apiTemp = context.jellyfinSDK.createApi(
|
||||
currentServer?.address,
|
||||
userOnDisk.AccessToken,
|
||||
);
|
||||
try {
|
||||
await getUserApi(apiTemp).getCurrentUser();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw redirect({
|
||||
to: "/login/manual",
|
||||
search: {
|
||||
redirect: location.href,
|
||||
},
|
||||
});
|
||||
}
|
||||
// return { api: apiTemp };
|
||||
}
|
||||
context.createApi(currentServer?.address, userOnDisk.AccessToken);
|
||||
} else {
|
||||
if (currentServer?.address) {
|
||||
const apiTemp = context.jellyfinSDK.createApi(
|
||||
currentServer?.address,
|
||||
null,
|
||||
undefined,
|
||||
);
|
||||
context.createApi(currentServer?.address, undefined); // Creates Api
|
||||
// return { api: apiTemp };
|
||||
try {
|
||||
await getSystemApi(apiTemp).getPingSystem();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw redirect({
|
||||
to: "/error/$code",
|
||||
params: {
|
||||
code: "101",
|
||||
},
|
||||
});
|
||||
}
|
||||
const userOnDisk = await getUser();
|
||||
if (userOnDisk) {
|
||||
if (location.pathname !== "/login/manual") {
|
||||
const apiTemp = context.jellyfinSDK.createApi(
|
||||
currentServer?.address,
|
||||
userOnDisk.AccessToken,
|
||||
);
|
||||
try {
|
||||
await getUserApi(apiTemp).getCurrentUser();
|
||||
// return { user: user.data };
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw redirect({
|
||||
to: "/login/manual",
|
||||
search: {
|
||||
redirect: location.href,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
context.createApi(currentServer?.address, userOnDisk.AccessToken);
|
||||
} else {
|
||||
context.createApi(currentServer?.address, undefined); // Creates Api
|
||||
|
||||
// return { api: apiTemp };
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (context.api) {
|
||||
if (context.api.accessToken && location.pathname !== "/login/manual") {
|
||||
try {
|
||||
return {
|
||||
user: await getUserApi(context.api).getCurrentUser(),
|
||||
}; // Verify user is able to authenticate
|
||||
await getUserApi(context.api).getCurrentUser(); // Verify user is able to authenticate
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw redirect({
|
||||
|
||||
+225
-156
@@ -1,16 +1,9 @@
|
||||
import PropTypes from "prop-types";
|
||||
import React, { useLayoutEffect, useRef } from "react";
|
||||
import React, { useLayoutEffect, useMemo, useRef } from "react";
|
||||
|
||||
import heroBg from "@/assets/herobg.png";
|
||||
import Box from "@mui/material/Box";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
import useParallax from "@/utils/hooks/useParallax";
|
||||
import { motion, useScroll } from "framer-motion";
|
||||
|
||||
import {
|
||||
type BaseItemDto,
|
||||
BaseItemKind,
|
||||
@@ -18,27 +11,19 @@ import {
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import {
|
||||
getRuntime,
|
||||
getRuntimeCompact,
|
||||
getRuntimeMusic,
|
||||
} from "@/utils/date/time";
|
||||
import { getRuntimeCompact, getRuntimeMusic } from "@/utils/date/time";
|
||||
|
||||
import { Card } from "@/components/card/card";
|
||||
import { CardScroller } from "@/components/cardScroller/cardScroller";
|
||||
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import PlayButton from "@/components/buttons/playButton";
|
||||
import TrackList from "@/components/layouts/tracksList";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
|
||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||
import {
|
||||
@@ -50,39 +35,12 @@ import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import "./album.scss";
|
||||
|
||||
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 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")({
|
||||
component: MusicAlbumTitlePage,
|
||||
});
|
||||
@@ -91,26 +49,18 @@ function MusicAlbumTitlePage() {
|
||||
const { id } = Route.useParams();
|
||||
const api = Route.useRouteContext().api;
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
@@ -118,12 +68,14 @@ function MusicAlbumTitlePage() {
|
||||
const similarItems = useQuery({
|
||||
queryKey: ["item", id, "similarItem"],
|
||||
queryFn: async () => {
|
||||
const result = await getLibraryApi(api).getSimilarAlbums({
|
||||
userId: user.data?.Id,
|
||||
itemId: item.data?.Id,
|
||||
limit: 16,
|
||||
});
|
||||
return result.data;
|
||||
if (item.data?.Id) {
|
||||
const result = await getLibraryApi(api).getSimilarAlbums({
|
||||
userId: user?.Id,
|
||||
itemId: item.data?.Id,
|
||||
limit: 16,
|
||||
});
|
||||
return result.data;
|
||||
}
|
||||
},
|
||||
enabled: item.isSuccess,
|
||||
networkMode: "always",
|
||||
@@ -134,10 +86,11 @@ function MusicAlbumTitlePage() {
|
||||
queryKey: ["item", "musicTracks", id],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
parentId: item.data?.Id,
|
||||
sortOrder: [SortOrder.Ascending],
|
||||
sortBy: ["IndexNumber"],
|
||||
fields: ["MediaSources"],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
@@ -147,6 +100,21 @@ function MusicAlbumTitlePage() {
|
||||
|
||||
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
||||
|
||||
const allDiscs = useMemo(() => {
|
||||
const discs: number[] = [];
|
||||
if (musicTracks.data?.Items) {
|
||||
for (const track of musicTracks.data.Items) {
|
||||
if (
|
||||
track.ParentIndexNumber &&
|
||||
!discs.includes(track.ParentIndexNumber)
|
||||
) {
|
||||
discs.push(track.ParentIndexNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
return discs;
|
||||
}, [musicTracks.data]);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (item.isSuccess) {
|
||||
setAppBackdrop(
|
||||
@@ -157,24 +125,22 @@ function MusicAlbumTitlePage() {
|
||||
}, [item.isSuccess]);
|
||||
|
||||
const pageRef = useRef(null);
|
||||
const { scrollYProgress } = useScroll({
|
||||
target: pageRef,
|
||||
offset: ["start start", "60vh start"],
|
||||
});
|
||||
const parallax = useParallax(scrollYProgress, 50);
|
||||
|
||||
const handlePlayback = (
|
||||
index: number,
|
||||
item: BaseItemDto,
|
||||
queue: BaseItemDto[],
|
||||
) => {
|
||||
const url = generateAudioStreamUrl(
|
||||
item.Id,
|
||||
user.data?.Id,
|
||||
api.deviceInfo.id,
|
||||
api.basePath,
|
||||
);
|
||||
playAudio(url, item, undefined, queue, index);
|
||||
if (item.Id && user?.Id) {
|
||||
const url = generateAudioStreamUrl(
|
||||
item.Id,
|
||||
user?.Id,
|
||||
api.deviceInfo.id,
|
||||
api.basePath,
|
||||
api.accessToken,
|
||||
);
|
||||
playAudio(url, item, undefined);
|
||||
}
|
||||
};
|
||||
|
||||
const currentPlayingItem = useAudioPlayback((s) => s.item);
|
||||
@@ -222,85 +188,180 @@ function MusicAlbumTitlePage() {
|
||||
{item.data.ProductionYear}
|
||||
</Typography>
|
||||
<Typography className="opacity-07">
|
||||
{musicTracks.data?.TotalRecordCount > 1
|
||||
{(musicTracks.data?.TotalRecordCount ?? 0) > 1
|
||||
? `${musicTracks.data?.TotalRecordCount} songs`
|
||||
: `1 song`}
|
||||
: "1 song"}
|
||||
</Typography>
|
||||
<Typography className="opacity-07">
|
||||
{getRuntimeCompact(item.data.CumulativeRunTimeTicks)}
|
||||
{getRuntimeCompact(item.data.CumulativeRunTimeTicks ?? 0)}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="item-info-buttons">
|
||||
<PlayButton
|
||||
item={item}
|
||||
item={item.data}
|
||||
audio
|
||||
itemType={item.data.Type}
|
||||
userId={user.data?.Id}
|
||||
itemType={item.data.Type ?? "Audio"}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
<LikeButton
|
||||
itemId={item.data.Id}
|
||||
isFavorite={item.data.UserData?.IsFavorite}
|
||||
queryKey={["item", "musicTracks"]}
|
||||
userId={user.data?.Id}
|
||||
userId={user?.Id}
|
||||
itemName={item.data.Name}
|
||||
/>
|
||||
</div>
|
||||
<div className="item-info-track-container">
|
||||
<div className="item-info-track header">
|
||||
<span className="material-symbols-rounded index">tag</span>
|
||||
<Typography variant="subtitle1">Title</Typography>
|
||||
<Typography variant="subtitle1">Duration</Typography>
|
||||
</div>
|
||||
{musicTracks.data?.Items?.map((track, index) => (
|
||||
<div
|
||||
className={
|
||||
currentPlayingItem?.Id === track.Id
|
||||
? "item-info-track playing"
|
||||
: "item-info-track"
|
||||
}
|
||||
key={track.Id}
|
||||
onClick={() =>
|
||||
handlePlayback(index, track, musicTracks.data.Items)
|
||||
}
|
||||
>
|
||||
<div className="index-container">
|
||||
<span className="material-symbols-rounded fill ">
|
||||
play_arrow
|
||||
</span>
|
||||
<Typography className="index">
|
||||
{track.IndexNumber ?? "-"}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="item-info-track-info">
|
||||
<Typography className="item-info-track-info-name">
|
||||
{track.Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
opacity: 0.6,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: "0.6em",
|
||||
}}
|
||||
fontWeight={300}
|
||||
<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}
|
||||
>
|
||||
{track.HasLyrics && <img src={lyricsIcon} alt="lyrics" />}
|
||||
{track.Artists?.join(", ")}
|
||||
</Typography>
|
||||
<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">
|
||||
<span className="material-symbols-rounded index">tag</span>
|
||||
<Typography variant="subtitle1">Title</Typography>
|
||||
<Typography variant="subtitle1">Duration</Typography>
|
||||
</div>
|
||||
<Typography>{getRuntimeMusic(track.RunTimeTicks)}</Typography>
|
||||
<div className="flex flex-align-center">
|
||||
<LikeButton
|
||||
itemId={track.Id}
|
||||
isFavorite={track.UserData?.IsFavorite}
|
||||
queryKey={["item", "musicTracks"]}
|
||||
userId={user.data?.Id}
|
||||
itemName={track.Name}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
{musicTracks.data?.Items?.map((track, index) => (
|
||||
<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>
|
||||
</div>
|
||||
<div className="item-info-sidebar">
|
||||
@@ -309,10 +370,17 @@ function MusicAlbumTitlePage() {
|
||||
<img
|
||||
className="item-info-sidebar-image"
|
||||
alt={item.data.Name ?? "Album"}
|
||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
||||
tag: item.data.ImageTags.Primary,
|
||||
quality: 90,
|
||||
})}
|
||||
src={
|
||||
item.data.Id &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id,
|
||||
"Primary",
|
||||
{
|
||||
tag: item.data.ImageTags.Primary,
|
||||
quality: 90,
|
||||
},
|
||||
)
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<div className="item-info-sidebar-icon">
|
||||
@@ -325,14 +393,14 @@ function MusicAlbumTitlePage() {
|
||||
style={{ gap: "1em", flexWrap: "wrap" }}
|
||||
>
|
||||
{item.data.GenreItems?.map((genre) => (
|
||||
<TagChip label={genre.Name} key={genre.Id} />
|
||||
<TagChip label={genre.Name ?? "genre"} key={genre.Id} />
|
||||
))}
|
||||
</div>
|
||||
<div className="flex flex-column item-info-sidebar-artist-container">
|
||||
{item.data.ArtistItems?.map((artist) => (
|
||||
<Link
|
||||
to="/artist/$id"
|
||||
params={{ id: artist.Id }}
|
||||
params={{ id: artist.Id ?? "" }}
|
||||
className="item-info-sidebar-artist"
|
||||
key={artist.Id}
|
||||
>
|
||||
@@ -340,9 +408,16 @@ function MusicAlbumTitlePage() {
|
||||
<img
|
||||
className="item-info-sidebar-artist-image"
|
||||
alt={artist.Name ?? "Artist"}
|
||||
src={api.getItemImageUrl(artist.Id, "Primary", {
|
||||
quality: 90,
|
||||
})}
|
||||
src={
|
||||
artist.Id &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
artist.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 90,
|
||||
},
|
||||
)
|
||||
}
|
||||
/>
|
||||
<span className="material-symbols-rounded">artist</span>
|
||||
</div>
|
||||
@@ -352,13 +427,13 @@ function MusicAlbumTitlePage() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{similarItems.data.TotalRecordCount > 0 && (
|
||||
{(similarItems.data?.TotalRecordCount ?? -1) > 0 && (
|
||||
<CardScroller
|
||||
title="You might also like"
|
||||
displayCards={7}
|
||||
disableDecoration
|
||||
>
|
||||
{similarItems.data.Items.map((similar) => {
|
||||
{similarItems.data?.Items?.map((similar) => {
|
||||
return (
|
||||
<Card
|
||||
key={similar.Id}
|
||||
@@ -390,13 +465,7 @@ function MusicAlbumTitlePage() {
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!similar.ImageBlurHashes?.Primary &&
|
||||
similar.ImageBlurHashes?.Primary[
|
||||
Object.keys(similar.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -3,12 +3,12 @@ $border-radius: 20px;
|
||||
.item-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
&-container {
|
||||
gap: 1.2em;
|
||||
&-container {
|
||||
grid-template-columns: 1fr 25%;
|
||||
display: grid;
|
||||
gap: 3em;
|
||||
}
|
||||
gap: 1.2em;
|
||||
&-sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -133,6 +133,13 @@ $border-radius: 20px;
|
||||
display: flex;
|
||||
gap: 1em;
|
||||
}
|
||||
&-disc-header{
|
||||
padding: 1em 2em;
|
||||
background: hsla(0, 0, 100%, 10%);
|
||||
border-radius: 100px;
|
||||
gap: 1em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
}
|
||||
}
|
||||
.item-detail-album {
|
||||
|
||||
@@ -36,6 +36,8 @@ import "./artist.scss";
|
||||
|
||||
import IconLink from "@/components/iconLink";
|
||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
|
||||
function TabPanel(props) {
|
||||
@@ -69,26 +71,19 @@ function ArtistTitlePage() {
|
||||
const { id } = Route.useParams();
|
||||
const api = Route.useRouteContext().api;
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
fields: [ItemFields.Crew],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
@@ -102,7 +97,7 @@ function ArtistTitlePage() {
|
||||
sortOrder: [SortOrder.Descending],
|
||||
recursive: true,
|
||||
includeItemTypes: [BaseItemKind.MusicAlbum],
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
fields: [ItemFields.Overview],
|
||||
});
|
||||
return result.data;
|
||||
@@ -119,7 +114,7 @@ function ArtistTitlePage() {
|
||||
sortOrder: [SortOrder.Ascending],
|
||||
recursive: true,
|
||||
includeItemTypes: [BaseItemKind.Audio],
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
fields: [ItemFields.Overview],
|
||||
});
|
||||
return result.data;
|
||||
@@ -137,7 +132,7 @@ function ArtistTitlePage() {
|
||||
sortOrder: [SortOrder.Descending],
|
||||
recursive: true,
|
||||
includeItemTypes: [BaseItemKind.MusicAlbum],
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
@@ -225,9 +220,13 @@ function ArtistTitlePage() {
|
||||
<div className="item-hero-backdrop-container">
|
||||
<motion.img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
|
||||
tag: item.data.BackdropImageTags[0],
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id,
|
||||
"Backdrop",
|
||||
{
|
||||
tag: item.data.BackdropImageTags[0],
|
||||
},
|
||||
)}
|
||||
className="item-hero-backdrop"
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
@@ -255,10 +254,14 @@ function ArtistTitlePage() {
|
||||
/>
|
||||
<img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
},
|
||||
)}
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
}}
|
||||
@@ -275,11 +278,15 @@ function ArtistTitlePage() {
|
||||
{Object.keys(item.data.ImageTags).includes("Logo") ? (
|
||||
<img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Logo", {
|
||||
quality: 90,
|
||||
fillWidth: 592,
|
||||
fillHeight: 592,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id,
|
||||
"Logo",
|
||||
{
|
||||
quality: 90,
|
||||
fillWidth: 592,
|
||||
fillHeight: 592,
|
||||
},
|
||||
)}
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
}}
|
||||
@@ -295,8 +302,8 @@ function ArtistTitlePage() {
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isFavorite={item.data.UserData.IsFavorite}
|
||||
userId={user.data.Id}
|
||||
isFavorite={item.data.UserData?.IsFavorite}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -314,7 +321,7 @@ function ArtistTitlePage() {
|
||||
marginTop: "1em",
|
||||
}}
|
||||
>
|
||||
{item.data.ExternalUrls.map((url) => (
|
||||
{item.data.ExternalUrls?.map((url) => (
|
||||
<IconLink url={url.Url} name={url.Name} />
|
||||
))}
|
||||
</div>
|
||||
@@ -358,7 +365,7 @@ function ArtistTitlePage() {
|
||||
setActiveArtistTab(newVal);
|
||||
}}
|
||||
>
|
||||
{artistTabs.map((tab, index) => {
|
||||
{artistTabs.map((tab) => {
|
||||
return (
|
||||
<Tab
|
||||
key={tab.title}
|
||||
@@ -391,11 +398,11 @@ function ArtistTitlePage() {
|
||||
}}
|
||||
>
|
||||
{artistDiscography.isSuccess &&
|
||||
artistDiscography.data.Items.map((tabitem) => {
|
||||
artistDiscography.data.Items?.map((tabitem) => {
|
||||
return (
|
||||
<ArtistAlbum
|
||||
key={tabitem.Id}
|
||||
user={user.data}
|
||||
user={user}
|
||||
album={tabitem}
|
||||
/>
|
||||
);
|
||||
@@ -422,13 +429,13 @@ function ArtistTitlePage() {
|
||||
}}
|
||||
>
|
||||
{artistSongs.isSuccess &&
|
||||
artistSongs.data.Items.map((tabitem) => {
|
||||
artistSongs.data.Items?.map((tabitem) => {
|
||||
return (
|
||||
<MusicTrack
|
||||
item={tabitem}
|
||||
key={tabitem.Id}
|
||||
queryKey={["item", id, "artist", "songs"]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
@@ -455,7 +462,7 @@ function ArtistTitlePage() {
|
||||
className="grid"
|
||||
>
|
||||
{artistAppearances.isSuccess &&
|
||||
artistAppearances.data.Items.map((tabitem) => {
|
||||
artistAppearances.data.Items?.map((tabitem) => {
|
||||
return (
|
||||
<Card
|
||||
key={tabitem.Id}
|
||||
@@ -465,13 +472,7 @@ function ArtistTitlePage() {
|
||||
cardCaption={tabitem.AlbumArtist}
|
||||
cardType={"square"}
|
||||
queryKey={["item", id, "artist", "appearences"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!tabitem.ImageBlurHashes?.Primary &&
|
||||
tabitem.ImageBlurHashes?.Primary[
|
||||
Object.keys(tabitem.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -39,6 +39,8 @@ import "./boxset.scss";
|
||||
|
||||
import IconLink from "@/components/iconLink";
|
||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
|
||||
function TabPanel(props) {
|
||||
@@ -72,27 +74,18 @@ function BoxSetTitlePage() {
|
||||
const { id } = Route.useParams();
|
||||
const api = Route.useRouteContext().api;
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
fields: [ItemFields.Crew],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
@@ -101,7 +94,7 @@ function BoxSetTitlePage() {
|
||||
queryKey: ["item", id, "collection"],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
parentId: item.data.Id,
|
||||
fields: [ItemFields.SeasonUserData, ItemFields.Overview],
|
||||
excludeLocationTypes: [LocationType.Virtual],
|
||||
@@ -117,8 +110,8 @@ function BoxSetTitlePage() {
|
||||
queryKey: ["item", id, "similarItem"],
|
||||
queryFn: async () => {
|
||||
const result = await getLibraryApi(api).getSimilarItems({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: item.data?.Id,
|
||||
limit: 16,
|
||||
});
|
||||
return result.data;
|
||||
@@ -187,9 +180,13 @@ function BoxSetTitlePage() {
|
||||
{item.data.BackdropImageTags?.length ? (
|
||||
<motion.img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
|
||||
tag: item.data.BackdropImageTags[0],
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id,
|
||||
"Backdrop",
|
||||
{
|
||||
tag: item.data.BackdropImageTags[0],
|
||||
},
|
||||
)}
|
||||
className="item-hero-backdrop"
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
@@ -230,10 +227,14 @@ function BoxSetTitlePage() {
|
||||
/>
|
||||
<img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
},
|
||||
)}
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
}}
|
||||
@@ -250,11 +251,15 @@ function BoxSetTitlePage() {
|
||||
{Object.keys(item.data.ImageTags).includes("Logo") ? (
|
||||
<img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Logo", {
|
||||
quality: 90,
|
||||
fillWidth: 592,
|
||||
fillHeight: 592,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id,
|
||||
"Logo",
|
||||
{
|
||||
quality: 90,
|
||||
fillWidth: 592,
|
||||
fillHeight: 592,
|
||||
},
|
||||
)}
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
}}
|
||||
@@ -370,7 +375,7 @@ function BoxSetTitlePage() {
|
||||
currentVideoTrack={0}
|
||||
currentAudioTrack={0}
|
||||
currentSubTrack={0}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
buttonProps={{
|
||||
fullWidth: true,
|
||||
}}
|
||||
@@ -382,14 +387,14 @@ function BoxSetTitlePage() {
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isFavorite={item.data.UserData.IsFavorite}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
<MarkPlayedButton
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isPlayed={item.data.UserData.Played}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -437,7 +442,7 @@ function BoxSetTitlePage() {
|
||||
cardCaption={similar.ProductionYear}
|
||||
cardType={"portrait"}
|
||||
queryKey={["item", id, "collection"]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!similar.ImageBlurHashes?.Primary &&
|
||||
similar.ImageBlurHashes?.Primary[
|
||||
@@ -487,7 +492,7 @@ function BoxSetTitlePage() {
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!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 IconLink from "@/components/iconLink";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { Link, createFileRoute } from "@tanstack/react-router";
|
||||
|
||||
function TabPanel(props) {
|
||||
@@ -97,27 +99,19 @@ function EpisodeTitlePage() {
|
||||
const { id } = Route.useParams();
|
||||
const api = Route.useRouteContext().api;
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
fields: [ItemFields.Crew],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
@@ -126,9 +120,9 @@ function EpisodeTitlePage() {
|
||||
queryKey: ["item", id, "episode", "upcomingEpisodes"],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
parentId: item.data.ParentId,
|
||||
startIndex: item.data.IndexNumber,
|
||||
userId: user?.Id,
|
||||
parentId: item.data?.ParentId ?? "",
|
||||
startIndex: item.data?.IndexNumber ?? 0,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
@@ -357,7 +351,7 @@ function EpisodeTitlePage() {
|
||||
{item.data.ParentBackdropImageTags?.length ? (
|
||||
<motion.img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.ParentBackdropItemId,
|
||||
"Backdrop",
|
||||
{
|
||||
@@ -404,10 +398,14 @@ function EpisodeTitlePage() {
|
||||
/>
|
||||
<img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
},
|
||||
)}
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
}}
|
||||
@@ -435,11 +433,15 @@ function EpisodeTitlePage() {
|
||||
{item.data.ParentLogoItemId?.length > 0 ? (
|
||||
<img
|
||||
alt={item.data.SeriesName}
|
||||
src={api.getItemImageUrl(item.data.ParentLogoItemId, "Logo", {
|
||||
quality: 90,
|
||||
fillWidth: 592,
|
||||
fillHeight: 592,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.ParentLogoItemId,
|
||||
"Logo",
|
||||
{
|
||||
quality: 90,
|
||||
fillWidth: 592,
|
||||
fillHeight: 592,
|
||||
},
|
||||
)}
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
}}
|
||||
@@ -688,7 +690,7 @@ function EpisodeTitlePage() {
|
||||
currentVideoTrack={selectedVideoTrack}
|
||||
currentAudioTrack={selectedAudioTrack}
|
||||
currentSubTrack={selectedSubtitleTrack}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-row" style={{ gap: "1em" }}>
|
||||
@@ -701,14 +703,14 @@ function EpisodeTitlePage() {
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isFavorite={item.data.UserData.IsFavorite}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
<MarkPlayedButton
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isPlayed={item.data.UserData.Played}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -812,7 +814,7 @@ function EpisodeTitlePage() {
|
||||
cardCaption={`S${episode.ParentIndexNumber}:E${episode.IndexNumber} - ${episode.Name}`}
|
||||
cardType="thumb"
|
||||
queryKey={["item", id, "episode", "upcomingEpisodes"]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!episode.ImageBlurHashes?.Primary &&
|
||||
episode.ImageBlurHashes?.Primary[
|
||||
@@ -845,11 +847,15 @@ function EpisodeTitlePage() {
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
@@ -891,11 +897,15 @@ function EpisodeTitlePage() {
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
@@ -937,11 +947,15 @@ function EpisodeTitlePage() {
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
@@ -983,11 +997,15 @@ function EpisodeTitlePage() {
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)}
|
||||
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 { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
|
||||
export const Route = createFileRoute("/_api/favorite/")({
|
||||
component: FavoritePage,
|
||||
@@ -21,21 +22,13 @@ function FavoritePage() {
|
||||
const api = Route.useRouteContext().api;
|
||||
const [setBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const movies = useQuery({
|
||||
queryKey: ["favorite", "movies"],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.Movie],
|
||||
recursive: true,
|
||||
@@ -48,7 +41,7 @@ function FavoritePage() {
|
||||
queryKey: ["favorite", "series"],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.Series],
|
||||
recursive: true,
|
||||
@@ -61,7 +54,7 @@ function FavoritePage() {
|
||||
queryKey: ["favorite", "musicAlbum"],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.MusicAlbum],
|
||||
recursive: true,
|
||||
@@ -74,7 +67,7 @@ function FavoritePage() {
|
||||
queryKey: ["favorite", "audio"],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.Audio],
|
||||
recursive: true,
|
||||
@@ -87,7 +80,7 @@ function FavoritePage() {
|
||||
queryKey: ["favorite", "book"],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.Book],
|
||||
recursive: true,
|
||||
@@ -100,7 +93,7 @@ function FavoritePage() {
|
||||
queryKey: ["favorite", "musicArtist"],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.MusicArtist],
|
||||
recursive: true,
|
||||
@@ -113,7 +106,7 @@ function FavoritePage() {
|
||||
queryKey: ["favorite", "person"],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
isFavorite: true,
|
||||
includeItemTypes: [BaseItemKind.Person],
|
||||
recursive: true,
|
||||
@@ -148,7 +141,7 @@ function FavoritePage() {
|
||||
cardCaption={item.ProductionYear}
|
||||
cardType="portrait"
|
||||
queryKey={["favorite", "movies"]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
@@ -176,7 +169,7 @@ function FavoritePage() {
|
||||
}`}
|
||||
cardType="portrait"
|
||||
queryKey={["favorite", "series"]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
@@ -198,7 +191,7 @@ function FavoritePage() {
|
||||
cardCaption={item.ProductionYear}
|
||||
cardType="square"
|
||||
queryKey={["favorite", "audio"]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
@@ -221,7 +214,7 @@ function FavoritePage() {
|
||||
cardCaption={item.AlbumArtist}
|
||||
cardType={"square"}
|
||||
queryKey={["favorite", "musicAlbum"]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
@@ -244,7 +237,7 @@ function FavoritePage() {
|
||||
disableOverlay
|
||||
cardType={"portrait"}
|
||||
queryKey={["favorite", "book"]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
@@ -266,7 +259,7 @@ function FavoritePage() {
|
||||
disableOverlay
|
||||
cardType={"square"}
|
||||
queryKey={["favorite", "musicArtist"]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
@@ -288,7 +281,7 @@ function FavoritePage() {
|
||||
disableOverlay
|
||||
cardType={"square"}
|
||||
queryKey={["favorite", "person"]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!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 { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
|
||||
import { Outlet, createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
|
||||
import { setBackdrop } from "@/utils/store/backdrop";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
|
||||
import CarouselSlide from "@/components/carouselSlide";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import {
|
||||
type BaseItemDto,
|
||||
BaseItemKind,
|
||||
@@ -36,33 +36,21 @@ import { ErrorBoundary } from "react-error-boundary";
|
||||
|
||||
export const Route = createFileRoute("/_api/home/")({
|
||||
component: Home,
|
||||
onError: (err) => {
|
||||
console.log(err);
|
||||
},
|
||||
});
|
||||
|
||||
function Home() {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
console.log(usr.data);
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const libraries = useQuery({
|
||||
queryKey: ["libraries"],
|
||||
queryFn: async () => {
|
||||
const libs = await getUserViewsApi(api).getUserViews({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
});
|
||||
return libs.data;
|
||||
},
|
||||
enabled: !!user.data && !!api.accessToken,
|
||||
enabled: !!user?.Id && !!api.accessToken,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
@@ -70,7 +58,7 @@ function Home() {
|
||||
queryKey: ["home", "latestMedia"],
|
||||
queryFn: async () => {
|
||||
const media = await getUserLibraryApi(api).getLatestMedia({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
fields: [
|
||||
ItemFields.Overview,
|
||||
ItemFields.ParentId,
|
||||
@@ -79,19 +67,24 @@ function Home() {
|
||||
ItemFields.MediaStreams,
|
||||
ItemFields.MediaSources,
|
||||
],
|
||||
includeItemTypes: [
|
||||
BaseItemKind.Movie,
|
||||
BaseItemKind.Series,
|
||||
BaseItemKind.MusicAlbum,
|
||||
],
|
||||
enableUserData: true,
|
||||
enableImages: true,
|
||||
});
|
||||
return media.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
|
||||
const resumeItemsVideo = useQuery({
|
||||
queryKey: ["home", "resume", "video"],
|
||||
queryFn: async () => {
|
||||
const resumeItems = await getItemsApi(api).getResumeItems({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
limit: 10,
|
||||
mediaTypes: ["Video"],
|
||||
enableUserData: true,
|
||||
@@ -99,7 +92,7 @@ function Home() {
|
||||
});
|
||||
return resumeItems.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
refetchOnMount: true,
|
||||
});
|
||||
|
||||
@@ -107,7 +100,7 @@ function Home() {
|
||||
queryKey: ["home", "resume", "audio"],
|
||||
queryFn: async () => {
|
||||
const resumeItems = await getItemsApi(api).getResumeItems({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
limit: 10,
|
||||
mediaTypes: ["Audio"],
|
||||
enableUserData: true,
|
||||
@@ -115,14 +108,14 @@ function Home() {
|
||||
});
|
||||
return resumeItems.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
|
||||
const upNextItems = useQuery({
|
||||
queryKey: ["home", "upNext"],
|
||||
queryFn: async () => {
|
||||
const upNext = await getTvShowsApi(api).getNextUp({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
fields: [
|
||||
ItemFields.PrimaryImageAspectRatio,
|
||||
ItemFields.MediaStreams,
|
||||
@@ -133,7 +126,7 @@ function Home() {
|
||||
});
|
||||
return upNext.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
refetchOnMount: true,
|
||||
});
|
||||
|
||||
@@ -143,6 +136,8 @@ function Home() {
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||
|
||||
const [excludeTypes] = useState(
|
||||
() => new Set(["boxsets", "playlists", "livetv", "channels"]),
|
||||
);
|
||||
@@ -151,7 +146,7 @@ function Home() {
|
||||
if (libraries.isSuccess) {
|
||||
const latestMediaLibsTemp = libraries.data.Items?.reduce(
|
||||
(filteredItems: BaseItemDto[], currentItem) => {
|
||||
if (!excludeTypes.has(currentItem.Type)) {
|
||||
if (currentItem.Type && !excludeTypes.has(currentItem.Type)) {
|
||||
filteredItems.push(currentItem);
|
||||
}
|
||||
return filteredItems;
|
||||
@@ -182,7 +177,7 @@ function Home() {
|
||||
if (latestMedia.isSuccess && latestMedia.data.length > 0) {
|
||||
if (latestMedia.data[now]?.ParentBackdropImageTags) {
|
||||
setBackdrop(
|
||||
api.getItemImageUrl(
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
latestMedia.data[now].Id,
|
||||
"Backdrop",
|
||||
{
|
||||
@@ -195,7 +190,7 @@ function Home() {
|
||||
);
|
||||
} else {
|
||||
setBackdrop(
|
||||
api.getItemImageUrl(
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
latestMedia.data[now].Id,
|
||||
"Backdrop",
|
||||
{
|
||||
@@ -234,12 +229,14 @@ function Home() {
|
||||
imageType="Primary"
|
||||
cardType="thumb"
|
||||
disableOverlay
|
||||
onClick={() =>
|
||||
navigate({
|
||||
to: "/library/$id",
|
||||
params: { id: item.Id ?? "" },
|
||||
})
|
||||
}
|
||||
onClick={() => {
|
||||
if (item.Id) {
|
||||
navigate({
|
||||
to: "/library/$id",
|
||||
params: { id: item.Id },
|
||||
});
|
||||
}
|
||||
}}
|
||||
overrideIcon={item.CollectionType}
|
||||
/>
|
||||
);
|
||||
@@ -296,7 +293,7 @@ function Home() {
|
||||
}
|
||||
cardType="thumb"
|
||||
queryKey={["home", "upNext"]}
|
||||
userId={user.data?.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
@@ -349,7 +346,7 @@ function Home() {
|
||||
}
|
||||
cardType="thumb"
|
||||
queryKey={["home", "resume", "video"]}
|
||||
userId={user.data?.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
@@ -380,7 +377,7 @@ function Home() {
|
||||
cardCaption={item.ProductionYear}
|
||||
cardType="thumb"
|
||||
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 { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||
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";
|
||||
|
||||
@@ -68,6 +68,8 @@ import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
|
||||
|
||||
import IconLink from "@/components/iconLink";
|
||||
import { queryClient } from "@/main";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { Link, createFileRoute } from "@tanstack/react-router";
|
||||
|
||||
function TabPanel(props) {
|
||||
@@ -102,26 +104,18 @@ function ItemDetail() {
|
||||
|
||||
const api = Route.useRouteContext().api;
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
@@ -134,28 +128,28 @@ function ItemDetail() {
|
||||
let result;
|
||||
if (item.data.Type === "Movie") {
|
||||
result = await getLibraryApi(api).getSimilarMovies({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: item.data.Id,
|
||||
limit: 16,
|
||||
});
|
||||
} else if (item.data.Type === "Series") {
|
||||
result = await getLibraryApi(api).getSimilarShows({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: item.data.Id,
|
||||
});
|
||||
} else if (item.data.Type === "MusicAlbum") {
|
||||
result = await getLibraryApi(api).getSimilarAlbums({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: item.data.Id,
|
||||
});
|
||||
} else if (item.data.Type === "MusicArtist") {
|
||||
result = await getLibraryApi(api).getSimilarArtists({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: item.data.Id,
|
||||
});
|
||||
} else {
|
||||
result = await getLibraryApi(api).getSimilarItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: item.data.Id,
|
||||
});
|
||||
}
|
||||
@@ -193,8 +187,6 @@ function ItemDetail() {
|
||||
const [selectedAudioTrack, setSelectedAudioTrack] = useState(null);
|
||||
const [selectedSubtitleTrack, setSelectedSubtitleTrack] = useState(null);
|
||||
|
||||
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
||||
|
||||
const [directors, setDirectors] = useState([]);
|
||||
const [writers, setWriters] = useState([]);
|
||||
const [actors, setActors] = useState([]);
|
||||
@@ -202,11 +194,13 @@ function ItemDetail() {
|
||||
|
||||
const [mediaQualityInfo, setMediaQualityInfo] = useState<MediaQualityInfo>();
|
||||
|
||||
const setBackdrop = useBackdropStore((state) => state.setBackdrop);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (item.isSuccess) {
|
||||
if (item.data.BackdropImageTags?.length > 0) {
|
||||
setBackdrop(
|
||||
api?.getItemImageUrl(item.data.Id, "Backdrop", {
|
||||
getImageUrlsApi(api).getItemImageUrlById(item.data.Id, "Backdrop", {
|
||||
tag: item.data.BackdropImageTags[0],
|
||||
}),
|
||||
item.data.BackdropImageTags[0],
|
||||
@@ -381,9 +375,13 @@ function ItemDetail() {
|
||||
{item.data.BackdropImageTags?.length ? (
|
||||
<motion.img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
|
||||
tag: item.data.BackdropImageTags[0],
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id,
|
||||
"Backdrop",
|
||||
{
|
||||
tag: item.data.BackdropImageTags[0],
|
||||
},
|
||||
)}
|
||||
className="item-hero-backdrop"
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
@@ -424,10 +422,14 @@ function ItemDetail() {
|
||||
/>
|
||||
<img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
},
|
||||
)}
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
}}
|
||||
@@ -444,12 +446,16 @@ function ItemDetail() {
|
||||
{item.data.ImageTags?.Logo ? (
|
||||
<img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Logo", {
|
||||
quality: 90,
|
||||
fillWidth: 592,
|
||||
fillHeight: 592,
|
||||
tag: item.data.ImageTags.Logo,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id,
|
||||
"Logo",
|
||||
{
|
||||
quality: 90,
|
||||
fillWidth: 592,
|
||||
fillHeight: 592,
|
||||
tag: item.data.ImageTags.Logo,
|
||||
},
|
||||
)}
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
}}
|
||||
@@ -694,7 +700,7 @@ function ItemDetail() {
|
||||
currentVideoTrack={selectedVideoTrack}
|
||||
currentAudioTrack={selectedAudioTrack}
|
||||
currentSubTrack={selectedSubtitleTrack}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
buttonProps={{
|
||||
fullWidth: true,
|
||||
}}
|
||||
@@ -710,14 +716,14 @@ function ItemDetail() {
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isFavorite={item.data.UserData.IsFavorite}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
<MarkPlayedButton
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isPlayed={item.data.UserData.Played}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -838,11 +844,15 @@ function ItemDetail() {
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
@@ -881,11 +891,15 @@ function ItemDetail() {
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
@@ -927,11 +941,15 @@ function ItemDetail() {
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
@@ -973,11 +991,15 @@ function ItemDetail() {
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
@@ -1043,7 +1065,7 @@ function ItemDetail() {
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!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,
|
||||
};
|
||||
},
|
||||
});
|
||||
+285
-208
@@ -1,49 +1,38 @@
|
||||
import React, {
|
||||
useState,
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
type ChangeEvent,
|
||||
useMemo,
|
||||
useCallback,
|
||||
type MouseEvent,
|
||||
} 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 Checkbox from "@mui/material/Checkbox";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||
import Grow from "@mui/material/Grow";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import Popper from "@mui/material/Popper";
|
||||
import TextField from "@mui/material/TextField";
|
||||
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 { getGenresApi } from "@jellyfin/sdk/lib/utils/api/genres-api";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getMusicGenresApi } from "@jellyfin/sdk/lib/utils/api/music-genres-api";
|
||||
import { getPersonsApi } from "@jellyfin/sdk/lib/utils/api/persons-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 MusicTrack from "@/components/musicTrack";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import { setBackdrop } from "@/utils/store/backdrop";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import {
|
||||
type BaseItemDto,
|
||||
type BaseItemDtoQueryResult,
|
||||
BaseItemKind,
|
||||
CollectionType,
|
||||
@@ -57,7 +46,7 @@ import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api"
|
||||
import {
|
||||
FormControl,
|
||||
Menu,
|
||||
MenuList,
|
||||
Select,
|
||||
Stack,
|
||||
useScrollTrigger,
|
||||
} from "@mui/material";
|
||||
@@ -65,12 +54,14 @@ import { useWindowVirtualizer } from "@tanstack/react-virtual";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import "./library.scss";
|
||||
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 ViewObject = { title: string; value: BaseItemKind | "Artist" };
|
||||
// type allowedFilters = ["movies", "tvshows", "music", "books"];
|
||||
type allowedFilters = Partial<CollectionType>[];
|
||||
|
||||
const useWindowWidth = () => {
|
||||
const [width, setWidth] = React.useState(window.innerWidth);
|
||||
@@ -96,30 +87,22 @@ export const Route = createFileRoute("/_api/library/$id")({
|
||||
});
|
||||
|
||||
function LibraryView() {
|
||||
const api = Route.useRouteContext().api;
|
||||
const navigate = useNavigate();
|
||||
const api = useApiInContext((s) => s.api);
|
||||
|
||||
const { id } = Route.useParams();
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const currentLib = useQuery({
|
||||
queryKey: ["libraryView", "currentLib", id],
|
||||
queryFn: async () => {
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
networkMode: "always",
|
||||
staleTime: 0,
|
||||
});
|
||||
@@ -217,16 +200,24 @@ function LibraryView() {
|
||||
});
|
||||
|
||||
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(() => {
|
||||
// I don't know why this works, don't ask...
|
||||
const cachedVal = sessionStorage.getItem(
|
||||
`library-${currentLib.data?.Id}-config_sort`,
|
||||
) as unknown as {
|
||||
sortAscending: boolean;
|
||||
sortBy: ItemSortBy;
|
||||
sortAscending?: boolean;
|
||||
sortBy?: ItemSortBy;
|
||||
};
|
||||
if (cachedVal) {
|
||||
if (cachedVal?.sortAscending) {
|
||||
console.log(cachedVal.sortAscending);
|
||||
setSortAscending(cachedVal.sortAscending);
|
||||
}
|
||||
}, [currentLib.data?.Id]);
|
||||
@@ -440,7 +431,11 @@ function LibraryView() {
|
||||
break;
|
||||
}
|
||||
// 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 {
|
||||
// sortAscending: boolean;
|
||||
// sortBy: ItemSortBy;
|
||||
@@ -453,25 +448,41 @@ function LibraryView() {
|
||||
return result;
|
||||
}, [currentLib.data?.CollectionType, currentViewType]);
|
||||
|
||||
const [filters, setFilters] = useState<Record<string, undefined | boolean>>({
|
||||
isPlayed: false,
|
||||
isUnPlayed: false,
|
||||
isResumable: false,
|
||||
isFavorite: false,
|
||||
isLiked: false,
|
||||
isUnliked: false,
|
||||
hasSubtitles: false,
|
||||
hasTrailer: false,
|
||||
hasSpecialFeature: false,
|
||||
hasThemeSong: false,
|
||||
hasThemeVideo: false,
|
||||
isBluRay: false,
|
||||
isDVD: false,
|
||||
isHD: undefined,
|
||||
isSD: false,
|
||||
is4K: false,
|
||||
is3D: false,
|
||||
});
|
||||
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,
|
||||
isUnPlayed: false,
|
||||
isResumable: false,
|
||||
isFavorite: false,
|
||||
isLiked: false,
|
||||
isUnliked: false,
|
||||
hasSubtitles: false,
|
||||
hasTrailer: false,
|
||||
hasSpecialFeature: false,
|
||||
hasThemeSong: false,
|
||||
hasThemeVideo: false,
|
||||
isBluRay: false,
|
||||
isDVD: false,
|
||||
isHD: undefined,
|
||||
isSD: false,
|
||||
is4K: false,
|
||||
is3D: false,
|
||||
};
|
||||
},
|
||||
);
|
||||
useEffect(() => {
|
||||
sessionStorage.setItem(
|
||||
`library-${currentLib.data?.Id}-config_fliters`,
|
||||
JSON.stringify(filters),
|
||||
);
|
||||
}, [filters, currentLib.data?.Id]);
|
||||
|
||||
const items = useQuery({
|
||||
queryKey: [
|
||||
@@ -490,32 +501,32 @@ function LibraryView() {
|
||||
let result: AxiosResponse<BaseItemDtoQueryResult, any>;
|
||||
if (currentViewType === "MusicArtist") {
|
||||
result = await getArtistsApi(api).getAlbumArtists({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
parentId: id,
|
||||
});
|
||||
} else if (currentViewType === "Artist") {
|
||||
result = await getArtistsApi(api).getArtists({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
parentId: id,
|
||||
});
|
||||
} else if (currentViewType === "Person") {
|
||||
result = await getPersonsApi(api).getPersons({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
personTypes: ["Actor"],
|
||||
});
|
||||
} else if (currentViewType === "Genre") {
|
||||
result = await getGenresApi(api).getGenres({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
parentId: id,
|
||||
});
|
||||
} else if (currentViewType === "MusicGenre") {
|
||||
result = await getMusicGenresApi(api).getMusicGenres({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
parentId: id,
|
||||
});
|
||||
} else if (currentViewType === "Studio") {
|
||||
result = await getStudiosApi(api).getStudios({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
parentId: id,
|
||||
});
|
||||
} else if (currentViewType === "BoxSet") {
|
||||
@@ -532,7 +543,7 @@ function LibraryView() {
|
||||
if (filters.isFavorite) filtersArray.push(ItemFilter.IsFavorite);
|
||||
|
||||
result = await getItemsApi(api).getItems({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
parentId: currentLib.data?.Id,
|
||||
recursive:
|
||||
currentLib.data?.CollectionType === "boxsets" ? undefined : true,
|
||||
@@ -567,7 +578,7 @@ function LibraryView() {
|
||||
if (filters.isFavorite) filtersArray.push(ItemFilter.IsFavorite);
|
||||
|
||||
result = await getItemsApi(api).getItems({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
parentId: currentLib.data?.Id,
|
||||
recursive:
|
||||
currentLib.data?.CollectionType === "boxsets" ? undefined : true,
|
||||
@@ -592,7 +603,7 @@ function LibraryView() {
|
||||
return result.data;
|
||||
},
|
||||
// enabled: false,
|
||||
enabled: user.isSuccess && Boolean(currentViewType) && currentLib.isSuccess,
|
||||
enabled: !!user?.Id && Boolean(currentViewType) && currentLib.isSuccess,
|
||||
networkMode: "always",
|
||||
// gcTime: 0,
|
||||
});
|
||||
@@ -679,17 +690,21 @@ function LibraryView() {
|
||||
threshold: 20,
|
||||
});
|
||||
|
||||
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||
|
||||
const backdropItems = useMemo(() => {
|
||||
if (items.isSuccess) {
|
||||
const temp = items.data.Items?.filter(
|
||||
(item) => item.BackdropImageTags?.length,
|
||||
);
|
||||
setBackdrop(
|
||||
api.getItemImageUrl(temp?.[0]?.Id, "Backdrop", {
|
||||
tag: temp?.[0]?.BackdropImageTags?.[0],
|
||||
}),
|
||||
temp?.[0]?.BackdropImageTags?.[0] ?? "none",
|
||||
);
|
||||
if (temp?.[0]?.Id) {
|
||||
setBackdrop(
|
||||
getImageUrlsApi(api).getItemImageUrlById(temp?.[0]?.Id, "Backdrop", {
|
||||
tag: temp?.[0]?.BackdropImageTags?.[0],
|
||||
}),
|
||||
temp?.[0]?.BackdropImageTags?.[0] ?? "none",
|
||||
);
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
}, [items]);
|
||||
@@ -701,9 +716,13 @@ function LibraryView() {
|
||||
const backdropItem = backdropItems[itemIndex];
|
||||
// enqueueSnackbar("Running");
|
||||
setBackdrop(
|
||||
api?.getItemImageUrl(backdropItem.Id ?? "", "Backdrop", {
|
||||
tag: backdropItem.BackdropImageTags?.[0],
|
||||
}),
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
backdropItem.Id ?? "",
|
||||
"Backdrop",
|
||||
{
|
||||
tag: backdropItem.BackdropImageTags?.[0],
|
||||
},
|
||||
),
|
||||
backdropItem.BackdropImageTags?.[0] ?? "none",
|
||||
);
|
||||
}, 14000); // Update backdrop every 14s
|
||||
@@ -711,6 +730,8 @@ function LibraryView() {
|
||||
}
|
||||
}, [backdropItems]);
|
||||
|
||||
const [test, setTest] = useState(1);
|
||||
|
||||
if (items.isError) {
|
||||
console.error(items.error);
|
||||
}
|
||||
@@ -792,7 +813,16 @@ function LibraryView() {
|
||||
{!disableSort && (
|
||||
<div className="flex flex-row flex-center">
|
||||
<IconButton
|
||||
onClick={() => setSortAscending((state) => !state)}
|
||||
onClick={() => {
|
||||
sessionStorage.setItem(
|
||||
`library-${currentLib.data?.Id}-config_sort`,
|
||||
JSON.stringify({
|
||||
sortAscending: !sortAscending,
|
||||
sortBy,
|
||||
}),
|
||||
);
|
||||
setSortAscending((state: boolean) => !state);
|
||||
}}
|
||||
>
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
@@ -810,7 +840,8 @@ function LibraryView() {
|
||||
value={sortBy ?? "Name"}
|
||||
size="small"
|
||||
onChange={(e) => {
|
||||
setSortBy(e.target.value);
|
||||
setSortBy(e.target.value as ItemSortBy);
|
||||
console.info(e);
|
||||
sessionStorage.setItem(
|
||||
`library-${currentLib.data?.Id}-config_sort`,
|
||||
JSON.stringify({
|
||||
@@ -834,7 +865,7 @@ function LibraryView() {
|
||||
value={currentViewType}
|
||||
size="small"
|
||||
onChange={(e) => {
|
||||
setCurrentViewType(e.target.value);
|
||||
setCurrentViewType(e.target.value as BaseItemKind);
|
||||
sessionStorage.setItem(
|
||||
`library-${currentLib.data?.Id}-config_currentViewType`,
|
||||
e.target.value,
|
||||
@@ -857,6 +888,7 @@ function LibraryView() {
|
||||
</span>
|
||||
}
|
||||
size="large"
|
||||
//@ts-ignore
|
||||
color="white"
|
||||
onClick={handleFilterDropdown}
|
||||
>
|
||||
@@ -892,44 +924,60 @@ function LibraryView() {
|
||||
}}
|
||||
>
|
||||
<FormControlLabel
|
||||
control={<Checkbox checked={filters.isPlayed} />}
|
||||
control={
|
||||
<Checkbox
|
||||
checked={filters.isPlayed}
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
isPlayed: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
}
|
||||
label="Played"
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
isPlayed: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={<Checkbox checked={filters.isUnPlayed} />}
|
||||
control={
|
||||
<Checkbox
|
||||
checked={filters.isUnPlayed}
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
isUnPlayed: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
}
|
||||
label="Unplayed"
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
isUnPlayed: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={<Checkbox checked={filters.isResumable} />}
|
||||
control={
|
||||
<Checkbox
|
||||
checked={filters.isResumable}
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
isResumable: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
}
|
||||
label="Resumable"
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
isResumable: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={<Checkbox checked={filters.isFavorite} />}
|
||||
label="Favorites"
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
isFavorite: e.target.checked,
|
||||
}))
|
||||
control={
|
||||
<Checkbox
|
||||
checked={filters.isFavorite}
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
isFavorite: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
}
|
||||
label="Favorites"
|
||||
/>
|
||||
</FormControl>
|
||||
<Typography
|
||||
@@ -949,56 +997,74 @@ function LibraryView() {
|
||||
}}
|
||||
>
|
||||
<FormControlLabel
|
||||
control={<Checkbox checked={filters.hasSubtitles} />}
|
||||
control={
|
||||
<Checkbox
|
||||
checked={filters.hasSubtitles}
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
hasSubtitles: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
}
|
||||
label="Subtitles"
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
hasSubtitles: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={<Checkbox checked={filters.hasTrailer} />}
|
||||
label="Trailer"
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
hasTrailer: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox checked={filters.hasSpecialFeature} />
|
||||
<Checkbox
|
||||
checked={filters.hasTrailer}
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
hasTrailer: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
}
|
||||
label="Trailer"
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
checked={filters.hasSpecialFeature}
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
hasSpecialFeature: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
}
|
||||
label="Special Features"
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
hasSpecialFeature: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={<Checkbox checked={filters.hasThemeSong} />}
|
||||
control={
|
||||
<Checkbox
|
||||
checked={filters.hasThemeSong}
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
hasThemeSong: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
}
|
||||
label="Theme Song"
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
hasThemeSong: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={<Checkbox checked={filters.hasThemeVideo} />}
|
||||
label="Theme Video"
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
hasThemeVideo: e.target.checked,
|
||||
}))
|
||||
control={
|
||||
<Checkbox
|
||||
checked={filters.hasThemeVideo}
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
hasThemeVideo: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
}
|
||||
label="Theme Video"
|
||||
/>
|
||||
</FormControl>
|
||||
<Typography
|
||||
@@ -1019,45 +1085,59 @@ function LibraryView() {
|
||||
>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox checked={videoTypesState.BluRay} />
|
||||
<Checkbox
|
||||
checked={videoTypesState.BluRay}
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setVideoTypesState((s) => ({
|
||||
...s,
|
||||
BluRay: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
}
|
||||
label="BluRay"
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setVideoTypesState((s) => ({
|
||||
...s,
|
||||
BluRay: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={<Checkbox checked={videoTypesState.Dvd} />}
|
||||
control={
|
||||
<Checkbox
|
||||
checked={videoTypesState.Dvd}
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setVideoTypesState((s) => ({
|
||||
...s,
|
||||
Dvd: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
}
|
||||
label="DVD"
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setVideoTypesState((s) => ({
|
||||
...s,
|
||||
Dvd: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={<Checkbox checked={filters.isHD} />}
|
||||
control={
|
||||
<Checkbox
|
||||
checked={filters.isHD}
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
isHD: e.target.checked,
|
||||
}));
|
||||
}}
|
||||
/>
|
||||
}
|
||||
label="HD"
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
isHD: e.target.checked,
|
||||
}));
|
||||
}}
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={<Checkbox checked={filters.is4K} />}
|
||||
label="4k"
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
is4K: e.target.checked,
|
||||
}))
|
||||
control={
|
||||
<Checkbox
|
||||
checked={filters.is4K}
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
is4K: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
}
|
||||
label="4k"
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={<Checkbox checked={false} />}
|
||||
@@ -1065,14 +1145,18 @@ function LibraryView() {
|
||||
disabled
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={<Checkbox value={filters.is3D} />}
|
||||
label="3D"
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
is3D: e.target.checked,
|
||||
}))
|
||||
control={
|
||||
<Checkbox
|
||||
value={filters.is3D}
|
||||
onChange={(e) =>
|
||||
setFilters((s) => ({
|
||||
...s,
|
||||
is3D: e.target.checked,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
}
|
||||
label="3D"
|
||||
/>
|
||||
</FormControl>
|
||||
</Menu>
|
||||
@@ -1098,7 +1182,7 @@ function LibraryView() {
|
||||
libraryId={currentLib.data.Id}
|
||||
genreId={item.Id}
|
||||
genreName={item.Name}
|
||||
userId={user.data?.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})
|
||||
@@ -1116,10 +1200,10 @@ function LibraryView() {
|
||||
const fromIndex = index * itemsPerRow;
|
||||
const toIndex = Math.min(
|
||||
fromIndex + itemsPerRow,
|
||||
items.data?.TotalRecordCount,
|
||||
items.data?.TotalRecordCount ?? 0,
|
||||
);
|
||||
for (let i = fromIndex; i < toIndex; i++) {
|
||||
const item = items.data?.Items[i];
|
||||
const item = items.data?.Items?.[i];
|
||||
displayItems.push(
|
||||
<div
|
||||
className="library-virtual-item"
|
||||
@@ -1128,18 +1212,18 @@ function LibraryView() {
|
||||
ref={virtualizer.measureElement}
|
||||
>
|
||||
<Card
|
||||
item={item}
|
||||
seriesId={item.SeriesId}
|
||||
item={item ?? null}
|
||||
seriesId={item?.SeriesId}
|
||||
cardTitle={
|
||||
item.Type === BaseItemKind.Episode
|
||||
item?.Type === BaseItemKind.Episode
|
||||
? item.SeriesName
|
||||
: item.Name
|
||||
: item?.Name
|
||||
}
|
||||
imageType={"Primary"}
|
||||
cardCaption={
|
||||
item.Type === BaseItemKind.Episode
|
||||
item?.Type === BaseItemKind.Episode
|
||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`
|
||||
: item.Type === BaseItemKind.Series
|
||||
: item?.Type === BaseItemKind.Series
|
||||
? `${item.ProductionYear} - ${
|
||||
item.EndDate
|
||||
? new Date(item.EndDate).toLocaleString(
|
||||
@@ -1150,32 +1234,26 @@ function LibraryView() {
|
||||
)
|
||||
: "Present"
|
||||
}`
|
||||
: item.ProductionYear
|
||||
: item?.ProductionYear
|
||||
}
|
||||
disableOverlay={
|
||||
item.Type === BaseItemKind.Person ||
|
||||
item.Type === BaseItemKind.Genre ||
|
||||
item.Type === BaseItemKind.MusicGenre ||
|
||||
item.Type === BaseItemKind.Studio
|
||||
item?.Type === BaseItemKind.Person ||
|
||||
item?.Type === BaseItemKind.Genre ||
|
||||
item?.Type === BaseItemKind.MusicGenre ||
|
||||
item?.Type === BaseItemKind.Studio
|
||||
}
|
||||
cardType={
|
||||
item.Type === BaseItemKind.MusicAlbum ||
|
||||
item.Type === BaseItemKind.Audio ||
|
||||
item.Type === BaseItemKind.Genre ||
|
||||
item.Type === BaseItemKind.MusicGenre ||
|
||||
item.Type === BaseItemKind.Studio ||
|
||||
item.Type === BaseItemKind.Playlist
|
||||
item?.Type === BaseItemKind.MusicAlbum ||
|
||||
item?.Type === BaseItemKind.Audio ||
|
||||
item?.Type === BaseItemKind.Genre ||
|
||||
item?.Type === BaseItemKind.MusicGenre ||
|
||||
item?.Type === BaseItemKind.Studio ||
|
||||
item?.Type === BaseItemKind.Playlist
|
||||
? "square"
|
||||
: "portrait"
|
||||
}
|
||||
// queryKey={items}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>,
|
||||
);
|
||||
@@ -1210,7 +1288,7 @@ function LibraryView() {
|
||||
const item = items.data?.Items?.[virtualRow.index];
|
||||
return (
|
||||
<div
|
||||
key={item.Id}
|
||||
key={item?.Id}
|
||||
style={{
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
@@ -1221,7 +1299,7 @@ function LibraryView() {
|
||||
}}
|
||||
>
|
||||
<MusicTrack
|
||||
item={item}
|
||||
item={item ?? null}
|
||||
// queryKey={[
|
||||
// "libraryView",
|
||||
// "currentLibItems",
|
||||
@@ -1246,7 +1324,7 @@ function LibraryView() {
|
||||
// },
|
||||
// },
|
||||
// ]}
|
||||
userId={user.data?.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
@@ -1260,9 +1338,8 @@ function LibraryView() {
|
||||
);
|
||||
}
|
||||
if (currentLib.isError) {
|
||||
return <h6>{currentLib.error}</h6>;
|
||||
return <ErrorNotice error={currentLib.error} />;
|
||||
}
|
||||
}
|
||||
|
||||
export default LibraryView;
|
||||
|
||||
@@ -84,6 +84,9 @@
|
||||
}
|
||||
}
|
||||
&-filter {
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
margin: 0 0.5em !important;
|
||||
&-container {
|
||||
margin-top: 0.75em;
|
||||
width: 22em;
|
||||
@@ -92,12 +95,7 @@
|
||||
border-radius: $border-radius-default;
|
||||
backdrop-filter: blur(10px);
|
||||
overflow-y: overlay;
|
||||
}
|
||||
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
margin: 0 0.5em !important;
|
||||
|
||||
}
|
||||
&-title {
|
||||
justify-self: start;
|
||||
}
|
||||
@@ -131,6 +129,14 @@
|
||||
}
|
||||
// Layout css for dynamic virtual rows
|
||||
&-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{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
@@ -138,13 +144,5 @@
|
||||
align-items: center;
|
||||
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 { CircularProgress, Typography } from "@mui/material";
|
||||
import { createFileRoute, redirect } from "@tanstack/react-router";
|
||||
import React from "react";
|
||||
|
||||
export const Route = createFileRoute("/_api/login")({
|
||||
beforeLoad: async ({ context, location }) => {
|
||||
@@ -7,13 +9,26 @@ export const Route = createFileRoute("/_api/login")({
|
||||
const api = context.api;
|
||||
if (!api) {
|
||||
console.info("Awaiting Api generation.");
|
||||
return;
|
||||
// throw redirect({ to: "/login/manual" });
|
||||
} else {
|
||||
const publicUsers = (await getUserApi(api).getPublicUsers()).data;
|
||||
if (publicUsers.length > 0) {
|
||||
throw redirect({ to: "/login/list" });
|
||||
}
|
||||
throw redirect({ to: "/login/manual" });
|
||||
}
|
||||
const publicUsers = (await getUserApi(api).getPublicUsers()).data;
|
||||
if (publicUsers.length > 0) {
|
||||
throw redirect({ to: "/login/list" });
|
||||
}
|
||||
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 React, { useLayoutEffect } from "react";
|
||||
|
||||
import { Grid, Typography } from "@mui/material";
|
||||
import { Chip, IconButton, Typography } from "@mui/material";
|
||||
import Button from "@mui/material/Button";
|
||||
import Container from "@mui/material/Container";
|
||||
|
||||
import { AppBarBackOnly } from "@/components/appBar/backOnly.jsx";
|
||||
import { Card } from "@/components/card/card.js";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
|
||||
@@ -15,13 +13,42 @@ import "./login.scss";
|
||||
|
||||
import QuickConnectButton from "@/components/buttons/quickConnectButton";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { setBackdrop } from "@/utils/store/backdrop.js";
|
||||
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop.js";
|
||||
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")({
|
||||
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() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
@@ -30,18 +57,18 @@ function LoginPublicUsersList() {
|
||||
const handleChangeServer = () => {
|
||||
navigate({ to: "/setup/server/list" });
|
||||
};
|
||||
const handleManualLogin = () => {
|
||||
navigate({ to: "/login/manual" });
|
||||
};
|
||||
const users = useQuery({
|
||||
queryKey: ["login", "public-users"],
|
||||
queryFn: async () => {
|
||||
if (!api) return [];
|
||||
const result = await getUserApi(api).getPublicUsers();
|
||||
return result.data;
|
||||
},
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
|
||||
const setBackdrop = useBackdropStore((state) => state.setBackdrop);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
setBackdrop("", "");
|
||||
}, []);
|
||||
@@ -49,66 +76,18 @@ function LoginPublicUsersList() {
|
||||
return (
|
||||
<>
|
||||
<AppBarBackOnly />
|
||||
<Container
|
||||
maxWidth="md"
|
||||
sx={{
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Typography variant="h3" mb={2}>
|
||||
<div className="login-container">
|
||||
<Typography variant="h4" align="center">
|
||||
Users
|
||||
</Typography>
|
||||
|
||||
<Grid
|
||||
container
|
||||
columns={{
|
||||
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>
|
||||
);
|
||||
<div className="user-list-container roundedScrollbar">
|
||||
{users.data.map((item) => {
|
||||
return <UserCard user={item} key={item.Id} />;
|
||||
})}
|
||||
</Grid>
|
||||
</div>
|
||||
|
||||
<div className="buttons">
|
||||
{/* <div className="buttons">
|
||||
<Button
|
||||
color="secondary"
|
||||
variant="contained"
|
||||
@@ -118,20 +97,22 @@ function LoginPublicUsersList() {
|
||||
Change Server
|
||||
</Button>
|
||||
<QuickConnectButton />
|
||||
<Button
|
||||
variant="contained"
|
||||
className="userEventButton"
|
||||
onClick={handleManualLogin}
|
||||
size="small"
|
||||
>
|
||||
Manual Login
|
||||
</Button>
|
||||
</div>
|
||||
</Container>
|
||||
</div> */}
|
||||
<Chip
|
||||
style={{ marginLeft: "50%", transform: "translateX(-50%)" }}
|
||||
label={
|
||||
<Typography variant="body2" align="center">
|
||||
Don't see your user? Try using{" "}
|
||||
<Link to="/login/manual">Manual Login</Link> or{" "}
|
||||
<Link to="/setup/server/list">Changing Server</Link>
|
||||
</Typography>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
if (users.isError) {
|
||||
return <ErrorNotice error="" />;
|
||||
return <ErrorNotice />;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,35 @@
|
||||
|
||||
.user {
|
||||
&List {
|
||||
display: flex;
|
||||
gap: 1em;
|
||||
width: min(60vw, 45em);
|
||||
&-list {
|
||||
&-container {
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
gap: 1em;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 30em;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
scroll-snap-type: y mandatory;
|
||||
margin: 2em 0;
|
||||
}
|
||||
}
|
||||
&Card {
|
||||
border-radius: $border-radius-default;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
flex: 1 1 0px;
|
||||
overflow: hidden;
|
||||
&-card {
|
||||
width: fit-content;
|
||||
scroll-snap-align: start;
|
||||
text-decoration: none !important;
|
||||
color: white !important;
|
||||
&-image{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
&-container{
|
||||
aspect-ratio: 1;
|
||||
width: 8em;
|
||||
overflow: hidden;
|
||||
border-radius: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
&Icon {
|
||||
font-size: 5em;
|
||||
@@ -31,13 +50,21 @@
|
||||
}
|
||||
|
||||
.login {
|
||||
width: 100vw;
|
||||
// width: 50em;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
&-container{
|
||||
width: min(40em,80vw);
|
||||
height: 100vh;
|
||||
margin: auto;
|
||||
padding-top: 4em;
|
||||
padding-bottom: 4em;
|
||||
}
|
||||
|
||||
&-form {
|
||||
width: 28em;
|
||||
display: flex;
|
||||
|
||||
@@ -34,6 +34,8 @@ import ShowMoreText from "@/components/showMoreText";
|
||||
import "./person.scss";
|
||||
|
||||
import IconLink from "@/components/iconLink";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
|
||||
function TabPanel(props) {
|
||||
@@ -74,27 +76,18 @@ function PersonTitlePage() {
|
||||
const { id } = Route.useParams();
|
||||
const api = Route.useRouteContext().api;
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
fields: [ItemFields.Crew],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
@@ -103,7 +96,7 @@ function PersonTitlePage() {
|
||||
queryKey: ["item", id, "personMovies"],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
personIds: [id],
|
||||
includeItemTypes: [BaseItemKind.Movie],
|
||||
recursive: true,
|
||||
@@ -120,7 +113,7 @@ function PersonTitlePage() {
|
||||
queryKey: ["item", id, "personShows"],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
personIds: [id],
|
||||
includeItemTypes: [BaseItemKind.Series],
|
||||
recursive: true,
|
||||
@@ -138,7 +131,7 @@ function PersonTitlePage() {
|
||||
queryKey: ["item", id, "personBooks"],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
personIds: [id],
|
||||
includeItemTypes: [BaseItemKind.Book],
|
||||
recursive: true,
|
||||
@@ -155,7 +148,7 @@ function PersonTitlePage() {
|
||||
queryKey: ["item", id, "personPhotos"],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
personIds: [id],
|
||||
includeItemTypes: [BaseItemKind.Photo],
|
||||
recursive: true,
|
||||
@@ -171,7 +164,7 @@ function PersonTitlePage() {
|
||||
queryKey: ["item", id, "personEpisodes"],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
personIds: [id],
|
||||
includeItemTypes: [BaseItemKind.Episode],
|
||||
recursive: true,
|
||||
@@ -319,10 +312,14 @@ function PersonTitlePage() {
|
||||
/>
|
||||
<img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
},
|
||||
)}
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
}}
|
||||
@@ -343,7 +340,7 @@ function PersonTitlePage() {
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isFavorite={item.data.UserData.IsFavorite}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -480,7 +477,7 @@ function PersonTitlePage() {
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={tab.queryKey}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!tabitem.ImageBlurHashes?.Primary &&
|
||||
tabitem.ImageBlurHashes?.Primary[
|
||||
|
||||
@@ -48,15 +48,19 @@
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
gap: 1em;
|
||||
|
||||
margin-top: 2em;
|
||||
&-track {
|
||||
padding: 1em;
|
||||
display: grid;
|
||||
grid-template-columns: 3em 1fr 6em;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
gap: 1em;
|
||||
.material-symbols-rounded{
|
||||
cursor: grab;
|
||||
}
|
||||
&-info-name {
|
||||
transition: $transition-time-fast;
|
||||
}
|
||||
@@ -66,11 +70,17 @@
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
&.dragging {
|
||||
background: black;
|
||||
border-radius: 10px;
|
||||
width: calc(100% + 2em);
|
||||
cursor: grabbing;
|
||||
}
|
||||
}
|
||||
}
|
||||
&-lyrics {
|
||||
max-height: 40vh;
|
||||
overflow:visible;
|
||||
overflow: visible;
|
||||
background: rgb(255 255 255 / 0.05);
|
||||
// border: 1px solid rgb(255 255 255 / 0.2);
|
||||
padding: 2em;
|
||||
|
||||
@@ -1,25 +1,40 @@
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
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 { createFileRoute } from "@tanstack/react-router";
|
||||
import React, {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import React, { useEffect, useMemo, useRef, useState } from "react";
|
||||
|
||||
import "./audio.scss";
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import PlayNextButton from "@/components/buttons/playNextButton";
|
||||
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
||||
import QueueTrack from "@/components/queueTrack";
|
||||
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 { 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")({
|
||||
component: AudioPlayerRoute,
|
||||
});
|
||||
@@ -29,11 +44,19 @@ const SEEK_AMOUNT = 10; // seconds to skip on fast_rewind or fast_forward button
|
||||
function AudioPlayerRoute() {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const [queue, currentTrack] = useQueue((s) => [s.tracks, s.currentItemIndex]);
|
||||
const [item] = useAudioPlayback((s) => [s.item]);
|
||||
const audioPlayer: HTMLAudioElement | null = useMemo(
|
||||
() => document.querySelector("#audio-player"),
|
||||
[item],
|
||||
const [item, audioPlayerRef] = useAudioPlayback((s) => [
|
||||
s.item,
|
||||
s.player.ref,
|
||||
]);
|
||||
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 [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(() => {
|
||||
audioPlayer?.addEventListener("timeupdate", () => {
|
||||
setProgress(audioPlayer.currentTime ?? 0);
|
||||
audioPlayerRef?.current?.addEventListener("timeupdate", () => {
|
||||
setProgress(audioPlayerRef?.current?.currentTime ?? 0);
|
||||
});
|
||||
console.log(audioPlayer);
|
||||
return () => {
|
||||
audioPlayerRef?.current?.removeEventListener("timeupdate", () => {
|
||||
setProgress(audioPlayerRef?.current?.currentTime ?? 0);
|
||||
});
|
||||
};
|
||||
}, [item?.Id, currentTrack]);
|
||||
|
||||
const lyricsContainer = useRef<HTMLDivElement | null>(null);
|
||||
@@ -73,20 +100,52 @@ function AudioPlayerRoute() {
|
||||
}
|
||||
}, [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 (
|
||||
<div
|
||||
className="scrollY padded-top flex flex-column"
|
||||
style={{ gap: "1em" }}
|
||||
key={queue[currentTrack]?.Id}
|
||||
key={item?.Id}
|
||||
>
|
||||
<div className="audio-info-container">
|
||||
<div className="audio-info-image-container">
|
||||
{item?.ImageTags?.Primary ? (
|
||||
<img
|
||||
alt={item.Name ?? "Music"}
|
||||
src={api.getItemImageUrl(item.Id, "Primary", {
|
||||
tag: item.ImageTags.Primary,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
tag: item.ImageTags.Primary,
|
||||
},
|
||||
)}
|
||||
className="audio-info-image"
|
||||
/>
|
||||
) : (
|
||||
@@ -117,6 +176,7 @@ function AudioPlayerRoute() {
|
||||
value={isScrubbing ? sliderProgress : secToTicks(progress)}
|
||||
max={item?.RunTimeTicks ?? 1}
|
||||
step={1}
|
||||
key={item?.Id}
|
||||
onChange={(_, newVal) => {
|
||||
setIsScrubbing(true);
|
||||
setSliderProgress(newVal);
|
||||
@@ -126,9 +186,11 @@ function AudioPlayerRoute() {
|
||||
Array.isArray(newVal)
|
||||
? setProgress(ticksToSec(newVal[0]))
|
||||
: setProgress(ticksToSec(newVal));
|
||||
audioPlayer?.currentTime = Array.isArray(newVal)
|
||||
? ticksToSec(newVal[0])
|
||||
: ticksToSec(newVal);
|
||||
if (audioPlayerRef?.current) {
|
||||
audioPlayerRef.current.currentTime = Array.isArray(newVal)
|
||||
? ticksToSec(newVal[0])
|
||||
: ticksToSec(newVal);
|
||||
}
|
||||
}}
|
||||
sx={{
|
||||
"& .MuiSlider-thumb": {
|
||||
@@ -167,19 +229,22 @@ function AudioPlayerRoute() {
|
||||
<PlayPreviousButton />
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
audioPlayer?.currentTime -= SEEK_AMOUNT;
|
||||
if (audioPlayer) {
|
||||
audioPlayer.currentTime -= SEEK_AMOUNT;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<span className="material-symbols-rounded">fast_rewind</span>
|
||||
</IconButton>
|
||||
<Fab
|
||||
disabled={!audioPlayer?.readyState}
|
||||
disabled={!audioPlayerRef?.current?.readyState}
|
||||
//@ts-ignore
|
||||
color="white"
|
||||
size="large"
|
||||
onClick={() =>
|
||||
audioPlayer?.paused
|
||||
? audioPlayer.play()
|
||||
: audioPlayer?.pause()
|
||||
audioPlayerRef?.current?.paused
|
||||
? audioPlayerRef?.current?.play()
|
||||
: audioPlayerRef?.current?.pause()
|
||||
}
|
||||
>
|
||||
<span
|
||||
@@ -188,12 +253,14 @@ function AudioPlayerRoute() {
|
||||
fontSize: "2.4em",
|
||||
}}
|
||||
>
|
||||
{audioPlayer?.paused ? "play_arrow" : "pause"}
|
||||
{audioPlayerRef?.current?.paused ? "play_arrow" : "pause"}
|
||||
</span>
|
||||
</Fab>
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
audioPlayer?.currentTime += SEEK_AMOUNT;
|
||||
if (audioPlayer) {
|
||||
audioPlayer.currentTime += SEEK_AMOUNT;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<span className="material-symbols-rounded">fast_forward</span>
|
||||
@@ -227,7 +294,7 @@ function AudioPlayerRoute() {
|
||||
className="audio-lyrics-line"
|
||||
key={`${lyric.Text}${index}`}
|
||||
data-active-lyric={
|
||||
secToTicks(audioPlayer?.currentTime) >= lyric.Start &&
|
||||
secToTicks(audioPlayer?.currentTime) >= (lyric.Start ?? 0) &&
|
||||
secToTicks(audioPlayer?.currentTime) <
|
||||
(lyrics.data?.[0]?.Lyrics?.Lyrics?.[index + 1]?.Start ?? 0)
|
||||
}
|
||||
@@ -252,14 +319,58 @@ function AudioPlayerRoute() {
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<div className="audio-queue-container">
|
||||
<Typography variant="h5">Queue:</Typography>
|
||||
<div className="audio-queue">
|
||||
{queue.map((track, index) => (
|
||||
<QueueTrack key={track.Id} track={track} index={index} />
|
||||
))}
|
||||
</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">
|
||||
<Typography variant="h5">Queue:</Typography>
|
||||
<SortableContext
|
||||
items={queue?.map((track) => track.Id)}
|
||||
strategy={verticalListSortingStrategy}
|
||||
>
|
||||
<div className="audio-queue">
|
||||
{queue?.map((track, index) => (
|
||||
<QueueTrack key={track.Id} track={track} index={index} />
|
||||
))}
|
||||
</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>
|
||||
<Typography className="opacity-07">
|
||||
{getRuntimeMusic(
|
||||
queue[currentDraggingIndex].RunTimeTicks ?? 0,
|
||||
)}
|
||||
</Typography>
|
||||
</div>
|
||||
)}
|
||||
</DragOverlay>
|
||||
</div>
|
||||
)}
|
||||
</DndContext>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
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 CircularProgress from "@mui/material/CircularProgress";
|
||||
@@ -13,6 +13,7 @@ import ReactPlayer from "react-player";
|
||||
|
||||
import {
|
||||
changeSubtitleTrack,
|
||||
playItemFromQueue,
|
||||
toggleSubtitleTrack,
|
||||
usePlaybackStore,
|
||||
} from "@/utils/store/playback";
|
||||
@@ -33,7 +34,7 @@ import {
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
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 JASSUB from "jassub";
|
||||
@@ -47,10 +48,14 @@ import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
||||
import QueueButton from "@/components/buttons/queueButton";
|
||||
import OutroCard from "@/components/outroCard";
|
||||
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 { toNumber } from "lodash";
|
||||
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 time = Math.round(ticks / 10000);
|
||||
@@ -75,17 +80,58 @@ const ticksDisplay = (ticks: number) => {
|
||||
};
|
||||
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/")({
|
||||
component: VideoPlayer,
|
||||
});
|
||||
|
||||
|
||||
function VideoPlayer() {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const { history } = useRouter();
|
||||
const [hoveringOsd, setHoveringOsd] = useState(false);
|
||||
const player = useRef<ReactPlayer | null>(null);
|
||||
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const [
|
||||
playbackStream,
|
||||
item,
|
||||
@@ -130,6 +176,7 @@ function VideoPlayer() {
|
||||
const [volume, setVolume] = useState(1);
|
||||
const [muted, setMuted] = useState(false);
|
||||
|
||||
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||
useEffect(() => setBackdrop("", ""), []);
|
||||
|
||||
const [clickTimeout, setClickTimeout] = useState<NodeJS.Timeout>(null!);
|
||||
@@ -194,6 +241,7 @@ function VideoPlayer() {
|
||||
},
|
||||
});
|
||||
usePlaybackStore.setState(usePlaybackStore.getInitialState());
|
||||
clearQueue();
|
||||
};
|
||||
|
||||
const handleShowOsd = () => {
|
||||
@@ -247,7 +295,6 @@ function VideoPlayer() {
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
// attach the event listener
|
||||
document.addEventListener("keydown", handleKeyPress);
|
||||
@@ -258,6 +305,7 @@ function VideoPlayer() {
|
||||
};
|
||||
}, [handleKeyPress]);
|
||||
|
||||
// Volume control with mouse wheel
|
||||
useEffect(() => {
|
||||
const handleMouseWheel = (event: WheelEvent) => {
|
||||
if (event.deltaY < 0) {
|
||||
@@ -278,44 +326,59 @@ function VideoPlayer() {
|
||||
};
|
||||
}, []);
|
||||
|
||||
// Set playing state to true when a new item is loaded
|
||||
useLayoutEffect(() => {
|
||||
setPlaying(true);
|
||||
setIsReady(false);
|
||||
}, [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(() => {
|
||||
console.log(mediaSource.subtitle.enable);
|
||||
|
||||
if (player.current?.getInternalPlayer() && mediaSource.subtitle.enable) {
|
||||
let jassubRenderer: JASSUB | undefined;
|
||||
if (
|
||||
mediaSource.subtitle.format === "ass" ||
|
||||
mediaSource.subtitle.format === "ssa"
|
||||
) {
|
||||
const jassubRenderer = new JASSUB({
|
||||
jassubRenderer = new JASSUB({
|
||||
//@ts-ignore
|
||||
video: player.current?.getInternalPlayer(),
|
||||
workerUrl,
|
||||
wasmUrl,
|
||||
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);
|
||||
}, [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 (
|
||||
<div className="video-player">
|
||||
<AnimatePresence>
|
||||
@@ -654,16 +738,9 @@ function VideoPlayer() {
|
||||
label="Subtitles"
|
||||
variant="outlined"
|
||||
value={mediaSource.subtitle.track}
|
||||
onChange={(e) => {
|
||||
if (mediaSource.subtitle.allTracks) {
|
||||
changeSubtitleTrack(
|
||||
toNumber(e.target.value),
|
||||
mediaSource.subtitle.allTracks,
|
||||
);
|
||||
}
|
||||
}}
|
||||
onChange={handleSubtitleChange}
|
||||
fullWidth
|
||||
disabled={mediaSource.subtitle.track === -2}
|
||||
disabled={mediaSource.subtitle.track === -2 || subtitleIsChanging}
|
||||
>
|
||||
<MenuItem key={-1} value={-1}>
|
||||
No Subtitle
|
||||
@@ -836,8 +913,10 @@ function VideoPlayer() {
|
||||
</IconButton>
|
||||
<QueueButton />
|
||||
<IconButton
|
||||
disabled={mediaSource.subtitle.track === -2}
|
||||
onClick={toggleSubtitleTrack}
|
||||
disabled={
|
||||
mediaSource.subtitle.track === -2 || subtitleIsChanging
|
||||
}
|
||||
onClick={() => startSubtitleChange(toggleSubtitleTrack)}
|
||||
>
|
||||
<span className={"material-symbols-rounded"}>
|
||||
{mediaSource.subtitle.enable
|
||||
@@ -864,7 +943,7 @@ function VideoPlayer() {
|
||||
)}
|
||||
</motion.div>
|
||||
<ReactPlayer
|
||||
key={item?.Id}
|
||||
key={`${item?.Id}${mediaSource.id}`}
|
||||
playing={playing}
|
||||
url={playbackStream}
|
||||
ref={player}
|
||||
@@ -875,24 +954,25 @@ function VideoPlayer() {
|
||||
console.error(hls);
|
||||
console.error(hlsG);
|
||||
}}
|
||||
onEnded={handlePlaybackEnded}
|
||||
width="100vw"
|
||||
height="100vh"
|
||||
style={{
|
||||
position: "fixed",
|
||||
zIndex: 1,
|
||||
}}
|
||||
config={{
|
||||
file: {
|
||||
attributes: {
|
||||
crossOrigin: "true",
|
||||
},
|
||||
tracks: reactPlayerCaptions,
|
||||
},
|
||||
}}
|
||||
volume={muted ? 0 : volume}
|
||||
onReady={handleReady}
|
||||
onBuffer={() => setLoading(true)}
|
||||
onBufferEnd={() => setLoading(false)}
|
||||
config={{
|
||||
file: {
|
||||
attributes: {
|
||||
crossOrigin: "anonymous",
|
||||
},
|
||||
tracks: [],
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</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 {
|
||||
&-osd {
|
||||
opacity: 0;
|
||||
@@ -8,6 +7,7 @@
|
||||
&-name {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5em;
|
||||
margin-left: 1.2em;
|
||||
&-logo {
|
||||
width: 16em;
|
||||
@@ -16,11 +16,10 @@
|
||||
object-position: left top;
|
||||
filter: drop-shadow(0 0 10px black);
|
||||
}
|
||||
gap: 0.5em;
|
||||
}
|
||||
&-trick-bubble{
|
||||
&-trick-bubble {
|
||||
overflow: hidden;
|
||||
border-radius: $border-radius-default;
|
||||
border-radius: $border-radius-default;
|
||||
}
|
||||
}
|
||||
&-osd-visible {
|
||||
@@ -36,7 +35,7 @@
|
||||
bottom: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
&-volume-indicator{
|
||||
&-volume-indicator {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 12em;
|
||||
@@ -50,13 +49,12 @@
|
||||
right: 2em;
|
||||
z-index: 10;
|
||||
border-radius: 2em;
|
||||
.material-symbols-rounded{
|
||||
.material-symbols-rounded {
|
||||
font-size: 3em;
|
||||
--fill:1;
|
||||
--fill: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
video {
|
||||
&::-webkit-media-text-track-display {
|
||||
overflow: visible !important;
|
||||
@@ -69,7 +67,6 @@ video {
|
||||
text-shadow: 0 2px 10px rgb(0 0 0 / 0.8);
|
||||
}
|
||||
}
|
||||
|
||||
.video-player {
|
||||
background: black;
|
||||
position: absolute;
|
||||
@@ -77,7 +74,7 @@ video {
|
||||
height: 100vh;
|
||||
top: 0;
|
||||
left: 0;
|
||||
&-osd{
|
||||
&-osd {
|
||||
position: absolute;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
@@ -90,22 +87,22 @@ video {
|
||||
justify-content: space-between;
|
||||
padding: 1em 2em;
|
||||
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;
|
||||
}
|
||||
&-controls{
|
||||
&-progress{
|
||||
&-controls {
|
||||
&-progress {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.2em;
|
||||
align-items: stretch;
|
||||
justify-content: center;
|
||||
&-text{
|
||||
margin-bottom: 0.5em;
|
||||
&-text {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
justify-content: space-between;
|
||||
}
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
&-buttons {
|
||||
display: flex;
|
||||
@@ -113,12 +110,12 @@ video {
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
.MuiSlider-valueLabel {
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
overflow: hidden;
|
||||
border-radius: $border-radius-default;
|
||||
border: 1.2px solid rgb(255 255 255 / 0.1);
|
||||
}
|
||||
.MuiSlider-valueLabel {
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
overflow: hidden;
|
||||
border-radius: $border-radius-default;
|
||||
border: 1.2px solid rgb(255 255 255 / 0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import "./playlist.scss";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
function TabPanel(props) {
|
||||
const { children, value, index, ...other } = props;
|
||||
|
||||
@@ -58,27 +59,18 @@ function PlaylistTitlePage() {
|
||||
const { id } = Route.useParams();
|
||||
const api = Route.useRouteContext().api;
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
fields: [ItemFields.Crew],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
@@ -87,7 +79,7 @@ function PlaylistTitlePage() {
|
||||
queryKey: ["item", id, "similarItem"],
|
||||
queryFn: async () => {
|
||||
const result = await getLibraryApi(api).getSimilarAlbums({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: item.data.Id,
|
||||
limit: 16,
|
||||
});
|
||||
@@ -102,7 +94,7 @@ function PlaylistTitlePage() {
|
||||
queryKey: ["item", id, "musicTracks"],
|
||||
queryFn: async () => {
|
||||
const result = await getPlaylistsApi(api).getPlaylistItems({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
playlistId: item.data.Id,
|
||||
});
|
||||
return result.data;
|
||||
@@ -161,7 +153,7 @@ function PlaylistTitlePage() {
|
||||
item={track}
|
||||
key={track.Id}
|
||||
queryKey={["item", id, "musicTracks"]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
playlistItem
|
||||
playlistItemId={item.data.Id}
|
||||
trackIndex={index}
|
||||
@@ -208,7 +200,7 @@ function PlaylistTitlePage() {
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!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 { getSearchApi } from "@jellyfin/sdk/lib/utils/api/search-api";
|
||||
import "./search.scss";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { Dialog, Fab } from "@mui/material";
|
||||
import { Outlet, createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
|
||||
export const Route = createFileRoute("/_api/search/")({
|
||||
component: SearchPage,
|
||||
validateSearch: (search: Record<string, unknown>): { query: string } => {
|
||||
return { query: search.query as string };
|
||||
},
|
||||
});
|
||||
|
||||
function SearchPage() {
|
||||
@@ -37,15 +41,7 @@ function SearchPage() {
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
// const searchParam = useDebounce(query, 500);
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const itemLimit = 12;
|
||||
|
||||
@@ -53,7 +49,7 @@ function SearchPage() {
|
||||
queryKey: ["search", "items", "Movie", query],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
includeItemTypes: [BaseItemKind.Movie],
|
||||
recursive: true,
|
||||
@@ -61,13 +57,13 @@ function SearchPage() {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: user.isSuccess,
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
const series = useQuery({
|
||||
queryKey: ["search", "items", "Series", query],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
includeItemTypes: [BaseItemKind.Series],
|
||||
recursive: true,
|
||||
@@ -75,13 +71,13 @@ function SearchPage() {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: user.isSuccess,
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
const musicAlbum = useQuery({
|
||||
queryKey: ["search", "items", "MusicAlbum", query],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
includeItemTypes: [BaseItemKind.MusicAlbum],
|
||||
recursive: true,
|
||||
@@ -89,13 +85,13 @@ function SearchPage() {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: user.isSuccess,
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
const audio = useQuery({
|
||||
queryKey: ["search", "items", "Audio", query],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
includeItemTypes: [BaseItemKind.Audio],
|
||||
recursive: true,
|
||||
@@ -103,13 +99,13 @@ function SearchPage() {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: user.isSuccess,
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
const book = useQuery({
|
||||
queryKey: ["search", "items", "Book", query],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
includeItemTypes: [BaseItemKind.Book],
|
||||
recursive: true,
|
||||
@@ -117,13 +113,13 @@ function SearchPage() {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: user.isSuccess,
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
const musicArtists = useQuery({
|
||||
queryKey: ["search", "items", "MusicArtists", query],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
includeItemTypes: [BaseItemKind.MusicArtist],
|
||||
recursive: true,
|
||||
@@ -131,32 +127,32 @@ function SearchPage() {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: user.isSuccess,
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
const person = useQuery({
|
||||
queryKey: ["search", "items", "Person", query],
|
||||
queryFn: async () => {
|
||||
const result = await getPersonsApi(api).getPersons({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
limit: itemLimit,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: user.isSuccess,
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
const episodes = useQuery({
|
||||
queryKey: ["search", "items", "Episodes", query],
|
||||
queryFn: async () => {
|
||||
const result = await getSearchApi(api).getSearchHints({
|
||||
userId: user.data?.Id,
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
limit: itemLimit,
|
||||
includeItemTypes: ["Episode"],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: user.isSuccess,
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
|
||||
const [setBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
||||
@@ -224,7 +220,7 @@ function SearchPage() {
|
||||
cardCaption={item.ProductionYear}
|
||||
cardType="portrait"
|
||||
queryKey={["search", "items", "Movie", query]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
@@ -252,7 +248,7 @@ function SearchPage() {
|
||||
}`}
|
||||
cardType="portrait"
|
||||
queryKey={["search", "items", "Series", query]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
@@ -273,7 +269,7 @@ function SearchPage() {
|
||||
cardTitle={episode.Series}
|
||||
cardCaption={`S${episode.ParentIndexNumber}:E${episode.IndexNumber} - ${episode.Name}`}
|
||||
queryKey={["search", "items", "Episodes", query]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
disableRunTime
|
||||
/>
|
||||
);
|
||||
@@ -291,7 +287,7 @@ function SearchPage() {
|
||||
cardCaption={item.ProductionYear}
|
||||
cardType="square"
|
||||
queryKey={["search", "items", "Audio", query]}
|
||||
userId={user.data?.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
@@ -308,7 +304,7 @@ function SearchPage() {
|
||||
cardCaption={item.AlbumArtist}
|
||||
cardType={"square"}
|
||||
queryKey={["search", "items", "MusicAlbum", query]}
|
||||
userId={user.data?.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
@@ -325,7 +321,7 @@ function SearchPage() {
|
||||
disableOverlay
|
||||
cardType={"portrait"}
|
||||
queryKey={["search", "items", "Book", query]}
|
||||
userId={user.data?.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
@@ -341,7 +337,7 @@ function SearchPage() {
|
||||
disableOverlay
|
||||
cardType={"square"}
|
||||
queryKey={["search", "items", "MusicArtists", query]}
|
||||
userId={user.data?.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
@@ -357,7 +353,7 @@ function SearchPage() {
|
||||
disableOverlay
|
||||
cardType={"square"}
|
||||
queryKey={["search", "items", "Person", query]}
|
||||
userId={user.data?.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
+116
-79
@@ -59,6 +59,8 @@ import { setBackdrop, useBackdropStore } from "@/utils/store/backdrop";
|
||||
|
||||
import IconLink from "@/components/iconLink";
|
||||
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 { Link } from "@tanstack/react-router";
|
||||
|
||||
@@ -101,27 +103,18 @@ function SeriesTitlePage() {
|
||||
|
||||
const api = Route.useRouteContext().api;
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
enabled: Boolean(api),
|
||||
});
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
fields: [ItemFields.Crew],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
enabled: !!user?.Id,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
@@ -130,7 +123,7 @@ function SeriesTitlePage() {
|
||||
queryKey: ["item", id, "similarItem"],
|
||||
queryFn: async () => {
|
||||
const result = await getLibraryApi(api).getSimilarShows({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: item.data.Id,
|
||||
limit: 16,
|
||||
});
|
||||
@@ -145,7 +138,7 @@ function SeriesTitlePage() {
|
||||
queryKey: ["item", id, "seasons"],
|
||||
queryFn: async () => {
|
||||
const result = await getTvShowsApi(api).getSeasons({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
seriesId: item.data.Id,
|
||||
// isSpecialSeason: false,
|
||||
});
|
||||
@@ -160,7 +153,7 @@ function SeriesTitlePage() {
|
||||
queryKey: ["item", id, "nextUp"],
|
||||
queryFn: async () => {
|
||||
const result = await getTvShowsApi(api).getNextUp({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
limit: 1,
|
||||
parentId: item.data.Id,
|
||||
disableFirstEpisode: true,
|
||||
@@ -189,7 +182,7 @@ function SeriesTitlePage() {
|
||||
queryKey: ["item", id, "season", currentSeason],
|
||||
queryFn: async () => {
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
itemId: seasons.data.Items[currentSeason].Id,
|
||||
});
|
||||
return result.data;
|
||||
@@ -203,7 +196,7 @@ function SeriesTitlePage() {
|
||||
queryKey: ["item", id, "season", currentSeason, "episodes"],
|
||||
queryFn: async () => {
|
||||
const result = await getTvShowsApi(api).getEpisodes({
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
seriesId: item.data.Id,
|
||||
seasonId: seasons.data.Items[currentSeason].Id,
|
||||
fields: [ItemFields.Overview],
|
||||
@@ -221,7 +214,7 @@ function SeriesTitlePage() {
|
||||
queryFn: async () => {
|
||||
const result = await getUserLibraryApi(api).getSpecialFeatures({
|
||||
itemId: item.data.Id,
|
||||
userId: user.data.Id,
|
||||
userId: user?.Id,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
@@ -236,13 +229,13 @@ function SeriesTitlePage() {
|
||||
useLayoutEffect(() => {
|
||||
if (item.isSuccess) {
|
||||
// setBackdropImage({
|
||||
// url: api.getItemImageUrl(item.data?.Id, "Backdrop", {
|
||||
// url: getImageUrlsApi(api).getItemImageUrlById(item.data?.Id, "Backdrop", {
|
||||
// tag: item.data?.BackdropImageTags[0],
|
||||
// }),
|
||||
// key: item.data?.BackdropImageTags[0],
|
||||
// });
|
||||
// setBackdrop(
|
||||
// api.getItemImageUrl(item.data?.Id, "Backdrop", {
|
||||
// getImageUrlsApi(api).getItemImageUrlById(item.data?.Id, "Backdrop", {
|
||||
// tag: item.data?.BackdropImageTags[0],
|
||||
// }),
|
||||
// item.data.Id,
|
||||
@@ -283,31 +276,43 @@ function SeriesTitlePage() {
|
||||
) {
|
||||
sessionStorage.setItem(
|
||||
`backdrop-${item.data?.Id}`,
|
||||
api.getItemImageUrl(currentSeasonItem.data.Id, "Backdrop", {
|
||||
tag: currentSeasonItem.data.BackdropImageTags?.[0],
|
||||
}),
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
currentSeasonItem.data.Id,
|
||||
"Backdrop",
|
||||
{
|
||||
tag: currentSeasonItem.data.BackdropImageTags?.[0],
|
||||
},
|
||||
),
|
||||
);
|
||||
sessionStorage.setItem(
|
||||
`backdrop-${item.data?.Id}-key`,
|
||||
currentSeasonItem.data.BackdropImageTags?.[0],
|
||||
);
|
||||
setBackdropImage({
|
||||
url: api.getItemImageUrl(currentSeasonItem.data.Id, "Backdrop", {
|
||||
tag: currentSeasonItem.data.BackdropImageTags?.[0],
|
||||
}),
|
||||
url: getImageUrlsApi(api).getItemImageUrlById(
|
||||
currentSeasonItem.data.Id,
|
||||
"Backdrop",
|
||||
{
|
||||
tag: currentSeasonItem.data.BackdropImageTags?.[0],
|
||||
},
|
||||
),
|
||||
key: currentSeasonItem.data.BackdropImageTags?.[0],
|
||||
});
|
||||
setBackdrop(
|
||||
api.getItemImageUrl(currentSeasonItem.data.Id, "Backdrop", {
|
||||
tag: currentSeasonItem.data.BackdropImageTags?.[0],
|
||||
}),
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
currentSeasonItem.data.Id,
|
||||
"Backdrop",
|
||||
{
|
||||
tag: currentSeasonItem.data.BackdropImageTags?.[0],
|
||||
},
|
||||
),
|
||||
currentSeasonItem.data.BackdropImageTags?.[0],
|
||||
);
|
||||
setBackdropImageLoaded(false);
|
||||
} else if (item.isSuccess && item.data?.BackdropImageTags?.length > 0) {
|
||||
sessionStorage.setItem(
|
||||
`backdrop-${item.data?.Id}`,
|
||||
api.getItemImageUrl(item.data.Id, "Backdrop", {
|
||||
getImageUrlsApi(api).getItemImageUrlById(item.data.Id, "Backdrop", {
|
||||
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
|
||||
}
|
||||
setBackdropImage({
|
||||
url: api.getItemImageUrl(item.data?.Id, "Backdrop", {
|
||||
tag: item.data?.BackdropImageTags?.[0],
|
||||
}),
|
||||
url: getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data?.Id,
|
||||
"Backdrop",
|
||||
{
|
||||
tag: item.data?.BackdropImageTags?.[0],
|
||||
},
|
||||
),
|
||||
key: item.data?.BackdropImageTags?.[0],
|
||||
});
|
||||
setBackdrop(
|
||||
api.getItemImageUrl(item.data.Id, "Backdrop", {
|
||||
getImageUrlsApi(api).getItemImageUrlById(item.data.Id, "Backdrop", {
|
||||
tag: item.data.BackdropImageTags?.[0],
|
||||
}),
|
||||
item.data.BackdropImageTags?.[0],
|
||||
@@ -438,10 +447,14 @@ function SeriesTitlePage() {
|
||||
/>
|
||||
<img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
},
|
||||
)}
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
}}
|
||||
@@ -458,11 +471,15 @@ function SeriesTitlePage() {
|
||||
{Object.keys(item.data.ImageTags).includes("Logo") ? (
|
||||
<img
|
||||
alt={item.data.Name}
|
||||
src={api.getItemImageUrl(item.data.Id, "Logo", {
|
||||
quality: 90,
|
||||
fillWidth: 592,
|
||||
fillHeight: 592,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id,
|
||||
"Logo",
|
||||
{
|
||||
quality: 90,
|
||||
fillWidth: 592,
|
||||
fillHeight: 592,
|
||||
},
|
||||
)}
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
}}
|
||||
@@ -594,7 +611,7 @@ function SeriesTitlePage() {
|
||||
currentAudioTrack={0}
|
||||
currentVideoTrack={0}
|
||||
currentSubTrack="nosub"
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
buttonProps={{
|
||||
fullWidth: true,
|
||||
}}
|
||||
@@ -610,14 +627,14 @@ function SeriesTitlePage() {
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isFavorite={item.data.UserData.IsFavorite}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
<MarkPlayedButton
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isPlayed={item.data.UserData.Played}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -672,11 +689,15 @@ function SeriesTitlePage() {
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
@@ -720,11 +741,15 @@ function SeriesTitlePage() {
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
@@ -768,11 +793,15 @@ function SeriesTitlePage() {
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
@@ -816,11 +845,15 @@ function SeriesTitlePage() {
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
alt={actor.Name}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
actor.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
@@ -870,7 +903,7 @@ function SeriesTitlePage() {
|
||||
`season ${currentSeason + 1}`,
|
||||
"episodes",
|
||||
]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
@@ -927,7 +960,7 @@ function SeriesTitlePage() {
|
||||
itemId={currentSeasonItem.data.Id}
|
||||
isFavorite={currentSeasonItem.data.UserData.IsFavorite}
|
||||
queryKey={["item", id, "season", currentSeason]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
itemName={currentSeasonItem.data.Name}
|
||||
/>
|
||||
)}
|
||||
@@ -937,7 +970,7 @@ function SeriesTitlePage() {
|
||||
itemId={currentSeasonItem.data.Id}
|
||||
isPlayed={currentSeasonItem.data.UserData.Played}
|
||||
queryKey={["item", id, "season", currentSeason]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
itemName={currentSeasonItem.data.Name}
|
||||
/>
|
||||
</>
|
||||
@@ -1007,7 +1040,7 @@ function SeriesTitlePage() {
|
||||
<Typography variant="subtitle1" textAlign="center">
|
||||
{episode.IndexNumberEnd
|
||||
? `${episode.IndexNumber} / ${episode.IndexNumberEnd}`
|
||||
: episode.IndexNumber ?? 0}
|
||||
: (episode.IndexNumber ?? 0)}
|
||||
</Typography>
|
||||
<div
|
||||
className={
|
||||
@@ -1022,7 +1055,7 @@ function SeriesTitlePage() {
|
||||
itemId={episode.Id}
|
||||
itemType={BaseItemKind.Episode}
|
||||
itemUserData={episode.UserData}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
currentAudioTrack={0}
|
||||
currentVideoTrack={0}
|
||||
currentSubTrack="nosub"
|
||||
@@ -1043,10 +1076,14 @@ function SeriesTitlePage() {
|
||||
</div>
|
||||
<img
|
||||
alt={episode.Name}
|
||||
src={api.getItemImageUrl(episode.Id, "Primary", {
|
||||
tag: episode.ImageTags.Primary,
|
||||
fillHeight: 300,
|
||||
})}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
episode.Id,
|
||||
"Primary",
|
||||
{
|
||||
tag: episode.ImageTags.Primary,
|
||||
fillHeight: 300,
|
||||
},
|
||||
)}
|
||||
className="item-detail-episode-image"
|
||||
onLoad={(e) => {
|
||||
e.target.style.opacity = 1;
|
||||
@@ -1112,7 +1149,7 @@ function SeriesTitlePage() {
|
||||
`season ${currentSeason + 1}`,
|
||||
"episodes",
|
||||
]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
<MarkPlayedButton
|
||||
itemId={episode.Id}
|
||||
@@ -1124,7 +1161,7 @@ function SeriesTitlePage() {
|
||||
`season ${currentSeason + 1}`,
|
||||
"episodes",
|
||||
]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
</motion.div>
|
||||
@@ -1157,7 +1194,7 @@ function SeriesTitlePage() {
|
||||
Object.keys(special.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
onClick={() => {}}
|
||||
/>
|
||||
);
|
||||
@@ -1202,7 +1239,7 @@ function SeriesTitlePage() {
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user.data.Id}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!similar.ImageBlurHashes?.Primary &&
|
||||
similar.ImageBlurHashes?.Primary[
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { getDefaultServer } from "@/utils/storage/servers";
|
||||
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("/")({
|
||||
errorComponent: (error) => {
|
||||
console.error(error.error);
|
||||
},
|
||||
beforeLoad: async () => {
|
||||
console.log("Hello");
|
||||
const currentServerId = await getDefaultServer();
|
||||
const userOnDisk = await getUser();
|
||||
if (currentServerId) {
|
||||
|
||||
@@ -298,4 +298,8 @@ h1 {
|
||||
|
||||
.opacity-07{
|
||||
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 { Store } from "@tauri-apps/plugin-store";
|
||||
import { load } from "@tauri-apps/plugin-store";
|
||||
|
||||
export interface ServerInfo extends RecommendedServerInfo {
|
||||
id: string;
|
||||
@@ -10,7 +10,7 @@ export interface ServerStore {
|
||||
servers: ServerInfo[];
|
||||
}
|
||||
|
||||
const store = new Store(".servers.dat");
|
||||
const store = await load(".servers.dat", { autoSave: true });
|
||||
|
||||
/**
|
||||
* Set server in .servers.dat
|
||||
@@ -40,10 +40,12 @@ export const setDefaultServer = async (
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
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:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Store } from "@tauri-apps/plugin-store";
|
||||
import { load } from "@tauri-apps/plugin-store";
|
||||
|
||||
export interface UserStore {
|
||||
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
|
||||
|
||||
+10
-10
@@ -1,7 +1,9 @@
|
||||
import { type Api, Jellyfin } from "@jellyfin/sdk";
|
||||
import React, { type ReactNode } 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";
|
||||
|
||||
// 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";
|
||||
|
||||
type ApiStore = {
|
||||
api: Api;
|
||||
api: Api | undefined;
|
||||
deviceId: string | null;
|
||||
jellyfin: Jellyfin;
|
||||
createApi: (serverAddress: string, accessToken?: string | undefined) => void;
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const axiosClient = axios.create({
|
||||
// adapter: axiosTauriApiAdapter,
|
||||
headers: {
|
||||
@@ -50,12 +55,7 @@ export const ApiProvider = ({ children }: { children: ReactNode }) => {
|
||||
jellyfin: jellyfin,
|
||||
createApi: (serverAddress, accessToken?) =>
|
||||
set((state) => {
|
||||
const apiTemp = state.jellyfin.createApi(
|
||||
serverAddress,
|
||||
accessToken,
|
||||
axiosClient,
|
||||
);
|
||||
console.info(apiTemp);
|
||||
const apiTemp = state.jellyfin.createApi(serverAddress, accessToken);
|
||||
return {
|
||||
...state,
|
||||
api: apiTemp,
|
||||
@@ -69,7 +69,7 @@ export const ApiProvider = ({ children }: { children: ReactNode }) => {
|
||||
export function useApiInContext<T>(selector?: (state: ApiStore) => T) {
|
||||
const store = useContext(ApiContext);
|
||||
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 { setQueue } from "./queue";
|
||||
|
||||
import { start } from "repl";
|
||||
import { max } from "lodash";
|
||||
import type React from "react";
|
||||
import { shallow } from "zustand/shallow";
|
||||
import { createWithEqualityFn } from "zustand/traditional";
|
||||
import { secToTicks } from "../date/time";
|
||||
import playbackProfile from "../playback-profiles";
|
||||
|
||||
type AudioPlaybackStore = {
|
||||
display: boolean;
|
||||
@@ -16,24 +21,25 @@ type AudioPlaybackStore = {
|
||||
ref: React.Ref<HTMLAudioElement> | null;
|
||||
};
|
||||
};
|
||||
export const useAudioPlayback = create<AudioPlaybackStore>(() => ({
|
||||
display: false,
|
||||
url: "",
|
||||
item: undefined,
|
||||
playlistItemId: undefined,
|
||||
player: {
|
||||
currentTick: 0,
|
||||
playing: false,
|
||||
ref: null,
|
||||
},
|
||||
}));
|
||||
export const useAudioPlayback = createWithEqualityFn<AudioPlaybackStore>(
|
||||
() => ({
|
||||
display: false,
|
||||
url: "",
|
||||
item: undefined,
|
||||
playlistItemId: undefined,
|
||||
player: {
|
||||
currentTick: 0,
|
||||
playing: false,
|
||||
ref: null,
|
||||
},
|
||||
}),
|
||||
shallow,
|
||||
);
|
||||
|
||||
export const playAudio = (
|
||||
url: string,
|
||||
item: BaseItemDto | undefined | null,
|
||||
playlistItemId: string | undefined,
|
||||
queue: BaseItemDto[] | undefined,
|
||||
queueItemIndex: number,
|
||||
): void => {
|
||||
useAudioPlayback.setState({
|
||||
display: true,
|
||||
@@ -41,7 +47,6 @@ export const playAudio = (
|
||||
item,
|
||||
playlistItemId,
|
||||
});
|
||||
setQueue(queue, queueItemIndex);
|
||||
};
|
||||
|
||||
export const generateAudioStreamUrl = (
|
||||
@@ -49,10 +54,41 @@ export const generateAudioStreamUrl = (
|
||||
userId: string,
|
||||
deviceId: 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 = {
|
||||
userId,
|
||||
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();
|
||||
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 { shallow } from "zustand/shallow";
|
||||
import { createWithEqualityFn } from "zustand/traditional";
|
||||
|
||||
export const useCarouselStore = create((set) => ({
|
||||
direction: "right",
|
||||
setDirection: (dir) => set(() => ({ direction: dir })),
|
||||
}));
|
||||
export const useCarouselStore = createWithEqualityFn(
|
||||
(set) => ({
|
||||
direction: "right",
|
||||
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) => ({
|
||||
open: false,
|
||||
setOpen: (sopen) => set((state) => ({ ...state, open: sopen })),
|
||||
}));
|
||||
export const useDrawerStore = createWithEqualityFn(
|
||||
(set) => ({
|
||||
open: false,
|
||||
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,
|
||||
);
|
||||
+52
-46
@@ -6,13 +6,14 @@ import type {
|
||||
import { getMediaInfoApi } from "@jellyfin/sdk/lib/utils/api/media-info-api";
|
||||
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
||||
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 playbackProfile from "../playback-profiles";
|
||||
import type IntroMediaInfo from "../types/introMediaInfo";
|
||||
import type subtitlePlaybackInfo from "../types/subtitlePlaybackInfo";
|
||||
import { axiosClient, useApiInContext } from "./api";
|
||||
import { playAudio } from "./audioPlayback";
|
||||
import { axiosClient } from "./api";
|
||||
import { generateAudioStreamUrl, playAudio } from "./audioPlayback";
|
||||
import useQueue, { setQueue, setTrackIndex } from "./queue";
|
||||
|
||||
type PlaybackStore = {
|
||||
@@ -34,31 +35,34 @@ type PlaybackStore = {
|
||||
intro: IntroMediaInfo | undefined;
|
||||
};
|
||||
|
||||
export const usePlaybackStore = create<PlaybackStore>(() => ({
|
||||
itemName: undefined!,
|
||||
episodeTitle: "",
|
||||
mediaSource: {
|
||||
videoTrack: 0,
|
||||
audioTrack: 0,
|
||||
container: "",
|
||||
id: undefined,
|
||||
subtitle: {
|
||||
enable: false,
|
||||
track: undefined!,
|
||||
format: "ass",
|
||||
allTracks: undefined,
|
||||
url: undefined,
|
||||
export const usePlaybackStore = createWithEqualityFn<PlaybackStore>(
|
||||
() => ({
|
||||
itemName: undefined!,
|
||||
episodeTitle: "",
|
||||
mediaSource: {
|
||||
videoTrack: 0,
|
||||
audioTrack: 0,
|
||||
container: "",
|
||||
id: undefined,
|
||||
subtitle: {
|
||||
enable: false,
|
||||
track: undefined!,
|
||||
format: "ass",
|
||||
allTracks: undefined,
|
||||
url: undefined,
|
||||
},
|
||||
},
|
||||
},
|
||||
enableSubtitle: true,
|
||||
playbackStream: "",
|
||||
userId: "",
|
||||
startPosition: 0,
|
||||
itemDuration: 0,
|
||||
item: null,
|
||||
playsessionId: "",
|
||||
intro: undefined,
|
||||
}));
|
||||
enableSubtitle: true,
|
||||
playbackStream: "",
|
||||
userId: "",
|
||||
startPosition: 0,
|
||||
itemDuration: 0,
|
||||
item: null,
|
||||
playsessionId: "",
|
||||
intro: undefined,
|
||||
}),
|
||||
shallow,
|
||||
);
|
||||
|
||||
export const playItem = (
|
||||
itemName: string | React.Component | undefined | null,
|
||||
@@ -135,16 +139,16 @@ export const playItemFromQueue = async (
|
||||
const prevMediaSourceId = usePlaybackStore.getState().mediaSource.id;
|
||||
const item = queueItems[requestedItemIndex];
|
||||
if (item.Type === "Audio") {
|
||||
const urlOptions = {
|
||||
deviceId: api?.deviceInfo.id,
|
||||
const playbackUrl = generateAudioStreamUrl(
|
||||
item.Id,
|
||||
userId,
|
||||
api_key: api?.accessToken,
|
||||
};
|
||||
const urlParams = new URLSearchParams(urlOptions).toString();
|
||||
|
||||
const playbackUrl = `${api.basePath}/Audio/${item?.Id}/universal?${urlParams}`;
|
||||
api?.deviceInfo.id,
|
||||
api?.basePath,
|
||||
api?.accessToken,
|
||||
);
|
||||
console.log(item);
|
||||
playAudio(playbackUrl, item, undefined, queueItems, requestedItemIndex);
|
||||
playAudio(playbackUrl, item, undefined);
|
||||
setQueue(queueItems, requestedItemIndex);
|
||||
} else {
|
||||
const mediaSource = (
|
||||
await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||
@@ -249,16 +253,18 @@ interface PlaybackDataLoadState {
|
||||
setisPending: (loading: boolean) => void;
|
||||
}
|
||||
|
||||
export const usePlaybackDataLoadStore = create<PlaybackDataLoadState>(
|
||||
(set) => ({
|
||||
isPending: false,
|
||||
setisPending: (loading: boolean) =>
|
||||
set((state: PlaybackDataLoadState) => ({
|
||||
...state,
|
||||
isPending: loading,
|
||||
})),
|
||||
}),
|
||||
);
|
||||
export const usePlaybackDataLoadStore =
|
||||
createWithEqualityFn<PlaybackDataLoadState>(
|
||||
(set) => ({
|
||||
isPending: false,
|
||||
setisPending: (loading: boolean) =>
|
||||
set((state: PlaybackDataLoadState) => ({
|
||||
...state,
|
||||
isPending: loading,
|
||||
})),
|
||||
}),
|
||||
shallow,
|
||||
);
|
||||
|
||||
export const changeSubtitleTrack = (
|
||||
trackIndex: number,
|
||||
@@ -273,7 +279,7 @@ export const changeSubtitleTrack = (
|
||||
track: trackIndex,
|
||||
format: requiredSubtitle?.[0]?.Codec,
|
||||
allTracks,
|
||||
enable: true,
|
||||
enable: trackIndex !== -1,
|
||||
};
|
||||
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 { create } from "zustand";
|
||||
import { shallow } from "zustand/shallow";
|
||||
import { createWithEqualityFn } from "zustand/traditional";
|
||||
|
||||
interface QueueStore {
|
||||
tracks: BaseItemDto[];
|
||||
tracks: BaseItemDto[] | undefined;
|
||||
currentItemIndex: number;
|
||||
}
|
||||
|
||||
const useQueue = create<QueueStore>(() => ({
|
||||
tracks: [],
|
||||
currentItemIndex: 0,
|
||||
}));
|
||||
const useQueue = createWithEqualityFn<QueueStore>(
|
||||
() => ({
|
||||
tracks: [],
|
||||
currentItemIndex: 0,
|
||||
}),
|
||||
shallow,
|
||||
);
|
||||
|
||||
export const setQueue = (
|
||||
tracks: BaseItemDto[] | undefined,
|
||||
@@ -23,4 +27,12 @@ export const setTrackIndex = (index: number) => {
|
||||
useQueue.setState((state) => ({ ...state, currentItemIndex: index }));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Resets the Queue store
|
||||
*/
|
||||
export const clearQueue = () => {
|
||||
useQueue.setState(useQueue.getInitialState());
|
||||
};
|
||||
|
||||
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(() => ({
|
||||
dialogOpen: false,
|
||||
tabValue: 0,
|
||||
}));
|
||||
const useSettingsStore = createWithEqualityFn(
|
||||
() => ({
|
||||
dialogOpen: false,
|
||||
tabValue: 0,
|
||||
}),
|
||||
shallow,
|
||||
);
|
||||
|
||||
const setDialogOpen = (dialog: boolean) =>
|
||||
useSettingsStore.setState((state) => ({ ...state, dialogOpen: dialog }));
|
||||
|
||||
@@ -5,8 +5,8 @@ import type {
|
||||
import type IntroMediaInfo from "./introMediaInfo";
|
||||
|
||||
interface PlayResult {
|
||||
item: BaseItemDtoQueryResult;
|
||||
mediaSource: PlaybackInfoResponse;
|
||||
item: BaseItemDtoQueryResult | undefined;
|
||||
mediaSource: PlaybackInfoResponse | 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