Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
272f74473a | ||
|
|
b02b3a95d2 | ||
|
|
d6c7c29b46 | ||
|
|
f12d92f42c | ||
|
|
aebea6a3b2 | ||
|
|
7c19efa448 | ||
|
|
cb0fb0eef8 | ||
|
|
e21a12e36f | ||
|
|
dbc2243dd4 | ||
|
|
4372ecbb4e | ||
|
|
69d0b4558f | ||
|
|
fc685414be | ||
|
|
68a97196d2 | ||
|
|
1c55dd77ef | ||
|
|
112b2babc1 | ||
|
|
3d40912b6f | ||
|
|
8d00739199 | ||
|
|
b66130950b | ||
|
|
5212e2c497 | ||
|
|
221cd4722a | ||
|
|
c851201872 | ||
|
|
12d771c6c7 | ||
|
|
275a05a0a3 | ||
|
|
65205e5c4e | ||
|
|
1a59605e17 | ||
|
|
3782c79464 | ||
|
|
cceb97d0d6 | ||
|
|
2df503c48a | ||
|
|
03323d954e | ||
|
|
6cb5130b08 | ||
|
|
b1ab16220c | ||
|
|
8ca01ccc2b | ||
|
|
81afd14b55 | ||
|
|
95f5cdd481 | ||
|
|
e33b8ff266 | ||
|
|
42af75b79d | ||
|
|
4e71297f02 | ||
|
|
eca1bcb995 | ||
|
|
4f7d58fe1d | ||
|
|
23e892f45b | ||
|
|
664293d82b | ||
|
|
1e9438227c | ||
|
|
4604b4f103 | ||
|
|
e62e9384d8 | ||
|
|
301dc3dcc1 | ||
|
|
93b79c5fba | ||
|
|
899fcb0479 | ||
|
|
61230c01bb | ||
|
|
059f391e52 | ||
|
|
c73774a3b2 | ||
|
|
8170c4a2d8 | ||
|
|
29ab3e96c7 | ||
|
|
7388876967 | ||
|
|
e2ae87ef9c | ||
|
|
355bbcdbe3 | ||
|
|
57cc216ae8 |
No files matched your search
@@ -0,0 +1,38 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
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]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
@@ -0,0 +1,19 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "npm" # See documentation for possible values
|
||||
directory: "/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
commit-message:
|
||||
prefix: "chore(package-update) NPM"
|
||||
- package-ecosystem: "cargo"
|
||||
directory: "/src-tauri"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
commit-message:
|
||||
prefix: "chore(package-update) CARGO"
|
||||
@@ -41,7 +41,7 @@ jobs:
|
||||
|
||||
- name: Install app dependencies and build web
|
||||
# Remove `&& yarn build` if you build your frontend in `beforeBuildCommand`
|
||||
run: npm install && npm build # Change this to npm, yarn or pnpm.
|
||||
run: npm install && npm run build # Change this to npm, yarn or pnpm.
|
||||
|
||||
- name: Build the app
|
||||
uses: tauri-apps/tauri-action@v0
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||

|
||||
|
||||
# :memo: Prerequisites:
|
||||
# 📝 Prerequisites:
|
||||
- Nodejs (≥19.1.0)
|
||||
- Rust (≥1.66.1)
|
||||
|
||||
# :warning: Getting started:
|
||||
# ℹ️ Getting started:
|
||||
- Install Nodejs and Rust.
|
||||
- install depencies using npm:
|
||||
```shell
|
||||
npm install
|
||||
```
|
||||
|
||||
# :information_source: Development:
|
||||
# 🛠️ Development:
|
||||
- Running the app:
|
||||
```shell
|
||||
npm run tauri dev
|
||||
@@ -22,5 +22,11 @@
|
||||
```
|
||||
- other commands can be found inside the `"scripts"` inside [package.json](https://github.com/prayag17/JellyPlayer/blob/main/package.json)
|
||||
|
||||
# :sos: Help Wanted:
|
||||
- Home sections containing latest media.
|
||||
# 💻 Contribution:
|
||||
- Checkout `issues` to see currently worked on features and bugs
|
||||
- Add features or fix bugs
|
||||
- Create a pull request
|
||||
|
||||
# 📃 Roadmap:
|
||||
- Checkout [GitHub Project](https://github.com/users/prayag17/projects/3)
|
||||
> **Note** : There is no current due date for alpha 1 release
|
||||
@@ -10,7 +10,13 @@
|
||||
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<svg style="width:0;height:0;position:absolute;" aria-hidden="true" focusable="false">
|
||||
<linearGradient id="clr-gradient-default" x2="1" y2="1">
|
||||
<stop offset="0%" stop-color="hsl(337, 96%, 56%)" />
|
||||
<stop offset="100%" stop-color="hsl(273, 100%, 36%)" />
|
||||
</linearGradient>
|
||||
</svg>
|
||||
<script type="module" src="/src/main.jsx"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jellyplayer",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"version": "1.0.0-alpha0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -14,21 +14,28 @@
|
||||
"@emotion/styled": "^11.10.5",
|
||||
"@fontsource/open-sans": "^4.5.13",
|
||||
"@jellyfin/sdk": "^0.7.0",
|
||||
"@mdi/js": "^7.1.96",
|
||||
"@mui/lab": "^5.0.0-alpha.110",
|
||||
"@mui/material": "^5.10.15",
|
||||
"@mdi/js": "^7.2.96",
|
||||
"@mui/lab": "^5.0.0-alpha.124",
|
||||
"@mui/material": "^5.11.14",
|
||||
"@reduxjs/toolkit": "^1.9.3",
|
||||
"@tanstack/react-query": "^4.26.1",
|
||||
"@tanstack/react-query-devtools": "^4.28.0",
|
||||
"blurhash": "^2.0.5",
|
||||
"events": "^3.3.0",
|
||||
"framer-motion": "^7.10.2",
|
||||
"framer-motion": "^10.10.0",
|
||||
"localforage": "^1.10.0",
|
||||
"match-sorter": "^6.3.1",
|
||||
"mdi-material-ui": "^7.6.0",
|
||||
"notistack": "^2.0.8",
|
||||
"notistack": "^3.0.1",
|
||||
"react": "^18.2.0",
|
||||
"react-blurhash": "^0.3.0",
|
||||
"react-cookie": "^4.1.1",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-material-ui-carousel": "^3.4.2",
|
||||
"react-multi-carousel": "^2.8.2",
|
||||
"react-router-dom": "^6.4.3",
|
||||
"react-parallax": "^3.5.1",
|
||||
"react-redux": "^8.0.5",
|
||||
"react-router-dom": "^6.9.0",
|
||||
"redux": "^4.2.1",
|
||||
"sort-by": "^1.2.0",
|
||||
"tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store",
|
||||
"uuid": "^9.0.0",
|
||||
@@ -38,9 +45,9 @@
|
||||
"@tauri-apps/cli": "^1.2.2",
|
||||
"@types/react": "^18.0.24",
|
||||
"@types/react-dom": "^18.0.8",
|
||||
"@vitejs/plugin-react": "^2.2.0",
|
||||
"sass": "^1.56.1",
|
||||
"vite": "^3.2.3"
|
||||
"@vitejs/plugin-react": "^3.1.0",
|
||||
"sass": "^1.59.3",
|
||||
"vite": "^4.2.1"
|
||||
},
|
||||
"license": "GPL-3.0-only"
|
||||
}
|
||||
|
Before Width: | Height: | Size: 289 KiB After Width: | Height: | Size: 289 KiB |
|
After Width: | Height: | Size: 71 KiB |
@@ -0,0 +1,57 @@
|
||||
<svg width="1197" height="247" viewBox="0 0 1197 247" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g clip-path="url(#clip0_504_8)">
|
||||
<path d="M169.982 114.384C171.569 115.293 172.888 116.605 173.805 118.187C174.722 119.769 175.205 121.566 175.205 123.395C175.205 125.224 174.722 127.021 173.805 128.603C172.888 130.185 171.569 131.497 169.982 132.406L87.6225 180.207C80.8918 184.117 71.6631 179.65 71.6631 171.196V123.395V75.5942C71.6631 67.1397 80.8918 62.673 87.6225 66.583L128.802 90.4834L169.982 114.384Z" fill="url(#pattern0)"/>
|
||||
<g filter="url(#filter0_d_504_8)">
|
||||
<path d="M71.6631 123.395V171.196C71.6631 179.65 80.8918 184.117 87.6225 180.207L169.982 132.406C171.569 131.497 172.888 130.185 173.805 128.603C174.722 127.021 175.205 125.224 175.205 123.395C175.205 121.566 174.722 119.769 173.805 118.187C172.888 116.605 171.569 115.293 169.982 114.384L128.802 90.4834M71.6631 123.395V75.5942C71.6631 67.1397 80.8918 62.673 87.6225 66.583L128.802 90.4834M71.6631 123.395L128.802 90.4834" stroke="white" stroke-width="10" shape-rendering="crispEdges"/>
|
||||
</g>
|
||||
<g clip-path="url(#clip1_504_8)">
|
||||
<path d="M268.49 132.788C263.093 132.788 258.076 131.572 253.438 129.139C248.801 126.63 245 123.209 242.035 118.876C239.071 114.543 237.322 109.754 236.79 104.509H241.009C241.541 108.994 243.1 113.099 245.684 116.824C248.269 120.473 251.538 123.362 255.491 125.49C259.52 127.543 263.853 128.569 268.49 128.569C273.584 128.569 278.259 127.315 282.516 124.806C286.773 122.297 290.156 118.838 292.665 114.429C295.173 110.02 296.428 105.079 296.428 99.6052V55.9316H260.85V51.7125H300.533V99.6052C300.533 105.839 299.089 111.502 296.2 116.596C293.387 121.613 289.51 125.566 284.569 128.455C279.703 131.344 274.344 132.788 268.49 132.788Z" fill="white"/>
|
||||
<path d="M326.901 51.7125H382.775V55.9316H331.12V88.0881H376.048V92.3073H331.12V126.858H382.775V131.078H326.901V51.7125Z" fill="white"/>
|
||||
<path d="M414.16 131.078V51.7125H418.38V126.858H473.684V131.078H414.16Z" fill="white"/>
|
||||
<path d="M498.569 131.078V51.7125H502.789V126.858H558.093V131.078H498.569Z" fill="white"/>
|
||||
<path d="M579.444 51.7125L607.609 94.1318L635.546 51.7125H640.564L609.662 98.5789V131.078H605.442V98.5789L574.426 51.7125H579.444Z" fill="white"/>
|
||||
<path d="M669.782 131.078H665.563V51.7125H697.492C702.813 51.7125 707.716 52.8528 712.201 55.1334C716.763 57.414 720.374 60.6448 723.034 64.826C725.695 69.0071 727.025 73.8344 727.025 79.3078C727.025 84.5532 725.657 89.3805 722.92 93.7897C720.26 98.1988 716.611 101.582 711.973 103.938C707.944 105.991 703.117 107.017 697.492 107.017H669.782V131.078ZM669.782 102.798H697.492C702.357 102.798 706.348 102.038 709.465 100.517C713.494 98.6169 716.725 95.7662 719.157 91.9652C721.59 88.1642 722.806 83.945 722.806 79.3078C722.806 74.7466 721.59 70.5655 719.157 66.7645C716.725 62.9635 713.456 60.1127 709.351 58.2122C706.234 56.6918 702.281 55.9316 697.492 55.9316H669.782V102.798Z" fill="white"/>
|
||||
<path d="M751.797 131.078V51.7125H756.016V126.858H811.32V131.078H751.797Z" fill="white"/>
|
||||
<path d="M898.124 131.078H823.32L860.722 50.002L898.124 131.078Z" fill="url(#paint0_linear_504_8)"/>
|
||||
<path d="M917.08 51.7125L945.245 94.1318L973.183 51.7125H978.2L947.298 98.5789V131.078H943.079V98.5789L912.062 51.7125H917.08Z" fill="white"/>
|
||||
<path d="M1002.17 51.7125H1058.05V55.9316H1006.39V88.0881H1051.32V92.3073H1006.39V126.858H1058.05V131.078H1002.17V51.7125Z" fill="white"/>
|
||||
<path d="M1131.17 54.3352C1135.73 56.4637 1139.3 59.6186 1141.89 63.7997C1144.55 67.9808 1145.88 72.618 1145.88 77.7114C1145.88 83.641 1144.05 88.9624 1140.4 93.6756C1136.83 98.3129 1131.24 102.013 1125.62 103.534L1085.78 51.7125H1116C1119.35 51.7125 1122.2 51.9405 1124.55 52.3966C1126.99 52.7767 1129.19 53.4229 1131.17 54.3352Z" fill="url(#paint1_linear_504_8)"/>
|
||||
<path d="M1146.79 131.078L1125.62 103.534H1085.78V131.078H1146.79Z" fill="url(#paint2_linear_504_8)"/>
|
||||
<path d="M256.77 180.696H242.154L238.95 187.788H236.97L248.562 162.588H250.398L261.99 187.788H260.01L256.77 180.696ZM256.086 179.148L249.462 164.604L242.874 179.148H256.086ZM303.243 187.788L303.207 166.224L292.659 184.44H291.759L281.211 166.296V187.788H279.411V162.588H280.959L292.227 182.064L303.495 162.588H305.007L305.043 187.788H303.243ZM326.321 187.968C323.849 187.968 321.617 187.416 319.625 186.312C317.633 185.184 316.061 183.648 314.909 181.704C313.781 179.76 313.217 177.588 313.217 175.188C313.217 172.788 313.781 170.616 314.909 168.672C316.061 166.728 317.633 165.204 319.625 164.1C321.617 162.972 323.849 162.408 326.321 162.408C328.793 162.408 331.025 162.96 333.017 164.064C335.009 165.168 336.569 166.692 337.697 168.636C338.849 170.58 339.425 172.764 339.425 175.188C339.425 177.612 338.849 179.796 337.697 181.74C336.569 183.684 335.009 185.208 333.017 186.312C331.025 187.416 328.793 187.968 326.321 187.968ZM326.321 186.276C328.433 186.276 330.341 185.796 332.045 184.836C333.749 183.876 335.093 182.556 336.077 180.876C337.061 179.172 337.553 177.276 337.553 175.188C337.553 173.1 337.061 171.216 336.077 169.536C335.093 167.832 333.749 166.5 332.045 165.54C330.341 164.58 328.433 164.1 326.321 164.1C324.209 164.1 322.289 164.58 320.561 165.54C318.857 166.5 317.513 167.832 316.529 169.536C315.545 171.216 315.053 173.1 315.053 175.188C315.053 177.276 315.545 179.172 316.529 180.876C317.513 182.556 318.857 183.876 320.561 184.836C322.289 185.796 324.209 186.276 326.321 186.276ZM347.593 162.588H357.565C360.181 162.588 362.497 163.128 364.513 164.208C366.553 165.288 368.137 166.788 369.265 168.708C370.393 170.604 370.957 172.764 370.957 175.188C370.957 177.612 370.393 179.784 369.265 181.704C368.137 183.6 366.553 185.088 364.513 186.168C362.497 187.248 360.181 187.788 357.565 187.788H347.593V162.588ZM357.421 186.132C359.749 186.132 361.801 185.676 363.577 184.764C365.353 183.828 366.721 182.532 367.681 180.876C368.641 179.22 369.121 177.324 369.121 175.188C369.121 173.052 368.641 171.156 367.681 169.5C366.721 167.844 365.353 166.56 363.577 165.648C361.801 164.712 359.749 164.244 357.421 164.244H349.429V186.132H357.421ZM396.523 186.132V187.788H379.135V162.588H395.983V164.244H380.971V174.18H394.399V175.8H380.971V186.132H396.523ZM422.513 187.788L416.501 179.364C415.613 179.484 414.797 179.544 414.053 179.544H406.853V187.788H405.017V162.588H414.053C417.221 162.588 419.705 163.344 421.505 164.856C423.305 166.344 424.205 168.42 424.205 171.084C424.205 173.076 423.689 174.756 422.657 176.124C421.649 177.468 420.197 178.416 418.301 178.968L424.601 187.788H422.513ZM414.053 177.924C416.741 177.924 418.793 177.336 420.209 176.16C421.625 174.96 422.333 173.268 422.333 171.084C422.333 168.9 421.625 167.22 420.209 166.044C418.793 164.844 416.741 164.244 414.053 164.244H406.853V177.924H414.053ZM453.247 162.588V187.788H451.735L434.563 165.9V187.788H432.727V162.588H434.275L451.411 184.476V162.588H453.247ZM477.162 187.968C475.794 187.968 474.51 187.656 473.31 187.032C472.134 186.384 471.186 185.496 470.466 184.368L471.582 183.144C472.278 184.176 473.094 184.968 474.03 185.52C474.99 186.048 476.034 186.312 477.162 186.312C478.842 186.312 480.09 185.832 480.906 184.872C481.746 183.888 482.166 182.388 482.166 180.372V164.244H472.878V162.588H484.002V180.372C484.002 182.892 483.426 184.788 482.274 186.06C481.122 187.332 479.418 187.968 477.162 187.968ZM511.765 186.132V187.788H494.377V162.588H511.225V164.244H496.213V174.18H509.641V175.8H496.213V186.132H511.765ZM520.259 162.588H522.095V186.132H536.603V187.788H520.259V162.588ZM543.118 162.588H544.954V186.132H559.462V187.788H543.118V162.588ZM571.081 179.112V187.788H569.245V179.112L559.093 162.588H561.109L570.217 177.42L579.325 162.588H581.233L571.081 179.112ZM588.843 164.244V175.008H602.271V176.664H588.843V187.788H587.007V162.588H603.855V164.244H588.843ZM611.518 162.588H613.354V187.788H611.518V162.588ZM644.455 162.588V187.788H642.943L625.771 165.9V187.788H623.935V162.588H625.483L642.619 184.476V162.588H644.455ZM676.758 187.968C674.286 187.968 672.054 187.416 670.062 186.312C668.094 185.208 666.534 183.684 665.382 181.74C664.254 179.796 663.69 177.612 663.69 175.188C663.69 172.764 664.254 170.58 665.382 168.636C666.534 166.692 668.094 165.168 670.062 164.064C672.054 162.96 674.286 162.408 676.758 162.408C678.582 162.408 680.262 162.708 681.798 163.308C683.334 163.884 684.642 164.748 685.722 165.9L684.57 167.088C682.554 165.096 679.974 164.1 676.83 164.1C674.718 164.1 672.798 164.58 671.07 165.54C669.342 166.5 667.986 167.832 667.002 169.536C666.018 171.216 665.526 173.1 665.526 175.188C665.526 177.276 666.018 179.172 667.002 180.876C667.986 182.556 669.342 183.876 671.07 184.836C672.798 185.796 674.718 186.276 676.83 186.276C679.95 186.276 682.53 185.268 684.57 183.252L685.722 184.44C684.642 185.592 683.322 186.468 681.762 187.068C680.226 187.668 678.558 187.968 676.758 187.968ZM693.671 162.588H695.507V186.132H710.015V187.788H693.671V162.588ZM716.53 162.588H718.366V187.788H716.53V162.Line truncated
|
||||
</g>
|
||||
</g>
|
||||
<defs>
|
||||
<pattern id="pattern0" patternContentUnits="objectBoundingBox" width="1" height="1">
|
||||
<use xlink:href="#image0_504_8" transform="matrix(0 -0.000244141 0.000274658 0 -0.0625001 1)"/>
|
||||
</pattern>
|
||||
<filter id="filter0_d_504_8" x="-21.3369" y="-25.8237" width="293.542" height="306.437" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dx="2" dy="4"/>
|
||||
<feGaussianBlur stdDeviation="45"/>
|
||||
<feComposite in2="hardAlpha" operator="out"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0"/>
|
||||
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_504_8"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_504_8" result="shape"/>
|
||||
</filter>
|
||||
<linearGradient id="paint0_linear_504_8" x1="879.722" y1="91.7373" x2="824.111" y2="130.497" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#FB2576"/>
|
||||
<stop offset="1" stop-color="#150050"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_504_8" x1="1138.4" y1="59.7188" x2="1086.16" y2="130.497" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#FB2576"/>
|
||||
<stop offset="1" stop-color="#150050"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint2_linear_504_8" x1="1138.4" y1="59.7188" x2="1086.16" y2="130.497" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#FB2576"/>
|
||||
<stop offset="1" stop-color="#150050"/>
|
||||
</linearGradient>
|
||||
<clipPath id="clip0_504_8">
|
||||
<rect width="1196.79" height="246.79" fill="white"/>
|
||||
</clipPath>
|
||||
<clipPath id="clip1_504_8">
|
||||
<rect width="910" height="146.786" fill="white" transform="translate(236.79 50.002)"/>
|
||||
</clipPath>
|
||||
<image id="image0_504_8" width="4096" height="4096" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAEAAAABAACAYAAADyoyQXAAAAAXNSR0IArs4c6QAAIABJREFUeF7s/QmS5DquNIxm3V7I/63jvv0v6556poEiAGJwJ6nIrNPV1nYqU8LgcAxSKETmr//39f/7/fX19fXr+I/5nz2WySD6nh9ED5GRthF5RIbF69scjzK8ormJ5CpeGPuI7AyvqM6af+1F/ub5n/XVWmjWvvUbYUPyjcqgcihPsZx/BuFqhRfUPtrvckwivRzJZ7lFsDD61RSq4mB8Ididyw10Dcpqtbp+IT3t4fJ6esex3RxUOcowV7zOzKHKJst1hb/y90YMKOdIbVb4URtoXc3yv2qf5ext+YyHFc4Zu4wsywdjm5X9SVhY7JH8+YFow/9W7WD6WirT6edmdDQhkR//+O8ve1z+np37MpqjbBSV1dS/X1oR2jxW6THGPtrmOIgzWduJObkiG6NvGmNe4loZdXy/nu0YA+qvlutZ1PXn47mZ+R8RQxtu/zce+/0/okZuOcnqbzsY//n6ksceWSH34HKG6hnB9f/rf8pny6rh5JS5PZmiUb/+6vx4Vff7PPhb4W8wxlo0tXX8arDaaeD6PHR+j3PjxGFm85DPX52oWHb06svmNd15QOwZbkQctppdTm55a+VOj2Kl1wniU9eWz7o3E+Me9KdMr1+L+feRsyCvIceyHwJu4jrNMuddGTxWbjm3t3JuIn6iq5KXxYExxcdYt15N3Z1dcs/JtbHj987gzF6JTS14cUZ5lZmL4o049q5JJVbTdZBPR8ivrjbXPRT92Kwunh0MR8rV4yxjaIOfnCrnbI2HMbnXGuMZkV3/tLZu4TM4ES9rMp0JnhNeQ2P95T4r5eLhMFTPj9/wHSPksF/YtE5uAbV/yWHSqBQm58VkczBXob7/tfyjSLjYcelakslkxT1Tabav4xzKM3U8Xdrjfk4/RzBvc0+fozMRw8nVAzNNMP9RjaHdGc/jlXpgMjUfJ+Kltl5LNI5RyXzSr2YGR+HnFp2xUWWs+Ue7D6lL5F5i7XpUeVjjorK+7/z8lWYfBsTSgfPnfTLyEf08nD7DO3GyTwIsojUs2fMLpLpmaqt+Ood5vqTq+HMJ6KlRCIjPXuyvfgobRVxz0ANgEKN2oyrC9SXB8/karWAIUClMjqtL1OZ63YxFjFYc1me2xub7HMWFcqfx11q1RMsxKonPKdwi+h064tubD3nWeZy1Ri3RcOLXrdomMxGr3kYrN77CMX3uWanjza+u811bcYNc1fG8Rtb4+FcjRuLaK8PHyPrf42GPFRb7v1n+T/l0/H05+LMZ+rPR7836Xi4Ka+b0Xt84L/v9Ms/HcZyM5P6YpHfu24IMN44TeOIqjOF25VPuWquW0NEyTywZ2+zTd1c+cDhgvm8pPHH3ufQvbH3tIYXZPDitZT2uz2OOk1DWFKsbnzEpZSTKX6oe+y9WXv/eAOh4K1vXK2QX8c1e/zeqQuPjdn0cvfz18+evv8Xvt8lT9tEbdRQfwn5Li8UY/n6cuP17MqOf64jE1mQU34fNJ5avr1/3S8uPXuPh5vex+fuy/etWPvi/OOocPHYbb4fMP4ePO/r/XD//+ufy1mxbnH68vVC1vM6HrDrLx2Wh82Tz2DFpfLJCNb+6dptWj0tfQ+zx63edSWs/smmPt8wPNfD/vv5XpCgb1o0eX0YWUQ97vNRZuVk9b47phM3HotOCx5DHIkuPw4Zy5HFij+205eV5xv6MTpSj2pafh1pvrH9PB+UkyhWSr6y/ZvWjWOTx9Xh9C8hMmI2L0ctmyjgF8nmIyGd8IljW9LV2lYM1X9hLkmgPZr3Dzu6ql3bZq/hjrpnInI/qD507Vh/tfUZvBmOV+zdwztp8I76qHmd9ruYNrW+m32Zkq/rI+EHOsXEiNmdk/uKYYQ3T2fmV0YotTBf/6jD6kjnzE53jjv9ZGwAcVSLjs7FKHuNz1gqyIUGvT2ZR34i1ep3gOh/F2I57VjydqAJHO/52Dlourmc0Tq82JZ8ersb8b3cDgM5WW8T/XRsAqLzdF4GIvwvrnWtDysBRsgnAtQHA8bxxZNavf1Ffx48FzrFT7s0SzgXNo4eo557jh78bdC4b15pgTl00otpBFs1fNsfe8yaFX8N3Hh5EpkOFUufC9zf4NHxVmzRUs0HbH6WfI5O11QZYzFOeW4kPz10w0x0QHus7sKYL3IcNEUYUr2MY1/67G87YOzGF67m5DWrXq/Ph1i5/jcvjAbv65q8yxt1m9AwAr5+ea1Jx2zqrG3MwcyYGeVoLTfon8vz4vmZ0CmrFadw6Lol7n5Pc/ylxv8UjsnesznHmaeX4OPSc9IgGePEjDXzOf9ea0++QcP1REtfVFOTPujPZmMrLJoYIlcLkLkxMTaJ2fTnmqFev7ViNopZosaOSFU+dSdxiZnO+ZhlNFKvXtaiuX2OxNmqXmSS4TVTye+sBR/nZDUtQXJ+q0WjqMte+OiZmgtczl7c2d92JtOp48/shXH/tehDn1p7BEdXXQ+5ekPPM2d6Vhd0x74ziT7bFfXrjpHfzstN79UQkw74Dx2iDs8pJj9FkT26qvK36Puwz3/hEeJgYMMzoYkjG84Uefe6D4fRs7sLU2M6es8UVovHvebKGRoZzh+YZWcjN88SwgseUf9tY9XRco+OZVUx5P9dI0XrIY5J+8HqobfL14NtEJwbSiytXO22fYaquEyaT2Rxdq9Fx4llO60jqukDrukaz2j++PpPZyEIdo60mTwNjm/W1X/4dnPut7re4n8ufa/H7Ph0znPwZKJmIPiX7l7nONMcFJ+3mU5jYYG2qZNb88tq8xlRY4Hd1le0c7WostT7x/clULc09x65x257CNDCpy7aWrTVdiUBNsS5uHzxxL0NywXpjYtSNuZ+RjSqlxrKOQ/puP1eL9q8c+ovw7YYHp83bsLeo/jzdXta9NwHwMOm6STYAOAWxDQCkTW/x+nhM891+e3i7q/v4PT8mIjyw3nXadW7PxyL7m0Bt7+JMbQBw+HY2AegbAwibd+BPfM8mAPei+gPP/9yL/MVLwc8mAP+5MI8bAHRGJQd2QwabX7cG1ZwYN0VoNdg8Su5sXi13tn49rNexnm/Z1/b4kDdRBxKfrJe8Rka/v9oGALYRxoHqDVk9dMchNX7dvkvGw6fJ1BdyxG9lMxrcmd9P8RpfVPgcobY8OZRn3Uw6V+/71wMXrXUr58WKchL5nPUhGazqcRbjeryxBQSz1Y6sVXJZHAz/6LyIcpPVAGKbiWO0N2qz85OJq8LK9GDFGzs/PmXvbQ4Q++jcsRMZ7X1Gz5/619E3/H3a5hvxZT2X+as4Xc0bWntZb0b437RdcbbKC2sflWc5Qe2ycj8FB4s7k9/59dCKLUwXfcEkXjqY+YnOccf/bgBw1JvlTP4+nsNfihntVK9cjK8ZeFg8K7mcjrLJxnFqHN7LD5Gulc24vFCN0XgMXwv7b+ttuP3feCzeAOD2ZgfjP89ztHP0PL7FovqHL2eonufsovZbTvMs4nzs/G6qz9gbYoc2ABir2K9pkZ3jRxenXysN4PnM0d0AYHxV0s+9V02d96q2HxyGMa+mRXWoy4pbX3f2fd6kejwzQ+zCqLJ/11jqc9gAoMiPE2kc78jQI3v/IDerGLnvzlRWhwXvlxyf27ymolp4fDmB8xg8DRu3RjK4dfnQdYTkyLtWRZ3v2ROjSlQJsSBfzT9HL6pzVZP5K9VRjAXDpr6Mw6D2dFffv6U1U89Z1ybYk1l/ZRFVnI26oh+jQnEwL/mJQHzkeN7D70H4zKewdS/rFt7j8LDM48M1cEk/xq4/Z2lOq7Myr3/Fg+vnT6bZCmCsoRiZXGA2maWtFZfaI+Y/sulr8zZrjVqi1REqWfE0V9sMIzhSiTXXQm1GFYXry07bhQmfBDXOS6KW63HEsnM9M/rfw5N93SmbeVj8MVeYvpzhtUYt0SJC5t6uPDNXgpHxjkI80rjF8Hira/tcpt/zj1nGpOLYkCqorvurGHpFVp7mcrRi1dPdFe9uXN60/ZUub34Pwaxl6MPqrHGlt+ZpTVsHMG/Lf9LK0oP79yVxfR9Zrl9bryVyRkb9uacJ2k6MisGLZphBXPtHvXZe46ebtbfDCiqFyV24mAygdrNasVWG2rywYtKMFCZbcY9WNTLT0CgrTDq763EyWR1nCdp7KM699YCiw/K3VuNSm+nOeH7jFYXXFJenCNtaTTWrPhYcIS5ZXZvnLM1p9ejX9JGcYzWZ54O943pffpU3ZBrsiGIvzh2IfqIN/BMnLvkT4/xvxvQ3czr7a88MJypJOPyuXNR+awkm8r3WYs+cH066eZ3TqmruOO9bTv2Zk8x3EzNx4Drc817crvw711gFurYDhw9qcbsQYRu+sxB/iV4i6/reT10ymkOef3lswNEqyVGcw+LjlkcVnucXs5j+DjX6a+9eZvuGAoEtswFA76Kx/iRPDWL/95a3GwCcH5HbuY7w0JO6snuvcyNn46LwMSa5OULDK31dfvoZrw40Nr0Y/ZlhdhMAZwOAU/PsA7GI/l7w/+tOjNqA4Obp2Vyg8XYu+L82BThZ+8+9QcA/PSMeZ7a+vJzJfLeftZz10ae4lOucSXndWV6+rS9bTxaz4vKuIRm7rVGNUdeLxJzWor8BwEWEN6ZlUdmLXnYuu0BaPcSOd0kcCz4boP4ldQZL5tfHOUaY+fX4iG4JKu522vIuZJV/VIeJzw5Y79Lv45JjZNSqYom4tNgZzr0+YfWRGkYxonJVD4yjVfON6+c9Xc2FqK68umRld8uv1B/Cg52AMzMomutoDdquQ/Wy3otymeVn1h4zp2Z9MP2P+GDsZdft1XPenF61ic7kqu6yGkLPvRHfim+kNhD+0evrbPxMbnZgyXCuYmFsM7JMLLine truncated
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.9 MiB |
|
Before Width: | Height: | Size: 393 KiB After Width: | Height: | Size: 393 KiB |
|
After Width: | Height: | Size: 2.8 MiB |
@@ -0,0 +1,102 @@
|
||||
<!-- @format -->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Document</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main>
|
||||
<img src="./assetsStatic/LogoBig.png" alt="" srcset="">
|
||||
</main>
|
||||
<div class="loading">
|
||||
<div class="indicator"></div>
|
||||
</div>
|
||||
<div class="background"></div>
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
overflow: hidden;
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: black;
|
||||
}
|
||||
|
||||
.background {
|
||||
position: fixed;
|
||||
z-index: 0;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: calc(100vw + 5em);
|
||||
height: calc(100vh + 5em);
|
||||
background-image: url("./assetsStatic/meshbackground.png");
|
||||
background-size: cover;
|
||||
filter: brightness(0.3);
|
||||
}
|
||||
|
||||
main {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.loading {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
background: hsla(255, 100%, 4%, 0.5);
|
||||
z-index: 1;
|
||||
height: 14px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.indicator {
|
||||
background: hsl(337, 96%, 56%);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
/* transform: scaleX(0.5); */
|
||||
transform-origin: left;
|
||||
animation: loading 1s infinite;
|
||||
}
|
||||
|
||||
@keyframes loading {
|
||||
0% {
|
||||
transform: scaleX(0) translateX(-100%);
|
||||
transform-origin: left;
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: scaleX(1) translateX(100%);
|
||||
transform-origin: left;
|
||||
}
|
||||
|
||||
/* 100% {
|
||||
transform: scaleX(0) translateX(-100%);
|
||||
transform-origin: left;
|
||||
} */
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,11 +1,11 @@
|
||||
[package]
|
||||
name = "app"
|
||||
version = "0.1.0"
|
||||
description = "A Tauri App"
|
||||
authors = ["you"]
|
||||
license = ""
|
||||
repository = ""
|
||||
default-run = "app"
|
||||
name = "jellyplayer"
|
||||
version = "1.0.0"
|
||||
description = "A Modern Jellyfin Client"
|
||||
authors = ["prayag17", "JellyPlayer contributors (https://github.com/prayag17/JellyPlayer/graphs/contributors)"]
|
||||
license = "GPL-3.0-only"
|
||||
repository = "https://github.com/prayag17/JellyPlayer/"
|
||||
default-run = "jellyplayer"
|
||||
edition = "2021"
|
||||
rust-version = "1.59"
|
||||
|
||||
|
||||
@@ -3,8 +3,22 @@
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
|
||||
use tauri::Manager;
|
||||
// Create the command:
|
||||
// This command must be async so that it doesn't run on the main thread.
|
||||
#[tauri::command]
|
||||
async fn close_splashscreen(window: tauri::Window) {
|
||||
// Close splashscreen
|
||||
if let Some(splashscreen) = window.get_window("splashscreen") {
|
||||
splashscreen.close().unwrap();
|
||||
}
|
||||
// Show main window
|
||||
window.get_window("main").unwrap().show().unwrap();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![close_splashscreen])
|
||||
.plugin(tauri_plugin_store::Builder::default().build())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
},
|
||||
"package": {
|
||||
"productName": "JellyPlayer",
|
||||
"version": "0.1.0"
|
||||
"version": "../package.json"
|
||||
},
|
||||
"tauri": {
|
||||
"allowlist": {
|
||||
@@ -57,9 +57,20 @@
|
||||
{
|
||||
"fullscreen": false,
|
||||
"height": 600,
|
||||
"width": 800,
|
||||
"resizable": true,
|
||||
"title": "JellyPlayer",
|
||||
"width": 800
|
||||
"visible": false,
|
||||
"center": true
|
||||
},
|
||||
{
|
||||
"width": 800,
|
||||
"height": 300,
|
||||
"center": true,
|
||||
"decorations": false,
|
||||
"resizable": false,
|
||||
"url": "splash.html",
|
||||
"label": "splashscreen"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
/** @format */
|
||||
|
||||
import { useState, useEffect, useContext } from "react";
|
||||
import React, { useState } from "react";
|
||||
import { ThemeProvider } from "@mui/material/styles";
|
||||
import { SnackbarProvider } from "notistack";
|
||||
import { useCookies, Cookies } from "react-cookie";
|
||||
import {
|
||||
Routes,
|
||||
Route,
|
||||
Navigate,
|
||||
useNavigate,
|
||||
useLocation,
|
||||
Outlet,
|
||||
@@ -16,21 +14,40 @@ import { AnimatePresence, motion } from "framer-motion";
|
||||
|
||||
import { EventEmitter as event } from "./eventEmitter.js";
|
||||
|
||||
import { relaunch } from "@tauri-apps/api/process";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||
|
||||
// Theming
|
||||
import CssBaseline from "@mui/material/CssBaseline";
|
||||
import { theme } from "./theme";
|
||||
import "./styles/global.scss";
|
||||
|
||||
// MUI
|
||||
import Dialog from "@mui/material/Dialog";
|
||||
import DialogActions from "@mui/material/DialogActions";
|
||||
import DialogContent from "@mui/material/DialogContent";
|
||||
import DialogContentText from "@mui/material/DialogContentText";
|
||||
import DialogTitle from "@mui/material/DialogTitle";
|
||||
import Button from "@mui/material/Button";
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
|
||||
// Routes
|
||||
import { ServerSetup, ServerList } from "./routes/setup/server/root";
|
||||
import { Home } from "./routes/home/root";
|
||||
import Home from "./routes/home/root";
|
||||
import {
|
||||
UserLogin,
|
||||
LoginWithImage,
|
||||
UserLoginManual,
|
||||
} from "./routes/login/root";
|
||||
import LibraryView from "./routes/library/root.jsx";
|
||||
|
||||
import { SideMenu } from "./components/menu/sidemenu.jsx";
|
||||
import { AppBar } from "./components/appBar/appBar.jsx";
|
||||
|
||||
// Fonts
|
||||
import "@fontsource/open-sans";
|
||||
@@ -39,6 +56,8 @@ import "@fontsource/open-sans";
|
||||
import { Jellyfin } from "@jellyfin/sdk";
|
||||
import { version as appVer } from "../package.json";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { delServer, getServer } from "./utils/storage/servers.js";
|
||||
import { getUser } from "./utils/storage/user.js";
|
||||
|
||||
const jellyfin = new Jellyfin({
|
||||
clientInfo: {
|
||||
@@ -98,128 +117,250 @@ const AnimationWrapper = () => {
|
||||
);
|
||||
};
|
||||
|
||||
function App({ hideLoader }) {
|
||||
const [userCookies] = useCookies(["user"]);
|
||||
function App() {
|
||||
const navigate = useNavigate();
|
||||
const cookies = new Cookies();
|
||||
|
||||
const serverAvailable = () => {
|
||||
try {
|
||||
const currentServer = cookies.get("currentServer");
|
||||
const serverList = cookies.get("servers");
|
||||
let currentServerIp = "";
|
||||
serverList.map((item, index) => {
|
||||
currentServerIp = item[currentServer];
|
||||
});
|
||||
const [serverReachable, setServerReachable] = useState(true);
|
||||
const [checkingServer, setChecking] = useState(false);
|
||||
|
||||
if (currentServer == undefined) {
|
||||
return false;
|
||||
} else {
|
||||
if (!window.api) {
|
||||
event.emit(
|
||||
"create-jellyfin-api",
|
||||
currentServerIp.serverAddress,
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
const createApi = async () => {
|
||||
const server = await getServer();
|
||||
event.emit("create-jellyfin-api", server.Ip);
|
||||
};
|
||||
|
||||
const userSaved = () => {
|
||||
try {
|
||||
userCookies.user[0];
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
const serverAvailable = async () => {
|
||||
const server = await getServer();
|
||||
|
||||
const userAvailable = async () => {
|
||||
const users = await getUserApi(window.api).getPublicUsers();
|
||||
try {
|
||||
if (users.data.length >= 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (error) {
|
||||
if (server == null) {
|
||||
console.log("server not found");
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const HandleLoginRoutes = () => {
|
||||
if (userSaved()) {
|
||||
navigate("/home");
|
||||
} else {
|
||||
userAvailable().then((res) => {
|
||||
if (res) {
|
||||
navigate("/login/users");
|
||||
} else if (!res) {
|
||||
navigate("/login/manual");
|
||||
}
|
||||
});
|
||||
// if (!window.api) {
|
||||
// console.log("Creating Jf api (without accessToken)");
|
||||
// event.emit("create-jellyfin-api", server.Ip);
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
const usersAvailable = async () => {
|
||||
const users = await getUserApi(window.api).getPublicUsers();
|
||||
if (users.data.length >= 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const userSaved = async () => {
|
||||
const user = await getUser();
|
||||
console.log("User store => ", user);
|
||||
if (user == null) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
const pingServer = () => {
|
||||
setChecking(true);
|
||||
let data;
|
||||
fetch(`${window.api.basePath}/System/Ping`, {
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
if (data == "Jellyfin Server") {
|
||||
setServerReachable(true);
|
||||
setChecking(false);
|
||||
} else {
|
||||
enqueueSnackbar(
|
||||
"The server address does not seem be a jellyfin server",
|
||||
{ variant: "error" },
|
||||
);
|
||||
setServerReachable(false);
|
||||
setChecking(false);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
setServerReachable(false);
|
||||
console.error(error);
|
||||
setChecking(false);
|
||||
});
|
||||
};
|
||||
|
||||
const userLogin = async () => {
|
||||
const user = await getUser();
|
||||
const auth = await api.authenticateUserByName(
|
||||
user.Name,
|
||||
user.Password,
|
||||
);
|
||||
sessionStorage.setItem("accessToken", auth.data.AccessToken);
|
||||
event.emit("set-api-accessToken", window.api.basePath);
|
||||
|
||||
// navigate("/home");
|
||||
};
|
||||
|
||||
const LogicalRoutes = () => {
|
||||
serverAvailable().then(async (server) => {
|
||||
if (server == true) {
|
||||
pingServer();
|
||||
if (serverReachable == true) {
|
||||
userSaved().then((user_available) => {
|
||||
if (user_available == true) {
|
||||
navigate("/home");
|
||||
} else {
|
||||
usersAvailable().then(
|
||||
(users_list_available) => {
|
||||
if (users_list_available == true) {
|
||||
navigate("/login/users");
|
||||
} else {
|
||||
navigate("/login/manual");
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
navigate("/setup/server");
|
||||
setChecking(false);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const LoginLogicalRoutes = () => {
|
||||
usersAvailable().then((users_list_available) => {
|
||||
if (users_list_available == true) {
|
||||
navigate("/login/users");
|
||||
} else {
|
||||
navigate("/login/manual");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const handleRelaunch = async () => {
|
||||
await relaunch();
|
||||
};
|
||||
|
||||
const handleRemoveServer = async () => {
|
||||
await delServer();
|
||||
};
|
||||
const location = useLocation();
|
||||
|
||||
if (!window.api) {
|
||||
console.log("WindowAPi not present");
|
||||
createApi().then(
|
||||
userSaved().then((userSavedBool) => {
|
||||
if (userSavedBool) {
|
||||
userLogin();
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<SnackbarProvider maxSnack={5}>
|
||||
<ThemeProvider theme={theme}>
|
||||
{checkingServer && (
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
)}
|
||||
{/* Show Dialog if server not reachable */}
|
||||
<Dialog
|
||||
open={!serverReachable}
|
||||
onClose={handleRelaunch}
|
||||
aria-labelledby="alert-dialog-text"
|
||||
aria-describedby="alert-dialog-desc"
|
||||
maxWidth="md"
|
||||
sx={{
|
||||
padding: "1em",
|
||||
}}
|
||||
>
|
||||
<DialogTitle id="alert-dialog-text">
|
||||
Unable to reach server
|
||||
</DialogTitle>
|
||||
<DialogContent>
|
||||
<DialogContentText id="alert-dialog-desc">
|
||||
Unable to connect to the jellyfin server.
|
||||
</DialogContentText>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={handleRemoveServer}>
|
||||
Remove Server
|
||||
</Button>
|
||||
<Button onClick={handleRelaunch}>
|
||||
Restart JellyPlayer
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
<AnimatePresence>
|
||||
<CssBaseline />
|
||||
<Routes key={location.pathname} location={location}>
|
||||
<Route element={<AnimationWrapper />}>
|
||||
{/* Main Routes */}
|
||||
<Route path="/home" element={<Home />} />
|
||||
<Route
|
||||
path="/setup/server"
|
||||
element={<ServerSetup />}
|
||||
/>
|
||||
<Route
|
||||
path="/servers/list"
|
||||
element={<ServerList />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/login/withImg/:userName/:userId/"
|
||||
element={<LoginWithImage />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/login/users"
|
||||
element={<UserLogin />}
|
||||
/>
|
||||
<Route
|
||||
path="/login/manual"
|
||||
element={<UserLoginManual />}
|
||||
/>
|
||||
<div style={{ display: "flex" }}>
|
||||
<CssBaseline />
|
||||
<SideMenu />
|
||||
<AppBar />
|
||||
<Routes
|
||||
key={location.pathname}
|
||||
location={location}
|
||||
>
|
||||
<Route element={<AnimationWrapper />}>
|
||||
{/* Main Routes */}
|
||||
<Route
|
||||
path="/home"
|
||||
element={<Home />}
|
||||
/>
|
||||
<Route
|
||||
path="/setup/server"
|
||||
element={<ServerSetup />}
|
||||
/>
|
||||
<Route
|
||||
path="/servers/list"
|
||||
element={<ServerList />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/login/withImg/:userName/:userId/"
|
||||
element={<LoginWithImage />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/login/users"
|
||||
element={<UserLogin />}
|
||||
/>
|
||||
<Route
|
||||
path="/login/manual"
|
||||
element={<UserLoginManual />}
|
||||
/>
|
||||
<Route
|
||||
path="/library/:id"
|
||||
element={<LibraryView />}
|
||||
/>
|
||||
|
||||
{/* Logical Routes */}
|
||||
<Route
|
||||
exact
|
||||
path="/login"
|
||||
element={
|
||||
<HandleLoginRoutes></HandleLoginRoutes>
|
||||
}
|
||||
/>
|
||||
{/* Logical Routes */}
|
||||
|
||||
<Route
|
||||
path="/"
|
||||
element={
|
||||
serverAvailable() ? (
|
||||
<Navigate to="/login" />
|
||||
) : (
|
||||
<Navigate to="/setup/server" />
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Route>
|
||||
</Routes>
|
||||
<Route
|
||||
path="/"
|
||||
element={<LogicalRoutes />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/login"
|
||||
element={<LoginLogicalRoutes />}
|
||||
/>
|
||||
</Route>
|
||||
</Routes>
|
||||
</div>
|
||||
</AnimatePresence>
|
||||
<ReactQueryDevtools />
|
||||
</ThemeProvider>
|
||||
</SnackbarProvider>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/** @format */
|
||||
|
||||
import MuiAppBar from "@mui/material/AppBar";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import InputAdornment from "@mui/material/InputAdornment";
|
||||
import Toolbar from "@mui/material/Toolbar";
|
||||
import Avatar from "@mui/material/Avatar";
|
||||
import Box from "@mui/material/Box";
|
||||
|
||||
import { MdiMagnify } from "../icons/mdiMagnify";
|
||||
import { theme } from "../../theme";
|
||||
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { useQueryClient, useQuery } from "@tanstack/react-query";
|
||||
|
||||
import "./appBar.module.scss";
|
||||
import { MdiAccount } from "../icons/mdiAccount";
|
||||
import { MdiHeartOutline } from "../icons/mdiHeartOutline";
|
||||
|
||||
export const AppBar = () => {
|
||||
const visible = useSelector((state) => state.appBar.visible);
|
||||
const backdropVisible = useSelector((state) => state.appBar.backdrop);
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["appBar", "user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
visible && (
|
||||
<MuiAppBar
|
||||
sx={{
|
||||
width: `calc(100vw - ${theme.spacing(7)} - 20px)`,
|
||||
mr: "10px",
|
||||
background: "transparent",
|
||||
}}
|
||||
className={
|
||||
backdropVisible ? "appBar backdropVisible" : "appBar"
|
||||
}
|
||||
elevation={backdropVisible ? 6 : 0}
|
||||
>
|
||||
<Toolbar sx={{ justifyContent: "space-between" }}>
|
||||
<Box sx={{ display: "flex", gap: 1 }}>
|
||||
<TextField
|
||||
variant="outlined"
|
||||
placeholder="Search..."
|
||||
size="small"
|
||||
/>
|
||||
<IconButton>
|
||||
<MdiMagnify />
|
||||
</IconButton>
|
||||
</Box>
|
||||
<Box sx={{ display: "flex", gap: 2 }}>
|
||||
<IconButton>
|
||||
<MdiHeartOutline />
|
||||
</IconButton>
|
||||
<IconButton sx={{ p: 0 }}>
|
||||
{user.isSuccess &&
|
||||
(user.data.PrimaryImageTag ==
|
||||
undefined ? (
|
||||
<Avatar
|
||||
className="appBar-avatar"
|
||||
alt={user.data.Name}
|
||||
>
|
||||
<MdiAccount className="appBar-avatar-icon" />
|
||||
</Avatar>
|
||||
) : (
|
||||
<Avatar
|
||||
className="appBar-avatar"
|
||||
src={
|
||||
window.api.basePath +
|
||||
"/Users/" +
|
||||
user.data.Id +
|
||||
"/Images/Primary"
|
||||
}
|
||||
alt={user.data.Name}
|
||||
>
|
||||
<MdiAccount className="appBar-avatar-icon" />
|
||||
</Avatar>
|
||||
))}
|
||||
</IconButton>
|
||||
</Box>
|
||||
</Toolbar>
|
||||
</MuiAppBar>
|
||||
)
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
/** @format */
|
||||
|
||||
.appBar {
|
||||
transition: background $transition-time-default,
|
||||
box-shadow $transition-time-default;
|
||||
&.backdropVisible {
|
||||
background: $clr-background-dark;
|
||||
}
|
||||
&-avatar {
|
||||
background: $clr-gradient-dark;
|
||||
&-icon {
|
||||
fill: url(#clr-gradient-default) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,64 +4,29 @@ import PropTypes from "prop-types";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import ButtonBase from "@mui/material/ButtonBase";
|
||||
|
||||
import Account from "mdi-material-ui/Account";
|
||||
import { MdiAccount } from "../icons/mdiAccount";
|
||||
|
||||
import "./avatar.module.scss";
|
||||
|
||||
export const AvatarCard = ({ userName, userId, userImageAvailable }) => {
|
||||
return (
|
||||
<ButtonBase className="card square">
|
||||
<div className="card-image-container">
|
||||
{userImageAvailable ? (
|
||||
<div
|
||||
className="card-image"
|
||||
style={{
|
||||
backgroundImage:
|
||||
"url('" +
|
||||
window.api.basePath +
|
||||
"/Users/" +
|
||||
userId +
|
||||
"/Images/Primary')",
|
||||
// http://localhost/Users/{userId}/Images/{imageType}
|
||||
}}
|
||||
></div>
|
||||
) : (
|
||||
<div className="card-image empty"></div>
|
||||
)}
|
||||
<div className="card-image-icon-container">
|
||||
<Account className="card-image-icon" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="card-text-container">
|
||||
<Typography
|
||||
variant="button"
|
||||
color="textPrimary"
|
||||
className="card-text"
|
||||
>
|
||||
{userName}
|
||||
</Typography>
|
||||
</div>
|
||||
</ButtonBase>
|
||||
);
|
||||
};
|
||||
|
||||
export const AvatarImage = ({ userId }) => {
|
||||
export const AvatarImage = ({ userId, userImageTags }) => {
|
||||
return (
|
||||
<div className="avatar-image-container">
|
||||
<div
|
||||
className="avatar-image"
|
||||
style={{
|
||||
backgroundImage:
|
||||
"url('" +
|
||||
window.api.basePath +
|
||||
"/Users/" +
|
||||
userId +
|
||||
"/Images/Primary')",
|
||||
}}
|
||||
></div>
|
||||
{!!userImageTags && (
|
||||
<div
|
||||
className="avatar-image"
|
||||
style={{
|
||||
backgroundImage:
|
||||
"url('" +
|
||||
window.api.basePath +
|
||||
"/Users/" +
|
||||
userId +
|
||||
"/Images/Primary')",
|
||||
}}
|
||||
></div>
|
||||
)}
|
||||
|
||||
<div className="avatar-image-icon-container">
|
||||
<Account className="avatar-image-icon" />
|
||||
<MdiAccount className="avatar-image-icon" />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -71,12 +36,7 @@ export const AvatarSideMenu = ({ userName }) => {
|
||||
return <div></div>;
|
||||
};
|
||||
|
||||
AvatarCard.propType = {
|
||||
userName: PropTypes.string.isRequired,
|
||||
userId: PropTypes.string.isRequired,
|
||||
userImageAvailable: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
AvatarImage.propType = {
|
||||
userId: PropTypes.string.isRequired,
|
||||
userImageTags: PropTypes.any,
|
||||
};
|
||||
@@ -1,42 +1,5 @@
|
||||
/** @format */
|
||||
|
||||
.userCard {
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
.card.square {
|
||||
width: fit-content;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
gap: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
.card-image {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
&-container {
|
||||
font-size: 5em;
|
||||
}
|
||||
&-icon {
|
||||
font-size: 1.5em !important;
|
||||
&-container {
|
||||
position: static;
|
||||
width: 1.5em !important;
|
||||
height: 1.5em !important;
|
||||
aspect-ratio: 1;
|
||||
border-radius: $border-radius-default;
|
||||
color: $clr-accent-default;
|
||||
background: $clr-accent-dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
.card-text {
|
||||
margin: 0 !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.avatar-image {
|
||||
aspect-ratio: 1;
|
||||
height: 100%;
|
||||
@@ -57,6 +20,6 @@
|
||||
padding: 0.2em;
|
||||
background: $clr-accent-dark;
|
||||
color: $clr-accent-default;
|
||||
font-size: 6em !important;
|
||||
font-size: 2em !important;
|
||||
}
|
||||
}
|
||||
@@ -2,109 +2,174 @@
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import MuiCard from "@mui/material/Card";
|
||||
import CardContent from "@mui/material/CardContent";
|
||||
import CardMedia from "@mui/material/CardMedia";
|
||||
import CardActionArea from "@mui/material/CardActionArea";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
|
||||
import {
|
||||
MediaCollectionTypeIconCollectionCard,
|
||||
MediaTypeIconCollectionCard,
|
||||
TypeIconCollectionCard,
|
||||
} from "../utils/iconsCollection";
|
||||
|
||||
import { borderRadiusDefault } from "../../palette.module.scss";
|
||||
import "./card.module.scss";
|
||||
|
||||
export const CardLandscape = ({ itemName, itemId, imageTags, iconType }) => {
|
||||
const imageAvailable = () => {
|
||||
console.log(imageTags);
|
||||
if (imageTags == undefined) {
|
||||
console.log("hee");
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
export const Card = ({
|
||||
itemName,
|
||||
itemId,
|
||||
imageTags,
|
||||
iconType,
|
||||
cardType = "",
|
||||
subText = "",
|
||||
playedPercent,
|
||||
cardOrientation,
|
||||
props,
|
||||
}) => {
|
||||
return (
|
||||
<div className="card landscape">
|
||||
<div className="card-image-container">
|
||||
{imageAvailable ? (
|
||||
<div
|
||||
className="card-image"
|
||||
style={{
|
||||
backgroundImage:
|
||||
"url('" +
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
itemId +
|
||||
"/Images/Primary')",
|
||||
}}
|
||||
></div>
|
||||
) : (
|
||||
<div className="card-image empty"></div>
|
||||
)}
|
||||
<div className="card-image-icon-container">
|
||||
{MediaCollectionTypeIconCollectionCard[iconType]}
|
||||
</div>
|
||||
</div>
|
||||
<MuiCard
|
||||
className={"card " + cardOrientation}
|
||||
sx={{
|
||||
background: "transparent",
|
||||
borderRadius: borderRadiusDefault,
|
||||
mr: 1,
|
||||
}}
|
||||
elevation={0}
|
||||
{...props}
|
||||
>
|
||||
<CardActionArea>
|
||||
<Box
|
||||
className="card-media-container"
|
||||
sx={{
|
||||
position: "relative",
|
||||
m: 1,
|
||||
aspectRatio:
|
||||
cardOrientation == "landscape"
|
||||
? "1.777"
|
||||
: cardOrientation == "portait"
|
||||
? "0.666"
|
||||
: "1",
|
||||
}}
|
||||
>
|
||||
{imageTags &&
|
||||
(cardType == "thumb" ? (
|
||||
<CardMedia
|
||||
component="div"
|
||||
image={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
itemId +
|
||||
"/Images/Backdrop?fillHeight=300&fillWidth=532&quality=96"
|
||||
}
|
||||
alt={itemName}
|
||||
sx={{
|
||||
width: "100%",
|
||||
aspectRatio:
|
||||
cardOrientation == "landscape"
|
||||
? "1.777"
|
||||
: cardOrientation ==
|
||||
"portait"
|
||||
? "0.666"
|
||||
: "1",
|
||||
}}
|
||||
className="card-image"
|
||||
></CardMedia>
|
||||
) : (
|
||||
<CardMedia
|
||||
component="div"
|
||||
image={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
itemId +
|
||||
"/Images/Primary"
|
||||
}
|
||||
alt={itemName}
|
||||
sx={{
|
||||
width: "100%",
|
||||
aspectRatio:
|
||||
cardOrientation == "landscape"
|
||||
? "1.777"
|
||||
: cardOrientation ==
|
||||
"portait"
|
||||
? "0.666"
|
||||
: "1",
|
||||
}}
|
||||
className="card-image"
|
||||
></CardMedia>
|
||||
))}
|
||||
<div className="card-image-icon-container">
|
||||
{cardType == "lib"
|
||||
? MediaCollectionTypeIconCollectionCard[
|
||||
iconType
|
||||
]
|
||||
: TypeIconCollectionCard[iconType]}
|
||||
</div>
|
||||
{!!playedPercent && (
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={playedPercent}
|
||||
sx={{
|
||||
width: "90%",
|
||||
position: "absolute",
|
||||
left: "5%",
|
||||
bottom: "5%",
|
||||
borderRadius: "100px",
|
||||
height: "5px",
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
<div className="card-text-container">
|
||||
<Typography variant="button" color="white">
|
||||
{itemName}
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
<CardContent
|
||||
className="card-text-container"
|
||||
sx={{
|
||||
padding: "0 0.5em",
|
||||
backgroundColor: "transparent",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
gutterBottom={false}
|
||||
variant="h6"
|
||||
component="div"
|
||||
color="white"
|
||||
fontWeight={500}
|
||||
textAlign="left"
|
||||
noWrap
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
>
|
||||
{itemName}
|
||||
</Typography>
|
||||
<Typography
|
||||
gutterBottom
|
||||
variant="subtitle2"
|
||||
component="div"
|
||||
color="gray"
|
||||
textAlign="left"
|
||||
// textOverflow={}
|
||||
// fontSize="0.85em"
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
noWrap
|
||||
>
|
||||
{subText}
|
||||
</Typography>
|
||||
</CardContent>
|
||||
</CardActionArea>
|
||||
</MuiCard>
|
||||
);
|
||||
};
|
||||
|
||||
export const CardPotrait = ({ itemName, itemId, imageTags, iconType }) => {
|
||||
const imageAvailable = () => {
|
||||
console.log(imageTags);
|
||||
if (imageTags == undefined) {
|
||||
console.log("hee");
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
return (
|
||||
<div className="card portrait">
|
||||
<div className="card-image-container">
|
||||
{imageAvailable ? (
|
||||
<div
|
||||
className="card-image"
|
||||
style={{
|
||||
backgroundImage:
|
||||
"url('" +
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
itemId +
|
||||
"/Images/Primary?quality=95&fillHeight=350&fillWidth=243')",
|
||||
}}
|
||||
></div>
|
||||
) : (
|
||||
<div className="card-image empty"></div>
|
||||
)}
|
||||
<div className="card-image-icon-container">
|
||||
{MediaTypeIconCollectionCard[iconType]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="card-text-container">
|
||||
<Typography variant="button" color="white">
|
||||
{itemName}
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
CardLandscape.propTypes = {
|
||||
Card.propTypes = {
|
||||
itemName: PropTypes.string.isRequired,
|
||||
itemId: PropTypes.string.isRequired,
|
||||
imageTags: PropTypes.object,
|
||||
iconType: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
CardPotrait.propTypes = {
|
||||
itemName: PropTypes.string.isRequired,
|
||||
itemId: PropTypes.string.isRequired,
|
||||
imageTags: PropTypes.object,
|
||||
imageTags: PropTypes.bool,
|
||||
iconType: PropTypes.string.isRequired,
|
||||
cardType: PropTypes.string,
|
||||
subText: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
playedPercent: PropTypes.number,
|
||||
cardOrientation: PropTypes.string.isRequired,
|
||||
};
|
||||
@@ -1,21 +1,10 @@
|
||||
/** @format */
|
||||
|
||||
.card {
|
||||
margin-right: 1em;
|
||||
|
||||
&.landscape {
|
||||
--image-aspect-ratio: 1.77;
|
||||
}
|
||||
|
||||
&.portrait {
|
||||
--image-aspect-ratio: 0.65;
|
||||
}
|
||||
|
||||
border-radius: $border-radius-default;
|
||||
&-image {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
border-radius: 10px;
|
||||
aspect-ratio: var(--image-aspect-ratio);
|
||||
border-radius: $border-radius-default;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
&-container {
|
||||
@@ -23,27 +12,26 @@
|
||||
}
|
||||
&-icon {
|
||||
font-size: 4.5em !important;
|
||||
fill: url(#clr-gradient-default) !important;
|
||||
|
||||
&-container {
|
||||
display: flex;
|
||||
display: flex !important;
|
||||
aspect-ratio: 1.777;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100% !important;
|
||||
color: transparent;
|
||||
background: $clr-gradient-dark;
|
||||
border-radius: 10px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
border-radius: $border-radius-default;
|
||||
color: $clr-accent-default;
|
||||
background: $clr-accent-dark;
|
||||
z-index: 0;
|
||||
height: 100%;
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
&-text-container {
|
||||
margin-top: 0.5em;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
@@ -1,53 +1,25 @@
|
||||
/** @format */
|
||||
|
||||
import { useRef, useEffect } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Carousel from "react-multi-carousel";
|
||||
import "react-multi-carousel/lib/styles.css";
|
||||
|
||||
import ChevronLeft from "mdi-material-ui/ChevronLeft";
|
||||
import ChevronRight from "mdi-material-ui/ChevronRight";
|
||||
import { MdiChevronLeft } from "../icons/mdiChevronLeft";
|
||||
import { MdiChevronRight } from "../icons/mdiChevronRight";
|
||||
|
||||
import { styled } from "@mui/material/styles";
|
||||
import Button from "@mui/material/Button";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import ButtonGroup from "@mui/material/ButtonGroup";
|
||||
|
||||
import "./cardScroller.module.scss";
|
||||
|
||||
const CarouselButton = styled(Button)(() => ({
|
||||
color: "white",
|
||||
height: "100%",
|
||||
}));
|
||||
|
||||
const SliderButtonRight = ({ onClick }) => {
|
||||
return (
|
||||
<CarouselButton
|
||||
onClick={() => onClick()}
|
||||
className="card-scroller-button right"
|
||||
variant="text"
|
||||
>
|
||||
<ChevronRight />
|
||||
</CarouselButton>
|
||||
);
|
||||
};
|
||||
|
||||
const SliderButtonLeft = ({ onClick }) => {
|
||||
return (
|
||||
<CarouselButton
|
||||
onClick={() => onClick()}
|
||||
className="card-scroller-button left"
|
||||
variant="text"
|
||||
>
|
||||
<ChevronLeft />
|
||||
</CarouselButton>
|
||||
);
|
||||
};
|
||||
|
||||
export const CardScroller = ({ children, displayCards }) => {
|
||||
export const CardScroller = ({ children, displayCards, title }) => {
|
||||
const responsive = {
|
||||
desktop: {
|
||||
breakpoint: { max: 3000, min: 1024 },
|
||||
breakpoint: { max: 3000, min: 1025 },
|
||||
items: displayCards,
|
||||
slidesToSlide: displayCards, // optional, default to 1.
|
||||
},
|
||||
@@ -63,21 +35,51 @@ export const CardScroller = ({ children, displayCards }) => {
|
||||
},
|
||||
};
|
||||
|
||||
const [carouselRef, setCarouselRef] = useState();
|
||||
|
||||
return (
|
||||
<Carousel
|
||||
swipeable={false}
|
||||
draggable={false}
|
||||
responsive={responsive}
|
||||
arrows={true}
|
||||
customRightArrow={<SliderButtonRight />}
|
||||
customLeftArrow={<SliderButtonLeft />}
|
||||
className="card-scroller"
|
||||
>
|
||||
{children}
|
||||
</Carousel>
|
||||
<Box className="card-scroller-container" sx={{ mb: 4 }}>
|
||||
<Box sx={{ mb: 2 }} className="card-scroller-header-container">
|
||||
<Typography
|
||||
variant="h4"
|
||||
color="textPrimary"
|
||||
className="card-scroller-heading"
|
||||
>
|
||||
<div className="card-scroller-heading-decoration"></div>{" "}
|
||||
{title}
|
||||
</Typography>
|
||||
<ButtonGroup className="card-scroller-button-group">
|
||||
<IconButton
|
||||
className="card-scroller-button"
|
||||
onClick={() => carouselRef.previous()}
|
||||
>
|
||||
<MdiChevronLeft />
|
||||
</IconButton>
|
||||
<IconButton
|
||||
className="card-scroller-button"
|
||||
onClick={() => carouselRef.next()}
|
||||
>
|
||||
<MdiChevronRight />
|
||||
</IconButton>
|
||||
</ButtonGroup>
|
||||
</Box>
|
||||
<Carousel
|
||||
swipeable={false}
|
||||
draggable={false}
|
||||
responsive={responsive}
|
||||
arrows={false}
|
||||
ref={(el) => setCarouselRef(el)}
|
||||
// customButtonGroup={<HomeSectionHeader />}
|
||||
// renderButtonGroupOutside={true}
|
||||
className="card-scroller"
|
||||
>
|
||||
{children}
|
||||
</Carousel>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
CardScroller.propTypes = {
|
||||
displayCards: PropTypes.number.isRequired,
|
||||
title: PropTypes.string.isRequired,
|
||||
};
|
||||
@@ -7,23 +7,25 @@
|
||||
display: flex;
|
||||
}
|
||||
&-button {
|
||||
color: white;
|
||||
position: absolute !important;
|
||||
top: 49%;
|
||||
transform: translateY(-50%);
|
||||
background-color: $clr-background-dark !important;
|
||||
border-radius: $border-radius-intensity-1 !important;
|
||||
opacity: 0;
|
||||
transition: opacity $transition-time-default !important;
|
||||
&:hover,
|
||||
&:focus {
|
||||
opacity: 1;
|
||||
}
|
||||
&.right {
|
||||
right: 0%;
|
||||
}
|
||||
&.left {
|
||||
left: 0%;
|
||||
aspect-ratio: 1;
|
||||
}
|
||||
&-header-container {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
&-heading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
gap: 0.35em;
|
||||
position: relative;
|
||||
margin-bottom: 0.25em !important;
|
||||
&-decoration {
|
||||
width: 0.75em;
|
||||
height: 3px;
|
||||
background: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/** @format */
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||
import { Card } from "../../components/card/card";
|
||||
import { CardsSkeleton } from "../skeleton/cards";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
|
||||
export const LatestMediaSection = ({ latestMediaLib }) => {
|
||||
const user = useQuery({
|
||||
queryKey: ["home", "user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
});
|
||||
const fetchLatestMedia = async (library) => {
|
||||
const media = await getUserLibraryApi(window.api).getLatestMedia({
|
||||
userId: user.data.Id,
|
||||
parentId: library,
|
||||
limit: 16,
|
||||
fields: ["PrimaryImageAspectRatio"],
|
||||
});
|
||||
return media.data;
|
||||
};
|
||||
const data = useQuery({
|
||||
queryKey: ["homeSection, latestMedia", latestMediaLib],
|
||||
queryFn: () => fetchLatestMedia(latestMediaLib[0]),
|
||||
enabled: !!user.data,
|
||||
});
|
||||
if (data.isLoading) {
|
||||
return <CardsSkeleton />;
|
||||
}
|
||||
if (data.isSuccess && data.data.length >= 1) {
|
||||
return (
|
||||
<CardScroller
|
||||
displayCards={8}
|
||||
title={"Latest " + latestMediaLib[1]}
|
||||
>
|
||||
{data.data.map((item, index) => {
|
||||
return (
|
||||
<Card
|
||||
key={index}
|
||||
itemName={
|
||||
!!item.SeriesId
|
||||
? item.SeriesName
|
||||
: item.Name
|
||||
}
|
||||
itemId={
|
||||
!!item.SeriesId
|
||||
? item.SeriesId
|
||||
: item.Id
|
||||
}
|
||||
// imageTags={false}
|
||||
imageTags={!!item.ImageTags.Primary}
|
||||
iconType={item.Type}
|
||||
subText={item.ProductionYear}
|
||||
playedPercent={
|
||||
item.UserData.PlayedPercentage
|
||||
}
|
||||
cardOrientation={
|
||||
item.PrimaryImageAspectRatio == 1
|
||||
? "sqaure"
|
||||
: "portait"
|
||||
}
|
||||
></Card>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
);
|
||||
}
|
||||
|
||||
return <></>;
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
/** @format */
|
||||
|
||||
import { MdiChevronLeft } from "./mdiChevronLeft";
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiAccount } from "@mdi/js";
|
||||
|
||||
export const MdiAccount = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiAccount}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiAccountMusic } from "@mdi/js";
|
||||
|
||||
export const MdiAccountMusic = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiAccountMusic}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiAccountTie } from "@mdi/js";
|
||||
|
||||
export const MdiAccountTie = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiAccountTie}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiAlbum } from "@mdi/js";
|
||||
|
||||
export const MdiAlbum = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiAlbum}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -4,9 +4,9 @@ import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiArrowLeft } from "@mdi/js";
|
||||
|
||||
export const MdiArrowLeft = () => {
|
||||
export const MdiArrowLeft = (props) => {
|
||||
return (
|
||||
<SvgIcon>
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiArrowLeft}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiBook } from "@mdi/js";
|
||||
|
||||
export const MdiBook = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiBook}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiBookMultiple } from "@mdi/js";
|
||||
|
||||
export const MdiBookMultiple = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiBookMultiple}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiBookMusic } from "@mdi/js";
|
||||
|
||||
export const MdiBookMusic = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiBookMusic}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiChevronLeft } from "@mdi/js";
|
||||
|
||||
export const MdiChevronLeft = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiChevronLeft}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -4,9 +4,9 @@ import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiChevronRight } from "@mdi/js";
|
||||
|
||||
export const MdiChevronRight = () => {
|
||||
export const MdiChevronRight = (props) => {
|
||||
return (
|
||||
<SvgIcon>
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiChevronRight}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiDramaMasks } from "@mdi/js";
|
||||
|
||||
export const MdiDramaMasks = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiDramaMasks}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -4,9 +4,9 @@ import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiEyeOffOutline } from "@mdi/js";
|
||||
|
||||
export const MdiEyeOffOutline = () => {
|
||||
export const MdiEyeOffOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon>
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiEyeOffOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
|
||||
@@ -4,9 +4,9 @@ import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiEyeOutline } from "@mdi/js";
|
||||
|
||||
export const MdiEyeOutline = () => {
|
||||
export const MdiEyeOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon>
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiEyeOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiFilmstrip } from "@mdi/js";
|
||||
|
||||
export const MdiFilmstrip = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiFilmstrip}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiFolderMultiple } from "@mdi/js";
|
||||
|
||||
export const MdiFolderMultiple = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiFolderMultiple}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiFolderMusicOutline } from "@mdi/js";
|
||||
|
||||
export const MdiFolderMusicOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiFolderMusicOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiFolderOutline } from "@mdi/js";
|
||||
|
||||
export const MdiFolderOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiFolderOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiHeartOutline } from "@mdi/js";
|
||||
|
||||
export const MdiHeartOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiHeartOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiHomeVariantOutline } from "@mdi/js";
|
||||
|
||||
export const MdiHomeVariantOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiHomeVariantOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiImage } from "@mdi/js";
|
||||
|
||||
export const MdiImage = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiImage}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiImageMultiple } from "@mdi/js";
|
||||
|
||||
export const MdiImageMultiple = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiImageMultiple}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiLogoutVariant } from "@mdi/js";
|
||||
|
||||
export const MdiLogoutVariant = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiLogoutVariant}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiMagnify } from "@mdi/js";
|
||||
|
||||
export const MdiMagnify = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiMagnify}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiMenu } from "@mdi/js";
|
||||
|
||||
export const MdiMenu = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiMenu}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiMicrophone } from "@mdi/js";
|
||||
|
||||
export const MdiMicrophone = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiMicrophone}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiMovieOutline } from "@mdi/js";
|
||||
|
||||
export const MdiMovieOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiMovieOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiMultimedia } from "@mdi/js";
|
||||
|
||||
export const MdiMultimedia = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiMultimedia}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiMusic } from "@mdi/js";
|
||||
|
||||
export const MdiMusic = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiMusic}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiMusicBoxMultipleOutline } from "@mdi/js";
|
||||
|
||||
export const MdiMusicBoxMultipleOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiMusicBoxMultipleOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiPlay } from "@mdi/js";
|
||||
|
||||
export const MdiPlay = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiPlay}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiPlayBoxMultiple } from "@mdi/js";
|
||||
|
||||
export const MdiPlayBoxMultiple = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiPlayBoxMultiple}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @format */
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiPlayOutline } from "@mdi/js";
|
||||
|
||||
export const MdiPlayOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiPlayOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiPlaylistMusicOutline } from "@mdi/js";
|
||||
|
||||
export const MdiPlaylistMusicOutline = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiPlaylistMusicOutline}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiStarHalfFull } from "@mdi/js";
|
||||
|
||||
export const MdiStarHalfFull = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiStarHalfFull}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiTelevision } from "@mdi/js";
|
||||
|
||||
export const MdiTelevision = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiTelevision}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiTelevisionClassic } from "@mdi/js";
|
||||
|
||||
export const MdiTelevisionClassic = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiTelevisionClassic}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiYoutube } from "@mdi/js";
|
||||
|
||||
export const MdiYoutube = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiYoutube}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,283 @@
|
||||
/** @format */
|
||||
import { delUser } from "../../utils/storage/user";
|
||||
|
||||
import { useQueryClient, useQuery, QueryClient } from "@tanstack/react-query";
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
|
||||
import { useNavigate, NavLink } from "react-router-dom";
|
||||
|
||||
import { theme } from "../../theme";
|
||||
|
||||
import { styled } from "@mui/material/styles";
|
||||
import Skeleton from "@mui/material/Skeleton";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import List from "@mui/material/List";
|
||||
import ListItem from "@mui/material/ListItem";
|
||||
import ListItemText from "@mui/material/ListItemText";
|
||||
import ListItemIcon from "@mui/material/ListItemIcon";
|
||||
import ListItemButton from "@mui/material/ListItemButton";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import MuiDrawer from "@mui/material/Drawer";
|
||||
|
||||
import { MdiMenu } from "../icons/mdiMenu";
|
||||
import { MdiLogoutVariant } from "../icons/mdiLogoutVariant";
|
||||
|
||||
import { MediaCollectionTypeIconCollection } from "../../components/utils/iconsCollection.jsx";
|
||||
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import { hideSidemenu } from "../../utils/slice/sidemenu";
|
||||
|
||||
import { MdiHomeVariantOutline } from "../icons/mdiHomeVariantOutline";
|
||||
|
||||
import "./sidemenu.module.scss";
|
||||
|
||||
const drawerWidth = 320;
|
||||
|
||||
const DrawerHeader = styled("div")(({ theme }) => ({
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "flex-end",
|
||||
padding: theme.spacing(0, 1),
|
||||
// necessary for content to be below app bar
|
||||
...theme.mixins.toolbar,
|
||||
}));
|
||||
|
||||
const MiniDrawer = styled(MuiDrawer, {
|
||||
shouldForwardProp: (prop) => prop !== "open",
|
||||
})(({ theme }) => ({
|
||||
flexShrink: 0,
|
||||
whiteSpace: "nowrap",
|
||||
boxSizing: "border-box",
|
||||
backgroundColor: theme.palette.primary.background.dark,
|
||||
overflowX: "hidden",
|
||||
// width: `calc(${theme.spacing(7)} + 10px)`,
|
||||
}));
|
||||
|
||||
export const SideMenu = ({}) => {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const visible = useSelector((state) => state.sidebar.visible);
|
||||
const navigate = useNavigate();
|
||||
const user = useQuery({
|
||||
queryKey: ["home", "user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
enabled: visible,
|
||||
});
|
||||
let libraries = useQuery({
|
||||
queryKey: ["sidemenu", "libraries"],
|
||||
queryFn: async () => {
|
||||
let libs = await getUserViewsApi(window.api).getUserViews({
|
||||
userId: user.data.Id,
|
||||
});
|
||||
return libs.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
});
|
||||
const handleDrawerOpen = () => {};
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const handleLogout = async () => {
|
||||
console.log("Logging out user...");
|
||||
await window.api.logout();
|
||||
delUser();
|
||||
dispatch(hideSidemenu());
|
||||
navigate("/login");
|
||||
};
|
||||
|
||||
return (
|
||||
<MiniDrawer
|
||||
variant="permanent"
|
||||
open={false}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
backgroundColor: "inherit",
|
||||
border: "none",
|
||||
width: visible
|
||||
? `calc(${theme.spacing(7)} + 10px)`
|
||||
: 0,
|
||||
height: "100vh",
|
||||
// display: visible ? "block" : "none",
|
||||
},
|
||||
}}
|
||||
sx={{
|
||||
width: visible ? `calc(${theme.spacing(7)} + 10px)` : 0,
|
||||
}}
|
||||
>
|
||||
<DrawerHeader
|
||||
className="Mui-DrawerHeader"
|
||||
sx={{
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
{/* <div>
|
||||
<Avatar src={""}/>
|
||||
<Typography variant="h3">
|
||||
{user["Name"]}
|
||||
</Typography>
|
||||
</div> */}
|
||||
<IconButton
|
||||
color="inherit"
|
||||
aria-label="open drawer"
|
||||
onClick={handleDrawerOpen}
|
||||
>
|
||||
<MdiMenu />
|
||||
</IconButton>
|
||||
</DrawerHeader>
|
||||
<Divider />
|
||||
{libraries.isLoading ? (
|
||||
<>
|
||||
<Skeleton
|
||||
height="100%"
|
||||
variant="rounded"
|
||||
width="calc(100% - 10px )"
|
||||
sx={{ margin: "5px" }}
|
||||
></Skeleton>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<List sx={{ border: "none" }}>
|
||||
{libraries.data.Items.map((library, index) => {
|
||||
return (
|
||||
<Tooltip
|
||||
title={library.Name}
|
||||
placement="right"
|
||||
arrow
|
||||
followCursor
|
||||
key={index}
|
||||
>
|
||||
<ListItem
|
||||
className="sidemenu-item-container"
|
||||
disablePadding
|
||||
>
|
||||
<NavLink
|
||||
to={
|
||||
"/library/" +
|
||||
library.Id
|
||||
}
|
||||
className={({
|
||||
isActive,
|
||||
isPending,
|
||||
}) =>
|
||||
isPending
|
||||
? "sidemenu-item-pending sidemenu-item"
|
||||
: isActive
|
||||
? "sidemenu-item-active sidemenu-item"
|
||||
: "sidemenu-item"
|
||||
}
|
||||
>
|
||||
<ListItemButton
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
"center",
|
||||
px: 2.5,
|
||||
}}
|
||||
color="white"
|
||||
>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
}}
|
||||
>
|
||||
{
|
||||
MediaCollectionTypeIconCollection[
|
||||
library
|
||||
.CollectionType
|
||||
]
|
||||
}
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</NavLink>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
);
|
||||
})}
|
||||
</List>
|
||||
<List sx={{ marginTop: "auto" }}>
|
||||
<Tooltip
|
||||
title="Home"
|
||||
placement="right"
|
||||
followCursor
|
||||
arrow
|
||||
>
|
||||
<ListItem
|
||||
className="sidemenu-item-container"
|
||||
disablePadding
|
||||
>
|
||||
<NavLink
|
||||
to="/home"
|
||||
className={({
|
||||
isActive,
|
||||
isPending,
|
||||
}) =>
|
||||
isPending
|
||||
? "sidemenu-item-pending sidemenu-item"
|
||||
: isActive
|
||||
? "sidemenu-item-active sidemenu-item"
|
||||
: "sidemenu-item"
|
||||
}
|
||||
>
|
||||
<ListItemButton
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent: "center",
|
||||
px: 2.5,
|
||||
}}
|
||||
>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
}}
|
||||
>
|
||||
<MdiHomeVariantOutline></MdiHomeVariantOutline>
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</NavLink>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
<Tooltip
|
||||
title="Logout"
|
||||
placement="right"
|
||||
followCursor
|
||||
arrow
|
||||
>
|
||||
<ListItem disablePadding>
|
||||
<ListItemButton
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent: "center",
|
||||
px: 2.5,
|
||||
}}
|
||||
onClick={handleLogout}
|
||||
>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
<MdiLogoutVariant></MdiLogoutVariant>
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
</List>
|
||||
</>
|
||||
)}
|
||||
</MiniDrawer>
|
||||
);
|
||||
};
|
||||
|
||||
// SideMenu.propTypes = {
|
||||
// skeleton: PropTypes.bool.isRequired,
|
||||
// data: PropTypes.array.isRequired,
|
||||
// };
|
||||
@@ -0,0 +1,29 @@
|
||||
/** @format */
|
||||
|
||||
.sidemenu {
|
||||
&-item {
|
||||
position: relative;
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 15%;
|
||||
bottom: 15%;
|
||||
left: 7%;
|
||||
width: 5px;
|
||||
border-radius: 10px;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
$clr-accent-default,
|
||||
$clr-secondary-default
|
||||
);
|
||||
opacity: 0;
|
||||
transform: translateX(-10px);
|
||||
transition: transform $transition-time-default,
|
||||
opacity $transition-time-default;
|
||||
}
|
||||
&-active::before {
|
||||
opacity: 1;
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/** @format */
|
||||
|
||||
import Skeleton from "@mui/material/Skeleton";
|
||||
import Card from "@mui/material/Card";
|
||||
import CardContent from "@mui/material/CardContent";
|
||||
import CardMedia from "@mui/material/CardMedia";
|
||||
import CardActionArea from "@mui/material/CardActionArea";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Box from "@mui/material/Box";
|
||||
|
||||
export const CardsSkeleton = () => {
|
||||
return (
|
||||
<Box sx={{ display: "flex", flexFlow: "column", mb: 4 }}>
|
||||
<Typography variant="h4" sx={{ mb: "0.15em" }}>
|
||||
<Skeleton width="35%" animation="wave" />
|
||||
</Typography>
|
||||
<Skeleton width="100%" variant="rounded" animation="wave">
|
||||
<div style={{ paddingTop: "20%" }}></div>
|
||||
</Skeleton>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
/** @format */
|
||||
import Skeleton from "@mui/material/Skeleton";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { theme } from "../../theme";
|
||||
export const CarouselSkeleton = () => {
|
||||
return (
|
||||
<Paper
|
||||
className="hero-carousel-slide"
|
||||
sx={{
|
||||
background: theme.palette.primary.background.dark,
|
||||
}}
|
||||
>
|
||||
<div className="hero-carousel-background">
|
||||
<Skeleton
|
||||
variant="rectangular"
|
||||
height="100%"
|
||||
animation="wave"
|
||||
></Skeleton>
|
||||
</div>
|
||||
<Box className="hero-carousel-detail">
|
||||
<Typography variant="h3" className="hero-carousel-text">
|
||||
<Skeleton
|
||||
variant="text"
|
||||
sx={{ fontSize: "5rem" }}
|
||||
width={300}
|
||||
animation="wave"
|
||||
></Skeleton>
|
||||
</Typography>
|
||||
<Typography variant="p" className="hero-carousel-text">
|
||||
<Skeleton
|
||||
variant="text"
|
||||
sx={{ fontSize: "3rem" }}
|
||||
width={400}
|
||||
animation="wave"
|
||||
></Skeleton>
|
||||
</Typography>
|
||||
</Box>
|
||||
</Paper>
|
||||
);
|
||||
};
|
||||
@@ -1,61 +1,104 @@
|
||||
/** @format */
|
||||
|
||||
import MovieOutline from "mdi-material-ui/MovieOutline";
|
||||
import MusicBoxMultipleOutline from "mdi-material-ui/MusicBoxMultipleOutline";
|
||||
import PlaylistMusicOutline from "mdi-material-ui/PlaylistMusicOutline";
|
||||
import Television from "mdi-material-ui/Television";
|
||||
import FolderOutline from "mdi-material-ui/FolderOutline";
|
||||
import FolderMusicOutline from "mdi-material-ui/FolderMusicOutline";
|
||||
import Youtube from "mdi-material-ui/Youtube";
|
||||
import MultiMedia from "mdi-material-ui/Multimedia";
|
||||
import BookMultiple from "mdi-material-ui/BookMultiple";
|
||||
import ImageMultiple from "mdi-material-ui/ImageMultiple";
|
||||
import TelevisionClassic from "mdi-material-ui/TelevisionClassic";
|
||||
import Filmstrip from "mdi-material-ui/Filmstrip";
|
||||
import Microphone from "mdi-material-ui/Microphone";
|
||||
import Image from "mdi-material-ui/Image";
|
||||
import Book from "mdi-material-ui/Book";
|
||||
import { MdiMovieOutline } from "../icons/mdiMovieOutline";
|
||||
import { MdiMusicBoxMultipleOutline } from "../icons/mdiMusicBoxMultipleOutline";
|
||||
import { MdiPlaylistMusicOutline } from "../icons/mdiPlaylistMusicOutline";
|
||||
import { MdiTelevision } from "../icons/mdiTelevision";
|
||||
import { MdiFolderOutline } from "../icons/mdiFolderOutline";
|
||||
import { MdiFolderMusicOutline } from "../icons/mdiFolderMusicOutline";
|
||||
import { MdiYoutube } from "../icons/mdiYoutube";
|
||||
import { MdiMultimedia } from "../icons/mdiMultiMedia";
|
||||
import { MdiBookMultiple } from "../icons/mdiBookMultiple";
|
||||
import { MdiImageMultiple } from "../icons/mdiImageMultiple";
|
||||
import { MdiTelevisionClassic } from "../icons/mdiTelevisionClassic";
|
||||
import { MdiFilmstrip } from "../icons/mdiFilmstrip";
|
||||
import { MdiMicrophone } from "../icons/mdiMicrophone";
|
||||
import { MdiImage } from "../icons/mdiImage";
|
||||
import { MdiBook } from "../icons/mdiBook";
|
||||
import { MdiFolderMultiple } from "../icons/mdiFolderMultiple";
|
||||
import { MdiBookMusic } from "../icons/mdiBookMusic";
|
||||
import { MdiPlayBoxMultiple } from "../icons/mdiPlayBoxMultiple";
|
||||
import { MdiAlbum } from "../icons/mdiAlbum";
|
||||
import { MdiAccountMusic } from "../icons/mdiAccountMusic";
|
||||
import { MdiDramaMasks } from "../icons/mdiDramaMasks";
|
||||
import { MdiMusic } from "../icons/mdiMusic";
|
||||
import { MdiAccountTie } from "../icons/mdiAccountTie";
|
||||
|
||||
export const MediaCollectionTypeIconCollection = {
|
||||
universal: <MultiMedia />,
|
||||
movies: <MovieOutline />,
|
||||
music: <MusicBoxMultipleOutline />,
|
||||
playlists: <PlaylistMusicOutline />,
|
||||
tvshows: <Television />,
|
||||
boxsets: <MovieOutline />,
|
||||
musicvideos: <FolderMusicOutline />,
|
||||
trailers: <Youtube />,
|
||||
books: <BookMultiple />,
|
||||
photos: <ImageMultiple />,
|
||||
livetv: <TelevisionClassic />,
|
||||
folder: <FolderOutline />,
|
||||
universal: <MdiMultimedia />,
|
||||
movies: <MdiMovieOutline />,
|
||||
music: <MdiMusicBoxMultipleOutline />,
|
||||
playlists: <MdiPlaylistMusicOutline />,
|
||||
tvshows: <MdiTelevision />,
|
||||
boxsets: <MdiMovieOutline />,
|
||||
musicvideos: <MdiFolderMusicOutline />,
|
||||
trailers: <MdiYoutube />,
|
||||
books: <MdiBookMultiple />,
|
||||
photos: <MdiImageMultiple />,
|
||||
livetv: <MdiTelevisionClassic />,
|
||||
folder: <MdiFolderOutline />,
|
||||
logout: <MdiFolderOutline />,
|
||||
};
|
||||
|
||||
export const MediaCollectionTypeIconCollectionCard = {
|
||||
universal: <MultiMedia className="card-image-icon" />,
|
||||
movies: <MovieOutline className="card-image-icon" />,
|
||||
music: <MusicBoxMultipleOutline className="card-image-icon" />,
|
||||
playlists: <PlaylistMusicOutline className="card-image-icon" />,
|
||||
tvshows: <Television className="card-image-icon" />,
|
||||
boxsets: <MovieOutline className="card-image-icon" />,
|
||||
musicvideos: <FolderMusicOutline className="card-image-icon" />,
|
||||
trailers: <Youtube className="card-image-icon" />,
|
||||
books: <BookMultiple className="card-image-icon" />,
|
||||
photos: <ImageMultiple className="card-image-icon" />,
|
||||
livetv: <TelevisionClassic className="card-image-icon" />,
|
||||
folder: <FolderOutline className="card-image-icon" />,
|
||||
universal: <MdiMultimedia className="card-image-icon" />,
|
||||
movies: <MdiMovieOutline className="card-image-icon" />,
|
||||
music: <MdiMusicBoxMultipleOutline className="card-image-icon" />,
|
||||
playlists: <MdiPlaylistMusicOutline className="card-image-icon" />,
|
||||
tvshows: <MdiTelevision className="card-image-icon" />,
|
||||
boxsets: <MdiMovieOutline className="card-image-icon" />,
|
||||
musicvideos: <MdiFolderMusicOutline className="card-image-icon" />,
|
||||
trailers: <MdiYoutube className="card-image-icon" />,
|
||||
books: <MdiBookMultiple className="card-image-icon" />,
|
||||
photos: <MdiImageMultiple className="card-image-icon" />,
|
||||
livetv: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
folder: <MdiFolderOutline className="card-image-icon" />,
|
||||
};
|
||||
|
||||
export const MediaTypeIconCollection = {
|
||||
Video: <Filmstrip className="hero-carousel-background-icon" />,
|
||||
Audio: <Microphone className="hero-carousel-background-icon" />,
|
||||
Photo: <Image className="hero-carousel-background-icon" />,
|
||||
Book: <Book className="hero-carousel-background-icon" />,
|
||||
Movie: <MdiFilmstrip className="hero-carousel-background-icon" />,
|
||||
Audio: <MdiMicrophone className="hero-carousel-background-icon" />,
|
||||
Photo: <MdiImage className="hero-carousel-background-icon" />,
|
||||
Book: <MdiBook className="hero-carousel-background-icon" />,
|
||||
};
|
||||
|
||||
export const MediaTypeIconCollectionCard = {
|
||||
Video: <Filmstrip className="card-image-icon" />,
|
||||
Audio: <Microphone className="card-image-icon" />,
|
||||
Photo: <Image className="card-image-icon" />,
|
||||
Book: <Book className="card-image-icon" />,
|
||||
export const TypeIconCollectionCard = {
|
||||
AggregateFolder: <MdiFolderMultiple className="card-image-icon" />,
|
||||
Audio: <MdiMicrophone className="card-image-icon" />,
|
||||
AudioBook: <MdiBookMusic className="card-image-icon" />,
|
||||
BasePluginFolder: <MdiFolderOutline className="card-image-icon" />,
|
||||
Book: <MdiBook className="card-image-icon" />,
|
||||
BoxSet: <MdiPlayBoxMultiple className="card-image-icon" />,
|
||||
Channel: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
ChannelFolderItem: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
CollectionFolder: <MdiFolderOutline className="card-image-icon" />,
|
||||
Episode: <MdiTelevision className="card-image-icon" />,
|
||||
Folder: <MdiFolderOutline className="card-image-icon" />,
|
||||
LiveTvChannel: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
LiveTvProgram: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
ManualPlaylistsFolder: (
|
||||
<MdiPlaylistMusicOutline className="card-image-icon" />
|
||||
),
|
||||
Movie: <MdiFilmstrip className="card-image-icon" />,
|
||||
MusicAlbum: <MdiAlbum className="card-image-icon" />,
|
||||
MusicArtist: <MdiAccountMusic className="card-image-icon" />,
|
||||
MusicGenre: <MdiDramaMasks className="card-image-icon" />,
|
||||
MusicVideo: <MdiMusic className="card-image-icon" />,
|
||||
Person: <MdiAccountTie className="card-image-icon" />,
|
||||
Photo: <MdiImage className="card-image-icon" />,
|
||||
PhotoAlbum: <MdiImageMultiple className="card-image-icon" />,
|
||||
Playlist: <MdiPlaylistMusicOutline className="card-image-icon" />,
|
||||
PlaylistsFolder: <MdiPlaylistMusicOutline className="card-image-icon" />,
|
||||
Program: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
Recording: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
Season: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
Series: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
Studio: <MdiMultimedia className="card-image-icon" />,
|
||||
Trailer: <MdiYoutube className="card-image-icon" />,
|
||||
TvChannel: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
TvProgram: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
UserRootFolder: <MdiFolderOutline className="card-image-icon" />,
|
||||
UserView: <MdiMultimedia className="card-image-icon" />,
|
||||
Video: <MdiFilmstrip className="card-image-icon" />,
|
||||
Year: <MdiMultimedia className="card-image-icon" />,
|
||||
};
|
||||
@@ -4,16 +4,32 @@ import React from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
|
||||
import { BrowserRouter as Router } from "react-router-dom";
|
||||
import { CookiesProvider } from "react-cookie";
|
||||
|
||||
import { invoke } from "@tauri-apps/api/tauri";
|
||||
|
||||
import App from "./App";
|
||||
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
|
||||
import store from "./store";
|
||||
import { Provider } from "react-redux";
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
ReactDOM.createRoot(document.getElementById("root")).render(
|
||||
<React.StrictMode>
|
||||
<CookiesProvider>
|
||||
<Router>
|
||||
<App />
|
||||
</Router>
|
||||
</CookiesProvider>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<Provider store={store}>
|
||||
<Router>
|
||||
<App />
|
||||
</Router>
|
||||
</Provider>
|
||||
</QueryClientProvider>
|
||||
</React.StrictMode>,
|
||||
);
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
// This will wait for the window to load, but you could
|
||||
// run this function on whatever trigger you want
|
||||
invoke("close_splashscreen");
|
||||
});
|
||||
@@ -10,4 +10,6 @@
|
||||
|
||||
clrBackgroundDark: $clr-background-dark;
|
||||
clrBackgroundLight: $clr-background-light;
|
||||
|
||||
borderRadiusDefault: $border-radius-default;
|
||||
}
|
||||
@@ -12,6 +12,12 @@
|
||||
margin: 0 auto;
|
||||
}
|
||||
&-background {
|
||||
&-blurhash {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
}
|
||||
&-container {
|
||||
position: absolute;
|
||||
z-index: 0;
|
||||
@@ -21,13 +27,12 @@
|
||||
bottom: 0;
|
||||
mask-image: linear-gradient(
|
||||
to right,
|
||||
transparent 20%,
|
||||
black 50%
|
||||
rgba(0, 0, 0, 0.1),
|
||||
black 90%
|
||||
);
|
||||
-webkit-mask-image: linear-gradient(
|
||||
to right,
|
||||
transparent 20%,
|
||||
rgb(0 0 0 / 0.5) 50%,
|
||||
rgba(0, 0, 0, 0.1),
|
||||
black 90%
|
||||
);
|
||||
}
|
||||
@@ -39,6 +44,20 @@
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-position: center;
|
||||
opacity: 1;
|
||||
mask-image: linear-gradient(
|
||||
to right,
|
||||
transparent 10%,
|
||||
rgba(0, 0, 0, 0.5) 50%,
|
||||
black 90%
|
||||
);
|
||||
-webkit-mask-image: linear-gradient(
|
||||
to right,
|
||||
transparent 10%,
|
||||
rgba(0, 0, 0, 0.5) 50%,
|
||||
black 90%
|
||||
);
|
||||
}
|
||||
&-icon {
|
||||
position: absolute;
|
||||
@@ -46,11 +65,10 @@
|
||||
left: 70%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
color: $clr-accent-default;
|
||||
|
||||
fill: url(#clr-gradient-default) !important;
|
||||
&-container {
|
||||
position: absolute;
|
||||
background: $clr-accent-dark;
|
||||
background: $clr-gradient-dark;
|
||||
z-index: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
@@ -63,6 +81,13 @@
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
-webkit-line-clamp: 2;
|
||||
margin-bottom: 0.5em;
|
||||
&-logo {
|
||||
max-width: 6em;
|
||||
height: 2em;
|
||||
object-fit: contain;
|
||||
object-position: bottom;
|
||||
}
|
||||
}
|
||||
&-detail {
|
||||
position: relative;
|
||||
@@ -82,18 +107,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
.home-section {
|
||||
&-heading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
gap: 0.35em;
|
||||
position: relative;
|
||||
margin-bottom: 0.25em !important;
|
||||
&-decoration {
|
||||
width: 0.75em;
|
||||
height: 3px;
|
||||
background: white;
|
||||
}
|
||||
}
|
||||
.backdropContainer {
|
||||
background: linear-gradient(
|
||||
45deg,
|
||||
$clr-background-default,
|
||||
$clr-background-light
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
/** @format */
|
||||
import { useParams } from "react-router-dom";
|
||||
|
||||
const LibraryView = () => {
|
||||
const { id } = useParams();
|
||||
return <h1>{id}</h1>;
|
||||
};
|
||||
|
||||
export default LibraryView;
|
||||
@@ -7,9 +7,11 @@
|
||||
width: min(60vw, 45em);
|
||||
}
|
||||
&Card {
|
||||
border-radius: $border-radius-default;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
flex: 1 1 0px;
|
||||
overflow: hidden;
|
||||
}
|
||||
&Icon {
|
||||
font-size: 5em;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
/** @format */
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import { Cookies, useCookies } from "react-cookie";
|
||||
import { useState, useEffect, useMemo } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useNavigate, useParams, Link } from "react-router-dom";
|
||||
import { EventEmitter as event } from "../../eventEmitter.js";
|
||||
import { motion } from "framer-motion";
|
||||
|
||||
import { getServer } from "../../utils/storage/servers.js";
|
||||
import { saveUser } from "../../utils/storage/user.js";
|
||||
|
||||
// import Icon from "mdi-material-ui";
|
||||
import { MdiEyeOffOutline } from "../../components/icons/mdiEyeOffOutline";
|
||||
@@ -22,23 +24,34 @@ import IconButton from "@mui/material/IconButton";
|
||||
import LoadingButton from "@mui/lab/LoadingButton";
|
||||
import Button from "@mui/material/Button";
|
||||
import { useSnackbar } from "notistack";
|
||||
import FormGroup from "@mui/material/FormGroup";
|
||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||
import Checkbox from "@mui/material/Checkbox";
|
||||
|
||||
import { AvatarCard, AvatarImage } from "../../components/avatar/avatar.jsx";
|
||||
import { AvatarImage } from "../../components/avatar/avatar.jsx";
|
||||
import { CardScroller } from "../../components/cardScroller/cardScroller.jsx";
|
||||
import { Card } from "../../components/card/card.jsx";
|
||||
import { AppBarBackOnly } from "../../components/appBar/backOnly.jsx";
|
||||
|
||||
// import { jellyfin } from "../../jellyfin";
|
||||
// import getSystemApi from "@jellyfin/sdk";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getBrandingApi } from "@jellyfin/sdk/lib/utils/api/branding-api";
|
||||
|
||||
import "./login.module.scss";
|
||||
import { CardsSkeleton } from "../../components/skeleton/cards.jsx";
|
||||
|
||||
export const LoginWithImage = () => {
|
||||
const { userName, userId } = useParams();
|
||||
|
||||
const [password, setPassword] = useState({
|
||||
showpass: false,
|
||||
});
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [rememberMe, setRememberMe] = useState(true);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
const handlePassword = (prop) => (event) => {
|
||||
@@ -57,7 +70,7 @@ export const LoginWithImage = () => {
|
||||
|
||||
const authUser = async () => {
|
||||
try {
|
||||
const auth = await api.authenticateUserByName(
|
||||
const auth = await window.api.authenticateUserByName(
|
||||
userName,
|
||||
password.password,
|
||||
);
|
||||
@@ -73,12 +86,18 @@ export const LoginWithImage = () => {
|
||||
setLoading(true);
|
||||
const user = await authUser();
|
||||
sessionStorage.setItem("accessToken", user.data.AccessToken);
|
||||
if (rememberMe == true) {
|
||||
saveUser(userName, password.password);
|
||||
}
|
||||
event.emit("set-api-accessToken", window.api.basePath);
|
||||
// setAccessToken(user.data.AccessToken)
|
||||
setLoading(false);
|
||||
navigate(`/home`);
|
||||
};
|
||||
|
||||
const handleCheckRememberMe = (event) => {
|
||||
setRememberMe(event.target.checked);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<AppBarBackOnly />
|
||||
@@ -90,7 +109,13 @@ export const LoginWithImage = () => {
|
||||
alignItems="center"
|
||||
spacing={2}
|
||||
>
|
||||
<Grid item marginBottom={2}>
|
||||
<Grid
|
||||
container
|
||||
direction="column"
|
||||
justifyContent="center"
|
||||
alignItems="center"
|
||||
marginBottom={2}
|
||||
>
|
||||
<Typography
|
||||
textAlign="center"
|
||||
variant="h3"
|
||||
@@ -116,39 +141,53 @@ export const LoginWithImage = () => {
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item minWidth="100%">
|
||||
<br />
|
||||
<FormControl variant="outlined" fullWidth>
|
||||
<InputLabel htmlFor="user-password">
|
||||
Password:
|
||||
</InputLabel>
|
||||
<OutlinedInput
|
||||
id="user-password"
|
||||
type={
|
||||
password.showpass
|
||||
? "text"
|
||||
: "password"
|
||||
}
|
||||
variant="outlined"
|
||||
onChange={handlePassword("password")}
|
||||
label="Password:"
|
||||
endAdornment={
|
||||
<InputAdornment position="end">
|
||||
<IconButton
|
||||
onClick={
|
||||
handleShowPassword
|
||||
}
|
||||
aria-label="toggle password visibility"
|
||||
>
|
||||
{password.showpass ? (
|
||||
<MdiEyeOffOutline />
|
||||
) : (
|
||||
<MdiEyeOutline />
|
||||
)}
|
||||
</IconButton>
|
||||
</InputAdornment>
|
||||
<FormGroup>
|
||||
<FormControl variant="outlined" fullWidth>
|
||||
<InputLabel htmlFor="user-password">
|
||||
Password:
|
||||
</InputLabel>
|
||||
<OutlinedInput
|
||||
id="user-password"
|
||||
type={
|
||||
password.showpass
|
||||
? "text"
|
||||
: "password"
|
||||
}
|
||||
variant="outlined"
|
||||
onChange={handlePassword(
|
||||
"password",
|
||||
)}
|
||||
label="Password:"
|
||||
endAdornment={
|
||||
<InputAdornment position="end">
|
||||
<IconButton
|
||||
onClick={
|
||||
handleShowPassword
|
||||
}
|
||||
aria-label="toggle password visibility"
|
||||
>
|
||||
{password.showpass ? (
|
||||
<MdiEyeOffOutline />
|
||||
) : (
|
||||
<MdiEyeOutline />
|
||||
)}
|
||||
</IconButton>
|
||||
</InputAdornment>
|
||||
}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
checked={rememberMe}
|
||||
onChange={
|
||||
handleCheckRememberMe
|
||||
}
|
||||
/>
|
||||
}
|
||||
label="Remember me"
|
||||
/>
|
||||
</FormControl>
|
||||
</FormGroup>
|
||||
</Grid>
|
||||
<Grid item minWidth="100%">
|
||||
<LoadingButton
|
||||
@@ -172,10 +211,6 @@ export const LoginWithImage = () => {
|
||||
export const UserLogin = () => {
|
||||
const [userList, setUsers] = useState([]);
|
||||
const navigate = useNavigate();
|
||||
const cookies = new Cookies();
|
||||
|
||||
const currentServer = cookies.get("currentServer");
|
||||
const serverList = cookies.get("servers");
|
||||
|
||||
const handleChangeServer = () => {
|
||||
navigate("/servers/list");
|
||||
@@ -183,50 +218,52 @@ export const UserLogin = () => {
|
||||
const handleManualLogin = () => {
|
||||
navigate("/login/manual");
|
||||
};
|
||||
const getUsers = async () => {
|
||||
const users = await getUserApi(window.api).getPublicUsers();
|
||||
// console.log(users.data);
|
||||
return users;
|
||||
// return {};
|
||||
};
|
||||
useEffect(() => {
|
||||
getUsers().then((users) => {
|
||||
setUsers(users.data);
|
||||
console.log(userList);
|
||||
});
|
||||
}, []);
|
||||
const users = useQuery({
|
||||
queryKey: ["login", "users"],
|
||||
queryFn: async () => {
|
||||
const users = await getUserApi(window.api).getPublicUsers();
|
||||
// console.log(users.data);
|
||||
return users.data;
|
||||
// return {};
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<AppBarBackOnly />
|
||||
<Container maxWidth="md" className="centered">
|
||||
<h1 color="white">WIP-user login</h1>
|
||||
<div className="userList">
|
||||
{userList.map((item, index) => {
|
||||
return (
|
||||
//
|
||||
<Link
|
||||
to={`/login/withImg/${item.Name}/${item.Id}/`}
|
||||
key={item.Id}
|
||||
className="userCard"
|
||||
index={index}
|
||||
>
|
||||
{item.PrimaryImageTag ? (
|
||||
<AvatarCard
|
||||
userName={item.Name}
|
||||
userId={item.Id}
|
||||
userImageAvailable={true}
|
||||
></AvatarCard>
|
||||
) : (
|
||||
<AvatarCard
|
||||
userName={item.Name}
|
||||
userImageAvailable={false}
|
||||
></AvatarCard>
|
||||
)}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
{/* <Typography variant="h3" sx={{ marginBottom: "1em" }}>
|
||||
Users
|
||||
</Typography> */}
|
||||
{users.isLoading ? (
|
||||
<CardsSkeleton />
|
||||
) : (
|
||||
<CardScroller displayCards={5} title="Users">
|
||||
{users.data.map((item, index) => {
|
||||
return (
|
||||
//
|
||||
<Link
|
||||
to={`/login/withImg/${item.Name}/${item.Id}/`}
|
||||
key={item.Id}
|
||||
className="userCard"
|
||||
index={index}
|
||||
>
|
||||
<Card
|
||||
key={index}
|
||||
itemName={item.Name}
|
||||
itemId={item.Id}
|
||||
imageTags={
|
||||
!!item.PrimaryImageTag
|
||||
}
|
||||
// cardType="sqaure"
|
||||
iconType="Person"
|
||||
cardOrientation="sqaure"
|
||||
/>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
<div className="buttons">
|
||||
<Button
|
||||
color="secondary"
|
||||
@@ -251,6 +288,8 @@ export const UserLogin = () => {
|
||||
|
||||
export const UserLoginManual = () => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [rememberMe, setRememberMe] = useState(true);
|
||||
|
||||
const navigate = useNavigate();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
@@ -259,6 +298,17 @@ export const UserLoginManual = () => {
|
||||
});
|
||||
const [userName, setUserName] = useState("");
|
||||
|
||||
const server = useQuery({
|
||||
queryKey: ["login, manual", "serverInfo"],
|
||||
queryFn: async () => {
|
||||
const result = await getBrandingApi(
|
||||
window.api,
|
||||
).getBrandingOptions();
|
||||
return result.data;
|
||||
},
|
||||
enabled: !window.api,
|
||||
});
|
||||
|
||||
const handleUsername = (event) => {
|
||||
setUserName(event.target.value);
|
||||
};
|
||||
@@ -279,7 +329,7 @@ export const UserLoginManual = () => {
|
||||
|
||||
const authUser = async () => {
|
||||
try {
|
||||
const auth = await api.authenticateUserByName(
|
||||
const auth = await window.api.authenticateUserByName(
|
||||
userName,
|
||||
password.password,
|
||||
);
|
||||
@@ -297,12 +347,19 @@ export const UserLoginManual = () => {
|
||||
setLoading(true);
|
||||
const user = await authUser();
|
||||
sessionStorage.setItem("accessToken", user.data.AccessToken);
|
||||
if (rememberMe == true) {
|
||||
saveUser(userName, password.password);
|
||||
}
|
||||
event.emit("set-api-accessToken", window.api.basePath);
|
||||
// setAccessToken(user.data.AccessToken)
|
||||
setLoading(false);
|
||||
navigate(`/home`);
|
||||
};
|
||||
|
||||
const handleCheckRememberMe = (event) => {
|
||||
setRememberMe(event.target.checked);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<AppBarBackOnly />
|
||||
@@ -338,42 +395,57 @@ export const UserLoginManual = () => {
|
||||
</FormControl>
|
||||
</Grid>
|
||||
<Grid sx={{ width: "100%" }} item xl={5} md={6}>
|
||||
<FormControl
|
||||
sx={{ width: "100%" }}
|
||||
variant="outlined"
|
||||
>
|
||||
<InputLabel htmlFor="user-password">
|
||||
Password:
|
||||
</InputLabel>
|
||||
<OutlinedInput
|
||||
fullWidth
|
||||
id="user-password"
|
||||
type={
|
||||
password.showpass
|
||||
? "text"
|
||||
: "password"
|
||||
}
|
||||
<FormGroup>
|
||||
<FormControl
|
||||
sx={{ width: "100%" }}
|
||||
variant="outlined"
|
||||
onChange={handlePassword("password")}
|
||||
label="Password:"
|
||||
endAdornment={
|
||||
<InputAdornment position="end">
|
||||
<IconButton
|
||||
onClick={
|
||||
handleShowPassword
|
||||
}
|
||||
aria-label="toggle password visibility"
|
||||
>
|
||||
{password.showpass ? (
|
||||
<MdiEyeOffOutline />
|
||||
) : (
|
||||
<MdiEyeOutline />
|
||||
)}
|
||||
</IconButton>
|
||||
</InputAdornment>
|
||||
>
|
||||
<InputLabel htmlFor="user-password">
|
||||
Password:
|
||||
</InputLabel>
|
||||
<OutlinedInput
|
||||
fullWidth
|
||||
id="user-password"
|
||||
type={
|
||||
password.showpass
|
||||
? "text"
|
||||
: "password"
|
||||
}
|
||||
variant="outlined"
|
||||
onChange={handlePassword(
|
||||
"password",
|
||||
)}
|
||||
label="Password:"
|
||||
endAdornment={
|
||||
<InputAdornment position="end">
|
||||
<IconButton
|
||||
onClick={
|
||||
handleShowPassword
|
||||
}
|
||||
aria-label="toggle password visibility"
|
||||
>
|
||||
{password.showpass ? (
|
||||
<MdiEyeOffOutline />
|
||||
) : (
|
||||
<MdiEyeOutline />
|
||||
)}
|
||||
</IconButton>
|
||||
</InputAdornment>
|
||||
}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
checked={rememberMe}
|
||||
onChange={
|
||||
handleCheckRememberMe
|
||||
}
|
||||
/>
|
||||
}
|
||||
label="Remember me"
|
||||
/>
|
||||
</FormControl>
|
||||
</FormGroup>
|
||||
</Grid>
|
||||
<Grid item xl={5} md={6} sx={{ width: "100%" }}>
|
||||
<LoadingButton
|
||||
@@ -388,6 +460,12 @@ export const UserLoginManual = () => {
|
||||
Login
|
||||
</LoadingButton>
|
||||
</Grid>
|
||||
<Grid item xl={15} md={6} sx={{ width: "100%" }}>
|
||||
<Typography variant="subtitle2">
|
||||
{server.isSuccess &&
|
||||
server.data.LoginDisclaimer}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Container>
|
||||
</>
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import { Cookies, useCookies } from "react-cookie";
|
||||
import { Navigate } from "react-router-dom";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
import { EventEmitter as event } from "../../../eventEmitter.js";
|
||||
import { setServer } from "../../../utils/storage/servers.js";
|
||||
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
|
||||
// MUI
|
||||
import TextField from "@mui/material/TextField";
|
||||
@@ -14,8 +16,6 @@ import Typography from "@mui/material/Typography";
|
||||
import Grid from "@mui/material/Grid";
|
||||
import LoadingButton from "@mui/lab/LoadingButton";
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
import Button from "@mui/material/Button";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import Container from "@mui/material/Container";
|
||||
|
||||
import { mdiChevronRight } from "@mdi/js";
|
||||
@@ -126,57 +126,53 @@ export const ServerList = () => {
|
||||
export const ServerSetup = (props) => {
|
||||
const [serverIp, setServerIp] = useState("");
|
||||
const [checkingServer, setServerCheckState] = useState(false);
|
||||
const [isJfServer, setIsJfServerState] = useState(false);
|
||||
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
const [serverlistCookies, setServerList] = useCookies(["servers"]);
|
||||
const [currentServer, setCurrentServer] = useCookies(["currentServer"]);
|
||||
const cookies = new Cookies();
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const usersAvailable = async () => {
|
||||
const users = await getUserApi(window.api).getPublicUsers();
|
||||
if (users.data.length >= 1) {
|
||||
console.log("Users => ", users.data);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
const addServer = async () => {
|
||||
event.emit("create-jellyfin-api", serverIp);
|
||||
let sysInfo = await getSystemApi(window.api).getPublicSystemInfo();
|
||||
sysInfo = sysInfo.data;
|
||||
let initServerList = cookies.get("servers");
|
||||
if (initServerList == null) {
|
||||
initServerList = [];
|
||||
|
||||
// Set Server Config to Tauri store
|
||||
sysInfo.Ip = serverIp;
|
||||
setServer(sysInfo);
|
||||
|
||||
const usersAvailablity = await usersAvailable();
|
||||
if (usersAvailablity == true) {
|
||||
console.log(usersAvailablity);
|
||||
navigate("/login/users");
|
||||
} else {
|
||||
initServerList = JSON.parse(initServerList);
|
||||
navigate("/login/manual");
|
||||
}
|
||||
let serverConf = {
|
||||
serverName: sysInfo.ServerName,
|
||||
id: sysInfo.Id,
|
||||
jellyfinVersion: sysInfo.Version,
|
||||
serverAddress: serverIp,
|
||||
};
|
||||
let jfId = sysInfo.Id;
|
||||
let server = {};
|
||||
server[sysInfo.Id] = serverConf;
|
||||
server = JSON.stringify([...initServerList, server]);
|
||||
setServerList("servers", server, { path: "/" });
|
||||
setCurrentServer("currentServer", sysInfo.Id, { path: "/" });
|
||||
setIsJfServerState(true);
|
||||
};
|
||||
|
||||
const handleAddServer = () => {
|
||||
setLoading(true);
|
||||
let data;
|
||||
// setServerCheckState(true);
|
||||
fetch(`${serverIp}/System/Ping`, {
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
if (data == "Jellyfin Server") {
|
||||
console.log(true);
|
||||
// setServerCheckState(false);
|
||||
addServer();
|
||||
setLoading(false);
|
||||
return true;
|
||||
} else {
|
||||
// setServerCheckState(false);
|
||||
enqueueSnackbar(
|
||||
"The server address does not seem be a jellyfin server",
|
||||
{ variant: "error" },
|
||||
@@ -186,7 +182,6 @@ export const ServerSetup = (props) => {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
// setServerCheckState(false);
|
||||
setLoading(false);
|
||||
enqueueSnackbar(
|
||||
"Unable to verify whether the give address is a valid Jellyfin server",
|
||||
@@ -198,9 +193,8 @@ export const ServerSetup = (props) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
{isJfServer && <Navigate to="/login" />}
|
||||
<Container
|
||||
maxWidth="md"
|
||||
maxWidth="sm"
|
||||
className={
|
||||
checkingServer
|
||||
? "centered serverContainer loading"
|
||||
@@ -215,7 +209,7 @@ export const ServerSetup = (props) => {
|
||||
alignItems="center"
|
||||
>
|
||||
<Grid item xl={5} md={6} sx={{ marginBottom: "1em" }}>
|
||||
<JellyplayerLogo className="logo" />
|
||||
<Typography variant="h3">Add Server</Typography>
|
||||
</Grid>
|
||||
<Grid item xl={5} md={6} sx={{ width: "100%" }}>
|
||||
<TextField
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/** @format */
|
||||
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import sideBarReducer from "./utils/slice/sidemenu";
|
||||
import appBarReducer from "./utils/slice/appBar";
|
||||
export default configureStore({
|
||||
reducer: {
|
||||
sidebar: sideBarReducer,
|
||||
appBar: appBarReducer,
|
||||
},
|
||||
});
|
||||
@@ -1,4 +1,18 @@
|
||||
/** @format */
|
||||
::-webkit-scrollbar {
|
||||
width: 10px;
|
||||
background: $clr-background-dark;
|
||||
}
|
||||
::-webkit-scrollbar-track {
|
||||
background-color: transparent;
|
||||
&:hover {
|
||||
background: rgb(255 255 255 / 0.25);
|
||||
}
|
||||
}
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: rgb(255 255 255 / 0.25);
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Open Sans";
|
||||
background: $clr-background-default;
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
/** @format */
|
||||
|
||||
$clr-accent-default: hsl(337, 96%, 56%);
|
||||
$clr-accent-dark: hsl(337, 96%, 10%);
|
||||
$clr-secondary-default: hsl(273, 100%, 22%);
|
||||
$clr-accent-dark: hsl(337, 96%, 20%);
|
||||
$clr-secondary-default: hsl(273, 100%, 36%);
|
||||
$clr-secondary-dark: hsl(273, 100%, 12%);
|
||||
$clr-background-default: hsl(256, 100%, 6%);
|
||||
|
||||
$clr-background-dark: hsl(256, 100%, 4%);
|
||||
$clr-background-light: hsl(256, 100%, 16%);
|
||||
|
||||
$clr-gradient-default: linear-gradient(
|
||||
135deg,
|
||||
$clr-accent-default,
|
||||
$clr-secondary-default
|
||||
);
|
||||
$clr-gradient-dark: linear-gradient(
|
||||
135deg,
|
||||
$clr-accent-dark,
|
||||
$clr-secondary-dark
|
||||
);
|
||||
|
||||
$border-radius-default: 10px;
|
||||
$border-radius-intensity-1: 5px;
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@ export const theme = createTheme({
|
||||
default: clrBackgroundDefault,
|
||||
paper: clrBackgroundDark,
|
||||
},
|
||||
white: {
|
||||
main: "#ffffff",
|
||||
},
|
||||
mode: "dark",
|
||||
},
|
||||
typography: {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @format
|
||||
* @param {string} date - Date from server
|
||||
* @returns {string} Formated Date
|
||||
*/
|
||||
|
||||
export const formateDate = (date) => {
|
||||
date = new Date(date);
|
||||
date = new Intl.DateTimeFormat().format(date);
|
||||
return date;
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @format
|
||||
* @param {number} ticks - C# ticks of a particular item
|
||||
* @return {number} Converted ticks to Milliseconds
|
||||
*/
|
||||
|
||||
const ticksToMs = (ticks) => {
|
||||
return Math.round(ticks / 10000);
|
||||
};
|
||||
|
||||
export const getRuntime = (ticks) => {
|
||||
let time = ticksToMs(ticks);
|
||||
let formatedTime = "";
|
||||
let timeSec = Math.round(time / 1000);
|
||||
let timeMin = Math.round(timeSec / 60);
|
||||
if (timeMin > 60) {
|
||||
let timeHr = Math.floor(timeMin / 60);
|
||||
timeMin -= timeHr * 60;
|
||||
formatedTime = `${timeHr}hr ${timeMin}min`;
|
||||
} else {
|
||||
formatedTime = `${timeMin}min`;
|
||||
}
|
||||
return formatedTime;
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
/** @format */
|
||||
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
export const appBarSlice = createSlice({
|
||||
name: "appBar",
|
||||
initialState: {
|
||||
visible: false,
|
||||
backdrop: false,
|
||||
},
|
||||
reducers: {
|
||||
showAppBar: (state) => {
|
||||
state.visible = true;
|
||||
},
|
||||
hideAppBar: (state) => {
|
||||
state.visible = false;
|
||||
},
|
||||
setBackdrop: (state, action) => {
|
||||
state.backdrop = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { showAppBar, hideAppBar, setBackdrop } = appBarSlice.actions;
|
||||
export default appBarSlice.reducer;
|
||||
@@ -0,0 +1,20 @@
|
||||
/** @format */
|
||||
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
export const sideBarSlice = createSlice({
|
||||
name: "sidebar",
|
||||
initialState: {
|
||||
visible: false,
|
||||
},
|
||||
reducers: {
|
||||
showSidemenu: (state) => {
|
||||
state.visible = true;
|
||||
},
|
||||
hideSidemenu: (state) => {
|
||||
state.visible = false;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { showSidemenu, hideSidemenu } = sideBarSlice.actions;
|
||||
export default sideBarSlice.reducer;
|
||||
@@ -0,0 +1,33 @@
|
||||
/** @format */
|
||||
|
||||
import { Store } from "tauri-plugin-store-api";
|
||||
|
||||
const servers = new Store(".servers.dat");
|
||||
|
||||
/**
|
||||
* Set server in .servers.dat
|
||||
* @param {object} data - Server info
|
||||
*/
|
||||
const setServer = async (data) => {
|
||||
let server = servers.set("server", data);
|
||||
await servers.save();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get Server list
|
||||
* @returns {object} server
|
||||
*/
|
||||
const getServer = async () => {
|
||||
let server = await servers.get("server");
|
||||
return server;
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete the given server from client storage
|
||||
*/
|
||||
const delServer = async () => {
|
||||
await servers.delete("server");
|
||||
await servers.save();
|
||||
};
|
||||
|
||||
export { setServer, getServer, delServer };
|
||||
@@ -0,0 +1,35 @@
|
||||
/** @format */
|
||||
|
||||
import { Store } from "tauri-plugin-store-api";
|
||||
|
||||
const user = new Store(".user.dat");
|
||||
|
||||
/**
|
||||
* Set User details to .user.dat
|
||||
* @param {string} userName - User's name
|
||||
* @param {string} userPassword - User's Password
|
||||
*/
|
||||
const saveUser = async (userName, userPassword) => {
|
||||
let details = user.set("user", {
|
||||
Name: userName,
|
||||
Password: userPassword || "",
|
||||
});
|
||||
await user.save();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get saved user fro .user.dat
|
||||
* @return {object}
|
||||
*/
|
||||
const getUser = async () => {
|
||||
let details = await user.get("user");
|
||||
return details;
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete user from storage
|
||||
*/
|
||||
const delUser = async () => {
|
||||
await user.clear();
|
||||
};
|
||||
export { saveUser, getUser, delUser };
|
||||