Compare commits

...
35 Commits
Author SHA1 Message Date
--remove-section e5171b7bb8 refactor: update workflows 2026-02-08 13:55:22 +05:30
--remove-section 9211faabf0 feat: auto generate release notes 2026-02-08 13:27:00 +05:30
--remove-section 422b1d6aa4 chore(deps): update dependencies 2026-02-07 17:14:06 +05:30
--remove-section 7f7866b28d fix: vite build failing because of jassub 2026-02-03 21:18:48 +05:30
--remove-section 1defb53945 feat: implement a new updator 2026-02-03 01:20:33 +05:30
--remove-section 73e3b865ab refactor: update UI for setup 2026-02-01 17:11:19 +05:30
--remove-section 691df70aff refactor: redesign sidebar component 2026-01-29 21:36:13 +05:30
--remove-section 6f2d5a5627 feat: add new server page 2026-01-28 23:21:35 +05:30
--remove-section 7804ab2b86 fix: home page carousel causing scroll on item change and fix other performance issues 2026-01-28 21:07:11 +05:30
--remove-section 4ade92bccc chore(deps): update dependencies 2026-01-27 21:48:12 +05:30
--remove-section ab1aa23725 feat: redesign card scroller 2026-01-27 21:37:29 +05:30
--remove-section 0131a23dc2 feat: add new favorites page 2026-01-27 21:02:02 +05:30
--remove-section 72ca2fb4f3 refactor: cleanup css code and remove duplicates 2026-01-21 21:36:06 +05:30
--remove-section b39a15449d refactor: improve hero carousel styling 2026-01-21 20:53:38 +05:30
--remove-section cb83b05c7a feat: add new adv. search page 2026-01-21 20:43:20 +05:30
--remove-section 32f5b3b3cf refactor: cleanup search animation 2026-01-20 20:17:20 +05:30
--remove-section 94e6a03e87 feat: autofocus input in search dialog 2026-01-17 20:27:10 +05:30
--remove-section 690070207b refactor: improve UI components 2026-01-17 20:20:20 +05:30
--remove-section 79c70e6d46 feat: add new search dialog 2026-01-17 19:30:43 +05:30
Prayag Prajapati cf1f3c772d Merge pull request #609 from tedhinklater/main
Update index.tsx "Perferences" to "Preferences"
2026-01-10 22:39:41 +05:30
tedhinklater b870a119e5 Update index.tsx "Perferences" to "Preferences" 2026-01-10 17:00:02 +00:00
--remove-section 0883cb0fe1 fix: series page not showing correct bg 2026-01-09 21:46:57 +05:30
--remove-section 8519c12c45 chore(deps): update to latest deps 2026-01-09 21:35:44 +05:30
--remove-section d6c1b0992e feat: add new last media layout 2026-01-09 21:09:05 +05:30
--remove-section 9c3cc53278 fix(ci): only upload dundles in nightly release 2025-12-26 20:46:20 +05:30
--remove-section abc7d68016 feat: persist volume across different medias 2025-12-26 20:41:35 +05:30
--remove-section ad8d8545e9 feat: revamp the entire audio player with a refreshed look and cleanup audioPlayer code 2025-12-26 20:27:05 +05:30
--remove-section 1c8c048df0 fix: subtitle track not setting properly on first render 2025-12-26 17:13:32 +05:30
Prayag Prajapati c0402fe8cf Merge pull request #595 from vikingnope/fix-niightly-release
fix: Clean nightly process
2025-12-26 02:24:22 +05:30
--remove-section ce6e4b681b fix: episode page not showing series details 2025-12-23 22:05:11 +05:30
--remove-section 6bf7f434b5 refactor: cleanup api setting and optimize rerendering due to api setting 2025-12-23 21:56:06 +05:30
--remove-section 4834a31cb5 fix: upNext not showing up in homepage 2025-12-23 21:49:35 +05:30
--remove-section b49f187098 feat: implement proper queue functionality and improve upnext flyout and skip segment buttons 2025-12-23 21:45:32 +05:30
--remove-section e41b5b3085 fix: display and report correct playback method 2025-12-22 22:29:59 +05:30
Vikingnope c19198e706 Made nightly builds cleaner 2025-12-21 23:14:09 +01:00
111 changed files with 9932 additions and 6595 deletions

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
changelog:
categories:
- title: 🏕 Features
labels:
- '*'
exclude:
labels:
- dependencies
- title: 👒 Dependencies
labels:
- dependencies
+26 -112
View File
@@ -134,126 +134,40 @@ jobs:
contents: write # Required for creating/updating releases contents: write # Required for creating/updating releases
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4.2.2 uses: actions/checkout@v6.0.1
- name: Download all artifacts - name: Download all artifacts
uses: actions/download-artifact@v4.3.0 uses: actions/download-artifact@v7.0.0
with: with:
path: artifacts path: artifacts
- name: Install dependencies - name: Prepare assets
run: npm install mime-types
- name: Get commit details
id: commit-details
run: | run: |
echo "message=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT mkdir -p release_assets
- name: Create or update nightly release find artifacts -type f \( -name "*.exe" -o -name "*.msi" -o -name "*.dmg" -o -name "*.deb" -o -name "*.AppImage" -o -name "*.rpm" -o -name "*.tar.gz" \) | while read -r file; do
uses: actions/github-script@v7.0.1 # Extract platform from artifact name (e.g. Blink-ubuntu-22.04-devSHA)
artifact_name=$(echo "$file" | cut -d'/' -f2)
platform=$(echo "$artifact_name" | sed -E 's/Blink-(.*)-dev.*/\1/' | sed 's/-/_/g')
filename=$(basename "$file")
cp "$file" "release_assets/${platform}-${filename}"
done
- name: Delete old nightly release
run: gh release delete nightly --yes --repo ${{ github.repository }} || true
env: env:
COMMIT_MESSAGE: ${{ steps.commit-details.outputs.message }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create nightly release
uses: softprops/action-gh-release@v2.5.0
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} tag_name: nightly
script: | name: Nightly Build (${{ github.sha }})
const fs = require('fs'); body: |
const path = require('path'); Nightly build from the latest main branch.
// Get today's date in YYYY-MM-DD format **Last commit:** ${{ github.event.head_commit.message }}
const today = new Date().toISOString().split('T')[0]; **SHA:** ${{ github.sha }}
const releaseTag = 'nightly';
const releaseName = `Nightly Build (${today})`;
// Check if nightly release already exists
console.log("Checking for existing nightly release...");
let release;
try {
release = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: releaseTag
});
console.log("Found existing nightly release");
} catch (error) {
if (error.status === 404) {
console.log("No existing nightly release found, creating one...");
release = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: releaseTag,
name: releaseName,
body: `Nightly build created on ${today} from the latest main branch\nLast commit: ${context.sha}\nCommit message: ${process.env.COMMIT_MESSAGE || "No commit message available"}`,
prerelease: true prerelease: true
}); files: release_assets/*
release = release.data; fail_on_unmatched_files: true
} else {
throw error;
}
}
// Handle the case where we have an existing release
// The release object structure differs depending on whether it came from getReleaseByTag or createRelease
const releaseId = release.data ? release.data.id : release.id;
if (releaseId) {
// Update existing release
console.log("Updating existing nightly release...");
const updateResult = await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: releaseId,
name: releaseName,
body: `Nightly build updated on ${today} from the latest main branch.\nLast commit: ${context.sha}\nCommit message: ${process.env.COMMIT_MESSAGE || "No commit message available"}`,
prerelease: true
});
release = updateResult.data;
}
// Delete existing assets to replace them with new ones
if (release.assets && release.assets.length > 0) {
console.log("Deleting existing release assets...");
for (const asset of release.assets) {
await github.rest.repos.deleteReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
asset_id: asset.id
});
}
}
// Upload new artifacts
console.log("Uploading new artifacts...");
const artifactsDir = 'artifacts';
const platforms = ['macos-latest', 'ubuntu-22.04', 'windows-latest'];
const mime = require('mime-types');
for (const platform of platforms) {
const platformDir = path.join(artifactsDir, `Blink-${platform}-dev${context.sha}`);
if (!fs.existsSync(platformDir)) {
console.log(`No artifacts found for ${platform}`);
continue;
}
const files = fs.readdirSync(platformDir, { recursive: true });
for (const file of files) {
if (typeof file === 'string' && !fs.statSync(path.join(platformDir, file)).isDirectory()) {
const filePath = path.join(platformDir, file);
const fileName = path.basename(filePath);
const contentType = mime.lookup(fileName) || 'application/octet-stream';
console.log(`Uploading ${fileName} from ${platform}...`);
// Use Octokit's uploadReleaseAsset with proper content type for binary data
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.id,
name: `${platform.replace(/-/g, '_')}-${fileName}`,
data: fs.readFileSync(filePath),
headers: {
'content-type': contentType,
'content-length': fs.statSync(filePath).size
}
});
}
}
}
console.log("Nightly release updated successfully!");
+1 -5
View File
@@ -67,7 +67,7 @@ jobs:
run: pnpm install --no-frozen-lockfile && pnpm run build # Change this to npm, yarn or pnpm. run: pnpm install --no-frozen-lockfile && pnpm run build # Change this to npm, yarn or pnpm.
- name: Build the app - name: Build the app
uses: tauri-apps/tauri-action@dev uses: tauri-apps/tauri-action@v0
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -75,10 +75,6 @@ jobs:
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
# TODO: Remove the below command after upstream issue is fixed
# Related issue: https://github.com/tauri-apps/tauri/issues/10702
WEBKIT_DISABLE_DMABUF_RENDERER: 1 # Disable DMABUF renderer on Wayland
with: with:
tagName: ${{ github.ref_name }} # This only works if your workflow triggers on new tags. tagName: ${{ github.ref_name }} # This only works if your workflow triggers on new tags.
releaseName: "App Name v__VERSION__" # tauri-action replaces \_\_VERSION\_\_ with the app version. releaseName: "App Name v__VERSION__" # tauri-action replaces \_\_VERSION\_\_ with the app version.
+2 -2
View File
@@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: contains(github.event.release.tag_name, '-alpha') if: contains(github.event.release.tag_name, '-alpha')
steps: steps:
- uses: vedantmgoyal9/winget-releaser@19e706d4c9121098010096f9c495a70a7518b30f - uses: vedantmgoyal9/winget-releaser@main
with: with:
identifier: prayag17.Blink.Alpha identifier: prayag17.Blink.Alpha
version: ${{ github.event.release.tag_name }} version: ${{ github.event.release.tag_name }}
@@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: "!contains(github.event.release.tag_name, '-alpha')" if: "!contains(github.event.release.tag_name, '-alpha')"
steps: steps:
- uses: vedantmgoyal9/winget-releaser@19e706d4c9121098010096f9c495a70a7518b30f - uses: vedantmgoyal9/winget-releaser@main
with: with:
identifier: prayag17.Blink identifier: prayag17.Blink
version: ${{ github.event.release.tag_name }} version: ${{ github.event.release.tag_name }}
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
"$schema": "https://biomejs.dev/schemas/2.2.6/schema.json", "$schema": "https://biomejs.dev/schemas/2.3.13/schema.json",
"assist": { "actions": { "source": { "organizeImports": "on" } } }, "assist": { "actions": { "source": { "organizeImports": "on" } } },
"linter": { "linter": {
"enabled": true, "enabled": true,
+39 -36
View File
@@ -1,7 +1,7 @@
{ {
"name": "blink", "name": "blink",
"private": true, "private": true,
"version": "1.0.0-alpha.3", "version": "1.0.0-alpha.4",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite --force && tsr watch", "dev": "vite --force && tsr watch",
@@ -24,71 +24,74 @@
"@fontsource-variable/plus-jakarta-sans": "^5.2.8", "@fontsource-variable/plus-jakarta-sans": "^5.2.8",
"@fontsource-variable/space-grotesk": "^5.2.10", "@fontsource-variable/space-grotesk": "^5.2.10",
"@jellyfin/sdk": "0.13.0", "@jellyfin/sdk": "0.13.0",
"@mui/lab": "7.0.1-beta.20", "@mui/lab": "7.0.1-beta.21",
"@mui/material": "7.3.6", "@mui/material": "7.3.7",
"@popperjs/core": "^2.11.8", "@popperjs/core": "^2.11.8",
"@react-spring/web": "^10.0.3", "@react-spring/web": "^10.0.3",
"@tanem/react-nprogress": "^5.0.56", "@tanem/react-nprogress": "^5.0.59",
"@tanstack/react-form": "^1.27.5", "@tanstack/react-form": "^1.28.0",
"@tanstack/react-query": "^5.90.12", "@tanstack/react-query": "^5.90.20",
"@tanstack/react-query-devtools": "^5.91.1", "@tanstack/react-query-devtools": "^5.91.3",
"@tanstack/react-router": "^1.141.8", "@tanstack/react-router": "^1.158.4",
"@tanstack/react-router-devtools": "^1.141.8", "@tanstack/react-router-devtools": "^1.158.4",
"@tanstack/react-virtual": "^3.13.13", "@tanstack/react-virtual": "^3.13.18",
"@tauri-apps/api": "2.9.1", "@tauri-apps/api": "2.10.1",
"@tauri-apps/plugin-clipboard-manager": "2.3.2", "@tauri-apps/plugin-clipboard-manager": "2.3.2",
"@tauri-apps/plugin-dialog": "2.4.2", "@tauri-apps/plugin-dialog": "2.6.0",
"@tauri-apps/plugin-global-shortcut": "~2.3.1",
"@tauri-apps/plugin-notification": "2.3.3", "@tauri-apps/plugin-notification": "2.3.3",
"@tauri-apps/plugin-process": "2.3.1", "@tauri-apps/plugin-process": "2.3.1",
"@tauri-apps/plugin-shell": "~2.3.5",
"@tauri-apps/plugin-store": "github:tauri-apps/tauri-plugin-store#v2", "@tauri-apps/plugin-store": "github:tauri-apps/tauri-plugin-store#v2",
"@tauri-apps/plugin-updater": "2.9.0", "@tauri-apps/plugin-updater": "2.10.0",
"@tauri-apps/plugin-upload": "2.3.2", "@tauri-apps/plugin-upload": "2.4.0",
"@tauri-apps/plugin-window-state": "~2.4.1", "@tauri-apps/plugin-window-state": "~2.4.1",
"@types/node": "^25.0.3", "@types/node": "^25.2.1",
"@types/react": "^19.2.7", "@types/react": "^19.2.13",
"@types/react-dom": "^19.2.3", "@types/react-dom": "^19.2.3",
"axios": "^1.13.2", "axios": "^1.13.4",
"axios-tauri-api-adapter": "^2.0.6", "axios-tauri-api-adapter": "^2.0.6",
"blurhash": "^2.0.5", "blurhash": "^2.0.5",
"blurhash-wasm": "^0.2.0", "blurhash-wasm": "^0.2.0",
"immer": "^11.1.0", "immer": "^11.1.3",
"jassub": "^1.8.6", "jassub": "^2.4.1",
"libpgs": "^0.8.1", "libpgs": "^0.8.1",
"lodash": "^4.17.21", "lodash": "^4.17.23",
"material-symbols": "^0.40.2", "material-symbols": "^0.40.2",
"motion": "^12.23.26", "motion": "^12.33.0",
"notistack": "^3.0.2", "notistack": "^3.0.2",
"react": "^19.2.3", "react": "^19.2.4",
"react-blurhash": "^0.3.0", "react-blurhash": "^0.3.0",
"react-dnd": "^16.0.1", "react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1", "react-dnd-html5-backend": "^16.0.1",
"react-dom": "^19.2.3", "react-dom": "^19.2.4",
"react-error-boundary": "^6.0.0", "react-error-boundary": "^6.1.0",
"react-intersection-observer": "^10.0.0", "react-intersection-observer": "^10.0.2",
"react-markdown": "^10.1.0", "react-markdown": "^10.1.0",
"react-multi-carousel": "^2.8.6", "react-multi-carousel": "^2.8.6",
"react-player": "^3.4.0", "react-player": "^3.4.0",
"remark-gfm": "^4.0.1", "remark-gfm": "^4.0.1",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"vite-plugin-svgr": "^4.5.0", "vite-plugin-svgr": "^4.5.0",
"vite-plugin-top-level-await": "^1.6.0",
"wavesurfer.js": "^7.12.1", "wavesurfer.js": "^7.12.1",
"zod": "^4.2.1", "zod": "^4.3.6",
"zustand": "5.0.9" "zustand": "5.0.11"
}, },
"devDependencies": { "devDependencies": {
"@babel/plugin-proposal-optional-chaining-assign": "^7.27.1", "@babel/plugin-proposal-optional-chaining-assign": "^7.27.1",
"@biomejs/biome": "^2.3.10", "@biomejs/biome": "^2.3.14",
"@tanstack/router-cli": "^1.142.0", "@tanstack/router-cli": "^1.158.4",
"@tanstack/router-devtools": "^1.141.8", "@tanstack/router-devtools": "^1.158.4",
"@tanstack/router-vite-plugin": "^1.142.0", "@tanstack/router-vite-plugin": "^1.158.4",
"@tauri-apps/cli": "2.9.6", "@tauri-apps/cli": "2.10.0",
"@types/lodash": "^4.17.21", "@types/lodash": "^4.17.23",
"@vitejs/plugin-react": "^5.1.2", "@vitejs/plugin-react": "^5.1.3",
"babel-plugin-react-compiler": "19.1.0-rc.3", "babel-plugin-react-compiler": "19.1.0-rc.3",
"eslint-plugin-react-hooks": "7.0.1", "eslint-plugin-react-hooks": "7.0.1",
"prop-types": "^15.8.1", "prop-types": "^15.8.1",
"sass": "^1.97.1", "sass": "^1.97.3",
"vite": "^7.3.0", "vite": "^7.3.1",
"vite-plugin-wasm": "^3.5.0" "vite-plugin-wasm": "^3.5.0"
}, },
"license": "GPL-3.0-only" "license": "GPL-3.0-only"
+1443 -1243
View File
File diff suppressed because it is too large. Load diff
+616 -403
View File
File diff suppressed because it is too large. Load diff
+5 -3
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "blink" name = "blink"
version = "1.0.0-alpha.3" version = "1.0.0-alpha.4"
description = "A Modern Jellyfin Client" description = "A Modern Jellyfin Client"
authors = ["prayag17", "Blink contributors (https://github.com/prayag17/Blink/graphs/contributors)"] authors = ["prayag17", "Blink contributors (https://github.com/prayag17/Blink/graphs/contributors)"]
license = "GPL-3.0-only" license = "GPL-3.0-only"
@@ -12,13 +12,13 @@ rust-version = "1.59"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies] [build-dependencies]
tauri-build = { version = "2.0.0-beta", features = [] } tauri-build = { version = "2.5.4", features = [] }
[dependencies] [dependencies]
log = "^0.4.21" log = "^0.4.21"
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
tauri = { version = "2.0.0-beta", features = [ "devtools"] } tauri = { version = "2.10.1", features = [ "devtools"] }
tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2", features = ["colored"] } tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2", features = ["colored"] }
@@ -29,6 +29,7 @@ tauri-plugin-clipboard-manager = "2.1.0-beta.6"
tauri-plugin-notification = "2.0.0-rc.1" tauri-plugin-notification = "2.0.0-rc.1"
tauri-plugin-upload = "2.0.0" tauri-plugin-upload = "2.0.0"
tauri-plugin-dialog = "2.0.0" tauri-plugin-dialog = "2.0.0"
tauri-plugin-shell = "2.3.5"
[features] [features]
# by default Tauri runs in production mode # by default Tauri runs in production mode
@@ -39,4 +40,5 @@ default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ] custom-protocol = [ "tauri/custom-protocol" ]
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] [target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-global-shortcut = "2"
tauri-plugin-window-state = "2" tauri-plugin-window-state = "2"
+6 -1
View File
@@ -9,6 +9,11 @@
"main" "main"
], ],
"permissions": [ "permissions": [
"window-state:default" "window-state:default",
"global-shortcut:default",
"global-shortcut:allow-is-registered",
"global-shortcut:allow-register",
"global-shortcut:allow-unregister",
"shell:default"
] ]
} }
+5 -1
View File
@@ -13,10 +13,14 @@
"store:allow-load", "store:allow-load",
"updater:allow-check", "updater:allow-check",
"updater:allow-download-and-install", "updater:allow-download-and-install",
"updater:allow-download",
"updater:allow-install",
"notification:default", "notification:default",
"core:webview:allow-internal-toggle-devtools", "core:webview:allow-internal-toggle-devtools",
"dialog:default", "dialog:default",
"upload:allow-download", "upload:allow-download",
"clipboard-manager:allow-write-text" "clipboard-manager:allow-write-text",
"shell:default",
"shell:allow-open"
] ]
} }
+5 -2
View File
@@ -3,7 +3,9 @@
"identifier": "migrated", "identifier": "migrated",
"description": "permissions that were migrated from v1", "description": "permissions that were migrated from v1",
"local": true, "local": true,
"windows": ["main"], "windows": [
"main"
],
"permissions": [ "permissions": [
"core:path:default", "core:path:default",
"core:event:default", "core:event:default",
@@ -12,6 +14,7 @@
"core:resources:default", "core:resources:default",
"core:menu:default", "core:menu:default",
"core:tray:default", "core:tray:default",
"core:window:allow-set-fullscreen" "core:window:allow-set-fullscreen",
"shell:default"
] ]
} }
+1 -1
View File
@@ -1 +1 @@
{"clipboard-manager":{"default_permission":{"identifier":"default","description":"No features are enabled by default, as we believe\nthe clipboard can be inherently dangerous and it is \napplication specific if read and/or write access is needed.\n\nClipboard interaction needs to be explicitly enabled.\n","permissions":[]},"permissions":{"allow-clear":{"identifier":"allow-clear","description":"Enables the clear command without any pre-configured scope.","commands":{"allow":["clear"],"deny":[]}},"allow-read-image":{"identifier":"allow-read-image","description":"Enables the read_image command without any pre-configured scope.","commands":{"allow":["read_image"],"deny":[]}},"allow-read-text":{"identifier":"allow-read-text","description":"Enables the read_text command without any pre-configured scope.","commands":{"allow":["read_text"],"deny":[]}},"allow-write-html":{"identifier":"allow-write-html","description":"Enables the write_html command without any pre-configured scope.","commands":{"allow":["write_html"],"deny":[]}},"allow-write-image":{"identifier":"allow-write-image","description":"Enables the write_image command without any pre-configured scope.","commands":{"allow":["write_image"],"deny":[]}},"allow-write-text":{"identifier":"allow-write-text","description":"Enables the write_text command without any pre-configured scope.","commands":{"allow":["write_text"],"deny":[]}},"deny-clear":{"identifier":"deny-clear","description":"Denies the clear command without any pre-configured scope.","commands":{"allow":[],"deny":["clear"]}},"deny-read-image":{"identifier":"deny-read-image","description":"Denies the read_image command without any pre-configured scope.","commands":{"allow":[],"deny":["read_image"]}},"deny-read-text":{"identifier":"deny-read-text","description":"Denies the read_text command without any pre-configured scope.","commands":{"allow":[],"deny":["read_text"]}},"deny-write-html":{"identifier":"deny-write-html","description":"Denies the write_html command without any pre-configured scope.","commands":{"allow":[],"deny":["write_html"]}},"deny-write-image":{"identifier":"deny-write-image","description":"Denies the write_image command without any pre-configured scope.","commands":{"allow":[],"deny":["write_image"]}},"deny-write-text":{"identifier":"deny-write-text","description":"Denies the write_text command without any pre-configured scope.","commands":{"allow":[],"deny":["write_text"]}}},"permission_sets":{},"global_scope_schema":null},"core":{"default_permission":{"identifier":"default","description":"Default core plugins set.","permissions":["core:path:default","core:event:default","core:window:default","core:webview:default","core:app:default","core:image:default","core:resources:default","core:menu:default","core:tray:default"]},"permissions":{},"permission_sets":{},"global_scope_schema":null},"core:app":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-version","allow-name","allow-tauri-version","allow-identifier","allow-bundle-type","allow-register-listener","allow-remove-listener"]},"permissions":{"allow-app-hide":{"identifier":"allow-app-hide","description":"Enables the app_hide command without any pre-configured scope.","commands":{"allow":["app_hide"],"deny":[]}},"allow-app-show":{"identifier":"allow-app-show","description":"Enables the app_show command without any pre-configured scope.","commands":{"allow":["app_show"],"deny":[]}},"allow-bundle-type":{"identifier":"allow-bundle-type","description":"Enables the bundle_type command without any pre-configured scope.","commands":{"allow":["bundle_type"],"deny":[]}},"allow-default-window-icon":{"identifier":"allow-default-window-icon","description":"Enables the default_window_icon command without any pre-configured scope.","commands":{"allow":["default_window_icon"],"deny":[]}},"allow-fetch-data-store-identifiers":{"identifier":"allow-fetch-data-store-identifiers","description":"Enables the fetch_data_store_identifiers command without any pre-configured scope.","commands":{"allow":["fetch_data_store_identifiers"],"deny":[]}},"allow-identifier":{"identifier":"allow-identifier","description":"Enables the identifier command without any pre-configured scope.","commands":{"allow":["identifier"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","commands":{"allow":["name"],"deny":[]}},"allow-register-listener":{"identifier":"allow-register-listener","description":"Enables the register_listener command without any pre-configured scope.","commands":{"allow":["register_listener"],"deny":[]}},"allow-remove-data-store":{"identifier":"allow-remove-data-store","description":"Enables the remove_data_store command without any pre-configured scope.","commands":{"allow":["remove_data_store"],"deny":[]}},"allow-remove-listener":{"identifier":"allow-remove-listener","description":"Enables the remove_listener commLine truncated {"clipboard-manager":{"default_permission":{"identifier":"default","description":"No features are enabled by default, as we believe\nthe clipboard can be inherently dangerous and it is \napplication specific if read and/or write access is needed.\n\nClipboard interaction needs to be explicitly enabled.\n","permissions":[]},"permissions":{"allow-clear":{"identifier":"allow-clear","description":"Enables the clear command without any pre-configured scope.","commands":{"allow":["clear"],"deny":[]}},"allow-read-image":{"identifier":"allow-read-image","description":"Enables the read_image command without any pre-configured scope.","commands":{"allow":["read_image"],"deny":[]}},"allow-read-text":{"identifier":"allow-read-text","description":"Enables the read_text command without any pre-configured scope.","commands":{"allow":["read_text"],"deny":[]}},"allow-write-html":{"identifier":"allow-write-html","description":"Enables the write_html command without any pre-configured scope.","commands":{"allow":["write_html"],"deny":[]}},"allow-write-image":{"identifier":"allow-write-image","description":"Enables the write_image command without any pre-configured scope.","commands":{"allow":["write_image"],"deny":[]}},"allow-write-text":{"identifier":"allow-write-text","description":"Enables the write_text command without any pre-configured scope.","commands":{"allow":["write_text"],"deny":[]}},"deny-clear":{"identifier":"deny-clear","description":"Denies the clear command without any pre-configured scope.","commands":{"allow":[],"deny":["clear"]}},"deny-read-image":{"identifier":"deny-read-image","description":"Denies the read_image command without any pre-configured scope.","commands":{"allow":[],"deny":["read_image"]}},"deny-read-text":{"identifier":"deny-read-text","description":"Denies the read_text command without any pre-configured scope.","commands":{"allow":[],"deny":["read_text"]}},"deny-write-html":{"identifier":"deny-write-html","description":"Denies the write_html command without any pre-configured scope.","commands":{"allow":[],"deny":["write_html"]}},"deny-write-image":{"identifier":"deny-write-image","description":"Denies the write_image command without any pre-configured scope.","commands":{"allow":[],"deny":["write_image"]}},"deny-write-text":{"identifier":"deny-write-text","description":"Denies the write_text command without any pre-configured scope.","commands":{"allow":[],"deny":["write_text"]}}},"permission_sets":{},"global_scope_schema":null},"core":{"default_permission":{"identifier":"default","description":"Default core plugins set.","permissions":["core:path:default","core:event:default","core:window:default","core:webview:default","core:app:default","core:image:default","core:resources:default","core:menu:default","core:tray:default"]},"permissions":{},"permission_sets":{},"global_scope_schema":null},"core:app":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-version","allow-name","allow-tauri-version","allow-identifier","allow-bundle-type","allow-register-listener","allow-remove-listener"]},"permissions":{"allow-app-hide":{"identifier":"allow-app-hide","description":"Enables the app_hide command without any pre-configured scope.","commands":{"allow":["app_hide"],"deny":[]}},"allow-app-show":{"identifier":"allow-app-show","description":"Enables the app_show command without any pre-configured scope.","commands":{"allow":["app_show"],"deny":[]}},"allow-bundle-type":{"identifier":"allow-bundle-type","description":"Enables the bundle_type command without any pre-configured scope.","commands":{"allow":["bundle_type"],"deny":[]}},"allow-default-window-icon":{"identifier":"allow-default-window-icon","description":"Enables the default_window_icon command without any pre-configured scope.","commands":{"allow":["default_window_icon"],"deny":[]}},"allow-fetch-data-store-identifiers":{"identifier":"allow-fetch-data-store-identifiers","description":"Enables the fetch_data_store_identifiers command without any pre-configured scope.","commands":{"allow":["fetch_data_store_identifiers"],"deny":[]}},"allow-identifier":{"identifier":"allow-identifier","description":"Enables the identifier command without any pre-configured scope.","commands":{"allow":["identifier"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","commands":{"allow":["name"],"deny":[]}},"allow-register-listener":{"identifier":"allow-register-listener","description":"Enables the register_listener command without any pre-configured scope.","commands":{"allow":["register_listener"],"deny":[]}},"allow-remove-data-store":{"identifier":"allow-remove-data-store","description":"Enables the remove_data_store command without any pre-configured scope.","commands":{"allow":["remove_data_store"],"deny":[]}},"allow-remove-listener":{"identifier":"allow-remove-listener","description":"Enables the remove_listener commLine truncated
+1 -1
View File
@@ -1 +1 @@
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["window-state:default"],"platforms":["macOS","windows","linux"]},"main-capabilities":{"identifier":"main-capabilities","description":"Capability for desktop window","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","store:allow-clear","store:allow-delete","store:allow-keys","store:allow-load","updater:allow-check","updater:allow-download-and-install","notification:default","core:webview:allow-internal-toggle-devtools","dialog:default","upload:allow-download","clipboard-manager:allow-write-text"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default","core:window:allow-set-fullscreen"]}} {"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["window-state:default","global-shortcut:default","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-unregister","shell:default"],"platforms":["macOS","windows","linux"]},"main-capabilities":{"identifier":"main-capabilities","description":"Capability for desktop window","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","store:allow-clear","store:allow-delete","store:allow-keys","store:allow-load","updater:allow-check","updater:allow-download-and-install","updater:allow-download","updater:allow-install","notification:default","core:webview:allow-internal-toggle-devtools","dialog:default","upload:allow-download","clipboard-manager:allow-write-text","shell:default","shell:allow-open"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default","core:window:allow-set-fullscreen","shell:default"]}}
+386
View File
@@ -134,6 +134,216 @@
"description": "Reference a permission or permission set by identifier and extends its scope.", "description": "Reference a permission or permission set by identifier and extends its scope.",
"type": "object", "type": "object",
"allOf": [ "allOf": [
{
"if": {
"properties": {
"identifier": {
"anyOf": [
{
"description": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`",
"type": "string",
"const": "shell:default",
"markdownDescription": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`"
},
{
"description": "Enables the execute command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-execute",
"markdownDescription": "Enables the execute command without any pre-configured scope."
},
{
"description": "Enables the kill command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-kill",
"markdownDescription": "Enables the kill command without any pre-configured scope."
},
{
"description": "Enables the open command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-open",
"markdownDescription": "Enables the open command without any pre-configured scope."
},
{
"description": "Enables the spawn command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-spawn",
"markdownDescription": "Enables the spawn command without any pre-configured scope."
},
{
"description": "Enables the stdin_write command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-stdin-write",
"markdownDescription": "Enables the stdin_write command without any pre-configured scope."
},
{
"description": "Denies the execute command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-execute",
"markdownDescription": "Denies the execute command without any pre-configured scope."
},
{
"description": "Denies the kill command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-kill",
"markdownDescription": "Denies the kill command without any pre-configured scope."
},
{
"description": "Denies the open command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-open",
"markdownDescription": "Denies the open command without any pre-configured scope."
},
{
"description": "Denies the spawn command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-spawn",
"markdownDescription": "Denies the spawn command without any pre-configured scope."
},
{
"description": "Denies the stdin_write command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-stdin-write",
"markdownDescription": "Denies the stdin_write command without any pre-configured scope."
}
]
}
}
},
"then": {
"properties": {
"allow": {
"items": {
"title": "ShellScopeEntry",
"description": "Shell scope entry.",
"anyOf": [
{
"type": "object",
"required": [
"cmd",
"name"
],
"properties": {
"args": {
"description": "The allowed arguments for the command execution.",
"allOf": [
{
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
}
]
},
"cmd": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"name",
"sidecar"
],
"properties": {
"args": {
"description": "The allowed arguments for the command execution.",
"allOf": [
{
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
}
]
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
},
"sidecar": {
"description": "If this command is a sidecar command.",
"type": "boolean"
}
},
"additionalProperties": false
}
]
}
},
"deny": {
"items": {
"title": "ShellScopeEntry",
"description": "Shell scope entry.",
"anyOf": [
{
"type": "object",
"required": [
"cmd",
"name"
],
"properties": {
"args": {
"description": "The allowed arguments for the command execution.",
"allOf": [
{
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
}
]
},
"cmd": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"name",
"sidecar"
],
"properties": {
"args": {
"description": "The allowed arguments for the command execution.",
"allOf": [
{
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
}
]
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
},
"sidecar": {
"description": "If this command is a sidecar command.",
"type": "boolean"
}
},
"additionalProperties": false
}
]
}
}
}
},
"properties": {
"identifier": {
"description": "Identifier of the permission or permission set.",
"allOf": [
{
"$ref": "#/definitions/Identifier"
}
]
}
}
},
{ {
"properties": { "properties": {
"identifier": { "identifier": {
@@ -2288,6 +2498,72 @@
"const": "dialog:deny-save", "const": "dialog:deny-save",
"markdownDescription": "Denies the save command without any pre-configured scope." "markdownDescription": "Denies the save command without any pre-configured scope."
}, },
{
"description": "No features are enabled by default, as we believe\nthe shortcuts can be inherently dangerous and it is\napplication specific if specific shortcuts should be\nregistered or unregistered.\n",
"type": "string",
"const": "global-shortcut:default",
"markdownDescription": "No features are enabled by default, as we believe\nthe shortcuts can be inherently dangerous and it is\napplication specific if specific shortcuts should be\nregistered or unregistered.\n"
},
{
"description": "Enables the is_registered command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:allow-is-registered",
"markdownDescription": "Enables the is_registered command without any pre-configured scope."
},
{
"description": "Enables the register command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:allow-register",
"markdownDescription": "Enables the register command without any pre-configured scope."
},
{
"description": "Enables the register_all command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:allow-register-all",
"markdownDescription": "Enables the register_all command without any pre-configured scope."
},
{
"description": "Enables the unregister command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:allow-unregister",
"markdownDescription": "Enables the unregister command without any pre-configured scope."
},
{
"description": "Enables the unregister_all command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:allow-unregister-all",
"markdownDescription": "Enables the unregister_all command without any pre-configured scope."
},
{
"description": "Denies the is_registered command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:deny-is-registered",
"markdownDescription": "Denies the is_registered command without any pre-configured scope."
},
{
"description": "Denies the register command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:deny-register",
"markdownDescription": "Denies the register command without any pre-configured scope."
},
{
"description": "Denies the register_all command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:deny-register-all",
"markdownDescription": "Denies the register_all command without any pre-configured scope."
},
{
"description": "Denies the unregister command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:deny-unregister",
"markdownDescription": "Denies the unregister command without any pre-configured scope."
},
{
"description": "Denies the unregister_all command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:deny-unregister-all",
"markdownDescription": "Denies the unregister_all command without any pre-configured scope."
},
{ {
"description": "Allows the log command\n#### This default permission set includes:\n\n- `allow-log`", "description": "Allows the log command\n#### This default permission set includes:\n\n- `allow-log`",
"type": "string", "type": "string",
@@ -2534,6 +2810,72 @@
"const": "process:deny-restart", "const": "process:deny-restart",
"markdownDescription": "Denies the restart command without any pre-configured scope." "markdownDescription": "Denies the restart command without any pre-configured scope."
}, },
{
"description": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`",
"type": "string",
"const": "shell:default",
"markdownDescription": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`"
},
{
"description": "Enables the execute command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-execute",
"markdownDescription": "Enables the execute command without any pre-configured scope."
},
{
"description": "Enables the kill command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-kill",
"markdownDescription": "Enables the kill command without any pre-configured scope."
},
{
"description": "Enables the open command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-open",
"markdownDescription": "Enables the open command without any pre-configured scope."
},
{
"description": "Enables the spawn command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-spawn",
"markdownDescription": "Enables the spawn command without any pre-configured scope."
},
{
"description": "Enables the stdin_write command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-stdin-write",
"markdownDescription": "Enables the stdin_write command without any pre-configured scope."
},
{
"description": "Denies the execute command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-execute",
"markdownDescription": "Denies the execute command without any pre-configured scope."
},
{
"description": "Denies the kill command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-kill",
"markdownDescription": "Denies the kill command without any pre-configured scope."
},
{
"description": "Denies the open command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-open",
"markdownDescription": "Denies the open command without any pre-configured scope."
},
{
"description": "Denies the spawn command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-spawn",
"markdownDescription": "Denies the spawn command without any pre-configured scope."
},
{
"description": "Denies the stdin_write command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-stdin-write",
"markdownDescription": "Denies the stdin_write command without any pre-configured scope."
},
{ {
"description": "This permission set configures what kind of\noperations are available from the store plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-load`\n- `allow-get-store`\n- `allow-set`\n- `allow-get`\n- `allow-has`\n- `allow-delete`\n- `allow-clear`\n- `allow-reset`\n- `allow-keys`\n- `allow-values`\n- `allow-entries`\n- `allow-length`\n- `allow-reload`\n- `allow-save`", "description": "This permission set configures what kind of\noperations are available from the store plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-load`\n- `allow-get-store`\n- `allow-set`\n- `allow-get`\n- `allow-has`\n- `allow-delete`\n- `allow-clear`\n- `allow-reset`\n- `allow-keys`\n- `allow-values`\n- `allow-entries`\n- `allow-length`\n- `allow-reload`\n- `allow-save`",
"type": "string", "type": "string",
@@ -2929,6 +3271,50 @@
] ]
} }
] ]
},
"ShellScopeEntryAllowedArg": {
"description": "A command argument allowed to be executed by the webview API.",
"anyOf": [
{
"description": "A non-configurable argument that is passed to the command in the order it was specified.",
"type": "string"
},
{
"description": "A variable that is set while calling the command from the webview API.",
"type": "object",
"required": [
"validator"
],
"properties": {
"raw": {
"description": "Marks the validator as a raw regex, meaning the plugin should not make any modification at runtime.\n\nThis means the regex will not match on the entire string by default, which might be exploited if your regex allow unexpected input to be considered valid. When using this option, make sure your regex is correct.",
"default": false,
"type": "boolean"
},
"validator": {
"description": "[regex] validator to require passed values to conform to an expected input.\n\nThis will require the argument value passed to this variable to match the `validator` regex before it will be executed.\n\nThe regex string is by default surrounded by `^...$` to match the full string. For example the `https?://\\w+` regex would be registered as `^https?://\\w+$`.\n\n[regex]: <https://docs.rs/regex/latest/regex/#syntax>",
"type": "string"
}
},
"additionalProperties": false
}
]
},
"ShellScopeEntryAllowedArgs": {
"description": "A set of command arguments allowed to be executed by the webview API.\n\nA value of `true` will allow any arguments to be passed to the command. `false` will disable all arguments. A list of [`ShellScopeEntryAllowedArg`] will set those arguments as the only valid arguments to be passed to the attached command configuration.",
"anyOf": [
{
"description": "Use a simple boolean to allow all or disable all arguments to this command configuration.",
"type": "boolean"
},
{
"description": "A specific set of [`ShellScopeEntryAllowedArg`] that are valid to call for the command configuration.",
"type": "array",
"items": {
"$ref": "#/definitions/ShellScopeEntryAllowedArg"
}
}
]
} }
} }
} }
+386
View File
@@ -134,6 +134,216 @@
"description": "Reference a permission or permission set by identifier and extends its scope.", "description": "Reference a permission or permission set by identifier and extends its scope.",
"type": "object", "type": "object",
"allOf": [ "allOf": [
{
"if": {
"properties": {
"identifier": {
"anyOf": [
{
"description": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`",
"type": "string",
"const": "shell:default",
"markdownDescription": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`"
},
{
"description": "Enables the execute command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-execute",
"markdownDescription": "Enables the execute command without any pre-configured scope."
},
{
"description": "Enables the kill command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-kill",
"markdownDescription": "Enables the kill command without any pre-configured scope."
},
{
"description": "Enables the open command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-open",
"markdownDescription": "Enables the open command without any pre-configured scope."
},
{
"description": "Enables the spawn command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-spawn",
"markdownDescription": "Enables the spawn command without any pre-configured scope."
},
{
"description": "Enables the stdin_write command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-stdin-write",
"markdownDescription": "Enables the stdin_write command without any pre-configured scope."
},
{
"description": "Denies the execute command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-execute",
"markdownDescription": "Denies the execute command without any pre-configured scope."
},
{
"description": "Denies the kill command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-kill",
"markdownDescription": "Denies the kill command without any pre-configured scope."
},
{
"description": "Denies the open command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-open",
"markdownDescription": "Denies the open command without any pre-configured scope."
},
{
"description": "Denies the spawn command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-spawn",
"markdownDescription": "Denies the spawn command without any pre-configured scope."
},
{
"description": "Denies the stdin_write command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-stdin-write",
"markdownDescription": "Denies the stdin_write command without any pre-configured scope."
}
]
}
}
},
"then": {
"properties": {
"allow": {
"items": {
"title": "ShellScopeEntry",
"description": "Shell scope entry.",
"anyOf": [
{
"type": "object",
"required": [
"cmd",
"name"
],
"properties": {
"args": {
"description": "The allowed arguments for the command execution.",
"allOf": [
{
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
}
]
},
"cmd": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"name",
"sidecar"
],
"properties": {
"args": {
"description": "The allowed arguments for the command execution.",
"allOf": [
{
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
}
]
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
},
"sidecar": {
"description": "If this command is a sidecar command.",
"type": "boolean"
}
},
"additionalProperties": false
}
]
}
},
"deny": {
"items": {
"title": "ShellScopeEntry",
"description": "Shell scope entry.",
"anyOf": [
{
"type": "object",
"required": [
"cmd",
"name"
],
"properties": {
"args": {
"description": "The allowed arguments for the command execution.",
"allOf": [
{
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
}
]
},
"cmd": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"name",
"sidecar"
],
"properties": {
"args": {
"description": "The allowed arguments for the command execution.",
"allOf": [
{
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
}
]
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
},
"sidecar": {
"description": "If this command is a sidecar command.",
"type": "boolean"
}
},
"additionalProperties": false
}
]
}
}
}
},
"properties": {
"identifier": {
"description": "Identifier of the permission or permission set.",
"allOf": [
{
"$ref": "#/definitions/Identifier"
}
]
}
}
},
{ {
"properties": { "properties": {
"identifier": { "identifier": {
@@ -2288,6 +2498,72 @@
"const": "dialog:deny-save", "const": "dialog:deny-save",
"markdownDescription": "Denies the save command without any pre-configured scope." "markdownDescription": "Denies the save command without any pre-configured scope."
}, },
{
"description": "No features are enabled by default, as we believe\nthe shortcuts can be inherently dangerous and it is\napplication specific if specific shortcuts should be\nregistered or unregistered.\n",
"type": "string",
"const": "global-shortcut:default",
"markdownDescription": "No features are enabled by default, as we believe\nthe shortcuts can be inherently dangerous and it is\napplication specific if specific shortcuts should be\nregistered or unregistered.\n"
},
{
"description": "Enables the is_registered command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:allow-is-registered",
"markdownDescription": "Enables the is_registered command without any pre-configured scope."
},
{
"description": "Enables the register command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:allow-register",
"markdownDescription": "Enables the register command without any pre-configured scope."
},
{
"description": "Enables the register_all command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:allow-register-all",
"markdownDescription": "Enables the register_all command without any pre-configured scope."
},
{
"description": "Enables the unregister command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:allow-unregister",
"markdownDescription": "Enables the unregister command without any pre-configured scope."
},
{
"description": "Enables the unregister_all command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:allow-unregister-all",
"markdownDescription": "Enables the unregister_all command without any pre-configured scope."
},
{
"description": "Denies the is_registered command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:deny-is-registered",
"markdownDescription": "Denies the is_registered command without any pre-configured scope."
},
{
"description": "Denies the register command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:deny-register",
"markdownDescription": "Denies the register command without any pre-configured scope."
},
{
"description": "Denies the register_all command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:deny-register-all",
"markdownDescription": "Denies the register_all command without any pre-configured scope."
},
{
"description": "Denies the unregister command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:deny-unregister",
"markdownDescription": "Denies the unregister command without any pre-configured scope."
},
{
"description": "Denies the unregister_all command without any pre-configured scope.",
"type": "string",
"const": "global-shortcut:deny-unregister-all",
"markdownDescription": "Denies the unregister_all command without any pre-configured scope."
},
{ {
"description": "Allows the log command\n#### This default permission set includes:\n\n- `allow-log`", "description": "Allows the log command\n#### This default permission set includes:\n\n- `allow-log`",
"type": "string", "type": "string",
@@ -2534,6 +2810,72 @@
"const": "process:deny-restart", "const": "process:deny-restart",
"markdownDescription": "Denies the restart command without any pre-configured scope." "markdownDescription": "Denies the restart command without any pre-configured scope."
}, },
{
"description": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`",
"type": "string",
"const": "shell:default",
"markdownDescription": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`"
},
{
"description": "Enables the execute command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-execute",
"markdownDescription": "Enables the execute command without any pre-configured scope."
},
{
"description": "Enables the kill command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-kill",
"markdownDescription": "Enables the kill command without any pre-configured scope."
},
{
"description": "Enables the open command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-open",
"markdownDescription": "Enables the open command without any pre-configured scope."
},
{
"description": "Enables the spawn command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-spawn",
"markdownDescription": "Enables the spawn command without any pre-configured scope."
},
{
"description": "Enables the stdin_write command without any pre-configured scope.",
"type": "string",
"const": "shell:allow-stdin-write",
"markdownDescription": "Enables the stdin_write command without any pre-configured scope."
},
{
"description": "Denies the execute command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-execute",
"markdownDescription": "Denies the execute command without any pre-configured scope."
},
{
"description": "Denies the kill command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-kill",
"markdownDescription": "Denies the kill command without any pre-configured scope."
},
{
"description": "Denies the open command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-open",
"markdownDescription": "Denies the open command without any pre-configured scope."
},
{
"description": "Denies the spawn command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-spawn",
"markdownDescription": "Denies the spawn command without any pre-configured scope."
},
{
"description": "Denies the stdin_write command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-stdin-write",
"markdownDescription": "Denies the stdin_write command without any pre-configured scope."
},
{ {
"description": "This permission set configures what kind of\noperations are available from the store plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-load`\n- `allow-get-store`\n- `allow-set`\n- `allow-get`\n- `allow-has`\n- `allow-delete`\n- `allow-clear`\n- `allow-reset`\n- `allow-keys`\n- `allow-values`\n- `allow-entries`\n- `allow-length`\n- `allow-reload`\n- `allow-save`", "description": "This permission set configures what kind of\noperations are available from the store plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-load`\n- `allow-get-store`\n- `allow-set`\n- `allow-get`\n- `allow-has`\n- `allow-delete`\n- `allow-clear`\n- `allow-reset`\n- `allow-keys`\n- `allow-values`\n- `allow-entries`\n- `allow-length`\n- `allow-reload`\n- `allow-save`",
"type": "string", "type": "string",
@@ -2929,6 +3271,50 @@
] ]
} }
] ]
},
"ShellScopeEntryAllowedArg": {
"description": "A command argument allowed to be executed by the webview API.",
"anyOf": [
{
"description": "A non-configurable argument that is passed to the command in the order it was specified.",
"type": "string"
},
{
"description": "A variable that is set while calling the command from the webview API.",
"type": "object",
"required": [
"validator"
],
"properties": {
"raw": {
"description": "Marks the validator as a raw regex, meaning the plugin should not make any modification at runtime.\n\nThis means the regex will not match on the entire string by default, which might be exploited if your regex allow unexpected input to be considered valid. When using this option, make sure your regex is correct.",
"default": false,
"type": "boolean"
},
"validator": {
"description": "[regex] validator to require passed values to conform to an expected input.\n\nThis will require the argument value passed to this variable to match the `validator` regex before it will be executed.\n\nThe regex string is by default surrounded by `^...$` to match the full string. For example the `https?://\\w+` regex would be registered as `^https?://\\w+$`.\n\n[regex]: <https://docs.rs/regex/latest/regex/#syntax>",
"type": "string"
}
},
"additionalProperties": false
}
]
},
"ShellScopeEntryAllowedArgs": {
"description": "A set of command arguments allowed to be executed by the webview API.\n\nA value of `true` will allow any arguments to be passed to the command. `false` will disable all arguments. A list of [`ShellScopeEntryAllowedArg`] will set those arguments as the only valid arguments to be passed to the attached command configuration.",
"anyOf": [
{
"description": "Use a simple boolean to allow all or disable all arguments to this command configuration.",
"type": "boolean"
},
{
"description": "A specific set of [`ShellScopeEntryAllowedArg`] that are valid to call for the command configuration.",
"type": "array",
"items": {
"$ref": "#/definitions/ShellScopeEntryAllowedArg"
}
}
]
} }
} }
} }
+2
View File
@@ -4,6 +4,8 @@ use tauri_plugin_log::{fern::colors::ColoredLevelConfig, Target, TargetKind};
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
.plugin(tauri_plugin_window_state::Builder::new().build()) .plugin(tauri_plugin_window_state::Builder::new().build())
.plugin(tauri_plugin_dialog::init()) .plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_upload::init()) .plugin(tauri_plugin_upload::init())
+82 -55
View File
@@ -1,17 +1,17 @@
import { setServer } from "@/utils/storage/servers";
import { jellyfin } from "@/utils/store/api";
import { LoadingButton } from "@mui/lab"; import { LoadingButton } from "@mui/lab";
import { import {
Box,
Button, Button,
Dialog, Dialog,
DialogActions, InputBase,
DialogContent, Stack,
DialogTitle, Typography,
TextField,
} from "@mui/material"; } from "@mui/material";
import { useMutation } from "@tanstack/react-query"; import { useMutation } from "@tanstack/react-query";
import { enqueueSnackbar } from "notistack"; import { enqueueSnackbar } from "notistack";
import React, { useState } from "react"; import React, { useState } from "react";
import { setServer } from "@/utils/storage/servers";
import { jellyfin } from "@/utils/store/api";
type AddServerDialogProps = { type AddServerDialogProps = {
open: boolean; open: boolean;
@@ -64,72 +64,99 @@ export default function AddServerDialog(props: AddServerDialogProps) {
return ( return (
<Dialog <Dialog
open={open} open={open}
onClose={() => setAddServerDialog(false)}
hideBackdrop={Boolean(hideBackdrop)} hideBackdrop={Boolean(hideBackdrop)}
fullWidth fullWidth
maxWidth="sm" maxWidth="sm"
disableScrollLock={true} disableScrollLock={true}
PaperProps={{
sx: {
backgroundColor: "rgba(20, 20, 30, 0.7)",
backdropFilter: "blur(24px) saturate(180%)",
backgroundImage:
"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0))",
border: "1px solid rgba(255, 255, 255, 0.08)",
boxShadow: "0 20px 50px rgba(0,0,0,0.5)",
borderRadius: 4,
overflow: "hidden",
},
}}
> >
<DialogTitle variant="h4" align="center" mb={1}> <Stack p={4} spacing={3}>
Add Server <Stack spacing={1} alignItems="center">
</DialogTitle> <span
<DialogContent className="settings-server-add"> className="material-symbols-rounded"
<TextField
variant="filled"
label="Address"
fullWidth
onChange={(e) => setServerIp(e.target.value)}
/>
</DialogContent>
<DialogActions
style={{ style={{
fontSize: "48px",
color: "var(--mui-palette-primary-main)",
}}
>
add_to_queue
</span>
<Typography variant="h5" fontWeight="bold" textAlign="center">
Connect to Server
</Typography>
<Typography variant="body2" color="text.secondary" textAlign="center">
Enter your Jellyfin server address to continue
</Typography>
</Stack>
<Box
sx={{
p: "2px 16px",
bgcolor: "rgba(0,0,0,0.2)",
borderRadius: 2,
border: "1px solid",
borderColor: "rgba(255,255,255,0.05)",
display: "flex",
alignItems: "center", alignItems: "center",
justifyContent: "center", gap: 2,
padding: "1em", "&:focus-within": {
gap: "1em", borderColor: "var(--mui-palette-primary-main)",
bgcolor: "rgba(0,0,0,0.3)",
},
transition: "border-color 0.2s, background-color 0.2s",
}} }}
> >
<span className="material-symbols-rounded" style={{ opacity: 0.5 }}>
dns
</span>
<InputBase
placeholder="https://jellyfin.example.com"
fullWidth
value={serverIp}
onChange={(e) => setServerIp(e.target.value)}
sx={{ py: 1.5 }}
autoFocus
onKeyDown={(e) => {
if (e.key === "Enter") {
addServer.mutate();
}
}}
/>
</Box>
<Stack direction="row" spacing={2} justifyContent="flex-end" pt={1}>
<Button <Button
variant="contained"
startIcon={
<span
className="material-symbols-rounded"
style={{
marginRight: "0.25em",
fontVariationSettings:
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
}}
>
cancel
</span>
}
color="error"
onClick={() => setAddServerDialog(false)} onClick={() => setAddServerDialog(false)}
color="inherit"
variant="text"
sx={{ borderRadius: 2 }}
> >
Close Cancel
</Button> </Button>
{/* @ts-ignore */}
<LoadingButton <LoadingButton
startIcon={
<span
className="material-symbols-rounded"
style={{
marginRight: "0.25em",
fontVariationSettings:
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
}}
>
add_circle
</span>
}
variant="contained"
loading={addServer.isPending} loading={addServer.isPending}
loadingPosition="start" onClick={() => addServer.mutate()}
onClick={addServer.mutate} variant="contained"
color="success" color="primary"
sx={{ borderRadius: 2, px: 3 }}
disabled={!serverIp}
> >
Add Connect
</LoadingButton> </LoadingButton>
</DialogActions> </Stack>
</Stack>
</Dialog> </Dialog>
); );
} }
+89 -39
View File
@@ -16,15 +16,15 @@
&::after { &::after {
content: ""; content: "";
position: absolute; position: absolute;
backdrop-filter: blur(40px);
inset: -0.35em; inset: -0.35em;
pointer-events: none; pointer-events: none;
border-radius: inherit; border-radius: inherit;
box-shadow: 0 0 25px rgb(0 0 0 / 0.45);
background: rgb(0 0 0 / 0.4); @include glass-effect;
opacity: 0; opacity: 0;
z-index: -1; z-index: -1;
transition: opacity $transition-time-fast; transition: all $transition-time-fast;
} }
} }
@@ -90,48 +90,98 @@
} }
} }
.library-drawer{ .library-drawer {
width: 20em; // Ensure the drawer paper itself gets the styling
margin: 1.4em; &.MuiDrawer-paper {
height: calc(100vh - 2.8em) !important; width: 280px;
border-radius: 20px; margin: 16px;
overflow-x: hidden; height: calc(100% - 32px) !important; // float in the middle
overflow-y: auto; border-radius: 24px;
.library-drawer-item{ background: rgba(20, 20, 25, 0.75); // Darker, substantial base
position: relative; backdrop-filter: blur(24px) saturate(180%);
overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.06);
border-radius: 1000px; box-shadow:
> div::before{ 0 24px 48px rgba(0, 0, 0, 0.4),
content: ""; 0 4px 8px rgba(0, 0, 0, 0.2);
overflow: hidden; // Contain scrollbars
}
.MuiList-root {
padding: 8px; // Reduced from 16px
gap: 2px; // Reduced gap
}
.MuiDivider-root {
border-color: rgba(255, 255, 255, 0.1);
margin: 4px 12px; // Reduced margins
}
// Navigation Items
.MuiListItemButton-root {
border-radius: 12px !important; // Slightly smaller radius
padding: 8px 12px; // Reduced padding (was 12px 16px)
margin-bottom: 2px;
transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
color: rgba(255, 255, 255, 0.6);
&:hover {
background: rgba(255, 255, 255, 0.08);
color: #fff;
transform: scale(1.02);
}
.material-symbols-rounded {
margin-right: 12px; // Reduced spacing
font-size: 22px; // Slightly smaller icons usually look better with less padding
transition: all 0.2s ease;
color: inherit;
}
.MuiListItemText-primary {
font-weight: 600;
font-size: 0.9rem; // Slightly smaller text
letter-spacing: 0.02em;
}
}
// Active State
.library-drawer-item.active {
.MuiListItemButton-root {
background: linear-gradient(90deg, rgba($clr-accent-default, 0.2), rgba($clr-accent-default, 0.05));
color: $clr-accent-default;
.material-symbols-rounded {
font-variation-settings: 'FILL' 1;
color: $clr-accent-default;
}
// Active Indicator Bar
&::before {
content: '';
position: absolute; position: absolute;
top: 0;
left: 0; left: 0;
right: 0; top: 50%;
bottom: 0; transform: translateY(-50%);
background: transparent; height: 24px;
transition: $transition-time-default; width: 4px;
z-index: -1;
border-radius: 100px;
}
}
.active.library-drawer-item {
.material-symbols-rounded{
--fill: 1;
}
&> div::before {
background: $clr-accent-default; background: $clr-accent-default;
border-radius: 0 4px 4px 0;
} }
} }
// Magic scrollbar }
// Custom Scrollbar for the drawer content
&::-webkit-scrollbar { &::-webkit-scrollbar {
&-thumb { width: 4px;
height: 150px;
max-height: 33%;
} }
&-track { &::-webkit-scrollbar-track {
margin-top: 15px; background: transparent;
margin-bottom: 15px; }
background: transparent !important; &::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.1);
border-radius: 4px;
&:hover {
background: rgba(255, 255, 255, 0.2);
} }
} }
} }
+19 -136
View File
@@ -1,28 +1,20 @@
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
import MuiAppBar from "@mui/material/AppBar"; import MuiAppBar from "@mui/material/AppBar";
import IconButton from "@mui/material/IconButton"; import IconButton from "@mui/material/IconButton";
import useScrollTrigger from "@mui/material/useScrollTrigger"; import useScrollTrigger from "@mui/material/useScrollTrigger";
import { useQuery } from "@tanstack/react-query";
import { useLocation, useNavigate } from "@tanstack/react-router"; import { useLocation, useNavigate } from "@tanstack/react-router";
import React, { useCallback, useMemo, useState } from "react"; import React, { useCallback, useMemo, useState } from "react";
import "./appBar.scss"; import "./appBar.scss";
import { Divider, Drawer, List, ListItem, ListItemButton } from "@mui/material";
import { useShallow } from "zustand/shallow"; import { useShallow } from "zustand/shallow";
// removed search placeholder; library state now managed via zustand // removed search placeholder; library state now managed via zustand
import { useApiInContext } from "@/utils/store/api"; import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central"; import { useCentralStore } from "@/utils/store/central";
import useHeaderStore from "@/utils/store/header"; import useHeaderStore from "@/utils/store/header";
import { import useSearchStore from "@/utils/store/search";
setSettingsDialogOpen,
setSettingsTabValue,
} from "@/utils/store/settings";
import BackButton from "../buttons/backButton"; import BackButton from "../buttons/backButton";
import ListItemLink from "../listItemLink";
import { UserAvatarMenu } from "../userAvatarMenu"; import { UserAvatarMenu } from "../userAvatarMenu";
import { getTypeIcon } from "../utils/iconsCollection"; import { NavigationDrawer } from "./navigationDrawer";
const MemoizeBackButton = React.memo(BackButton); const MemoizeBackButton = React.memo(BackButton);
@@ -34,34 +26,23 @@ const HIDDEN_PATHS = [
"/error", "/error",
"/settings", "/settings",
"/library", "/library",
"/search",
]; ];
export const AppBar = () => { export const AppBar = () => {
const api = useApiInContext((s) => s.api);
const navigate = useNavigate(); const navigate = useNavigate();
const location = useLocation(); const location = useLocation();
const display = !HIDDEN_PATHS.some( const toggleSearchDialog = useSearchStore(
(path) => location.pathname.startsWith(path) || location.pathname === "/", useShallow((s) => s.toggleSearchDialog),
); );
const display = !HIDDEN_PATHS.some(
const [user] = useCentralStore((s) => [s.currentUser]); (path) =>
const libraries = useQuery({ (location.pathname.startsWith(path) &&
queryKey: ["libraries"], location.pathname !== "/player/audio") ||
queryFn: async () => { location.pathname === "/",
if (!user?.Id || !api?.accessToken) { );
return;
}
const libs = await getUserViewsApi(api).getUserViews({
userId: user.Id,
});
return libs.data;
},
enabled: !!user?.Id && !!api?.accessToken,
networkMode: "always",
});
const trigger = useScrollTrigger({ const trigger = useScrollTrigger({
disableHysteresis: true, disableHysteresis: true,
@@ -77,14 +58,7 @@ export const AppBar = () => {
}; };
}, []); }, []);
const drawerPaperProps = useMemo(() => { const _handleNavigateToSearch = useCallback(
return {
className: "glass library-drawer",
elevation: 6,
};
}, []);
const handleNavigateToSearch = useCallback(
() => navigate({ to: "/search", search: { query: "" } }), () => navigate({ to: "/search", search: { query: "" } }),
[navigate], [navigate],
); );
@@ -122,11 +96,11 @@ export const AppBar = () => {
> >
<div className="flex flex-row" style={{ gap: "0.6em" }}> <div className="flex flex-row" style={{ gap: "0.6em" }}>
<IconButton onClick={handleDrawerOpen}> <IconButton onClick={handleDrawerOpen}>
<div className="material-symbols-rounded">menu</div> <span className="material-symbols-rounded">menu</span>
</IconButton> </IconButton>
<MemoizeBackButton /> <MemoizeBackButton />
<IconButton onClick={handleNavigateToHome}> <IconButton onClick={handleNavigateToHome}>
<div <span
className={ className={
location.pathname === "/home" location.pathname === "/home"
? "material-symbols-rounded fill" ? "material-symbols-rounded fill"
@@ -134,112 +108,21 @@ export const AppBar = () => {
} }
> >
home home
</div> </span>
</IconButton> </IconButton>
</div> </div>
<div className="flex flex-row" style={{ gap: "0.6em" }}> <div className="flex flex-row" style={{ gap: "0.6em" }}>
<IconButton onClick={handleNavigateToSearch}> <IconButton onClick={toggleSearchDialog}>
<div className="material-symbols-rounded">search</div> <span className="material-symbols-rounded">search</span>
</IconButton> </IconButton>
<IconButton onClick={handleNavigateToFavorite}> <IconButton onClick={handleNavigateToFavorite}>
<div className="material-symbols-rounded">favorite</div> <span className="material-symbols-rounded">favorite</span>
</IconButton> </IconButton>
<UserAvatarMenu /> <UserAvatarMenu />
</div> </div>
</MuiAppBar> </MuiAppBar>
<Drawer <NavigationDrawer open={showDrawer} onClose={handleDrawerClose} />
open={showDrawer}
slotProps={{ paper: drawerPaperProps }}
className="library-drawer"
onClose={handleDrawerClose}
>
<List>
<ListItem>
<ListItemButton
onClick={handleDrawerClose}
style={{
borderRadius: "100px",
gap: "0.85em",
}}
>
<span className="material-symbols-rounded">menu_open</span>
Close
</ListItemButton>
</ListItem>
</List>
<Divider variant="middle" />
<List>
<ListItemLink
className="library-drawer-item"
to="/home"
icon="home"
primary="Home"
/>
{libraries.isSuccess &&
libraries.data?.Items?.map((library) => (
<ListItemLink
className="library-drawer-item"
key={library.Id}
to="/library/$id"
params={{ id: library.Id ?? "" }}
icon={
library.CollectionType &&
getTypeIcon(library.CollectionType)
}
primary={library.Name ?? "Library"}
/>
))}
</List>
<Divider variant="middle" />
<List>
<ListItem>
<ListItemButton
onClick={() => {
setSettingsDialogOpen(true);
setSettingsTabValue(1);
}}
style={{
borderRadius: "100px",
gap: "0.85em",
}}
>
<span className="material-symbols-rounded">settings</span>
Settings
</ListItemButton>
</ListItem>
<ListItem>
<ListItemButton
onClick={() => {
setSettingsDialogOpen(true);
setSettingsTabValue(2);
}}
style={{
borderRadius: "100px",
gap: "0.85em",
}}
>
<span className="material-symbols-rounded">dns</span>
Change Server
</ListItemButton>
</ListItem>
<ListItem>
<ListItemButton
onClick={() => {
setSettingsDialogOpen(true);
setSettingsTabValue(10);
}}
style={{
borderRadius: "100px",
gap: "0.85em",
}}
>
<span className="material-symbols-rounded">info</span>
About
</ListItemButton>
</ListItem>
</List>
</Drawer>
</> </>
); );
} }
+107
View File
@@ -0,0 +1,107 @@
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
import { Divider, Drawer, List, ListItem, ListItemButton } from "@mui/material";
import { useQuery } from "@tanstack/react-query";
import React, { useMemo } from "react";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import ListItemLink from "../listItemLink";
import { getTypeIcon } from "../utils/iconsCollection";
interface NavigationDrawerProps {
open: boolean;
onClose: () => void;
}
export const NavigationDrawer = ({ open, onClose }: NavigationDrawerProps) => {
const api = useApiInContext((s) => s.api);
const [user] = useCentralStore((s) => [s.currentUser]);
const libraries = useQuery({
queryKey: ["libraries"],
queryFn: async () => {
if (!user?.Id || !api?.accessToken) {
return;
}
const libs = await getUserViewsApi(api).getUserViews({
userId: user.Id,
});
return libs.data;
},
enabled: !!user?.Id && !!api?.accessToken,
networkMode: "always",
});
const drawerPaperProps = useMemo(() => {
return {
className: "glass library-drawer",
elevation: 6,
};
}, []);
return (
<Drawer
open={open}
slotProps={{ paper: drawerPaperProps }}
className="library-drawer"
onClose={onClose}
>
<List>
<ListItem>
<ListItemButton onClick={onClose}>
<span className="material-symbols-rounded">menu_open</span>
<div style={{ marginLeft: "8px" }}>Close</div>
</ListItemButton>
</ListItem>
</List>
<Divider variant="middle" />
<List>
<ListItemLink
className="library-drawer-item"
to="/home"
icon="home"
primary="Home"
onClick={onClose}
/>
{libraries.isSuccess &&
libraries.data?.Items?.map((library) => (
<ListItemLink
className="library-drawer-item"
key={library.Id}
to="/library/$id"
params={{ id: library.Id ?? "" }}
icon={
library.CollectionType &&
getTypeIcon(library.CollectionType)
}
primary={library.Name ?? "Library"}
onClick={onClose}
/>
))}
</List>
<Divider variant="middle" />
<List>
<ListItemLink
to="/settings/preferences"
icon="settings"
primary="Settings"
className="library-drawer-item"
onClick={onClose}
/>
<ListItemLink
to="/settings/changeServer"
icon="dns"
primary="Change Server"
className="library-drawer-item"
onClick={onClose}
/>
<ListItemLink
to="/settings/about"
icon="info"
primary="About"
className="library-drawer-item"
onClick={onClose}
/>
</List>
</Drawer>
);
};
+7 -9
View File
@@ -1,13 +1,11 @@
import React from "react";
import IconButton from "@mui/material/IconButton";
import { useApiInContext } from "@/utils/store/api";
import type { UserItemDataDto } from "@jellyfin/sdk/lib/generated-client"; import type { UserItemDataDto } from "@jellyfin/sdk/lib/generated-client";
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api"; import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
import { pink } from "@mui/material/colors"; import { pink } from "@mui/material/colors";
import IconButton from "@mui/material/IconButton";
import { useMutation, useQueryClient } from "@tanstack/react-query"; import { useMutation, useQueryClient } from "@tanstack/react-query";
import { useSnackbar } from "notistack"; import { useSnackbar } from "notistack";
import React from "react";
import { useApiInContext } from "@/utils/store/api";
export default function LikeButton({ export default function LikeButton({
itemId, itemId,
@@ -78,24 +76,24 @@ export default function LikeButton({
transition: "opacity 250ms", transition: "opacity 250ms",
}} }}
> >
<div <span
className="material-symbols-rounded" className="material-symbols-rounded"
style={ style={
isFavorite isFavorite
? { ? {
//@ts-ignore //@ts-expect-error
"--fill": mutation.isPending ? 0 : 1, "--fill": mutation.isPending ? 0 : 1,
color: mutation.isPending ? "white" : pink.A700, color: mutation.isPending ? "white" : pink.A700,
} }
: { : {
//@ts-ignore //@ts-expect-error
"--fill": mutation.isPending ? 1 : 0, "--fill": mutation.isPending ? 1 : 0,
color: mutation.isPending ? pink.A700 : "white", color: mutation.isPending ? pink.A700 : "white",
} }
} }
> >
favorite favorite
</div> </span>
</IconButton> </IconButton>
); );
} }
+27 -141
View File
@@ -14,13 +14,11 @@ import { useSnackbar } from "notistack";
import React, { type MouseEvent, memo } from "react"; // Import memo import React, { type MouseEvent, memo } from "react"; // Import memo
import type PlayResult from "@//utils/types/playResult"; import type PlayResult from "@//utils/types/playResult";
import { getRuntimeCompact } from "@/utils/date/time"; import { getRuntimeCompact } from "@/utils/date/time";
import getSubtitle from "@/utils/methods/getSubtitles";
import { getNextEpisode, getPlaybackInfo } from "@/utils/methods/playback"; import { getNextEpisode, getPlaybackInfo } from "@/utils/methods/playback";
import { useApiInContext } from "@/utils/store/api"; import { useApiInContext } from "@/utils/store/api";
import { generateAudioStreamUrl, playAudio } from "@/utils/store/audioPlayback"; import { generateAudioStreamUrl, playAudio } from "@/utils/store/audioPlayback";
import { useCentralStore } from "@/utils/store/central";
import { usePhotosPlayback } from "@/utils/store/photosPlayback"; import { usePhotosPlayback } from "@/utils/store/photosPlayback";
import { playItem } from "@/utils/store/playback"; import { initializePlayback } from "@/utils/store/playback";
import { setQueue } from "@/utils/store/queue"; import { setQueue } from "@/utils/store/queue";
type PlayButtonProps = { type PlayButtonProps = {
@@ -85,7 +83,6 @@ const PlayButton = ({
// (state) => state.setisPending, // (state) => state.setisPending,
// ); // );
const playPhotos = usePhotosPlayback((s) => s.playPhotos); const playPhotos = usePhotosPlayback((s) => s.playPhotos);
const currentUser = useCentralStore((s) => s.currentUser);
const { enqueueSnackbar } = useSnackbar(); const { enqueueSnackbar } = useSnackbar();
@@ -156,144 +153,33 @@ const PlayButton = ({
return; return;
} }
const episodeIndex = result.episodeIndex; const episodeIndex = result.episodeIndex;
const queue = result?.item?.Items ?? [];
// Creates a queue containing all Episodes for a particular season(series) or collection of movies let playItemValue = queue[episodeIndex];
const queue = result?.item?.Items;
let itemName = item.Name;
let episodeTitle = "";
if (result?.item?.Items?.[episodeIndex].SeriesId) {
itemName = result?.item.Items[episodeIndex].SeriesName;
episodeTitle = `S${result?.item.Items[episodeIndex].ParentIndexNumber ?? 0}:E${
result?.item.Items[episodeIndex].IndexNumber ?? 0
} ${result?.item.Items[episodeIndex].Name}`;
}
if (itemType === "BoxSet") {
itemName = result.item.Items[0].Name;
}
// Subtitle
const userSubtitleLanguagePreference =
currentUser?.Configuration?.SubtitleLanguagePreference;
// Get all subtitle streams
const allSubtitles =
result?.mediaSource?.MediaSources?.[0]?.MediaStreams?.filter(
(stream) => stream.Type === "Subtitle",
);
// Find preferred subtitle based on user's language preference
const preferredSubtitle =
allSubtitles?.find(
(sub) => sub.Language === userSubtitleLanguagePreference,
) || null;
const subtitle = getSubtitle(
preferredSubtitle?.Index ??
result.mediaSource.MediaSources?.[0].DefaultSubtitleStreamIndex ??
-1,
result?.mediaSource?.MediaSources?.[0]?.MediaStreams,
);
// Audio
const userAudioLanguagePreference =
currentUser?.Configuration?.AudioLanguagePreference;
// Get all audio streams
const allAudioTracks =
result.mediaSource.MediaSources?.[0].MediaStreams?.filter(
(value) => value.Type === "Audio",
);
// Find preferred audio track based on user's language preference
const preferredAudioTrack =
allAudioTracks?.find(
(track) => track.Language === userAudioLanguagePreference,
) ||
allAudioTracks?.find((track) => track.IsDefault) ||
allAudioTracks?.[0];
const audio = {
track:
preferredAudioTrack?.Index ??
result.mediaSource.MediaSources?.[0].DefaultAudioStreamIndex ??
0,
allTracks: allAudioTracks,
};
// URL generation
const urlOptions: URLSearchParams = {
//@ts-expect-error
Static: true,
tag: result?.mediaSource.MediaSources?.[0].ETag,
mediaSourceId: result?.mediaSource.MediaSources?.[0].Id,
deviceId: api?.deviceInfo.id,
api_key: api?.accessToken,
};
const urlParams = new URLSearchParams(urlOptions).toString();
let playbackUrl = `${api?.basePath}/Videos/${result?.mediaSource.MediaSources?.[0].Id}/stream.${result?.mediaSource.MediaSources?.[0].Container}?${urlParams}`;
if (
result?.mediaSource.MediaSources?.[0].SupportsTranscoding &&
result?.mediaSource.MediaSources?.[0].TranscodingUrl
) {
playbackUrl = `${api.basePath}${result.mediaSource.MediaSources[0].TranscodingUrl}`;
}
let playItemValue = result?.item?.Items?.[episodeIndex];
if (itemType === BaseItemKind.Movie) { if (itemType === BaseItemKind.Movie) {
playItemValue = result?.item?.Items?.[0]; playItemValue = queue[0];
} }
const startPosition = if (!playItemValue) {
result?.item?.Items?.[episodeIndex].UserData?.PlaybackPositionTicks; console.error("No item to play found");
return;
}
const videoTrack = const startPosition = playItemValue.UserData?.PlaybackPositionTicks;
result.mediaSource.MediaSources?.[0].MediaStreams?.filter(
(value) => value.Type === "Video",
);
const isDirectPlay = initializePlayback({
!result.mediaSource.MediaSources?.[0].SupportsTranscoding || api,
!result.mediaSource.MediaSources?.[0].TranscodingUrl;
playItem({
metadata: {
itemName: itemName ?? "",
episodeTitle: episodeTitle,
isEpisode: !!item.SeriesId,
itemDuration: playItemValue?.RunTimeTicks ?? item.RunTimeTicks ?? 0,
item: playItemValue ?? item,
mediaSegments: result.mediaSegments,
userDataLastPlayedPositionTicks: startPosition ?? 0,
},
mediaSource: {
videoTrack: videoTrack?.[0]?.Index ?? 0,
audioTrack: audio.track,
container: result.mediaSource.MediaSources?.[0].Container ?? "",
id: result.mediaSource.MediaSources?.[0]?.Id,
subtitle: {
url: subtitle?.url,
track: subtitle?.track ?? -1,
format: subtitle?.format ?? "nosub",
allTracks:
result.mediaSource.MediaSources?.[0].MediaStreams?.filter(
(value) => value.Type === "Subtitle",
),
enable: subtitle?.enable ?? false,
},
audio: audio,
bitrate: result.mediaSource.MediaSources?.[0].Bitrate ?? 0,
videoCodec: videoTrack?.[0]?.Codec ?? "",
audioCodec:
audio.allTracks?.find((t) => t.Index === audio.track)?.Codec ??
"",
isDirectPlay: isDirectPlay,
transcodingUrl:
result.mediaSource.MediaSources?.[0].TranscodingUrl ?? "",
},
playbackStream: playbackUrl,
playsessionId: result.mediaSource.PlaySessionId,
userDataPlayedPositionTicks:
item.UserData?.PlaybackPositionTicks ?? 0,
userId, userId,
queueItems: queue ?? [], item: playItemValue,
queueItemIndex: episodeIndex, mediaSource: result.mediaSource,
mediaSegments: result.mediaSegments,
queueItems: queue,
queueIndex: episodeIndex,
startPositionTicks: startPosition,
audioStreamIndex:
currentAudioTrack === "auto" ? undefined : currentAudioTrack,
subtitleStreamIndex:
currentSubTrack === "nosub" ? -1 : currentSubTrack,
}); });
navigate({ to: "/player" }); navigate({ to: "/player" });
} }
@@ -377,14 +263,14 @@ const PlayButton = ({
} }
{...buttonProps} {...buttonProps}
> >
<div <span
className="material-symbols-rounded em-4 fill" className="material-symbols-rounded em-4 fill"
style={{ style={{
fontSize: "3em", fontSize: "3em",
}} }}
> >
play_arrow play_arrow
</div> </span>
</Fab> </Fab>
); );
} }
@@ -409,7 +295,7 @@ const PlayButton = ({
} }
}} }}
startIcon={ startIcon={
<div <span
className="material-symbols-rounded fill" className="material-symbols-rounded fill"
style={{ style={{
zIndex: 1, zIndex: 1,
@@ -417,7 +303,7 @@ const PlayButton = ({
}} }}
> >
play_arrow play_arrow
</div> </span>
} }
{...buttonProps} {...buttonProps}
sx={{ sx={{
@@ -498,7 +384,7 @@ const PlayButton = ({
item.Type === "Episode" ? handleClick(e, item.Id) : handleClick(e) item.Type === "Episode" ? handleClick(e, item.Id) : handleClick(e)
} }
startIcon={ startIcon={
<div <span
className="material-symbols-rounded fill" className="material-symbols-rounded fill"
style={{ style={{
zIndex: 1, zIndex: 1,
@@ -506,7 +392,7 @@ const PlayButton = ({
}} }}
> >
play_arrow play_arrow
</div> </span>
} }
{...buttonProps} {...buttonProps}
sx={{ sx={{
+7 -3
View File
@@ -1,14 +1,16 @@
$image-size: 5em;
.queue{ .queue{
&-item{ &-item{
--image-size: 5em;
&.episode {
--image-size: 8em !important;
}
width: 32em; width: 32em;
padding: 1em; padding: 1em;
display: grid !important; display: grid !important;
opacity: 1 !important; opacity: 1 !important;
gap: 1em; gap: 1em;
height: 5em; height: 5em;
grid-template-columns: 3em $image-size 1fr; grid-template-columns: 3em var(--image-size) 1fr;
justify-items: center; justify-items: center;
align-items: center; align-items: center;
&-image{ &-image{
@@ -25,6 +27,7 @@ $image-size: 5em;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
position: relative; position: relative;
width: var(--image-size);
} }
&-icon { &-icon {
width: 100%; width: 100%;
@@ -52,4 +55,5 @@ $image-size: 5em;
opacity: 0.5 !important; opacity: 0.5 !important;
} }
} }
} }
+336 -242
View File
@@ -1,20 +1,86 @@
import { playItemFromQueue } from "@/utils/store/playback"; import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import useQueue from "@/utils/store/queue";
import { import {
Box,
Drawer,
IconButton, IconButton,
Menu, List,
MenuItem, Tooltip,
MenuList,
Typography, Typography,
} from "@mui/material"; } from "@mui/material";
import React, { useState } from "react"; import { useQuery } from "@tanstack/react-query";
import { getTypeIcon } from "../utils/iconsCollection"; import React, { useMemo, useState } from "react";
import { playItemFromQueue } from "@/utils/store/playback";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api"; import useQueue, {
import { useMutation, useQuery } from "@tanstack/react-query"; clearUpcoming,
removeFromQueue,
reorderQueue,
shuffleUpcoming,
} from "@/utils/store/queue";
import "./queueButton.scss"; import "./queueButton.scss";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi"; import {
closestCenter,
DndContext,
type DragEndEvent,
KeyboardSensor,
PointerSensor,
useSensor,
useSensors,
} from "@dnd-kit/core";
import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
import {
arrayMove,
SortableContext,
sortableKeyboardCoordinates,
useSortable,
verticalListSortingStrategy,
} from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import { useApiInContext } from "@/utils/store/api"; import { useApiInContext } from "@/utils/store/api";
import QueueListItem from "../queueListItem";
function SortableQueueItem({
item,
onDelete,
onPlay,
index,
}: {
item: BaseItemDto;
onDelete: () => void;
onPlay: () => void;
index: number;
}) {
const {
attributes,
listeners,
setNodeRef,
transform,
transition,
isDragging,
} = useSortable({ id: item.Id || "" });
const style = {
transform: CSS.Transform.toString(transform),
transition,
opacity: isDragging ? 0.5 : 1,
position: "relative" as const,
zIndex: isDragging ? 2 : 1,
};
return (
<div ref={setNodeRef} style={style}>
<QueueListItem
queueItem={item}
onDelete={onDelete}
onPlay={onPlay}
dragHandleProps={{ ...attributes, ...listeners }}
isEpisode={item.Type === "Episode"}
index={index}
/>
</div>
);
}
const QueueButton = () => { const QueueButton = () => {
const api = useApiInContext((s) => s.api); const api = useApiInContext((s) => s.api);
@@ -23,262 +89,290 @@ const QueueButton = () => {
state.currentItemIndex, state.currentItemIndex,
]); ]);
const user = useQuery({ const [open, setOpen] = useState(false);
queryKey: ["user"],
queryFn: async () => {
if (!api) return;
const result = await getUserApi(api).getCurrentUser();
return result.data;
},
});
const [buttonEl, setButtonEl] = useState<HTMLButtonElement | null>(null);
const handlePlay = useMutation({ const user = useQuery({
mutationKey: ["handlePlayIndex"], queryKey: ["currentUser"],
mutationFn: async ({ index }: { index: number }) => { queryFn: async () => {
const result = playItemFromQueue(index, user.data?.Id, api); if (!api) throw new Error("API not available");
return result; return (await getUserApi(api).getCurrentUser()).data;
},
onSuccess: () => {
setButtonEl(null);
},
onError: (error) => {
console.error(error);
}, },
enabled: !!api,
}); });
const sensors = useSensors(
useSensor(PointerSensor),
useSensor(KeyboardSensor, {
coordinateGetter: sortableKeyboardCoordinates,
}),
);
const upcomingItems = useMemo(() => {
return queueItems ? queueItems.slice(currentItemIndex + 1) : [];
}, [queueItems, currentItemIndex]);
const upcomingIds = useMemo(() => {
return upcomingItems.map((item) => item.Id || "");
}, [upcomingItems]);
const handleDragEnd = (event: DragEndEvent) => {
const { active, over } = event;
if (active.id !== over?.id && queueItems) {
const oldIndex = upcomingItems.findIndex(
(item) => item.Id === active.id,
);
const newIndex = upcomingItems.findIndex(
(item) => item.Id === over?.id,
);
if (oldIndex !== -1 && newIndex !== -1) {
const newUpcoming = arrayMove(upcomingItems, oldIndex, newIndex);
const newQueue = [
...queueItems.slice(0, currentItemIndex + 1),
...newUpcoming,
];
reorderQueue(newQueue);
}
}
};
const handleDelete = (index: number) => {
removeFromQueue(index);
};
const handlePlay = (index: number) => {
playItemFromQueue(index, user.data?.Id, api);
};
const handleClear = () => {
clearUpcoming();
};
const handleShuffle = () => {
shuffleUpcoming();
};
return ( return (
<> <>
<Menu <Drawer
open={Boolean(buttonEl)} anchor="right"
onClose={() => setButtonEl(null)} open={open}
anchorEl={buttonEl} onClose={() => setOpen(false)}
anchorOrigin={{ PaperProps={{
vertical: "top", className: "glass",
horizontal: "center", sx: {
width: 450,
maxWidth: "100%",
display: "flex",
flexDirection: "column",
borderLeft: "1px solid rgba(255, 255, 255, 0.08)",
},
}} }}
transformOrigin={{ ModalProps={{
vertical: "bottom", BackdropProps: {
horizontal: "center", sx: {
backgroundColor: "rgba(0, 0, 0, 0.2)",
backdropFilter: "blur(4px)",
},
},
}} }}
slotProps={{ >
paper: { <Box
style: { p={3}
maxHeight: "30em", display="flex"
overflowX: "hidden", justifyContent="space-between"
alignItems="center"
sx={{
position: "sticky",
top: 0,
zIndex: 20,
borderBottom: "1px solid",
borderColor: "rgba(255, 255, 255, 0.08)",
backgroundColor: "rgba(20, 20, 30, 0.4)",
backdropFilter: "blur(12px)",
}}
>
<Box display="flex" alignItems="center" gap={1}>
<Typography variant="h5" fontWeight="bold">
Play Queue
</Typography>
<Typography
variant="caption"
color="text.secondary"
sx={{
ml: 1,
fontWeight: 600,
bgcolor: "rgba(255, 255, 255, 0.08)",
px: 1,
py: 0.5,
borderRadius: 2,
}}
>
{queueItems?.length || 0}
</Typography>
</Box>
<Box display="flex" gap={0.5}>
<Tooltip title="Shuffle Upcoming">
<span>
<IconButton
onClick={handleShuffle}
size="small"
disabled={upcomingItems.length < 2}
>
<span className="material-symbols-rounded">
shuffle
</span>
</IconButton>
</span>
</Tooltip>
<Tooltip title="Clear Upcoming">
<span>
<IconButton
onClick={handleClear}
size="small"
disabled={upcomingItems.length === 0}
>
<span className="material-symbols-rounded">
clear_all
</span>
</IconButton>
</span>
</Tooltip>
<IconButton onClick={() => setOpen(false)} size="small">
<span className="material-symbols-rounded">close</span>
</IconButton>
</Box>
</Box>
<Box
sx={{
overflowY: "auto", overflowY: "auto",
flex: 1,
p: 2,
"&::-webkit-scrollbar": { width: 8 },
"&::-webkit-scrollbar-track": { background: "transparent" },
"&::-webkit-scrollbar-thumb": {
background: "rgba(128,128,128,0.2)",
borderRadius: 4,
}, },
"&::-webkit-scrollbar-thumb:hover": {
background: "rgba(128,128,128,0.3)",
}, },
}} }}
> >
<MenuList {queueItems && queueItems.length > 0 ? (
style={{ <List disablePadding>
height: "fit-content", {/* Current Item */}
width: " 32em", {queueItems[currentItemIndex] && (
position: "relative", <Box sx={{ mb: 4 }}>
<Typography
variant="overline"
sx={{
display: "block",
opacity: 0.6,
mb: 1,
fontWeight: 600,
letterSpacing: 1.2,
}} }}
> >
{queueItems?.[currentItemIndex]?.Id && ( NOW PLAYING
<>
<Typography px="1em" mb={2} variant="h5" fontWeight={300}>
Currently Playing:
</Typography> </Typography>
<MenuItem <Box
className="queue-item" sx={{
disabled bgcolor: "background.paper",
key={queueItems[currentItemIndex].Id} borderRadius: 3,
overflow: "hidden",
boxShadow: 4,
border: "1px solid",
borderColor: "divider",
}}
> >
<Typography variant="subtitle2"> <QueueListItem
{queueItems[currentItemIndex]?.Type === "Audio" queueItem={queueItems[currentItemIndex]}
? currentItemIndex + 1 active={true}
: queueItems[currentItemIndex].IndexNumberEnd isEpisode={
? `S${queueItems[currentItemIndex].ParentIndexNumber}:E${queueItems[currentItemIndex].IndexNumber} / ${queueItems[currentItemIndex].IndexNumberEnd}` queueItems[currentItemIndex].Type === "Episode"
: `S${queueItems[currentItemIndex].ParentIndexNumber}:E${queueItems[currentItemIndex].IndexNumber}`}
</Typography>
<div className="queue-item-image-container">
{queueItems[currentItemIndex].ImageTags?.Primary ? (
<img
className="queue-item-image"
src={
api &&
getImageUrlsApi(api).getItemImageUrlById(
queueItems[currentItemIndex]?.Id,
"Primary",
{
tag: queueItems[currentItemIndex].ImageTags
?.Primary,
},
)
} }
alt={queueItems[currentItemIndex].Name ?? "image"} index={currentItemIndex + 1}
/> />
) : (queueItems[currentItemIndex].AlbumPrimaryImageTag </Box>
?.length ?? -1) > 0 ? ( </Box>
<img
className="queue-item-image"
src={
api &&
getImageUrlsApi(api).getItemImageUrlById(
queueItems?.[currentItemIndex]?.AlbumId ?? "",
"Primary",
{
tag: queueItems?.[currentItemIndex]
.AlbumPrimaryImageTag?.[0],
},
)
}
alt={queueItems[currentItemIndex].Name ?? "image"}
/>
) : (
<div className="queue-item-image-icon">
{queueItems[currentItemIndex].Type &&
getTypeIcon(queueItems[currentItemIndex].Type)}
</div>
)} )}
{/* Upcoming Items */}
{upcomingItems.length > 0 && (
<>
<Typography
variant="overline"
sx={{
display: "block",
opacity: 0.6,
mb: 1,
fontWeight: 600,
letterSpacing: 1.2,
}}
>
NEXT UP
</Typography>
<DndContext
sensors={sensors}
collisionDetection={closestCenter}
onDragEnd={handleDragEnd}
modifiers={[restrictToVerticalAxis]}
>
<SortableContext
items={upcomingIds}
strategy={verticalListSortingStrategy}
>
<Box
sx={{
display: "flex",
flexDirection: "column",
gap: 1,
}}
>
{upcomingItems.map((item, index) => (
<SortableQueueItem
key={item.Id || index}
item={item}
onDelete={() =>
handleDelete(currentItemIndex + 1 + index)
}
onPlay={() =>
handlePlay(currentItemIndex + 1 + index)
}
index={currentItemIndex + 1 + index + 1}
/>
))}
</Box>
</SortableContext>
</DndContext>
</>
)}
</List>
) : (
<Box
p={4}
textAlign="center"
display="flex"
flexDirection="column"
alignItems="center"
gap={2}
sx={{ opacity: 0.5 }}
>
<span <span
className="material-symbols-rounded" className="material-symbols-rounded"
style={{ style={{ fontSize: 48 }}
position: "absolute",
top: "50%",
left: "50%",
transform: "translate(-50%,-50%)",
fontSize: "2em",
//@ts-ignore
"--wght": "100",
}}
> >
equalizer queue_music
</span> </span>
</div> <Typography>Your queue is empty</Typography>
<div className="queue-item-info"> </Box>
{queueItems[currentItemIndex].SeriesName ? (
<>
<Typography variant="subtitle1" width="100%">
{queueItems[currentItemIndex].SeriesName}
</Typography>
<Typography
variant="subtitle2"
width="100%"
style={{ opacity: 0.6 }}
>
{queueItems[currentItemIndex].Name}
</Typography>
</>
) : (
<Typography variant="subtitle1" width="100%">
{queueItems[currentItemIndex].Name}
</Typography>
)} )}
</div> </Box>
</MenuItem> </Drawer>
</> <IconButton onClick={() => setOpen(true)}>
)}
{queueItems &&
queueItems.slice(currentItemIndex + 1, queueItems.length - 1)
.length > 0 && (
<Typography px="1em" my={2} variant="h5" fontWeight={300}>
Queue:
</Typography>
)}
{queueItems
?.slice(currentItemIndex + 1, queueItems.length - 1)
.map((item, index) => {
return (
<MenuItem
className="queue-item"
onClick={() =>
handlePlay.mutate({ index: index + currentItemIndex })
}
key={item.Id}
>
<Typography variant="subtitle2">
{item.Type === "Audio"
? index + 1
: item.IndexNumberEnd
? `S${item.ParentIndexNumber}:E${item.IndexNumber} / ${item.IndexNumberEnd}`
: `S${item.ParentIndexNumber}:E${item.IndexNumber}`}
</Typography>
<div className="queue-item-image-container">
{item.ImageTags?.Primary ? (
<img
className="queue-item-image"
src={
api &&
getImageUrlsApi(api).getItemImageUrlById(
item?.Id ?? "",
"Primary",
{
tag: item.ImageTags?.Primary,
},
)
}
alt={item.Name ?? "image"}
/>
) : (item.AlbumPrimaryImageTag?.length ?? -1) > 0 ? (
<img
className="queue-item-image"
src={
api &&
getImageUrlsApi(api).getItemImageUrlById(
item?.AlbumId ?? "",
"Primary",
{
tag: item.AlbumPrimaryImageTag?.[0],
},
)
}
alt={item.Name ?? "image"}
/>
) : (
<div className="queue-item-image-icon">
{item.Type && getTypeIcon(item.Type)}
</div>
)}
</div>
<div className="queue-item-info">
{item.SeriesName ? (
<>
<Typography
variant="subtitle1"
width="100%"
sx={{ overflow: "hidden", textOverflow: "ellipsis" }}
>
{item.SeriesName}
</Typography>
<Typography
variant="subtitle2"
width="100%"
style={{ opacity: 0.6 }}
>
{item.Name}
</Typography>
</>
) : (
<>
<Typography
variant="subtitle1"
width="100%"
sx={{ overflow: "hidden", textOverflow: "ellipsis" }}
>
{item.Name}
</Typography>
<Typography
variant="subtitle2"
width="100%"
style={{ opacity: 0.6 }}
sx={{ overflow: "hidden", textOverflow: "ellipsis" }}
>
{item.Artists?.join(", ")}
</Typography>
</>
)}
</div>
</MenuItem>
);
})}
</MenuList>
</Menu>
<IconButton onClick={(e) => setButtonEl(e.currentTarget)}>
<span className="material-symbols-rounded">playlist_play</span> <span className="material-symbols-rounded">playlist_play</span>
</IconButton> </IconButton>
</> </>
@@ -1,6 +1,3 @@
import useInterval from "@/utils/hooks/useInterval";
import { saveUser } from "@/utils/storage/user";
import { useApiInContext } from "@/utils/store/api";
import { getQuickConnectApi } from "@jellyfin/sdk/lib/utils/api/quick-connect-api"; import { getQuickConnectApi } from "@jellyfin/sdk/lib/utils/api/quick-connect-api";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api"; import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { LoadingButton, type LoadingButtonProps } from "@mui/lab"; import { LoadingButton, type LoadingButtonProps } from "@mui/lab";
@@ -22,6 +19,9 @@ import { useNavigate } from "@tanstack/react-router";
import { writeText } from "@tauri-apps/plugin-clipboard-manager"; import { writeText } from "@tauri-apps/plugin-clipboard-manager";
import { useSnackbar } from "notistack"; import { useSnackbar } from "notistack";
import React, { useCallback, useState } from "react"; import React, { useCallback, useState } from "react";
import useInterval from "@/utils/hooks/useInterval";
import { saveUser } from "@/utils/storage/user";
import { useApiInContext } from "@/utils/store/api";
const Transition = React.forwardRef(function Transition( const Transition = React.forwardRef(function Transition(
props: TransitionProps & { props: TransitionProps & {
@@ -185,6 +185,7 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
fullWidth fullWidth
maxWidth="xs" maxWidth="xs"
TransitionComponent={Transition} TransitionComponent={Transition}
PaperProps={{ className: "glass", sx: { borderRadius: "24px" } }}
> >
<DialogContent <DialogContent
style={{ style={{
+1
View File
@@ -23,6 +23,7 @@ const TrailerButton = (props: TrailerButtonType) => {
fullWidth fullWidth
open={dialog} open={dialog}
PaperProps={{ PaperProps={{
className: "glass",
style: { style: {
overflow: "hidden", overflow: "hidden",
}, },
+3 -2
View File
@@ -82,12 +82,13 @@
top: 0; top: 0;
z-index: 10; z-index: 10;
opacity: 0; opacity: 0;
transition: opacity $transition-time-default; transition: all $transition-time-default;
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
justify-content: flex-end; justify-content: flex-end;
padding: 0.5em; padding: 0.5em;
background: rgb(0 0 0 / 0.6); background: rgba(20, 20, 30, 0.6);
backdrop-filter: blur(12px);
} }
&:hover, &:hover,
&:focus, &:focus,
+2 -18
View File
@@ -6,8 +6,7 @@ import {
type ImageType, type ImageType,
} from "@jellyfin/sdk/lib/generated-client"; } from "@jellyfin/sdk/lib/generated-client";
import { useNavigate } from "@tanstack/react-router"; import { useNavigate } from "@tanstack/react-router";
import type React from "react"; import React, { memo, type Ref, useCallback, useState } from "react";
import { memo, useCallback, useState } from "react";
import { ErrorBoundary } from "react-error-boundary"; import { ErrorBoundary } from "react-error-boundary";
import { useInView } from "react-intersection-observer"; import { useInView } from "react-intersection-observer";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi"; import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
@@ -51,11 +50,10 @@ const CardContent = ({
forwardedRef, forwardedRef,
}: CardProps & { }: CardProps & {
inView: boolean; inView: boolean;
forwardedRef?: React.Ref<HTMLDivElement>; forwardedRef?: Ref<HTMLDivElement>;
}) => { }) => {
const api = useApiInContext((s) => s.api); const api = useApiInContext((s) => s.api);
const navigate = useNavigate(); const navigate = useNavigate();
const [isHovered, setIsHovered] = useState(false);
const defaultOnClick = useCallback(() => { const defaultOnClick = useCallback(() => {
if (item?.Id) { if (item?.Id) {
@@ -88,18 +86,11 @@ const CardContent = ({
} }
}, [item?.Id, item?.Type, navigate]); }, [item?.Id, item?.Type, navigate]);
const handleInteractionStart = useCallback(() => setIsHovered(true), []);
const handleInteractionEnd = useCallback(() => setIsHovered(false), []);
return ( return (
<div <div
className="card" className="card"
ref={forwardedRef} ref={forwardedRef}
onClick={onClick || defaultOnClick} onClick={onClick || defaultOnClick}
onMouseEnter={handleInteractionStart}
onMouseLeave={handleInteractionEnd}
onFocus={handleInteractionStart}
onBlur={handleInteractionEnd}
> >
<div className={`card-image-container ${cardType}`}> <div className={`card-image-container ${cardType}`}>
<ErrorBoundary fallback={<></>}> <ErrorBoundary fallback={<></>}>
@@ -169,15 +160,10 @@ const CardContent = ({
)} )}
{inView && !disableOverlay && ( {inView && !disableOverlay && (
<div className="card-overlay"> <div className="card-overlay">
{isHovered && (
<>
<PlayButton <PlayButton
item={item} item={item}
userId={userId} userId={userId}
itemType={item.Type ?? "Movie"} itemType={item.Type ?? "Movie"}
currentAudioTrack="auto"
currentSubTrack={-1}
currentVideoTrack={0}
className="card-play-button" className="card-play-button"
iconOnly iconOnly
audio={ audio={
@@ -203,8 +189,6 @@ const CardContent = ({
queryKey={queryKey} queryKey={queryKey}
userId={userId} userId={userId}
/> />
</>
)}
</div> </div>
)} )}
{(item.UserData?.PlaybackPositionTicks ?? -1) > 0 && ( {(item.UserData?.PlaybackPositionTicks ?? -1) > 0 && (
+59 -28
View File
@@ -1,50 +1,81 @@
@use "@/styles/variables.scss" as *;
.card-scroller-container {
margin-bottom: 2.5em;
position: relative;
// Ensure the container handles overflow if needed, but usually Carousel handles it
}
.card-scroller { .card-scroller {
// height: 20em; // Override carousel default outline
&:focus {
outline: none;
}
&-slide { &-slide {
overflow: visible; padding-right: 0.5em; // Gap between cards (handled by slide padding instead of gap for carousel)
display: flex; // With react-multi-carousel, better to rely on their gap logic or item class
}
&-button {
position: absolute !important;
height: 100%;
font-size: 1em !important;
width: $page-margin;
&.right{
border-radius: $border-radius-default 0 0 $border-radius-default !important;
right: -$page-margin;
}
&.left{
border-radius: 0 $border-radius-default $border-radius-default 0 !important;
left: -$page-margin;
}
.material-symbols-rounded{
font-size: 3.2em;
--wght: 200;
--opsz: 48;
} }
&-item {
padding-right: 0.6em; // Consistent gap
} }
&-header-container { &-header-container {
display: flex; display: flex;
width: 100%; width: 100%;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 1em;
min-height: 40px;
} }
&-heading { &-heading {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-start; justify-content: flex-start;
gap: 0.35em; gap: 0.5em;
position: relative; position: relative;
margin-bottom: 0.25em !important; font-weight: 600 !important;
&-decoration { &-decoration {
width: 0.75em; width: 4px;
height: 2px; height: 24px;
background: white; background: $clr-accent-default;
border-radius: 4px;
}
}
&-controls {
display: flex;
gap: 0.5em;
.scroller-nav-btn {
background-color: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.05);
color: rgba(255, 255, 255, 0.7);
transition: all 0.2s ease;
width: 36px;
height: 36px;
&:hover {
background-color: rgba(255, 255, 255, 0.1);
color: #fff;
border-color: rgba(255, 255, 255, 0.2);
}
// Disabled state
&.Mui-disabled {
background-color: transparent;
border-color: transparent;
color: rgba(255, 255, 255, 0.1);
}
.material-symbols-rounded {
font-size: 1.5em;
} }
} }
&-container .MuiButtonGroup-outlined{
gap: 1em;
} }
} }
+86 -48
View File
@@ -1,5 +1,4 @@
import React, { type ReactNode } from "react"; import React, { type ReactNode, useRef, useState } from "react";
import Carousel from "react-multi-carousel"; import Carousel from "react-multi-carousel";
import "react-multi-carousel/lib/styles.css"; import "react-multi-carousel/lib/styles.css";
@@ -8,24 +7,54 @@ import Typography from "@mui/material/Typography";
import "./cardScroller.scss"; import "./cardScroller.scss";
//@ts-ignore - I don't know the prop type for react-multi-carousel's customRightArrow and customLeftArrow // Custom Header + Button Group component
function RightButton(props) { const ScrollerHeader = ({
const { carouselState, children, rtl, ...restProps } = props; onNext,
onPrevious,
title,
headingProps,
disableDecoration,
currentSlide = 0,
isNextDisabled = false,
}: any) => {
// Basic disable logic for visual feedback
const isFirst = currentSlide === 0;
return ( return (
<IconButton className="card-scroller-button right" {...restProps}> <div
<div className="material-symbols-rounded">chevron_right</div> className={`card-scroller-header-container ${disableDecoration ? "hidden-decoration" : ""}`}
>
<Typography
variant="h5"
color="textPrimary"
className="card-scroller-heading"
{...headingProps}
>
<div className="card-scroller-heading-decoration" />
{title}
</Typography>
<div className="card-scroller-controls">
<IconButton
onClick={onPrevious}
disabled={isFirst}
size="small"
className="scroller-nav-btn"
>
<span className="material-symbols-rounded">chevron_left</span>
</IconButton> </IconButton>
); <IconButton
} onClick={onNext}
//@ts-ignore - I don't know the prop type for react-multi-carousel's customRightArrow and customLeftArrow disabled={isNextDisabled}
function LeftButton(props) { size="small"
const { carouselState, children, rtl, ...restProps } = props; className="scroller-nav-btn"
return ( >
<IconButton className="card-scroller-button left" {...restProps}> <span className="material-symbols-rounded">chevron_right</span>
<div className="material-symbols-rounded">chevron_left</div>
</IconButton> </IconButton>
</div>
</div>
); );
} };
type CardScrollerProps = { type CardScrollerProps = {
children: ReactNode; children: ReactNode;
@@ -44,9 +73,13 @@ export default function CardScroller({
disableDecoration = false, disableDecoration = false,
boxProps, boxProps,
}: CardScrollerProps) { }: CardScrollerProps) {
const carouselRef = useRef<any>(null);
const [currentSlide, setCurrentSlide] = useState(0);
const [slidesToShow, setSlidesToShow] = useState(displayCards);
const totalItems = React.Children.count(children);
const responsive = { const responsive = {
superLargeDesktop: { superLargeDesktop: {
// the naming can be any, depends on you.
breakpoint: { max: 4000, min: 3000 }, breakpoint: { max: 4000, min: 3000 },
items: displayCards + 1, items: displayCards + 1,
slidesToSlide: displayCards + 1, slidesToSlide: displayCards + 1,
@@ -55,62 +88,67 @@ export default function CardScroller({
desktop: { desktop: {
breakpoint: { max: 3000, min: 925 }, breakpoint: { max: 3000, min: 925 },
items: displayCards, items: displayCards,
slidesToSlide: displayCards, // optional, default to 1. slidesToSlide: displayCards,
partialVisibilityGutter: 30, partialVisibilityGutter: 30,
}, },
tablet: { tablet: {
breakpoint: { max: 925, min: 600 }, breakpoint: { max: 925, min: 600 },
items: displayCards - 3, items: displayCards - 3,
slidesToSlide: displayCards - 3, // optional, default to 1. slidesToSlide: displayCards - 3,
partialVisibilityGutter: 20, partialVisibilityGutter: 20,
}, },
mobile: { mobile: {
breakpoint: { max: 600, min: 424 }, breakpoint: { max: 600, min: 424 },
items: displayCards - 5, items: displayCards - 5,
slidesToSlide: displayCards - 5, // optional, default to 1. slidesToSlide: displayCards - 5,
partialVisibilityGutter: 10, partialVisibilityGutter: 10,
}, },
smallScreen: { smallScreen: {
breakpoint: { max: 424, min: 0 }, breakpoint: { max: 424, min: 0 },
items: 1, items: 1,
slidesToSlide: 1, // optional, default to 1. slidesToSlide: 1,
partialVisibilityGutter: 10, partialVisibilityGutter: 10,
}, },
}; };
return ( const handleNext = () => {
<div if (carouselRef.current) {
{...boxProps} carouselRef.current.next();
className="card-scroller-container"
style={{ marginBottom: "1.2em" }}
>
<div
style={{ marginBottom: "1.2em" }}
className={
disableDecoration
? "card-scroller-header-container hidden-decoration"
: "card-scroller-header-container"
} }
> };
<Typography
variant="h5" const handlePrevious = () => {
color="textPrimary" if (carouselRef.current) {
className="card-scroller-heading" carouselRef.current.previous();
{...headingProps} }
> };
<div className="card-scroller-heading-decoration" /> {title}
</Typography> return (
</div> <div {...boxProps} className="card-scroller-container">
<ScrollerHeader
title={title}
headingProps={headingProps}
disableDecoration={disableDecoration}
onNext={handleNext}
onPrevious={handlePrevious}
currentSlide={currentSlide}
isNextDisabled={currentSlide + slidesToShow >= totalItems}
/>
<Carousel <Carousel
ref={carouselRef}
swipeable swipeable
draggable draggable
responsive={responsive} responsive={responsive}
arrows arrows={false}
className="card-scroller" className="card-scroller"
customTransition="all .6s" customTransition="transform 400ms ease-in-out"
transitionDuration={600} transitionDuration={400}
customRightArrow={<RightButton />} containerClass="card-scroller-track"
customLeftArrow={<LeftButton />} itemClass="card-scroller-item"
beforeChange={(nextSlide, state) => {
setCurrentSlide(nextSlide);
setSlidesToShow(state.slidesToShow);
}}
> >
{children} {children}
</Carousel> </Carousel>
+128 -13
View File
@@ -1,15 +1,38 @@
.carousel { .carousel {
position: relative; position: relative;
height: 64vh; overflow: visible;
width: calc(100% + 2*$page-margin); height: 65vh;
left: -$page-margin; margin-bottom: 3em;
margin-bottom: 3.2em; display: grid;
.slider { grid-template-areas: "main sidebar";
position: absolute; grid-template-columns: 1fr 340px;
bottom: 0; gap: 1.5em;
max-width: 35%;
right: $page-margin; &-sidebar {
overflow-y: auto;
height: 100%;
position: relative;
@include glass-effect($bg-color: rgba(10, 10, 14, 0.4));
border-radius: 24px;
grid-area: sidebar;
display: flex;
flex-direction: column;
padding: 12px;
gap: 8px;
// Ensure programmatic scroll respects padding
scroll-padding-block: 24px;
// Hide scrollbar but keep functionality
scrollbar-width: none;
-ms-overflow-style: none;
&::-webkit-scrollbar {
width: 0;
height: 0;
display: none;
} }
}
&-button { &-button {
position: absolute !important; position: absolute !important;
top: 50%; top: 50%;
@@ -25,6 +48,94 @@
} }
} }
&-ticker{
overflow: hidden;
height: 72px;
display: flex;
padding: 8px;
align-items: center;
gap: 12px;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
position: relative;
border-radius: 12px; // Slightly smaller radius to work with the bar
background: transparent;
border: 1px solid transparent;
&:hover {
background: rgba(255, 255, 255, 0.05);
cursor: pointer;
}
&.active {
background: rgba(255, 255, 255, 0.08); // Subtle background
// Vertical Progress Bar
&::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 4px;
background-color: var(--mui-palette-primary-main, #fff);
height: 0%;
animation: ticker-v-progress 8s linear;
}
}
&-image {
height: 56px;
width: 100px;
flex-shrink: 0;
border-radius: 8px;
object-fit: cover;
box-shadow: 0 2px 8px rgba(0,0,0,0.2);
&.placeholder {
display: flex;
align-items: center;
justify-content: center;
background: rgb(100 100 100 / 0.1);
color: rgb(200 200 200 / 0.7);
font-size: 2rem;
}
}
& > div {
display: flex;
flex-direction: column;
justify-content: center;
min-width: 0; // flexible text truncation
padding-left: 4px; // compensate for visual weight of potential bar
.carousel-ticker-title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-weight: 500; // Slightly lighter
font-size: 0.95rem;
line-height: 1.2;
margin-bottom: 2px;
opacity: 0.9;
}
.carousel-ticker-year {
font-size: 0.8rem;
opacity: 0.6;
}
}
}
// Pause progress when carousel is paused
&.paused {
.carousel-ticker.active::after {
animation-play-state: paused;
}
}
@keyframes ticker-v-progress {
from { height: 0%; }
to { height: 100%; }
}
&-indicator { &-indicator {
aspect-ratio: 1.77777; aspect-ratio: 1.77777;
overflow: hidden; overflow: hidden;
@@ -44,14 +155,14 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
&-image { &-image {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
border-radius: 4px; border-radius: 4px;
} }
&-icon { &-icon {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@@ -59,7 +170,7 @@
height: 100%; height: 100%;
background: rgb(155 155 155 / 0.4); background: rgb(155 155 155 / 0.4);
border-radius: 4px; border-radius: 4px;
} }
&.active { &.active {
opacity: 1; opacity: 1;
@@ -70,3 +181,7 @@
} }
} }
} }
.carousel-ticker-wrapper {
scroll-margin-block: 24px;
}
+104 -113
View File
@@ -1,29 +1,20 @@
import { AnimatePresence, motion } from "motion/react"; import { AnimatePresence } from "motion/react";
import type { PanInfo } from "motion/react"; import React, { useCallback, useEffect, useState } from "react";
import React, { useEffect, useState, useMemo, useCallback } from "react";
import type { MouseEvent, PointerEvent } from "react";
import { useCarouselStore } from "../../utils/store/carousel"; import { useCarouselStore } from "../../utils/store/carousel";
import "./carousel.scss"; import "./carousel.scss";
import { useApiInContext } from "@/utils/store/api"; import {
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client"; type BaseItemDto,
import CarouselSlide from "../carouselSlide"; BaseItemKind,
} from "@jellyfin/sdk/lib/generated-client";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi"; import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import Slider from "../Slider"; import { useApiInContext } from "@/utils/store/api";
import { getTypeIcon } from "../utils/iconsCollection"; import CarouselSlide from "../carouselSlide";
import CarouselTickers from "./tickers";
const swipeConfidenceThreshold = 8000;
const swipePower = (offset: number, velocity: number) => {
return Math.abs(offset) * velocity;
};
// Memoize CarouselSlide to prevent unnecessary re-renders // Memoize CarouselSlide to prevent unnecessary re-renders
const MemoizedCarouselSlide = React.memo(CarouselSlide); const MemoizedCarouselSlide = React.memo(CarouselSlide);
// Memoize Slider to prevent unnecessary re-renders
const MemoizedSlider = React.memo(Slider);
const Carousel = ({ const Carousel = ({
content, content,
onChange, onChange,
@@ -32,121 +23,121 @@ const Carousel = ({
onChange: (currentSlide: number) => void; onChange: (currentSlide: number) => void;
}) => { }) => {
const [currentSlide, setCurrentSlide] = useState(0); const [currentSlide, setCurrentSlide] = useState(0);
const [isPaused, setIsPaused] = useState(false);
const sidebarRef = React.useRef<HTMLDivElement>(null);
const tickerRefs = React.useRef<(HTMLDivElement | null)[]>([]);
const currentSlideRef = React.useRef(currentSlide);
const [setDirection] = useCarouselStore((state) => [state.setDirection]); const [setDirection] = useCarouselStore((state) => [state.setDirection]);
useEffect(() => {
currentSlideRef.current = currentSlide;
}, [currentSlide]);
useEffect(() => { useEffect(() => {
onChange(currentSlide); onChange(currentSlide);
}, [content[currentSlide]?.Id]);
// Auto-scroll sidebar to keep active item in view
const activeTicker = tickerRefs.current[currentSlide];
const sidebar = sidebarRef.current;
if (activeTicker && sidebar) {
const sidebarTop = sidebar.scrollTop;
const sidebarBottom = sidebarTop + sidebar.clientHeight;
const activeTickerTop = activeTicker.offsetTop;
const activeTickerBottom =
activeTicker.offsetTop + activeTicker.offsetHeight;
// If element is below the visible area
if (activeTickerBottom > sidebarBottom) {
sidebar.scrollTo({
top: activeTickerBottom - sidebar.clientHeight + 24, // 24px padding
behavior: "smooth",
});
}
// If element is above the visible area
else if (activeTickerTop < sidebarTop) {
sidebar.scrollTo({
top: activeTickerTop - 24, // 24px padding
behavior: "smooth",
});
}
}
}, [currentSlide, content, onChange]);
// Autoplay functionality
useEffect(() => {
if (isPaused || content.length === 0) return;
const timer = setInterval(() => {
setDirection("right");
setCurrentSlide((prev) => (prev + 1) % content.length);
}, 8000);
return () => clearInterval(timer);
}, [isPaused, content.length, setDirection, currentSlide]);
const api = useApiInContext((s) => s.api); const api = useApiInContext((s) => s.api);
// Memoize the content mapping const handleTickerClick = useCallback(
const sliderContent = useMemo(() => { (index: number) => {
return content.map((item, index) => { if (index === currentSlideRef.current) return;
return ( setDirection(index > currentSlideRef.current ? "right" : "left");
<motion.div
className={
currentSlide === index
? "carousel-indicator active"
: "carousel-indicator"
}
layout
initial={{
height: "4.6em",
}}
whileHover={{
height: "5.5em",
}}
transition={{
duration: 0.05,
}}
key={item.Id}
onClick={() => {
if (currentSlide > index) {
setDirection("left");
} else if (currentSlide <= index) {
setDirection("right");
}
setCurrentSlide(index); setCurrentSlide(index);
}}
>
{item.ImageTags?.Thumb ? (
<img
src={
api &&
getImageUrlsApi(api).getItemImageUrlById(
item.Id ?? "",
"Thumb",
{
tag: item.ImageTags.Primary,
fillWidth: 300,
}, },
) [setDirection],
}
alt={item.Name ?? "item-image"}
className="carousel-indicator-image"
/>
) : (
<div className="carousel-indicator-icon">
{getTypeIcon(item.Type ?? "Movie")}
</div>
)}
</motion.div>
); );
});
}, [content, currentSlide, api, setDirection]);
const handleDragEnd = useCallback( if (!api) return null;
(
_: MouseEvent | TouchEvent | PointerEvent,
{ offset, velocity }: PanInfo,
) => {
const swipe = swipePower(offset.x, velocity.x);
if (
currentSlide !== content.length - 1 &&
swipe < -swipeConfidenceThreshold
) {
setDirection("right");
setCurrentSlide((init) => init + 1);
} else if (currentSlide !== 0 && swipe > swipeConfidenceThreshold) {
setDirection("left");
setCurrentSlide((init) => init - 1);
}
},
[currentSlide, content.length, setDirection],
);
return ( return (
<div className="carousel"> <div
<AnimatePresence mode="sync"> className={`carousel ${isPaused ? "paused" : ""}`}
<motion.div onMouseEnter={() => setIsPaused(true)}
key={currentSlide} onMouseLeave={() => setIsPaused(false)}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{
duration: 0.25,
ease: "linear",
}}
drag={"x"}
dragConstraints={{ left: 0, right: 0 }}
dragElastic={1}
//@ts-ignore
onDragEnd={handleDragEnd}
style={{
height: "100%",
width: "100%",
position: "absolute",
}}
> >
<AnimatePresence mode="sync">
<MemoizedCarouselSlide <MemoizedCarouselSlide
item={content[currentSlide]} item={content[currentSlide]}
key={content[currentSlide].Id} key={content[currentSlide].Id}
/> />
</motion.div>
</AnimatePresence> </AnimatePresence>
<MemoizedSlider currentSlide={currentSlide} content={sliderContent} /> <div className="carousel-sidebar" ref={sidebarRef}>
{content.map((item, index) => (
<div
key={item.Id}
ref={(el) => {
tickerRefs.current[index] = el;
}}
className="carousel-ticker-wrapper"
>
<CarouselTickers
imageUrl={
item.ImageTags?.Thumb
? getImageUrlsApi(api).getItemImageUrlById(
item.Id ?? "",
"Thumb",
{
quality: 90,
fillHeight: 360,
},
)
: undefined
}
isActive={index === currentSlide}
itemName={item.Name ?? "Unknown"}
itemYear={
item.Type === BaseItemKind.Series && item.EndDate
? `${item.ProductionYear ?? ""} - ${new Date(item.EndDate).getFullYear().toString()}`
: (item.ProductionYear?.toString() ?? "")
}
onTickerClick={handleTickerClick}
index={index}
itemType={item.Type as BaseItemKind}
/>
</div>
))}
</div>
</div> </div>
); );
}; };
+59
View File
@@ -0,0 +1,59 @@
import type { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
import { Typography } from "@mui/material";
import React from "react";
import { getTypeIcon } from "../utils/iconsCollection";
type CarouselTickersProps = {
imageUrl?: string | undefined | null;
itemName: string;
itemYear: string;
onTickerClick: (index: number) => void;
index: number;
isActive: boolean;
itemType: BaseItemKind;
};
const CarouselTickers = React.memo(
({
imageUrl,
itemName,
itemYear,
onTickerClick,
index,
isActive,
itemType,
}: CarouselTickersProps) => {
const handleClick = React.useCallback(() => {
onTickerClick(index);
}, [index, onTickerClick]);
return (
<div
className={`carousel-ticker${isActive ? " active" : ""}`}
onClick={handleClick}
>
{imageUrl ? (
<img
src={imageUrl}
alt={itemName}
className="carousel-ticker-image"
/>
) : (
<div className="carousel-ticker-image placeholder material-symbols-rounded">
{" "}
{getTypeIcon(itemType)}
</div>
)}
<div>
<Typography variant="subtitle1" className="carousel-ticker-title">
{itemName}
</Typography>
<Typography variant="caption" className="carousel-ticker-year">
{itemYear}
</Typography>
</div>
</div>
);
},
);
export default CarouselTickers;
+88 -117
View File
@@ -1,29 +1,47 @@
import React from "react";
import { motion } from "motion/react";
import Button from "@mui/material/Button";
import Chip from "@mui/material/Chip";
import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography";
import { yellow } from "@mui/material/colors";
import { endsAt, getRuntime } from "@/utils/date/time";
import { green, red } from "@mui/material/colors";
import { useNavigate } from "@tanstack/react-router";
import { getTypeIcon } from "../utils/iconsCollection";
import { useApiInContext } from "@/utils/store/api";
import { useCarouselStore } from "@/utils/store/carousel";
import { useCentralStore } from "@/utils/store/central";
import { import {
type BaseItemDto, type BaseItemDto,
BaseItemKind, BaseItemKind,
} from "@jellyfin/sdk/lib/generated-client"; } from "@jellyfin/sdk/lib/generated-client";
import Button from "@mui/material/Button";
import Chip from "@mui/material/Chip";
import { green, red, yellow } from "@mui/material/colors";
import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography";
import { useNavigate } from "@tanstack/react-router";
import { motion } from "motion/react";
import React from "react";
import { endsAt, getRuntime } from "@/utils/date/time";
import { useApiInContext } from "@/utils/store/api";
import { useCarouselStore } from "@/utils/store/carousel";
import { useCentralStore } from "@/utils/store/central";
import LikeButton from "../buttons/likeButton"; import LikeButton from "../buttons/likeButton";
import MarkPlayedButton from "../buttons/markPlayedButton"; import MarkPlayedButton from "../buttons/markPlayedButton";
import PlayButton from "../buttons/playButton"; import PlayButton from "../buttons/playButton";
import { getTypeIcon } from "../utils/iconsCollection";
const textVariants = {
initial: (direction: string) => ({
x: direction === "right" ? 40 : -40,
opacity: 0,
}),
animate: {
x: 0,
opacity: 1,
transition: {
duration: 0.35,
ease: [0.2, 0, 0, 1],
},
},
exit: (direction: string) => ({
x: direction === "right" ? -40 : 40,
opacity: 0,
transition: {
duration: 0.2,
ease: "easeInOut",
},
}),
};
const CarouselSlide = ({ item }: { item: BaseItemDto }) => { const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
const api = useApiInContext((s) => s.api); const api = useApiInContext((s) => s.api);
@@ -66,7 +84,13 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
return ( return (
<div className="hero-carousel-slide"> <div className="hero-carousel-slide">
<div className="hero-carousel-background-container"> <motion.div
className="hero-carousel-background-container"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.4, ease: "easeInOut" }}
>
{item.BackdropImageTags?.length ? ( {item.BackdropImageTags?.length ? (
<img <img
alt={item.Name ?? "item"} alt={item.Name ?? "item"}
@@ -89,39 +113,39 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
{getTypeIcon(item.Type ?? "Movie")} {getTypeIcon(item.Type ?? "Movie")}
</div> </div>
)} )}
</div> </motion.div>
<div className="hero-carousel-detail"> <motion.div
className="hero-carousel-detail"
initial="initial"
animate="animate"
exit="exit"
variants={{
animate: {
transition: {
staggerChildren: 0.05,
delayChildren: 0.05,
},
},
exit: {
transition: {
staggerChildren: 0.02,
staggerDirection: -1,
},
},
}}
>
{/* @ts-ignore */}
<Typography <Typography
component={motion.div} component={motion.div}
initial={{ custom={animationDirection}
transform: variants={textVariants}
animationDirection === "right"
? "translateX(60px)"
: "translateX(-60px)",
opacity: 0,
}}
animate={{
transform: "translateX(0px)",
opacity: 1,
}}
exit={{
transform:
animationDirection === "right"
? "translateX(-60px)"
: "translateX(60px)",
opacity: 0,
}}
transition={{
duration: 0.25,
ease: "easeInOut",
}}
key={item.Id} key={item.Id}
variant="h2" variant="h2"
className="hero-carousel-text" className="hero-carousel-text"
sx={{ sx={{
mb: "5px", mb: "5px",
}} }}
fontWeight={200} fontWeight={600}
overflow="visible" overflow="visible"
> >
{!item.ImageTags?.Logo ? ( {!item.ImageTags?.Logo ? (
@@ -142,31 +166,11 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
/> />
)} )}
</Typography> </Typography>
{/* @ts-ignore */}
<Stack <Stack
component={motion.div} component={motion.div}
initial={{ custom={animationDirection}
transform: variants={textVariants}
animationDirection === "right"
? "translateX(20px)"
: "translateX(-20px)",
opacity: 0,
}}
animate={{
transform: "translateX(0px)",
opacity: 1,
}}
exit={{
transform:
animationDirection === "right"
? "translateX(-20px)"
: "translateX(20px)",
opacity: 0,
}}
transition={{
duration: 0.25,
ease: "easeInOut",
}}
direction="row" direction="row"
gap={2} gap={2}
className="hero-carousel-info" className="hero-carousel-info"
@@ -176,7 +180,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
> >
{item.PremiereDate && ( {item.PremiereDate && (
<Typography style={{ opacity: "0.8" }} variant="subtitle2"> <Typography style={{ opacity: "0.8" }} variant="subtitle2">
{item.ProductionYear} {item.ProductionYear ?? ""}
</Typography> </Typography>
)} )}
{item.OfficialRating && ( {item.OfficialRating && (
@@ -239,82 +243,49 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
</div> </div>
)} )}
{item.RunTimeTicks ? ( {item.RunTimeTicks && (
<Typography style={{ opacity: "0.8" }} variant="subtitle2"> <Typography style={{ opacity: "0.8" }} variant="subtitle2">
{getRuntime(item.RunTimeTicks)} {getRuntime(item.RunTimeTicks)}
</Typography> </Typography>
) : (
<></>
)} )}
{item.RunTimeTicks ? ( {item.RunTimeTicks && (
<Typography style={{ opacity: "0.8" }} variant="subtitle2"> <Typography style={{ opacity: "0.8" }} variant="subtitle2">
{endsAt( {endsAt(
item.RunTimeTicks - (item.UserData?.PlaybackPositionTicks ?? 0), item.RunTimeTicks - (item.UserData?.PlaybackPositionTicks ?? 0),
)} )}
</Typography> </Typography>
) : (
<></>
)} )}
<Typography variant="subtitle2" style={{ opacity: 0.8 }}> <Typography variant="subtitle2" style={{ opacity: 0.8 }}>
{item.Genres?.slice(0, 4).join(" / ")} {item.Genres?.slice(0, 4).join(" / ")}
</Typography> </Typography>
</Stack> </Stack>
{/* @ts-ignore */}
<Typography <Typography
component={motion.div} component={motion.div}
initial={{ custom={animationDirection}
transform: variants={textVariants}
animationDirection === "right" className="hero-carousel-overview"
? "translateX(20px)" variant="body1"
: "translateX(-20px)", fontWeight={400}
opacity: 0,
}}
animate={{
transform: "translateX(0px)",
opacity: 1,
}}
exit={{
transform:
animationDirection === "right"
? "translateX(-20px)"
: "translateX(20px)",
opacity: 0,
}}
transition={{
duration: 0.25,
ease: "easeInOut",
}}
className="hero-carousel-text"
sx={{
display: "-webkit-box",
maxWidth: "70%",
maxHeight: "50%",
textOverflow: "ellipsis",
overflow: "hidden",
WebkitLineClamp: "4",
WebkitBoxOrient: "vertical",
}}
variant="subtitle2"
fontWeight={300}
> >
{item.Overview} {item.Overview}
</Typography> </Typography>
{/* @ts-ignore */}
<Stack <Stack
mt={3}
direction="row" direction="row"
gap={3} gap={2}
width="100%" width="100%"
className="hero-carousel-button-container" className="hero-carousel-button-container"
alignItems="center" alignItems="center"
component={motion.div}
custom={animationDirection}
variants={textVariants}
> >
<PlayButton <PlayButton
item={item} item={item}
userId={user?.Id} userId={user?.Id}
itemType={item.Type ?? "Movie"} itemType={item.Type ?? "Movie"}
currentAudioTrack={0}
currentSubTrack={0}
currentVideoTrack={0}
buttonProps={{ buttonProps={{
size: "large", size: "large",
}} }}
@@ -330,7 +301,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
<Button <Button
size="large" size="large"
//@ts-ignore //@ts-expect-error
color="white" color="white"
variant="outlined" variant="outlined"
endIcon={ endIcon={
@@ -364,7 +335,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
/> />
</Stack> </Stack>
</Stack> </Stack>
</div> </motion.div>
</div> </div>
); );
}; };
+27 -9
View File
@@ -164,9 +164,19 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
const restoreGenres = () => setLocalGenreIds(initialGenres); const restoreGenres = () => setLocalGenreIds(initialGenres);
return ( return (
<Dialog open={open} onClose={onClose} fullWidth maxWidth="sm" keepMounted> <Dialog
open={open}
onClose={onClose}
fullWidth
maxWidth="sm"
keepMounted
PaperProps={{ className: "glass-dialog-paper" }}
>
<DialogTitle>Filters</DialogTitle> <DialogTitle>Filters</DialogTitle>
<DialogContent dividers> <DialogContent
dividers
sx={{ borderColor: "rgba(255, 255, 255, 0.1)" }}
>
<Stack spacing={1.25}> <Stack spacing={1.25}>
<Accordion <Accordion
disableGutters disableGutters
@@ -186,7 +196,7 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
"& .MuiAccordionSummary-content": { my: 0 }, "& .MuiAccordionSummary-content": { my: 0 },
}} }}
expandIcon={ expandIcon={
<div className="material-symbols-rounded">expand_more</div> <span className="material-symbols-rounded">expand_more</span>
} }
> >
<Typography variant="subtitle2">General</Typography> <Typography variant="subtitle2">General</Typography>
@@ -236,7 +246,9 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
"& .MuiAccordionSummary-content": { my: 0 }, "& .MuiAccordionSummary-content": { my: 0 },
}} }}
expandIcon={ expandIcon={
<div className="material-symbols-rounded">expand_more</div> <span className="material-symbols-rounded">
expand_more
</span>
} }
> >
<Typography variant="subtitle2">Video features</Typography> <Typography variant="subtitle2">Video features</Typography>
@@ -288,7 +300,9 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
"& .MuiAccordionSummary-content": { my: 0 }, "& .MuiAccordionSummary-content": { my: 0 },
}} }}
expandIcon={ expandIcon={
<div className="material-symbols-rounded">expand_more</div> <span className="material-symbols-rounded">
expand_more
</span>
} }
> >
<Typography variant="subtitle2">Resolution</Typography> <Typography variant="subtitle2">Resolution</Typography>
@@ -334,7 +348,9 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
"& .MuiAccordionSummary-content": { my: 0 }, "& .MuiAccordionSummary-content": { my: 0 },
}} }}
expandIcon={ expandIcon={
<div className="material-symbols-rounded">expand_more</div> <span className="material-symbols-rounded">
expand_more
</span>
} }
> >
<Typography variant="subtitle2">Media type</Typography> <Typography variant="subtitle2">Media type</Typography>
@@ -383,7 +399,9 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
"& .MuiAccordionSummary-content": { my: 0 }, "& .MuiAccordionSummary-content": { my: 0 },
}} }}
expandIcon={ expandIcon={
<div className="material-symbols-rounded">expand_more</div> <span className="material-symbols-rounded">
expand_more
</span>
} }
> >
<Typography variant="subtitle2">Genres</Typography> <Typography variant="subtitle2">Genres</Typography>
@@ -475,7 +493,7 @@ export const FiltersDialogTrigger: React.FC = () => {
onClick={() => setOpen(true)} onClick={() => setOpen(true)}
aria-label="Open filters dialog" aria-label="Open filters dialog"
> >
<div <span
className="material-symbols-rounded" className="material-symbols-rounded"
style={{ position: "relative" }} style={{ position: "relative" }}
> >
@@ -498,7 +516,7 @@ export const FiltersDialogTrigger: React.FC = () => {
{activeCount} {activeCount}
</span> </span>
)} )}
</div> </span>
</IconButton> </IconButton>
</Tooltip> </Tooltip>
<FiltersDialog open={open} onClose={() => setOpen(false)} /> <FiltersDialog open={open} onClose={() => setOpen(false)} />
+25 -5
View File
@@ -1,4 +1,5 @@
import { import {
AnimatePresence,
type HTMLMotionProps, type HTMLMotionProps,
motion, motion,
useScroll, useScroll,
@@ -17,6 +18,15 @@ interface ItemBackdropProps {
motionProps?: HTMLMotionProps<"img">; motionProps?: HTMLMotionProps<"img">;
} }
const MotionImg = motion.img;
const animationProps = {
initial: { opacity: 0 },
animate: { opacity: 1 },
exit: { opacity: 0 },
transition: { duration: 0.5 },
};
/** /**
* ItemBackdrop delays applying motion-driven parallax until after mount * ItemBackdrop delays applying motion-driven parallax until after mount
* to avoid hydration timing errors ("Target ref is defined but not hydrated"). * to avoid hydration timing errors ("Target ref is defined but not hydrated").
@@ -24,7 +34,7 @@ interface ItemBackdropProps {
* attached, it renders a static img to prevent motion from touching an * attached, it renders a static img to prevent motion from touching an
* unhydrated DOM node. * unhydrated DOM node.
*/ */
function ItemBackdropContent({ const ItemBackdropContent = React.memo(function ItemBackdropContent({
targetRef, targetRef,
src, src,
alt, alt,
@@ -47,19 +57,18 @@ function ItemBackdropContent({
}); });
const y = useTransform(scrollYProgress, [0, 1], [-distance, distance]); const y = useTransform(scrollYProgress, [0, 1], [-distance, distance]);
return ( return (
<motion.img <MotionImg
alt={alt} alt={alt}
src={src} src={src}
className={className ?? "item-hero-backdrop"} className={className ?? "item-hero-backdrop"}
onLoad={(e) => { onLoad={(e) => {
e.currentTarget.style.opacity = "1";
onLoad?.(e); onLoad?.(e);
}} }}
style={{ y }} style={{ y }}
{...motionProps} {...motionProps}
/> />
); );
} });
export function ItemBackdrop({ export function ItemBackdrop({
targetRef, targetRef,
@@ -90,6 +99,14 @@ export function ItemBackdrop({
return () => cancelAnimationFrame(raf); return () => cancelAnimationFrame(raf);
}, [targetRef, ready]); }, [targetRef, ready]);
const finalMotionProps = React.useMemo(
() => ({
...animationProps,
...motionProps,
}),
[motionProps],
);
if (!ready) { if (!ready) {
return ( return (
<img <img
@@ -105,15 +122,18 @@ export function ItemBackdrop({
} }
return ( return (
<AnimatePresence>
<ItemBackdropContent <ItemBackdropContent
key={src}
targetRef={targetRef} targetRef={targetRef}
src={src} src={src}
alt={alt} alt={alt}
distance={distance} distance={distance}
className={className} className={className}
onLoad={onLoad} onLoad={onLoad}
motionProps={motionProps} motionProps={finalMotionProps}
/> />
</AnimatePresence>
); );
} }
+68 -21
View File
@@ -4,6 +4,7 @@ import Chip from "@mui/material/Chip";
import { green, red, yellow } from "@mui/material/colors"; import { green, red, yellow } from "@mui/material/colors";
import Stack from "@mui/material/Stack"; import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import { Link } from "@tanstack/react-router";
import React, { type ReactNode, type RefObject } from "react"; import React, { type ReactNode, type RefObject } from "react";
import { Blurhash } from "react-blurhash"; import { Blurhash } from "react-blurhash";
import heroBg from "@/assets/herobg.png"; import heroBg from "@/assets/herobg.png";
@@ -34,6 +35,7 @@ interface ItemHeaderProps {
mediaQualityInfo?: MediaQualityInfo; mediaQualityInfo?: MediaQualityInfo;
scrollTargetRef?: RefObject<HTMLDivElement | null>; scrollTargetRef?: RefObject<HTMLDivElement | null>;
children?: ReactNode; children?: ReactNode;
backdropSrc?: string | null;
} }
const ItemHeader = ({ const ItemHeader = ({
@@ -42,7 +44,49 @@ const ItemHeader = ({
mediaQualityInfo, mediaQualityInfo,
scrollTargetRef, scrollTargetRef,
children, children,
backdropSrc,
}: ItemHeaderProps) => { }: ItemHeaderProps) => {
const isEpisode = item.Type === "Episode";
const backdropTag =
isEpisode && item.ParentBackdropImageTags?.length
? item.ParentBackdropImageTags[0]
: item.BackdropImageTags?.[0];
const backdropId =
isEpisode && item.ParentBackdropImageTags?.length
? (item.ParentBackdropItemId ?? item.Id)
: item.Id;
const parentLogoImageTag =
(item as any).ParentLogoImageTag || (item as any).ParentLogoImageTags?.[0];
const logoTag =
isEpisode && parentLogoImageTag ? parentLogoImageTag : item.ImageTags?.Logo;
const logoId =
isEpisode && parentLogoImageTag ? (item.SeriesId ?? item.Id) : item.Id;
const logo =
logoTag ? (
<img
alt={item.Name ?? ""}
src={
api &&
getImageUrlsApi(api).getItemImageUrlById(logoId ?? "", "Logo", {
quality: 90,
fillWidth: 592,
fillHeight: 592,
tag: logoTag,
})
}
onLoad={(e) => {
e.currentTarget.style.opacity = "1";
}}
className="item-hero-logo"
/>
) : (
<Typography mb={2} fontWeight={200} variant="h2">
{isEpisode ? item.SeriesName : item.Name}
</Typography>
);
return ( return (
<div className="item-hero"> <div className="item-hero">
<div className="item-hero-backdrop-container"> <div className="item-hero-backdrop-container">
@@ -51,14 +95,15 @@ const ItemHeader = ({
targetRef={scrollTargetRef} targetRef={scrollTargetRef}
alt={item.Name ?? ""} alt={item.Name ?? ""}
backdropSrc={ backdropSrc={
item.BackdropImageTags?.length backdropSrc ??
(backdropTag
? api && ? api &&
getImageUrlsApi(api).getItemImageUrlById( getImageUrlsApi(api).getItemImageUrlById(
item.Id ?? "", backdropId ?? "",
"Backdrop", "Backdrop",
{ tag: item.BackdropImageTags[0] }, { tag: backdropTag },
) )
: undefined : undefined)
} }
fallbackSrc={heroBg} fallbackSrc={heroBg}
/> />
@@ -104,25 +149,27 @@ const ItemHeader = ({
)} )}
</div> </div>
<div className="item-hero-detail flex flex-column"> <div className="item-hero-detail flex flex-column">
{item.ImageTags?.Logo ? ( {isEpisode && logoId ? (
<img <Link
alt={item.Name ?? ""} to="/series/$id"
src={ params={{ id: logoId }}
api && style={{
getImageUrlsApi(api).getItemImageUrlById(item.Id ?? "", "Logo", { textDecoration: "none",
quality: 90, color: "inherit",
fillWidth: 592, width: "fit-content",
fillHeight: 592,
tag: item.ImageTags.Logo,
})
}
onLoad={(e) => {
e.currentTarget.style.opacity = "1";
}} }}
className="item-hero-logo" >
/> {logo}
</Link>
) : ( ) : (
<Typography mb={2} fontWeight={200} variant="h2"> logo
)}
{isEpisode && (
<Typography mb={2} fontWeight={200} variant="h4">
{item.ParentIndexNumber !== undefined &&
item.IndexNumber !== undefined
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - `
: ""}
{item.Name} {item.Name}
</Typography> </Typography>
)} )}
+4 -1
View File
@@ -75,6 +75,9 @@ $cardWidth: 18%;
object-fit: cover; object-fit: cover;
object-position: top; object-position: top;
opacity: 0; opacity: 0;
position: absolute;
top: 0;
left: 0;
transition: opacity $transition-time-default; transition: opacity $transition-time-default;
&-container { &-container {
filter: brightness(0.8); filter: brightness(0.8);
@@ -82,7 +85,7 @@ $cardWidth: 18%;
top: -4.4em; top: -4.4em;
left: -$page-margin; left: -$page-margin;
width: 100vw; width: 100vw;
height: calc(54vh + 4.4em); height: calc(64vh + 4.4em);
z-index: -1; z-index: -1;
mask-image: linear-gradient(to top, transparent, black); mask-image: linear-gradient(to top, transparent, black);
-webkit-mask-image: linear-gradient( -webkit-mask-image: linear-gradient(
+45 -7
View File
@@ -13,16 +13,18 @@ import {
import { useQueryClient, useSuspenseQuery } from "@tanstack/react-query"; import { useQueryClient, useSuspenseQuery } from "@tanstack/react-query";
import { getRouteApi, useNavigate } from "@tanstack/react-router"; import { getRouteApi, useNavigate } from "@tanstack/react-router";
import type { ChangeEvent } from "react"; import type { ChangeEvent } from "react";
import React, { useCallback, useEffect, useMemo } from "react"; import React, { useCallback, useEffect, useMemo, useState } from "react";
import { useShallow } from "zustand/shallow"; import { useShallow } from "zustand/shallow";
import { AVAILABLE_VIEWS, SORT_BY_OPTIONS } from "@/utils/constants/library"; import { AVAILABLE_VIEWS, SORT_BY_OPTIONS } from "@/utils/constants/library";
import { getLibraryQueryOptions } from "@/utils/queries/library"; import { getLibraryQueryOptions } from "@/utils/queries/library";
// import removed: header reads name/count from Zustand slice // import removed: header reads name/count from Zustand slice
import { useLibraryStateStore } from "@/utils/store/libraryState"; import { useLibraryStateStore } from "@/utils/store/libraryState";
import "./libraryHeader.scss"; import useSearchStore from "@/utils/store/search";
import { NavigationDrawer } from "../appBar/navigationDrawer";
import BackButton from "../buttons/backButton"; import BackButton from "../buttons/backButton";
import { FiltersDialogTrigger } from "../filtersDialog"; import { FiltersDialogTrigger } from "../filtersDialog";
import { UserAvatarMenu } from "../userAvatarMenu"; import { UserAvatarMenu } from "../userAvatarMenu";
import "./libraryHeader.scss";
const route = getRouteApi("/_api/library/$id"); const route = getRouteApi("/_api/library/$id");
@@ -231,9 +233,8 @@ export const LibraryHeader = () => {
const libraryName = libraryNameFromStore ?? currentLibrary.data.Name; const libraryName = libraryNameFromStore ?? currentLibrary.data.Name;
const totalCount = itemsTotalCount; const totalCount = itemsTotalCount;
const handleNavigateToSearch = useCallback( const toggleSearchDialog = useSearchStore(
() => navigate({ to: "/search", search: { query: "" } }), useShallow((s) => s.toggleSearchDialog),
[navigate],
); );
const handleNavigateToHome = useCallback( const handleNavigateToHome = useCallback(
() => navigate({ to: "/home" }), () => navigate({ to: "/home" }),
@@ -244,7 +245,18 @@ export const LibraryHeader = () => {
[navigate], [navigate],
); );
const [showDrawer, setShowDrawer] = useState(false);
const handleDrawerClose = useCallback(() => {
setShowDrawer(false);
}, []);
const handleDrawerOpen = useCallback(() => {
setShowDrawer(true);
}, []);
return ( return (
<>
<AppBar <AppBar
className={ className={
scrollTrigger scrollTrigger
@@ -256,7 +268,7 @@ export const LibraryHeader = () => {
color="transparent" color="transparent"
> >
<div className="flex flex-row" style={{ gap: "0.6em" }}> <div className="flex flex-row" style={{ gap: "0.6em" }}>
<IconButton disabled> <IconButton onClick={handleDrawerOpen}>
<div className="material-symbols-rounded">menu</div> <div className="material-symbols-rounded">menu</div>
</IconButton> </IconButton>
<MemoizeBackButton /> <MemoizeBackButton />
@@ -292,7 +304,19 @@ export const LibraryHeader = () => {
size="small" size="small"
value={String(normalizedViewType)} value={String(normalizedViewType)}
onChange={handleChangeViewType} onChange={handleChangeViewType}
SelectProps={{
MenuProps: {
PaperProps: {
className: "glass-menu-paper",
},
},
}}
> >
<MenuItem disabled value="">
<Typography variant="overline" color="textSecondary">
View
</Typography>
</MenuItem>
{compatibleViews.map((v) => ( {compatibleViews.map((v) => (
<MenuItem key={String(v.value)} value={String(v.value)}> <MenuItem key={String(v.value)} value={String(v.value)}>
{v.title} {v.title}
@@ -318,7 +342,19 @@ export const LibraryHeader = () => {
value={normalizedSortBy} value={normalizedSortBy}
onChange={handleChangeSortBy} onChange={handleChangeSortBy}
disabled={disableSortOption} disabled={disableSortOption}
SelectProps={{
MenuProps: {
PaperProps: {
className: "glass-menu-paper",
},
},
}}
> >
<MenuItem disabled value="">
<Typography variant="overline" color="textSecondary">
Sort By
</Typography>
</MenuItem>
{SORT_BY_OPTIONS.map((option) => { {SORT_BY_OPTIONS.map((option) => {
const isCompatible = const isCompatible =
option.compatibleViewTypes?.includes(currentViewType as any) || option.compatibleViewTypes?.includes(currentViewType as any) ||
@@ -349,7 +385,7 @@ export const LibraryHeader = () => {
<FiltersDialogTrigger /> <FiltersDialogTrigger />
</div> </div>
<div className="flex flex-row" style={{ gap: "0.6em" }}> <div className="flex flex-row" style={{ gap: "0.6em" }}>
<IconButton onClick={handleNavigateToSearch}> <IconButton onClick={toggleSearchDialog}>
<div className="material-symbols-rounded">search</div> <div className="material-symbols-rounded">search</div>
</IconButton> </IconButton>
<IconButton onClick={handleNavigateToFavorite}> <IconButton onClick={handleNavigateToFavorite}>
@@ -358,5 +394,7 @@ export const LibraryHeader = () => {
<UserAvatarMenu /> <UserAvatarMenu />
</div> </div>
</AppBar> </AppBar>
<NavigationDrawer open={showDrawer} onClose={handleDrawerClose} />
</>
); );
}; };
@@ -2,7 +2,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
inset: 1em 1em auto 1em !important; inset: 1em 2em auto 2em !important;
border-radius: 9999px; border-radius: 9999px;
margin: 0 auto; margin: 0 auto;
width: fit-content; width: fit-content;
@@ -15,20 +15,18 @@
&::after { &::after {
content: ""; content: "";
position: absolute; position: absolute;
backdrop-filter: blur(40px);
inset: -0.35em; inset: -0.35em;
pointer-events: none; pointer-events: none;
border-radius: inherit; border-radius: inherit;
box-shadow: 0 0 25px rgb(0 0 0 / 0.45); @include glass-effect;
background: rgb(0 0 0 / 0.4);
opacity: 0; opacity: 0;
z-index: -1; z-index: -1;
transition: opacity $transition-time-fast; transition: all 150ms;
} }
&.scrolling { &.scrolling {
&::after { &::after {
opacity: 1; opacity: 1;
} }
} }
} }
+3 -5
View File
@@ -17,10 +17,8 @@ const CreatedListItemLink = forwardRef<HTMLAnchorElement, MUIListItemLinkProps>(
(props, ref) => ( (props, ref) => (
<ListItem component="a" ref={ref} {...props}> <ListItem component="a" ref={ref} {...props}>
<ListItemButton <ListItemButton
style={{ sx={{
borderRadius: "100px", color: "inherit",
gap: "0.85em",
color: "white",
textDecoration: "none", textDecoration: "none",
}} }}
> >
@@ -40,7 +38,7 @@ export default ListItemLink;
return ( return (
<li> <li>
{/* @ts-ignore /*} {/* @ts-expect-error /*}
<ListItem <ListItem
component={Link} component={Link}
activeClassName="active" activeClassName="active"
@@ -2,15 +2,40 @@ $image-size: 4em;
.audio-player { .audio-player {
position: fixed; position: fixed;
bottom: 0; bottom: 1rem;
right: 0; left: 50%;
z-index: 10; transform: translateX(-50%);
width: 95%;
max-width: 1200px;
z-index: 100;
display: grid; display: grid;
padding: 0.5em 1.5em; padding: 0.75em 1.5em;
gap: 1em; gap: 1.5em;
box-shadow: 0 0 20px rgb(0 0 0 / 0.25); box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
grid-template-columns: 30% 1fr 30%; grid-template-columns: 25% 1fr 25%;
background: rgb(0 0 0 / 0.8) !important; @include glass-effect($blur: 12px, $bg-color: rgba(18, 18, 18, 0.85));
// background: rgba(18, 18, 18, 0.85) !important;
// backdrop-filter: blur(12px);
// -webkit-backdrop-filter: blur(12px);
// border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 1rem;
align-items: center;
@media (max-width: 900px) {
grid-template-columns: 1fr auto;
padding: 0.5em 1em;
bottom: 0;
width: 100%;
border-radius: 0;
border-bottom: none;
border-left: none;
border-right: none;
.audio-player-controls {
display: none; // Hide controls on mobile for now or adjust
}
}
#waveform { #waveform {
width: 100%; width: 100%;
transform: scaleY(0); transform: scaleY(0);
@@ -36,6 +61,13 @@ $image-size: 4em;
flex-grow: 1; flex-grow: 1;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
&-text {
display: flex;
flex-direction: column;
overflow: hidden;
min-width: 0;
}
} }
&-image { &-image {
width: $image-size; width: $image-size;
@@ -0,0 +1,104 @@
import type { Api } from "@jellyfin/sdk";
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import { getLyricsApi } from "@jellyfin/sdk/lib/utils/api/lyrics-api";
import { Typography } from "@mui/material";
import { useQuery } from "@tanstack/react-query";
import React, { useEffect, useRef, useState } from "react";
import { secToTicks } from "@/utils/date/time";
interface LyricsPanelProps {
item: BaseItemDto | undefined | null;
api: Api | undefined;
currentTime: number;
}
const LyricsPanel = ({ item, api, currentTime }: LyricsPanelProps) => {
const lyricsContainer = useRef<HTMLDivElement | null>(null);
const lyrics = useQuery({
queryKey: ["player", "audio", item?.Id, "lyrics"],
queryFn: async () => {
if (!item?.Id || !api) {
return null;
}
try {
const response = await getLyricsApi(api).getLyrics({
itemId: item?.Id,
});
return response.data;
} catch (e) {
console.error("Failed to fetch lyrics", e);
return null;
}
},
enabled: Boolean(item?.Id) && Boolean(api),
});
useEffect(() => {
if (lyrics.data && lyricsContainer.current) {
const currentLyric = lyricsContainer.current.querySelector(
"[data-active-lyric='true']",
);
if (currentLyric) {
currentLyric.scrollIntoView({
block: "center",
inline: "nearest",
behavior: "smooth",
});
}
}
}, [currentTime, lyrics.data]);
if (lyrics.isLoading) {
return (
<div className="audio-lyrics-status">
<Typography>Loading lyrics...</Typography>
</div>
);
}
if (lyrics.isError || !lyrics.data || !lyrics.data.Lyrics?.length) {
return (
<div className="audio-lyrics-status">
<Typography>No lyrics available</Typography>
</div>
);
}
const hasSyncedLyrics = (lyrics.data.Lyrics[0].Start ?? -1) >= 0;
return (
<div className="audio-lyrics" data-has-synced-lyrics={hasSyncedLyrics}>
<div className="audio-lyrics-container" ref={lyricsContainer}>
{lyrics.data.Lyrics.map((lyric, index) => {
const isActive =
hasSyncedLyrics &&
secToTicks(currentTime) >= (lyric.Start ?? 0) &&
secToTicks(currentTime) <
(lyrics.data?.Lyrics?.[index + 1]?.Start ??
Number.POSITIVE_INFINITY);
return (
<Typography
variant="body1"
component="p"
className={`audio-lyrics-line ${isActive ? "active" : ""}`}
key={`${lyric.Text}-${index}`}
data-active-lyric={isActive}
>
{lyric.Text}
</Typography>
);
})}
</div>
{!hasSyncedLyrics && (
<div className="audio-lyrics-unsynced-notice">
<span className="material-symbols-rounded">info</span>
<Typography variant="caption">Synced lyrics not available</Typography>
</div>
)}
</div>
);
};
export default React.memo(LyricsPanel);
@@ -0,0 +1,37 @@
import IconButton from "@mui/material/IconButton";
import type { ReactNode } from "react";
import React from "react";
import QueueButton from "@/components/buttons/queueButton";
interface PlayerActionsProps {
onNavigate: () => void;
onClose: () => void;
children?: ReactNode;
}
const PlayerActions = ({
onNavigate,
onClose,
children,
}: PlayerActionsProps) => {
return (
<div
style={{
display: "flex",
alignItems: "center",
justifyContent: "flex-end",
}}
>
<IconButton onClick={onNavigate}>
<span className="material-symbols-rounded">info</span>
</IconButton>
<QueueButton />
{children}
<IconButton onClick={onClose}>
<div className="material-symbols-rounded">close</div>
</IconButton>
</div>
);
};
export default PlayerActions;
@@ -0,0 +1,59 @@
import Fab from "@mui/material/Fab";
import IconButton from "@mui/material/IconButton";
import React from "react";
import PlayNextButton from "@/components/buttons/playNextButton";
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
interface PlayerControlsProps {
playing: boolean;
onPlayPause: () => void;
size?: "small" | "medium" | "large";
onRewind?: () => void;
onForward?: () => void;
}
const PlayerControls = ({
playing,
onPlayPause,
size = "small",
onRewind,
onForward,
}: PlayerControlsProps) => {
return (
<div style={{ display: "flex", gap: "1em", alignItems: "center" }}>
<PlayPreviousButton />
{onRewind && (
<IconButton onClick={onRewind}>
<span className="material-symbols-rounded">fast_rewind</span>
</IconButton>
)}
<div
style={{
display: "inline-flex",
alignItems: "center",
justifyContent: "center",
position: "relative",
}}
>
<Fab size={size} onClick={onPlayPause}>
<div
className="material-symbols-rounded"
style={{
fontSize: size === "large" ? "2.4em" : "2em",
}}
>
{playing ? "pause" : "play_arrow"}
</div>
</Fab>
</div>
{onForward && (
<IconButton onClick={onForward}>
<span className="material-symbols-rounded">fast_forward</span>
</IconButton>
)}
<PlayNextButton />
</div>
);
};
export default React.memo(PlayerControls);
@@ -0,0 +1,60 @@
import type { Api } from "@jellyfin/sdk";
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import Typography from "@mui/material/Typography";
import React from "react";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
interface PlayerInfoProps {
item: BaseItemDto | undefined | null;
api: Api | undefined;
trackName?: string;
}
const PlayerInfo = ({ item, api, trackName }: PlayerInfoProps) => {
if (!api || !item) return null;
return (
<div className="audio-player-info">
<div className="audio-player-image-container">
<img
alt={trackName ?? "track"}
className="audio-player-image"
src={getImageUrlsApi(api).getItemImageUrlById(
(!item?.ImageTags?.Primary ? item?.AlbumId : item.Id) ?? "",
"Primary",
{
quality: 85,
fillHeight: 462,
fillWidth: 462,
},
)}
/>
<span className="material-symbols-rounded audio-player-image-icon">
music_note
</span>
</div>
<div className="audio-player-info-text">
<Typography
variant="subtitle2"
style={{
width: "100%",
}}
noWrap
>
{item?.Name}
</Typography>
<Typography
variant="caption"
style={{
opacity: 0.5,
}}
noWrap
>
by {item?.Artists?.map((artist) => artist).join(",")}
</Typography>
</div>
</div>
);
};
export default PlayerInfo;
@@ -0,0 +1,87 @@
import Slider from "@mui/material/Slider";
import Typography from "@mui/material/Typography";
import React, { useEffect, useState } from "react";
import { getRuntimeMusic } from "@/utils/date/time";
interface PlayerProgressProps {
progress: number;
duration: number;
onSeek?: (value: number) => void;
onSeekCommit: (value: number) => void;
}
const PlayerProgress = ({
progress,
duration,
onSeek,
onSeekCommit,
}: PlayerProgressProps) => {
const [isScrubbing, setIsScrubbing] = useState(false);
const [sliderValue, setSliderValue] = useState(progress);
useEffect(() => {
if (!isScrubbing) {
setSliderValue(progress);
}
}, [progress, isScrubbing]);
const handleChange = (_: Event, value: number | number[]) => {
setIsScrubbing(true);
const newValue = Array.isArray(value) ? value[0] : value;
setSliderValue(newValue);
onSeek?.(newValue);
};
const handleChangeCommitted = (_: unknown, value: number | number[]) => {
setIsScrubbing(false);
const newValue = Array.isArray(value) ? value[0] : value;
onSeekCommit(newValue);
};
return (
<div
style={{
width: "100%",
display: "flex",
gap: "1em",
alignItems: "center",
justifyContent: "center",
}}
>
<Typography
variant="subtitle2"
fontWeight={300}
style={{
opacity: 0.8,
minWidth: "3.5em",
textAlign: "right",
fontVariantNumeric: "tabular-nums",
}}
>
{getRuntimeMusic(sliderValue)}
</Typography>
<Slider
value={sliderValue}
step={1}
size="small"
max={duration}
onChange={handleChange}
onChangeCommitted={handleChangeCommitted}
/>
<Typography
variant="subtitle2"
fontWeight={300}
style={{
opacity: 0.8,
minWidth: "3.5em",
textAlign: "left",
fontVariantNumeric: "tabular-nums",
}}
>
{getRuntimeMusic(duration)}
</Typography>
</div>
);
};
export default PlayerProgress;
@@ -0,0 +1,73 @@
import IconButton from "@mui/material/IconButton";
import Slider from "@mui/material/Slider";
import React from "react";
interface PlayerVolumeProps {
volume: number;
isMuted: boolean;
onVolumeChange: (value: number) => void;
onMuteToggle: () => void;
}
const PlayerVolume = ({
volume,
isMuted,
onVolumeChange,
onMuteToggle,
}: PlayerVolumeProps) => {
const [localVolume, setLocalVolume] = React.useState(volume * 100);
React.useEffect(() => {
setLocalVolume(volume * 100);
}, [volume]);
return (
<>
<IconButton onClick={onMuteToggle}>
<div className="material-symbols-rounded">
{isMuted ? "volume_mute" : "volume_up"}
</div>
</IconButton>
<Slider
value={isMuted ? 0 : localVolume}
step={1}
max={100}
onChange={(_, newVal) => {
const newVolume = Array.isArray(newVal) ? newVal[0] : newVal;
setLocalVolume(newVolume);
onVolumeChange(newVolume / 100);
}}
valueLabelDisplay="auto"
valueLabelFormat={(value) => Math.floor(value)}
size="small"
sx={{
mr: 1,
ml: 1,
width: "10em",
"& .MuiSlider-valueLabel": {
lineHeight: 1.2,
fontSize: 24,
background: "rgb(0 0 0 / 0.5)",
backdropFilter: "blur(5px)",
padding: 1,
borderRadius: "10px",
border: "1px solid rgb(255 255 255 / 0.15)",
boxShadow: "0 0 10px rgb(0 0 0 / 0.4) ",
transform: "translatey(-120%) scale(0)",
"&:before": {
display: "none",
},
"&.MuiSlider-valueLabelOpen": {
transform: "translateY(-120%) scale(1)",
},
"& > *": {
transform: "rotate(0deg)",
},
},
}}
/>
</>
);
};
export default PlayerVolume;
@@ -0,0 +1,297 @@
import {
closestCenter,
DndContext,
type DragEndEvent,
DragOverlay,
type DragStartEvent,
type DropAnimation,
defaultDropAnimationSideEffects,
KeyboardSensor,
PointerSensor,
useSensor,
useSensors,
} from "@dnd-kit/core";
import {
restrictToVerticalAxis,
restrictToWindowEdges,
} from "@dnd-kit/modifiers";
import {
arrayMove,
SortableContext,
sortableKeyboardCoordinates,
useSortable,
verticalListSortingStrategy,
} from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import {
Box,
IconButton,
Menu,
MenuItem,
Tooltip,
Typography,
} from "@mui/material";
import React, { useMemo, useState } from "react";
import QueueListItem from "@/components/queueListItem";
import { stopPlayback } from "@/utils/store/audioPlayback";
import useQueue, {
clearQueue,
removeFromQueue,
setQueue,
shuffleUpcoming,
} from "@/utils/store/queue";
interface QueuePanelProps {
queue: BaseItemDto[];
currentTrackIndex: number;
}
const dropAnimation: DropAnimation = {
sideEffects: defaultDropAnimationSideEffects({
styles: {
active: {
opacity: "0.5",
},
},
}),
};
function SortableQueueItem({
item,
onDelete,
index,
isActive,
}: {
item: BaseItemDto;
onDelete: () => void;
index: number;
isActive: boolean;
}) {
const {
attributes,
listeners,
setNodeRef,
transform,
transition,
isDragging,
} = useSortable({ id: item.Id || "" });
const style = {
transform: CSS.Translate.toString(transform),
transition,
opacity: isDragging ? 0.3 : 1,
position: "relative" as const,
zIndex: isDragging ? 999 : "auto",
};
return (
<div ref={setNodeRef} style={style} className="sortable-queue-item">
<QueueListItem
queueItem={item}
onDelete={onDelete}
dragHandleProps={{ ...attributes, ...listeners }}
isEpisode={item.Type === "Episode"}
index={index}
className={isActive ? "active" : ""}
sx={{
bgcolor: isActive
? "rgba(255, 255, 255, 0.1) !important"
: "transparent",
borderRadius: 2,
mb: 1,
transition: "background-color 0.2s",
"&:hover": {
bgcolor: "rgba(255, 255, 255, 0.05)",
},
".MuiListItemText-primary": {
color: isActive ? "var(--primary-color, #90caf9)" : "inherit",
fontWeight: isActive ? 600 : 500,
fontSize: "1rem",
},
".MuiListItemText-secondary": {
fontSize: "0.85rem",
opacity: 0.7,
},
}}
/>
</div>
);
}
const QueuePanel = ({ queue, currentTrackIndex }: QueuePanelProps) => {
const [activeId, setActiveId] = useState<string | null>(null);
const sensors = useSensors(
useSensor(PointerSensor, {
activationConstraint: {
distance: 8,
},
}),
useSensor(KeyboardSensor, {
coordinateGetter: sortableKeyboardCoordinates,
}),
);
const activeItem = useMemo(
() => queue.find((item) => item.Id === activeId),
[queue, activeId],
);
const handleDragStart = (event: DragStartEvent) => {
setActiveId(String(event.active.id));
};
const handleDragEnd = (event: DragEndEvent) => {
const { active, over } = event;
setActiveId(null);
if (active.id !== over?.id) {
const oldIndex = queue.map((item) => item.Id).indexOf(String(active.id));
const newIndex = queue.map((item) => item.Id).indexOf(String(over?.id));
if (oldIndex !== -1 && newIndex !== -1) {
const newQueue = arrayMove(queue, oldIndex, newIndex);
const currentTrackId = queue[currentTrackIndex]?.Id;
const newCurrentTrackIndex = newQueue.findIndex(
(item) => item.Id === currentTrackId,
);
setQueue(
newQueue,
newCurrentTrackIndex !== -1 ? newCurrentTrackIndex : 0,
);
}
}
};
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
const open = Boolean(anchorEl);
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
setAnchorEl(event.currentTarget);
};
const handleClose = () => {
setAnchorEl(null);
};
const handleClearQueue = () => {
stopPlayback();
clearQueue();
handleClose();
};
return (
<DndContext
sensors={sensors}
collisionDetection={closestCenter}
onDragStart={handleDragStart}
onDragEnd={handleDragEnd}
modifiers={[restrictToVerticalAxis, restrictToWindowEdges]}
>
<div
className="audio-queue-container"
style={{
width: "100%",
height: "100%",
display: "flex",
flexDirection: "column",
}}
>
<Box
sx={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
mb: 2,
px: 1,
}}
>
<Typography variant="h6" fontWeight={700}>
Queue
</Typography>
<Box sx={{ display: "flex", gap: 1 }}>
<Tooltip title="Shuffle Upcoming">
<IconButton onClick={() => shuffleUpcoming()} size="small">
<span className="material-symbols-rounded">shuffle</span>
</IconButton>
</Tooltip>
<IconButton onClick={handleClick} size="small">
<span className="material-symbols-rounded">more_vert</span>
</IconButton>
</Box>
<Menu
anchorEl={anchorEl}
open={open}
onClose={handleClose}
transformOrigin={{ horizontal: "right", vertical: "top" }}
anchorOrigin={{ horizontal: "right", vertical: "bottom" }}
>
<MenuItem onClick={handleClearQueue}>
<span
className="material-symbols-rounded"
style={{ marginRight: "0.5em", fontSize: "1.2em" }}
>
clear_all
</span>
Clear Queue
</MenuItem>
</Menu>
</Box>
<SortableContext
items={queue.map((track) => track.Id ?? "")}
strategy={verticalListSortingStrategy}
>
<div
className="audio-queue"
style={{ display: "flex", flexDirection: "column", gap: "0px" }}
>
{queue.map((track, index) => (
<SortableQueueItem
key={track.Id}
item={track}
index={index}
onDelete={() => removeFromQueue(index)}
isActive={currentTrackIndex === index}
/>
))}
</div>
</SortableContext>
<DragOverlay
dropAnimation={dropAnimation}
style={{
left: "1.5rem",
}}
>
{activeItem ? (
<QueueListItem
queueItem={activeItem}
isEpisode={activeItem.Type === "Episode"}
dragHandleProps={{}} // Pass empty object to render handle
onDelete={() => {}} // Pass empty function to render delete button space
sx={{
bgcolor: "rgba(40, 40, 40, 0.9)",
backdropFilter: "blur(10px)",
borderRadius: 2,
boxShadow: "0 8px 32px rgba(0,0,0,0.5)",
outline: "1px solid rgba(255, 255, 255, 0.1)",
mb: 1,
".MuiListItemText-primary": {
fontWeight: 500,
fontSize: "1rem",
},
".MuiListItemText-secondary": {
fontSize: "0.85rem",
opacity: 0.7,
},
}}
/>
) : null}
</DragOverlay>
</div>
</DndContext>
);
};
export default React.memo(QueuePanel);
@@ -0,0 +1,149 @@
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import { Box, Paper, Typography } from "@mui/material";
import React, { useEffect, useState } from "react";
interface StatsPanelProps {
item: BaseItemDto | undefined | null;
audioRef: React.RefObject<HTMLAudioElement> | null;
}
const StatRow = ({
label,
value,
}: {
label: string;
value: string | number | undefined | null;
}) => (
<Box
sx={{
display: "flex",
justifyContent: "space-between",
mb: 1,
borderBottom: "1px solid rgba(255,255,255,0.1)",
pb: 0.5,
}}
>
<Typography variant="body2" sx={{ opacity: 0.7, fontFamily: "monospace" }}>
{label}
</Typography>
<Typography
variant="body2"
sx={{ fontFamily: "monospace", fontWeight: 600 }}
>
{value || "-"}
</Typography>
</Box>
);
const StatsPanel: React.FC<StatsPanelProps> = ({ item, audioRef }) => {
const [buffered, setBuffered] = useState<string>("0%");
useEffect(() => {
const player = audioRef?.current;
if (!player) return;
const updateStats = () => {
if (player.buffered.length > 0) {
const bufferedEnd = player.buffered.end(player.buffered.length - 1);
const duration = player.duration;
if (duration > 0) {
setBuffered(`${Math.round((bufferedEnd / duration) * 100)}%`);
}
}
};
const interval = setInterval(updateStats, 1000);
return () => clearInterval(interval);
}, [audioRef]);
const mediaSource = item?.MediaSources?.[0];
const mediaStream = mediaSource?.MediaStreams?.find(
(s) => s.Type === "Audio",
);
return (
<Box sx={{ p: 2 }}>
<Typography variant="h6" sx={{ mb: 2 }}>
Stats for Nerds
</Typography>
<Paper
sx={{
p: 2,
background: "rgba(0,0,0,0.2)",
backdropFilter: "blur(10px)",
}}
>
<Typography
variant="subtitle2"
sx={{ mb: 1, opacity: 0.5, textTransform: "uppercase" }}
>
Media Source
</Typography>
<StatRow label="Container" value={mediaSource?.Container} />
<StatRow
label="Bitrate"
value={
mediaSource?.Bitrate
? `${Math.round(mediaSource.Bitrate / 1000)} kbps`
: undefined
}
/>
<StatRow
label="Size"
value={
mediaSource?.Size
? `${(mediaSource.Size / 1024 / 1024).toFixed(2)} MB`
: undefined
}
/>
<StatRow label="Path" value={mediaSource?.Path} />
<Box sx={{ mt: 3 }}>
<Typography
variant="subtitle2"
sx={{ mb: 1, opacity: 0.5, textTransform: "uppercase" }}
>
Audio Stream
</Typography>
<StatRow label="Codec" value={mediaStream?.Codec} />
<StatRow label="Channels" value={mediaStream?.Channels} />
<StatRow
label="Sample Rate"
value={
mediaStream?.SampleRate
? `${mediaStream.SampleRate} Hz`
: undefined
}
/>
<StatRow label="Bit Depth" value={mediaStream?.BitDepth} />
<StatRow label="Language" value={mediaStream?.Language} />
</Box>
<Box sx={{ mt: 3 }}>
<Typography
variant="subtitle2"
sx={{ mb: 1, opacity: 0.5, textTransform: "uppercase" }}
>
Player
</Typography>
<StatRow label="Buffered" value={buffered} />
<StatRow
label="Volume"
value={
audioRef?.current
? `${Math.round(audioRef.current.volume * 100)}%`
: undefined
}
/>
<StatRow
label="Playback Rate"
value={audioRef?.current?.playbackRate}
/>
</Box>
</Paper>
</Box>
);
};
export default React.memo(StatsPanel);
+193 -304
View File
@@ -1,37 +1,39 @@
import React, { useEffect, useMemo, useRef, useState } from "react"; import { useLocation, useNavigate } from "@tanstack/react-router";
import { AnimatePresence, motion } from "motion/react";
import { motion } from "motion/react"; import React, { type SyntheticEvent, useEffect, useRef, useState } from "react";
import { secToTicks, ticksToSec } from "@/utils/date/time";
import Fab from "@mui/material/Fab";
import IconButton from "@mui/material/IconButton";
import Slider from "@mui/material/Slider";
import Typography from "@mui/material/Typography";
import { setAudioRef, useAudioPlayback } from "@/utils/store/audioPlayback";
import useQueue from "@/utils/store/queue";
import { AnimatePresence } from "motion/react";
import "./audioPlayer.scss";
import { getRuntimeMusic, secToTicks, ticksToSec } from "@/utils/date/time";
import PlayNextButton from "@/components/buttons/playNextButton";
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
import QueueButton from "@/components/buttons/queueButton";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi"; import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api"; import { useApiInContext } from "@/utils/store/api";
import {
setAudioRef,
setIsMuted,
setVolume,
useAudioPlayback,
} from "@/utils/store/audioPlayback";
import { useCentralStore } from "@/utils/store/central"; import { useCentralStore } from "@/utils/store/central";
import { playItemFromQueue } from "@/utils/store/playback"; import { playItemFromQueue } from "@/utils/store/playback";
import { useNavigate } from "@tanstack/react-router"; import useQueue from "@/utils/store/queue";
import PlayerActions from "./components/PlayerActions";
import PlayerControls from "./components/PlayerControls";
import PlayerInfo from "./components/PlayerInfo";
import PlayerProgress from "./components/PlayerProgress";
import PlayerVolume from "./components/PlayerVolume";
import "./audioPlayer.scss";
const AudioPlayer = () => { const AudioPlayer = () => {
const api = useApiInContext((s) => s.api); const api = useApiInContext((s) => s.api);
const user = useCentralStore((s) => s.currentUser);
const navigate = useNavigate();
const location = useLocation();
const audioRef = useRef<HTMLAudioElement | null>(null); const audioRef = useRef<HTMLAudioElement | null>(null);
const [url, display, item] = useAudioPlayback((state) => [ const [url, display, item, volume, isMuted] = useAudioPlayback((state) => [
state.url, state.url,
state.display, state.display,
state.item, state.item,
state.player.volume,
state.player.isMuted,
]); ]);
const [tracks, currentTrack] = useQueue((state) => [ const [tracks, currentTrack] = useQueue((state) => [
@@ -39,327 +41,214 @@ const AudioPlayer = () => {
state.currentItemIndex, state.currentItemIndex,
]); ]);
const user = useCentralStore((s) => s.currentUser); const [playing, setPlaying] = useState(false);
const playing = useMemo(() => {
if (audioRef.current?.paused) return false;
return true;
}, [audioRef.current?.paused]);
const [volume, setVolume] = useState(0.8);
const [isMuted, setIsMuted] = useState(false);
const [progress, setProgress] = useState(0); const [progress, setProgress] = useState(0);
const [isScrubbing, setIsScrubbing] = useState(false);
const [sliderProgress, setSliderProgress] = useState(0);
// Sync volume and ref
useEffect(() => { useEffect(() => {
if (display) { if (display) {
// const audioUrlRequest = new Request(audioRef.current?.dataset.src, {
// method: "GET",
// headers: {
// Authorization: api.authorizationHeader,
// },
// });
// fetch(audioUrlRequest)
// .then((res) => res)
// .then(async (result) => {
// const blob = await result.blob();
// const blobUrl = URL.createObjectURL(blob);
// audioRef.current.src = blobUrl;
// await audioRef.current.play();
// setLoading(false);
// });
// Set the audio ref in the store to allow for global control
setAudioRef(audioRef); setAudioRef(audioRef);
if (audioRef.current) {
audioRef.current.volume = isMuted ? 0 : volume;
} }
}, [url, tracks?.[currentTrack]?.Id]); }
}, [display, url, tracks?.[currentTrack]?.Id]);
const navigate = useNavigate(); // Update volume when state changes
useEffect(() => {
if (audioRef.current) {
audioRef.current.volume = isMuted ? 0 : volume;
}
}, [volume, isMuted]);
const info = useMemo( // Media Session Metadata
() => useEffect(() => {
api && ( if ("mediaSession" in navigator && item) {
<div const imageUrl = item.ImageTags?.Primary
// initial={{ ? api &&
// filter: "opacity(0)", getImageUrlsApi(api).getItemImageUrlById(item.Id ?? "", "Primary", {
// }} tag: item.ImageTags.Primary,
// animate={{ })
// filter: "opacity(1)", : undefined;
// }}
// exit={{ navigator.mediaSession.metadata = new MediaMetadata({
// filter: "opacity(0)", title: item.Name ?? "Unknown Title",
// }} artist: item.Artists?.join(", ") ?? "Unknown Artist",
className="audio-player-info" album: item.Album ?? "Unknown Album",
> artwork: imageUrl
<div className="audio-player-image-container"> ? [
<img
alt={tracks?.[currentTrack]?.Name ?? "track"}
className="audio-player-image"
src={getImageUrlsApi(api).getItemImageUrlById(
(!item?.ImageTags?.Primary ? item?.AlbumId : item.Id) ?? "",
"Primary",
{ {
quality: 85, src: imageUrl,
fillHeight: 462, sizes: "512x512",
fillWidth: 462, type: "image/jpeg",
}, },
)} ]
/> : [],
<span className="material-symbols-rounded audio-player-image-icon"> });
music_note
</span>
</div>
<div className="audio-player-info-text">
<Typography
variant="subtitle2"
style={{
width: "100%",
}}
>
{item?.Name}
</Typography>
<Typography
variant="caption"
style={{
opacity: 0.5,
}}
noWrap
>
by {item?.Artists?.map((artist) => artist).join(",")}
</Typography>
</div>
</div>
),
[tracks?.[currentTrack]?.Id, currentTrack, api?.configuration],
);
const controls = useMemo(
() => (
<div style={{ display: "flex", gap: "1em" }}>
<PlayPreviousButton />
<div
style={{
display: "inline-flex",
alignItems: "center",
justifyContent: "center",
position: "relative",
}}
>
<Fab
size="small"
onClick={() =>
audioRef.current?.paused
? audioRef.current.play()
: audioRef.current?.pause()
} }
> }, [item, api]);
<div
className="material-symbols-rounded"
style={{
fontSize: "2em",
}}
>
{playing ? "pause" : "play_arrow"}
</div>
</Fab>
</div>
<PlayNextButton />
</div>
),
[tracks?.[currentTrack]?.Id, playing, tracks?.length],
);
const buttons = useMemo( // Media Session Action Handlers
() => ( useEffect(() => {
<div if ("mediaSession" in navigator) {
style={{ navigator.mediaSession.setActionHandler("play", () => {
display: "flex", audioRef.current?.play();
alignItems: "center", });
justifyContent: "flex-end", navigator.mediaSession.setActionHandler("pause", () => {
}} audioRef.current?.pause();
> });
<IconButton onClick={() => navigate({ to: "/player/audio" })}> navigator.mediaSession.setActionHandler("previoustrack", () => {
<span className="material-symbols-rounded">info</span> if (user?.Id && api) {
</IconButton> playItemFromQueue("previous", user.Id, api);
<QueueButton />
<IconButton
onClick={() => {
setIsMuted(!isMuted);
}}
>
<div className="material-symbols-rounded">
{isMuted ? "volume_mute" : "volume_up"}
</div>
</IconButton>
<Slider
value={isMuted ? 0 : volume * 100}
step={1}
max={100}
onChange={(_, newVal) => {
if (!audioRef.current) {
console.error("Audio ref not found");
return;
} }
Array.isArray(newVal) });
? setVolume(newVal[0] / 100) navigator.mediaSession.setActionHandler("nexttrack", () => {
: setVolume(newVal / 100); if (user?.Id && api) {
if (Array.isArray(newVal)) { playItemFromQueue("next", user.Id, api);
audioRef.current.volume = newVal[0] / 100; }
});
navigator.mediaSession.setActionHandler("seekto", (details) => {
if (audioRef.current && details.seekTime !== undefined) {
audioRef.current.currentTime = details.seekTime;
}
});
}
}, [api, user?.Id]);
const updatePositionState = () => {
if (
"mediaSession" in navigator &&
audioRef.current &&
!Number.isNaN(audioRef.current.duration)
) {
try {
navigator.mediaSession.setPositionState({
duration: audioRef.current.duration,
playbackRate: audioRef.current.playbackRate,
position: audioRef.current.currentTime,
});
} catch (error) {
console.error("Error updating media session position state:", error);
}
}
};
const handlePlayPause = () => {
if (audioRef.current) {
if (audioRef.current.paused) {
audioRef.current.play();
setPlaying(true);
} else { } else {
audioRef.current.volume = newVal / 100; audioRef.current.pause();
setPlaying(false);
} }
}} }
valueLabelDisplay="auto" };
valueLabelFormat={(value) => Math.floor(value)}
size="small" const handleTimeUpdate = (e: SyntheticEvent<HTMLAudioElement>) => {
sx={{ setProgress(secToTicks(e.currentTarget.currentTime));
mr: 1, };
ml: 1,
width: "10em", const handleEnded = () => {
"& .MuiSlider-valueLabel": { setPlaying(false);
lineHeight: 1.2, if (tracks?.[currentTrack + 1]?.Id && api && user?.Id) {
fontSize: 24, playItemFromQueue("next", user.Id, api);
background: "rgb(0 0 0 / 0.5)", }
backdropFilter: "blur(5px)", };
padding: 1,
borderRadius: "10px", const handleSeekCommit = (value: number) => {
border: "1px solid rgb(255 255 255 / 0.15)", if (audioRef.current) {
boxShadow: "0 0 10px rgb(0 0 0 / 0.4) ", audioRef.current.currentTime = ticksToSec(value);
transform: "translatey(-120%) scale(0)", setProgress(value);
"&:before": { }
display: "none", };
},
"&.MuiSlider-valueLabelOpen": { const handleVolumeChange = (newVolume: number) => {
transform: "translateY(-120%) scale(1)", setVolume(newVolume);
}, };
"& > *": {
transform: "rotate(0deg)", const handleMuteToggle = () => {
}, setIsMuted(!isMuted);
}, };
}}
/> const handleClose = () => {
<IconButton
onClick={() => {
useAudioPlayback.setState(useAudioPlayback.getInitialState()); useAudioPlayback.setState(useAudioPlayback.getInitialState());
}} };
>
<div className="material-symbols-rounded">close</div>
</IconButton>
</div>
),
[volume, isMuted, currentTrack],
);
// if (audioRef.current) { const handleNavigate = () => {
// audioRef.current.addEventListener("change", () => { navigate({ to: "/player/audio" });
// console.log("Audio Player changed state : ", currentTrack); };
// });
// audioRef.current.addEventListener("ended", () => {
// }); // Listen to play/pause events directly from audio element to keep state in sync
// } // (e.g. if paused by media keys)
const onPlay = () => {
setPlaying(true);
updatePositionState();
if ("mediaSession" in navigator) {
navigator.mediaSession.playbackState = "playing";
}
};
const onPause = () => {
setPlaying(false);
updatePositionState();
if ("mediaSession" in navigator) {
navigator.mediaSession.playbackState = "paused";
}
};
return ( return (
<AnimatePresence mode="sync"> <AnimatePresence mode="sync">
{display && ( {display && (
<motion.div <motion.div
initial={{ initial={{ transform: "translate(-50%, 150%)" }}
transform: "translateY(100%)",
}}
animate={{ animate={{
transform: transform:
location.pathname === "/player/audio" location.pathname === "/player/audio"
? "translateY(100%)" ? "translate(-50%, 150%)"
: "translateY(0%)", : "translate(-50%, 0%)",
}}
exit={{
transform: "translateY(100%)",
}}
style={{
width: "100%",
}}
transition={{
duration: 0.2,
ease: "easeInOut",
}} }}
exit={{ transform: "translate(-50%, 150%)" }}
transition={{ duration: 0.3, ease: "circOut" }}
className="audio-player glass" className="audio-player glass"
> >
{info} <PlayerInfo
item={item}
api={api}
trackName={tracks?.[currentTrack]?.Name ?? "Unknown Track"}
/>
<audio <audio
autoPlay autoPlay
src={url} src={url}
ref={audioRef} ref={audioRef}
key={item?.Id ?? "noItem"} key={item?.Id ?? "noItem"}
onTimeUpdate={(e) => onTimeUpdate={handleTimeUpdate}
setProgress(secToTicks(e.currentTarget.currentTime)) onEnded={handleEnded}
} onPlay={onPlay}
onEnded={() => { onPause={onPause}
if (tracks?.[currentTrack + 1]?.Id && api && user?.Id) { onSeeked={updatePositionState}
playItemFromQueue("next", user.Id, api); onLoadedMetadata={updatePositionState}
}
}}
id="audio-player" id="audio-player"
/> />
<div className="audio-player-controls"> <div className="audio-player-controls">
{controls} <PlayerControls playing={playing} onPlayPause={handlePlayPause} />
<div <PlayerProgress
style={{ progress={progress}
width: "100%", duration={item?.RunTimeTicks ?? 1}
display: "flex", onSeekCommit={handleSeekCommit}
gap: "1em",
alignItems: "center",
justifyContent: "center",
}}
>
<Typography
variant="subtitle2"
fontWeight={300}
style={{
opacity: 0.8,
}}
>
{getRuntimeMusic(progress)}
</Typography>
<Slider
value={isScrubbing ? sliderProgress : progress}
step={1}
size="small"
max={item?.RunTimeTicks ?? 1}
onChange={(_, value) => {
setIsScrubbing(true);
Array.isArray(value)
? setSliderProgress(value[0])
: setSliderProgress(value);
}}
onChangeCommitted={(_, value) => {
if (!audioRef.current) {
console.error("Audio ref not found");
return;
}
setIsScrubbing(false);
// console.log(ticksToSec(value * item.RunTimeTicks));
Array.isArray(value)
? setProgress(value[0])
: setProgress(value);
if (Array.isArray(value)) {
audioRef.current.currentTime = ticksToSec(value[0]);
} else {
audioRef.current.currentTime = ticksToSec(value);
}
}}
/> />
<Typography
variant="subtitle2"
fontWeight={300}
style={{
opacity: 0.8,
}}
>
{getRuntimeMusic(item?.RunTimeTicks ?? 0)}
</Typography>
</div> </div>
</div>
{buttons} <PlayerActions onNavigate={handleNavigate} onClose={handleClose}>
<PlayerVolume
volume={volume}
isMuted={isMuted}
onVolumeChange={handleVolumeChange}
onMuteToggle={handleMuteToggle}
/>
</PlayerActions>
</motion.div> </motion.div>
)} )}
</AnimatePresence> </AnimatePresence>
@@ -137,7 +137,7 @@ const StatsForNerds = ({ playerRef }: StatsForNerdsProps) => {
<span>Media Source ID:</span> <span>{mediaSourceId}</span> <span>Media Source ID:</span> <span>{mediaSourceId}</span>
<span>Play Session ID:</span> <span>{playsessionId}</span> <span>Play Session ID:</span> <span>{playsessionId}</span>
<span>Playback Method:</span>{" "} <span>Playback Method:</span>{" "}
<span>{mediaSource.isDirectPlay ? "Direct Play" : "Transcoding"}</span> <span>{mediaSource.playMethod}</span>
<span>Container:</span> <span>{mediaSource.container}</span> <span>Container:</span> <span>{mediaSource.container}</span>
<span>Video Codec:</span> <span>{mediaSource.videoCodec}</span> <span>Video Codec:</span> <span>{mediaSource.videoCodec}</span>
<span>Audio Codec:</span> <span>{mediaSource.audioCodec}</span> <span>Audio Codec:</span> <span>{mediaSource.audioCodec}</span>
@@ -199,7 +199,7 @@ const BubbleSlider = () => {
trickplayResolution.Width / trickplayResolution.Height; trickplayResolution.Width / trickplayResolution.Height;
trickplayStyle = { trickplayStyle = {
background: `url(${api?.basePath}/Videos/${itemId}/Trickplay/${trickplayResolution.Width}/${index}.jpg?${imgUrlParams})`, backgroundImage: `url(${api?.basePath}/Videos/${itemId}/Trickplay/${trickplayResolution.Width}/${index}.jpg?${imgUrlParams})`,
backgroundPositionX: `${backgroundOffsetX}px`, backgroundPositionX: `${backgroundOffsetX}px`,
backgroundPositionY: `${backgroundOffsetY}px`, backgroundPositionY: `${backgroundOffsetY}px`,
width: `${trickplayResolution.Width}px`, width: `${trickplayResolution.Width}px`,
@@ -1,4 +1,5 @@
import { Button } from "@mui/material"; import { Box, Button } from "@mui/material";
import { AnimatePresence, motion } from "motion/react";
import React from "react"; import React from "react";
import { useShallow } from "zustand/shallow"; import { useShallow } from "zustand/shallow";
import { usePlaybackStore } from "@/utils/store/playback"; import { usePlaybackStore } from "@/utils/store/playback";
@@ -24,33 +25,67 @@ const SkipSegmentButton = () => {
})), })),
); );
if ( const shouldShow =
!mediaSegments?.Items?.length || mediaSegments?.Items?.length &&
currentSegmentIndex < 0 || currentSegmentIndex >= 0 &&
!activeSegmentId || activeSegmentId &&
mediaSegments?.Items?.[currentSegmentIndex].Type === "Outro" mediaSegments?.Items?.[currentSegmentIndex].Type !== "Outro";
) {
return null; // No segments to skip
}
return ( return (
<Button <AnimatePresence>
variant="outlined" {shouldShow && (
size="large" <motion.div
//@ts-ignore initial={{ opacity: 0, x: 20, scale: 0.9 }}
color="white" animate={{ opacity: 1, x: 0, scale: 1 }}
exit={{ opacity: 0, x: 20, scale: 0.9 }}
transition={{
type: "spring",
stiffness: 300,
damping: 30,
}}
style={{ style={{
position: "absolute", position: "absolute",
bottom: right: "3em",
isUserHovering || !isPlayerPlaying || isUserSeeking ? "18vh" : "2em",
right: "2em",
transition: "bottom 0.3s ease-in-out",
zIndex: 10000, zIndex: 10000,
bottom:
isUserHovering || !isPlayerPlaying || isUserSeeking ? "20vh" : "6em",
transition: "bottom 0.3s ease-in-out",
}} }}
>
<Button
onClick={skipSegment} onClick={skipSegment}
variant="contained"
startIcon={
<span className="material-symbols-rounded">skip_next</span>
}
sx={{
bgcolor: "rgba(20, 20, 20, 0.6)",
backdropFilter: "blur(16px) saturate(180%)",
color: "white",
border: "1px solid rgba(255, 255, 255, 0.1)",
borderRadius: "12px",
padding: "12px 24px",
textTransform: "none",
fontSize: "1rem",
fontWeight: 600,
boxShadow: "0 8px 32px 0 rgba(0, 0, 0, 0.2)",
transition: "all 0.2s ease",
"&:hover": {
bgcolor: "rgba(255, 255, 255, 0.1)",
transform: "scale(1.02)",
boxShadow: "0 8px 32px 0 rgba(0, 0, 0, 0.3)",
border: "1px solid rgba(255, 255, 255, 0.2)",
},
"&:active": {
transform: "scale(0.98)",
},
}}
> >
Skip {mediaSegments?.Items?.[currentSegmentIndex].Type} Skip {mediaSegments?.Items?.[currentSegmentIndex].Type}
</Button> </Button>
</motion.div>
)}
</AnimatePresence>
); );
}; };
@@ -1,6 +1,6 @@
import { Button, Typography } from "@mui/material"; import { Box, Button, IconButton, Typography } from "@mui/material";
import { motion } from "motion/react"; import { AnimatePresence, motion } from "motion/react";
import React, { useMemo } from "react"; import React, { useEffect, useMemo, useState } from "react";
import { useShallow } from "zustand/shallow"; import { useShallow } from "zustand/shallow";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi"; import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api"; import { useApiInContext } from "@/utils/store/api";
@@ -36,6 +36,13 @@ const UpNextFlyout = () => {
tracks: state.tracks, tracks: state.tracks,
})), })),
); );
const [isHidden, setIsHidden] = useState(false);
useEffect(() => {
setIsHidden(false);
}, [activeSegmentId]);
const areControlsVisible = useMemo(() => { const areControlsVisible = useMemo(() => {
return isUserHovering || isUserSeeking || !isPlayerPlaying; return isUserHovering || isUserSeeking || !isPlayerPlaying;
}, [isUserHovering, isUserSeeking, isPlayerPlaying]); }, [isUserHovering, isUserSeeking, isPlayerPlaying]);
@@ -45,7 +52,8 @@ const UpNextFlyout = () => {
if ( if (
!api || !api ||
!activeSegmentId || !activeSegmentId ||
mediaSegments?.Items?.[currentSegmemtIndex].Type !== "Outro" mediaSegments?.Items?.[currentSegmemtIndex].Type !== "Outro" ||
isHidden
) { ) {
return null; return null;
} }
@@ -56,53 +64,154 @@ const UpNextFlyout = () => {
} }
return ( return (
<AnimatePresence>
<motion.div <motion.div
className={ className={
areControlsVisible areControlsVisible
? "video-player-up_next_flyout floating" ? "video-player-up_next_flyout floating"
: "video-player-up_next_flyout" : "video-player-up_next_flyout"
} }
initial={{ opacity: 0 }} initial={{ opacity: 0, y: 50, scale: 0.95 }}
animate={{ opacity: 1 }} animate={{ opacity: 1, y: 0, scale: 1 }}
> exit={{ opacity: 0, y: 20, scale: 0.95 }}
<img transition={{ duration: 0.4, ease: [0.4, 0, 0.2, 1] }}
className="video-player-up_next_flyout-thumbnail" style={{
src={getImageUrlsApi(api).getItemImageUrlById(item.Id, "Primary", { background: "rgba(20, 20, 20, 0.6)",
tag: item.ImageTags?.Primary, backdropFilter: "blur(16px) saturate(180%)",
quality: 80, border: "1px solid rgba(255, 255, 255, 0.1)",
fillWidth: 300, boxShadow: "0 8px 32px 0 rgba(0, 0, 0, 0.3)",
})} borderRadius: "24px",
alt={"next item thumbnail"} padding: "16px",
/> display: "flex",
<div className="video-player-up_next_flyout-details"> gap: "16px",
<Typography variant="h5"> maxWidth: "500px",
{`S${item.ParentIndexNumber}:E${item.IndexNumber} `} width: "100%",
{item.Name}
</Typography>
<Typography
variant="subtitle2"
// noWrap
textOverflow="ellipsis"
maxWidth="100%"
sx={{
display: "-webkit-box",
webkitLineClamp: "3",
webkitBoxOrient: "vertical",
overflow: "hidden", overflow: "hidden",
}} }}
> >
{item.Overview} <Box
sx={{
position: "relative",
width: "160px",
minWidth: "160px",
borderRadius: "8px",
overflow: "hidden",
aspectRatio: "16/9",
boxShadow: "0 4px 12px rgba(0,0,0,0.3)",
}}
>
<img
src={getImageUrlsApi(api).getItemImageUrlById(item.Id, "Primary", {
tag: item.ImageTags?.Primary,
quality: 90,
fillWidth: 320,
})}
alt="next item thumbnail"
style={{
width: "100%",
height: "100%",
objectFit: "cover",
}}
/>
<Box
sx={{
position: "absolute",
inset: 0,
background:
"linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%)",
}}
/>
</Box>
<Box
sx={{
display: "flex",
flexDirection: "column",
flex: 1,
minWidth: 0,
justifyContent: "center",
}}
>
<Typography
variant="overline"
sx={{
color: "primary.main",
fontWeight: 700,
lineHeight: 1,
mb: 0.5,
letterSpacing: 1.2,
}}
>
UP NEXT
</Typography> </Typography>
<Typography
variant="h6"
sx={{
fontWeight: 600,
lineHeight: 1.2,
mb: 0.5,
fontSize: "1.1rem",
}}
noWrap
>
{item.SeriesName || item.Name}
</Typography>
<Typography
variant="body2"
color="text.secondary"
sx={{
mb: 2,
display: "-webkit-box",
WebkitLineClamp: 1,
WebkitBoxOrient: "vertical",
overflow: "hidden",
opacity: 0.8,
}}
>
{item.SeriesName
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`
: item.Overview || ""}
</Typography>
<Box sx={{ display: "flex", gap: 1, mt: "auto" }}>
<Button <Button
onClick={skipSegment} onClick={skipSegment}
variant="contained" variant="contained"
color="primary" color="primary"
className="video-player-up_next_flyout-button" startIcon={
<span className="material-symbols-rounded fill">
play_arrow
</span>
}
sx={{
borderRadius: "8px",
textTransform: "none",
fontWeight: 600,
boxShadow:
"0 4px 12px rgba(var(--mui-palette-primary-mainChannel), 0.3)",
flex: 1,
}}
> >
Play Play Now
</Button> </Button>
</div> <IconButton
onClick={() => setIsHidden(true)}
sx={{
borderRadius: "8px",
border: "1px solid rgba(255,255,255,0.1)",
color: "text.secondary",
"&:hover": {
bgcolor: "rgba(255,255,255,0.1)",
color: "white",
},
}}
>
<span className="material-symbols-rounded">close</span>
</IconButton>
</Box>
</Box>
</motion.div> </motion.div>
</AnimatePresence>
); );
}; };
+237
View File
@@ -0,0 +1,237 @@
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import {
Box,
IconButton,
ListItem,
ListItemAvatar,
ListItemText,
} from "@mui/material";
import React from "react";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api";
import { getTypeIcon } from "../utils/iconsCollection";
type QueueListItemProps = {
queueItem: BaseItemDto;
active?: boolean;
onDelete?: () => void;
onPlay?: () => void;
dragHandleProps?: any;
isEpisode?: boolean;
index?: number;
className?: string;
sx?: any;
};
const QueueListItem = ({
queueItem,
active,
onDelete,
onPlay,
dragHandleProps,
isEpisode,
className,
sx,
}: QueueListItemProps) => {
const api = useApiInContext((s) => s.api);
const imageUrl =
api &&
queueItem.Id &&
(queueItem.ImageTags?.Primary
? getImageUrlsApi(api).getItemImageUrlById(queueItem.Id, "Primary", {
tag: queueItem.ImageTags.Primary,
})
: queueItem.AlbumPrimaryImageTag?.[0]
? getImageUrlsApi(api).getItemImageUrlById(
queueItem.AlbumId || "",
"Primary",
{ tag: queueItem.AlbumPrimaryImageTag[0] },
)
: null);
const primaryText = queueItem.SeriesName || queueItem.Name;
let secondaryText = "";
if (isEpisode) {
const season = queueItem.ParentIndexNumber;
const episode = queueItem.IndexNumber;
const episodeEnd = queueItem.IndexNumberEnd;
const episodeString = episodeEnd
? `S${season}:E${episode}-${episodeEnd}`
: `S${season}:E${episode}`;
secondaryText = `${episodeString} - ${queueItem.Name}`;
} else {
secondaryText = queueItem.Artists?.join(", ") || "";
}
return (
<ListItem
component="div"
className={className}
secondaryAction={
onDelete && (
<IconButton
edge="end"
aria-label="delete"
onClick={onDelete}
size="small"
sx={{
opacity: 0,
transition: "opacity 0.2s",
".MuiListItem-root:hover &": { opacity: 0.7 },
"&:hover": { opacity: "1 !important", bgcolor: "action.hover" },
}}
>
<span className="material-symbols-rounded" style={{ fontSize: 20 }}>
close
</span>
</IconButton>
)
}
sx={{
opacity: active ? 1 : 1,
bgcolor: active ? "rgba(255, 255, 255, 0.1)" : "rgba(0,0,0,0.2)",
borderRadius: 3,
mb: 0,
transition: "all 0.2s ease",
border: "1px solid",
borderColor: active
? "rgba(255, 255, 255, 0.2)"
: "rgba(255,255,255,0.05)",
"&:hover": {
bgcolor: active
? "rgba(255, 255, 255, 0.15)"
: "rgba(255,255,255,0.05)",
transform: active ? "none" : "translateY(-2px)",
borderColor: active
? "rgba(255, 255, 255, 0.3)"
: "rgba(255,255,255,0.2)",
boxShadow: active ? "none" : "0 4px 12px rgba(0,0,0,0.2)",
},
pr: onDelete ? 6 : 2,
...sx,
}}
>
{dragHandleProps && (
<div
{...dragHandleProps}
style={{
cursor: "grab",
marginRight: 12,
display: "flex",
alignItems: "center",
opacity: 0.5,
transition: "opacity 0.2s",
}}
className="drag-handle"
>
<span className="material-symbols-rounded">drag_indicator</span>
</div>
)}
<ListItemAvatar sx={{ minWidth: 64 }}>
<Box
onClick={onPlay}
sx={{
width: 48,
height: 48,
borderRadius: 2,
overflow: "hidden",
position: "relative",
boxShadow: "0 2px 8px rgba(0,0,0,0.2)",
cursor: onPlay ? "pointer" : "default",
"&:hover .play-overlay": {
opacity: 1,
},
}}
>
{imageUrl ? (
<img
src={imageUrl}
alt={queueItem.Name || ""}
style={{ width: "100%", height: "100%", objectFit: "cover" }}
/>
) : (
<div
style={{
width: "100%",
height: "100%",
display: "flex",
alignItems: "center",
justifyContent: "center",
background: "#2a2a2a",
}}
>
{queueItem.Type && getTypeIcon(queueItem.Type)}
</div>
)}
{active && (
<div
style={{
position: "absolute",
inset: 0,
background: "rgba(0,0,0,0.4)",
display: "flex",
alignItems: "center",
justifyContent: "center",
backdropFilter: "blur(2px)",
}}
>
<span
className="material-symbols-rounded"
style={{ fontSize: "1.5rem", color: "white" }}
>
equalizer
</span>
</div>
)}
{!active && onPlay && (
<Box
className="play-overlay"
sx={{
position: "absolute",
inset: 0,
background: "rgba(0,0,0,0.4)",
display: "flex",
alignItems: "center",
justifyContent: "center",
opacity: 0,
transition: "opacity 0.2s",
backdropFilter: "blur(1px)",
}}
>
<span
className="material-symbols-rounded"
style={{ fontSize: "2rem", color: "white" }}
>
play_arrow
</span>
</Box>
)}
</Box>
</ListItemAvatar>
<ListItemText
primary={primaryText}
secondary={secondaryText}
slotProps={{
primary: {
noWrap: true,
variant: "body2",
fontWeight: active ? 700 : 500,
sx: { mb: 0.5 },
},
secondary: {
noWrap: true,
variant: "caption",
sx: { opacity: 0.7 },
},
}}
/>
</ListItem>
);
};
export default QueueListItem;
+17 -8
View File
@@ -1,21 +1,18 @@
import { getRuntimeMusic } from "@/utils/date/time";
import useQueue from "@/utils/store/queue";
import { useSortable } from "@dnd-kit/sortable"; import { useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities"; import { CSS } from "@dnd-kit/utilities";
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client"; import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import { Typography } from "@mui/material"; import { IconButton, Typography } from "@mui/material";
import React from "react"; import React from "react";
import { getRuntimeMusic } from "@/utils/date/time";
import useQueue from "@/utils/store/queue";
type Props = { type Props = {
track: BaseItemDto; track: BaseItemDto;
index: number; index: number;
onRemove?: () => void;
}; };
const QueueTrack = (props: Props) => { const QueueTrack = (props: Props) => {
const { track, index } = props; const { track, index, onRemove } = props;
const [currentItemIndex] = useQueue((s) => [s.currentItemIndex]); const [currentItemIndex] = useQueue((s) => [s.currentItemIndex]);
const { attributes, listeners, setNodeRef, transform, transition } = const { attributes, listeners, setNodeRef, transform, transition } =
@@ -50,9 +47,21 @@ const QueueTrack = (props: Props) => {
{track.Artists?.join(", ")} {track.Artists?.join(", ")}
</Typography> </Typography>
</div> </div>
<div style={{ display: "flex", alignItems: "center", gap: "0.5em" }}>
<Typography className="opacity-07"> <Typography className="opacity-07">
{getRuntimeMusic(track.RunTimeTicks ?? 0)} {getRuntimeMusic(track.RunTimeTicks ?? 0)}
</Typography> </Typography>
{onRemove && (
<IconButton size="small" onClick={onRemove}>
<span
className="material-symbols-rounded"
style={{ fontSize: "1.2em" }}
>
close
</span>
</IconButton>
)}
</div>
</div> </div>
); );
}; };
+420
View File
@@ -0,0 +1,420 @@
import { ItemSortBy } from "@jellyfin/sdk/lib/generated-client";
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
import { getSearchApi } from "@jellyfin/sdk/lib/utils/api/search-api";
import {
Box,
Button,
Dialog,
Grow,
IconButton,
InputBase,
LinearProgress,
Stack,
Typography,
useTheme,
} from "@mui/material";
import type { TransitionProps } from "@mui/material/transitions";
import { useQuery } from "@tanstack/react-query";
import { useNavigate } from "@tanstack/react-router";
import { register } from "@tauri-apps/plugin-global-shortcut";
import React, {
type ChangeEvent,
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from "react";
import { useShallow } from "zustand/shallow";
import useDebounce from "@/utils/hooks/useDebounce";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import useSearchStore from "@/utils/store/search";
import SearchItem from "./item";
const Transition = React.forwardRef(function Transition(
props: TransitionProps & {
children: React.ReactElement<any, any>;
},
ref: React.Ref<unknown>,
) {
return <Grow ref={ref} {...props} />;
});
const Search = () => {
const theme = useTheme();
const { isOpen, handleClose, toggleSearchDialog } = useSearchStore(
useShallow((s) => ({
isOpen: s.showSearchDialog,
handleClose: s.toggleSearchDialog,
toggleSearchDialog: s.toggleSearchDialog,
})),
);
const api = useApiInContext((s) => s.api);
const userId = useCentralStore((s) => s.currentUser?.Id || "");
const suggestions = useQuery({
queryKey: ["search", "suggestions"],
queryFn: async () =>
api &&
(
await getItemsApi(api).getItems({
userId: userId,
limit: 5,
sortBy: [ItemSortBy.IsFavoriteOrLiked, ItemSortBy.Random],
includeItemTypes: ["Movie", "Series", "MusicArtist"],
enableImages: true,
recursive: true,
})
).data,
});
const [searchTerm, setSearchTerm] = useState("");
const debouncedSearchTerm = useDebounce(searchTerm, 300);
const inputRef = useRef<HTMLInputElement>(null);
useEffect(() => {
if (isOpen) {
setTimeout(() => {
inputRef.current?.focus();
}, 100);
}
}, [isOpen]);
const handleSearchChange = (e: ChangeEvent<HTMLInputElement>) => {
setSearchTerm(e.target.value);
};
const searchResults = useQuery({
queryKey: ["search", debouncedSearchTerm],
queryFn: async () => {
if (!api) return null;
if (debouncedSearchTerm.trim() === "") {
return null;
}
return (
await getSearchApi(api).getSearchHints({
searchTerm: debouncedSearchTerm,
userId: userId,
limit: 10,
includeItemTypes: [
"Movie",
"Series",
"MusicAlbum",
"Person",
"Audio",
"Photo",
"PhotoAlbum",
"Playlist",
],
// enableImages: true,
})
).data;
},
});
const showSuggestions = useMemo(
() =>
(debouncedSearchTerm.length === 0 || searchResults.isLoading) &&
(suggestions.data?.Items?.length ?? 0) > 0,
[
debouncedSearchTerm.length,
searchResults.isLoading,
suggestions.data?.Items?.length,
],
);
const navigate = useNavigate();
const handleClearSearch = useCallback(() => {
setSearchTerm("");
}, []);
const handleAdvancedSearch = useCallback(() => {
navigate({ to: "/search", search: { query: debouncedSearchTerm } });
toggleSearchDialog();
}, [navigate, toggleSearchDialog, debouncedSearchTerm]);
useEffect(() => {
async function registerglobalShortcut() {
await register("CommandOrControl+K", (e) => {
if (e.state === "Pressed") {
toggleSearchDialog();
}
});
}
registerglobalShortcut();
}, []);
return (
<Dialog
open={isOpen}
slotProps={{
transition: Transition,
paper: {
className: "glass-panel",
sx: {
willChange: "opacity, transform, backdrop-filter",
borderRadius: 4,
overflow: "hidden",
},
},
}}
onClose={handleClose}
fullWidth
maxWidth="sm"
>
<Box sx={{ position: "relative" }}>
<Stack
direction="row"
alignItems="center"
spacing={1.5}
sx={{
p: "16px 24px",
}}
>
<span
className="material-symbols-rounded"
style={{
color: "var(--mui-palette-text-secondary)",
fontSize: "1.75rem",
opacity: 0.7,
}}
>
search
</span>
<InputBase
inputRef={inputRef}
placeholder="Search movies, shows, and more..."
onChange={handleSearchChange}
value={searchTerm}
fullWidth
autoFocus
sx={{
fontSize: "1.25rem",
fontWeight: 400,
color: "text.primary",
"& input::placeholder": {
color: "text.disabled",
opacity: 1,
},
}}
/>
{searchTerm && (
<IconButton
onClick={handleClearSearch}
size="small"
sx={{
color: "text.secondary",
bgcolor: "rgba(255,255,255,0.05)",
"&:hover": {
bgcolor: "rgba(255,255,255,0.15)",
},
}}
>
<span
className="material-symbols-rounded"
style={{ fontSize: "1.25rem" }}
>
close
</span>
</IconButton>
)}
</Stack>
{searchResults.isLoading && (
<LinearProgress
sx={{
height: 2,
backgroundColor: "transparent",
"& .MuiLinearProgress-bar": {
backgroundImage: `linear-gradient(90deg, ${theme.palette.primary.main}, ${theme.palette.secondary.main})`,
},
position: "absolute",
bottom: 0,
left: 0,
right: 0,
}}
/>
)}
<Box
sx={{
height: "1px",
bgcolor: "divider",
opacity: 0.1,
mx: 2,
}}
/>
</Box>
<Stack
spacing={1}
sx={{
p: 1,
maxHeight: "55vh",
overflowY: "auto",
minHeight:
showSuggestions ||
(debouncedSearchTerm &&
searchResults.data?.SearchHints?.length !== 0)
? "auto"
: "150px",
"&::-webkit-scrollbar": {
width: "8px",
},
"&::-webkit-scrollbar-thumb": {
background: "rgba(255,255,255,0.1)",
borderRadius: "4px",
},
}}
>
{debouncedSearchTerm.length > 0 &&
searchResults.data?.SearchHints &&
searchResults.data.SearchHints.length > 0 && (
<Box>
<Typography
variant="caption"
fontWeight={600}
sx={{
px: 2,
py: 1.5,
color: "text.secondary",
textTransform: "uppercase",
letterSpacing: "0.05em",
display: "block",
}}
>
Results
</Typography>
<Stack spacing={0.5} sx={{ px: 1 }}>
{searchResults.data.SearchHints.map((item) => (
<SearchItem
key={item.Id}
itemName={item.Name || "Untitled"}
imageUrl={
api &&
item.PrimaryImageTag &&
getImageUrlsApi(api).getItemImageUrl(item, "Primary", {
maxWidth: 90,
maxHeight: 140,
tag: item.PrimaryImageTag,
})
}
itemYear={
item.Type === "Series"
? `${item.ProductionYear?.toString()} - ${new Date(item.EndDate ?? "").getFullYear().toString()}`
: item.ProductionYear?.toString()
}
itemType={item.Type}
itemId={item.Id ?? ""}
/>
))}
</Stack>
</Box>
)}
{showSuggestions && (
<Box>
<Typography
variant="caption"
fontWeight={600}
sx={{
px: 2,
py: 1.5,
color: "text.secondary",
textTransform: "uppercase",
letterSpacing: "0.05em",
display: "block",
}}
>
Suggestions
</Typography>
<Stack spacing={0.5} sx={{ px: 1 }}>
{suggestions.data?.Items?.map((item) => (
<SearchItem
key={item.Id}
itemName={item.Name || "Untitled"}
imageUrl={
api &&
item.ImageTags?.Primary &&
getImageUrlsApi(api).getItemImageUrl(item, "Primary", {
maxWidth: 90,
maxHeight: 140,
})
}
itemYear={
item.Type === "Series"
? `${item.ProductionYear?.toString()} - ${new Date(item.EndDate ?? "").getFullYear().toString()}`
: item.ProductionYear?.toString()
}
itemType={item.Type}
itemId={item.Id ?? ""}
/>
))}
</Stack>
</Box>
)}
{searchResults.isSuccess &&
searchResults.data?.SearchHints?.length === 0 && (
<Stack
alignItems="center"
justifyContent="center"
sx={{
height: "100%",
minHeight: "200px",
color: "text.secondary",
gap: 2,
}}
>
<span
className="material-symbols-rounded"
style={{ fontSize: "48px", opacity: 0.2 }}
>
search_off
</span>
<Typography variant="body1">
No results found for "{debouncedSearchTerm}"
</Typography>
</Stack>
)}
</Stack>
<Stack
direction="row"
justifyContent="flex-end"
sx={{
p: 1.5,
mt: 1,
backgroundImage:
"linear-gradient(to top, rgba(0,0,0,0.2), transparent)",
}}
>
<Button
onClick={handleAdvancedSearch}
endIcon={
<span
className="material-symbols-rounded"
style={{ fontSize: "1.25rem" }}
>
arrow_forward
</span>
}
sx={{
color: "text.secondary",
textTransform: "none",
fontWeight: 500,
padding: "6px 16px",
borderRadius: "8px",
"&:hover": {
color: "primary.main",
backgroundColor: "rgba(255,255,255,0.05)",
},
}}
>
Advanced Search
</Button>
</Stack>
</Dialog>
);
};
export default Search;
+132
View File
@@ -0,0 +1,132 @@
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
import { Box, Button, Stack, Typography } from "@mui/material";
import { useNavigate } from "@tanstack/react-router";
import React from "react";
import { useShallow } from "zustand/react/shallow";
import useSearchStore from "@/utils/store/search";
import { getTypeIcon } from "../utils/iconsCollection";
type SearchItemProps = {
itemName: string;
imageUrl?: string | null;
itemYear?: string;
itemType?: BaseItemKind;
itemId: string;
};
const SearchItem = (props: SearchItemProps) => {
const { itemName, imageUrl, itemYear, itemType, itemId } = props;
const toggleSearchDialog = useSearchStore(
useShallow((s) => s.toggleSearchDialog),
);
const navigate = useNavigate();
const handleOnClick = () => {
toggleSearchDialog();
switch (itemType) {
case BaseItemKind.BoxSet:
navigate({ to: "/boxset/$id", params: { id: itemId } });
break;
case BaseItemKind.Episode:
navigate({ to: "/episode/$id", params: { id: itemId } });
break;
case BaseItemKind.MusicAlbum:
navigate({ to: "/album/$id", params: { id: itemId } });
break;
case BaseItemKind.MusicArtist:
navigate({ to: "/artist/$id", params: { id: itemId } });
break;
case BaseItemKind.Person:
navigate({ to: "/person/$id", params: { id: itemId } });
break;
case BaseItemKind.Series:
navigate({ to: "/series/$id", params: { id: itemId } });
break;
case BaseItemKind.Playlist:
navigate({ to: "/playlist/$id", params: { id: itemId } });
break;
default:
navigate({ to: "/item/$id", params: { id: itemId } });
break;
}
};
return (
<Button
onClick={handleOnClick}
fullWidth
sx={{
justifyContent: "flex-start",
textAlign: "left",
p: 1,
borderRadius: 2,
textTransform: "none",
color: "text.primary",
"&:hover": {
bgcolor: "action.hover",
},
}}
>
<Box
sx={{
width: 50,
height: 75,
mr: 2,
borderRadius: 1,
overflow: "hidden",
bgcolor: "action.selected",
flexShrink: 0,
display: "flex",
alignItems: "center",
justifyContent: "center",
}}
>
{imageUrl ? (
<Box
component="img"
src={imageUrl}
alt={itemName}
sx={{
height: "100%",
width: "100%",
objectFit: "cover",
}}
/>
) : (
<span
className="material-symbols-rounded"
style={{
fontSize: "2rem",
color: "var(--mui-palette-text-secondary)",
}}
>
{getTypeIcon(itemType ?? "unknown")}
</span>
)}
</Box>
<Stack sx={{ minWidth: 0, flex: 1 }}>
<Typography variant="body1" noWrap fontWeight={500}>
{itemName}
</Typography>
<Stack direction="row" spacing={1} alignItems="center">
{itemYear && (
<Typography variant="caption" color="text.secondary">
{itemYear}
</Typography>
)}
{itemYear && itemType && (
<Typography variant="caption" color="text.secondary">
•
</Typography>
)}
{itemType && (
<Typography variant="caption" color="text.secondary">
{itemType}
</Typography>
)}
</Stack>
</Stack>
</Button>
);
};
export default SearchItem;
-710
View File
@@ -1,710 +0,0 @@
import useSettingsStore, {
setSettingsDialogOpen,
setSettingsTabValue,
} from "@/utils/store/settings";
import {
Button,
Chip,
Dialog,
DialogActions,
DialogContent,
DialogTitle,
Fab,
IconButton,
Link,
Skeleton,
Tab,
Tabs,
TextField,
Typography,
} from "@mui/material";
import { AnimatePresence, motion } from "motion/react";
import React, { useState, useMemo, useCallback } from "react";
import logo from "@/assets/logo.png";
import { jellyfin, useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import { getDisplayPreferencesApi } from "@jellyfin/sdk/lib/utils/api/display-preferences-api";
import { getLocalizationApi } from "@jellyfin/sdk/lib/utils/api/localization-api";
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import "./settings.scss";
import {
delServer,
getAllServers,
getDefaultServer,
setDefaultServer,
setServer,
} from "@/utils/storage/servers";
import { allSettings } from "@/utils/storage/settings";
import { delUser } from "@/utils/storage/user";
import type { RecommendedServerInfo } from "@jellyfin/sdk";
import { LoadingButton } from "@mui/lab";
import { red } from "@mui/material/colors";
import { useNavigate } from "@tanstack/react-router";
import { relaunch } from "@tauri-apps/plugin-process";
import { check } from "@tauri-apps/plugin-updater";
import { useSnackbar } from "notistack";
import SettingOption from "../settingOption";
import SettingOptionSelect from "../settingOptionSelect";
const motionConfig = {
initial: {
opacity: 0,
},
visible: {
opacity: 1,
},
};
const Settings = () => {
const [open, tabValue] = useSettingsStore((state) => [
state.dialogOpen,
state.tabValue,
]);
const api = useApiInContext((s) => s.api);
const createApi = useApiInContext((s) => s.createApi);
const user = useCentralStore((state) => state.currentUser);
const systemInfo = useQuery({
queryKey: ["about", "systemInfo"],
queryFn: async () => {
if (!api) return null;
const result = await getSystemApi(api).getSystemInfo();
return result.data;
},
enabled: Boolean(api) && open,
});
const navigate = useNavigate();
const { enqueueSnackbar } = useSnackbar();
const [applicationVersion] = useCentralStore((state) => [state.clientVersion]);
const serversOnDisk = useQuery({
queryKey: ["settings", "serversOnDisk"],
queryFn: async () => await getAllServers(),
enabled: open,
});
const updateInfo = useQuery({
queryKey: ["about", "updater"],
queryFn: async () => await check(),
enabled: open,
});
const defaultServer = useQuery({
queryKey: ["settings", "default-server"],
queryFn: async () => await getDefaultServer(),
enabled: open,
});
const cultures = useQuery({
queryKey: ["settings", "cultures"],
queryFn: async () => {
if (!api) return;
const result = await getLocalizationApi(api).getCultures();
return result.data;
},
enabled: open,
});
const clientSettingsOnServer = useQuery({
queryKey: ["settings", "clientSettings"],
queryFn: async () => {
if (!api) return;
const result = await getDisplayPreferencesApi(api).getDisplayPreferences({
client: "blink",
userId: user?.Id,
displayPreferencesId: api.deviceInfo.id,
});
return result.data;
},
enabled: open,
});
const queryClient = useQueryClient();
// Server Management
const [updating, setUpdating] = useState(false);
const [addServerDialog, setAddServerDialog] = useState(false);
const [serverIp, setServerIp] = useState("");
const handleServerChange = useMutation({
mutationFn: async (server: RecommendedServerInfo) => {
await delUser();
await setDefaultServer(server.systemInfo?.Id ?? "");
await defaultServer.refetch();
createApi(server.address, undefined);
queryClient.removeQueries();
},
onSuccess: async () => {
setSettingsDialogOpen(false);
navigate({ to: "/login" });
},
onError: (error) => {
console.error(error);
enqueueSnackbar("Error changing the server", {
variant: "error",
});
},
});
const handleDelete = useMutation({
mutationKey: ["server-delete"],
mutationFn: async (server: RecommendedServerInfo) => {
await delServer(server.systemInfo?.Id ?? "");
if (server.systemInfo?.Id === defaultServer.data) {
await delUser();
await serversOnDisk.refetch();
if (serversOnDisk.data?.length) {
setDefaultServer(serversOnDisk.data[0].id);
createApi(serversOnDisk.data[0].address, undefined);
} else {
// TODO: Reset api in context
// useApi.setState(useApi.getInitialState());
}
setSettingsDialogOpen(false);
await queryClient.removeQueries();
navigate({ to: "/" });
}
enqueueSnackbar("Server deleted successfully!", { variant: "success" });
await serversOnDisk.refetch();
await defaultServer.refetch();
},
});
const addServer = useMutation({
mutationFn: async () => {
const servers =
await jellyfin.discovery.getRecommendedServerCandidates(serverIp);
const bestServer = jellyfin.discovery.findBestServer(servers);
return bestServer;
},
onSuccess: async (bestServer) => {
if (bestServer) {
await setServer(bestServer.systemInfo?.Id ?? "", bestServer);
setAddServerDialog(false);
enqueueSnackbar(
"Client added successfully. You might need to refresh client list.",
{
variant: "success",
},
);
await serversOnDisk.refetch();
}
},
onError: (err) => {
console.error(err);
enqueueSnackbar(`${err}`, { variant: "error" });
enqueueSnackbar("Something went wrong", { variant: "error" });
},
onSettled: async (bestServer) => {
if (!bestServer) {
enqueueSnackbar("Provided server address is not a Jellyfin server.", {
variant: "error",
});
}
},
});
// Memoize PaperProps to prevent unnecessary re-renders
const paperProps = useMemo(
() => ({
className: "settings glass",
elevation: 10,
}),
[],
);
// Memoize onClose function to prevent unnecessary re-renders
const handleClose = useCallback(() => {
setSettingsDialogOpen(false);
}, []);
return (
<Dialog
open={open}
fullWidth
maxWidth="md"
slotProps={{ paper: paperProps }}
hideBackdrop
onClose={handleClose}
>
<Tabs
orientation="vertical"
value={tabValue}
onChange={(_, newValue) => {
setSettingsTabValue(newValue);
}}
style={{
background: "rgb(0 0 0 / 0.4)",
}}
>
<Tab
icon={<span className="material-symbols-rounded">settings</span>}
iconPosition="start"
value={1}
label="General"
className="settings-tab"
sx={{
minHeight: "48px",
height: "48px",
}}
/>
<Tab
icon={<span className="material-symbols-rounded">dns</span>}
iconPosition="start"
value={2}
label="Servers"
className="settings-tab"
sx={{
minHeight: "48px",
height: "48px",
}}
/>
<Tab
icon={<span className="material-symbols-rounded">tune</span>}
iconPosition="start"
value={3}
label="Perferences"
className="settings-tab"
sx={{
minHeight: "48px",
height: "48px",
}}
/>
<Tab
icon={<span className="material-symbols-rounded">info</span>}
iconPosition="start"
value={10}
label="About"
className="settings-tab"
sx={{
minHeight: "48px",
height: "48px",
marginTop: "auto",
}}
/>
</Tabs>
<AnimatePresence mode="wait">
<motion.div
variants={motionConfig}
initial="initial"
animate="visible"
exit="initial"
key={tabValue}
transition={{
duration: 0.25,
}}
className="settings-scroll "
>
{/* General */}
{tabValue === 1 && (
<div className="settings-container">
{allSettings.general.map((setting) => (
<SettingOption key={setting.key} setting={setting} />
))}
</div>
)}
{/* Server */}
{tabValue === 2 && (
<motion.div
layoutScroll
className="settings-container settings-server-container"
>
{serversOnDisk.isSuccess &&
serversOnDisk.data.map((server, index) => {
return (
<motion.div
key={server.id}
className="settings-server"
initial={{
transform: "translateY(10px)",
opacity: 0,
}}
animate={{ transform: "translateY(0px)", opacity: 1 }}
exit={{ transform: "translateY(-10px)", opacity: 0 }}
transition={{
delay: 0.1 * index,
duration: 0.15,
}}
>
<span className="material-symbols-rounded settings-server-icon">
hard_drive
</span>
<div className="settings-server-info">
<Typography
variant="h5"
style={{
display: "flex",
alignItems: "center",
}}
>
{server.systemInfo?.ServerName}
{systemInfo.data?.Id === server.id && (
<Chip
label={
<Typography
variant="caption"
fontWeight={600}
fontFamily="JetBrains Mono Variable"
>
Current
</Typography>
}
color="info"
sx={{
ml: 2,
width: "5.4em",
}}
size="medium"
/>
)}
</Typography>
<Typography variant="subtitle1">
{server.address}
</Typography>
<Typography
variant="subtitle2"
className="settings-server-info-version"
>
Version:{" "}
<Typography
className="gradient-text"
variant="subtitle2"
fontWeight={700}
>
{server.systemInfo?.Version}
</Typography>
</Typography>
</div>
<div className="settings-buttons">
<IconButton
style={{
fontSize: "1.64em",
}}
onClick={() => {
handleServerChange.mutate(server);
}}
disabled={handleServerChange.isPending}
>
<div className="material-symbols-rounded">start</div>
</IconButton>
<IconButton
style={{
fontSize: "1.64em",
color: red[400],
}}
disabled={handleServerChange.isPending}
onClick={() => {
handleDelete.mutate(server);
}}
>
<div className="material-symbols-rounded">
delete_forever
</div>
</IconButton>
</div>
</motion.div>
);
})}
<div className="settings-server-fab-container">
<Fab
onClick={() => serversOnDisk.refetch()}
size="medium"
color="info"
disabled={serversOnDisk.isFetching}
>
<span
className={
serversOnDisk.isFetching
? "material-symbols-rounded animate-rotate"
: "material-symbols-rounded"
}
>
autorenew
</span>
</Fab>
<Fab
variant="extended"
onClick={() => setAddServerDialog(true)}
>
<span
className="material-symbols-rounded fill"
style={{
marginRight: "0.25em",
}}
>
add_circle
</span>
Add server
</Fab>
</div>
</motion.div>
)}
{/* Preferences */}
{tabValue === 3 && cultures.isSuccess && (
<div className="settings-container">
<SettingOptionSelect
setting={{
name: "Preferred Audio Language",
description: "Select your preferred audio language.",
}}
userValue={
user?.Configuration?.AudioLanguagePreference ?? "anyLanguage"
}
options={cultures.data ?? []}
/>
</div>
)}
{/* About */}
{tabValue === 10 && (
<div className="settings-container settings-about">
<img src={logo} className="settings-logo" alt="Blink" />
<div className="settings-grid">
<div className="settings-info-container">
<div className="settings-info">
<Typography variant="subtitle2">Client Version:</Typography>
<Chip
icon={
<span
className="material-symbols-rounded"
// style={{ "--wght": 500 }}
>
{updateInfo.data?.available
? "release_alert"
: "new_releases"}
</span>
}
label={
<Typography variant="subtitle2">
{applicationVersion}
</Typography>
}
color={updateInfo.data?.available ? "error" : "success"}
size="small"
style={{
width: "fit-content !important",
}}
/>
</div>
<div className="settings-info">
<Typography variant="subtitle2">
Update Available:
</Typography>
<Typography variant="subtitle2">
{updateInfo.isFetching ? (
"Checking for new updates..."
) : updateInfo.data?.available ? (
<Chip
icon={
<span className="material-symbols-rounded">
new_releases
</span>
}
label={
<Typography variant="subtitle2">
{applicationVersion}
</Typography>
}
color="success"
size="small"
style={{
width: "fit-content !important",
}}
/>
) : (
"No update found."
)}
</Typography>
</div>
<LoadingButton
style={{
marginTop: "auto",
}}
loading={updateInfo.isFetching || updating}
variant="contained"
disabled={!updateInfo.data?.available}
loadingPosition="start"
onClick={async () => {
if (updateInfo.data?.available) {
setUpdating(true);
await updateInfo.data?.downloadAndInstall();
enqueueSnackbar(
"Update has been installed! You need to relaunch Blink.",
{
variant: "success",
},
);
await relaunch();
}
}}
>
{updateInfo.isFetching
? "Checking for Update..."
: updateInfo.data?.available
? "Update"
: "No Update Found"}
</LoadingButton>
</div>
{systemInfo.isSuccess ? (
<div className="settings-info-container">
<div className="settings-info">
<Typography variant="subtitle2">Server:</Typography>
<Typography variant="subtitle2">
{systemInfo.data?.ServerName}
</Typography>
</div>
<div className="settings-info">
<Typography variant="subtitle2">
Jellyfin Version:
</Typography>
<Typography variant="subtitle2">
{systemInfo.data?.Version}
</Typography>
</div>
<div className="settings-info">
<Typography variant="subtitle2">
Server Architecture:
</Typography>
<Typography variant="subtitle2">
{systemInfo.data?.SystemArchitecture}
</Typography>
</div>
</div>
) : (
<Skeleton
variant="rectangular"
sx={{
height: "100%",
borderRadius: "10px",
}}
/>
)}
</div>
<div
style={{
marginTop: "1em",
background: "rgb(0 0 0 / 0.3)",
padding: "1em",
borderRadius: "10px",
}}
>
<Typography variant="subtitle1" mb={1}>
Links:
</Typography>
<div
style={{
display: "flex",
flexDirection: "column",
alignItems: "flex-start",
gap: "0.1em",
}}
>
<Typography
component={Link}
variant="subtitle2"
target="_blank"
href="https://github.com/prayag17/Blink"
>
https://github.com/prayag17/Blink
</Typography>
<Typography
component={Link}
variant="subtitle2"
target="_blank"
href="https://jellyfin.org"
>
https://jellyfin.org
</Typography>
</div>
</div>
</div>
)}
</motion.div>
</AnimatePresence>
{/* Add Server */}
<Dialog
open={addServerDialog}
fullWidth
hideBackdrop
disableScrollLock={true}
>
<DialogTitle>Add Server</DialogTitle>
<DialogContent className="settings-server-add">
<TextField
variant="filled"
label="Address"
fullWidth
onChange={(e) => setServerIp(e.target.value)}
/>
</DialogContent>
<DialogActions
style={{
alignItems: "center",
justifyContent: "center",
padding: "1em",
gap: "1em",
}}
>
<Button
variant="contained"
startIcon={
<span
className="material-symbols-rounded"
style={{
marginRight: "0.25em",
fontVariationSettings:
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
}}
>
cancel
</span>
}
color="error"
onClick={() => setAddServerDialog(false)}
>
Close
</Button>
{/* @ts-ignore */}
<LoadingButton
startIcon={
<span
className="material-symbols-rounded"
style={{
marginRight: "0.25em",
fontVariationSettings:
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
}}
>
add_circle
</span>
}
variant="contained"
loading={addServer.isPending}
loadingPosition="start"
onClick={addServer.mutate}
color="success"
>
Add
</LoadingButton>
</DialogActions>
</Dialog>
</Dialog>
);
};
export default Settings;
-151
View File
@@ -1,151 +0,0 @@
.settings {
display: grid !important;
grid-template-columns: 20% 1fr;
height: 60vh;
overflow: hidden !important;
.MuiTabs-flexContainerVertical {
height: 100%;
}
&-container {
margin: 14px 0 14px 14px;
}
&-tab {
display: grid !important;
grid-template-columns: 2em 1fr;
align-items: center;
justify-items: start !important;
gap: 1em;
& .material-symbols-rounded {
justify-self: center !important;
}
}
&-scroll {
overflow-y: auto;
scrollbar-gutter: stable;
overscroll-behavior: contain;
// Magic scrollbar
&::-webkit-scrollbar {
&-thumb {
height: 150px;
max-height: 33%;
}
&-track {
margin-top: 15px;
margin-bottom: 15px;
background: transparent !important;
}
}
}
// About page
&-grid {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
gap: 1em;
}
&-logo {
width: 100%;
background: rgb(255 255 255 / 1);
padding: 0em;
height: 10em;
margin-bottom: 1em;
border-radius: $border-radius-default;
object-fit: contain;
}
&-info {
display: grid;
grid-template-columns: 40% 1fr;
gap: 1em;
justify-items: start;
align-items: center;
border-bottom: 1px solid rgb(255 255 255 / 0.1);
padding-bottom: 0.5em;
&-container {
background: rgb(0 0 0 / 0.3);
padding: 1em;
border-radius: $border-radius-default;
display: flex;
flex-direction: column;
gap: 0.6em;
width: 100%;
}
&:last-child {
border: none;
padding-bottom: 0em;
}
> :last-child {
opacity: 0.8;
}
}
//settings
&-option {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
padding: 0 !important;
margin: 0 !important;
margin-bottom: 0.6em !important;
&-info-caption {
opacity: 0.6;
}
}
//serverList
&-server {
display: grid;
grid-template-columns: 3.4em 1fr auto;
justify-items: start;
align-items: center;
gap: 0.8em;
background: rgb(0 0 0 / 0.3);
padding: 1em;
width: 100%;
border-radius: $border-radius-default;
&-container {
display: flex;
flex-direction: column;
gap: 1em;
align-items: center;
padding-bottom: 4.6em;
}
&-icon {
font-size: 3.4em !important;
font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 10, "opsz" 40;
}
&-info {
display: flex;
flex-direction: column;
// width: 100%;
&-version {
display: flex;
align-items: center;
gap: 0.4em;
}
}
&-buttons {
display: flex;
flex-direction: row;
gap: 0.5em;
// width: 100%;
overflow: hidden;
}
&-fab-container {
display: flex;
position: absolute;
bottom: 14px;
right: 14px;
align-items: center;
justify-content: center;
gap: 0.8em;
}
// Dialog
&-add {
display: flex;
flex-direction: column;
align-items: center;
gap: 1em;
}
}
}
.Mui-selected .material-symbols-rounded {
font-variation-settings: "FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40;
}
+256 -69
View File
@@ -1,18 +1,19 @@
import { LoadingButton } from "@mui/lab"; import { LoadingButton } from "@mui/lab";
import { import {
Box,
Button, Button,
Chip, CircularProgress,
Dialog, Dialog,
DialogActions, DialogActions,
DialogContent, DialogContent,
DialogContentText, Stack,
DialogTitle, Typography,
Link,
} from "@mui/material"; } from "@mui/material";
import { relaunch } from "@tauri-apps/plugin-process"; import { relaunch } from "@tauri-apps/plugin-process";
import { type Update, check } from "@tauri-apps/plugin-updater"; import { open } from "@tauri-apps/plugin-shell";
import { check, type Update } from "@tauri-apps/plugin-updater";
import { useSnackbar } from "notistack"; import { useSnackbar } from "notistack";
import React, { useLayoutEffect, useState } from "react"; import React, { useCallback, useLayoutEffect, useState } from "react";
export default function Updater() { export default function Updater() {
const [updateDialog, setUpdateDialog] = useState(false); const [updateDialog, setUpdateDialog] = useState(false);
@@ -23,8 +24,8 @@ export default function Updater() {
async function checkForUpdates() { async function checkForUpdates() {
try { try {
const update = await check(); const update = await check();
if (update) {
if (update?.available) { // console.log(update);
setUpdateInfo(update); setUpdateInfo(update);
setUpdateDialog(true); setUpdateDialog(true);
@@ -37,95 +38,281 @@ export default function Updater() {
checkForUpdates(); checkForUpdates();
}, []); }, []);
const { enqueueSnackbar } = useSnackbar(); const { enqueueSnackbar } = useSnackbar();
const [downloadProgress, setDownloadProgress] = useState(0);
const [downloadSize, setDownloadSize] = useState(0);
const handleUpdate = useCallback(async () => {
try {
setUpdateDialogButton(true);
await updateInfo?.downloadAndInstall((e) => {
switch (e.event) {
case "Started":
setDownloadSize(e.data.contentLength ?? 0);
break;
case "Progress":
setDownloadProgress((s) => s + e.data.chunkLength);
break;
case "Finished":
setDownloadProgress(downloadSize);
break;
}
});
enqueueSnackbar(
"Update has been installed! You need to relaunch Blink.",
{
variant: "success",
},
);
await relaunch();
} catch (error) {
console.error(error);
enqueueSnackbar(`Failed to update Blink. ${error}`, { variant: "error" });
}
setUpdateDialogButton(false);
}, [enqueueSnackbar, updateInfo, downloadSize]);
if (!updateInfo) return null; if (!updateInfo) return null;
return ( return (
<Dialog <Dialog
open={updateDialog} open={updateDialog}
maxWidth="xs" maxWidth="xs"
PaperProps={{ fullWidth
style: { slotProps={{
borderRadius: "20px", paper: {
},
className: "glass", className: "glass",
}} style: {
sx={{ borderRadius: "24px",
"& img": { overflow: "hidden",
width: "100%", },
},
backdrop: {
style: {
backdropFilter: "blur(5px)",
backgroundColor: "rgba(0, 0, 0, 0.5)",
},
}, },
}} }}
> >
<DialogTitle variant="h5" align="center" textAlign={"center"}> <Box
Update Available! sx={{
</DialogTitle> position: "absolute",
top: 0,
left: 0,
right: 0,
height: "140px",
opacity: 0.5,
background: (theme) =>
`linear-gradient(135deg, ${theme.palette.primary.main} 0%, ${theme.palette.secondary.main} 100%)`,
zIndex: 0,
filter: "blur(40px)",
transform: "translateY(-50%) scale(1.5)",
}}
/>
<DialogContent <DialogContent
className="flex flex-center" sx={{ position: "relative", zIndex: 1, pt: 5, pb: 3, px: 3 }}
style={{ gap: "0.5em", padding: "0 2em 1em 2em", flexWrap: "wrap" }}
> >
<Chip <Stack alignItems="center" spacing={3}>
icon={<span className="material-symbols-rounded">update</span>} <Box
label={`v${updateInfo.currentVersion}`} sx={{
variant="outlined" width: 72,
/> height: 72,
<span className="material-symbols-rounded">arrow_right_alt</span> borderRadius: "50%",
<Chip display: "flex",
icon={<span className="material-symbols-rounded">update</span>} alignItems: "center",
label={`v${updateInfo.version}`} justifyContent: "center",
variant="outlined" background: (theme) =>
/> `linear-gradient(135deg, ${theme.palette.primary.main} 0%, ${theme.palette.secondary.main} 100%)`,
<DialogContentText sx={{ width: "100%" }}> boxShadow: (theme) =>
<Link `0 10px 25px -5px ${theme.palette.primary.main}80`,
href={`https://github.com/prayag17/Blink/releases/v${updateInfo.version}`} mb: 1,
target="_blank" }}
> >
Open changelog <span
</Link> className="material-symbols-rounded"
</DialogContentText> style={{ fontSize: "36px", color: "white" }}
>
rocket_launch
</span>
</Box>
<Stack spacing={1} textAlign="center">
<Typography
variant="h5"
fontWeight="900"
sx={{
background: (theme) =>
`linear-gradient(135deg, ${theme.palette.primary.light} 0%, ${theme.palette.secondary.light} 100%)`,
backgroundClip: "text",
WebkitBackgroundClip: "text",
color: "transparent",
}}
>
Update Available
</Typography>
<Typography
variant="body2"
color="text.secondary"
sx={{ maxWidth: "25ch" }}
>
A new version of Blink is ready for you.
</Typography>
</Stack>
<Stack
direction="row"
alignItems="center"
justifyContent="space-between"
sx={{
width: "100%",
bgcolor: "rgba(255,255,255,0.03)",
borderRadius: 4,
p: 2.5,
border: "1px solid rgba(255,255,255,0.05)",
}}
>
<Stack>
<Typography
variant="caption"
color="text.secondary"
sx={{ mb: 0.5 }}
>
Current
</Typography>
<Typography variant="subtitle1" fontWeight="bold">
v{updateInfo.currentVersion}
</Typography>
</Stack>
<Box
sx={{
display: "flex",
alignItems: "center",
justifyContent: "center",
width: 32,
height: 32,
borderRadius: "50%",
bgcolor: "rgba(255,255,255,0.05)",
}}
>
<span
className="material-symbols-rounded"
style={{
fontSize: "16px",
color: "rgba(255,255,255,0.5)",
}}
>
arrow_forward
</span>
</Box>
<Stack alignItems="flex-end">
<Typography
variant="caption"
color="primary.main"
sx={{ mb: 0.5 }}
>
New Version
</Typography>
<Typography
variant="subtitle1"
fontWeight="bold"
color="primary.main"
>
v{updateInfo.version}
</Typography>
</Stack>
</Stack>
<Button
onClick={() =>
open(
`https://github.com/prayag17/Blink/releases/v${updateInfo.version}`,
)
}
size="small"
sx={{
textTransform: "none",
cursor: "pointer",
color: "text.secondary",
borderRadius: "100px",
px: 2,
"&:hover": {
color: "primary.main",
bgcolor: "rgba(255,255,255,0.05)",
},
}}
endIcon={
<span
className="material-symbols-rounded"
style={{ fontSize: 16 }}
>
open_in_new
</span>
}
>
See what's new
</Button>
</Stack>
</DialogContent> </DialogContent>
<DialogActions <DialogActions
style={{ sx={{
padding: "1em", p: 3,
pt: 0,
justifyContent: "space-between",
gap: 1.5,
}} }}
className="flex flex-center"
> >
{/* <Button
variant="outlined"
//@ts-ignore
color="white"
disabled={updateDialogButton}
onClick={() => setUpdateDialog(false)}
>
changelog
</Button> */}
<Button <Button
color="error" color="inherit"
variant="contained" size="large"
disabled={updateDialogButton}
onClick={() => setUpdateDialog(false)} onClick={() => setUpdateDialog(false)}
style={{ borderRadius: "10px" }} sx={{
disableElevation borderRadius: "14px",
flex: 1,
color: "text.secondary",
height: 48,
"&:hover": {
bgcolor: "rgba(255,255,255,0.05)",
color: "text.primary",
},
}}
> >
close Later
</Button> </Button>
<LoadingButton <Button
style={{ borderRadius: "10px" }} size="large"
color="success"
variant="contained" variant="contained"
loading={updateDialogButton} loading={updateDialogButton}
loadingIndicator="Updating..." loadingIndicator={
<CircularProgress
size={24}
color="inherit"
value={downloadProgress / downloadSize}
/>
}
disableElevation disableElevation
onClick={async () => { onClick={handleUpdate}
setUpdateDialogButton(true); sx={{
await updateInfo.downloadAndInstall(); borderRadius: "14px",
enqueueSnackbar("Update has been installed! You need to relaunch Blink.", { flex: 1,
variant: "success", height: 48,
}); background: (theme) =>
await relaunch(); `linear-gradient(135deg, ${theme.palette.primary.main} 0%, ${theme.palette.secondary.main} 100%)`,
boxShadow: (theme) =>
`0 8px 20px -5px ${theme.palette.primary.main}60`,
"&:hover": {
background: (theme) =>
`linear-gradient(135deg, ${theme.palette.primary.main} 0%, ${theme.palette.secondary.main} 100%)`,
opacity: 0.9,
boxShadow: (theme) =>
`0 12px 25px -5px ${theme.palette.primary.main}80`,
},
}} }}
> >
Update Update
</LoadingButton> </Button>
</DialogActions> </DialogActions>
</Dialog> </Dialog>
); );
+4 -19
View File
@@ -17,10 +17,6 @@ import React, {
import { delUser } from "@/utils/storage/user"; import { delUser } from "@/utils/storage/user";
import { useApiInContext } from "@/utils/store/api"; import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central"; import { useCentralStore } from "@/utils/store/central";
import {
setSettingsDialogOpen,
setSettingsTabValue,
} from "@/utils/store/settings";
export const UserAvatarMenu = () => { export const UserAvatarMenu = () => {
const api = useApiInContext((s) => s.api); const api = useApiInContext((s) => s.api);
@@ -91,6 +87,7 @@ export const UserAvatarMenu = () => {
onClose={handleMenuClose} onClose={handleMenuClose}
sx={menuStyle} sx={menuStyle}
disableScrollLock disableScrollLock
PaperProps={{ className: "glass" }}
> >
<MenuItem <MenuItem
onClick={() => { onClick={() => {
@@ -99,23 +96,11 @@ export const UserAvatarMenu = () => {
}} }}
> >
<ListItemIcon> <ListItemIcon>
<div className="material-symbols-rounded">logout</div> <span className="material-symbols-rounded">logout</span>
</ListItemIcon> </ListItemIcon>
Logout Logout
</MenuItem> </MenuItem>
<Divider /> <Divider />
<MenuItem
onClick={() => {
setSettingsDialogOpen(true);
setSettingsTabValue(1);
handleMenuClose();
}}
>
<ListItemIcon>
<div className="material-symbols-rounded">settings</div>
</ListItemIcon>
Settings
</MenuItem>
<MenuItem <MenuItem
onClick={() => { onClick={() => {
navigate({ to: "/settings/preferences" }); navigate({ to: "/settings/preferences" });
@@ -123,7 +108,7 @@ export const UserAvatarMenu = () => {
}} }}
> >
<ListItemIcon> <ListItemIcon>
<div className="material-symbols-rounded">tune</div> <span className="material-symbols-rounded">tune</span>
</ListItemIcon> </ListItemIcon>
Preferences Preferences
</MenuItem> </MenuItem>
@@ -134,7 +119,7 @@ export const UserAvatarMenu = () => {
}} }}
> >
<ListItemIcon> <ListItemIcon>
<div className="material-symbols-rounded">info</div> <span className="material-symbols-rounded">info</span>
</ListItemIcon> </ListItemIcon>
About About
</MenuItem> </MenuItem>
+18 -6
View File
@@ -4,10 +4,14 @@ import React, { useEffect } from "react";
import ReactDOM from "react-dom/client"; import ReactDOM from "react-dom/client";
// Import the generated route tree // Import the generated route tree
import { routeTree } from "./routeTree.gen"; import { routeTree } from "./routeTree.gen";
import { ApiProvider, useApiInContext } from "./utils/store/api"; import {
ApiProvider,
initializeApi,
useApiInContext,
} from "./utils/store/api";
import { CentralProvider, useCentralStore } from "./utils/store/central"; import { CentralProvider, useCentralStore } from "./utils/store/central";
export const queryClient = new QueryClient({ const queryClient = new QueryClient({
defaultOptions: { defaultOptions: {
queries: { queries: {
networkMode: "always", networkMode: "always",
@@ -61,9 +65,11 @@ function ProviderWrapper() {
s.currentUser, s.currentUser,
s.fetchCurrentUser, s.fetchCurrentUser,
]); ]);
useEffect(() => {
if (api?.accessToken && !user?.Id) { if (api?.accessToken && !user?.Id) {
fetchCurrentUser(api); fetchCurrentUser(api);
} }
}, [api, user, fetchCurrentUser]);
useEffect(() => { useEffect(() => {
if (api) { if (api) {
console.log(`API is set - Route ${window.location.pathname}`); console.log(`API is set - Route ${window.location.pathname}`);
@@ -72,7 +78,7 @@ function ProviderWrapper() {
console.log(`API is not set - Route ${window.location.pathname}`); console.log(`API is not set - Route ${window.location.pathname}`);
} }
router.invalidate(); // This is a hack to force the router to re-evaluate the routes and re-run the beforeLoad functions router.invalidate(); // This is a hack to force the router to re-evaluate the routes and re-run the beforeLoad functions
}, [api]); }, [api?.accessToken]);
return ( return (
<RouterProvider <RouterProvider
router={router} router={router}
@@ -88,16 +94,22 @@ function ProviderWrapper() {
); );
} }
ReactDOM.createRoot(document.getElementById("root")!).render( const init = async () => {
const initialApi = await initializeApi();
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode> <React.StrictMode>
<QueryClientProvider client={queryClient}> <QueryClientProvider client={queryClient}>
<CentralProvider> <CentralProvider>
<ApiProvider> <ApiProvider initialApi={initialApi}>
<ProviderWrapper /> <ProviderWrapper />
</ApiProvider> </ApiProvider>
</CentralProvider> </CentralProvider>
</QueryClientProvider> </QueryClientProvider>
</React.StrictMode>, </React.StrictMode>,
); );
};
init();
document.querySelector(".app-loading")!.classList.toggle("hidden"); document.querySelector(".app-loading")!.classList.toggle("hidden");
+35 -13
View File
@@ -36,6 +36,7 @@ import { Route as ApiEpisodeIdRouteImport } from './routes/_api/episode/$id'
import { Route as ApiBoxsetIdRouteImport } from './routes/_api/boxset/$id' import { Route as ApiBoxsetIdRouteImport } from './routes/_api/boxset/$id'
import { Route as ApiArtistIdRouteImport } from './routes/_api/artist/$id' import { Route as ApiArtistIdRouteImport } from './routes/_api/artist/$id'
import { Route as ApiAlbumIdRouteImport } from './routes/_api/album/$id' import { Route as ApiAlbumIdRouteImport } from './routes/_api/album/$id'
import { Route as ApiSettingsChangeServerIndexRouteImport } from './routes/_api/settings/changeServer/index'
import { Route as ApiLoginUserIdUserNameRouteImport } from './routes/_api/login/$userId.$userName' import { Route as ApiLoginUserIdUserNameRouteImport } from './routes/_api/login/$userId.$userName'
const ApiRoute = ApiRouteImport.update({ const ApiRoute = ApiRouteImport.update({
@@ -172,6 +173,12 @@ const ApiAlbumIdRoute = ApiAlbumIdRouteImport.update({
path: '/album/$id', path: '/album/$id',
getParentRoute: () => ApiRoute, getParentRoute: () => ApiRoute,
} as any) } as any)
const ApiSettingsChangeServerIndexRoute =
ApiSettingsChangeServerIndexRouteImport.update({
id: '/changeServer/',
path: '/changeServer/',
getParentRoute: () => ApiSettingsRoute,
} as any)
const ApiLoginUserIdUserNameRoute = ApiLoginUserIdUserNameRouteImport.update({ const ApiLoginUserIdUserNameRoute = ApiLoginUserIdUserNameRouteImport.update({
id: '/$userId/$userName', id: '/$userId/$userName',
path: '/$userId/$userName', path: '/$userId/$userName',
@@ -201,11 +208,12 @@ export interface FileRoutesByFullPath {
'/setup/server/add': typeof SetupServerAddRoute '/setup/server/add': typeof SetupServerAddRoute
'/setup/server/error': typeof SetupServerErrorRoute '/setup/server/error': typeof SetupServerErrorRoute
'/setup/server/list': typeof SetupServerListRoute '/setup/server/list': typeof SetupServerListRoute
'/favorite': typeof ApiFavoriteIndexRoute '/favorite/': typeof ApiFavoriteIndexRoute
'/home': typeof ApiHomeIndexRoute '/home/': typeof ApiHomeIndexRoute
'/player': typeof ApiPlayerIndexRoute '/player/': typeof ApiPlayerIndexRoute
'/search': typeof ApiSearchIndexRoute '/search/': typeof ApiSearchIndexRoute
'/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute '/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
'/settings/changeServer/': typeof ApiSettingsChangeServerIndexRoute
} }
export interface FileRoutesByTo { export interface FileRoutesByTo {
'/': typeof IndexRoute '/': typeof IndexRoute
@@ -235,6 +243,7 @@ export interface FileRoutesByTo {
'/player': typeof ApiPlayerIndexRoute '/player': typeof ApiPlayerIndexRoute
'/search': typeof ApiSearchIndexRoute '/search': typeof ApiSearchIndexRoute
'/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute '/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
'/settings/changeServer': typeof ApiSettingsChangeServerIndexRoute
} }
export interface FileRoutesById { export interface FileRoutesById {
__root__: typeof rootRouteImport __root__: typeof rootRouteImport
@@ -266,6 +275,7 @@ export interface FileRoutesById {
'/_api/player/': typeof ApiPlayerIndexRoute '/_api/player/': typeof ApiPlayerIndexRoute
'/_api/search/': typeof ApiSearchIndexRoute '/_api/search/': typeof ApiSearchIndexRoute
'/_api/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute '/_api/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
'/_api/settings/changeServer/': typeof ApiSettingsChangeServerIndexRoute
} }
export interface FileRouteTypes { export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath fileRoutesByFullPath: FileRoutesByFullPath
@@ -292,11 +302,12 @@ export interface FileRouteTypes {
| '/setup/server/add' | '/setup/server/add'
| '/setup/server/error' | '/setup/server/error'
| '/setup/server/list' | '/setup/server/list'
| '/favorite' | '/favorite/'
| '/home' | '/home/'
| '/player' | '/player/'
| '/search' | '/search/'
| '/login/$userId/$userName' | '/login/$userId/$userName'
| '/settings/changeServer/'
fileRoutesByTo: FileRoutesByTo fileRoutesByTo: FileRoutesByTo
to: to:
| '/' | '/'
@@ -326,6 +337,7 @@ export interface FileRouteTypes {
| '/player' | '/player'
| '/search' | '/search'
| '/login/$userId/$userName' | '/login/$userId/$userName'
| '/settings/changeServer'
id: id:
| '__root__' | '__root__'
| '/' | '/'
@@ -356,6 +368,7 @@ export interface FileRouteTypes {
| '/_api/player/' | '/_api/player/'
| '/_api/search/' | '/_api/search/'
| '/_api/login/$userId/$userName' | '/_api/login/$userId/$userName'
| '/_api/settings/changeServer/'
fileRoutesById: FileRoutesById fileRoutesById: FileRoutesById
} }
export interface RootRouteChildren { export interface RootRouteChildren {
@@ -372,7 +385,7 @@ declare module '@tanstack/react-router' {
'/_api': { '/_api': {
id: '/_api' id: '/_api'
path: '' path: ''
fullPath: '' fullPath: '/'
preLoaderRoute: typeof ApiRouteImport preLoaderRoute: typeof ApiRouteImport
parentRoute: typeof rootRouteImport parentRoute: typeof rootRouteImport
} }
@@ -407,28 +420,28 @@ declare module '@tanstack/react-router' {
'/_api/search/': { '/_api/search/': {
id: '/_api/search/' id: '/_api/search/'
path: '/search' path: '/search'
fullPath: '/search' fullPath: '/search/'
preLoaderRoute: typeof ApiSearchIndexRouteImport preLoaderRoute: typeof ApiSearchIndexRouteImport
parentRoute: typeof ApiRoute parentRoute: typeof ApiRoute
} }
'/_api/player/': { '/_api/player/': {
id: '/_api/player/' id: '/_api/player/'
path: '/player' path: '/player'
fullPath: '/player' fullPath: '/player/'
preLoaderRoute: typeof ApiPlayerIndexRouteImport preLoaderRoute: typeof ApiPlayerIndexRouteImport
parentRoute: typeof ApiRoute parentRoute: typeof ApiRoute
} }
'/_api/home/': { '/_api/home/': {
id: '/_api/home/' id: '/_api/home/'
path: '/home' path: '/home'
fullPath: '/home' fullPath: '/home/'
preLoaderRoute: typeof ApiHomeIndexRouteImport preLoaderRoute: typeof ApiHomeIndexRouteImport
parentRoute: typeof ApiRoute parentRoute: typeof ApiRoute
} }
'/_api/favorite/': { '/_api/favorite/': {
id: '/_api/favorite/' id: '/_api/favorite/'
path: '/favorite' path: '/favorite'
fullPath: '/favorite' fullPath: '/favorite/'
preLoaderRoute: typeof ApiFavoriteIndexRouteImport preLoaderRoute: typeof ApiFavoriteIndexRouteImport
parentRoute: typeof ApiRoute parentRoute: typeof ApiRoute
} }
@@ -558,6 +571,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof ApiAlbumIdRouteImport preLoaderRoute: typeof ApiAlbumIdRouteImport
parentRoute: typeof ApiRoute parentRoute: typeof ApiRoute
} }
'/_api/settings/changeServer/': {
id: '/_api/settings/changeServer/'
path: '/changeServer'
fullPath: '/settings/changeServer/'
preLoaderRoute: typeof ApiSettingsChangeServerIndexRouteImport
parentRoute: typeof ApiSettingsRoute
}
'/_api/login/$userId/$userName': { '/_api/login/$userId/$userName': {
id: '/_api/login/$userId/$userName' id: '/_api/login/$userId/$userName'
path: '/$userId/$userName' path: '/$userId/$userName'
@@ -587,11 +607,13 @@ const ApiLoginRouteWithChildren = ApiLoginRoute._addFileChildren(
interface ApiSettingsRouteChildren { interface ApiSettingsRouteChildren {
ApiSettingsAboutRoute: typeof ApiSettingsAboutRoute ApiSettingsAboutRoute: typeof ApiSettingsAboutRoute
ApiSettingsPreferencesRoute: typeof ApiSettingsPreferencesRoute ApiSettingsPreferencesRoute: typeof ApiSettingsPreferencesRoute
ApiSettingsChangeServerIndexRoute: typeof ApiSettingsChangeServerIndexRoute
} }
const ApiSettingsRouteChildren: ApiSettingsRouteChildren = { const ApiSettingsRouteChildren: ApiSettingsRouteChildren = {
ApiSettingsAboutRoute: ApiSettingsAboutRoute, ApiSettingsAboutRoute: ApiSettingsAboutRoute,
ApiSettingsPreferencesRoute: ApiSettingsPreferencesRoute, ApiSettingsPreferencesRoute: ApiSettingsPreferencesRoute,
ApiSettingsChangeServerIndexRoute: ApiSettingsChangeServerIndexRoute,
} }
const ApiSettingsRouteWithChildren = ApiSettingsRoute._addFileChildren( const ApiSettingsRouteWithChildren = ApiSettingsRoute._addFileChildren(
+2 -2
View File
@@ -7,7 +7,6 @@ import React from "react";
import { AppBar } from "@/components/appBar/appBar"; import { AppBar } from "@/components/appBar/appBar";
// import NProgress from "@/components/nProgress"; // import NProgress from "@/components/nProgress";
import AudioPlayer from "@/components/playback/audioPlayer"; import AudioPlayer from "@/components/playback/audioPlayer";
import Settings from "@/components/settings";
import "../styles/global.scss"; import "../styles/global.scss";
import { theme } from "@/theme"; import { theme } from "@/theme";
@@ -29,6 +28,7 @@ import { HTML5Backend } from "react-dnd-html5-backend";
import Backdrop from "@/components/backdrop"; import Backdrop from "@/components/backdrop";
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice"; import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
import RouterLoading from "@/components/routerLoading"; import RouterLoading from "@/components/routerLoading";
import Search from "@/components/search";
import Updater from "@/components/updater"; import Updater from "@/components/updater";
import { EasterEgg } from "@/components/utils/easterEgg"; import { EasterEgg } from "@/components/utils/easterEgg";
@@ -48,7 +48,6 @@ export const Route = createRootRouteWithContext<ApiContext>()({
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<SnackbarProvider maxSnack={5}> <SnackbarProvider maxSnack={5}>
<CssBaseline /> <CssBaseline />
<Settings />
<EasterEgg /> <EasterEgg />
{/* <NProgress /> */} {/* <NProgress /> */}
@@ -56,6 +55,7 @@ export const Route = createRootRouteWithContext<ApiContext>()({
<Updater /> <Updater />
<Backdrop /> <Backdrop />
<Search />
<AppBar /> <AppBar />
<AudioPlayer /> <AudioPlayer />
<Outlet /> <Outlet />
+1 -162
View File
@@ -134,168 +134,7 @@ $border-radius: 20px;
} }
$cardWidth: 22%; $cardWidth: 22%;
.item-album.item { .item-album.item {
.item-hero {
height: 50vh;
gap: 2em;
position: relative;
align-items: center;
&-image {
opacity: 0;
width: 100%;
object-fit: contain;
transition: opacity $transition-time-default;
&-container {
height: fit-content;
max-height: 100%;
overflow: hidden;
border-radius: $border-radius-default;
box-shadow: $shadow-card;
flex-grow: 1;
flex-shrink: 0;
position: relative;
}
&-blurhash {
position: absolute !important;
width: 100% !important;
height: 100% !important;
z-index: -1;
}
}
&-logo {
max-width: 42rem;
max-height: 10rem;
opacity: 0;
transition: opacity $transition-time-default;
object-position: bottom;
}
&-detail {
width: 100%;
align-items: flex-start;
gap: 1em;
justify-content: end;
}
&-buttons {
&-container {
align-items: center;
justify-content: space-between;
width: 100%;
}
}
&-backdrop {
width: 100vw;
height: 100vh;
object-fit: cover;
object-position: top;
opacity: 0;
transition: opacity $transition-time-default;
&-container {
filter: brightness(0.8);
position: absolute;
top: -4.4em;
left: -$page-margin;
width: 100vw;
height: calc(50vh + 4.4em);
z-index: -1;
mask-image: linear-gradient(to top, transparent, black);
-webkit-mask-image: linear-gradient(to top,
transparent,
black);
}
}
}
.item-hero {
height: 60vh;
gap: 2em;
row-gap: 1.2em;
position: relative;
align-items: flex-end;
margin-bottom: 1em;
display: grid;
grid-template-columns: $cardWidth 1fr;
grid-template-rows: 1fr auto;
&-image {
opacity: 0;
width: 100%;
object-fit: contain;
transition: opacity $transition-time-default;
&-container {
height: fit-content;
max-height: 100%;
overflow: hidden;
border-radius: $border-radius-default;
box-shadow: $shadow-card;
flex-grow: 1;
flex-shrink: 0;
position: relative;
width: 100%;
}
&-blurhash {
position: absolute !important;
width: 100% !important;
height: 100% !important;
z-index: -1;
}
&-icon {
background: linear-gradient(45deg, rgb(255 255 255 / 0.05), rgb(255 255 255 / 0.15));
height: 100%;
display: flex;
align-items: center;
justify-content: center;
.material-symbols-rounded {
font-size: 4em;
}
}
}
&-logo {
max-width: 34rem;
max-height: 10rem;
opacity: 0;
transition: opacity $transition-time-default;
object-position: bottom;
margin-bottom: 2em;
}
&-detail {
width: 100%;
align-items: flex-start;
gap: 0.2em;
justify-content: end;
}
&-buttons {
&-container {
align-items: center;
justify-content: space-between;
width: 100%;
grid-column: 1/3;
display: grid;
grid-template-columns: inherit;
gap: 2em;
}
}
&-backdrop {
width: 100vw;
height: 100vh;
object-fit: cover;
object-position: top;
opacity: 0;
transition: opacity $transition-time-default;
&-container {
filter: brightness(0.8);
position: absolute;
top: -4.4em;
left: -$page-margin;
width: 100vw;
height: calc(54vh + 4.4em);
z-index: -1;
mask-image: linear-gradient(to top, transparent, black);
-webkit-mask-image: linear-gradient(to top,
transparent,
black);
}
}
& .play-button {
width: 100% !important;
}
}
.item-detail { .item-detail {
display: grid; display: grid;
grid-template-columns: 1fr 35%; grid-template-columns: 1fr 35%;
-95
View File
@@ -2,101 +2,6 @@ $cardWidth: 22%;
.item-artist.item { .item-artist.item {
gap: 1em; gap: 1em;
.item-hero {
height: 60vh;
gap: 2em;
row-gap: 1.2em;
position: relative;
align-items: flex-end;
margin-bottom: 1em;
display: grid;
grid-template-columns: $cardWidth 1fr;
grid-template-rows: 1fr auto;
&-image {
opacity: 0;
width: 100%;
object-fit: contain;
transition: opacity $transition-time-default;
&-container {
height: fit-content;
max-height: 100%;
overflow: hidden;
border-radius: $border-radius-default;
box-shadow: $shadow-card;
flex-grow: 1;
flex-shrink: 0;
position: relative;
width: 100%;
}
&-blurhash {
position: absolute !important;
width: 100% !important;
height: 100% !important;
z-index: -1;
}
&-icon {
background: linear-gradient(45deg, rgb(255 255 255 / 0.05), rgb(255 255 255 / 0.15));
height: 100%;
display: flex;
align-items: center;
justify-content: center;
.material-symbols-rounded{
font-size: 4em;
}
}
}
&-logo {
max-width: 34rem;
max-height: 10rem;
opacity: 0;
transition: opacity $transition-time-default;
object-position: bottom;
margin-bottom: 2em;
}
&-detail {
width: 100%;
align-items: flex-start;
gap: 0.2em;
justify-content: end;
}
&-buttons {
&-container {
align-items: center;
justify-content: space-between;
width: 100%;
grid-column: 1/3;
display: grid;
grid-template-columns: inherit;
gap: 2em;
}
}
&-backdrop {
width: 100vw;
height: 100vh;
object-fit: cover;
object-position: top;
opacity: 0;
transition: opacity $transition-time-default;
&-container {
filter: brightness(0.8);
position: absolute;
top: -4.4em;
left: -$page-margin;
width: 100vw;
height: calc(54vh + 4.4em);
z-index: -1;
mask-image: linear-gradient(to top, transparent, black);
-webkit-mask-image: linear-gradient(
to top,
transparent,
black
);
}
}
& .play-button {
width: 100% !important;
}
}
.item-detail { .item-detail {
display: grid; display: grid;
-3
View File
@@ -147,9 +147,6 @@ function BoxSetTitlePage() {
<PlayButton <PlayButton
item={item.data} item={item.data}
itemType={item.data.Type ?? "BoxSet"} itemType={item.data.Type ?? "BoxSet"}
currentVideoTrack={0}
currentAudioTrack={0}
currentSubTrack={0}
userId={user?.Id} userId={user?.Id}
buttonProps={{ buttonProps={{
fullWidth: true, fullWidth: true,
-95
View File
@@ -1,101 +1,6 @@
$cardWidth: 18%; $cardWidth: 18%;
.item-boxset.item { .item-boxset.item {
gap: 1em; gap: 1em;
.item-hero {
height: 60vh;
gap: 2em;
row-gap: 1.2em;
position: relative;
align-items: flex-end;
margin-bottom: 1em;
display: grid;
grid-template-columns: $cardWidth 1fr;
grid-template-rows: 1fr auto;
&-image {
opacity: 0;
width: 100%;
object-fit: contain;
transition: opacity $transition-time-default;
&-container {
height: fit-content;
max-height: 100%;
overflow: hidden;
border-radius: $border-radius-default;
box-shadow: $shadow-card;
flex-grow: 1;
flex-shrink: 0;
position: relative;
width: 100%;
}
&-blurhash {
position: absolute !important;
width: 100% !important;
height: 100% !important;
z-index: -1;
}
&-icon {
background: linear-gradient(45deg, rgb(255 255 255 / 0.05), rgb(255 255 255 / 0.15));
height: 100%;
display: flex;
align-items: center;
justify-content: center;
.material-symbols-rounded{
font-size: 4em;
}
}
}
&-logo {
max-width: 34rem;
max-height: 10rem;
opacity: 0;
transition: opacity $transition-time-default;
object-position: bottom;
margin-bottom: 2em;
}
&-detail {
width: 100%;
align-items: flex-start;
gap: 0.2em;
justify-content: end;
}
&-buttons {
&-container {
align-items: center;
justify-content: space-between;
width: 100%;
grid-column: 1/3;
display: grid;
grid-template-columns: inherit;
gap: 2em;
}
}
&-backdrop {
width: 100vw;
height: 100vh;
object-fit: cover;
object-position: top;
opacity: 0;
transition: opacity $transition-time-default;
&-container {
filter: brightness(0.8);
position: absolute;
top: -4.4em;
left: -$page-margin;
width: 100vw;
height: calc(54vh + 4.4em);
z-index: -1;
mask-image: linear-gradient(to top, transparent, black);
-webkit-mask-image: linear-gradient(
to top,
transparent,
black
);
}
}
& .play-button {
width: 100% !important;
}
}
.item-detail { .item-detail {
display: grid; display: grid;
-94
View File
@@ -1,100 +1,6 @@
$cardWidth: 30%; $cardWidth: 30%;
.item-episode.item { .item-episode.item {
gap: 1em; gap: 1em;
.item-hero {
height: 55vh;
gap: 2em;
row-gap: 1.2em;
position: relative;
align-items: flex-end;
margin-bottom: 1em;
display: grid;
grid-template-columns: $cardWidth 1fr;
grid-template-rows: 1fr auto;
&-image {
opacity: 0;
width: 100%;
object-fit: contain;
transition: opacity $transition-time-default;
&-container {
height: fit-content;
max-height: 100%;
overflow: hidden;
border-radius: $border-radius-default;
box-shadow: $shadow-card;
flex-grow: 1;
flex-shrink: 0;
position: relative;
width: 100%;
}
&-blurhash {
position: absolute !important;
width: 100% !important;
height: 100% !important;
z-index: -1;
}
&-icon {
background: linear-gradient(45deg, rgb(255 255 255 / 0.05), rgb(255 255 255 / 0.15));
height: 100%;
display: flex;
align-items: center;
justify-content: center;
.material-symbols-rounded{
font-size: 4em;
}
}
}
&-logo {
max-width: 34rem;
max-height: 10rem;
opacity: 0;
transition: opacity $transition-time-default;
object-position: bottom;
}
&-detail {
width: 100%;
align-items: flex-start;
gap: 0.2em;
justify-content: end;
}
&-buttons {
&-container {
align-items: center;
justify-content: space-between;
width: 100%;
grid-column: 1/3;
display: grid;
grid-template-columns: inherit;
gap: 2em;
}
}
&-backdrop {
width: 100vw;
height: 100vh;
object-fit: cover;
object-position: top;
opacity: 0;
transition: opacity $transition-time-default;
&-container {
filter: brightness(0.8);
position: absolute;
top: -4.4em;
left: -$page-margin;
width: 100vw;
height: calc(49vh + 4.4em);
z-index: -1;
mask-image: linear-gradient(to top, transparent, black);
-webkit-mask-image: linear-gradient(
to top,
transparent,
black
);
}
}
& .play-button {
width: 100% !important;
}
}
.item-detail { .item-detail {
display: grid; display: grid;
+140
View File
@@ -0,0 +1,140 @@
@use "@/styles/variables.scss" as *;
.favorite-page {
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
overflow-y: auto;
padding-bottom: 2em;
.favorite-header {
padding: 2em 2em 0 2em;
display: flex;
flex-direction: column;
gap: 0.5em;
position: relative;
z-index: 2;
.header-content {
display: flex;
align-items: flex-end;
justify-content: space-between;
h1 {
font-size: 2.2rem;
font-weight: 600;
margin: 0;
color: rgba(255, 255, 255, 0.95);
letter-spacing: -0.02em;
}
}
.MuiTabs-root {
min-height: 40px;
margin-left: -12px;
margin-top: 1em;
.MuiTabs-indicator {
display: none; // Hide default indicator
}
.MuiTabs-scroller {
overflow: visible !important; // Allow shadows/glows to show
}
.MuiTab-root {
text-transform: none;
font-size: 0.9rem;
font-weight: 500;
color: rgba(255, 255, 255, 0.6);
padding: 8px 20px;
min-height: 36px;
min-width: fit-content;
border-radius: 100px;
margin-right: 8px;
transition: all $transition-time-fast ease;
background-color: transparent;
border: 1px solid rgba(255, 255, 255, 0.1);
&:first-of-type {
margin-left: 12px;
}
&:hover {
color: rgba(255, 255, 255, 0.9);
background-color: rgba(255, 255, 255, 0.05);
border-color: rgba(255, 255, 255, 0.2);
}
&.Mui-selected {
color: #fff;
font-weight: 600;
background-color: $clr-accent-default;
border-color: $clr-accent-default;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
}
}
}
.favorite-content {
padding: 0.5em 0;
flex: 1;
// For Overview (Scrollers)
.overview-section {
padding: 0 2em; // Align with header
display: flex;
flex-direction: column;
gap: 1.5em;
// Override card scroller buttons to fit the new padding
.card-scroller-button {
width: 2em !important;
&.left {
left: -2em !important;
border-radius: 4px !important;
}
&.right {
right: -2em !important;
border-radius: 4px !important;
}
.material-symbols-rounded {
font-size: 2em;
}
}
}
// For Grid Views
.grid-section {
padding: 1em 2em;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
gap: 1em;
// Adjust for different card types if needed
&.grid-landscape {
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
}
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 300px;
color: rgba(255, 255, 255, 0.4);
h3 {
margin-top: 1em;
font-weight: 400;
}
}
}
}
+170 -88
View File
@@ -1,16 +1,19 @@
import React, { useEffect } from "react";
import { useBackdropStore } from "@/utils/store/backdrop";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
import React, { type SyntheticEvent, useEffect, useState } from "react";
import { useBackdropStore } from "@/utils/store/backdrop";
import "./favorite.scss"; import "./favorite.scss";
import {
type BaseItemDto,
BaseItemKind,
} from "@jellyfin/sdk/lib/generated-client";
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
import { Fade, Tab, Tabs, Typography } from "@mui/material";
import { createFileRoute } from "@tanstack/react-router";
import { useShallow } from "zustand/react/shallow";
import { Card } from "@/components/card/card"; import { Card } from "@/components/card/card";
import CardScroller from "@/components/cardScroller/cardScroller"; import CardScroller from "@/components/cardScroller/cardScroller";
import { useCentralStore } from "@/utils/store/central"; import { useCentralStore } from "@/utils/store/central";
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/_api/favorite/")({ export const Route = createFileRoute("/_api/favorite/")({
component: FavoritePage, component: FavoritePage,
@@ -18,7 +21,10 @@ export const Route = createFileRoute("/_api/favorite/")({
function FavoritePage() { function FavoritePage() {
const api = Route.useRouteContext().api; const api = Route.useRouteContext().api;
const [setBackdrop] = useBackdropStore((state) => [state.setBackdrop]); const [setBackdrop] = useBackdropStore(
useShallow((state) => [state.setBackdrop]),
);
const [tabValue, setTabValue] = useState("overview");
const user = useCentralStore((s) => s.currentUser); const user = useCentralStore((s) => s.currentUser);
@@ -30,6 +36,7 @@ function FavoritePage() {
userId: user?.Id, userId: user?.Id,
isFavorite: true, isFavorite: true,
includeItemTypes: [BaseItemKind.Movie], includeItemTypes: [BaseItemKind.Movie],
enableImages: true,
recursive: true, recursive: true,
}); });
return result.data; return result.data;
@@ -121,23 +128,33 @@ function FavoritePage() {
}); });
useEffect(() => { useEffect(() => {
setBackdrop("", ""); // Set a backdrop from one of the favorites if available?
}); // For now, clear it or maybe pick random from movies
if (movies.data?.Items && movies.data.Items.length > 0) {
const randomMovie =
movies.data.Items[Math.floor(Math.random() * movies.data.Items.length)];
if (randomMovie.BackdropImageTags?.[0]) {
setBackdrop(
randomMovie.ImageBlurHashes?.Backdrop?.[
randomMovie.BackdropImageTags[0]
] || "",
);
}
} else {
setBackdrop("");
}
}, [movies.data, setBackdrop]);
return ( const handleTabChange = (_event: SyntheticEvent, newValue: string) => {
<div setTabValue(newValue);
className="scrollY" };
style={{
display: "flex", const sections = [
flexDirection: "column", {
gap: "0.5em", id: "movies",
paddingBottom: "2em", title: "Movies",
paddingTop: "4.2em", query: movies,
}} renderCard: (item: BaseItemDto) => (
>
{movies.isSuccess && (movies.data?.Items?.length ?? 0) > 0 && (
<CardScroller displayCards={8} title="Movies">
{movies.data?.Items?.map((item) => (
<Card <Card
key={item.Id} key={item.Id}
item={item} item={item}
@@ -148,50 +165,30 @@ function FavoritePage() {
queryKey={["favorite", "movies"]} queryKey={["favorite", "movies"]}
userId={user?.Id} userId={user?.Id}
/> />
))} ),
</CardScroller> },
)} {
{series.isSuccess && (series.data?.Items?.length ?? 0) > 0 && ( id: "series",
<CardScroller title="TV Shows" displayCards={8} disableDecoration> title: "TV Shows",
{series.data?.Items?.map((item) => ( query: series,
renderCard: (item: BaseItemDto) => (
<Card <Card
key={item.Id} key={item.Id}
item={item} item={item}
cardTitle={item.Name} cardTitle={item.Name}
imageType={"Primary"} imageType={"Primary"}
cardCaption={`${item.ProductionYear} - ${ cardCaption={`${item.ProductionYear} - ${item.EndDate ? new Date(item.EndDate).getFullYear() : "Present"}`}
item.EndDate
? new Date(item.EndDate).toLocaleString([], {
year: "numeric",
})
: "Present"
}`}
cardType="portrait" cardType="portrait"
queryKey={["favorite", "series"]} queryKey={["favorite", "series"]}
userId={user?.Id} userId={user?.Id}
/> />
))} ),
</CardScroller> },
)} {
{audio.isSuccess && (audio.data?.Items?.length ?? 0) > 0 && ( id: "albums",
<CardScroller title="Audio" displayCards={8} disableDecoration> title: "Albums",
{audio.data?.Items?.map((item) => ( query: musicAlbum,
<Card renderCard: (item: BaseItemDto) => (
key={item.Id}
item={item}
cardTitle={item.Name}
imageType={"Primary"}
cardCaption={item.ProductionYear}
cardType="square"
queryKey={["favorite", "audio"]}
userId={user?.Id}
/>
))}
</CardScroller>
)}
{musicAlbum.isSuccess && (musicAlbum.data?.Items?.length ?? 0) > 0 && (
<CardScroller title="Albums" displayCards={8} disableDecoration>
{musicAlbum.data?.Items?.map((item) => (
<Card <Card
key={item.Id} key={item.Id}
item={item} item={item}
@@ -203,12 +200,47 @@ function FavoritePage() {
queryKey={["favorite", "musicAlbum"]} queryKey={["favorite", "musicAlbum"]}
userId={user?.Id} userId={user?.Id}
/> />
))} ),
</CardScroller> },
)} {
{book.isSuccess && (book.data?.Items?.length ?? 0) > 0 && ( id: "artists",
<CardScroller title="Books" displayCards={8} disableDecoration> title: "Artists",
{book.data?.Items?.map((item) => ( query: musicArtists,
renderCard: (item: BaseItemDto) => (
<Card
key={item.Id}
item={item}
cardTitle={item.Name}
imageType={"Primary"}
disableOverlay
cardType={"square"}
queryKey={["favorite", "musicArtist"]}
userId={user?.Id}
/>
),
},
{
id: "audio",
title: "Songs",
query: audio,
renderCard: (item: BaseItemDto) => (
<Card
key={item.Id}
item={item}
cardTitle={item.Name}
imageType={"Primary"}
cardCaption={item.ProductionYear}
cardType="square"
queryKey={["favorite", "audio"]}
userId={user?.Id}
/>
),
},
{
id: "books",
title: "Books",
query: book,
renderCard: (item: BaseItemDto) => (
<Card <Card
key={item.Id} key={item.Id}
item={item} item={item}
@@ -220,29 +252,13 @@ function FavoritePage() {
queryKey={["favorite", "book"]} queryKey={["favorite", "book"]}
userId={user?.Id} userId={user?.Id}
/> />
))} ),
</CardScroller> },
)} {
{musicArtists.isSuccess && id: "person",
(musicArtists.data?.Items?.length ?? 0) > 0 && ( title: "People",
<CardScroller title="Artists" displayCards={8} disableDecoration> query: person,
{musicArtists.data?.Items?.map((item) => ( renderCard: (item: BaseItemDto) => (
<Card
key={item.Id}
item={item}
cardTitle={item.Name}
imageType={"Primary"}
disableOverlay
cardType={"square"}
queryKey={["favorite", "musicArtist"]}
userId={user?.Id}
/>
))}
</CardScroller>
)}
{person.isSuccess && (person.data?.Items?.length ?? 0) > 0 && (
<CardScroller title="People" displayCards={8} disableDecoration>
{person.data?.Items?.map((item) => (
<Card <Card
key={item.Id} key={item.Id}
item={item} item={item}
@@ -253,10 +269,76 @@ function FavoritePage() {
queryKey={["favorite", "person"]} queryKey={["favorite", "person"]}
userId={user?.Id} userId={user?.Id}
/> />
),
},
];
const availableSections = sections.filter(
(s) => s.query.isSuccess && (s.query.data?.Items?.length ?? 0) > 0,
);
return (
<div className="favorite-page scrollY">
<div className="favorite-header">
<div className="header-content">
<Typography variant="h1" component="h1">
Your Favorites
</Typography>
</div>
<Tabs
value={tabValue}
onChange={handleTabChange}
variant="scrollable"
scrollButtons="auto"
aria-label="favorite sections"
>
<Tab label="Overview" value="overview" />
{availableSections.map((section) => (
<Tab key={section.id} label={section.title} value={section.id} />
))} ))}
</Tabs>
</div>
<div className="favorite-content">
{tabValue === "overview" && (
<Fade in={tabValue === "overview"}>
<div className="overview-section">
{availableSections.map((section) => (
<CardScroller
key={section.id}
title={section.title}
displayCards={7}
disableDecoration
>
{section.query.data?.Items?.map(section.renderCard)}
</CardScroller> </CardScroller>
))}
{availableSections.length === 0 && (
<div className="empty-state">
<Typography variant="h5">No favorites yet</Typography>
<Typography variant="body1">
Mark items as favorite to see them here.
</Typography>
</div>
)} )}
</div> </div>
</Fade>
)}
{availableSections.map(
(section) =>
tabValue === section.id && (
<Fade key={section.id} in={tabValue === section.id}>
<div
className={`grid-section ${["movies", "series", "books"].includes(section.id) ? "grid-landscape" : ""}`}
>
{section.query.data?.Items?.map(section.renderCard)}
</div>
</Fade>
),
)}
</div>
</div>
); );
} }
+82 -43
View File
@@ -1,39 +1,50 @@
.hero-carousel { .hero-carousel {
position: relative; position: relative;
overflow: hidden; overflow: visible;
isolation: isolate; isolation: isolate;
height: 100%;
width: 100%;
&-slide { &-slide {
position: relative; position: relative;
height: 100%; height: 100%;
width: 100%; width: 100%;
overflow: visible; overflow: hidden;
margin: 0 auto; margin: 0;
border: none; border: none;
// box-shadow: 0 0 30px black !important; border-radius: 20px;
grid-area: main;
border: 1.2px solid rgb(255 255 255 / 0.1);
box-shadow: 0 0 20px rgba(0,0,0,0.2);
} }
&-background { &-background {
&-blurhash {
width: 100%;
height: 100%;
position: absolute;
z-index: 1;
filter: brightness(0.4);
}
&-container { &-container {
position: absolute; position: absolute;
z-index: 0; z-index: 0;
top: -4.4em; top: 0;
left: 0; left: 0;
right: 0; right: 0;
height: 90vh; bottom: 0;
filter: brightness(0.8); height: 100%;
mask-image: linear-gradient(to left, black 50%, transparent), linear-gradient(to bottom, black 60%, transparent);
-webkit-mask-image: linear-gradient(to left, // Gradient overlay to make text readable
black 50%, &::after {
transparent), linear-gradient(to bottom, black 40%, transparent); content: "";
mask-composite: intersect; position: absolute;
inset: 0;
background: linear-gradient(
to top right,
rgba(0, 0, 0, 0.9) 0%,
rgba(0, 0, 0, 0.4) 50%,
transparent 100%
);
z-index: 2;
} }
}
&-image { &-image {
position: absolute; position: absolute;
background-size: cover; background-size: cover;
@@ -41,16 +52,16 @@
right: 0; right: 0;
top: 0; top: 0;
bottom: 0; bottom: 0;
left: 0;
background-position: center; background-position: center;
object-fit: cover; object-fit: cover;
width: 100%; width: 100%;
height: 90vh; height: 100%;
transition: opacity 0.5s; transition: opacity 0.5s;
} }
&-icon-container { &-icon-container {
position: absolute; position: absolute;
// background: $clr-gradient-dark;
background: url("/src/assets/herobg.png"), rgb(0 0 0 /0.3); background: url("/src/assets/herobg.png"), rgb(0 0 0 /0.3);
z-index: 0; z-index: 0;
top: 0; top: 0;
@@ -58,41 +69,67 @@
right: 0; right: 0;
bottom: 0; bottom: 0;
background-blend-mode: overlay; background-blend-mode: overlay;
height: 90vh; height: 100%;
.material-symbols-rounded { .material-symbols-rounded {
position: absolute; position: absolute;
font-size: 15em !important; font-size: 15em !important;
left: 80%; left: 50%;
top: 50%; top: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 50, font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 50, "opsz" 60;
"opsz" 60; opacity: 0.5;
} }
} }
} }
&-text { &-text {
display: -webkit-box; display: -webkit-box;
overflow: hidden; overflow: hidden;
-webkit-line-clamp: 2;
margin-bottom: 0.5em; margin-bottom: 0.5em;
text-shadow: 0 0 10px rgba(0,0,0,0.5), 0 0 20px rgba(0,0,0,0.3);
&-logo { &-logo {
max-width: 34vw; max-width: 25vw;
max-height: 2.4em; max-height: 20vh;
object-fit: contain; object-fit: contain;
object-position: bottom; object-position: left bottom;
filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
} }
} }
&-overview {
overflow: hidden;
margin-bottom: 0.5em;
text-shadow: 0 1px 2px rgba(0,0,0,0.8);
white-space: nowrap;
text-overflow: ellipsis;
display: block;
font-size: 1.1rem;
opacity: 0.9;
max-width: 800px;
}
&-detail { &-detail {
position: relative; position: absolute;
z-index: 0; z-index: 3;
display: flex; display: flex;
gap: 1.5em;
height: 100%; height: 100%;
width: 80%; width: 100%;
padding: $page-margin; max-width: 1400px;
padding-bottom: 0; padding: 4rem;
padding-bottom: 5rem;
padding-left: 5rem;
flex-direction: column; flex-direction: column;
justify-content: flex-end; justify-content: flex-end;
align-items: flex-start; align-items: flex-start;
left: 0;
bottom: 0;
}
&-info {
text-shadow: 0 1px 2px rgba(0,0,0,0.8);
} }
} }
@@ -105,21 +142,23 @@
} }
@media (max-width: 1140px) { @media (max-width: 1140px) {
.carousel{ .carousel {
height: 60vh !important; height: 60vh !important;
} }
.hero-carousel{ .hero-carousel {
&-background-image{ &-detail {
width: 100%; width: 100%;
background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
} }
&-text {
-webkit-line-clamp: 2 !important;
&-background-container::after {
background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}
&-text {
&-logo { &-logo {
max-width: 7em; max-width: 60vw;
max-height: 2em; max-height: 10vh;
object-fit: contain;
object-position: bottom;
} }
} }
} }
+19 -8
View File
@@ -3,10 +3,12 @@ import React, { useCallback, useMemo } from "react";
import "./home.scss"; import "./home.scss";
import type { Api } from "@jellyfin/sdk";
import { import {
type BaseItemDto, type BaseItemDto,
BaseItemKind, BaseItemKind,
ItemFields, ItemFields,
type UserDto,
} from "@jellyfin/sdk/lib/generated-client"; } from "@jellyfin/sdk/lib/generated-client";
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api"; import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api"; import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
@@ -40,10 +42,17 @@ function Home() {
const api = useApiInContext((s) => s.api); const api = useApiInContext((s) => s.api);
const user = useCentralStore((s) => s.currentUser); const user = useCentralStore((s) => s.currentUser);
if (!api || !user?.Id) {
return <CircularPageLoadingAnimation />;
}
return <HomeContent api={api} user={user} />;
}
function HomeContent({ api, user }: { api: Api; user: UserDto }) {
const libraries = useSuspenseQuery({ const libraries = useSuspenseQuery({
queryKey: ["libraries"], queryKey: ["libraries"],
queryFn: async () => { queryFn: async () => {
if (!api || !user?.Id) return null;
const libs = await getUserViewsApi(api).getUserViews({ const libs = await getUserViewsApi(api).getUserViews({
userId: user.Id, userId: user.Id,
}); });
@@ -52,12 +61,13 @@ function Home() {
networkMode: "always", networkMode: "always",
}); });
const latestMedia = useSuspenseQuery(getLatestItemsQueryOptions(api, user?.Id)); const latestMedia = useSuspenseQuery(
getLatestItemsQueryOptions(api, user.Id),
);
const resumeItemsVideo = useSuspenseQuery({ const resumeItemsVideo = useSuspenseQuery({
queryKey: ["home", "resume", "video"], queryKey: ["home", "resume", "video"],
queryFn: async () => { queryFn: async () => {
if (!api || !user?.Id) return null;
const resumeItems = await getItemsApi(api).getResumeItems({ const resumeItems = await getItemsApi(api).getResumeItems({
userId: user.Id, userId: user.Id,
limit: 10, limit: 10,
@@ -72,9 +82,8 @@ function Home() {
const resumeItemsAudio = useSuspenseQuery({ const resumeItemsAudio = useSuspenseQuery({
queryKey: ["home", "resume", "audio"], queryKey: ["home", "resume", "audio"],
queryFn: async () => { queryFn: async () => {
if (!api || !user?.Id) return null;
const resumeItems = await getItemsApi(api).getResumeItems({ const resumeItems = await getItemsApi(api).getResumeItems({
userId: user?.Id, userId: user.Id,
limit: 10, limit: 10,
mediaTypes: ["Audio"], mediaTypes: ["Audio"],
enableUserData: true, enableUserData: true,
@@ -87,15 +96,17 @@ function Home() {
const upNextItems = useSuspenseQuery({ const upNextItems = useSuspenseQuery({
queryKey: ["home", "upNext"], queryKey: ["home", "upNext"],
queryFn: async () => { queryFn: async () => {
if (!api || !user?.Id) return null;
const upNext = await getTvShowsApi(api).getNextUp({ const upNext = await getTvShowsApi(api).getNextUp({
userId: user?.Id, userId: user.Id,
fields: [ fields: [
ItemFields.PrimaryImageAspectRatio, ItemFields.PrimaryImageAspectRatio,
ItemFields.MediaStreams, ItemFields.MediaStreams,
ItemFields.MediaSources, ItemFields.MediaSources,
ItemFields.ParentId, ItemFields.ParentId,
], ],
enableResumable: false,
enableRewatching: false,
disableFirstEpisode: false,
limit: 10, limit: 10,
}); });
return upNext.data; return upNext.data;
@@ -206,7 +217,7 @@ function Home() {
</div> </div>
} }
> >
{upNextItems.isSuccess && !upNextItems.data?.TotalRecordCount && ( {upNextItems.isSuccess && upNextItems.data?.TotalRecordCount && (
<CardScroller displayCards={4} title="Up Next"> <CardScroller displayCards={4} title="Up Next">
{upNextItems.data?.Items?.map((item) => { {upNextItems.data?.Items?.map((item) => {
return ( return (
-94
View File
@@ -1,100 +1,6 @@
$cardWidth: 18%; $cardWidth: 18%;
.item-default.item { .item-default.item {
.item-hero {
height: 60vh;
gap: 2em;
row-gap: 1.2em;
position: relative;
align-items: flex-end;
display: grid;
grid-template-columns: $cardWidth 1fr;
grid-template-rows: 1fr auto;
&-image {
opacity: 0;
width: 100%;
object-fit: contain;
transition: opacity $transition-time-default;
&-container {
height: fit-content;
max-height: 100%;
overflow: hidden;
border-radius: $border-radius-default;
box-shadow: $shadow-card;
flex-grow: 1;
flex-shrink: 0;
position: relative;
width: 100%;
}
&-blurhash {
position: absolute !important;
width: 100% !important;
height: 100% !important;
z-index: -1;
}
&-icon {
background: linear-gradient(45deg, rgb(255 255 255 / 0.05), rgb(255 255 255 / 0.15));
height: 100%;
display: flex;
align-items: center;
justify-content: center;
.material-symbols-rounded{
font-size: 4em;
}
}
}
&-logo {
max-width: 34rem;
max-height: 10rem;
opacity: 0;
transition: opacity $transition-time-default;
object-position: bottom;
margin-bottom: 2em;
}
&-detail {
width: 100%;
align-items: flex-start;
gap: 0.2em;
justify-content: end;
}
&-buttons {
&-container {
align-items: center;
justify-content: space-between;
width: 100%;
grid-column: 1/3;
display: grid;
grid-template-columns: inherit;
gap: 2em;
}
}
&-backdrop {
width: 100vw;
height: 100vh;
object-fit: cover;
object-position: top;
opacity: 0;
transition: opacity $transition-time-default;
&-container {
filter: brightness(0.8);
position: absolute;
top: -4.4em;
left: -$page-margin;
width: 100vw;
height: calc(54vh + 4.4em);
z-index: -1;
mask-image: linear-gradient(to top, transparent, black);
-webkit-mask-image: linear-gradient(
to top,
transparent,
black
);
}
}
& .play-button {
width: 100% !important;
}
}
.item-detail { .item-detail {
display: grid; display: grid;
+16 -3
View File
@@ -67,11 +67,24 @@
transform: translate(-50%); transform: translate(-50%);
border-radius: 100px; border-radius: 100px;
overflow: hidden; overflow: hidden;
transition: background $transition-time-default, box-shadow $transition-time-default;
z-index: 1000; z-index: 1000;
&::after {
content: "";
position: absolute;
inset: 0 -0.35em;
pointer-events: none;
border-radius: inherit;
@include glass-effect;
opacity: 0;
z-index: -1;
transition: all $transition-time-fast;
}
&.scrolling { &.scrolling {
background: rgb(0 0 0 / 0.4) !important; &::after {
box-shadow: 0 0 25px rgb(0 0 0 / 0.45); opacity: 1;
}
} }
} }
&-options { &-options {
+96 -41
View File
@@ -1,20 +1,15 @@
import LoadingButton from "@mui/lab/LoadingButton"; import LoadingButton from "@mui/lab/LoadingButton";
import { OutlinedInput, Typography } from "@mui/material"; import { Paper, TextField, Typography } from "@mui/material";
import Checkbox from "@mui/material/Checkbox"; import Checkbox from "@mui/material/Checkbox";
import FormControl from "@mui/material/FormControl";
import FormControlLabel from "@mui/material/FormControlLabel"; import FormControlLabel from "@mui/material/FormControlLabel";
import IconButton from "@mui/material/IconButton"; import IconButton from "@mui/material/IconButton";
import InputAdornment from "@mui/material/InputAdornment"; import InputAdornment from "@mui/material/InputAdornment";
import InputLabel from "@mui/material/InputLabel";
import { useSnackbar } from "notistack"; import { useSnackbar } from "notistack";
import { AvatarImage } from "@/components/avatar/avatar.jsx"; import { AvatarImage } from "@/components/avatar/avatar.jsx";
import "./login.scss"; import "./login.scss";
import { saveUser } from "@/utils/storage/user";
import { useApiInContext } from "@/utils/store/api";
import { useBackdropStore } from "@/utils/store/backdrop.js";
import { useMutation } from "@tanstack/react-query"; import { useMutation } from "@tanstack/react-query";
import { import {
createFileRoute, createFileRoute,
@@ -27,6 +22,10 @@ import React, {
useEffect, useEffect,
useState, useState,
} from "react"; } from "react";
import { useShallow } from "zustand/shallow";
import { saveUser } from "@/utils/storage/user";
import { useApiInContext } from "@/utils/store/api";
import { useBackdropStore } from "@/utils/store/backdrop.js";
export const Route = createFileRoute("/_api/login/$userId/$userName")({ export const Route = createFileRoute("/_api/login/$userId/$userName")({
component: LoginUser, component: LoginUser,
@@ -71,13 +70,15 @@ function LoginUser() {
}); });
}; };
const setBackdrop = useBackdropStore((state) => state.setBackdrop); const setBackdrop = useBackdropStore(
useShallow((state) => state.setBackdrop),
);
useEffect(() => { useEffect(() => {
if (!api) { if (!api) {
return; return;
} }
setBackdrop("", ""); setBackdrop("");
}, []); }, []);
const handleCheckRememberMe = ( const handleCheckRememberMe = (
@@ -102,7 +103,13 @@ function LoginUser() {
} }
createApi(api.basePath, authenticate.data?.AccessToken); createApi(api.basePath, authenticate.data?.AccessToken);
if (rememberMe) await saveUser(userName, authenticate.data.AccessToken); if (authenticate.data.SessionInfo?.UserId && rememberMe) {
await saveUser(
userName,
authenticate.data.AccessToken,
authenticate.data.SessionInfo.UserId,
);
}
router.invalidate().finally(() => { router.invalidate().finally(() => {
navigate({ to: "/home", replace: true }); navigate({ to: "/home", replace: true });
@@ -123,52 +130,86 @@ function LoginUser() {
return ( return (
<div <div
style={{ className="login flex flex-center flex-column centered"
height: "100vh", style={{ marginTop: 0 }}
>
<Paper
sx={{
p: 4,
width: "100%",
maxWidth: "600px",
backgroundColor: "rgba(20, 20, 30, 0.7)",
backdropFilter: "blur(24px) saturate(180%)",
backgroundImage:
"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0))",
border: "1px solid rgba(255, 255, 255, 0.08)",
boxShadow: "0 20px 50px rgba(0,0,0,0.5)",
borderRadius: 4,
display: "flex", display: "flex",
justifyContent: "center",
alignItems: "center",
flexDirection: "column", flexDirection: "column",
width: "30vw", alignItems: "center",
margin: "auto", }}
>
<div
style={{
marginBottom: "2em",
display: "flex",
flexDirection: "column",
alignItems: "center",
gap: "1em",
}} }}
> >
<AvatarImage userId={userId} /> <AvatarImage userId={userId} />
<div style={{ display: "inline-flex", margin: "1em 0" }}> <div
<Typography variant="h5">Login as</Typography>
<Typography
variant="h5"
style={{ style={{
display: "inline", display: "flex",
flexDirection: "column",
alignItems: "center",
}} }}
ml={0.5}
fontWeight={700}
className="gradient-text"
> >
<Typography variant="body1" sx={{ opacity: 0.7 }}>
Login as
</Typography>
<Typography variant="h5" fontWeight={700} className="gradient-text">
{userName} {userName}
</Typography> </Typography>
</div> </div>
<form onSubmit={(e) => handleLogin.mutate(e)}> </div>
<FormControl
variant="outlined" <form
onSubmit={(e) => handleLogin.mutate(e)}
style={{ style={{
width: "100%", width: "100%",
display: "flex",
flexDirection: "column",
gap: "1.5rem",
}} }}
> >
<InputLabel htmlFor="user-password">Password</InputLabel> <TextField
<OutlinedInput fullWidth
id="user-password"
type={password.showpass ? "text" : "password"} type={password.showpass ? "text" : "password"}
onChange={handlePassword("password")} onChange={handlePassword("password")}
label="Password" label="Password"
endAdornment={ variant="outlined"
<InputAdornment position="end"> autoFocus
<IconButton InputProps={{
onClick={handleShowPassword} startAdornment: (
aria-label="toggle password visibility" <InputAdornment position="start">
<span
className="material-symbols-rounded"
style={{ opacity: 0.5 }}
> >
key
</span>
</InputAdornment>
),
endAdornment: (
<InputAdornment position="end">
<IconButton onClick={handleShowPassword} edge="end">
{password.showpass ? ( {password.showpass ? (
<span className="material-symbols-rounded">visibility</span> <span className="material-symbols-rounded">
visibility
</span>
) : ( ) : (
<span className="material-symbols-rounded"> <span className="material-symbols-rounded">
visibility_off visibility_off
@@ -176,29 +217,43 @@ function LoginUser() {
)} )}
</IconButton> </IconButton>
</InputAdornment> </InputAdornment>
} ),
}}
/> />
</FormControl>
<div
style={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
}}
>
<FormControlLabel <FormControlLabel
control={ control={
<Checkbox checked={rememberMe} onChange={handleCheckRememberMe} /> <Checkbox
checked={rememberMe}
onChange={handleCheckRememberMe}
/>
} }
label="Remember me" label="Remember me"
sx={{ m: 0 }}
/> />
</div>
<LoadingButton <LoadingButton
variant="contained" variant="contained"
endIcon={ endIcon={<span className="material-symbols-rounded">login</span>}
<span className="material-symbols-rounded">chevron_right</span>
}
type="submit" type="submit"
loading={handleLogin.isPending} loading={handleLogin.isPending}
loadingPosition="end" loadingPosition="end"
size="large" size="large"
fullWidth fullWidth
sx={{ borderRadius: 2, height: 48 }}
> >
Login Login
</LoadingButton> </LoadingButton>
</form> </form>
</Paper>
</div> </div>
); );
} }
+108 -13
View File
@@ -1,5 +1,5 @@
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api"; import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { Chip, Typography } from "@mui/material"; import { Box, Chip, Typography } from "@mui/material";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
import React, { useEffect } from "react"; import React, { useEffect } from "react";
@@ -7,10 +7,10 @@ import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice.jsx";
import "./login.scss"; import "./login.scss";
import type { UserDto } from "@jellyfin/sdk/lib/generated-client"; import type { UserDto } from "@jellyfin/sdk/lib/generated-client";
import { Paper } from "@mui/material";
import { createFileRoute, Link } from "@tanstack/react-router"; import { createFileRoute, Link } from "@tanstack/react-router";
import { useApiInContext } from "@/utils/store/api"; import { useApiInContext } from "@/utils/store/api";
import { useBackdropStore } from "@/utils/store/backdrop.js"; import { useBackdropStore } from "@/utils/store/backdrop.js";
import avatar from "../../../assets/icons/avatar.png"; import avatar from "../../../assets/icons/avatar.png";
export const Route = createFileRoute("/_api/login/list")({ export const Route = createFileRoute("/_api/login/list")({
@@ -24,21 +24,66 @@ const UserCard = ({ user }: { user: UserDto }) => {
to="/login/$userId/$userName" to="/login/$userId/$userName"
params={{ userId: user.Id ?? "", userName: user.Name ?? "" }} params={{ userId: user.Id ?? "", userName: user.Name ?? "" }}
className="user-list-item user-card" className="user-list-item user-card"
style={{ textDecoration: "none", display: "block" }}
>
<Paper
elevation={0}
sx={{
p: 2,
bgcolor: "rgba(255,255,255,0.03)",
"&:hover": {
bgcolor: "rgba(255,255,255,0.1)",
transform: "translateY(-4px)",
boxShadow: "0 8px 20px rgba(0,0,0,0.3)",
},
transition: "all 0.3s ease",
borderRadius: 4,
border: "1px solid rgba(255,255,255,0.05)",
display: "flex",
flexDirection: "column",
alignItems: "center",
width: "160px",
height: "100%",
cursor: "pointer",
}}
>
<div
className="user-card-image-container"
style={{
width: "100px",
height: "100px",
borderRadius: "50%",
overflow: "hidden",
boxShadow: "0 8px 16px rgba(0,0,0,0.3)",
}}
> >
<div className="user-card-image-container">
{user.PrimaryImageTag ? ( {user.PrimaryImageTag ? (
<img <img
className="user-card-image" className="user-card-image"
alt={"user"} alt={"user"}
src={`${api?.basePath}/Users/${user.Id}/Images/Primary?quality=80&tag=${user.PrimaryImageTag}`} src={`${api?.basePath}/Users/${user.Id}/Images/Primary?quality=80&tag=${user.PrimaryImageTag}`}
style={{ width: "100%", height: "100%", objectFit: "cover" }}
/> />
) : ( ) : (
<img className="user-card-image" alt="user" src={avatar} /> <img
className="user-card-image"
alt="user"
src={avatar}
style={{ width: "100%", height: "100%", objectFit: "cover" }}
/>
)} )}
</div> </div>
<Typography mt={1} align="center"> <Typography
mt={2}
align="center"
variant="subtitle1"
fontWeight="bold"
noWrap
sx={{ width: "100%", color: "text.primary" }}
>
{user.Name} {user.Name}
</Typography> </Typography>
</Paper>
</Link> </Link>
); );
}; };
@@ -63,27 +108,77 @@ function LoginPublicUsersList() {
if (users.isSuccess) { if (users.isSuccess) {
return ( return (
<div className="login-container scrollY"> <div className="login-container scrollY flex flex-column flex-center">
<Typography variant="h4" align="center"> <Paper
Users sx={{
p: 4,
maxWidth: "800px",
width: "90%",
backgroundColor: "rgba(20, 20, 30, 0.7)",
backdropFilter: "blur(24px) saturate(180%)",
backgroundImage:
"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0))",
border: "1px solid rgba(255, 255, 255, 0.08)",
boxShadow: "0 20px 50px rgba(0,0,0,0.5)",
borderRadius: 4,
display: "flex",
flexDirection: "column",
alignItems: "center",
gap: 3,
}}
>
<Typography variant="h4" align="center" fontWeight="bold">
Select User
</Typography> </Typography>
<div className="user-list-container roundedScrollbar"> <Box
sx={{
display: "flex",
flexWrap: "wrap",
gap: 3,
justifyContent: "center",
width: "100%",
maxHeight: "60vh",
overflowY: "auto",
py: 2,
"&::-webkit-scrollbar": { display: "none" },
scrollbarWidth: "none",
}}
>
{users.data.map((item) => { {users.data.map((item) => {
return <UserCard user={item} key={item.Id} />; return <UserCard user={item} key={item.Id} />;
})} })}
</div> </Box>
<Chip <Chip
style={{ marginLeft: "50%", transform: "translateX(-50%)" }}
label={ label={
<Typography variant="body2" align="center"> <Typography variant="body2" align="center">
Don't see your user? Try using{" "} Don't see your user? Try using{" "}
<Link to="/login/manual">Manual Login</Link> or{" "} <Link
<Link to="/setup/server/list">Changing Server</Link> to="/login/manual"
style={{ color: "inherit", fontWeight: "bold" }}
>
Manual Login
</Link>{" "}
or{" "}
<Link
to="/setup/server/list"
style={{ color: "inherit", fontWeight: "bold" }}
>
Changing Server
</Link>
</Typography> </Typography>
} }
sx={{
bgcolor: "rgba(255,255,255,0.05)",
p: 1,
height: "auto",
"& .MuiChip-label": {
padding: "8px 12px",
},
}}
/> />
</Paper>
</div> </div>
); );
} }
+123 -58
View File
@@ -1,36 +1,31 @@
import { getBrandingApi } from "@jellyfin/sdk/lib/utils/api/branding-api";
import LoadingButton from "@mui/lab/LoadingButton";
import { Paper, TextField, Typography } from "@mui/material";
import Button from "@mui/material/Button";
import Checkbox from "@mui/material/Checkbox";
import FormControlLabel from "@mui/material/FormControlLabel";
import IconButton from "@mui/material/IconButton";
import InputAdornment from "@mui/material/InputAdornment";
import { useMutation, useQuery } from "@tanstack/react-query"; import { useMutation, useQuery } from "@tanstack/react-query";
import { useSnackbar } from "notistack";
import React, { import React, {
type ChangeEvent, type ChangeEvent,
type FormEvent, type FormEvent,
useEffect, useEffect,
useState, useState,
} from "react"; } from "react";
import { saveUser } from "@/utils/storage/user.js"; import { saveUser } from "@/utils/storage/user.js";
import LoadingButton from "@mui/lab/LoadingButton";
import { OutlinedInput, Paper, TextField, Typography } from "@mui/material";
import Button from "@mui/material/Button";
import Checkbox from "@mui/material/Checkbox";
import FormControl from "@mui/material/FormControl";
import FormControlLabel from "@mui/material/FormControlLabel";
import IconButton from "@mui/material/IconButton";
import InputAdornment from "@mui/material/InputAdornment";
import InputLabel from "@mui/material/InputLabel";
import { useSnackbar } from "notistack";
import { useApiInContext } from "@/utils/store/api.js"; import { useApiInContext } from "@/utils/store/api.js";
import { getBrandingApi } from "@jellyfin/sdk/lib/utils/api/branding-api";
import "./login.scss"; import "./login.scss";
import { useBackdropStore } from "@/utils/store/backdrop.js";
import { blue } from "@mui/material/colors"; import { blue } from "@mui/material/colors";
import { import {
createFileRoute, createFileRoute,
useNavigate, useNavigate,
useRouter, useRouter,
} from "@tanstack/react-router"; } from "@tanstack/react-router";
import { useShallow } from "zustand/shallow";
import { useBackdropStore } from "@/utils/store/backdrop.js";
export const Route = createFileRoute("/_api/login/manual")({ export const Route = createFileRoute("/_api/login/manual")({
component: UserLoginManual, component: UserLoginManual,
@@ -96,7 +91,12 @@ function UserLoginManual() {
} }
createApi(api.basePath, authenticate.data?.AccessToken); createApi(api.basePath, authenticate.data?.AccessToken);
if (rememberMe) await saveUser(username, authenticate.data.AccessToken); if (rememberMe)
await saveUser(
username,
authenticate.data.AccessToken,
authenticate.data.User?.Id ?? "",
);
router.invalidate().finally(() => { router.invalidate().finally(() => {
navigate({ to: searchParams.redirect || "/home", replace: true }); navigate({ to: searchParams.redirect || "/home", replace: true });
}); });
@@ -122,40 +122,85 @@ function UserLoginManual() {
setRememberMe(checked); setRememberMe(checked);
}; };
const setBackdrop = useBackdropStore((state) => state.setBackdrop); const setBackdrop = useBackdropStore(
useShallow((state) => state.setBackdrop),
);
useEffect(() => { useEffect(() => {
setBackdrop("", ""); setBackdrop("");
}, []); }, []);
return ( return (
<div className="login scrollY"> <div className="login scrollY flex flex-center flex-column">
<div <Paper
className={`login-form-container ${ sx={{
server.data?.LoginDisclaimer && "padded-top" p: 4,
}`} width: "100%",
maxWidth: "600px",
backgroundColor: "rgba(20, 20, 30, 0.7)",
backdropFilter: "blur(24px) saturate(180%)",
backgroundImage:
"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0))",
border: "1px solid rgba(255, 255, 255, 0.08)",
boxShadow: "0 20px 50px rgba(0,0,0,0.5)",
borderRadius: 4,
display: "flex",
flexDirection: "column",
gap: 3,
mb: 3,
}}
> >
<Typography variant="h4" color="textPrimary"> <Typography variant="h4" fontWeight="bold" align="center">
Login Login
</Typography> </Typography>
<form className="login-form" onSubmit={(e) => handleLogin.mutate(e)}> <form
className="flex flex-column"
style={{ gap: "1.5em", width: "100%" }}
onSubmit={(e) => handleLogin.mutate(e)}
>
<TextField <TextField
variant="outlined" variant="outlined"
label="Username" label="Username" // Label helps accessibility, theme handles style
fullWidth
onChange={(e) => setUsername(e.currentTarget.value)} onChange={(e) => setUsername(e.currentTarget.value)}
InputProps={{
startAdornment: (
<InputAdornment position="start">
<span
className="material-symbols-rounded"
style={{ opacity: 0.5 }}
>
person
</span>
</InputAdornment>
),
}}
/> />
<FormControl sx={{ width: "100%" }} variant="outlined"> <TextField
<InputLabel htmlFor="user-password">Password</InputLabel>
<OutlinedInput
fullWidth fullWidth
id="user-password"
type={password.showpass ? "text" : "password"} type={password.showpass ? "text" : "password"}
onChange={handlePassword("password")} onChange={handlePassword("password")}
label="Password" label="Password"
endAdornment={ variant="outlined"
InputProps={{
startAdornment: (
<InputAdornment position="start">
<span
className="material-symbols-rounded"
style={{ opacity: 0.5 }}
>
key
</span>
</InputAdornment>
),
endAdornment: (
<InputAdornment position="end"> <InputAdornment position="end">
<IconButton <IconButton
onClick={handleShowPassword} onClick={handleShowPassword}
aria-label="toggle password visibility" edge="end"
sx={{
color: "rgba(255,255,255,0.7)",
"&:hover": { color: "#fff" },
}}
> >
{password.showpass ? ( {password.showpass ? (
<span className="material-symbols-rounded"> <span className="material-symbols-rounded">
@@ -168,48 +213,68 @@ function UserLoginManual() {
)} )}
</IconButton> </IconButton>
</InputAdornment> </InputAdornment>
} ),
}}
/> />
</FormControl>
<FormControlLabel <FormControlLabel
control={ control={
<Checkbox checked={rememberMe} onChange={handleCheckRememberMe} /> <Checkbox
} checked={rememberMe}
label="Remember me" onChange={handleCheckRememberMe}
sx={{
color: "rgba(255,255,255,0.5)",
"&.Mui-checked": {
color: "primary.main",
},
}}
/> />
<div }
className="flex flex-row" label={
style={{ width: "100%", gap: "0.8em", flexWrap: "wrap" }} <Typography variant="body2" sx={{ opacity: 0.7 }}>
> Remember me
</Typography>
}
/>
<div className="flex flex-column" style={{ gap: "1em" }}>
<LoadingButton <LoadingButton
variant="contained" variant="contained"
type="submit" type="submit"
loading={handleLogin.isPending} loading={handleLogin.isPending}
sx={{ width: "100%" }} sx={{ width: "100%", height: 48, borderRadius: 2 }}
size="large"
> >
Login Login
</LoadingButton> </LoadingButton>
<Button <Button
color="secondary" color="inherit"
variant="contained" variant="text"
className="userEventButton" sx={{
// size="large" width: "100%",
style={{ flex: 1 }} color: "rgba(255,255,255,0.5)",
"&:hover": {
color: "white",
bgcolor: "rgba(255,255,255,0.05)",
},
}}
onClick={() => navigate({ to: "/setup/server/list" })} onClick={() => navigate({ to: "/setup/server/list" })}
> >
Change Server Change Server
</Button> </Button>
</div> </div>
</form> </form>
</div> </Paper>
{server.isSuccess && server.data?.LoginDisclaimer && ( {server.isSuccess && server.data?.LoginDisclaimer && (
<Paper <Paper
elevation={0} elevation={0}
style={{ sx={{
marginTop: "1em", padding: "1.5em",
padding: "1em", borderRadius: "16px",
borderRadius: "15px", width: "100%",
width: "28em", maxWidth: "450px",
backgroundColor: "rgba(33, 150, 243, 0.1)",
border: "1px solid rgba(33, 150, 243, 0.2)",
}} }}
> >
<div <div
@@ -219,16 +284,16 @@ function UserLoginManual() {
<span <span
className="material-symbols-rounded" className="material-symbols-rounded"
style={{ style={{
color: blue[700], color: blue[400],
//@ts-ignore
"--fill": 1,
}} }}
> >
info info
</span> </span>
<Typography variant="subtitle1" fontWeight="bold">
Notice Notice
</Typography>
</div> </div>
<Typography variant="subtitle2" style={{ opacity: 0.8 }}> <Typography variant="body2" style={{ opacity: 0.8, lineHeight: 1.6 }}>
{server.data.LoginDisclaimer} {server.data.LoginDisclaimer}
</Typography> </Typography>
</Paper> </Paper>
-95
View File
@@ -22,101 +22,6 @@ $cardWidth: 18%;
.item-person.item { .item-person.item {
gap: 1em; gap: 1em;
.item-hero {
height: 50vh;
gap: 2em;
row-gap: 1.2em;
position: relative;
align-items: flex-end;
margin-bottom: 1em;
display: grid;
grid-template-columns: $cardWidth 1fr;
grid-template-rows: 1fr auto;
&-image {
opacity: 0;
width: 100%;
object-fit: contain;
transition: opacity $transition-time-default;
&-container {
height: fit-content;
max-height: 100%;
overflow: hidden;
border-radius: $border-radius-default;
box-shadow: $shadow-card;
flex-grow: 1;
flex-shrink: 0;
position: relative;
width: 100%;
}
&-blurhash {
position: absolute !important;
width: 100% !important;
height: 100% !important;
z-index: -1;
}
&-icon {
background: linear-gradient(45deg, rgb(255 255 255 / 0.05), rgb(255 255 255 / 0.15));
height: 100%;
display: flex;
align-items: center;
justify-content: center;
.material-symbols-rounded{
font-size: 4em;
}
}
}
&-logo {
max-width: 34rem;
max-height: 10rem;
opacity: 0;
transition: opacity $transition-time-default;
object-position: bottom;
margin-bottom: 2em;
}
&-detail {
width: 100%;
align-items: flex-start;
gap: 0.2em;
justify-content: end;
}
&-buttons {
&-container {
align-items: center;
justify-content: space-between;
width: 100%;
grid-column: 1/3;
display: grid;
grid-template-columns: inherit;
gap: 2em;
}
}
&-backdrop {
width: 100vw;
height: 100%;
object-fit: cover;
object-position: top;
opacity: 0;
transition: opacity $transition-time-default;
&-container {
filter: brightness(0.8);
position: absolute;
top: -4.4em;
left: -$page-margin;
width: 100vw;
height: 100vh;
z-index: -1;
mask-image: linear-gradient(to top, transparent, black);
-webkit-mask-image: linear-gradient(
to top,
transparent,
black
);
}
}
& .play-button {
width: 100% !important;
}
}
.item-detail { .item-detail {
+202 -77
View File
@@ -1,38 +1,155 @@
.audio { .audio {
&-hidden { &-background {
transform: translateY(-100%); position: fixed;
} top: 0;
&-info { left: 0;
width: 100%; width: 100%;
padding: 4em; height: 100%;
gap: 0.5em; z-index: -1;
display: flex; overflow: hidden;
flex-direction: column;
&::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6); // Dark overlay
backdrop-filter: blur(60px);
-webkit-backdrop-filter: blur(60px);
}
&-image {
width: 100%;
height: 100%;
object-fit: cover;
transform: scale(1.1); // Prevent white edges from blur
}
}
&-container { &-container {
display: flex; display: flex;
gap: 0em; flex-direction: column;
height: 100vh;
width: 100%;
padding: 1rem;
gap: 1rem;
box-sizing: border-box;
position: relative;
z-index: 1;
color: white;
overflow: hidden;
@media (min-width: 900px) {
flex-direction: row;
align-items: center; align-items: center;
justify-content: flex-start; justify-content: center;
padding: 4rem;
gap: 3rem;
max-width: 1600px;
margin: 0 auto;
} }
}
&-left-column {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 1.5rem;
width: 100%;
max-width: 500px;
margin: 0 auto;
min-height: 0; // Allow shrinking
@media (min-width: 900px) {
gap: 2rem;
}
}
&-right-column {
flex: 1;
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
max-width: 600px;
overflow: hidden;
@include glass-effect($blur: 20px, $bg-color: rgba(255, 255, 255, 0.05));
border-radius: 1.5rem;
padding: 0;
min-height: 0; // Allow shrinking
}
&-right-content {
flex: 1;
padding: 1.5rem;
overflow-y: auto;
overflow-x: hidden;
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-track {
background: transparent;
}
&::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.2);
border-radius: 3px;
}
&::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.3);
}
}
&-info {
width: 100%;
display: flex;
flex-direction: column;
align-items: flex-start; // Left align text
text-align: left;
gap: 0.5em;
@media (max-width: 900px) {
align-items: center;
text-align: center;
}
&-image { &-image {
width: 100%; width: 100%;
aspect-ratio: 1; aspect-ratio: 1;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
border-radius: 1.5rem;
box-shadow: 0 20px 50px rgba(0,0,0,0.5);
transition: transform 0.3s ease;
&-container { &-container {
width: 25em; width: 100%;
aspect-ratio: 1; aspect-ratio: 1;
position: relative; position: relative;
border-radius: $border-radius-default; border-radius: 1.5rem;
overflow: hidden; overflow: hidden;
margin-bottom: 1rem;
@media (max-width: 900px) {
max-width: 70vw;
max-height: 35vh;
margin: 0 auto 1rem auto;
} }
}
&-icon { &-icon {
font-size: 4em; font-size: 8em;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
height: 100%; height: 100%;
background: rgb(255 255 255 / 0.2); width: 100%;
background: rgba(255, 255, 255, 0.1);
border-radius: 1.5rem;
} }
} }
&-controls { &-controls {
@@ -40,82 +157,90 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 1em; gap: 1.5em;
margin-top: 1rem;
} }
} }
&-queue { &-queue {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
align-items: center; align-items: stretch; // Ensure items take full width
margin-top: 2em; // Remove old track styles as we now use QueueListItem
&-track {
padding: 1em;
display: grid;
grid-template-columns: 3em 1fr 6em;
align-items: center;
justify-content: center;
width: 100%;
gap: 1em;
.material-symbols-rounded{
cursor: grab;
}
&-info-name {
transition: $transition-time-fast;
}
&.active {
.audio-queue-track-info-name {
color: $clr-accent-default;
font-weight: 500;
}
}
&.dragging {
background: black;
border-radius: 10px;
width: calc(100% + 2em);
cursor: grabbing;
}
}
} }
&-lyrics { &-lyrics {
max-height: 40vh; padding: 1rem;
overflow: visible;
background: rgb(255 255 255 / 0.05);
// border: 1px solid rgb(255 255 255 / 0.2);
padding: 2em;
position: relative;
margin-bottom: 2em;
border-radius: 20px;
overscroll-behavior: contain;
&-line {
width: fit-content;
white-space: wrap;
text-align: center; text-align: center;
font-size: 1.5em; width: 100%;
opacity: 0.5;
transform: scale(1);
transition: transform $transition-time-default;
&[data-active-lyric="true"] {
opacity: 1;
transform: scale(1.2);
}
}
&[data-has-synced-lyrics="false"] {
.audio-lyrics-line {
opacity: 1;
}
}
&-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow-y: scroll;
height: calc(40vh - 4em);
width: 100%;
overflow-x: visible !important;
align-items: center; align-items: center;
position: relative; min-height: 100%;
top: 0;
&-container {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
padding-bottom: 4rem; // Space for unsynced notice
}
&-status {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
width: 100%;
opacity: 0.7;
min-height: 200px;
}
&-line {
margin-bottom: 1.5rem;
opacity: 0.5;
transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
border-radius: 1rem;
padding: 0.75rem 1.5rem;
cursor: pointer;
font-size: 1.5rem !important;
line-height: 1.6 !important;
font-weight: 600 !important;
max-width: 90%;
&:hover {
opacity: 0.8;
background: rgba(255, 255, 255, 0.05);
}
&[data-active-lyric="true"] {
opacity: 1;
font-weight: 800 !important;
transform: scale(1.05);
text-shadow: 0 0 30px rgba(255,255,255,0.3);
color: var(--primary-color, #90caf9);
}
}
&-unsynced-notice {
position: sticky;
bottom: 1rem;
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
padding: 0.5rem 1rem;
background: rgba(0, 0, 0, 0.4);
backdrop-filter: blur(10px);
border-radius: 2rem;
margin-top: auto;
opacity: 0.8;
.material-symbols-rounded {
font-size: 1.2rem;
}
} }
} }
} }
+206 -356
View File
@@ -1,249 +1,200 @@
import { useApiInContext } from "@/utils/store/api"; import { Box, Tab, Tabs, Typography } from "@mui/material";
import { useAudioPlayback } from "@/utils/store/audioPlayback";
import useQueue, { setQueue } from "@/utils/store/queue";
import { Fab, IconButton, Slider, Typography } from "@mui/material";
import { createFileRoute } from "@tanstack/react-router"; import { createFileRoute } from "@tanstack/react-router";
import React, { useEffect, useRef, useState } from "react"; import React, { useEffect, useMemo, useState } from "react";
import { useApiInContext } from "@/utils/store/api";
import {
setIsMuted,
setVolume,
useAudioPlayback,
} from "@/utils/store/audioPlayback";
import useQueue from "@/utils/store/queue";
import "./audio.scss"; import "./audio.scss";
import PlayNextButton from "@/components/buttons/playNextButton";
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
import QueueTrack from "@/components/queueTrack";
import { getRuntimeMusic, secToTicks, ticksToSec } from "@/utils/date/time";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { getLyricsApi } from "@jellyfin/sdk/lib/utils/api/lyrics-api";
import { useQuery } from "@tanstack/react-query";
import { import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
DndContext, import LyricsPanel from "@/components/playback/audioPlayer/components/LyricsPanel";
type DragEndEvent, import PlayerControls from "@/components/playback/audioPlayer/components/PlayerControls";
DragOverlay, import PlayerProgress from "@/components/playback/audioPlayer/components/PlayerProgress";
KeyboardSensor, import PlayerVolume from "@/components/playback/audioPlayer/components/PlayerVolume";
PointerSensor, import QueuePanel from "@/components/playback/audioPlayer/components/QueuePanel";
closestCenter, import StatsPanel from "@/components/playback/audioPlayer/components/StatsPanel";
useSensor, import { secToTicks, ticksToSec } from "@/utils/date/time";
useSensors, import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
} from "@dnd-kit/core";
import {
restrictToVerticalAxis,
restrictToWindowEdges,
} from "@dnd-kit/modifiers";
import {
SortableContext,
arrayMove,
sortableKeyboardCoordinates,
verticalListSortingStrategy,
} from "@dnd-kit/sortable";
export const Route = createFileRoute("/_api/player/audio")({ export const Route = createFileRoute("/_api/player/audio")({
component: AudioPlayerRoute, component: AudioPlayerRoute,
}); });
const SEEK_AMOUNT = 10; // seconds to skip on fast_rewind or fast_forward button click const SEEK_AMOUNT = 10;
const AudioInfo = React.memo(
({
item,
imageUrl,
}: {
item: BaseItemDto | undefined | null;
imageUrl: string | undefined;
}) => (
<>
<div className="audio-info-image-container">
{imageUrl ? (
<img
alt={item?.Name ?? "Music"}
src={imageUrl}
className="audio-info-image"
/>
) : (
<div className="audio-info-image-icon">
<span
className="material-symbols-rounded"
style={{ fontSize: "inherit" }}
>
music_note
</span>
</div>
)}
</div>
<div className="audio-info">
<Typography
variant="h4"
fontWeight={700}
noWrap
style={{ width: "100%", marginBottom: "0.2em" }}
>
{item?.Name}
</Typography>
<Typography
variant="h6"
fontWeight={400}
className="opacity-07"
noWrap
style={{ width: "100%" }}
>
{item?.Artists?.join(", ")}
</Typography>
</div>
</>
),
);
function AudioPlayerRoute() { function AudioPlayerRoute() {
const api = useApiInContext((s) => s.api); const api = useApiInContext((s) => s.api);
const [queue, currentTrack] = useQueue((s) => [s.tracks, s.currentItemIndex]); const [queue, currentTrack] = useQueue((s) => [s.tracks, s.currentItemIndex]);
const [item, audioPlayerRef] = useAudioPlayback((s) => [ const [item, audioPlayerRef, volume, isMuted] = useAudioPlayback((s) => [
s.item, s.item,
s.player.ref, s.player.ref,
s.player.volume,
s.player.isMuted,
]); ]);
const [audioPlayer, setAudioPlayer] = useState<HTMLAudioElement | null>(
audioPlayerRef?.current ? audioPlayerRef?.current : null,
);
useEffect(() => {
if (audioPlayerRef?.current) {
setAudioPlayer(audioPlayerRef?.current);
}
}, [audioPlayerRef?.current]);
console.log(audioPlayer?.paused); const [progress, setProgress] = useState(0);
const [playing, setPlaying] = useState(false);
const [isScrubbing, setIsScrubbing] = useState(false); const [tabValue, setTabValue] = useState(0);
const [sliderProgress, setSliderProgress] = useState<number | number[]>(0); // this state hold the slider scrubbing value allowing user to scrub track without changing current time
const [progress, setProgress] = useState<number | number[]>(
audioPlayer?.currentTime ?? 0,
);
const [showLyrics, setShowLyrics] = useState(false);
const lyrics = useQuery({
queryKey: ["player", "audio", item?.Id, "lyrics"],
queryFn: async () => {
if (!item?.Id || !api) {
return null;
}
return (
await getLyricsApi(api).getLyrics({
itemId: item?.Id,
})
).data;
},
enabled: Boolean(item?.Id),
});
useEffect(() => { useEffect(() => {
audioPlayerRef?.current?.addEventListener("timeupdate", () => { const player = audioPlayerRef?.current;
setProgress(audioPlayerRef?.current?.currentTime ?? 0); if (!player) return;
});
const updateProgress = () => setProgress(player.currentTime);
const updatePlaying = () => setPlaying(!player.paused);
player.addEventListener("timeupdate", updateProgress);
player.addEventListener("play", updatePlaying);
player.addEventListener("pause", updatePlaying);
// Initial state
setProgress(player.currentTime);
setPlaying(!player.paused);
return () => { return () => {
audioPlayerRef?.current?.removeEventListener("timeupdate", () => { player.removeEventListener("timeupdate", updateProgress);
setProgress(audioPlayerRef?.current?.currentTime ?? 0); player.removeEventListener("play", updatePlaying);
}); player.removeEventListener("pause", updatePlaying);
}; };
}, [item?.Id, currentTrack]); }, [audioPlayerRef?.current, item?.Id]);
const lyricsContainer = useRef<HTMLDivElement | null>(null); const handlePlayPause = () => {
useEffect(() => { const player = audioPlayerRef?.current;
if (showLyrics) { if (player) {
const currentLyric = document.querySelector("[data-active-lyric='true']"); if (player.paused) {
currentLyric?.scrollIntoView({ player.play();
block: "nearest", } else {
inline: "nearest", player.pause();
behavior: "smooth",
});
} }
}, [showLyrics, audioPlayer?.currentTime]); }
};
const sensors = useSensors( const handleSeek = (value: number) => {
useSensor(PointerSensor), setProgress(ticksToSec(value));
useSensor(KeyboardSensor, { };
coordinateGetter: sortableKeyboardCoordinates,
}), const handleSeekCommit = (value: number) => {
const player = audioPlayerRef?.current;
if (player) {
player.currentTime = ticksToSec(value);
setProgress(ticksToSec(value));
}
};
const handleRewind = () => {
const player = audioPlayerRef?.current;
if (player) {
player.currentTime -= SEEK_AMOUNT;
}
};
const handleForward = () => {
const player = audioPlayerRef?.current;
if (player) {
player.currentTime += SEEK_AMOUNT;
}
};
const handleTabChange = (_: React.SyntheticEvent, newValue: number) => {
setTabValue(newValue);
};
const imageUrl = useMemo(
() =>
item?.ImageTags?.Primary
? api &&
getImageUrlsApi(api).getItemImageUrlById(item.Id ?? "", "Primary", {
tag: item.ImageTags.Primary,
})
: undefined,
[item?.Id, item?.ImageTags?.Primary, api],
); );
const handleDragEnd = (event: DragEndEvent) => {
const { active, over } = event;
if (active.id !== over?.id) {
const prevState = queue;
const oldIndex = prevState
?.map((item) => item.Id)
.indexOf(String(active.id));
const newIndex = prevState
?.map((item) => item.Id)
.indexOf(String(over?.id));
if (oldIndex === newIndex) {
return;
}
if (!oldIndex || !newIndex) {
return;
}
if (oldIndex === -1 || newIndex === -1) {
return;
}
const newState = prevState
? arrayMove(prevState, oldIndex, newIndex)
: prevState;
const currentTrack = newState?.map((item) => item.Id).indexOf(item?.Id);
if (!currentTrack) {
return;
}
setQueue(newState, currentTrack);
// setQueue(newState);
}
};
const [currentDraggingIndex, setCurrentDraggingIndex] = useState<
number | null
>(null);
return ( return (
<div <>
className="scrollY padded-top flex flex-column" <div className="audio-background">
style={{ gap: "1em" }} {imageUrl && (
key={item?.Id} <img src={imageUrl} alt="" className="audio-background-image" />
>
<div className="audio-info-container">
<div className="audio-info-image-container">
{item?.ImageTags?.Primary ? (
<img
alt={item.Name ?? "Music"}
src={
api &&
getImageUrlsApi(api).getItemImageUrlById(
item.Id ?? "",
"Primary",
{
tag: item.ImageTags.Primary,
},
)
}
className="audio-info-image"
/>
) : (
<span className="material-symbols-rounded fill audio-info-image-icon">
music_note
</span>
)} )}
</div> </div>
<div className="audio-info"> <div className="audio-container" key={item?.Id}>
<Typography variant="h4" fontWeight={400}> <div className="audio-left-column">
{item?.Name} <AudioInfo item={item} imageUrl={imageUrl} />
</Typography>
<Typography <PlayerProgress
variant="subtitle1" progress={secToTicks(progress)}
fontWeight={300} duration={item?.RunTimeTicks ?? 1}
className="opacity-07" onSeek={handleSeek}
> onSeekCommit={handleSeekCommit}
by {item?.Artists?.join(", ")} />
</Typography>
<div <div className="audio-info-controls">
className="flex flex-row" <PlayerControls
style={{ gap: "1em", alignItems: "center" }} playing={playing}
> onPlayPause={handlePlayPause}
<Typography variant="subtitle2" className="opacity-07"> size="large"
{getRuntimeMusic(secToTicks(audioPlayer?.currentTime ?? 0) ?? 0)} onRewind={handleRewind}
</Typography> onForward={handleForward}
<Slider
value={
isScrubbing ? sliderProgress : secToTicks(Number(progress))
}
max={item?.RunTimeTicks ?? 1}
step={1}
key={item?.Id}
onChange={(_, newVal) => {
setIsScrubbing(true);
setSliderProgress(newVal);
}}
onChangeCommitted={(_, newVal) => {
setIsScrubbing(false);
Array.isArray(newVal)
? setProgress(ticksToSec(newVal[0]))
: setProgress(ticksToSec(newVal));
if (audioPlayerRef?.current) {
audioPlayerRef.current.currentTime = Array.isArray(newVal)
? ticksToSec(newVal[0])
: ticksToSec(newVal);
}
}}
sx={{
"& .MuiSlider-thumb": {
width: 14,
height: 14,
transition: "0.1s ease-in-out",
opacity: 0,
"&.Mui-active": {
width: 20,
height: 20,
opacity: 1,
},
},
"&:hover .MuiSlider-thumb": {
opacity: 1,
},
"& .MuiSlider-rail": {
opacity: 0.28,
background: "white",
},
}}
/> />
<Typography variant="subtitle2" className="opacity-07">
{getRuntimeMusic(item?.RunTimeTicks ?? 0)}
</Typography>
</div> </div>
<div <div
className="audio-info-volume"
style={{ style={{
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
@@ -251,154 +202,53 @@ function AudioPlayerRoute() {
width: "100%", width: "100%",
}} }}
> >
<div className="audio-info-controls"> <PlayerVolume
<PlayPreviousButton /> volume={volume}
<IconButton isMuted={isMuted}
onClick={() => { onVolumeChange={setVolume}
if (audioPlayer) { onMuteToggle={() => setIsMuted(!isMuted)}
audioPlayer.currentTime -= SEEK_AMOUNT; />
} </div>
</div>
<div className="audio-right-column">
<Box sx={{ borderBottom: 1, borderColor: "rgba(255,255,255,0.1)" }}>
<Tabs
value={tabValue}
onChange={handleTabChange}
aria-label="audio player tabs"
variant="fullWidth"
scrollButtons="auto"
allowScrollButtonsMobile
textColor="inherit"
indicatorColor="primary"
sx={{
"& .MuiTab-root": {
color: "rgba(255,255,255,0.5)",
"&.Mui-selected": { color: "white" },
},
}} }}
> >
<span className="material-symbols-rounded">fast_rewind</span> <Tab label="Queue" />
</IconButton> <Tab label="Lyrics" />
<Fab <Tab label="Stats" />
disabled={!audioPlayerRef?.current?.readyState} </Tabs>
//@ts-ignore </Box>
color="white"
size="large" <div className="audio-right-content">
onClick={() => {tabValue === 0 && queue && (
audioPlayerRef?.current?.paused <QueuePanel queue={queue} currentTrackIndex={currentTrack} />
? audioPlayerRef?.current?.play()
: audioPlayerRef?.current?.pause()
}
>
<span
className="fill material-symbols-rounded"
style={{
fontSize: "2.4em",
}}
>
{audioPlayerRef?.current?.paused ? "play_arrow" : "pause"}
</span>
</Fab>
<IconButton
onClick={() => {
if (audioPlayer) {
audioPlayer.currentTime += SEEK_AMOUNT;
}
}}
>
<span className="material-symbols-rounded">fast_forward</span>
</IconButton>
<PlayNextButton />
</div>
<IconButton onClick={() => setShowLyrics((s) => !s)}>
<span
className={
showLyrics
? "material-symbols-rounded fill"
: "material-symbols-rounded"
}
>
lyrics
</span>
</IconButton>
</div>
</div>
</div>
{showLyrics && (
<div
className="audio-lyrics"
data-has-synced-lyrics={Boolean(
(lyrics.data?.Lyrics?.[0].Start ?? -1) >= 0,
)} )}
> {tabValue === 1 && (
<div className="audio-lyrics-container" ref={lyricsContainer}> <LyricsPanel item={item} api={api} currentTime={progress} />
{lyrics.data?.Lyrics?.map((lyric, index) => ( )}
<div {tabValue === 2 && (
className="audio-lyrics-line" <StatsPanel item={item} audioRef={audioPlayerRef} />
key={`${lyric.Text}${index}`}
data-active-lyric={
secToTicks(audioPlayer?.currentTime ?? 0) >=
(lyric.Start ?? 0) &&
secToTicks(audioPlayer?.currentTime ?? 0) <
(lyrics.data?.Lyrics?.[index + 1]?.Start ?? 0)
}
>
{lyric.Text}
</div>
))}
</div>
{!((lyrics.data?.Lyrics?.[0].Start ?? -1) >= 0) && (
<Typography
className="flex flex-align-center"
style={{
position: "absolute",
bottom: "-2em",
opacity: 0.7,
gap: "0.4em",
}}
>
<span className="material-symbols-rounded">info</span>
Synced subtitles no available
</Typography>
)} )}
</div> </div>
)}
<DndContext
sensors={sensors}
collisionDetection={closestCenter}
onDragEnd={handleDragEnd}
onDragStart={(event) => {
const { active } = event;
setCurrentDraggingIndex(
queue?.map((item) => item.Id).indexOf(String(active.id) ?? "") ?? 0,
);
}}
modifiers={[restrictToVerticalAxis]}
>
{queue && (
<div className="audio-queue-container">
<Typography variant="h5">Queue:</Typography>
<SortableContext
//@ts-ignore
items={queue?.map((track) => track.Id)}
strategy={verticalListSortingStrategy}
>
<div className="audio-queue">
{queue?.map((track, index) => (
<QueueTrack key={track.Id} track={track} index={index} />
))}
</div> </div>
</SortableContext>
<DragOverlay modifiers={[restrictToWindowEdges]}>
{(currentDraggingIndex ?? -1) >= 0 && (
<div className="audio-queue-track dragging">
<span className="material-symbols-rounded">drag_handle</span>
<div className="audio-queue-track-info">
<Typography className="audio-queue-track-info-name">
{queue[currentDraggingIndex ?? 0].Name}
</Typography>
<Typography
fontWeight={300}
className="opacity-07"
variant="subtitle2"
>
{queue[currentDraggingIndex ?? 0].Artists?.join(", ")}
</Typography>
</div>
<Typography className="opacity-07">
{getRuntimeMusic(
queue[currentDraggingIndex ?? 0].RunTimeTicks ?? 0,
)}
</Typography>
</div>
)}
</DragOverlay>
</div>
)}
</DndContext>
</div> </div>
</>
); );
} }
+78 -32
View File
@@ -8,14 +8,16 @@ import { playItemFromQueue, usePlaybackStore } from "@/utils/store/playback";
import "./videoPlayer.scss"; import "./videoPlayer.scss";
import { PlayMethod, RepeatMode } from "@jellyfin/sdk/lib/generated-client"; import { RepeatMode } from "@jellyfin/sdk/lib/generated-client";
import { useMutation } from "@tanstack/react-query"; import { useMutation } from "@tanstack/react-query";
import { createFileRoute, useRouter } from "@tanstack/react-router"; import { createFileRoute, useRouter } from "@tanstack/react-router";
import JASSUB from "jassub"; import JASSUB from "jassub";
//@ts-expect-error // @ts-expect-error
import workerUrl from "jassub/dist/jassub-worker.js?url"; import wasmUrl from "jassub/dist/wasm/jassub-worker.wasm?url"; // non-SIMD fallback
//@ts-expect-error // @ts-expect-error
import wasmUrl from "jassub/dist/jassub-worker.wasm?url"; import modernWasmUrl from "jassub/dist/wasm/jassub-worker-modern.wasm?url"; // SIMD
// @ts-expect-error
import workerUrl from "jassub/dist/worker/worker.js?url"; // Web Worker
import { PgsRenderer } from "libpgs"; import { PgsRenderer } from "libpgs";
//@ts-expect-error //@ts-expect-error
import pgsWorkerUrl from "libpgs/dist/libpgs.worker.js?url"; import pgsWorkerUrl from "libpgs/dist/libpgs.worker.js?url";
@@ -77,6 +79,9 @@ function addSubtitleTrackToReactPlayer(
}); });
videoElem.appendChild(track); videoElem.appendChild(track);
if (track.track) {
track.track.mode = "showing";
}
} }
} }
@@ -114,6 +119,7 @@ export function VideoPlayer() {
itemName, itemName,
isEpisode, isEpisode,
episodeTitle, episodeTitle,
initializeVolume,
} = usePlaybackStore( } = usePlaybackStore(
useShallow((state) => ({ useShallow((state) => ({
itemId: state.metadata.item?.Id, itemId: state.metadata.item?.Id,
@@ -144,9 +150,14 @@ export function VideoPlayer() {
registerPlayerActions: state.registerPlayerActions, registerPlayerActions: state.registerPlayerActions,
setIsUserHovering: state.setIsUserHovering, setIsUserHovering: state.setIsUserHovering,
handleOnSeek: state.handleOnSeek, handleOnSeek: state.handleOnSeek,
initializeVolume: state.initializeVolume,
})), })),
); );
useEffect(() => {
initializeVolume();
}, [initializeVolume]);
const [currentQueueItemIndex, queue] = useQueue((s) => [ const [currentQueueItemIndex, queue] = useQueue((s) => [
s.currentItemIndex, s.currentItemIndex,
s.tracks, s.tracks,
@@ -176,7 +187,9 @@ export function VideoPlayer() {
if (navigator.mediaSession && mediaSource) { if (navigator.mediaSession && mediaSource) {
navigator.mediaSession.metadata = new MediaMetadata({ navigator.mediaSession.metadata = new MediaMetadata({
title: isEpisode ? episodeTitle : (itemName ?? "Blink"), title: isEpisode
? `${itemName} - ${episodeTitle}`
: (itemName ?? "Blink"),
album: isEpisode ? (itemName ?? "Blink") : undefined, album: isEpisode ? (itemName ?? "Blink") : undefined,
artwork: [ artwork: [
{ {
@@ -217,6 +230,8 @@ export function VideoPlayer() {
}); });
} }
console.log(mediaSource.subtitle);
registerPlayerActions({ registerPlayerActions({
seekTo: (seconds: number) => { seekTo: (seconds: number) => {
const internalPlayer = player.current; const internalPlayer = player.current;
@@ -247,7 +262,7 @@ export function VideoPlayer() {
IsPaused: false, IsPaused: false,
ItemId: itemId, ItemId: itemId,
MediaSourceId: mediaSource.id, MediaSourceId: mediaSource.id,
PlayMethod: PlayMethod.DirectPlay, PlayMethod: mediaSource.playMethod,
PlaySessionId: playsessionId, PlaySessionId: playsessionId,
PlaybackStartTimeTicks: userDataLastPlayedPositionTicks, PlaybackStartTimeTicks: userDataLastPlayedPositionTicks,
PositionTicks: userDataLastPlayedPositionTicks, PositionTicks: userDataLastPlayedPositionTicks,
@@ -290,7 +305,7 @@ export function VideoPlayer() {
IsPaused: !isPlayerPlaying, IsPaused: !isPlayerPlaying,
ItemId: itemId, ItemId: itemId,
MediaSourceId: mediaSource.id, MediaSourceId: mediaSource.id,
PlayMethod: PlayMethod.DirectPlay, PlayMethod: mediaSource.playMethod,
PlaySessionId: playsessionId, PlaySessionId: playsessionId,
PlaybackStartTimeTicks: userDataLastPlayedPositionTicks, PlaybackStartTimeTicks: userDataLastPlayedPositionTicks,
PositionTicks: ticks, PositionTicks: ticks,
@@ -310,6 +325,45 @@ export function VideoPlayer() {
volume, volume,
]); ]);
const handlePause = useCallback(async () => {
if (!api) {
console.warn("API is not available, cannot report playback paused.");
return;
}
let currentTime = 0;
if (player.current) {
currentTime = player.current.currentTime ?? 0;
}
// Report Jellyfin server: Playback has been paused
getPlaystateApi(api).reportPlaybackProgress({
playbackProgressInfo: {
AudioStreamIndex: mediaSource.audioTrack,
CanSeek: true,
IsMuted: isPlayerMuted,
IsPaused: true,
ItemId: itemId,
MediaSourceId: mediaSource.id,
PlayMethod: mediaSource.playMethod,
PlaySessionId: playsessionId,
PlaybackStartTimeTicks: userDataLastPlayedPositionTicks,
PositionTicks: secToTicks(currentTime),
RepeatMode: RepeatMode.RepeatNone,
VolumeLevel: Math.floor(volume * 100),
},
});
}, [setCurrentTime,
api,
mediaSource,
isPlayerMuted,
isPlayerPlaying,
itemId,
playsessionId,
userDataLastPlayedPositionTicks,
volume,]);
const handleExitPlayer = useCallback(async () => { const handleExitPlayer = useCallback(async () => {
appWindow.getCurrent().setFullscreen(false); appWindow.getCurrent().setFullscreen(false);
@@ -417,11 +471,15 @@ export function VideoPlayer() {
) { ) {
jassubRenderer = new JASSUB({ jassubRenderer = new JASSUB({
video: internalPlayer, video: internalPlayer,
subUrl: `${api?.basePath}${mediaSource.subtitle.url}`,
availableFonts: { "noto sans": font },
defaultFont: "noto sans",
workerUrl, workerUrl,
wasmUrl, wasmUrl,
subUrl: `${api?.basePath}${mediaSource.subtitle.url}${urlParams}`, modernWasmUrl,
availableFonts: { "noto sans": font }, });
fallbackFont: "noto sans", jassubRenderer.ready.then(() => {
console.log("JASSUB subtitle renderer is ready");
}); });
} else if ( } else if (
mediaSource.subtitle.format === "subrip" || mediaSource.subtitle.format === "subrip" ||
@@ -458,7 +516,12 @@ export function VideoPlayer() {
} }
} }
} }
}, [mediaSource.subtitle?.track, mediaSource.subtitle?.enable]); }, [
mediaSource.subtitle?.track,
mediaSource.subtitle?.enable,
isPlayerReady,
api,
]);
const handlePlaybackEnded = useCallback(() => { const handlePlaybackEnded = useCallback(() => {
if (queue?.length !== currentQueueItemIndex + 1) { if (queue?.length !== currentQueueItemIndex + 1) {
@@ -469,25 +532,6 @@ export function VideoPlayer() {
} }
}, []); }, []);
// useEffect(() => {
// async function setVolumeInServer() {
// if (!api) return null;
// await getDisplayPreferencesApi(api).updateDisplayPreferences({
// userId: user?.Id,
// client: "blink",
// displayPreferencesId: api.deviceInfo.id,
// displayPreferencesDto: {
// CustomPrefs: {
// Volume: String(playerVolume),
// },
// },
// });
// }
// if (user?.Id && initVolume !== playerVolume && initVolume !== undefined) {
// setVolumeInServer();
// }
// }, [playerVolume]);
const idleTimerRef = useRef<NodeJS.Timeout | null>(null); const idleTimerRef = useRef<NodeJS.Timeout | null>(null);
// Function to clear the existing idle timer // Function to clear the existing idle timer
@@ -587,13 +631,15 @@ export function VideoPlayer() {
ref={player} ref={player}
onReady={handleReady} onReady={handleReady}
onTimeUpdate={handleTimeUpdate} onTimeUpdate={handleTimeUpdate}
onPause={handlePause}
onPlay={handleTimeUpdate}
onError={handleError} onError={handleError}
onEnded={handlePlaybackEnded} onEnded={handlePlaybackEnded}
width="100vw" width="100vw"
height="100vh" height="100vh"
style={{ style={{
position: "fixed", position: "fixed",
zIndex: 1, zIndex: 0,
}} }}
volume={isPlayerMuted ? 0 : volume} volume={isPlayerMuted ? 0 : volume}
onWaiting={handleOnBuffer} onWaiting={handleOnBuffer}
+1 -247
View File
@@ -129,253 +129,7 @@ $border-radius: 20px;
} }
} }
} }
$cardWidth: 22%;
.item-playlist.item {
.item-hero {
height: 50vh;
gap: 2em;
position: relative;
align-items: center;
&-image {
opacity: 0;
width: 100%;
object-fit: contain;
transition: opacity $transition-time-default;
&-container {
height: fit-content;
max-height: 100%;
overflow: hidden;
border-radius: $border-radius-default;
box-shadow: $shadow-card;
flex-grow: 1;
flex-shrink: 0;
position: relative;
}
&-blurhash {
position: absolute !important;
width: 100% !important;
height: 100% !important;
z-index: -1;
}
}
&-logo {
max-width: 42rem;
max-height: 10rem;
opacity: 0;
transition: opacity $transition-time-default;
object-position: bottom;
}
&-detail {
width: 100%;
align-items: flex-start;
gap: 1em;
justify-content: end;
}
&-buttons {
&-container {
align-items: center;
justify-content: space-between;
width: 100%;
}
}
&-backdrop {
width: 100vw;
height: 100vh;
object-fit: cover;
object-position: top;
opacity: 0;
transition: opacity $transition-time-default;
&-container {
filter: brightness(0.8);
position: absolute;
top: -4.4em;
left: -$page-margin;
width: 100vw;
height: calc(50vh + 4.4em);
z-index: -1;
mask-image: linear-gradient(to top, transparent, black);
-webkit-mask-image: linear-gradient(to top,
transparent,
black);
}
}
}
.item-hero {
height: 60vh;
gap: 2em;
row-gap: 1.2em;
position: relative;
align-items: flex-end;
margin-bottom: 1em;
display: grid;
grid-template-columns: $cardWidth 1fr;
grid-template-rows: 1fr auto;
&-image {
opacity: 0;
width: 100%;
object-fit: contain;
transition: opacity $transition-time-default;
&-container {
height: fit-content;
max-height: 100%;
overflow: hidden;
border-radius: $border-radius-default;
box-shadow: $shadow-card;
flex-grow: 1;
flex-shrink: 0;
position: relative;
width: 100%;
}
&-blurhash {
position: absolute !important;
width: 100% !important;
height: 100% !important;
z-index: -1;
}
&-icon {
background: linear-gradient(45deg, rgb(255 255 255 / 0.05), rgb(255 255 255 / 0.15));
height: 100%;
display: flex;
align-items: center;
justify-content: center;
.material-symbols-rounded {
font-size: 4em;
}
}
}
&-logo {
max-width: 34rem;
max-height: 10rem;
opacity: 0;
transition: opacity $transition-time-default;
object-position: bottom;
margin-bottom: 2em;
}
&-detail {
width: 100%;
align-items: flex-start;
gap: 0.2em;
justify-content: end;
}
&-buttons {
&-container {
align-items: center;
justify-content: space-between;
width: 100%;
grid-column: 1/3;
display: grid;
grid-template-columns: inherit;
gap: 2em;
}
}
&-backdrop {
width: 100vw;
height: 100vh;
object-fit: cover;
object-position: top;
opacity: 0;
transition: opacity $transition-time-default;
&-container {
filter: brightness(0.8);
position: absolute;
top: -4.4em;
left: -$page-margin;
width: 100vw;
height: calc(54vh + 4.4em);
z-index: -1;
mask-image: linear-gradient(to top, transparent, black);
-webkit-mask-image: linear-gradient(to top,
transparent,
black);
}
}
& .play-button {
width: 100% !important;
}
}
.item-detail {
display: grid;
grid-template-columns: 1fr 35%;
justify-items: center;
align-items: start;
gap: 3em;
&-cast {
max-height: 50vh;
overflow-y: auto;
overflow-x: hidden;
mask-image: linear-gradient(to top, transparent, black 1.2em);
-webkit-mask-image: linear-gradient(to top, transparent, black 1.2em);
&-title {
position: sticky;
top: 0;
background: black;
border: 1px solid rgb(255 255 255 / 0.2);
padding: 0.35em;
border-radius: 10px;
z-index: 1;
}
&-container {
display: flex;
flex-direction: column;
gap: 1em;
}
&-grid {
display: grid;
gap: 1em;
margin-bottom: 1em;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
&-card {
display: grid;
grid-template-columns: 6em 1fr;
gap: 0.5em;
align-items: center;
color: white !important;
text-decoration: none;
padding: 0.5em;
background: rgb(255 255 255 / 0);
transition: background $transition-time-default;
border-radius: $border-radius-default;
&:hover {
background: rgb(255 255 255 / 0.1);
}
&-image,
&-icon {
width: 6em;
height: 6em;
object-fit: cover;
border-radius: 100%;
box-shadow: $shadow-card-image;
}
&-icon {
display: flex;
align-items: center;
justify-content: center;
font-size: 1em;
background: rgb(255 255 255 / 0.1);
.material-symbols-rounded {
font-size: 3em;
}
}
}
}
&-link {
color: white;
text-decoration-color: rgb(255 255 255 / 0.5);
&:hover {
text-decoration-color: white;
}
}
&-episodes-container {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 0.25em;
margin-top: 0.5em;
align-items: start;
justify-items: center;
}
}
}
@media (max-width: 1320px) { @media (max-width: 1320px) {
.item-playlist .item-detail { .item-playlist .item-detail {
&-cast { &-cast {
+530 -347
View File
@@ -1,23 +1,36 @@
import React, { useEffect, useState } from "react";
import TextField from "@mui/material/TextField";
import { useBackdropStore } from "@/utils/store/backdrop";
import { useQuery } from "@tanstack/react-query";
import { EmptyNotice } from "@/components/notices/emptyNotice/emptyNotice";
import { Card } from "@/components/card/card";
import CardScroller from "@/components/cardScroller/cardScroller";
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client"; import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api"; import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
import { getPersonsApi } from "@jellyfin/sdk/lib/utils/api/persons-api"; import { getPersonsApi } from "@jellyfin/sdk/lib/utils/api/persons-api";
import { getSearchApi } from "@jellyfin/sdk/lib/utils/api/search-api"; import { getSearchApi } from "@jellyfin/sdk/lib/utils/api/search-api";
import { useQuery } from "@tanstack/react-query";
import React, { useCallback, useEffect, useMemo, useState } from "react";
import { Card } from "@/components/card/card";
import CardScroller from "@/components/cardScroller/cardScroller";
import { useBackdropStore } from "@/utils/store/backdrop";
import "./search.scss"; import "./search.scss";
import {
AppBar,
Box,
Chip,
Fade,
FormControl,
Grow,
IconButton,
InputBase,
MenuItem,
OutlinedInput,
Select,
type SelectChangeEvent,
Typography,
useScrollTrigger,
} from "@mui/material";
import { createFileRoute, Outlet, useNavigate } from "@tanstack/react-router";
import { useShallow } from "zustand/shallow";
import BackButton from "@/components/buttons/backButton";
import { UserAvatarMenu } from "@/components/userAvatarMenu";
import useDebounce from "@/utils/hooks/useDebounce";
import { useCentralStore } from "@/utils/store/central"; import { useCentralStore } from "@/utils/store/central";
import { Fab } from "@mui/material"; import useSearchStore from "@/utils/store/search";
import { Outlet, createFileRoute, useNavigate } from "@tanstack/react-router";
export const Route = createFileRoute("/_api/search/")({ export const Route = createFileRoute("/_api/search/")({
component: SearchPage, component: SearchPage,
@@ -26,358 +39,528 @@ export const Route = createFileRoute("/_api/search/")({
}, },
}); });
const CATEGORIES = [
{ label: "Movies", value: "Movie", kind: BaseItemKind.Movie },
{ label: "TV Shows", value: "Series", kind: BaseItemKind.Series },
{ label: "Episodes", value: "Episode", kind: "Episode" },
{ label: "Music", value: "MusicAlbum", kind: BaseItemKind.MusicAlbum },
{ label: "Artists", value: "MusicArtist", kind: BaseItemKind.MusicArtist },
{ label: "People", value: "Person", kind: "Person" },
{ label: "Books", value: "Book", kind: BaseItemKind.Book },
];
function SearchPage() { function SearchPage() {
const api = Route.useRouteContext().api; const api = Route.useRouteContext().api;
const navigate = useNavigate(); const navigate = useNavigate();
const { query } = Route.useSearch(); const { query } = Route.useSearch();
const [setBackdrop] = useBackdropStore(useShallow((s) => [s.setBackdrop]));
const [searchTerm, setSearchTerm] = useState("");
// const searchParam = useDebounce(query, 500);
const user = useCentralStore((s) => s.currentUser); const user = useCentralStore((s) => s.currentUser);
const itemLimit = 12; const [searchTerm, setSearchTerm] = useState(query ?? "");
const debouncedSearchTerm = useDebounce(searchTerm, 300);
const movies = useQuery({ const [selectedCategories, setSelectedCategories] = useState<string[]>([]);
queryKey: ["search", "items", "Movie", query],
queryFn: async () => {
if (!api) return null;
const result = await getItemsApi(api).getItems({
userId: user?.Id,
searchTerm: query,
includeItemTypes: [BaseItemKind.Movie],
recursive: true,
limit: itemLimit,
});
return result.data;
},
enabled: !!user?.Id,
});
const series = useQuery({
queryKey: ["search", "items", "Series", query],
queryFn: async () => {
if (!api) return null;
const result = await getItemsApi(api).getItems({
userId: user?.Id,
searchTerm: query,
includeItemTypes: [BaseItemKind.Series],
recursive: true,
limit: itemLimit,
});
return result.data;
},
enabled: !!user?.Id,
});
const musicAlbum = useQuery({
queryKey: ["search", "items", "MusicAlbum", query],
queryFn: async () => {
if (!api) return null;
const result = await getItemsApi(api).getItems({
userId: user?.Id,
searchTerm: query,
includeItemTypes: [BaseItemKind.MusicAlbum],
recursive: true,
limit: itemLimit,
});
return result.data;
},
enabled: !!user?.Id,
});
const audio = useQuery({
queryKey: ["search", "items", "Audio", query],
queryFn: async () => {
if (!api) return null;
const result = await getItemsApi(api).getItems({
userId: user?.Id,
searchTerm: query,
includeItemTypes: [BaseItemKind.Audio],
recursive: true,
limit: itemLimit,
});
return result.data;
},
enabled: !!user?.Id,
});
const book = useQuery({
queryKey: ["search", "items", "Book", query],
queryFn: async () => {
if (!api) return null;
const result = await getItemsApi(api).getItems({
userId: user?.Id,
searchTerm: query,
includeItemTypes: [BaseItemKind.Book],
recursive: true,
limit: itemLimit,
});
return result.data;
},
enabled: !!user?.Id,
});
const musicArtists = useQuery({
queryKey: ["search", "items", "MusicArtists", query],
queryFn: async () => {
if (!api) return null;
const result = await getItemsApi(api).getItems({
userId: user?.Id,
searchTerm: query,
includeItemTypes: [BaseItemKind.MusicArtist],
recursive: true,
limit: itemLimit,
});
return result.data;
},
enabled: !!user?.Id,
});
const person = useQuery({
queryKey: ["search", "items", "Person", query],
queryFn: async () => {
if (!api) return null;
const result = await getPersonsApi(api).getPersons({
userId: user?.Id,
searchTerm: query,
limit: itemLimit,
});
return result.data;
},
enabled: !!user?.Id,
});
const episodes = useQuery({
queryKey: ["search", "items", "Episodes", query],
queryFn: async () => {
if (!api) return null;
const result = await getSearchApi(api).getSearchHints({
userId: user?.Id,
searchTerm: query,
limit: itemLimit,
includeItemTypes: ["Episode"],
});
return result.data;
},
enabled: !!user?.Id,
});
const [setBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
useEffect(() => { useEffect(() => {
// Removing app's backdrop if (query && query !== searchTerm) {
setBackdrop("", ""); setSearchTerm(query);
}
}, [query]);
useEffect(() => {
if (debouncedSearchTerm !== query) {
navigate({
to: "/search",
search: { query: debouncedSearchTerm ?? "" },
replace: true,
});
}
}, [debouncedSearchTerm, navigate]);
useEffect(() => {
setBackdrop("");
}, []); }, []);
return ( const handleCategoryChange = (event: SelectChangeEvent<string[]>) => {
<div const {
className="scrollY" target: { value },
style={{ } = event;
paddingTop: "4.2em", setSelectedCategories(typeof value === "string" ? value.split(",") : value);
display: "flex", };
flexDirection: "column",
gap: "0.5em",
paddingBottom: "2em",
}}
>
<div className="search-header">
<TextField
variant="outlined"
style={{
width: "50%",
}}
placeholder="Search"
hiddenLabel
className="search-searchbar"
slotProps={{
input: {
style: {
border: "100px !important",
},
autoFocus: true,
},
htmlInput: {
className: "search-searchbar-input",
},
}}
value={searchTerm}
onChange={(e) => setSearchTerm(e.currentTarget.value)}
/>
<Fab
size="medium"
onClick={() =>
navigate({ search: { query: searchTerm }, replace: true })
}
>
<span className="material-symbols-rounded">search</span>
</Fab>
</div>
<div
style={{
height: "100%",
}}
>
{movies.isSuccess && Boolean(movies.data?.Items?.length) && (
<CardScroller title="Movies" displayCards={7} disableDecoration>
{movies.data?.Items?.map((item) => (
<Card
key={item.Id}
item={item}
cardTitle={item.Name}
imageType={"Primary"}
cardCaption={item.ProductionYear}
cardType="portrait"
queryKey={["search", "items", "Movie", query]}
userId={user?.Id}
/>
))}
</CardScroller>
)}
{series.isSuccess && Boolean(series.data?.Items?.length) && (
<CardScroller title="TV Shows" displayCards={7} disableDecoration>
{series.data?.Items?.map((item) => (
<Card
key={item.Id}
item={item}
cardTitle={item.Name}
imageType={"Primary"}
cardCaption={`${item.ProductionYear} - ${
item.EndDate
? new Date(item.EndDate).toLocaleString([], {
year: "numeric",
})
: "Present"
}`}
cardType="portrait"
queryKey={["search", "items", "Series", query]}
userId={user?.Id}
/>
))}
</CardScroller>
)}
{episodes.isSuccess && Boolean(episodes.data?.TotalRecordCount) && (
<CardScroller title="Episodes" displayCards={4} disableDecoration>
{episodes.data?.SearchHints?.map((episode) => {
return (
<Card
key={episode.Id}
item={episode}
cardTitle={episode.Series}
cardType="thumb"
cardCaption={`S${episode.ParentIndexNumber}:E${episode.IndexNumber} - ${episode.Name}`}
queryKey={["search", "items", "Episodes", query]}
userId={user?.Id}
/>
);
})}
</CardScroller>
)}
{audio.isSuccess && Boolean(audio.data?.Items?.length) && (
<CardScroller title="Audio" displayCards={7} disableDecoration>
{audio.data?.Items?.map((item) => (
<Card
key={item.Id}
item={item}
cardTitle={item.Name}
imageType={"Primary"}
cardCaption={item.ProductionYear}
cardType="square"
queryKey={["search", "items", "Audio", query]}
userId={user?.Id}
/>
))}
</CardScroller>
)}
{musicAlbum.isSuccess && Boolean(musicAlbum.data?.Items?.length) && (
<CardScroller title="Albums" displayCards={7} disableDecoration>
{musicAlbum.data?.Items?.map((item) => (
<Card
key={item.Id}
item={item}
seriesId={item.SeriesId}
cardTitle={item.Name}
imageType={"Primary"}
cardCaption={item.AlbumArtist}
cardType={"square"}
queryKey={["search", "items", "MusicAlbum", query]}
userId={user?.Id}
/>
))}
</CardScroller>
)}
{book.isSuccess && Boolean(book.data?.Items?.length) && (
<CardScroller title="Books" displayCards={7} disableDecoration>
{book.data?.Items?.map((item) => (
<Card
key={item.Id}
item={item}
cardTitle={item.Name}
imageType={"Primary"}
cardCaption={item.ProductionYear}
disableOverlay
cardType={"portrait"}
queryKey={["search", "items", "Book", query]}
userId={user?.Id}
/>
))}
</CardScroller>
)}
{musicArtists.isSuccess &&
Boolean(musicArtists.data?.Items?.length) && (
<CardScroller title="Artists" displayCards={7} disableDecoration>
{musicArtists.data?.Items?.map((item) => (
<Card
key={item.Id}
item={item}
cardTitle={item.Name}
imageType={"Primary"}
disableOverlay
cardType={"square"}
queryKey={["search", "items", "MusicArtists", query]}
userId={user?.Id}
/>
))}
</CardScroller>
)}
{person.isSuccess && Boolean(person.data?.Items?.length) && (
<CardScroller title="People" displayCards={7} disableDecoration>
{person.data?.Items?.map((item) => (
<Card
key={item.Id}
item={item}
cardTitle={item.Name}
imageType={"Primary"}
disableOverlay
cardType={"square"}
queryKey={["search", "items", "Person", query]}
userId={user?.Id}
/>
))}
</CardScroller>
)}
</div>
{movies.isSuccess && const activeCategories = useMemo(() => {
series.isSuccess && if (selectedCategories.length === 0) return CATEGORIES;
audio.isSuccess && return CATEGORIES.filter((cat) => selectedCategories.includes(cat.value));
musicAlbum.isSuccess && }, [selectedCategories]);
book.isSuccess &&
musicArtists.isSuccess && return (
person.isSuccess && <div className="search-page scrollY">
movies.data?.Items?.length === 0 &&
series.data?.Items?.length === 0 &&
audio.data?.Items?.length === 0 &&
musicAlbum.data?.Items?.length === 0 &&
book.data?.Items?.length === 0 &&
musicArtists.data?.Items?.length === 0 &&
person.data?.Items?.length === 0 &&
episodes.data?.SearchHints?.length === 0 && (
<div <div
className={`search-page-bg ${debouncedSearchTerm ? "active" : ""}`}
/>
<SearchAppBar
searchTerm={searchTerm}
setSearchTerm={setSearchTerm}
selectedCategories={selectedCategories}
handleCategoryChange={handleCategoryChange}
handleClearCategories={() => setSelectedCategories([])}
/>
<div
className="search-page-content"
style={{ style={{
height: "calc(100vh - 12em)", paddingTop: "2.4em",
}} }}
> >
<EmptyNotice extraMsg={"Try using different search terms."} /> {debouncedSearchTerm ? (
</div> <SearchResultsList
categories={activeCategories}
query={debouncedSearchTerm}
api={api}
user={user}
/>
) : (
<Fade in timeout={800}>
<Box className="search-empty-state">
<Box className="icon-stack">
<span className="material-symbols-rounded icon-lg">movie</span>
<span className="material-symbols-rounded icon-sm">
music_note
</span>
<span className="material-symbols-rounded icon-md">tv</span>
</Box>
<Typography variant="h4" fontWeight={600} gutterBottom>
Explore your library
</Typography>
<Typography variant="body1" sx={{ opacity: 0.6, maxWidth: 400 }}>
Search for movies, tv shows, music, people and more.
</Typography>
</Box>
</Fade>
)} )}
</div>
<Outlet /> <Outlet />
</div> </div>
); );
} }
interface SearchAppBarProps {
searchTerm: string;
setSearchTerm: (term: string) => void;
selectedCategories: string[];
handleCategoryChange: (event: SelectChangeEvent<string[]>) => void;
handleClearCategories: () => void;
}
function SearchAppBar({
searchTerm,
setSearchTerm,
selectedCategories,
handleCategoryChange,
handleClearCategories,
}: SearchAppBarProps) {
const scrollTrigger = useScrollTrigger({
disableHysteresis: true,
threshold: 20,
});
const appBarStyling = useMemo(
() => ({ backgroundColor: "transparent", paddingRight: "0 !important" }),
[],
);
const navigate = useNavigate();
const handleNavigateToHome = useCallback(() => navigate({ to: "/home" }), []);
const handleNavigateToFavorite = useCallback(() => {
navigate({ to: "/favorite" });
}, []);
const toggleSearchDialog = useSearchStore(
useShallow((s) => s.toggleSearchDialog),
);
return (
<AppBar
className={
scrollTrigger
? "appBar search-header scrolling flex flex-row"
: "appBar search-header flex flex-row"
}
style={appBarStyling}
elevation={0}
color="transparent"
>
<div className="flex flex-row" style={{ gap: "0.6em" }}>
<IconButton disabled>
<div className="material-symbols-rounded">menu</div>
</IconButton>
<BackButton />
<IconButton onClick={handleNavigateToHome}>
<div
className={
location.pathname === "/home"
? "material-symbols-rounded fill"
: "material-symbols-rounded"
}
>
home
</div>
</IconButton>
</div>
<div
className="flex flex-row library-header-center"
style={{ gap: "0.6em" }}
>
<Box className="search-input-container">
<span className="material-symbols-rounded search-icon">search</span>
<InputBase
className="search-input"
placeholder="Search library..."
fullWidth
autoFocus
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
endAdornment={
searchTerm && (
<IconButton
size="small"
onClick={() => setSearchTerm("")}
sx={{ color: "white" }}
>
<span
className="material-symbols-rounded"
style={{ fontSize: "1.2rem" }}
>
close
</span>
</IconButton>
)
}
size="small"
/>
<FormControl size="small" className="search-category-select">
<Select
multiple
displayEmpty
value={selectedCategories}
onChange={handleCategoryChange}
input={
<OutlinedInput
endAdornment={
selectedCategories.length > 0 && (
<IconButton
size="small"
onMouseDown={(e) => {
e.stopPropagation();
}}
onClick={(e) => {
e.stopPropagation();
handleClearCategories();
}}
sx={{ mr: 2, p: 0.5 }}
>
<span
className="material-symbols-rounded"
style={{ fontSize: "1rem" }}
>
close
</span>
</IconButton>
)
}
/>
}
IconComponent={(props) => (
<span
{...props}
className={`material-symbols-rounded ${props.className}`}
>
expand_more
</span>
)}
renderValue={(selected) => {
if (selected.length === 0)
return (
<Typography
variant="body2"
color="textSecondary"
sx={{ opacity: 0.7 }}
>
Types
</Typography>
);
return (
<Box
sx={{
display: "flex",
flexWrap: "nowrap",
gap: 0.5,
overflow: "hidden",
maxWidth: "100%",
maskImage:
"linear-gradient(to right, black 85%, transparent 100%)",
}}
>
{selected.map((value) => {
const label =
CATEGORIES.find((c) => c.value === value)?.label ||
value;
return (
<Chip
key={value}
label={label}
size="small"
sx={{ height: 24 }}
/>
);
})}
</Box>
);
}}
MenuProps={{
PaperProps: {
className: "glass-menu-paper",
},
disableScrollLock: true,
}}
size="small"
>
<MenuItem disabled value="">
<Typography variant="overline" color="textSecondary">
Filter by Type
</Typography>
</MenuItem>
{CATEGORIES.map((cat) => (
<MenuItem key={cat.value} value={cat.value}>
{cat.label}
</MenuItem>
))}
</Select>
</FormControl>
</Box>
</div>
<div className="flex flex-row" style={{ gap: "0.6em" }}>
<IconButton onClick={toggleSearchDialog}>
<span className="material-symbols-rounded">search</span>
</IconButton>
<IconButton onClick={handleNavigateToFavorite}>
<div className="material-symbols-rounded">favorite</div>
</IconButton>
<UserAvatarMenu />
</div>
</AppBar>
);
}
function SearchResultsList({ categories, query, api, user }: any) {
// Lift state to know if we have ANY results
const [resultsStatus, setResultsStatus] = useState<Record<string, boolean>>(
{},
);
const handleResultUpdate = (catValue: string, hasResults: boolean) => {
setResultsStatus((prev) => {
if (prev[catValue] === hasResults) return prev;
return { ...prev, [catValue]: hasResults };
});
};
// Derived state: are *all* queried categories empty?
// We only know for sure if all active categories have reported back false.
// This is tricky with async. A better way implies checking isLoading.
// For now, we render the sections; if they are empty, they render null.
// If ALL render null, we show "No Results".
// Simpler visual fix: Render "No results found" at the bottom if nothing appears?
// No, that looks broken.
// Let's use a timeout or assume if no results update to true after X time.
const _hasAnyResults = Object.values(resultsStatus).some((v) => v);
return (
<Box sx={{ display: "flex", flexDirection: "column", gap: "1em", pb: 4 }}>
{categories.map((cat: any) => (
<CategorySection
key={cat.value}
category={cat}
query={query}
api={api}
user={user}
onResult={(hasItems: boolean) =>
handleResultUpdate(cat.value, hasItems)
}
/>
))}
{/*
Only show "No results" if we are confident.
Since we don't have a global loading state here,
checking `!hasAnyResults` immediately causes flickers.
Better to handle "No results" inside the sections or leave it blank?
User asked for "User needs to know search result is empty".
*/}
<NoResultsDetector
categories={categories}
resultsStatus={resultsStatus}
/>
</Box>
);
}
function NoResultsDetector({ categories, resultsStatus }: any) {
// Wait for all categories to report status
const allReported = categories.every(
(c: any) => resultsStatus[c.value] !== undefined,
);
const hasAny = Object.values(resultsStatus).some((v) => v);
if (allReported && !hasAny) {
return (
<Fade in>
<Box className="search-no-results">
<Typography variant="h6">No results found</Typography>
<Typography variant="body2" sx={{ opacity: 0.6 }}>
Try adjusting your search or filters.
</Typography>
</Box>
</Fade>
);
}
return null;
}
function CategorySection({ category, query, api, user, onResult }: any) {
const limit = 20;
const { data, isLoading } = useQuery({
queryKey: ["search", "category", category.value, query],
queryFn: async () => {
if (!api || !user?.Id) return { items: [], total: 0 };
if (category.value === "Person") {
const res = await getPersonsApi(api).getPersons({
userId: user.Id,
searchTerm: query,
limit,
});
return { items: res.data.Items, total: res.data.TotalRecordCount };
}
if (category.value === "Episode") {
const res = await getSearchApi(api).getSearchHints({
userId: user.Id,
searchTerm: query,
limit,
includeItemTypes: ["Episode"],
});
return {
items: res.data.SearchHints,
total: res.data.TotalRecordCount,
};
}
const res = await getItemsApi(api).getItems({
userId: user.Id,
searchTerm: query,
includeItemTypes: [category.kind],
recursive: true,
limit,
});
return { items: res.data.Items, total: res.data.TotalRecordCount };
},
enabled: !!query,
});
useEffect(() => {
if (!isLoading && data) {
onResult((data.items?.length || 0) > 0);
} else if (!isLoading && !data) {
onResult(false);
}
}, [data, isLoading, onResult]);
if (isLoading) return <CategorySkeleton />;
if (!data?.items || data.items.length === 0) return null;
// ... (Card mapping logic same as before) ...
return (
<Grow in>
<div>
<CardScroller
title={category.label}
displayCards={category.value === "Episode" ? 4 : 7}
disableDecoration
>
{data.items.map((item: any) => {
let props: any = {
cardTitle: item?.Name,
imageType: "Primary",
cardCaption: item?.ProductionYear,
cardType: "portrait",
};
if (category.value === "Series") {
props.cardCaption = `${item.ProductionYear || ""}`;
} else if (
category.value === "MusicAlbum" ||
category.value === "MusicArtist" ||
category.value === "Person"
) {
props.cardType = "square";
} else if (category.value === "Episode") {
props = {
cardTitle: item.Series,
imageType: "Primary",
cardCaption: `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`,
cardType: "thumb",
};
}
return (
<Card
key={item.Id}
item={item}
{...props}
queryKey={["search", "category", category.value, query]}
userId={user?.Id}
/>
);
})}
</CardScroller>
</div>
</Grow>
);
}
function CategorySkeleton() {
return (
<Box sx={{ mb: 4, ml: 2, mr: 2 }}>
<Box
sx={{
height: 32,
width: 200,
bgcolor: "rgba(255,255,255,0.05)",
borderRadius: 2,
mb: 2,
}}
/>
<Box sx={{ display: "flex", gap: 2, overflow: "hidden" }}>
{[1, 2, 3, 4, 5, 6].map((i) => (
<Box
key={i}
sx={{
height: 260,
minWidth: 170,
bgcolor: "rgba(255,255,255,0.03)",
borderRadius: 3,
}}
/>
))}
</Box>
</Box>
);
}
export default SearchPage; export default SearchPage;
+179 -13
View File
@@ -1,23 +1,189 @@
.search { .search-page {
&-header { position: relative;
min-height: 100vh;
display: flex;
flex-direction: column;
// Glossy subtle background animation - fixed to viewport so it stays while scrolling
&-bg {
position: fixed;
top: -50%;
left: -50%;
right: -50%;
bottom: -50%;
background: radial-gradient(circle at center, rgba(var(--mui-palette-primary-mainChannel), 0.15) 0%, transparent 60%);
opacity: 0;
transition: opacity 0.8s ease;
pointer-events: none;
z-index: 0;
&.active {
opacity: 1;
}
}
// New Sticky AppBar styles mirroring LibraryHeader exactly
.search-header {
display: flex;
align-items: center;
justify-content: space-between;
inset: 1em 1em auto 1em !important;
border-radius: 9999px;
margin: 0 auto;
position: fixed;
width: calc(100vw - 4em) !important;
z-index: 100;
padding: 0.25em !important;
transition: all 0.2s ease-in-out;
&::after {
content: "";
position: absolute;
inset: 0 -0.35em;
pointer-events: none;
border-radius: inherit;
@include glass-effect;
opacity: 0;
z-index: -1;
transition: all $transition-time-fast;
}
&.scrolling {
&::after {
opacity: 1;
}
}
}
&-content {
flex-grow: 1;
width: 100%; width: 100%;
align-self: center;
z-index: 1;
}
// Input Container adapted for the pill header
.search-input-container {
display: flex;
align-items: center;
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 9999px; // Match pill
padding: 2px 4px 2px 16px;
flex-grow: 1;
width: 100%;
max-width: 800px;
transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
height: 48px; // Match library header elements roughly
&:hover, &:focus-within {
background: rgba(255, 255, 255, 0.1);
border-color: rgba(255, 255, 255, 0.15);
}
.search-category-select {
flex-shrink: 0;
max-width: 40%;
.MuiSelect-select {
padding-right: 24px !important; // Make room for clear icon inside select if needed, though we put it in EndAdornment
}
}
}
.search-input {
flex-grow: 1;
.MuiInputBase-input {
font-size: 1rem;
padding: 4px 8px;
color: white;
&::placeholder {
opacity: 0.6;
}
}
.search-icon {
font-size: 1.2rem;
opacity: 0.7;
margin-right: 8px;
}
}
.search-category-select {
flex-shrink: 0;
min-width: 120px;
margin-left: 8px;
.MuiOutlinedInput-root {
border-radius: 20px;
background-color: transparent ;
color: rgba(255, 255, 255, 0.9);
height: 36px;
font-size: 0.85rem;
transition: all 0.2s ease;
fieldset { border: none; }
&:hover {
background-color: rgba(255, 255, 255, 0.05);
}
}
}
&-empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 60vh; // Take up vertical space to look nice
text-align: center;
width: 100%;
.icon-stack {
position: relative;
height: 120px;
width: 200px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 1em; margin-bottom: 24px;
height: 4em;
.icon-lg {
font-size: 5rem;
z-index: 2;
color: var(--mui-palette-primary-main);
filter: drop-shadow(0 0 20px rgba(var(--mui-palette-primary-mainChannel), 0.4));
} }
&-searchbar { .icon-md {
border-radius: 100px !important; font-size: 3.5rem;
background: rgb(255 255 255 / 0.09); position: absolute;
border: none !important; right: 30px;
.MuiInputBase-root { top: 10px;
border-radius: 100px !important; opacity: 0.4;
transform: rotate(15deg);
} }
&-input { .icon-sm {
text-align: center; font-size: 3rem;
padding: 0.8em 1.5em !important; position: absolute;
left: 40px;
bottom: 10px;
opacity: 0.3;
transform: rotate(-10deg);
} }
} }
}
&-no-results {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 4em;
opacity: 0.7;
}
} }
+6 -7
View File
@@ -303,7 +303,12 @@ function SeriesTitlePage() {
className="scrollY padded-top flex flex-column item item-series" className="scrollY padded-top flex flex-column item item-series"
ref={containerRef} ref={containerRef}
> >
<ItemHeader item={item.data} api={api} scrollTargetRef={containerRef}> <ItemHeader
item={item.data}
api={api}
scrollTargetRef={containerRef}
backdropSrc={backdropImage.url}
>
<div className="item-hero-buttons-container"> <div className="item-hero-buttons-container">
<div <div
className="flex flex-row" className="flex flex-row"
@@ -314,9 +319,6 @@ function SeriesTitlePage() {
<PlayButton <PlayButton
item={item.data} item={item.data}
itemType={BaseItemKind.Series} itemType={BaseItemKind.Series}
currentAudioTrack={0}
currentVideoTrack={0}
currentSubTrack="nosub"
userId={user?.Id} userId={user?.Id}
buttonProps={{ buttonProps={{
fullWidth: true, fullWidth: true,
@@ -752,9 +754,6 @@ function SeriesTitlePage() {
item={episode} item={episode}
itemType={BaseItemKind.Episode} itemType={BaseItemKind.Episode}
userId={user?.Id} userId={user?.Id}
currentAudioTrack={0}
currentVideoTrack={0}
currentSubTrack="nosub"
size="medium" size="medium"
buttonProps={{ buttonProps={{
//@ts-expect-error //@ts-expect-error
-85
View File
@@ -2,91 +2,6 @@ $cardWidth: 18%;
.item-series.item { .item-series.item {
gap: 1em; gap: 1em;
.item-hero {
height: 60vh;
gap: 2em;
row-gap: 1.2em;
position: relative;
align-items: flex-end;
margin-bottom: 1em;
display: grid;
grid-template-columns: $cardWidth 1fr;
grid-template-rows: 1fr auto;
&-image {
opacity: 0;
width: 100%;
object-fit: contain;
transition: opacity $transition-time-default;
&-container {
height: fit-content;
max-height: 100%;
overflow: hidden;
border-radius: $border-radius-default;
box-shadow: $shadow-card;
flex-grow: 1;
flex-shrink: 0;
position: relative;
width: 100%;
}
&-blurhash {
position: absolute !important;
width: 100% !important;
height: 100% !important;
z-index: -1;
}
}
&-logo {
max-width: 34rem;
max-height: 10rem;
opacity: 0;
transition: opacity $transition-time-default;
object-position: bottom;
margin-bottom: 2em;
}
&-detail {
width: 100%;
align-items: flex-start;
gap: 0.2em;
justify-content: end;
}
&-buttons {
&-container {
align-items: center;
justify-content: space-between;
width: 100%;
grid-column: 1/3;
display: grid;
grid-template-columns: inherit;
gap: 2em;
}
}
&-backdrop {
width: 100vw;
height: 100vh;
object-fit: cover;
object-position: top;
opacity: 0;
transition: opacity $transition-time-default;
&-container {
filter: brightness(0.8);
position: absolute;
top: -4.4em;
left: -$page-margin;
width: 100vw;
height: calc(54vh + 4.4em);
z-index: -1;
mask-image: linear-gradient(to top, transparent, black);
-webkit-mask-image: linear-gradient(
to top,
transparent,
black
);
}
}
& .play-button {
width: 100% !important;
}
}
.item-detail { .item-detail {
display: grid; display: grid;
+127 -29
View File
@@ -1,3 +1,5 @@
@use "../../styles/variables.scss" as *;
.settings { .settings {
&-page { &-page {
&-container { &-container {
@@ -16,53 +18,149 @@
&-form{ &-form{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: flex-end; align-items: stretch;
justify-content: flex-start; justify-content: flex-start;
gap: 1em; gap: 1.5em;
width: 100%; width: 100%;
margin-top: 2em; margin-top: 2em;
button[type="submit"] {
align-self: flex-end;
min-width: 10em;
}
}
&-option {
width: 100%;
margin: 0 !important;
justify-content: space-between;
padding: 1em 0;
/* Ensure the label text takes available space */
.MuiFormControlLabel-label {
flex-grow: 1;
}
&-info {
display: flex;
flex-direction: column;
gap: 0.25em;
padding-right: 1em;
&-caption {
opacity: 0.7;
}
}
} }
&-sidebar { &-sidebar {
// padding-top: 4.4em !important; display: flex;
flex-direction: column;
align-items: stretch;
justify-content: flex-start;
background: $clr-background-dark;
border-right: 1px solid rgba(255, 255, 255, 0.05);
padding: 1.5em 1em; // Reduced padding
gap: 1em; // Reduced gap
&-controls {
display: flex;
align-items: center;
justify-content: space-between;
padding-bottom: 0.5em; // Reduced
// Adjust back button for this context
.MuiIconButton-root {
color: rgba(255,255,255,0.7);
&:hover {
color: white;
background: rgba(255,255,255,0.05);
}
}
}
&-header {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: flex-start; text-align: center;
background: rgb(0 0 0 / 0.4); gap: 0.75em;
border-right: 1px solid rgba(255, 255, 255, 0.12); padding: 1em; // Reduced padding
// padding-top: 1em;s background: rgba(255, 255, 255, 0.03);
&-controls { border-radius: 16px; // Slightly tighter radius
display: flex; border: 1px solid rgba(255, 255, 255, 0.05);
flex-direction: row; transition: all 0.3s ease;
align-items: center;
justify-content: flex-start; &:hover {
gap: 0.5em; background: rgba(255, 255, 255, 0.05);
width: 100%; border-color: rgba(255, 255, 255, 0.1);
padding: 1em; transform: translateY(-2px);
} }
&-header {
display: flex;
align-items: center;
justify-content: flex-start;
width: 100%;
padding: 1em;
flex-direction: row;
gap: 1em;
&-image { &-image {
$size: 3em; $size: 3.5em; // Reduced size slightly (was 4.5em)
width: $size; width: $size;
height: $size; height: $size;
border-radius: 50%; border-radius: 50%;
object-fit: cover;
border: 3px solid rgba(0,0,0,0.2);
box-shadow: 0 8px 16px rgba(0,0,0,0.3);
} }
} }
&-list-item {
width: 100%; &-list {
display: flex;
flex-direction: column;
gap: 0.25em;
// Section headers
.MuiTypography-overline {
color: rgba(255,255,255,0.4);
font-size: 0.7rem;
margin-top: 1em; // Reduced
margin-bottom: 0.25em; // Reduced
padding-left: 12px;
}
&-item {
.MuiButtonBase-root { .MuiButtonBase-root {
border-radius: 5px !important; border-radius: 12px !important;
padding: 8px 12px !important; // Reduced padding
transition: all 0.2s ease;
color: rgba(255,255,255,0.6);
font-weight: 500;
&:hover {
background: rgba(255, 255, 255, 0.05);
color: rgba(255,255,255,0.9);
} }
.material-symbols-rounded {
margin-right: 12px;
opacity: 0.7;
font-size: 20px; // Slightly smaller icons
}
}
&.active .MuiButtonBase-root { &.active .MuiButtonBase-root {
--fill: 1; background: rgba($clr-accent-default, 0.1) !important;
background: $clr-gradient-default; color: $clr-accent-default;
font-weight: 600;
.material-symbols-rounded {
opacity: 1;
font-variation-settings: 'FILL' 1;
}
&::after {
content: '';
position: absolute;
right: 12px;
width: 6px;
height: 6px;
border-radius: 50%;
background: currentColor;
}
}
} }
} }
} }
+49 -8
View File
@@ -30,11 +30,17 @@ function SettingsRoute() {
<div className="settings-sidebar"> <div className="settings-sidebar">
<div className="settings-sidebar-controls"> <div className="settings-sidebar-controls">
<BackButton /> <BackButton />
<IconButton onClick={handleNavigateHome}> <IconButton
onClick={handleNavigateHome}
sx={{
background: "rgba(255, 255, 255, 0.05)",
"&:hover": { background: "rgba(255, 255, 255, 0.1)" },
}}
>
<span className="material-symbols-rounded">home</span> <span className="material-symbols-rounded">home</span>
</IconButton> </IconButton>
</div> </div>
<Divider flexItem />
<div className="settings-sidebar-header"> <div className="settings-sidebar-header">
<img <img
className="settings-sidebar-header-image" className="settings-sidebar-header-image"
@@ -42,27 +48,62 @@ function SettingsRoute() {
alt="user" alt="user"
/> />
<div className="flex flex-column"> <div className="flex flex-column">
<Typography variant="h6">{user?.Name}</Typography> <Typography variant="h6" fontWeight="bold">
<Typography variant="caption" style={{ opacity: 0.5 }}> {user?.Name}
{user?.Policy?.IsAdministrator ? "administrator" : "user"} </Typography>
<Typography variant="body2" sx={{ opacity: 0.5 }}>
{user?.Policy?.IsAdministrator ? "Administrator" : "User"}
</Typography> </Typography>
</div> </div>
</div> </div>
<Divider flexItem variant="middle" />
<List <List
component="nav" component="nav"
aria-label="main mailbox folders" aria-label="settings navigation"
className="settings-sidebar-list" className="settings-sidebar-list"
style={{ sx={{
width: "100%", width: "100%",
padding: 0,
}} }}
> >
<Typography
variant="overline"
sx={{
px: 2,
py: 1,
opacity: 0.5,
fontWeight: "bold",
letterSpacing: "0.1em",
}}
>
General
</Typography>
<ListItemLink <ListItemLink
to="/settings/preferences" to="/settings/preferences"
icon="tune" icon="tune"
primary="Preferences" primary="Preferences"
className="settings-sidebar-list-item" className="settings-sidebar-list-item"
/> />
<ListItemLink
to="/settings/changeServer"
icon="dns"
primary="Servers"
className="settings-sidebar-list-item"
/>
<Typography
variant="overline"
sx={{
px: 2,
py: 1,
mt: 2,
opacity: 0.5,
fontWeight: "bold",
letterSpacing: "0.1em",
}}
>
System
</Typography>
<ListItemLink <ListItemLink
to="/settings/about" to="/settings/about"
icon="info" icon="info"
@@ -0,0 +1,380 @@
import {
alpha,
Button,
Card,
CardActions,
CardContent,
Chip,
Grid,
IconButton,
Typography,
useTheme,
} from "@mui/material";
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { createFileRoute } from "@tanstack/react-router";
import { useSnackbar } from "notistack";
import React, { useState } from "react";
import AddServerDialog from "@/components/addServerDialog";
import CircularPageLoadingAnimation from "@/components/circularPageLoadingAnimation";
import {
delServer,
getAllServers,
getDefaultServer,
setDefaultServer,
} from "@/utils/storage/servers";
import { delUser } from "@/utils/storage/user";
import { useApiInContext } from "@/utils/store/api";
export const Route = createFileRoute("/_api/settings/changeServer/")({
component: ChangeServerRoute,
});
function ChangeServerRoute() {
const _theme = useTheme();
const queryClient = useQueryClient();
const createApi = useApiInContext((s) => s.createApi);
const { enqueueSnackbar } = useSnackbar();
const [addServerDialogOpen, setAddServerDialogOpen] = useState(false);
const serversQuery = useQuery({
queryKey: ["servers"],
queryFn: async () => {
return await getAllServers();
},
});
const activeServerQuery = useQuery({
queryKey: ["activeServer"],
queryFn: async () => {
return await getDefaultServer();
},
});
const handleConnect = async (serverId: string) => {
try {
// Clear current user when switching servers to force login/user fetch
await delUser();
await setDefaultServer(serverId);
const servers = await getAllServers();
const server = servers.find((s) => s.id === serverId);
if (server) {
createApi(server.address);
}
// Reload the page to reset API context and states
window.location.href = "/";
} catch (error) {
console.error("Failed to switch server", error);
enqueueSnackbar("Failed to switch server", { variant: "error" });
}
};
const handleDelete = async (serverId: string) => {
try {
await delServer(serverId);
queryClient.invalidateQueries({ queryKey: ["servers"] });
enqueueSnackbar("Server removed", { variant: "success" });
} catch (error) {
console.error("Failed to delete server", error);
enqueueSnackbar("Failed to delete server", { variant: "error" });
}
};
if (serversQuery.isLoading || activeServerQuery.isLoading) {
return <CircularPageLoadingAnimation />;
}
return (
<div className="settings-page-scrollY">
<div
style={{
marginBottom: "2em",
}}
>
<Typography variant="h4">Servers</Typography>
</div>
<Grid container spacing={3}>
{serversQuery.data?.map((server) => {
const isActive = activeServerQuery.data === server.id;
const spalshUrl =
new URL(server.address).pathname.length > 1
? `${new URL(server.address).origin}${`${new URL(server.address).pathname}/`}Branding/Splashscreen?fillWidth=400&fillHeight=100`
: `${server.address}Branding/Splashscreen?fillWidth=400&fillHeight=100`;
return (
<Grid size={{ xs: 12, sm: 12, md: 6, lg: 4 }} key={server.id}>
<Card
elevation={0}
sx={{
height: "100%",
minHeight: "280px",
display: "flex",
flexDirection: "column",
position: "relative",
overflow: "hidden",
borderRadius: "24px",
transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
border: "1px solid rgba(255, 255, 255, 0.08)",
background: "rgba(30, 30, 35, 0.4)",
boxShadow: "none",
backdropFilter: "blur(12px)",
"&:hover": {
transform: "translateY(-4px)",
boxShadow: "0 12px 40px rgba(0,0,0,0.3)",
borderColor: "rgba(255, 255, 255, 0.2)",
"& .server-card-bg": {
transform: "scale(1.05)",
},
},
}}
>
{/* Standard BG Section / Cover Area */}
<div
className="server-card-bg"
style={{
height: "100px",
width: "100%",
background: "linear-gradient(45deg, #2a2a35, #1a1a20)",
position: "absolute",
top: 0,
left: 0,
zIndex: 0,
transition: "transform 0.4s ease",
}}
>
<img
alt={server.systemInfo?.ServerName || "Unknown Server"}
src={spalshUrl}
style={{
height: "100%",
width: "100%",
objectFit: "cover",
}}
/>
</div>
{isActive && (
<Chip
label="Active"
size="small"
color="primary"
sx={{
fontWeight: "bold",
position: "absolute",
top: 24,
right: 24,
zIndex: 2,
}}
/>
)}
<CardContent
sx={{
flexGrow: 1,
zIndex: 1,
pt: "60px !important", // Push content down to overlap properly
px: 3,
}}
>
<div
style={{
display: "flex",
justifyContent: "space-between",
alignItems: "flex-end",
marginBottom: "1.5rem",
}}
>
<div
style={{
width: "64px",
height: "64px",
borderRadius: "20px",
background: "rgba(30, 30, 40, 0.8)",
backdropFilter: "blur(4px)",
border: "1px solid rgba(255,255,255,0.1)",
display: "flex",
alignItems: "center",
justifyContent: "center",
boxShadow: "0 8px 16px rgba(0,0,0,0.2)",
}}
>
<span
className="material-symbols-rounded"
style={{
fontSize: "32px",
color: "#fff",
opacity: isActive ? 1 : 0.8,
}}
>
dns
</span>
</div>
</div>
<Typography
variant="h5"
component="div"
fontWeight="bold"
noWrap
title={server.systemInfo?.ServerName || "Unknown Server"}
sx={{ mb: 0.5, letterSpacing: "-0.02em" }}
>
{server.systemInfo?.ServerName || "Unknown Server"}
</Typography>
<Typography
variant="body2"
color="text.secondary"
noWrap
title={server.address}
sx={{
opacity: 0.6,
fontFamily: "monospace",
fontSize: "0.85rem",
}}
>
{server.address}
</Typography>
</CardContent>
<CardActions
sx={{
justifyContent: "space-between",
padding: "24px",
zIndex: 1,
mt: "auto",
}}
>
<Button
variant="outlined"
color="error"
size="small"
onClick={() => handleDelete(server.id)}
sx={{
minWidth: "40px",
width: "40px",
height: "40px",
borderRadius: "12px",
p: 0,
border: "1px solid rgba(211, 47, 47, 0.3)",
"&:hover": {
backgroundColor: "rgba(211, 47, 47, 0.1)",
border: "1px solid rgba(211, 47, 47, 0.8)",
},
}}
disabled={isActive}
>
<span className="material-symbols-rounded">delete</span>
</Button>
{!isActive ? (
<Button
variant="contained"
onClick={() => handleConnect(server.id)}
sx={{
borderRadius: "12px",
textTransform: "none",
fontWeight: 600,
px: 3,
}}
>
Connect
</Button>
) : (
<Button
disabled
startIcon={
<span className="material-symbols-rounded">check</span>
}
sx={{
borderRadius: "12px",
textTransform: "none",
fontWeight: 600,
color: "text.primary",
"&.Mui-disabled": {
color: "text.primary",
opacity: 0.7,
},
}}
>
Connected
</Button>
)}
</CardActions>
</Card>
</Grid>
);
})}
{/* Add Server Card */}
<Grid size={{ xs: 12, sm: 12, md: 6, lg: 4 }}>
<Card
onClick={() => setAddServerDialogOpen(true)}
elevation={0}
sx={{
height: "100%",
minHeight: "280px",
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
position: "relative",
borderRadius: "24px",
cursor: "pointer",
background: "rgba(255, 255, 255, 0.02)",
border: "2px dashed rgba(255, 255, 255, 0.1)",
transition: "all 0.2s ease-in-out",
"&:hover": {
background: "rgba(255, 255, 255, 0.05)",
borderColor: "rgba(255, 255, 255, 0.3)",
transform: "translateY(-4px)",
"& .add-icon": {
transform: "scale(1.1) rotate(90deg)",
color: "var(--mui-palette-primary-main)",
},
},
}}
>
<div
className="add-icon"
style={{
width: "80px",
height: "80px",
borderRadius: "50%",
backgroundColor: "rgba(255, 255, 255, 0.05)",
display: "flex",
alignItems: "center",
justifyContent: "center",
marginBottom: "1.5rem",
transition: "all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)",
}}
>
<span
className="material-symbols-rounded"
style={{ fontSize: "40px", opacity: 0.7 }}
>
add
</span>
</div>
<Typography variant="h6" fontWeight="bold">
Add Server
</Typography>
<Typography variant="body2" color="text.secondary" sx={{ mt: 1 }}>
Connect to a new Jellyfin server
</Typography>
</Card>
</Grid>
</Grid>
<AddServerDialog
open={addServerDialogOpen}
setAddServerDialog={setAddServerDialogOpen}
sideEffect={async () => {
await queryClient.invalidateQueries({ queryKey: ["servers"] });
}}
/>
</div>
);
}
+4 -38
View File
@@ -10,16 +10,15 @@ import { createFileRoute } from "@tanstack/react-router";
import React from "react"; import React from "react";
import "../settings.scss"; import "../settings.scss";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import { getLocalizationApi } from "@jellyfin/sdk/lib/utils/api/localization-api"; import { getLocalizationApi } from "@jellyfin/sdk/lib/utils/api/localization-api";
import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
import CircularPageLoadingAnimation from "@/components/circularPageLoadingAnimation";
// import { getDisplayPreferencesApi } from "@jellyfin/sdk/lib/utils/api/display-preferences-api"; // import { getDisplayPreferencesApi } from "@jellyfin/sdk/lib/utils/api/display-preferences-api";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api"; import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { useForm } from "@tanstack/react-form"; import { useForm } from "@tanstack/react-form";
import { useSuspenseQuery } from "@tanstack/react-query";
import { useSnackbar } from "notistack"; import { useSnackbar } from "notistack";
import CircularPageLoadingAnimation from "@/components/circularPageLoadingAnimation";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
export const Route = createFileRoute("/_api/settings/preferences")({ export const Route = createFileRoute("/_api/settings/preferences")({
component: RouteComponent, component: RouteComponent,
@@ -268,39 +267,6 @@ function RouteComponent() {
Save Save
</Button> </Button>
</form> </form>
{/* <FormControlLabel
value={currentCulture}
control={
<TextField select onChange={(e) => setCurrentCulture(e.target.value)}>
<MenuItem key={"anyLanguage"} value={"anyLanguage"}>
Any Language
</MenuItem>
{cultures.data?.map((option) => (
<MenuItem
key={option.ThreeLetterISOLanguageName}
value={option.ThreeLetterISOLanguageName ?? "none"}
>
{option.DisplayName}
</MenuItem>
))}
</TextField>
}
label={
<div className="settings-option-info">
<Typography variant="subtitle1" fontWeight={400}>
{setting.name}
</Typography>
<Typography
variant="caption"
className="settings-option-info-caption"
>
{setting.description}
</Typography>
</div>
}
labelPlacement="start"
className="settings-option"
/> */}
</div> </div>
); );
} }
+63 -35
View File
@@ -1,20 +1,19 @@
import React, { type FormEvent, useState } from "react";
import { setDefaultServer, setServer } from "@/utils/storage/servers";
import LoadingButton from "@mui/lab/LoadingButton"; import LoadingButton from "@mui/lab/LoadingButton";
import { yellow } from "@mui/material/colors";
import Grid from "@mui/material/Grid"; import Grid from "@mui/material/Grid";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import { useMutation } from "@tanstack/react-query";
import { useSnackbar } from "notistack"; import { useSnackbar } from "notistack";
import React, { type FormEvent, useState } from "react";
import { setDefaultServer, setServer } from "@/utils/storage/servers";
import { jellyfin, useApiInContext } from "@/utils/store/api"; import { jellyfin, useApiInContext } from "@/utils/store/api";
import { yellow } from "@mui/material/colors";
import { useMutation } from "@tanstack/react-query";
// SCSS // SCSS
import "./server.scss"; import "./server.scss";
import { Paper, Stack } from "@mui/material";
import { createFileRoute, useNavigate } from "@tanstack/react-router"; import { createFileRoute, useNavigate } from "@tanstack/react-router";
import logo from "../../assets/logoBlackTransparent.png";
export const Route = createFileRoute("/setup/server/add")({ export const Route = createFileRoute("/setup/server/add")({
component: ServerSetup, component: ServerSetup,
@@ -66,17 +65,43 @@ function ServerSetup() {
}); });
return ( return (
<div <div className="centered serverContainer flex flex-column flex-center">
className={"centered serverContainer flex flex-column flex-center"} <Paper
style={{ sx={{
opacity: checkServer.isPending ? "0.5" : "1", p: 4,
transition: "opacity 350ms", width: "100%",
width: "40vw", maxWidth: "40em",
backgroundColor: "rgba(20, 20, 30, 0.7)",
backdropFilter: "blur(24px) saturate(180%)",
backgroundImage:
"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0))",
border: "1px solid rgba(255, 255, 255, 0.08)",
boxShadow: "0 20px 50px rgba(0,0,0,0.5)",
borderRadius: 4,
overflow: "hidden",
}} }}
> >
<div style={{ marginBottom: "1em" }}> <Stack spacing={2} width="30em" alignItems="center">
<Typography variant="h3">Add Server</Typography> <img
</div> src={logo}
alt="Blink"
style={{
width: "200px",
height: "auto",
objectFit: "contain",
}}
/>
<Typography
variant="body1"
color="text.secondary"
textAlign="center"
maxWidth="80%"
sx={{ lineHeight: 1.5 }}
>
Enter your Jellyfin server address to get started
</Typography>
<form <form
onSubmit={(e) => checkServer.mutate(e)} onSubmit={(e) => checkServer.mutate(e)}
className="flex flex-column" className="flex flex-column"
@@ -84,38 +109,41 @@ function ServerSetup() {
> >
<TextField <TextField
className="textbox" className="textbox"
label="Server Address:" placeholder="https://jellyfin.example.com"
fullWidth
variant="outlined" variant="outlined"
// inputRef={serverIp} // inputRef={serverIp}
onChange={(event) => { onChange={(event) => {
setServerIp(event.target.value); setServerIp(event.target.value);
}} }}
InputProps={{
startAdornment: (
<span
className="material-symbols-rounded"
style={{ opacity: 0.5, marginRight: "12px" }}
>
dns
</span>
),
}}
/> />
<LoadingButton <LoadingButton
variant="contained" variant="contained"
sx={{ width: "100%" }} sx={{ width: "100%", borderRadius: 2, height: 48 }}
size="large" size="large"
loading={checkServer.isPending} loading={checkServer.isPending}
endIcon={
<span className="material-symbols-rounded">chevron_right</span>
}
loadingPosition="end"
type="submit" type="submit"
> >
Add Server Connect
</LoadingButton> </LoadingButton>
</form> </form>
<Grid </Stack>
item </Paper>
xl={5} <Stack
md={6} direction="row"
sx={{ spacing={1}
width: "100%", alignItems="center"
display: "flex", sx={{ mt: 3, opacity: 0.6 }}
alignItems: "center",
gap: 1,
opacity: 0.6,
}}
> >
<span <span
className="material-symbols-rounded" className="material-symbols-rounded"
@@ -128,7 +156,7 @@ function ServerSetup() {
<Typography variant="subtitle1"> <Typography variant="subtitle1">
Example: https://demo.jellyfin.org/stable Example: https://demo.jellyfin.org/stable
</Typography> </Typography>
</Grid> </Stack>
</div> </div>
); );
} }
+118 -106
View File
@@ -1,21 +1,7 @@
import React, { useLayoutEffect, useState } from "react";
import Chip from "@mui/material/Chip"; import Chip from "@mui/material/Chip";
import IconButton from "@mui/material/IconButton"; import IconButton from "@mui/material/IconButton";
import Paper from "@mui/material/Paper"; import Paper from "@mui/material/Paper";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import { red } from "@mui/material/colors";
import AppBarBackOnly from "@/components/appBar/backOnly";
import {
type ServerInfo,
delServer,
getAllServers,
getDefaultServer,
setDefaultServer,
} from "@/utils/storage/servers";
import { delUser } from "@/utils/storage/user";
import { useBackdropStore } from "@/utils/store/backdrop";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { import {
createFileRoute, createFileRoute,
@@ -23,7 +9,19 @@ import {
useRouter, useRouter,
} from "@tanstack/react-router"; } from "@tanstack/react-router";
import { useSnackbar } from "notistack"; import { useSnackbar } from "notistack";
import React, { useLayoutEffect, useState } from "react";
import AppBarBackOnly from "@/components/appBar/backOnly";
import {
delServer,
getAllServers,
getDefaultServer,
type ServerInfo,
setDefaultServer,
} from "@/utils/storage/servers";
import { delUser } from "@/utils/storage/user";
import { useBackdropStore } from "@/utils/store/backdrop";
import "./serverList.scss"; import "./serverList.scss";
import { useShallow } from "zustand/shallow";
import AddServerDialog from "@/components/addServerDialog"; import AddServerDialog from "@/components/addServerDialog";
import { useApiInContext } from "@/utils/store/api"; import { useApiInContext } from "@/utils/store/api";
@@ -95,125 +93,139 @@ function ServerList() {
await defaultServer.refetch(); await defaultServer.refetch();
}; };
const setBackdrop = useBackdropStore((state) => state.setBackdrop); const setBackdrop = useBackdropStore(
useShallow((state) => state.setBackdrop),
);
useLayoutEffect(() => { useLayoutEffect(() => {
setBackdrop("", ""); setBackdrop("");
}, []); }, []);
const [addServerDialog, setAddServerDialog] = useState(false); const [addServerDialog, setAddServerDialog] = useState(false);
return ( return (
<div className="server-list"> <div className="server-list flex flex-column flex-center centered">
<AppBarBackOnly /> <AppBarBackOnly />
<Paper
sx={{
p: 4,
width: "100%",
maxWidth: "600px",
backgroundColor: "rgba(20, 20, 30, 0.7)",
backdropFilter: "blur(24px) saturate(180%)",
backgroundImage:
"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0))",
border: "1px solid rgba(255, 255, 255, 0.08)",
boxShadow: "0 20px 50px rgba(0,0,0,0.5)",
borderRadius: 4,
overflow: "hidden",
display: "flex",
flexDirection: "column",
gap: 3,
}}
>
<div <div
style={{ style={{
display: "flex", display: "flex",
justifyContent: "space-between", justifyContent: "space-between",
width: "40vw",
alignItems: "center", alignItems: "center",
marginBottom: "2em",
}} }}
> >
<Typography variant="h3" fontWeight={200}> <Typography variant="h4" fontWeight="bold">
Servers Servers
</Typography> </Typography>
<IconButton <IconButton
style={{
fontSize: "1.64em",
}}
onClick={() => setAddServerDialog(true)} onClick={() => setAddServerDialog(true)}
sx={{
bgcolor: "rgba(255,255,255,0.05)",
"&:hover": { bgcolor: "rgba(255,255,255,0.1)" },
}}
> >
<div className="material-symbols-rounded">add</div> <span className="material-symbols-rounded">add</span>
</IconButton> </IconButton>
</div>
<div className="flex flex-column" style={{ gap: "1em" }}>
{servers.isSuccess &&
servers.data.map((server) => (
<div
key={server.id}
className="server-list-item"
style={{
display: "flex",
alignItems: "center",
padding: "16px",
borderRadius: "16px",
backgroundColor: "rgba(0,0,0,0.2)",
border: "1px solid rgba(255,255,255,0.05)",
gap: "16px",
}}
>
<div
className="material-symbols-rounded"
style={{ fontSize: "24px", opacity: 0.7 }}
>
dns
</div>
<div style={{ flex: 1 }}>
<Typography
variant="h6"
fontWeight={600}
sx={{
display: "flex",
alignItems: "center",
gap: 1,
}}
>
{server.systemInfo?.ServerName}
{server.id === defaultServer.data && (
<Chip
label="Current"
color="primary"
size="small"
sx={{ height: 20, fontSize: "0.7rem", fontWeight: 700 }}
/>
)}
</Typography>
<Typography variant="body2" style={{ opacity: 0.7 }} noWrap>
{server.address}
</Typography>
</div>
<div style={{ display: "flex", gap: "8px" }}>
<IconButton
onClick={() => {
handleServerChange.mutate(server);
}}
disabled={handleServerChange.isPending}
size="small"
sx={{
bgcolor: "rgba(255,255,255,0.05)",
"&:hover": { bgcolor: "var(--mui-palette-primary-main)" },
}}
>
<span className="material-symbols-rounded">login</span>
</IconButton>
<IconButton
onClick={() => handleDelete(server)}
size="small"
sx={{
bgcolor: "rgba(255,255,255,0.05)",
"&:hover": { bgcolor: "var(--mui-palette-error-main)" },
}}
>
<span className="material-symbols-rounded">delete</span>
</IconButton>
</div>
</div>
))}
</div>
</Paper>
<AddServerDialog <AddServerDialog
open={addServerDialog} open={addServerDialog}
sideEffect={() => servers.refetch()} sideEffect={() => servers.refetch()}
setAddServerDialog={setAddServerDialog} setAddServerDialog={setAddServerDialog}
/> />
</div> </div>
<Paper className="server-list-container">
{servers.isSuccess &&
servers.data.map((server) => (
<div key={server.id} className="server-list-item">
<div className="material-symbols-rounded server-list-item-icon">
dns
</div>
<div className="server-list-item-info">
<Typography
variant="h6"
fontWeight={400}
sx={{
display: "flex",
alignItems: "center",
}}
>
{server.systemInfo?.ServerName}
{server.id === defaultServer.data && (
<Chip
label={
<Typography variant="caption" fontWeight={700}>
Current
</Typography>
}
color="info"
sx={{
ml: 2,
width: "5.4em",
}}
size="small"
/>
)}
</Typography>
<Typography
variant="subtitle1"
style={{
opacity: 0.7,
}}
fontWeight={300}
>
{server.address}
</Typography>
<Typography
variant="subtitle2"
style={{
opacity: 0.5,
}}
fontWeight={300}
>
Version: {server.systemInfo?.Version}
</Typography>
</div>
<div className="server-list-item-buttons">
<IconButton
style={{
fontSize: "1.64em",
}}
onClick={() => {
handleServerChange.mutate(server);
}}
disabled={handleServerChange.isPending}
>
<div className="material-symbols-rounded">start</div>
</IconButton>
<IconButton
style={{
fontSize: "1.64em",
color: red[400],
}}
disabled={handleServerChange.isPending}
onClick={() => {
handleDelete(server);
}}
>
<div className="material-symbols-rounded">delete_forever</div>
</IconButton>
</div>
</div>
))}
</Paper>
</div>
); );
} }
export default ServerList; export default ServerList;
+39 -4
View File
@@ -32,6 +32,10 @@ div::-webkit-scrollbar {
background: $clr-secondary-default; background: $clr-secondary-default;
} }
html {
overscroll-behavior: none;
}
body { body {
font-family: "Plus Jakarta Sans Variable",system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; font-family: "Plus Jakarta Sans Variable",system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
background: $clr-background-default; background: $clr-background-default;
@@ -94,6 +98,37 @@ body {
animation: 0.5s fadeOutPage forwards; animation: 0.5s fadeOutPage forwards;
} }
.glass-panel {
@include glass-effect;
}
.glass-menu-paper, .glass-dialog-paper {
@include glass-effect;
border-radius: 16px !important;
}
.glass-menu-paper {
.MuiMenuItem-root {
font-family: inherit;
transition: background-color 0.2s;
border-radius: 8px;
margin: 4px;
&:hover {
background-color: rgba(255, 255, 255, 0.1);
}
&.Mui-selected {
background-color: rgba(255, 255, 255, 0.2) !important;
color: white;
&:hover {
background-color: rgba(255, 255, 255, 0.25) !important;
}
}
}
}
@keyframes fadeInPage { @keyframes fadeInPage {
from { from {
opacity: 0; opacity: 0;
@@ -292,10 +327,10 @@ h1 {
} }
.glass { .glass {
background: rgba(0, 0, 0, 0.6) !important; background-color: rgba(20, 20, 30, 0.7) !important;
backdrop-filter: blur(20px); backdrop-filter: blur(24px) saturate(180%) !important;
border: 1px solid rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.08);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
} }
.opacity-07{ .opacity-07{
+8
View File
@@ -34,3 +34,11 @@ $shadow-card-image: 0 2px 8px rgb(0 0 0 / 0.25);
$clr-background-card-icon: linear-gradient(45deg, rgb(255 255 255 / 0.05), rgb(255 255 255 / 0.2)); $clr-background-card-icon: linear-gradient(45deg, rgb(255 255 255 / 0.05), rgb(255 255 255 / 0.2));
$page-margin: 4em; $page-margin: 4em;
@mixin glass-effect($blur: 24px, $saturation: 180%, $opacity: 0.7, $bg-color: rgba(20, 20, 30, $opacity)) {
background-color: $bg-color;
backdrop-filter: blur($blur) saturate($saturation);
background-image: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
border: 1px solid rgba(255, 255, 255, 0.08);
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
+38
View File
@@ -91,5 +91,43 @@ export const theme = createTheme({
}, },
}, },
}, },
MuiInputLabel: {
styleOverrides: {
root: {
marginLeft: "6px",
color: "rgba(255, 255, 255, 0.5)",
"&.Mui-focused": {
color: clrAccentDefault,
},
},
},
},
MuiOutlinedInput: {
styleOverrides: {
notchedOutline: {
paddingLeft: "15px",
},
root: {
backgroundColor: "rgba(0,0,0,0.2)",
borderRadius: "16px",
transition: "border-color 0.2s, background-color 0.2s",
"&.Mui-focused": {
backgroundColor: "rgba(0,0,0,0.3)",
},
"&:hover": {
backgroundColor: "rgba(0,0,0,0.25)",
},
"& .MuiOutlinedInput-notchedOutline": {
borderColor: "rgba(255,255,255,0.1)",
},
"&:hover .MuiOutlinedInput-notchedOutline": {
borderColor: "rgba(255,255,255,0.3)",
},
"&.Mui-focused .MuiOutlinedInput-notchedOutline": {
borderColor: clrAccentDefault,
},
},
},
},
}, },
}); });
+1 -10
View File
@@ -20,7 +20,7 @@ export default function getSubtitle(
(stream) => stream.Index === track, (stream) => stream.Index === track,
); );
const url = requiredSubtitle?.[0]?.DeliveryUrl; const url = requiredSubtitle?.[0]?.DeliveryUrl;
if (track) { if (track !== undefined && track !== -1) {
return { return {
track, track,
enable: true, enable: true,
@@ -29,13 +29,4 @@ export default function getSubtitle(
url, url,
}; };
} }
if (track === 0) {
return {
track: 0,
enable: false,
format: null,
allTracks: availableSubtitles,
url: null,
};
}
} }
Loaded 100 of 111 files, more files were not shown because too many files have changed in this diff. Show more