Compare commits

..
50 Commits
Author SHA1 Message Date
1xDed b00f93d262 fix: stop artwork/background flashing when pages open
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped
- disable router view transitions (they cross-faded through a black frame)
- keep the last app backdrop instead of clearing it to nothing on navigation
- drop opacity fade-in on cards, hero and detail artwork: cached images must be
  visible on the first paint, not fade from empty
- keep the hero slide mounted so the old image remains until the new one loads
- ambient backdrop falls back to the poster BlurHash for poster-only items
- show the router loader only after 250ms so fast navigations don't blink
2026-11-27 09:20:36 +03:00
1xDed 4c9dd86962 feat(hero): pick the best Jellyfin artwork for the home hero
Jellyfin stores several images per item. Ask /Items/{id}/Images for their real
sizes and use the biggest wide image (Backdrop, then Thumb) for the 16:9 hero.
Poster-only items are no longer stretched: the poster is blurred into an ambient
background with the sharp poster displayed beside the text. The slide element is
kept mounted across changes so the previous artwork stays until the next loads.
2026-11-27 09:20:26 +03:00
1xDed 3131c1f905 fix(dev): keep the MCP bridge capability out of default builds
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped
The bridge needs no capability (it talks to the plugin over its own socket),
and a capability referencing an optional plugin broke builds without the
feature.
2026-11-27 03:14:00 +03:00
1xDed c560f8ae1b chore(dev): optional MCP bridge for UI automation
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped
Enable with: pnpm tauri dev -- --features mcp-bridge (debug only).
2026-11-27 03:11:27 +03:00
1xDed cf5fb43377 fix: stop library cards from jumping while scrolling
- stable measureElement ref (the inline ref re-attached on every render and
  re-triggered measurement, causing continuous row re-layout)
- reactive scrollMargin instead of reading offsetTop once at mount
- size rows from the real card aspect ratio (portrait vs square) and text block
- remove duplicated row padding/gap
2026-11-27 03:11:23 +03:00
1xDed 5a9b3ad273 fix: artwork fallbacks everywhere and hero layout
- resolveItemImage(): try the item's own images, then series/album/parent artwork
- hero sidebar tickers fall back from Thumb to Backdrop/Primary instead of an icon
- hero background falls back to the poster when no backdrop exists
- stop stacked slides when the carousel advances (drop leaking AnimatePresence)
- keep the hero title/logo inside the slide on narrow windows
- sensible slides-per-view on tablet/mobile widths
2026-11-27 03:11:17 +03:00
1xDed 1c499f42ec feat: custom in-app titlebar with overlay window chrome
- macOS: titleBarStyle Overlay + hiddenTitle, traffic lights aligned with the header
- header itself is the titlebar: draggable regions, no native glass strip
- solid (not blurred) header surfaces once content scrolls
- keep traffic lights clear of controls on library/login/settings pages
2026-11-27 03:11:09 +03:00
--remove-section 61ebc66127 feat: redesigned login pages 2026-10-20 18:36:02 +05:30
--remove-section c232c1bf12 feat: added new music player and fix some UI issues 2026-10-20 18:31:09 +05:30
--remove-section 2d5f49c32e fix: player throws error whenever settings panel is openned 2026-10-20 18:08:50 +05:30
--remove-section 0c50acddd9 fix: quickconnect not saving user 2026-10-20 17:55:02 +05:30
--remove-section 56ba65d23e chore(deps); update and migrate to latest node and cargo packages 2026-10-20 17:53:01 +05:30
Prayag Prajapati b8f544b483 Merge pull request #639 from Molier/feat/windows-arm64
feat: add Windows ARM64 build support
2026-10-20 17:13:01 +05:30
Molier 690cfb398c feat: add Windows ARM64 build support
Add windows-11-arm runner to CI and release workflows to produce
native ARM64 Windows installers. Resolves #634.
2026-04-12 19:36:21 +02:00
Prayag Prajapati 45dbfbb7ec refactor: update images 2026-02-10 21:37:30 +05:30
--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
168 changed files with 17567 additions and 14558 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
+28 -114
View File
@@ -56,7 +56,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-22.04, windows-latest]
platform: [macos-latest, ubuntu-22.04, windows-latest, windows-11-arm]
runs-on: ${{ matrix.platform }}
environment: TAURI
steps:
@@ -134,126 +134,40 @@ jobs:
contents: write # Required for creating/updating releases
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
uses: actions/checkout@v6.0.1
- name: Download all artifacts
uses: actions/download-artifact@v4.3.0
uses: actions/download-artifact@v7.0.0
with:
path: artifacts
- name: Install dependencies
run: npm install mime-types
- name: Get commit details
id: commit-details
- name: Prepare assets
run: |
echo "message=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT
- name: Create or update nightly release
uses: actions/github-script@v7.0.1
mkdir -p release_assets
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
# 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:
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:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const path = require('path');
tag_name: nightly
name: Nightly Build (${{ github.sha }})
body: |
Nightly build from the latest main branch.
// Get today's date in YYYY-MM-DD format
const today = new Date().toISOString().split('T')[0];
const releaseTag = 'nightly';
const releaseName = `Nightly Build (${today})`;
**Last commit:** ${{ github.event.head_commit.message }}
**SHA:** ${{ github.sha }}
prerelease: true
files: release_assets/*
fail_on_unmatched_files: true
// 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
});
release = release.data;
} 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!");
+2 -6
View File
@@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-22.04, windows-latest]
platform: [macos-latest, ubuntu-22.04, windows-latest, windows-11-arm]
runs-on: ${{ matrix.platform }}
environment: TAURI
steps:
@@ -67,7 +67,7 @@ jobs:
run: pnpm install --no-frozen-lockfile && pnpm run build # Change this to npm, yarn or pnpm.
- name: Build the app
uses: tauri-apps/tauri-action@dev
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -75,10 +75,6 @@ jobs:
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
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:
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.
+2 -2
View File
@@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
if: contains(github.event.release.tag_name, '-alpha')
steps:
- uses: vedantmgoyal9/winget-releaser@19e706d4c9121098010096f9c495a70a7518b30f
- uses: vedantmgoyal9/winget-releaser@main
with:
identifier: prayag17.Blink.Alpha
version: ${{ github.event.release.tag_name }}
@@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.release.tag_name, '-alpha')"
steps:
- uses: vedantmgoyal9/winget-releaser@19e706d4c9121098010096f9c495a70a7518b30f
- uses: vedantmgoyal9/winget-releaser@main
with:
identifier: prayag17.Blink
version: ${{ github.event.release.tag_name }}
+3
View File
@@ -42,3 +42,6 @@ target/
generateBanner
# Million Lint
.million
# TypeScript incremental build cache
*.tsbuildinfo
+15 -8
View File
@@ -60,19 +60,25 @@
- Sort/Filter library items
- Queue playback support
- Intro Skip button using [jumoog/Intro-Skipper](https://github.com/jumoog/intro-skipper) plugin
- Mediasegment support
## 📷 Screenshots
- Home
![home](https://github.com/user-attachments/assets/6d892160-4513-4496-a220-4c3ce6af20a4)
- Title Page - Movie
![title-movie](https://github.com/prayag17/Blink/assets/55829513/1086f51b-a743-46e4-a761-c9f70a0d21bd)
- Title Page - Show
![title-show](https://github.com/prayag17/Blink/assets/55829513/23b42d4a-2892-497b-aa32-0ae73e300655)
- Episode List
![show-episodes](https://github.com/prayag17/Blink/assets/55829513/9fe69ddd-ffa3-4a6b-a2a7-c2e639b6b2e4)
<img width="2560" height="1600" alt="Screenshot 2026-02-10 212208" src="https://github.com/user-attachments/assets/036c2339-e8f1-4c8d-a908-af0ece9bb1f3" />
- Library
<img width="2560" height="1600" alt="Screenshot 2026-02-10 212723" src="https://github.com/user-attachments/assets/6520a325-3cf3-47a0-9056-b27aded4bb8c" />
- Music Player Detailed
<img width="2560" height="1600" alt="Screenshot 2026-02-10 213017" src="https://github.com/user-attachments/assets/00a89efa-0a4c-4272-868e-f52c9fcfeaac" />
- Item Page
<img width="2560" height="1600" alt="Screenshot 2026-02-10 212653" src="https://github.com/user-attachments/assets/5d281f8c-48ba-4787-b8ca-a4b86ccab5c1" />
- Album / Music Player
<img width="2560" height="1600" alt="Screenshot 2026-02-10 212949" src="https://github.com/user-attachments/assets/d99aaea5-e242-4b3d-a5c5-d2868313728b" />
- Search Dialog
<img width="2560" height="1600" alt="Screenshot 2026-02-10 212749" src="https://github.com/user-attachments/assets/4ad87072-86ad-4510-95a4-567d6d11e997" />
- Video Player
![playback-video](https://github.com/prayag17/Blink/assets/55829513/a84850e6-3be7-41c5-8cf7-e14c3cd0df29)
<img width="2560" height="1600" alt="Screenshot 2026-02-10 213049" src="https://github.com/user-attachments/assets/effcca22-3650-46e1-9a86-b3b434851f2f" />
## 📃 Roadmap
@@ -84,3 +90,4 @@
- [@ferferga](https://github.com/ferferga) for helping in development behind the scenes.
- All contributors of [jellyfin/jellyfin-vue](https://github.com/jellyfin/jellyfin-vue).
- And also [@jellyfin](https://github.com/jellyfin/) for creating the main service
+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" } } },
"linter": {
"enabled": true,
+58 -55
View File
@@ -1,7 +1,7 @@
{
"name": "blink",
"private": true,
"version": "1.0.0-alpha.3",
"version": "1.0.0-alpha.4",
"type": "module",
"scripts": {
"dev": "vite --force && tsr watch",
@@ -19,77 +19,80 @@
"@dnd-kit/utilities": "^3.2.2",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@fontsource-variable/jetbrains-mono": "^5.2.8",
"@fontsource-variable/noto-sans": "^5.2.10",
"@fontsource-variable/plus-jakarta-sans": "^5.2.8",
"@fontsource-variable/space-grotesk": "^5.2.10",
"@jellyfin/sdk": "0.13.0",
"@mui/lab": "7.0.1-beta.20",
"@mui/material": "7.3.6",
"@fontsource-variable/jetbrains-mono": "^5.3.0",
"@fontsource-variable/noto-sans": "^5.3.0",
"@fontsource-variable/plus-jakarta-sans": "^5.3.0",
"@fontsource-variable/space-grotesk": "^5.3.0",
"@jellyfin/sdk": "1.0.1",
"@mui/lab": "9.0.0-beta.10",
"@mui/material": "9.5.0",
"@popperjs/core": "^2.11.8",
"@react-spring/web": "^10.0.3",
"@tanem/react-nprogress": "^5.0.56",
"@tanstack/react-form": "^1.27.5",
"@tanstack/react-query": "^5.90.12",
"@tanstack/react-query-devtools": "^5.91.1",
"@tanstack/react-router": "^1.141.8",
"@tanstack/react-router-devtools": "^1.141.8",
"@tanstack/react-virtual": "^3.13.13",
"@tauri-apps/api": "2.9.1",
"@tauri-apps/plugin-clipboard-manager": "2.3.2",
"@tauri-apps/plugin-dialog": "2.4.2",
"@tauri-apps/plugin-notification": "2.3.3",
"@tauri-apps/plugin-process": "2.3.1",
"@react-spring/web": "^10.1.2",
"@tanem/react-nprogress": "^7.1.7",
"@tanstack/react-devtools": "^0.10.13",
"@tanstack/react-form": "^1.33.5",
"@tanstack/react-query": "^5.104.4",
"@tanstack/react-query-devtools": "^5.104.4",
"@tanstack/react-router": "^1.170.45",
"@tanstack/react-router-devtools": "^1.167.2",
"@tanstack/react-virtual": "^3.14.21",
"@tauri-apps/api": "2.12.4",
"@tauri-apps/plugin-clipboard-manager": "2.5.0",
"@tauri-apps/plugin-dialog": "2.8.3",
"@tauri-apps/plugin-global-shortcut": "~2.4.1",
"@tauri-apps/plugin-notification": "2.7.0",
"@tauri-apps/plugin-process": "2.4.0",
"@tauri-apps/plugin-shell": "~2.5.0",
"@tauri-apps/plugin-store": "github:tauri-apps/tauri-plugin-store#v2",
"@tauri-apps/plugin-updater": "2.9.0",
"@tauri-apps/plugin-upload": "2.3.2",
"@tauri-apps/plugin-window-state": "~2.4.1",
"@types/node": "^25.0.3",
"@types/react": "^19.2.7",
"@types/react-dom": "^19.2.3",
"axios": "^1.13.2",
"@tauri-apps/plugin-updater": "2.14.0",
"@tauri-apps/plugin-upload": "2.5.0",
"@tauri-apps/plugin-window-state": "~2.5.0",
"@types/node": "^26.6.5",
"@types/react": "^19.3.0",
"@types/react-dom": "^19.3.0",
"axios": "^1.20.0",
"axios-tauri-api-adapter": "^2.0.6",
"blurhash": "^2.0.5",
"blurhash-wasm": "^0.2.0",
"immer": "^11.1.0",
"jassub": "^1.8.6",
"libpgs": "^0.8.1",
"lodash": "^4.17.21",
"material-symbols": "^0.40.2",
"motion": "^12.23.26",
"immer": "^11.1.21",
"jassub": "^2.5.22",
"libpgs": "^0.9.0",
"lodash": "^4.18.1",
"material-symbols": "^0.48.0",
"motion": "^14.4.0",
"notistack": "^3.0.2",
"react": "^19.2.3",
"react": "^19.3.1",
"react-blurhash": "^0.3.0",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dom": "^19.2.3",
"react-error-boundary": "^6.0.0",
"react-intersection-observer": "^10.0.0",
"react-dom": "^19.3.1",
"react-error-boundary": "^6.1.6",
"react-intersection-observer": "^11.0.1",
"react-markdown": "^10.1.0",
"react-multi-carousel": "^2.8.6",
"react-player": "^3.4.0",
"remark-gfm": "^4.0.1",
"typescript": "^5.9.3",
"vite-plugin-svgr": "^4.5.0",
"wavesurfer.js": "^7.12.1",
"zod": "^4.2.1",
"zustand": "5.0.9"
"typescript": "^7.0.2",
"vite-plugin-svgr": "^5.2.0",
"vite-plugin-top-level-await": "^1.6.0",
"wavesurfer.js": "^8.0.3",
"zod": "^4.6.7",
"zustand": "5.0.15"
},
"devDependencies": {
"@babel/plugin-proposal-optional-chaining-assign": "^7.27.1",
"@biomejs/biome": "^2.3.10",
"@tanstack/router-cli": "^1.142.0",
"@tanstack/router-devtools": "^1.141.8",
"@tanstack/router-vite-plugin": "^1.142.0",
"@tauri-apps/cli": "2.9.6",
"@types/lodash": "^4.17.21",
"@vitejs/plugin-react": "^5.1.2",
"@babel/plugin-proposal-optional-chaining-assign": "^8.0.1",
"@biomejs/biome": "^2.5.15",
"@tanstack/router-cli": "^1.167.45",
"@tanstack/router-vite-plugin": "^1.167.47",
"@tauri-apps/cli": "2.12.3",
"@types/lodash": "^4.17.26",
"@vitejs/plugin-react": "^6.1.2",
"babel-plugin-react-compiler": "19.1.0-rc.3",
"eslint-plugin-react-hooks": "7.0.1",
"eslint-plugin-react-hooks": "7.1.1",
"prop-types": "^15.8.1",
"sass": "^1.97.1",
"vite": "^7.3.0",
"vite-plugin-wasm": "^3.5.0"
"sass": "^1.105.2",
"vite": "^8.3.4",
"vite-plugin-wasm": "^3.6.0"
},
"license": "GPL-3.0-only"
}
+3174 -2648
View File
File diff suppressed because it is too large. Load diff
+5 -4
View File
@@ -1,4 +1,5 @@
onlyBuiltDependencies:
- '@parcel/watcher'
- core-js
- esbuild
allowBuilds:
'@parcel/watcher': true
'@swc/core': true
core-js: true
lfa-ponyfill: true
+1861 -1597
View File
File diff suppressed because it is too large. Load diff
+8 -3
View File
@@ -1,6 +1,6 @@
[package]
name = "blink"
version = "1.0.0-alpha.3"
version = "1.0.0-alpha.4"
description = "A Modern Jellyfin Client"
authors = ["prayag17", "Blink contributors (https://github.com/prayag17/Blink/graphs/contributors)"]
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
[build-dependencies]
tauri-build = { version = "2.0.0-beta", features = [] }
tauri-build = { version = "2.5.4", features = [] }
[dependencies]
log = "^0.4.21"
serde_json = "1.0"
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-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"] }
@@ -29,14 +29,19 @@ tauri-plugin-clipboard-manager = "2.1.0-beta.6"
tauri-plugin-notification = "2.0.0-rc.1"
tauri-plugin-upload = "2.0.0"
tauri-plugin-dialog = "2.0.0"
tauri-plugin-shell = "2.3.5"
tauri-plugin-mcp-bridge = { version = "0.13.2", optional = true }
[features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = [ "custom-protocol" ]
# Dev-only MCP bridge for UI automation: `pnpm tauri dev -- --features mcp-bridge`
mcp-bridge = ["dep:tauri-plugin-mcp-bridge"]
# this feature is used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = [ "tauri/custom-protocol" ]
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-global-shortcut = "2"
tauri-plugin-window-state = "2"
+6 -1
View File
@@ -9,6 +9,11 @@
"main"
],
"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"
]
}
+6 -1
View File
@@ -13,10 +13,15 @@
"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",
"core:window:allow-start-dragging",
"dialog:default",
"upload:allow-download",
"clipboard-manager:allow-write-text"
"clipboard-manager:allow-write-text",
"shell:default",
"shell:allow-open"
]
}
+18 -15
View File
@@ -1,17 +1,20 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"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"
]
"$schema": "../gen/schemas/desktop-schema.json",
"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"
]
}
+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-secret":{"identifier":"allow-write-secret","description":"Enables the write_secret command without any pre-configured scope.","commands":{"allow":["write_secret"],"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-secret":{"identifier":"deny-write-secret","description":"Denies the write_secret command without any pre-configured scope.","commands":{"allow":[],"deny":["write_secret"]}},"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","allow-supports-multiple-windows"]},"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-exit":{"identifier":"allow-exit","description":"Enables the exit command without any pre-configured scope.","commands":{"allow":["exit"],"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.","coLine 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","core:window:allow-start-dragging","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"]}}
+500 -18
View File
@@ -134,6 +134,216 @@
"description": "Reference a permission or permission set by identifier and extends its scope.",
"type": "object",
"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": {
"identifier": {
@@ -212,6 +422,12 @@
"const": "clipboard-manager:allow-write-image",
"markdownDescription": "Enables the write_image command without any pre-configured scope."
},
{
"description": "Enables the write_secret command without any pre-configured scope.",
"type": "string",
"const": "clipboard-manager:allow-write-secret",
"markdownDescription": "Enables the write_secret command without any pre-configured scope."
},
{
"description": "Enables the write_text command without any pre-configured scope.",
"type": "string",
@@ -248,6 +464,12 @@
"const": "clipboard-manager:deny-write-image",
"markdownDescription": "Denies the write_image command without any pre-configured scope."
},
{
"description": "Denies the write_secret command without any pre-configured scope.",
"type": "string",
"const": "clipboard-manager:deny-write-secret",
"markdownDescription": "Denies the write_secret command without any pre-configured scope."
},
{
"description": "Denies the write_text command without any pre-configured scope.",
"type": "string",
@@ -261,10 +483,10 @@
"markdownDescription": "Default core plugins set.\n#### This default permission set includes:\n\n- `core:path:default`\n- `core:event:default`\n- `core:window:default`\n- `core:webview:default`\n- `core:app:default`\n- `core:image:default`\n- `core:resources:default`\n- `core:menu:default`\n- `core:tray:default`"
},
{
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`",
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-supports-multiple-windows`",
"type": "string",
"const": "core:app:default",
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`"
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-supports-multiple-windows`"
},
{
"description": "Enables the app_hide command without any pre-configured scope.",
@@ -290,6 +512,12 @@
"const": "core:app:allow-default-window-icon",
"markdownDescription": "Enables the default_window_icon command without any pre-configured scope."
},
{
"description": "Enables the exit command without any pre-configured scope.",
"type": "string",
"const": "core:app:allow-exit",
"markdownDescription": "Enables the exit command without any pre-configured scope."
},
{
"description": "Enables the fetch_data_store_identifiers command without any pre-configured scope.",
"type": "string",
@@ -338,6 +566,12 @@
"const": "core:app:allow-set-dock-visibility",
"markdownDescription": "Enables the set_dock_visibility command without any pre-configured scope."
},
{
"description": "Enables the supports_multiple_windows command without any pre-configured scope.",
"type": "string",
"const": "core:app:allow-supports-multiple-windows",
"markdownDescription": "Enables the supports_multiple_windows command without any pre-configured scope."
},
{
"description": "Enables the tauri_version command without any pre-configured scope.",
"type": "string",
@@ -374,6 +608,12 @@
"const": "core:app:deny-default-window-icon",
"markdownDescription": "Denies the default_window_icon command without any pre-configured scope."
},
{
"description": "Denies the exit command without any pre-configured scope.",
"type": "string",
"const": "core:app:deny-exit",
"markdownDescription": "Denies the exit command without any pre-configured scope."
},
{
"description": "Denies the fetch_data_store_identifiers command without any pre-configured scope.",
"type": "string",
@@ -422,6 +662,12 @@
"const": "core:app:deny-set-dock-visibility",
"markdownDescription": "Denies the set_dock_visibility command without any pre-configured scope."
},
{
"description": "Denies the supports_multiple_windows command without any pre-configured scope.",
"type": "string",
"const": "core:app:deny-supports-multiple-windows",
"markdownDescription": "Denies the supports_multiple_windows command without any pre-configured scope."
},
{
"description": "Denies the tauri_version command without any pre-configured scope.",
"type": "string",
@@ -945,10 +1191,10 @@
"markdownDescription": "Denies the close command without any pre-configured scope."
},
{
"description": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-show-menu-on-left-click`",
"description": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-icon-with-as-template`\n- `allow-set-show-menu-on-left-click`",
"type": "string",
"const": "core:tray:default",
"markdownDescription": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-show-menu-on-left-click`"
"markdownDescription": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-icon-with-as-template`\n- `allow-set-show-menu-on-left-click`"
},
{
"description": "Enables the get_by_id command without any pre-configured scope.",
@@ -980,6 +1226,12 @@
"const": "core:tray:allow-set-icon-as-template",
"markdownDescription": "Enables the set_icon_as_template command without any pre-configured scope."
},
{
"description": "Enables the set_icon_with_as_template command without any pre-configured scope.",
"type": "string",
"const": "core:tray:allow-set-icon-with-as-template",
"markdownDescription": "Enables the set_icon_with_as_template command without any pre-configured scope."
},
{
"description": "Enables the set_menu command without any pre-configured scope.",
"type": "string",
@@ -1046,6 +1298,12 @@
"const": "core:tray:deny-set-icon-as-template",
"markdownDescription": "Denies the set_icon_as_template command without any pre-configured scope."
},
{
"description": "Denies the set_icon_with_as_template command without any pre-configured scope.",
"type": "string",
"const": "core:tray:deny-set-icon-with-as-template",
"markdownDescription": "Denies the set_icon_with_as_template command without any pre-configured scope."
},
{
"description": "Denies the set_menu command without any pre-configured scope.",
"type": "string",
@@ -1305,10 +1563,16 @@
"markdownDescription": "Denies the webview_size command without any pre-configured scope."
},
{
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-internal-toggle-maximize`",
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-activity-name`\n- `allow-scene-identifier`\n- `allow-internal-toggle-maximize`",
"type": "string",
"const": "core:window:default",
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-internal-toggle-maximize`"
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-activity-name`\n- `allow-scene-identifier`\n- `allow-internal-toggle-maximize`"
},
{
"description": "Enables the activity_name command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-activity-name",
"markdownDescription": "Enables the activity_name command without any pre-configured scope."
},
{
"description": "Enables the available_monitors command without any pre-configured scope.",
@@ -1502,6 +1766,12 @@
"const": "core:window:allow-scale-factor",
"markdownDescription": "Enables the scale_factor command without any pre-configured scope."
},
{
"description": "Enables the scene_identifier command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-scene-identifier",
"markdownDescription": "Enables the scene_identifier command without any pre-configured scope."
},
{
"description": "Enables the set_always_on_bottom command without any pre-configured scope.",
"type": "string",
@@ -1604,6 +1874,12 @@
"const": "core:window:allow-set-fullscreen",
"markdownDescription": "Enables the set_fullscreen command without any pre-configured scope."
},
{
"description": "Enables the set_fullscreen_on_monitor command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-set-fullscreen-on-monitor",
"markdownDescription": "Enables the set_fullscreen_on_monitor command without any pre-configured scope."
},
{
"description": "Enables the set_icon command without any pre-configured scope.",
"type": "string",
@@ -1766,6 +2042,12 @@
"const": "core:window:allow-unminimize",
"markdownDescription": "Enables the unminimize command without any pre-configured scope."
},
{
"description": "Denies the activity_name command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-activity-name",
"markdownDescription": "Denies the activity_name command without any pre-configured scope."
},
{
"description": "Denies the available_monitors command without any pre-configured scope.",
"type": "string",
@@ -1958,6 +2240,12 @@
"const": "core:window:deny-scale-factor",
"markdownDescription": "Denies the scale_factor command without any pre-configured scope."
},
{
"description": "Denies the scene_identifier command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-scene-identifier",
"markdownDescription": "Denies the scene_identifier command without any pre-configured scope."
},
{
"description": "Denies the set_always_on_bottom command without any pre-configured scope.",
"type": "string",
@@ -2060,6 +2348,12 @@
"const": "core:window:deny-set-fullscreen",
"markdownDescription": "Denies the set_fullscreen command without any pre-configured scope."
},
{
"description": "Denies the set_fullscreen_on_monitor command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-set-fullscreen-on-monitor",
"markdownDescription": "Denies the set_fullscreen_on_monitor command without any pre-configured scope."
},
{
"description": "Denies the set_icon command without any pre-configured scope.",
"type": "string",
@@ -2223,22 +2517,22 @@
"markdownDescription": "Denies the unminimize command without any pre-configured scope."
},
{
"description": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`",
"description": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-message`\n- `allow-save`\n- `allow-open`",
"type": "string",
"const": "dialog:default",
"markdownDescription": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`"
"markdownDescription": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-message`\n- `allow-save`\n- `allow-open`"
},
{
"description": "Enables the ask command without any pre-configured scope.",
"description": "Enables the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)",
"type": "string",
"const": "dialog:allow-ask",
"markdownDescription": "Enables the ask command without any pre-configured scope."
"markdownDescription": "Enables the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)"
},
{
"description": "Enables the confirm command without any pre-configured scope.",
"description": "Enables the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)",
"type": "string",
"const": "dialog:allow-confirm",
"markdownDescription": "Enables the confirm command without any pre-configured scope."
"markdownDescription": "Enables the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)"
},
{
"description": "Enables the message command without any pre-configured scope.",
@@ -2259,16 +2553,16 @@
"markdownDescription": "Enables the save command without any pre-configured scope."
},
{
"description": "Denies the ask command without any pre-configured scope.",
"description": "Denies the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)",
"type": "string",
"const": "dialog:deny-ask",
"markdownDescription": "Denies the ask command without any pre-configured scope."
"markdownDescription": "Denies the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)"
},
{
"description": "Denies the confirm command without any pre-configured scope.",
"description": "Denies the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)",
"type": "string",
"const": "dialog:deny-confirm",
"markdownDescription": "Denies the confirm command without any pre-configured scope."
"markdownDescription": "Denies the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)"
},
{
"description": "Denies the message command without any pre-configured scope.",
@@ -2288,6 +2582,72 @@
"const": "dialog:deny-save",
"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`",
"type": "string",
@@ -2307,10 +2667,10 @@
"markdownDescription": "Denies the log command without any pre-configured scope."
},
{
"description": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`",
"description": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`",
"type": "string",
"const": "notification:default",
"markdownDescription": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`"
"markdownDescription": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`"
},
{
"description": "Enables the batch command without any pre-configured scope.",
@@ -2396,6 +2756,12 @@
"const": "notification:allow-remove-active",
"markdownDescription": "Enables the remove_active command without any pre-configured scope."
},
{
"description": "Enables the remove_listener command without any pre-configured scope.",
"type": "string",
"const": "notification:allow-remove-listener",
"markdownDescription": "Enables the remove_listener command without any pre-configured scope."
},
{
"description": "Enables the request_permission command without any pre-configured scope.",
"type": "string",
@@ -2492,6 +2858,12 @@
"const": "notification:deny-remove-active",
"markdownDescription": "Denies the remove_active command without any pre-configured scope."
},
{
"description": "Denies the remove_listener command without any pre-configured scope.",
"type": "string",
"const": "notification:deny-remove-listener",
"markdownDescription": "Denies the remove_listener command without any pre-configured scope."
},
{
"description": "Denies the request_permission command without any pre-configured scope.",
"type": "string",
@@ -2534,6 +2906,72 @@
"const": "process:deny-restart",
"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`",
"type": "string",
@@ -2929,6 +3367,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"
}
}
]
}
}
}
+500 -18
View File
@@ -134,6 +134,216 @@
"description": "Reference a permission or permission set by identifier and extends its scope.",
"type": "object",
"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": {
"identifier": {
@@ -212,6 +422,12 @@
"const": "clipboard-manager:allow-write-image",
"markdownDescription": "Enables the write_image command without any pre-configured scope."
},
{
"description": "Enables the write_secret command without any pre-configured scope.",
"type": "string",
"const": "clipboard-manager:allow-write-secret",
"markdownDescription": "Enables the write_secret command without any pre-configured scope."
},
{
"description": "Enables the write_text command without any pre-configured scope.",
"type": "string",
@@ -248,6 +464,12 @@
"const": "clipboard-manager:deny-write-image",
"markdownDescription": "Denies the write_image command without any pre-configured scope."
},
{
"description": "Denies the write_secret command without any pre-configured scope.",
"type": "string",
"const": "clipboard-manager:deny-write-secret",
"markdownDescription": "Denies the write_secret command without any pre-configured scope."
},
{
"description": "Denies the write_text command without any pre-configured scope.",
"type": "string",
@@ -261,10 +483,10 @@
"markdownDescription": "Default core plugins set.\n#### This default permission set includes:\n\n- `core:path:default`\n- `core:event:default`\n- `core:window:default`\n- `core:webview:default`\n- `core:app:default`\n- `core:image:default`\n- `core:resources:default`\n- `core:menu:default`\n- `core:tray:default`"
},
{
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`",
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-supports-multiple-windows`",
"type": "string",
"const": "core:app:default",
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`"
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-supports-multiple-windows`"
},
{
"description": "Enables the app_hide command without any pre-configured scope.",
@@ -290,6 +512,12 @@
"const": "core:app:allow-default-window-icon",
"markdownDescription": "Enables the default_window_icon command without any pre-configured scope."
},
{
"description": "Enables the exit command without any pre-configured scope.",
"type": "string",
"const": "core:app:allow-exit",
"markdownDescription": "Enables the exit command without any pre-configured scope."
},
{
"description": "Enables the fetch_data_store_identifiers command without any pre-configured scope.",
"type": "string",
@@ -338,6 +566,12 @@
"const": "core:app:allow-set-dock-visibility",
"markdownDescription": "Enables the set_dock_visibility command without any pre-configured scope."
},
{
"description": "Enables the supports_multiple_windows command without any pre-configured scope.",
"type": "string",
"const": "core:app:allow-supports-multiple-windows",
"markdownDescription": "Enables the supports_multiple_windows command without any pre-configured scope."
},
{
"description": "Enables the tauri_version command without any pre-configured scope.",
"type": "string",
@@ -374,6 +608,12 @@
"const": "core:app:deny-default-window-icon",
"markdownDescription": "Denies the default_window_icon command without any pre-configured scope."
},
{
"description": "Denies the exit command without any pre-configured scope.",
"type": "string",
"const": "core:app:deny-exit",
"markdownDescription": "Denies the exit command without any pre-configured scope."
},
{
"description": "Denies the fetch_data_store_identifiers command without any pre-configured scope.",
"type": "string",
@@ -422,6 +662,12 @@
"const": "core:app:deny-set-dock-visibility",
"markdownDescription": "Denies the set_dock_visibility command without any pre-configured scope."
},
{
"description": "Denies the supports_multiple_windows command without any pre-configured scope.",
"type": "string",
"const": "core:app:deny-supports-multiple-windows",
"markdownDescription": "Denies the supports_multiple_windows command without any pre-configured scope."
},
{
"description": "Denies the tauri_version command without any pre-configured scope.",
"type": "string",
@@ -945,10 +1191,10 @@
"markdownDescription": "Denies the close command without any pre-configured scope."
},
{
"description": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-show-menu-on-left-click`",
"description": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-icon-with-as-template`\n- `allow-set-show-menu-on-left-click`",
"type": "string",
"const": "core:tray:default",
"markdownDescription": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-show-menu-on-left-click`"
"markdownDescription": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-icon-with-as-template`\n- `allow-set-show-menu-on-left-click`"
},
{
"description": "Enables the get_by_id command without any pre-configured scope.",
@@ -980,6 +1226,12 @@
"const": "core:tray:allow-set-icon-as-template",
"markdownDescription": "Enables the set_icon_as_template command without any pre-configured scope."
},
{
"description": "Enables the set_icon_with_as_template command without any pre-configured scope.",
"type": "string",
"const": "core:tray:allow-set-icon-with-as-template",
"markdownDescription": "Enables the set_icon_with_as_template command without any pre-configured scope."
},
{
"description": "Enables the set_menu command without any pre-configured scope.",
"type": "string",
@@ -1046,6 +1298,12 @@
"const": "core:tray:deny-set-icon-as-template",
"markdownDescription": "Denies the set_icon_as_template command without any pre-configured scope."
},
{
"description": "Denies the set_icon_with_as_template command without any pre-configured scope.",
"type": "string",
"const": "core:tray:deny-set-icon-with-as-template",
"markdownDescription": "Denies the set_icon_with_as_template command without any pre-configured scope."
},
{
"description": "Denies the set_menu command without any pre-configured scope.",
"type": "string",
@@ -1305,10 +1563,16 @@
"markdownDescription": "Denies the webview_size command without any pre-configured scope."
},
{
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-internal-toggle-maximize`",
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-activity-name`\n- `allow-scene-identifier`\n- `allow-internal-toggle-maximize`",
"type": "string",
"const": "core:window:default",
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-internal-toggle-maximize`"
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-activity-name`\n- `allow-scene-identifier`\n- `allow-internal-toggle-maximize`"
},
{
"description": "Enables the activity_name command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-activity-name",
"markdownDescription": "Enables the activity_name command without any pre-configured scope."
},
{
"description": "Enables the available_monitors command without any pre-configured scope.",
@@ -1502,6 +1766,12 @@
"const": "core:window:allow-scale-factor",
"markdownDescription": "Enables the scale_factor command without any pre-configured scope."
},
{
"description": "Enables the scene_identifier command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-scene-identifier",
"markdownDescription": "Enables the scene_identifier command without any pre-configured scope."
},
{
"description": "Enables the set_always_on_bottom command without any pre-configured scope.",
"type": "string",
@@ -1604,6 +1874,12 @@
"const": "core:window:allow-set-fullscreen",
"markdownDescription": "Enables the set_fullscreen command without any pre-configured scope."
},
{
"description": "Enables the set_fullscreen_on_monitor command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-set-fullscreen-on-monitor",
"markdownDescription": "Enables the set_fullscreen_on_monitor command without any pre-configured scope."
},
{
"description": "Enables the set_icon command without any pre-configured scope.",
"type": "string",
@@ -1766,6 +2042,12 @@
"const": "core:window:allow-unminimize",
"markdownDescription": "Enables the unminimize command without any pre-configured scope."
},
{
"description": "Denies the activity_name command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-activity-name",
"markdownDescription": "Denies the activity_name command without any pre-configured scope."
},
{
"description": "Denies the available_monitors command without any pre-configured scope.",
"type": "string",
@@ -1958,6 +2240,12 @@
"const": "core:window:deny-scale-factor",
"markdownDescription": "Denies the scale_factor command without any pre-configured scope."
},
{
"description": "Denies the scene_identifier command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-scene-identifier",
"markdownDescription": "Denies the scene_identifier command without any pre-configured scope."
},
{
"description": "Denies the set_always_on_bottom command without any pre-configured scope.",
"type": "string",
@@ -2060,6 +2348,12 @@
"const": "core:window:deny-set-fullscreen",
"markdownDescription": "Denies the set_fullscreen command without any pre-configured scope."
},
{
"description": "Denies the set_fullscreen_on_monitor command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-set-fullscreen-on-monitor",
"markdownDescription": "Denies the set_fullscreen_on_monitor command without any pre-configured scope."
},
{
"description": "Denies the set_icon command without any pre-configured scope.",
"type": "string",
@@ -2223,22 +2517,22 @@
"markdownDescription": "Denies the unminimize command without any pre-configured scope."
},
{
"description": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`",
"description": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-message`\n- `allow-save`\n- `allow-open`",
"type": "string",
"const": "dialog:default",
"markdownDescription": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`"
"markdownDescription": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-message`\n- `allow-save`\n- `allow-open`"
},
{
"description": "Enables the ask command without any pre-configured scope.",
"description": "Enables the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)",
"type": "string",
"const": "dialog:allow-ask",
"markdownDescription": "Enables the ask command without any pre-configured scope."
"markdownDescription": "Enables the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)"
},
{
"description": "Enables the confirm command without any pre-configured scope.",
"description": "Enables the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)",
"type": "string",
"const": "dialog:allow-confirm",
"markdownDescription": "Enables the confirm command without any pre-configured scope."
"markdownDescription": "Enables the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)"
},
{
"description": "Enables the message command without any pre-configured scope.",
@@ -2259,16 +2553,16 @@
"markdownDescription": "Enables the save command without any pre-configured scope."
},
{
"description": "Denies the ask command without any pre-configured scope.",
"description": "Denies the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)",
"type": "string",
"const": "dialog:deny-ask",
"markdownDescription": "Denies the ask command without any pre-configured scope."
"markdownDescription": "Denies the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)"
},
{
"description": "Denies the confirm command without any pre-configured scope.",
"description": "Denies the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)",
"type": "string",
"const": "dialog:deny-confirm",
"markdownDescription": "Denies the confirm command without any pre-configured scope."
"markdownDescription": "Denies the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)"
},
{
"description": "Denies the message command without any pre-configured scope.",
@@ -2288,6 +2582,72 @@
"const": "dialog:deny-save",
"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`",
"type": "string",
@@ -2307,10 +2667,10 @@
"markdownDescription": "Denies the log command without any pre-configured scope."
},
{
"description": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`",
"description": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`",
"type": "string",
"const": "notification:default",
"markdownDescription": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`"
"markdownDescription": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`"
},
{
"description": "Enables the batch command without any pre-configured scope.",
@@ -2396,6 +2756,12 @@
"const": "notification:allow-remove-active",
"markdownDescription": "Enables the remove_active command without any pre-configured scope."
},
{
"description": "Enables the remove_listener command without any pre-configured scope.",
"type": "string",
"const": "notification:allow-remove-listener",
"markdownDescription": "Enables the remove_listener command without any pre-configured scope."
},
{
"description": "Enables the request_permission command without any pre-configured scope.",
"type": "string",
@@ -2492,6 +2858,12 @@
"const": "notification:deny-remove-active",
"markdownDescription": "Denies the remove_active command without any pre-configured scope."
},
{
"description": "Denies the remove_listener command without any pre-configured scope.",
"type": "string",
"const": "notification:deny-remove-listener",
"markdownDescription": "Denies the remove_listener command without any pre-configured scope."
},
{
"description": "Denies the request_permission command without any pre-configured scope.",
"type": "string",
@@ -2534,6 +2906,72 @@
"const": "process:deny-restart",
"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`",
"type": "string",
@@ -2929,6 +3367,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"
}
}
]
}
}
}
+13 -1
View File
@@ -3,7 +3,19 @@
use tauri_plugin_log::{fern::colors::ColoredLevelConfig, Target, TargetKind};
fn main() {
tauri::Builder::default()
let builder = tauri::Builder::default();
// Dev-only MCP bridge: `pnpm tauri dev -- --features mcp-bridge`.
#[cfg(all(debug_assertions, feature = "mcp-bridge"))]
let builder = builder.plugin(
tauri_plugin_mcp_bridge::Builder::new()
.bind_address("127.0.0.1")
.build(),
);
builder
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
.plugin(tauri_plugin_window_state::Builder::new().build())
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_upload::init())
+4 -1
View File
@@ -77,7 +77,10 @@
"label": "main",
"dragDropEnabled": false,
"backgroundColor": "#08001f",
"transparent": false
"transparent": false,
"titleBarStyle": "Overlay",
"hiddenTitle": true,
"trafficLightPosition": { "x": 18, "y": 31 }
}
],
"security": {
+121 -63
View File
@@ -1,17 +1,17 @@
import { setServer } from "@/utils/storage/servers";
import { jellyfin } from "@/utils/store/api";
import { LoadingButton } from "@mui/lab";
import {
Box,
Button,
Dialog,
DialogActions,
DialogContent,
DialogTitle,
TextField,
InputBase,
Stack,
Typography,
} from "@mui/material";
import { useMutation } from "@tanstack/react-query";
import { enqueueSnackbar } from "notistack";
import React, { useState } from "react";
import { setServer } from "@/utils/storage/servers";
import { jellyfin } from "@/utils/store/api";
type AddServerDialogProps = {
open: boolean;
@@ -64,72 +64,130 @@ export default function AddServerDialog(props: AddServerDialogProps) {
return (
<Dialog
open={open}
onClose={() => setAddServerDialog(false)}
hideBackdrop={Boolean(hideBackdrop)}
fullWidth
maxWidth="sm"
disableScrollLock={true}
slotProps={{
paper: {
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}>
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",
<Stack
spacing={3}
sx={{
p: 4,
}}
>
<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)}
<Stack
spacing={1}
sx={{
alignItems: "center",
}}
>
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"
<span
className="material-symbols-rounded"
style={{
fontSize: "48px",
color: "var(--mui-palette-primary-main)",
}}
>
add_to_queue
</span>
<Typography
variant="h5"
sx={{
fontWeight: "bold",
textAlign: "center",
}}
>
Connect to Server
</Typography>
<Typography
variant="body2"
sx={{
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",
gap: 2,
"&:focus-within": {
borderColor: "var(--mui-palette-primary-main)",
bgcolor: "rgba(0,0,0,0.3)",
},
transition: "border-color 0.2s, background-color 0.2s",
}}
>
Add
</LoadingButton>
</DialogActions>
<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}
sx={{
justifyContent: "flex-end",
pt: 1,
}}
>
<Button
onClick={() => setAddServerDialog(false)}
color="inherit"
variant="text"
sx={{ borderRadius: 2 }}
>
Cancel
</Button>
<LoadingButton
loading={addServer.isPending}
onClick={() => addServer.mutate()}
variant="contained"
color="primary"
sx={{ borderRadius: 2, px: 3 }}
disabled={!serverIp}
>
Connect
</LoadingButton>
</Stack>
</Stack>
</Dialog>
);
}
+3 -1
View File
@@ -92,7 +92,9 @@ export default function AlbumMusicTrack(props: AlbumMusicTrackProps) {
alignItems: "center",
gap: "0.6em",
}}
fontWeight={300}
sx={{
fontWeight: 300,
}}
>
{track.HasLyrics && <img src={lyricsIcon} alt="lyrics" />}
{track.Artists?.join(", ")}
+103 -70
View File
@@ -1,50 +1,33 @@
.appBar {
// Limit transitions to cheaper properties; avoid animating box-shadow directly
// Custom titlebar: the app header itself sits at the very top of the window,
// under the native overlay titlebar (no native glass strip, no blur panels).
transition: background-color $transition-time-fast;
padding: 0.8em ($page-margin - 1.7em);
z-index: 999 !important;
top: 0 !important;
// Keep the left controls clear of the macOS traffic lights.
html.is-macos & {
padding-left: calc(#{$page-margin} - 1.7em + 72px);
}
.flex {
// Avoid animating padding; it causes layout reflow on each frame.
transition: background-color $transition-time-fast;
// Avoid using will-change: scroll-position; it can degrade performance when misused
// will-change: opacity, transform;
border-radius: 1000px;
position: relative;
// Pseudo-element handles elevation shadow; we animate its opacity
&::after {
content: "";
position: absolute;
backdrop-filter: blur(40px);
inset: -0.35em;
pointer-events: none;
border-radius: inherit;
box-shadow: 0 0 25px rgb(0 0 0 / 0.45);
background: rgb(0 0 0 / 0.4);
opacity: 0;
z-index: -1;
transition: opacity $transition-time-fast;
}
}
// Inner content wrapper that we can scale without causing layout reflow
.flex-inner {
transform-origin: top center;
transition: transform $transition-time-fast;
// Solid, part-of-the-screen titlebar background once the page scrolls.
&.elevated {
background-color: $clr-background-default !important;
border-bottom: 1px solid rgb(255 255 255 / 0.06);
box-shadow: none !important;
background-image: none !important;
backdrop-filter: none !important;
}
&.elevated{
.flex {
&::after {
opacity: 1;
}
}
// Apply a subtle scale to simulate shrink without layout changes
.flex-inner {
transform: scaleY(0.95);
}
}
&-avatar {
background: rgb(255 255 255 / 0.1) !important;
&-icon {
@@ -90,48 +73,98 @@
}
}
.library-drawer{
width: 20em;
margin: 1.4em;
height: calc(100vh - 2.8em) !important;
border-radius: 20px;
overflow-x: hidden;
overflow-y: auto;
.library-drawer-item{
position: relative;
overflow: hidden;
border-radius: 1000px;
> div::before{
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: transparent;
transition: $transition-time-default;
z-index: -1;
border-radius: 100px;
.library-drawer {
// Ensure the drawer paper itself gets the styling
&.MuiDrawer-paper {
width: 280px;
margin: 16px;
height: calc(100% - 32px) !important; // float in the middle
border-radius: 24px;
background: rgba(20, 20, 25, 0.75); // Darker, substantial base
backdrop-filter: blur(24px) saturate(180%);
border: 1px solid rgba(255, 255, 255, 0.06);
box-shadow:
0 24px 48px rgba(0, 0, 0, 0.4),
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.library-drawer-item {
.material-symbols-rounded{
--fill: 1;
}
&> div::before {
background: $clr-accent-default;
// 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;
left: 0;
top: 50%;
transform: translateY(-50%);
height: 24px;
width: 4px;
background: $clr-accent-default;
border-radius: 0 4px 4px 0;
}
}
}
// Magic scrollbar
// Custom Scrollbar for the drawer content
&::-webkit-scrollbar {
&-thumb {
height: 150px;
max-height: 33%;
}
&-track {
margin-top: 15px;
margin-bottom: 15px;
background: transparent !important;
width: 4px;
}
&::-webkit-scrollbar-track {
background: transparent;
}
&::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.1);
border-radius: 4px;
&:hover {
background: rgba(255, 255, 255, 0.2);
}
}
}
+23 -147
View File
@@ -1,28 +1,20 @@
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
import MuiAppBar from "@mui/material/AppBar";
import IconButton from "@mui/material/IconButton";
import useScrollTrigger from "@mui/material/useScrollTrigger";
import { useQuery } from "@tanstack/react-query";
import { useLocation, useNavigate } from "@tanstack/react-router";
import React, { useCallback, useMemo, useState } from "react";
import React, { useCallback, useState } from "react";
import "./appBar.scss";
import { Divider, Drawer, List, ListItem, ListItemButton } from "@mui/material";
import { useShallow } from "zustand/shallow";
// removed search placeholder; library state now managed via zustand
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import useHeaderStore from "@/utils/store/header";
import {
setSettingsDialogOpen,
setSettingsTabValue,
} from "@/utils/store/settings";
import useSearchStore from "@/utils/store/search";
import BackButton from "../buttons/backButton";
import ListItemLink from "../listItemLink";
import { UserAvatarMenu } from "../userAvatarMenu";
import { getTypeIcon } from "../utils/iconsCollection";
import { NavigationDrawer } from "./navigationDrawer";
const MemoizeBackButton = React.memo(BackButton);
@@ -34,34 +26,23 @@ const HIDDEN_PATHS = [
"/error",
"/settings",
"/library",
"/search",
];
export const AppBar = () => {
const api = useApiInContext((s) => s.api);
const navigate = useNavigate();
const location = useLocation();
const display = !HIDDEN_PATHS.some(
(path) => location.pathname.startsWith(path) || location.pathname === "/",
const toggleSearchDialog = useSearchStore(
useShallow((s) => s.toggleSearchDialog),
);
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 display = !HIDDEN_PATHS.some(
(path) =>
(location.pathname.startsWith(path) &&
location.pathname !== "/player/audio") ||
location.pathname === "/",
);
const trigger = useScrollTrigger({
disableHysteresis: true,
@@ -70,21 +51,7 @@ export const AppBar = () => {
const [showDrawer, setShowDrawer] = useState(false);
const appBarStyling = useMemo(() => {
return {
backgroundColor: "transparent",
paddingRight: "0 !important",
};
}, []);
const drawerPaperProps = useMemo(() => {
return {
className: "glass library-drawer",
elevation: 6,
};
}, []);
const handleNavigateToSearch = useCallback(
const _handleNavigateToSearch = useCallback(
() => navigate({ to: "/search", search: { query: "" } }),
[navigate],
);
@@ -111,7 +78,7 @@ export const AppBar = () => {
return (
<>
<MuiAppBar
style={appBarStyling}
data-tauri-drag-region
className={
trigger
? "appBar flex flex-row flex-justify-spaced-between elevated"
@@ -120,13 +87,13 @@ export const AppBar = () => {
elevation={0}
color="transparent"
>
<div className="flex flex-row" style={{ gap: "0.6em" }}>
<div className="flex flex-row" data-tauri-drag-region style={{ gap: "0.6em" }}>
<IconButton onClick={handleDrawerOpen}>
<div className="material-symbols-rounded">menu</div>
<span className="material-symbols-rounded">menu</span>
</IconButton>
<MemoizeBackButton />
<IconButton onClick={handleNavigateToHome}>
<div
<span
className={
location.pathname === "/home"
? "material-symbols-rounded fill"
@@ -134,112 +101,21 @@ export const AppBar = () => {
}
>
home
</div>
</span>
</IconButton>
</div>
<div className="flex flex-row" style={{ gap: "0.6em" }}>
<IconButton onClick={handleNavigateToSearch}>
<div className="material-symbols-rounded">search</div>
<div className="flex flex-row" data-tauri-drag-region 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>
<span className="material-symbols-rounded">favorite</span>
</IconButton>
<UserAvatarMenu />
</div>
</MuiAppBar>
<Drawer
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>
<NavigationDrawer open={showDrawer} onClose={handleDrawerClose} />
</>
);
}
+106
View File
@@ -0,0 +1,106 @@
import { getUserViewApi } from "@jellyfin/sdk/lib/utils/api/user-view-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 getUserViewApi(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>
);
};
+11 -6
View File
@@ -5,15 +5,20 @@ import { useBackdropStore } from "@/utils/store/backdrop";
import BlurhashCanvas from "../blurhash-canvas";
export default function Backdrop() {
// const [backdropLoading, setBackdropLoading] = useState(true);
const { backdropHash } = useBackdropStore(
useShallow((state) => ({
backdropHash: state.backdropHash,
})),
);
if (!backdropHash) {
// Routes clear the backdrop when they mount ("") and some set it later.
// Keep the last non-empty hash so the app background never blanks out
// (which looked like a flash on every page open).
const lastHash = React.useRef<string | undefined>(undefined);
if (backdropHash) lastHash.current = backdropHash;
const hash = backdropHash || lastHash.current;
if (!hash) {
return null;
}
@@ -22,16 +27,16 @@ export default function Backdrop() {
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
key={backdropHash}
key={hash}
exit={{ opacity: 0 }}
transition={{
duration: 2,
duration: 0.45,
ease: "easeInOut",
}}
className="app-backdrop-container"
>
<BlurhashCanvas
blurhashString={backdropHash}
blurhashString={hash}
width={300}
height={150}
canvasProps={{
+12 -16
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 { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
import { getUserDataApi } from "@jellyfin/sdk/lib/utils/api/user-data-api";
import { pink } from "@mui/material/colors";
import IconButton from "@mui/material/IconButton";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { useSnackbar } from "notistack";
import React from "react";
import { useApiInContext } from "@/utils/store/api";
export default function LikeButton({
itemId,
@@ -34,14 +32,14 @@ export default function LikeButton({
if (!itemName) return;
if (isFavorite) {
result = (
await getUserLibraryApi(api).unmarkFavoriteItem({
await getUserDataApi(api).unmarkFavoriteItem({
userId: userId,
itemId: itemId,
})
).data;
} else if (!isFavorite) {
result = (
await getUserLibraryApi(api).markFavoriteItem({
await getUserDataApi(api).markFavoriteItem({
userId: userId,
itemId: itemId,
})
@@ -78,24 +76,22 @@ export default function LikeButton({
transition: "opacity 250ms",
}}
>
<div
<span
className="material-symbols-rounded"
style={
isFavorite
? {
//@ts-ignore
? ({
"--fill": mutation.isPending ? 0 : 1,
color: mutation.isPending ? "white" : pink.A700,
}
: {
//@ts-ignore
} as React.CSSProperties)
: ({
"--fill": mutation.isPending ? 1 : 0,
color: mutation.isPending ? pink.A700 : "white",
}
} as React.CSSProperties)
}
>
favorite
</div>
</span>
</IconButton>
);
}
+3 -3
View File
@@ -6,7 +6,7 @@ import { green } from "@mui/material/colors";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { useApiInContext } from "@/utils/store/api";
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
import { getUserDataApi } from "@jellyfin/sdk/lib/utils/api/user-data-api";
import { useSnackbar } from "notistack";
export default function MarkPlayedButton({
@@ -36,12 +36,12 @@ export default function MarkPlayedButton({
if (!itemName) return;
if (!isPlayed) {
result = await getPlaystateApi(api).markPlayedItem({
result = await getUserDataApi(api).markPlayedItem({
userId: userId,
itemId: itemId,
});
} else if (isPlayed) {
result = await getPlaystateApi(api).markUnplayedItem({
result = await getUserDataApi(api).markUnplayedItem({
userId: userId,
itemId: itemId,
});
+29 -143
View File
@@ -2,7 +2,7 @@ import {
type BaseItemDto,
BaseItemKind,
} from "@jellyfin/sdk/lib/generated-client";
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
import { getShowApi } from "@jellyfin/sdk/lib/utils/api/show-api";
import type { SxProps } from "@mui/material";
import Button, { type ButtonProps } from "@mui/material/Button";
import Fab from "@mui/material/Fab";
@@ -14,13 +14,11 @@ import { useSnackbar } from "notistack";
import React, { type MouseEvent, memo } from "react"; // Import memo
import type PlayResult from "@//utils/types/playResult";
import { getRuntimeCompact } from "@/utils/date/time";
import getSubtitle from "@/utils/methods/getSubtitles";
import { getNextEpisode, getPlaybackInfo } from "@/utils/methods/playback";
import { useApiInContext } from "@/utils/store/api";
import { generateAudioStreamUrl, playAudio } from "@/utils/store/audioPlayback";
import { useCentralStore } from "@/utils/store/central";
import { usePhotosPlayback } from "@/utils/store/photosPlayback";
import { playItem } from "@/utils/store/playback";
import { initializePlayback } from "@/utils/store/playback";
import { setQueue } from "@/utils/store/queue";
type PlayButtonProps = {
@@ -85,7 +83,6 @@ const PlayButton = ({
// (state) => state.setisPending,
// );
const playPhotos = usePhotosPlayback((s) => s.playPhotos);
const currentUser = useCentralStore((s) => s.currentUser);
const { enqueueSnackbar } = useSnackbar();
@@ -156,144 +153,33 @@ const PlayButton = ({
return;
}
const episodeIndex = result.episodeIndex;
const queue = result?.item?.Items ?? [];
// Creates a queue containing all Episodes for a particular season(series) or collection of movies
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];
let playItemValue = queue[episodeIndex];
if (itemType === BaseItemKind.Movie) {
playItemValue = result?.item?.Items?.[0];
playItemValue = queue[0];
}
const startPosition =
result?.item?.Items?.[episodeIndex].UserData?.PlaybackPositionTicks;
if (!playItemValue) {
console.error("No item to play found");
return;
}
const videoTrack =
result.mediaSource.MediaSources?.[0].MediaStreams?.filter(
(value) => value.Type === "Video",
);
const startPosition = playItemValue.UserData?.PlaybackPositionTicks;
const isDirectPlay =
!result.mediaSource.MediaSources?.[0].SupportsTranscoding ||
!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,
initializePlayback({
api,
userId,
queueItems: queue ?? [],
queueItemIndex: episodeIndex,
item: playItemValue,
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" });
}
@@ -327,7 +213,7 @@ const PlayButton = ({
if (!item.Id) {
throw new Error("Item ID is not available");
}
const seasons = await getTvShowsApi(api).getSeasons({
const seasons = await getShowApi(api).getSeasons({
seriesId: item.Id,
userId: userId,
enableUserData: true,
@@ -377,14 +263,14 @@ const PlayButton = ({
}
{...buttonProps}
>
<div
<span
className="material-symbols-rounded em-4 fill"
style={{
fontSize: "3em",
}}
>
play_arrow
</div>
</span>
</Fab>
);
}
@@ -409,7 +295,7 @@ const PlayButton = ({
}
}}
startIcon={
<div
<span
className="material-symbols-rounded fill"
style={{
zIndex: 1,
@@ -417,7 +303,7 @@ const PlayButton = ({
}}
>
play_arrow
</div>
</span>
}
{...buttonProps}
sx={{
@@ -498,7 +384,7 @@ const PlayButton = ({
item.Type === "Episode" ? handleClick(e, item.Id) : handleClick(e)
}
startIcon={
<div
<span
className="material-symbols-rounded fill"
style={{
zIndex: 1,
@@ -506,7 +392,7 @@ const PlayButton = ({
}}
>
play_arrow
</div>
</span>
}
{...buttonProps}
sx={{
+12 -12
View File
@@ -1,10 +1,10 @@
import { useApiInContext } from "@/utils/store/api";
import { playItemFromQueue } from "@/utils/store/playback";
import useQueue from "@/utils/store/queue";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { IconButton } from "@mui/material";
import { useMutation, useQuery } from "@tanstack/react-query";
import React from "react";
import { useApiInContext } from "@/utils/store/api";
import { playItemFromQueue } from "@/utils/store/playback";
import useQueue, { getNextTrackIndex } from "@/utils/store/queue";
const PlayNextButton = () => {
const api = useApiInContext((s) => s.api);
@@ -19,18 +19,18 @@ const PlayNextButton = () => {
});
const handlePlayNext = useMutation({
mutationKey: ["playNextButton"],
mutationFn: () => playItemFromQueue("next", user.data?.Id, api),
mutationFn: async () => {
const nextIndex = getNextTrackIndex();
if (nextIndex === undefined) return;
return playItemFromQueue(nextIndex, user.data?.Id, api);
},
onError: (error) => console.error(error),
});
const [queueItems, currentItemIndex] = useQueue((state) => [
state.tracks,
state.currentItemIndex,
]);
// Re-render when the queue position or repeat mode changes.
useQueue((state) => [state.tracks, state.currentItemIndex, state.repeatMode]);
const hasNext = getNextTrackIndex() !== undefined;
return (
<IconButton
disabled={queueItems?.length === currentItemIndex + 1}
onClick={() => handlePlayNext.mutate()}
>
<IconButton disabled={!hasNext} onClick={() => handlePlayNext.mutate()}>
<span className="material-symbols-rounded">skip_next</span>
</IconButton>
);
+7 -3
View File
@@ -1,14 +1,16 @@
$image-size: 5em;
.queue{
&-item{
--image-size: 5em;
&.episode {
--image-size: 8em !important;
}
width: 32em;
padding: 1em;
display: grid !important;
opacity: 1 !important;
gap: 1em;
height: 5em;
grid-template-columns: 3em $image-size 1fr;
grid-template-columns: 3em var(--image-size) 1fr;
justify-items: center;
align-items: center;
&-image{
@@ -25,6 +27,7 @@ $image-size: 5em;
justify-content: center;
align-items: center;
position: relative;
width: var(--image-size);
}
&-icon {
width: 100%;
@@ -52,4 +55,5 @@ $image-size: 5em;
opacity: 0.5 !important;
}
}
}
+19 -274
View File
@@ -1,286 +1,31 @@
import { playItemFromQueue } from "@/utils/store/playback";
import useQueue from "@/utils/store/queue";
import {
IconButton,
Menu,
MenuItem,
MenuList,
Typography,
} from "@mui/material";
import Drawer from "@mui/material/Drawer";
import IconButton from "@mui/material/IconButton";
import Tooltip from "@mui/material/Tooltip";
import React, { useState } from "react";
import { getTypeIcon } from "../utils/iconsCollection";
import QueueView from "@/components/queue/queueView";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { useMutation, useQuery } from "@tanstack/react-query";
import "./queueButton.scss";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api";
/** Opens the play queue in a side drawer. */
const QueueButton = () => {
const api = useApiInContext((s) => s.api);
const [queueItems, currentItemIndex] = useQueue((state) => [
state.tracks,
state.currentItemIndex,
]);
const user = useQuery({
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({
mutationKey: ["handlePlayIndex"],
mutationFn: async ({ index }: { index: number }) => {
const result = playItemFromQueue(index, user.data?.Id, api);
return result;
},
onSuccess: () => {
setButtonEl(null);
},
onError: (error) => {
console.error(error);
},
});
const [open, setOpen] = useState(false);
return (
<>
<Menu
open={Boolean(buttonEl)}
onClose={() => setButtonEl(null)}
anchorEl={buttonEl}
anchorOrigin={{
vertical: "top",
horizontal: "center",
}}
transformOrigin={{
vertical: "bottom",
horizontal: "center",
}}
<Tooltip title="Queue">
<IconButton onClick={() => setOpen(true)} aria-label="Open queue">
<span className="material-symbols-rounded">queue_music</span>
</IconButton>
</Tooltip>
<Drawer
anchor="right"
open={open}
onClose={() => setOpen(false)}
slotProps={{
paper: {
style: {
maxHeight: "30em",
overflowX: "hidden",
overflowY: "auto",
},
},
backdrop: { sx: { backgroundColor: "rgb(0 0 0 / 0.3)" } },
paper: { className: "queue-drawer-paper" },
}}
>
<MenuList
style={{
height: "fit-content",
width: " 32em",
position: "relative",
}}
>
{queueItems?.[currentItemIndex]?.Id && (
<>
<Typography px="1em" mb={2} variant="h5" fontWeight={300}>
Currently Playing:
</Typography>
<MenuItem
className="queue-item"
disabled
key={queueItems[currentItemIndex].Id}
>
<Typography variant="subtitle2">
{queueItems[currentItemIndex]?.Type === "Audio"
? currentItemIndex + 1
: queueItems[currentItemIndex].IndexNumberEnd
? `S${queueItems[currentItemIndex].ParentIndexNumber}:E${queueItems[currentItemIndex].IndexNumber} / ${queueItems[currentItemIndex].IndexNumberEnd}`
: `S${queueItems[currentItemIndex].ParentIndexNumber}:E${queueItems[currentItemIndex].IndexNumber}`}
</Typography>
<div className="queue-item-image-container">
{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"}
/>
) : (queueItems[currentItemIndex].AlbumPrimaryImageTag
?.length ?? -1) > 0 ? (
<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>
)}
<span
className="material-symbols-rounded"
style={{
position: "absolute",
top: "50%",
left: "50%",
transform: "translate(-50%,-50%)",
fontSize: "2em",
//@ts-ignore
"--wght": "100",
}}
>
equalizer
</span>
</div>
<div className="queue-item-info">
{queueItems[currentItemIndex].SeriesName ? (
<>
<Typography variant="subtitle1" width="100%">
{queueItems[currentItemIndex].SeriesName}
</Typography>
<Typography
variant="subtitle2"
width="100%"
style={{ opacity: 0.6 }}
>
{queueItems[currentItemIndex].Name}
</Typography>
</>
) : (
<Typography variant="subtitle1" width="100%">
{queueItems[currentItemIndex].Name}
</Typography>
)}
</div>
</MenuItem>
</>
)}
{queueItems &&
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>
</IconButton>
<QueueView variant="drawer" onClose={() => setOpen(false)} />
</Drawer>
</>
);
};
+39 -28
View File
@@ -1,8 +1,4 @@
import useInterval from "@/utils/hooks/useInterval";
import { saveUser } from "@/utils/storage/user";
import { useApiInContext } from "@/utils/store/api";
import { getQuickConnectApi } from "@jellyfin/sdk/lib/utils/api/quick-connect-api";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { getAuthenticationApi } from "@jellyfin/sdk/lib/utils/api/authentication-api";
import { LoadingButton, type LoadingButtonProps } from "@mui/lab";
import {
Button,
@@ -18,10 +14,13 @@ import {
} from "@mui/material";
import type { TransitionProps } from "@mui/material/transitions";
import { skipToken, useMutation, useQuery } from "@tanstack/react-query";
import { useNavigate } from "@tanstack/react-router";
import { useNavigate, useRouter } from "@tanstack/react-router";
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
import { useSnackbar } from "notistack";
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(
props: TransitionProps & {
@@ -56,11 +55,12 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
};
const navigate = useNavigate();
const router = useRouter();
const quickConnectEnabled = useQuery({
queryKey: ["quick-connect-button", "check-quick-connect-enabled"],
queryFn: api
? async () => await getQuickConnectApi(api).getQuickConnectEnabled()
? async () => await getAuthenticationApi(api).getQuickConnectEnabled()
: skipToken,
enabled: Boolean(api),
});
@@ -74,24 +74,26 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
mutationKey: ["quick-connect-button", "authenticate-user"],
mutationFn: async () => {
if (api && quickConnectSecret) {
return await getUserApi(api).authenticateWithQuickConnect(
return await getAuthenticationApi(api).authenticateWithQuickConnect(
{ quickConnectDto: { Secret: quickConnectSecret } },
{ headers },
);
}
},
onSuccess: (result) => {
if (api && result?.data?.AccessToken && result.data.User?.Name) {
onSuccess: async (result) => {
const { AccessToken, User } = result?.data ?? {};
if (api && AccessToken && User?.Name && User.Id) {
setCheckForQuickConnect(false);
// saveUser({ username, password, rememberMe: rememberUser });
enqueueSnackbar(`Logged in as ${result.data.User?.Name}!`, {
enqueueSnackbar(`Logged in as ${User.Name}!`, {
variant: "success",
});
createApi(api.basePath, result.data.AccessToken);
createApi(api.basePath, AccessToken);
if (rememberUser) {
saveUser(result.data.User?.Name, result.data.AccessToken);
await saveUser(User.Name, AccessToken, User.Id);
}
navigate({ to: "/home", replace: true });
router.invalidate().finally(() => {
navigate({ to: "/home", replace: true });
});
}
},
onError: (error) => {
@@ -104,7 +106,7 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
mutationFn: async (secret: string) =>
api &&
(
await getQuickConnectApi(api).getQuickConnectState(
await getAuthenticationApi(api).getQuickConnectState(
{ secret },
{ headers },
)
@@ -127,7 +129,9 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
});
}
if (api) {
return await getQuickConnectApi(api).initiateQuickConnect({ headers });
return await getAuthenticationApi(api).initiateQuickConnect({
headers,
});
}
},
onSuccess: (result) => {
@@ -173,7 +177,7 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
(quickConnectCode && !checkQuickConnectStatus.data?.Authenticated),
)}
variant={props.variant ?? "contained"}
onClick={initQuickConnect.mutate}
onClick={() => initQuickConnect.mutate()}
>
{quickConnectEnabled.data?.data
? "Use Quick Connect"
@@ -184,7 +188,12 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
onClose={handleQuickConnectClose}
fullWidth
maxWidth="xs"
TransitionComponent={Transition}
slots={{
transition: Transition,
}}
slotProps={{
paper: { className: "glass", sx: { borderRadius: "24px" } },
}}
>
<DialogContent
style={{
@@ -195,10 +204,12 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
>
<Typography
variant="h5"
mb={2}
style={{
width: "100%",
}}
sx={{
mb: 2,
}}
>
Quick Connect Code:
</Typography>
@@ -213,14 +224,6 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
<Typography
variant="h3"
color="textPrimary"
textAlign="center"
sx={{
background: "rgb(255 255 255 / 0.1)",
width: "fit-content",
padding: "0.4em",
borderRadius: "10px",
cursor: "pointer",
}}
onClick={async () => {
quickConnectCode && (await writeText(quickConnectCode));
enqueueSnackbar("Quick Connect Code copied!", {
@@ -228,6 +231,14 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
key: "copiedText",
});
}}
sx={{
textAlign: "center",
background: "rgb(255 255 255 / 0.1)",
width: "fit-content",
padding: "0.4em",
borderRadius: "10px",
cursor: "pointer",
}}
>
{quickConnectCode}
</Typography>
+8 -5
View File
@@ -22,17 +22,20 @@ const TrailerButton = (props: TrailerButtonType) => {
maxWidth="md"
fullWidth
open={dialog}
PaperProps={{
style: {
overflow: "hidden",
onClose={() => setDialog(false)}
slotProps={{
paper: {
className: "glass",
style: {
overflow: "hidden",
},
},
}}
onClose={() => setDialog(false)}
>
{props.trailerItem[0]?.Url && (
<ReactPlayer
playing={false}
url={props.trailerItem[0]?.Url}
src={props.trailerItem[0]?.Url}
width="100%"
height="auto"
style={{
+3 -3
View File
@@ -18,7 +18,6 @@
width: 100%;
height: 100%;
object-fit: cover;
transition: all $transition-time-fast;
position: absolute;
z-index: 1;
top: 0;
@@ -82,12 +81,13 @@
top: 0;
z-index: 10;
opacity: 0;
transition: opacity $transition-time-default;
transition: all $transition-time-default;
display: flex;
align-items: flex-end;
justify-content: flex-end;
padding: 0.5em;
background: rgb(0 0 0 / 0.6);
background: rgba(20, 20, 30, 0.6);
backdrop-filter: blur(12px);
}
&:hover,
&:focus,
+43 -83
View File
@@ -6,17 +6,18 @@ import {
type ImageType,
} from "@jellyfin/sdk/lib/generated-client";
import { useNavigate } from "@tanstack/react-router";
import type React from "react";
import { memo, useCallback, useState } from "react";
import React, { memo, type Ref, useCallback, useState } from "react";
import { ErrorBoundary } from "react-error-boundary";
import { useInView } from "react-intersection-observer";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { resolveItemImage } from "@/utils/methods/itemImages";
import { useApiInContext } from "@/utils/store/api";
import LikeButton from "../buttons/likeButton";
import MarkPlayedButton from "../buttons/markPlayedButton";
import PlayButton from "../buttons/playButton";
import { getTypeIcon } from "../utils/iconsCollection";
import "./card.scss";
import { getItemLinkOptions } from "@/utils/navigation/itemLink";
interface CardProps {
item: BaseItemDto;
@@ -51,55 +52,26 @@ const CardContent = ({
forwardedRef,
}: CardProps & {
inView: boolean;
forwardedRef?: React.Ref<HTMLDivElement>;
forwardedRef?: Ref<HTMLDivElement>;
}) => {
const api = useApiInContext((s) => s.api);
const navigate = useNavigate();
const [isHovered, setIsHovered] = useState(false);
const image = resolveItemImage(item, imageType, {
seriesId: seriesId ? (item.SeriesId ?? undefined) : undefined,
});
const defaultOnClick = useCallback(() => {
if (item?.Id) {
switch (item?.Type) {
case BaseItemKind.BoxSet:
navigate({ to: "/boxset/$id", params: { id: item.Id } });
break;
case BaseItemKind.Episode:
navigate({ to: "/episode/$id", params: { id: item.Id } });
break;
case BaseItemKind.MusicAlbum:
navigate({ to: "/album/$id", params: { id: item.Id } });
break;
case BaseItemKind.MusicArtist:
navigate({ to: "/artist/$id", params: { id: item.Id } });
break;
case BaseItemKind.Person:
navigate({ to: "/person/$id", params: { id: item.Id } });
break;
case BaseItemKind.Series:
navigate({ to: "/series/$id", params: { id: item.Id } });
break;
case BaseItemKind.Playlist:
navigate({ to: "/playlist/$id", params: { id: item.Id } });
break;
default:
navigate({ to: "/item/$id", params: { id: item.Id } });
break;
}
navigate(getItemLinkOptions(item.Id, item?.Type));
}
}, [item?.Id, item?.Type, navigate]);
const handleInteractionStart = useCallback(() => setIsHovered(true), []);
const handleInteractionEnd = useCallback(() => setIsHovered(false), []);
return (
<div
className="card"
ref={forwardedRef}
onClick={onClick || defaultOnClick}
onMouseEnter={handleInteractionStart}
onMouseLeave={handleInteractionEnd}
onFocus={handleInteractionStart}
onBlur={handleInteractionEnd}
>
<div className={`card-image-container ${cardType}`}>
<ErrorBoundary fallback={<></>}>
@@ -135,20 +107,20 @@ const CardContent = ({
? getTypeIcon(overrideIcon)
: getTypeIcon(item.Type ?? "universal")}
</div>
{inView && (
{image && (
<img
alt={item.Name ?? "blink"}
src={
api
api && image
? overrideIcon === "User"
? `${api?.basePath}/Users/${item.Id}/Images/Primary`
: getImageUrlsApi(api).getItemImageUrlById(
(seriesId ? item.SeriesId : (item.AlbumId ?? item.Id)) ??
"",
imageType,
image.itemId,
image.imageType,
{
quality: 90,
fillWidth: cardType === "thumb" ? 560 : 320,
tag: image.tag,
},
)
: ""
@@ -156,55 +128,43 @@ const CardContent = ({
style={{
height: "100%",
width: "100%",
opacity: 0,
display: "block",
transition: "opacity 0.3s ease-in-out",
}}
loading="lazy"
onLoad={(e) => {
e.currentTarget.style.opacity = "1";
}}
className="card-image"
/>
)}
{inView && !disableOverlay && (
<div className="card-overlay">
{isHovered && (
<>
<PlayButton
item={item}
userId={userId}
itemType={item.Type ?? "Movie"}
currentAudioTrack="auto"
currentSubTrack={-1}
currentVideoTrack={0}
className="card-play-button"
iconOnly
audio={
item.Type === BaseItemKind.MusicAlbum ||
item.Type === BaseItemKind.Audio ||
item.Type === BaseItemKind.AudioBook ||
item.Type === BaseItemKind.Playlist
}
playlistItem={item.Type === BaseItemKind.Playlist}
playlistItemId={item.Id}
/>
<LikeButton
itemId={item.Id}
itemName={item.Name ?? ""}
isFavorite={item.UserData?.IsFavorite}
queryKey={queryKey}
userId={userId}
/>
<MarkPlayedButton
itemId={item.Id}
itemName={item.Name ?? ""}
isPlayed={item.UserData?.Played}
queryKey={queryKey}
userId={userId}
/>
</>
)}
<PlayButton
item={item}
userId={userId}
itemType={item.Type ?? "Movie"}
className="card-play-button"
iconOnly
audio={
item.Type === BaseItemKind.MusicAlbum ||
item.Type === BaseItemKind.Audio ||
item.Type === BaseItemKind.AudioBook ||
item.Type === BaseItemKind.Playlist
}
playlistItem={item.Type === BaseItemKind.Playlist}
playlistItemId={item.Id}
/>
<LikeButton
itemId={item.Id}
itemName={item.Name ?? ""}
isFavorite={item.UserData?.IsFavorite}
queryKey={queryKey}
userId={userId}
/>
<MarkPlayedButton
itemId={item.Id}
itemName={item.Name ?? ""}
isPlayed={item.UserData?.Played}
queryKey={queryKey}
userId={userId}
/>
</div>
)}
{(item.UserData?.PlaybackPositionTicks ?? -1) > 0 && (
+61 -30
View File
@@ -1,51 +1,82 @@
@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 {
// height: 20em;
// Override carousel default outline
&:focus {
outline: none;
}
&-slide {
overflow: visible;
display: flex;
}
&-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;
}
padding-right: 0.5em; // Gap between cards (handled by slide padding instead of gap for carousel)
// With react-multi-carousel, better to rely on their gap logic or item class
}
&-item {
padding-right: 0.6em; // Consistent gap
}
&-header-container {
display: flex;
width: 100%;
justify-content: space-between;
align-items: center;
margin-bottom: 1em;
min-height: 40px;
}
&-heading {
display: flex;
align-items: center;
justify-content: flex-start;
gap: 0.35em;
gap: 0.5em;
position: relative;
margin-bottom: 0.25em !important;
font-weight: 600 !important;
&-decoration {
width: 0.75em;
height: 2px;
background: white;
width: 4px;
height: 24px;
background: $clr-accent-default;
border-radius: 4px;
}
}
&-container .MuiButtonGroup-outlined{
gap: 1em;
}
&-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;
}
}
}
}
.hidden-decoration {
+97 -53
View File
@@ -1,31 +1,66 @@
import React, { type ReactNode } from "react";
import Carousel from "react-multi-carousel";
import React, { type ReactNode, useRef, useState } from "react";
import CarouselModule from "react-multi-carousel";
import "react-multi-carousel/lib/styles.css";
// react-multi-carousel is CJS with `exports.default`; Vite 8 hands default imports the whole
// `module.exports`, so unwrap `.default` when present.
const Carousel = ((
CarouselModule as unknown as { default?: typeof CarouselModule }
).default ?? CarouselModule) as typeof CarouselModule;
import IconButton from "@mui/material/IconButton";
import Typography from "@mui/material/Typography";
import "./cardScroller.scss";
//@ts-ignore - I don't know the prop type for react-multi-carousel's customRightArrow and customLeftArrow
function RightButton(props) {
const { carouselState, children, rtl, ...restProps } = props;
// Custom Header + Button Group component
const ScrollerHeader = ({
onNext,
onPrevious,
title,
headingProps,
disableDecoration,
currentSlide = 0,
isNextDisabled = false,
}: any) => {
// Basic disable logic for visual feedback
const isFirst = currentSlide === 0;
return (
<IconButton className="card-scroller-button right" {...restProps}>
<div className="material-symbols-rounded">chevron_right</div>
</IconButton>
<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
onClick={onNext}
disabled={isNextDisabled}
size="small"
className="scroller-nav-btn"
>
<span className="material-symbols-rounded">chevron_right</span>
</IconButton>
</div>
</div>
);
}
//@ts-ignore - I don't know the prop type for react-multi-carousel's customRightArrow and customLeftArrow
function LeftButton(props) {
const { carouselState, children, rtl, ...restProps } = props;
return (
<IconButton className="card-scroller-button left" {...restProps}>
<div className="material-symbols-rounded">chevron_left</div>
</IconButton>
);
}
};
type CardScrollerProps = {
children: ReactNode;
@@ -44,9 +79,13 @@ export default function CardScroller({
disableDecoration = false,
boxProps,
}: CardScrollerProps) {
const carouselRef = useRef<any>(null);
const [currentSlide, setCurrentSlide] = useState(0);
const [slidesToShow, setSlidesToShow] = useState(displayCards);
const totalItems = React.Children.count(children);
const responsive = {
superLargeDesktop: {
// the naming can be any, depends on you.
breakpoint: { max: 4000, min: 3000 },
items: displayCards + 1,
slidesToSlide: displayCards + 1,
@@ -55,62 +94,67 @@ export default function CardScroller({
desktop: {
breakpoint: { max: 3000, min: 925 },
items: displayCards,
slidesToSlide: displayCards, // optional, default to 1.
slidesToSlide: displayCards,
partialVisibilityGutter: 30,
},
tablet: {
breakpoint: { max: 925, min: 600 },
items: displayCards - 3,
slidesToSlide: displayCards - 3, // optional, default to 1.
items: Math.max(2, displayCards - 2),
slidesToSlide: Math.max(2, displayCards - 2),
partialVisibilityGutter: 20,
},
mobile: {
breakpoint: { max: 600, min: 424 },
items: displayCards - 5,
slidesToSlide: displayCards - 5, // optional, default to 1.
items: Math.max(1, displayCards - 4),
slidesToSlide: Math.max(1, displayCards - 4),
partialVisibilityGutter: 10,
},
smallScreen: {
breakpoint: { max: 424, min: 0 },
items: 1,
slidesToSlide: 1, // optional, default to 1.
slidesToSlide: 1,
partialVisibilityGutter: 10,
},
};
const handleNext = () => {
if (carouselRef.current) {
carouselRef.current.next();
}
};
const handlePrevious = () => {
if (carouselRef.current) {
carouselRef.current.previous();
}
};
return (
<div
{...boxProps}
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"
color="textPrimary"
className="card-scroller-heading"
{...headingProps}
>
<div className="card-scroller-heading-decoration" /> {title}
</Typography>
</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
ref={carouselRef}
swipeable
draggable
responsive={responsive}
arrows
arrows={false}
className="card-scroller"
customTransition="all .6s"
transitionDuration={600}
customRightArrow={<RightButton />}
customLeftArrow={<LeftButton />}
customTransition="transform 400ms ease-in-out"
transitionDuration={400}
containerClass="card-scroller-track"
itemClass="card-scroller-item"
beforeChange={(nextSlide, state) => {
setCurrentSlide(nextSlide);
setSlidesToShow(state.slidesToShow);
}}
>
{children}
</Carousel>
+158 -34
View File
@@ -1,15 +1,47 @@
.carousel {
position: relative;
height: 64vh;
width: calc(100% + 2*$page-margin);
left: -$page-margin;
margin-bottom: 3.2em;
.slider {
position: absolute;
bottom: 0;
max-width: 35%;
right: $page-margin;
overflow: visible;
height: 65vh;
margin-bottom: 3em;
display: grid;
grid-template-areas: "main sidebar";
grid-template-columns: 1fr 340px;
gap: 1.5em;
&-slide-wrapper {
grid-area: main;
position: relative;
height: 100%;
min-width: 0;
overflow: hidden;
border-radius: 20px;
}
&-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 {
position: absolute !important;
top: 50%;
@@ -25,14 +57,102 @@
}
}
&-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 {
aspect-ratio: 1.77777;
overflow: hidden;
border-radius: 2px;
padding: 2px;
transition: opacity $transition-time-fast;
opacity: 0.5;
width: auto;
overflow: hidden;
border-radius: 2px;
padding: 2px;
transition: opacity $transition-time-fast;
opacity: 0.5;
width: auto;
&:hover {
cursor: pointer;
opacity: 0.8;
@@ -44,29 +164,33 @@
align-items: center;
justify-content: center;
}
&-image {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 4px;
}
&-image {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 4px;
}
&-icon {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
background: rgb(155 155 155 / 0.4);
border-radius: 4px;
}
&-icon {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
background: rgb(155 155 155 / 0.4);
border-radius: 4px;
}
&.active {
opacity: 1;
.material-symbols-rounded {
.material-symbols-rounded {
--fill: 1;
}
}
--fill: 1;
}
}
}
}
.carousel-ticker-wrapper {
scroll-margin-block: 24px;
}
+116 -120
View File
@@ -1,28 +1,38 @@
import { AnimatePresence, motion } from "motion/react";
import type { PanInfo } from "motion/react";
import React, { useEffect, useState, useMemo, useCallback } from "react";
import type { MouseEvent, PointerEvent } from "react";
import React, { useCallback, useEffect, useState } from "react";
import type { Api } from "@jellyfin/sdk";
import { useCarouselStore } from "../../utils/store/carousel";
import "./carousel.scss";
import { useApiInContext } from "@/utils/store/api";
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import CarouselSlide from "../carouselSlide";
import {
type BaseItemDto,
BaseItemKind,
} from "@jellyfin/sdk/lib/generated-client";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import Slider from "../Slider";
import { getTypeIcon } from "../utils/iconsCollection";
const swipeConfidenceThreshold = 8000;
const swipePower = (offset: number, velocity: number) => {
return Math.abs(offset) * velocity;
};
import { resolveItemImage } from "@/utils/methods/itemImages";
import { useApiInContext } from "@/utils/store/api";
import CarouselSlide from "../carouselSlide";
import CarouselTickers from "./tickers";
// Memoize CarouselSlide to prevent unnecessary re-renders
const MemoizedCarouselSlide = React.memo(CarouselSlide);
// Memoize Slider to prevent unnecessary re-renders
const MemoizedSlider = React.memo(Slider);
/** Sidebar thumbnail: prefer Thumb, fall back to Backdrop/Primary when missing. */
const tickerImageUrl = (
api: Api,
item: BaseItemDto,
): string | undefined => {
const image = resolveItemImage(item, "Thumb");
if (!image) return undefined;
return getImageUrlsApi(api).getItemImageUrlById(
image.itemId,
image.imageType,
{
quality: 90,
fillHeight: 360,
tag: image.tag,
},
);
};
const Carousel = ({
content,
@@ -32,121 +42,107 @@ const Carousel = ({
onChange: (currentSlide: number) => void;
}) => {
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]);
useEffect(() => {
currentSlideRef.current = currentSlide;
}, [currentSlide]);
useEffect(() => {
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);
// Memoize the content mapping
const sliderContent = useMemo(() => {
return content.map((item, index) => {
return (
<motion.div
className={
currentSlide === index
? "carousel-indicator active"
: "carousel-indicator"
}
layout
initial={{
height: "4.6em",
}}
whileHover={{
height: "5.5em",
}}
transition={{
duration: 0.05,
}}
key={item.Id}
onClick={() => {
if (currentSlide > index) {
setDirection("left");
} else if (currentSlide <= index) {
setDirection("right");
}
setCurrentSlide(index);
}}
>
{item.ImageTags?.Thumb ? (
<img
src={
api &&
getImageUrlsApi(api).getItemImageUrlById(
item.Id ?? "",
"Thumb",
{
tag: item.ImageTags.Primary,
fillWidth: 300,
},
)
}
alt={item.Name ?? "item-image"}
className="carousel-indicator-image"
/>
) : (
<div className="carousel-indicator-icon">
{getTypeIcon(item.Type ?? "Movie")}
</div>
)}
</motion.div>
);
});
}, [content, currentSlide, api, setDirection]);
const handleDragEnd = useCallback(
(
_: MouseEvent | TouchEvent | PointerEvent,
{ offset, velocity }: PanInfo,
) => {
const swipe = swipePower(offset.x, velocity.x);
if (
currentSlide !== content.length - 1 &&
swipe < -swipeConfidenceThreshold
) {
setDirection("right");
setCurrentSlide((init) => init + 1);
} else if (currentSlide !== 0 && swipe > swipeConfidenceThreshold) {
setDirection("left");
setCurrentSlide((init) => init - 1);
}
const handleTickerClick = useCallback(
(index: number) => {
if (index === currentSlideRef.current) return;
setDirection(index > currentSlideRef.current ? "right" : "left");
setCurrentSlide(index);
},
[currentSlide, content.length, setDirection],
[setDirection],
);
if (!api) return null;
return (
<div className="carousel">
<AnimatePresence mode="sync">
<motion.div
key={currentSlide}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{
duration: 0.25,
ease: "linear",
}}
drag={"x"}
dragConstraints={{ left: 0, right: 0 }}
dragElastic={1}
//@ts-ignore
onDragEnd={handleDragEnd}
style={{
height: "100%",
width: "100%",
position: "absolute",
}}
>
<MemoizedCarouselSlide
item={content[currentSlide]}
key={content[currentSlide].Id}
/>
</motion.div>
</AnimatePresence>
<MemoizedSlider currentSlide={currentSlide} content={sliderContent} />
<div
className={`carousel ${isPaused ? "paused" : ""}`}
onMouseEnter={() => setIsPaused(true)}
onMouseLeave={() => setIsPaused(false)}
>
<div className="hero-carousel-slide-wrapper">
<MemoizedCarouselSlide item={content[currentSlide]} />
</div>
<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={tickerImageUrl(api, item)}
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>
);
};
+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;
+150 -173
View File
@@ -1,29 +1,59 @@
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 {
type BaseItemDto,
BaseItemKind,
} 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 { useQuery } from "@tanstack/react-query";
import { motion, type Variants } from "motion/react";
import React from "react";
import { endsAt, getRuntime } from "@/utils/date/time";
import {
getHeroPosterUrl,
getItemImagesQueryOptions,
resolveHeroArtwork,
} from "@/utils/methods/heroArtwork";
import BlurhashCanvas from "../blurhash-canvas";
import { useApiInContext } from "@/utils/store/api";
import { useCarouselStore } from "@/utils/store/carousel";
import { useCentralStore } from "@/utils/store/central";
import LikeButton from "../buttons/likeButton";
import MarkPlayedButton from "../buttons/markPlayedButton";
import PlayButton from "../buttons/playButton";
import { getTypeIcon } from "../utils/iconsCollection";
import { getItemLinkOptions } from "@/utils/navigation/itemLink";
const MotionTypography = motion.create(Typography);
const MotionStack = motion.create(Stack);
const textVariants: Variants = {
// No hidden start state: hero text must not blink on slide changes.
initial: {
x: 0,
opacity: 1,
},
animate: {
x: 0,
opacity: 1,
transition: {
duration: 0.35,
ease: [0.2, 0, 0, 1] as const,
},
},
exit: (direction: string) => ({
x: direction === "right" ? -40 : 40,
opacity: 0,
transition: {
duration: 0.2,
ease: "easeInOut",
},
}),
};
const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
const api = useApiInContext((s) => s.api);
@@ -33,55 +63,44 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
const handleMoreInfo = () => {
if (item.Id) {
switch (item.Type) {
case BaseItemKind.BoxSet:
navigate({ to: "/boxset/$id", params: { id: item.Id } });
break;
case BaseItemKind.Episode:
navigate({ to: "/episode/$id", params: { id: item.Id } });
break;
case BaseItemKind.MusicAlbum:
navigate({ to: "/album/$id", params: { id: item.Id } });
break;
case BaseItemKind.MusicArtist:
navigate({ to: "/artist/$id", params: { id: item.Id } });
break;
case BaseItemKind.Person:
navigate({ to: "/person/$id", params: { id: item.Id } });
break;
case BaseItemKind.Series:
navigate({ to: "/series/$id", params: { id: item.Id } });
break;
case BaseItemKind.Playlist:
navigate({ to: "/playlist/$id", params: { id: item.Id } });
break;
default:
navigate({ to: "/item/$id", params: { id: item.Id } });
break;
}
navigate(getItemLinkOptions(item.Id, item.Type));
}
};
const [animationDirection] = useCarouselStore((state) => [state.direction]);
// Jellyfin stores several images per item (poster, thumb, backdrops).
// Ask the server which ones exist and their real size, then pick the wide one.
const imageInfos = useQuery(getItemImagesQueryOptions(api, item.Id));
const heroArtwork = resolveHeroArtwork(api, item, imageInfos.data);
const heroPoster = heroArtwork?.isPortrait
? getHeroPosterUrl(api, item)
: undefined;
return (
<div className="hero-carousel-slide">
<div className="hero-carousel-background-container">
{item.BackdropImageTags?.length ? (
<motion.div
className="hero-carousel-background-container"
initial={{ opacity: 1 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.4, ease: "easeInOut" }}
>
{heroArtwork?.blurhash && (
<BlurhashCanvas
blurhashString={heroArtwork.blurhash}
width={48}
height={27}
canvasProps={{
className: "hero-carousel-background-blurhash",
}}
/>
)}
{heroArtwork ? (
<img
alt={item.Name ?? "item"}
className="hero-carousel-background-image"
src={
item.ParentBackdropItemId
? `${api?.basePath}/Items/${item.ParentBackdropItemId}/Images/Backdrop?quality=80`
: `${api?.basePath}/Items/${item.Id}/Images/Backdrop?quality=80&fillHeight=1400`
}
style={{
opacity: 0,
}}
onLoad={(e) => {
e.currentTarget.style.opacity = "1";
}}
className={`hero-carousel-background-image${heroArtwork.isPortrait ? " is-poster" : ""}`}
src={heroArtwork.url}
loading="eager"
/>
) : (
@@ -89,40 +108,46 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
{getTypeIcon(item.Type ?? "Movie")}
</div>
)}
</div>
<div className="hero-carousel-detail">
<Typography
component={motion.div}
initial={{
transform:
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",
}}
{heroPoster && (
<img
alt={item.Name ?? "poster"}
className="hero-carousel-poster"
src={heroPoster}
loading="eager"
/>
)}
</motion.div>
<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,
},
},
}}
>
<MotionTypography
custom={animationDirection}
variants={textVariants}
key={item.Id}
variant="h2"
className="hero-carousel-text"
sx={{
fontWeight: 600,
overflow: "visible",
mb: "5px",
}}
fontWeight={200}
overflow="visible"
>
{!item.ImageTags?.Logo ? (
item.Name
@@ -141,42 +166,22 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
}}
/>
)}
</Typography>
<Stack
component={motion.div}
initial={{
transform:
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",
}}
</MotionTypography>
<MotionStack
custom={animationDirection}
variants={textVariants}
direction="row"
gap={2}
className="hero-carousel-info"
mt={1}
justifyItems="flex-start"
alignItems="center"
sx={{
gap: 2,
mt: 1,
justifyItems: "flex-start",
alignItems: "center",
}}
>
{item.PremiereDate && (
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
{item.ProductionYear}
{item.ProductionYear ?? ""}
</Typography>
)}
{item.OfficialRating && (
@@ -239,82 +244,49 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
</div>
)}
{item.RunTimeTicks ? (
{item.RunTimeTicks && (
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
{getRuntime(item.RunTimeTicks)}
</Typography>
) : (
<></>
)}
{item.RunTimeTicks ? (
{item.RunTimeTicks && (
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
{endsAt(
item.RunTimeTicks - (item.UserData?.PlaybackPositionTicks ?? 0),
)}
</Typography>
) : (
<></>
)}
<Typography variant="subtitle2" style={{ opacity: 0.8 }}>
{item.Genres?.slice(0, 4).join(" / ")}
</Typography>
</Stack>
<Typography
component={motion.div}
initial={{
transform:
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",
}}
className="hero-carousel-text"
</MotionStack>
<MotionTypography
custom={animationDirection}
variants={textVariants}
className="hero-carousel-overview"
variant="body1"
sx={{
display: "-webkit-box",
maxWidth: "70%",
maxHeight: "50%",
textOverflow: "ellipsis",
overflow: "hidden",
WebkitLineClamp: "4",
WebkitBoxOrient: "vertical",
fontWeight: 400,
}}
variant="subtitle2"
fontWeight={300}
>
{item.Overview}
</Typography>
</MotionTypography>
<Stack
mt={3}
<MotionStack
direction="row"
gap={3}
width="100%"
className="hero-carousel-button-container"
alignItems="center"
custom={animationDirection}
variants={textVariants}
sx={{
gap: 2,
width: "100%",
alignItems: "center",
}}
>
<PlayButton
item={item}
userId={user?.Id}
itemType={item.Type ?? "Movie"}
currentAudioTrack={0}
currentSubTrack={0}
currentVideoTrack={0}
buttonProps={{
size: "large",
}}
@@ -330,7 +302,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
<Button
size="large"
//@ts-ignore
//@ts-expect-error
color="white"
variant="outlined"
endIcon={
@@ -347,7 +319,12 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
>
More info
</Button>
<Stack direction="row" gap={1}>
<Stack
direction="row"
sx={{
gap: 1,
}}
>
<LikeButton
itemId={item.Id}
queryKey={["home", "latestMedia"]}
@@ -363,8 +340,8 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
itemName={item.Name}
/>
</Stack>
</Stack>
</div>
</MotionStack>
</motion.div>
</div>
);
};
+32 -13
View File
@@ -1,5 +1,4 @@
import { getGenresApi } from "@jellyfin/sdk/lib/utils/api/genres-api";
import { getMusicGenresApi } from "@jellyfin/sdk/lib/utils/api/music-genres-api";
import { getGenreApi } from "@jellyfin/sdk/lib/utils/api/genre-api";
import {
Accordion,
AccordionDetails,
@@ -110,13 +109,13 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
queryFn: async () => {
if (!api || !user?.Id || !currentLibraryId) return { Items: [] } as any;
if (String(collectionType || "").toLowerCase() === "music") {
const res = await getMusicGenresApi(api).getMusicGenres({
const res = await getGenreApi(api).getGenres({
parentId: currentLibraryId,
userId: user.Id,
});
return res.data;
}
const res = await getGenresApi(api).getGenres({
const res = await getGenreApi(api).getGenres({
parentId: currentLibraryId,
userId: user.Id,
});
@@ -164,9 +163,21 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
const restoreGenres = () => setLocalGenreIds(initialGenres);
return (
<Dialog open={open} onClose={onClose} fullWidth maxWidth="sm" keepMounted>
<Dialog
open={open}
onClose={onClose}
fullWidth
maxWidth="sm"
keepMounted
slotProps={{
paper: { className: "glass-dialog-paper" },
}}
>
<DialogTitle>Filters</DialogTitle>
<DialogContent dividers>
<DialogContent
dividers
sx={{ borderColor: "rgba(255, 255, 255, 0.1)" }}
>
<Stack spacing={1.25}>
<Accordion
disableGutters
@@ -186,7 +197,7 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
"& .MuiAccordionSummary-content": { my: 0 },
}}
expandIcon={
<div className="material-symbols-rounded">expand_more</div>
<span className="material-symbols-rounded">expand_more</span>
}
>
<Typography variant="subtitle2">General</Typography>
@@ -236,7 +247,9 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
"& .MuiAccordionSummary-content": { my: 0 },
}}
expandIcon={
<div className="material-symbols-rounded">expand_more</div>
<span className="material-symbols-rounded">
expand_more
</span>
}
>
<Typography variant="subtitle2">Video features</Typography>
@@ -288,7 +301,9 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
"& .MuiAccordionSummary-content": { my: 0 },
}}
expandIcon={
<div className="material-symbols-rounded">expand_more</div>
<span className="material-symbols-rounded">
expand_more
</span>
}
>
<Typography variant="subtitle2">Resolution</Typography>
@@ -334,7 +349,9 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
"& .MuiAccordionSummary-content": { my: 0 },
}}
expandIcon={
<div className="material-symbols-rounded">expand_more</div>
<span className="material-symbols-rounded">
expand_more
</span>
}
>
<Typography variant="subtitle2">Media type</Typography>
@@ -383,7 +400,9 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
"& .MuiAccordionSummary-content": { my: 0 },
}}
expandIcon={
<div className="material-symbols-rounded">expand_more</div>
<span className="material-symbols-rounded">
expand_more
</span>
}
>
<Typography variant="subtitle2">Genres</Typography>
@@ -475,7 +494,7 @@ export const FiltersDialogTrigger: React.FC = () => {
onClick={() => setOpen(true)}
aria-label="Open filters dialog"
>
<div
<span
className="material-symbols-rounded"
style={{ position: "relative" }}
>
@@ -498,7 +517,7 @@ export const FiltersDialogTrigger: React.FC = () => {
{activeCount}
</span>
)}
</div>
</span>
</IconButton>
</Tooltip>
<FiltersDialog open={open} onClose={() => setOpen(false)} />
+40 -45
View File
@@ -1,4 +1,4 @@
import { Link, Typography } from "@mui/material";
import { Link, Tooltip } from "@mui/material";
import React, { memo } from "react";
import anidbIcon from "../../assets/icons/anidb.png";
@@ -12,54 +12,49 @@ import tmdbIcon from "../../assets/icons/themoviedatabase.svg";
import traktIcon from "../../assets/icons/trakt.svg";
import tvMazeIcon from "../../assets/icons/tvmaze.png";
const knownIcons = [
"imdb",
"themoviedb",
"trakt",
"musicbrainz",
"thetvdb",
"anidb",
"anilist",
"tvmaze",
"theaudiodb",
"kitsu",
/**
* Provider icons keyed by the start of the normalized link name, so variants like
* "TMDB"/"TheMovieDb", "TVDB"/"TheTVDB" or "MusicBrainz Artist" all match.
*/
const providerIcons: [prefixes: string[], icon: string][] = [
[["imdb"], imdbIcon],
[["tmdb", "themoviedb"], tmdbIcon],
[["tvdb", "thetvdb"], tvDbIcon],
[["trakt"], traktIcon],
[["musicbrainz"], musicBrainzIcon],
[["anidb"], anidbIcon],
[["anilist"], anilistIcon],
[["tvmaze"], tvMazeIcon],
[["theaudiodb", "audiodb"], audioDBIcon],
[["kitsu"], kitsuIcon],
];
const getProviderIcon = (name: string) => {
const normalized = name.toLocaleLowerCase().replace(/[^a-z0-9]/g, "");
return providerIcons.find(([prefixes]) =>
prefixes.some((prefix) => normalized.startsWith(prefix)),
)?.[1];
};
const IconLink = memo(({ name, url }: { name: string; url: string }) => {
const icon = getProviderIcon(name);
return (
<Link target="_blank" href={url} className="item-detail-link">
{name.toLocaleLowerCase() === "imdb" && <img src={imdbIcon} alt="IMDb" />}
{name.toLocaleLowerCase() === "themoviedb" && (
<img src={tmdbIcon} alt="TheMovieDb" />
)}
{name.toLocaleLowerCase() === "trakt" && (
<img src={traktIcon} alt="Trakt" />
)}
{name.toLocaleLowerCase() === "musicbrainz" && (
<img src={musicBrainzIcon} alt="MusicBrainz" />
)}
{name.toLocaleLowerCase() === "thetvdb" && (
<img src={tvDbIcon} alt="TheTVDB" />
)}
{name.toLocaleLowerCase() === "anidb" && (
<img src={anidbIcon} alt="AniDB" />
)}
{name.toLocaleLowerCase() === "anilist" && (
<img src={anilistIcon} alt="AniList" />
)}
{name.toLocaleLowerCase() === "tvmaze" && (
<img src={tvMazeIcon} alt="TVMaze" />
)}
{name.toLocaleLowerCase() === "theaudiodb" && (
<img src={audioDBIcon} alt="TheAudioDB" />
)}
{name.toLocaleLowerCase() === "kitsu" && (
<img src={kitsuIcon} alt="Kitsu" />
)}
{!knownIcons.includes(name.toLocaleLowerCase()) && (
<Typography>{name}</Typography>
)}
</Link>
<Tooltip title={name}>
<Link
target="_blank"
href={url}
className="item-detail-link"
aria-label={name}
>
{icon ? (
<img src={icon} alt={name} />
) : (
<span className="material-symbols-rounded item-detail-link-generic">
link
</span>
)}
</Link>
</Tooltip>
);
});
+38 -13
View File
@@ -1,4 +1,5 @@
import {
AnimatePresence,
type HTMLMotionProps,
motion,
useScroll,
@@ -17,6 +18,17 @@ interface ItemBackdropProps {
motionProps?: HTMLMotionProps<"img">;
}
const MotionImg = motion.img;
const animationProps = {
// Do not fade in from black on every navigation: cached artwork should be
// visible immediately (a fade here reads as a flash).
initial: { opacity: 1 },
animate: { opacity: 1 },
exit: { opacity: 0 },
transition: { duration: 0.3 },
};
/**
* ItemBackdrop delays applying motion-driven parallax until after mount
* to avoid hydration timing errors ("Target ref is defined but not hydrated").
@@ -24,7 +36,7 @@ interface ItemBackdropProps {
* attached, it renders a static img to prevent motion from touching an
* unhydrated DOM node.
*/
function ItemBackdropContent({
const ItemBackdropContent = React.memo(function ItemBackdropContent({
targetRef,
src,
alt,
@@ -47,19 +59,18 @@ function ItemBackdropContent({
});
const y = useTransform(scrollYProgress, [0, 1], [-distance, distance]);
return (
<motion.img
<MotionImg
alt={alt}
src={src}
className={className ?? "item-hero-backdrop"}
onLoad={(e) => {
e.currentTarget.style.opacity = "1";
onLoad?.(e);
}}
style={{ y }}
{...motionProps}
/>
);
}
});
export function ItemBackdrop({
targetRef,
@@ -90,12 +101,23 @@ export function ItemBackdrop({
return () => cancelAnimationFrame(raf);
}, [targetRef, ready]);
const finalMotionProps = React.useMemo(
() => ({
...animationProps,
...motionProps,
}),
[motionProps],
);
if (!ready) {
return (
<img
alt={alt}
src={src}
className={className ?? "item-hero-backdrop"}
ref={(el) => {
if (el?.complete && el.naturalWidth > 0) el.style.opacity = "1";
}}
onLoad={(e) => {
e.currentTarget.style.opacity = "1";
onLoad?.(e);
@@ -105,15 +127,18 @@ export function ItemBackdrop({
}
return (
<ItemBackdropContent
targetRef={targetRef}
src={src}
alt={alt}
distance={distance}
className={className}
onLoad={onLoad}
motionProps={motionProps}
/>
<AnimatePresence>
<ItemBackdropContent
key={src}
targetRef={targetRef}
src={src}
alt={alt}
distance={distance}
className={className}
onLoad={onLoad}
motionProps={finalMotionProps}
/>
</AnimatePresence>
);
}
+92
View File
@@ -0,0 +1,92 @@
import type { Api } from "@jellyfin/sdk";
import type { BaseItemPerson } from "@jellyfin/sdk/lib/generated-client";
import Typography from "@mui/material/Typography";
import { Link } from "@tanstack/react-router";
import React, { useMemo } from "react";
import { getTypeIcon } from "@/components/utils/iconsCollection";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
const groups = [
{ type: "Actor", title: "Actors" },
{ type: "Writer", title: "Writers" },
{ type: "Director", title: "Directors" },
{ type: "Producer", title: "Producers" },
] as const;
type CastAndCrewProps = {
people: BaseItemPerson[] | null | undefined;
api: Api | undefined;
};
const CastAndCrew = ({ people, api }: CastAndCrewProps) => {
const grouped = useMemo(
() =>
groups.map((group) => ({
...group,
people: people?.filter((person) => person.Type === group.type) ?? [],
})),
[people],
);
if (!people?.length) return null;
return (
<div className="item-detail-cast">
<Typography variant="h5" sx={{ mb: 2 }}>
Cast & Crew
</Typography>
{grouped.map(
(group) =>
group.people.length > 0 && (
<div className="item-detail-cast-container" key={group.type}>
<Typography variant="h6" className="item-detail-cast-title">
{group.title}
</Typography>
<div className="item-detail-cast-grid">
{group.people.map((person) => (
<Link
className="item-detail-cast-card"
key={person.Id}
to="/item/$id"
params={{ id: person.Id ?? "" }}
search={{ type: "Person" }}
>
{person.PrimaryImageTag ? (
<img
alt={person.Name ?? ""}
src={
api &&
getImageUrlsApi(api).getItemImageUrlById(
person.Id ?? "",
"Primary",
{
quality: 80,
fillWidth: 200,
fillHeight: 200,
},
)
}
className="item-detail-cast-card-image"
/>
) : (
<div className="item-detail-cast-card-icon">
{getTypeIcon("Person")}
</div>
)}
<div className="item-detail-cast-card-text">
<Typography variant="subtitle1">{person.Name}</Typography>
<Typography variant="subtitle2" style={{ opacity: 0.5 }}>
{person.Role}
</Typography>
</div>
</Link>
))}
</div>
</div>
),
)}
</div>
);
};
export default CastAndCrew;
@@ -1,91 +1,8 @@
$cardWidth: 18%;
.item-series.item {
.item-detail-page.item {
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-default {
gap: 1.5em;
}
.item-detail {
@@ -95,25 +12,11 @@ $cardWidth: 18%;
align-items: start;
gap: 3em;
&-nextUp {
max-width: 23em;
&.single {
grid-template-columns: 1fr;
}
&-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;
@@ -121,9 +24,9 @@ $cardWidth: 18%;
}
&-grid {
display: grid;
grid-template-columns: repeat(5, minmax(0, 1fr));
gap: 1em;
margin-bottom: 1em;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
&-card {
display: grid;
@@ -166,12 +69,19 @@ $cardWidth: 18%;
text-decoration-color: white;
}
}
&-episode{
display:grid;
&-external-links {
display: flex;
gap: 0.6em;
align-self: end;
margin-top: 1em;
}
&-episode {
display: grid;
grid-template-columns: 3.2em 12em 1fr 6em;
flex-direction: row;
width: 100%;
gap:1.8em;
gap: 1.8em;
align-items: center;
justify-content: center;
cursor: pointer;
@@ -187,24 +97,22 @@ $cardWidth: 18%;
margin-top: 0.5em;
width: 100%;
}
&-image{
&-image {
width: 100%;
height: 100%;
object-fit: cover;
opacity: 0;
transition: opacity $transition-time-default;
position: absolute;
top: 0;
left: 0;
z-index: 0;
&-container{
&-container {
width: 100%;
aspect-ratio: 1.66666;
position: relative;
overflow: hidden;
border-radius: $border-radius-default;
flex-shrink: 0;
&::after{
&::after {
content: "";
position: absolute;
top: 0;
@@ -219,7 +127,7 @@ $cardWidth: 18%;
opacity: 1;
}
}
&-overlay{
&-overlay {
position: absolute;
top: 0;
left: 0;
@@ -244,7 +152,7 @@ $cardWidth: 18%;
}
}
}
&-info{
&-info {
display: flex;
flex-direction: column;
align-items: flex-start;
@@ -253,43 +161,81 @@ $cardWidth: 18%;
width: 100%;
padding-right: 2em;
}
&-buttons{
&-buttons {
display: flex;
gap: 1em;
}
&:hover .item-detail-episode-image-overlay, &:focus-within .item-detail-episode-image-overlay{
&:hover .item-detail-episode-image-overlay,
&:focus-within .item-detail-episode-image-overlay {
opacity: 1;
}
}
}
}
@media (max-width: 1320px) {
.item-series .item-detail {
&-cast {
&-grid {
grid-template-columns: 1fr;
&-person {
&-container {
position: relative;
width: 100%;
}
&-header {
width: 100%;
}
&-cards {
display: grid;
align-items: start;
&.col-7 {
grid-template-columns: repeat(7, minmax(0, 1fr));
}
&.col-4 {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
}
}
&-episodes-container {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
}
}
@media (max-width: 830px) {
.item-series .item-detail {
&-episodes-container {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
// Global item-detail
.item-detail-link {
margin-top: 0.85em !important;
&:hover > img {
filter: brightness(1);
}
& > img {
width: 2em;
aspect-ratio: 1;
filter: brightness(0.5);
transition: filter $transition-time-default;
}
&-generic {
display: block;
font-size: 2em !important;
color: white;
opacity: 0.5;
transition: opacity $transition-time-default;
}
&:hover > &-generic {
opacity: 1;
}
}
@media (max-width: 564px) {
.item-series .item-detail {
&-episodes-container {
grid-template-columns: repeat(1, minmax(0, 1fr));
.item {
gap: 1.5em;
&-hero {
&-image {
box-sizing: border-box;
&-container {
box-sizing: content-box;
box-shadow: 0px 10px 20px -10px rgb(0 0 0 / 0.5) !important;
}
}
&-mediaInfo {
margin-top: 1em;
height: 1.1em;
opacity: 0.8;
&.badge {
margin: 0;
height: 1.2em;
}
}
}
}
@@ -0,0 +1,146 @@
import {
type BaseItemDto,
BaseItemKind,
} from "@jellyfin/sdk/lib/generated-client";
import Typography from "@mui/material/Typography";
import { motion } from "motion/react";
import React, { type ReactNode, useEffect, useRef } from "react";
import LikeButton from "@/components/buttons/likeButton";
import MarkPlayedButton from "@/components/buttons/markPlayedButton";
import TrailerButton from "@/components/buttons/trailerButton";
import IconLink from "@/components/iconLink";
import ItemHeader from "@/components/itemHeader";
import ShowMoreText from "@/components/showMoreText";
import { useApiInContext } from "@/utils/store/api";
import { useBackdropStore } from "@/utils/store/backdrop";
import { useCentralStore } from "@/utils/store/central";
import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
import "./itemDetail.scss";
export const ExternalLinks = ({ item }: { item: BaseItemDto }) => (
<div className="item-detail-external-links">
{item.ExternalUrls?.map(
(url) =>
url.Url &&
url.Name && <IconLink key={url.Url} url={url.Url} name={url.Name} />,
)}
</div>
);
const getDefaultBackdropHash = (item: BaseItemDto) => {
const tag =
item.Type === BaseItemKind.Episode
? item.ParentBackdropImageTags?.[0]
: item.BackdropImageTags?.[0];
return (tag && item.ImageBlurHashes?.Backdrop?.[tag]) || "";
};
type ItemDetailLayoutProps = {
item: BaseItemDto;
/** CSS modifier, rendered as `item-<variant>`. */
variant: "default" | "episode" | "series" | "boxset" | "person";
mediaQualityInfo?: MediaQualityInfo;
backdropSrc?: string | null;
/** Blurhash for the app backdrop; defaults to the item's (or an episode's series) backdrop. */
backdropHash?: string;
/** Play button area; omitted for items that can't be played (people). */
playButton?: ReactNode;
showTrailer?: boolean;
showMarkPlayed?: boolean;
/** Extra content under the overview in the main column. */
main?: ReactNode;
/** Right-hand column next to the overview. */
aside?: ReactNode;
/** Sections rendered below the overview. */
children?: ReactNode;
};
const ItemDetailLayout = ({
item,
variant,
mediaQualityInfo,
backdropSrc,
backdropHash,
playButton,
showTrailer = true,
showMarkPlayed = true,
main,
aside,
children,
}: ItemDetailLayoutProps) => {
const api = useApiInContext((s) => s.api);
const user = useCentralStore((s) => s.currentUser);
const containerRef = useRef<HTMLDivElement | null>(null);
const queryKey = ["item", item.Id ?? ""];
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
const hash = backdropHash ?? getDefaultBackdropHash(item);
useEffect(() => {
setBackdrop(hash);
}, [hash, setBackdrop]);
return (
<motion.div
key={item.Id}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.3, ease: "easeInOut" }}
className={`scrollY padded-top flex flex-column item item-detail-page item-${variant}`}
ref={containerRef}
>
<ItemHeader
item={item}
api={api}
mediaQualityInfo={mediaQualityInfo}
scrollTargetRef={containerRef}
backdropSrc={backdropSrc}
>
<div className="item-hero-buttons-container">
<div className="flex flex-row" style={{ width: "100%" }}>
{playButton}
</div>
<div className="flex flex-row" style={{ gap: "1em" }}>
{showTrailer && item.RemoteTrailers && (
<TrailerButton
trailerItem={item.RemoteTrailers}
disabled={item.RemoteTrailers.length === 0}
/>
)}
<LikeButton
itemName={item.Name}
itemId={item.Id}
queryKey={queryKey}
isFavorite={item.UserData?.IsFavorite}
userId={user?.Id}
/>
{showMarkPlayed && (
<MarkPlayedButton
itemName={item.Name}
itemId={item.Id}
queryKey={queryKey}
isPlayed={item.UserData?.Played}
userId={user?.Id}
/>
)}
</div>
</div>
</ItemHeader>
<div className={aside ? "item-detail" : "item-detail single"}>
<div className="fullWidth">
{(item.Taglines?.length ?? 0) > 0 && (
<Typography variant="h5" sx={{ mb: 2, fontWeight: 300 }}>
{item.Taglines?.[0]}
</Typography>
)}
<ShowMoreText content={item.Overview ?? ""} collapsedLines={4} />
{main}
</div>
{aside && <div className="fullWidth">{aside}</div>}
</div>
{children}
</motion.div>
);
};
export default ItemDetailLayout;
+172
View File
@@ -0,0 +1,172 @@
import {
type BaseItemDto,
type MediaStream,
MediaStreamType,
} from "@jellyfin/sdk/lib/generated-client";
import MenuItem from "@mui/material/MenuItem";
import TextField from "@mui/material/TextField";
import React, { useMemo, useState } from "react";
import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
const titleIncludes = (stream: MediaStream, ...needles: string[]) => {
const title = stream.DisplayTitle?.toLocaleLowerCase();
return needles.some((needle) => title?.includes(needle));
};
const getMediaQualityInfo = (
videoTracks: MediaStream[],
audioTracks: MediaStream[],
): MediaQualityInfo => ({
isAtmos: audioTracks.some((a) => titleIncludes(a, "atmos")),
isDolbyVision: videoTracks.some(
(v) =>
titleIncludes(v, "dv", "dolby vision") ||
!!v.VideoDoViTitle ||
v.VideoRangeType === "DOVI",
),
isDts: audioTracks.some(
(a) =>
titleIncludes(a, "dts") && !titleIncludes(a, "dts-hd ma", "dts-hd.ma"),
),
isDtsHDMA: audioTracks.some((a) =>
titleIncludes(a, "dts-hd ma", "dts-hd.ma"),
),
isDD: audioTracks.some(
(a) =>
(titleIncludes(a, "dd") && !titleIncludes(a, "ddp")) ||
(titleIncludes(a, "dolby digital") &&
!titleIncludes(a, "dolby digital+")),
),
isDDP: audioTracks.some((a) => titleIncludes(a, "ddp", "dolby digital+")),
isUHD: videoTracks.some((v) => titleIncludes(v, "4k", "2160p", "uhd")),
isHD: videoTracks.some(
(v) =>
(titleIncludes(v, "hd") && !titleIncludes(v, "hdr")) ||
titleIncludes(v, "1080p", "fhd"),
),
isSD: videoTracks.some(
(v) =>
(titleIncludes(v, "sd") && !titleIncludes(v, "sdr")) ||
titleIncludes(v, "720p"),
),
isSDR: videoTracks.some((v) => v.VideoRangeType === "SDR"),
isHDR: videoTracks.some(
(v) => v.VideoRange === "HDR" || titleIncludes(v, "dv"),
),
isHDR10: videoTracks.some(
(v) => v.VideoRangeType === "HDR10" && !titleIncludes(v, "hdr10+"),
),
isHDR10Plus: videoTracks.some(
(v) => v.VideoRangeType === "HDR10Plus" || titleIncludes(v, "hdr10+"),
),
isTrueHD: audioTracks.some((a) => titleIncludes(a, "truehd")),
isIMAX: videoTracks.some((v) => titleIncludes(v, "imax")),
});
/**
* Splits an item's media streams into tracks, tracks the user's track selection
* (reset whenever the item changes) and derives the media quality badges.
*/
export const useMediaTracks = (item: BaseItemDto) => {
const tracks = useMemo(() => {
const streams = item.MediaStreams ?? [];
return {
video: streams.filter((s) => s.Type === MediaStreamType.Video),
audio: streams.filter((s) => s.Type === MediaStreamType.Audio),
subtitle: streams.filter((s) => s.Type === MediaStreamType.Subtitle),
};
}, [item.MediaStreams]);
const defaults = {
itemId: item.Id,
video:
tracks.video.find((track) => track.IsDefault)?.Index ??
tracks.video[0]?.Index ??
0,
audio: item.MediaSources?.[0]?.DefaultAudioStreamIndex ?? 0,
subtitle: item.MediaSources?.[0]?.DefaultSubtitleStreamIndex ?? -1,
};
const [selection, setSelection] = useState(defaults);
if (selection.itemId !== item.Id) {
setSelection(defaults);
}
const mediaQualityInfo = useMemo(
() => getMediaQualityInfo(tracks.video, tracks.audio),
[tracks],
);
return {
tracks,
selection,
setSelection: (patch: Partial<Omit<typeof defaults, "itemId">>) =>
setSelection((prev) => ({ ...prev, ...patch })),
mediaQualityInfo,
};
};
type TrackSelectorsProps = Pick<
ReturnType<typeof useMediaTracks>,
"tracks" | "selection" | "setSelection"
>;
export const TrackSelectors = ({
tracks,
selection,
setSelection,
}: TrackSelectorsProps) => (
<>
{tracks.video.length > 0 && (
<TextField
label="Video"
select
style={{ width: "100%", marginBottom: "1em" }}
value={selection.video}
variant="filled"
onChange={(e) => setSelection({ video: Number(e.target.value) })}
>
{tracks.video.map((track) => (
<MenuItem key={track.Index} value={track.Index}>
{track.DisplayTitle}
</MenuItem>
))}
</TextField>
)}
{tracks.audio.length > 0 && (
<TextField
label="Audio"
select
style={{ width: "100%", marginBottom: "1em" }}
value={selection.audio}
variant="filled"
onChange={(e) => setSelection({ audio: Number(e.target.value) })}
>
{tracks.audio.map((track) => (
<MenuItem key={track.Index} value={track.Index}>
{track.DisplayTitle}
</MenuItem>
))}
</TextField>
)}
{tracks.subtitle.length > 0 && (
<TextField
label="Subtitle"
select
style={{ width: "100%" }}
value={selection.subtitle}
variant="filled"
slotProps={{ select: { MenuProps: { disablePortal: true } } }}
onChange={(e) => setSelection({ subtitle: Number(e.target.value) })}
>
<MenuItem key={-1} value={-1}>
No Subtitle
</MenuItem>
{tracks.subtitle.map((track) => (
<MenuItem key={track.Index} value={track.Index}>
{track.DisplayTitle}
</MenuItem>
))}
</TextField>
)}
</>
);
@@ -0,0 +1,67 @@
import {
type BaseItemDto,
BaseItemKind,
} from "@jellyfin/sdk/lib/generated-client";
import { useQuery } from "@tanstack/react-query";
import React from "react";
import { Card } from "@/components/card/card";
import CardScroller from "@/components/cardScroller/cardScroller";
import { getSimilarItemsQueryOptions } from "@/utils/queries/itemDetail";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
export const getItemCardTitle = (item: BaseItemDto) =>
item.Type === BaseItemKind.Episode ? item.SeriesName : item.Name;
export const getItemCardCaption = (item: BaseItemDto) => {
if (item.Type === BaseItemKind.Episode) {
return `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`;
}
if (item.Type === BaseItemKind.Series) {
const end = item.EndDate
? new Date(item.EndDate).toLocaleString([], { year: "numeric" })
: "Present";
return `${item.ProductionYear} - ${end}`;
}
return item.ProductionYear;
};
const SimilarItems = ({ item }: { item: BaseItemDto }) => {
const api = useApiInContext((s) => s.api);
const user = useCentralStore((s) => s.currentUser);
const id = item.Id ?? "";
const similarItems = useQuery(
getSimilarItemsQueryOptions(api, user?.Id, id, item.Type),
);
if (!similarItems.data?.TotalRecordCount) return null;
return (
<CardScroller
title="You might also like"
displayCards={7}
disableDecoration
>
{similarItems.data.Items?.map((similar) => (
<Card
key={similar.Id}
item={similar}
seriesId={similar.SeriesId}
cardTitle={getItemCardTitle(similar)}
imageType="Primary"
cardCaption={getItemCardCaption(similar)}
cardType={
similar.Type === BaseItemKind.MusicAlbum ||
similar.Type === BaseItemKind.Audio
? "square"
: "portrait"
}
queryKey={["item", id, "similarItem"]}
userId={user?.Id}
/>
))}
</CardScroller>
);
};
export default SimilarItems;
@@ -0,0 +1,58 @@
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import { useQuery } from "@tanstack/react-query";
import React from "react";
import PlayButton from "@/components/buttons/playButton";
import { Card } from "@/components/card/card";
import CardScroller from "@/components/cardScroller/cardScroller";
import { getCollectionItemsQueryOptions } from "@/utils/queries/itemDetail";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import ItemDetailLayout, { ExternalLinks } from "../itemDetailLayout";
import SimilarItems, { getItemCardTitle } from "../similarItems";
const BoxSetView = ({ item }: { item: BaseItemDto }) => {
const api = useApiInContext((s) => s.api);
const user = useCentralStore((s) => s.currentUser);
const id = item.Id ?? "";
const collectionItems = useQuery(
getCollectionItemsQueryOptions(api, user?.Id, id),
);
return (
<ItemDetailLayout
item={item}
variant="boxset"
showTrailer={false}
playButton={
<PlayButton
item={item}
itemType={item.Type ?? "BoxSet"}
userId={user?.Id}
buttonProps={{ fullWidth: true }}
/>
}
aside={<ExternalLinks item={item} />}
>
{(collectionItems.data?.TotalRecordCount ?? 0) > 0 && (
<CardScroller title="" displayCards={7} disableDecoration>
{collectionItems.data?.Items?.map((collectionItem) => (
<Card
key={collectionItem.Id}
item={collectionItem}
seriesId={collectionItem.SeriesId}
cardTitle={getItemCardTitle(collectionItem)}
imageType="Primary"
cardCaption={collectionItem.ProductionYear}
cardType="portrait"
queryKey={["item", id]}
userId={user?.Id}
/>
))}
</CardScroller>
)}
<SimilarItems item={item} />
</ItemDetailLayout>
);
};
export default BoxSetView;
@@ -0,0 +1,90 @@
import {
type BaseItemDto,
BaseItemKind,
} from "@jellyfin/sdk/lib/generated-client";
import { useQuery } from "@tanstack/react-query";
import React from "react";
import PlayButton from "@/components/buttons/playButton";
import { Card } from "@/components/card/card";
import CardScroller from "@/components/cardScroller/cardScroller";
import { getUpcomingEpisodesQueryOptions } from "@/utils/queries/itemDetail";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import CastAndCrew from "../castAndCrew";
import ItemDetailLayout, { ExternalLinks } from "../itemDetailLayout";
import { TrackSelectors, useMediaTracks } from "../mediaTracks";
import SimilarItems from "../similarItems";
const UpcomingEpisodes = ({ episode }: { episode: BaseItemDto }) => {
const api = useApiInContext((s) => s.api);
const user = useCentralStore((s) => s.currentUser);
const options = getUpcomingEpisodesQueryOptions(api, user?.Id, episode);
const upcomingEpisodes = useQuery(options);
if (!upcomingEpisodes.data?.Items?.length) return null;
return (
<CardScroller title="Upcoming Episodes" displayCards={4} disableDecoration>
{upcomingEpisodes.data.Items.map((upcoming) => (
<Card
key={upcoming.Id}
item={upcoming}
cardTitle={upcoming.SeriesName}
imageType="Primary"
cardCaption={`S${upcoming.ParentIndexNumber}:E${upcoming.IndexNumber} - ${upcoming.Name}`}
cardType="thumb"
queryKey={options.queryKey as string[]}
userId={user?.Id}
/>
))}
</CardScroller>
);
};
/** Movies, episodes, videos and any other playable item. */
const DefaultView = ({ item }: { item: BaseItemDto }) => {
const api = useApiInContext((s) => s.api);
const user = useCentralStore((s) => s.currentUser);
const { tracks, selection, setSelection, mediaQualityInfo } =
useMediaTracks(item);
const isEpisode = item.Type === BaseItemKind.Episode;
return (
<ItemDetailLayout
item={item}
variant={isEpisode ? "episode" : "default"}
mediaQualityInfo={mediaQualityInfo}
playButton={
<PlayButton
item={item}
itemType={item.Type ?? "Movie"}
audio={item.Type === BaseItemKind.Audio}
currentVideoTrack={selection.video}
currentAudioTrack={selection.audio}
currentSubTrack={selection.subtitle}
userId={user?.Id}
buttonProps={{ fullWidth: true }}
/>
}
aside={
<>
<TrackSelectors
tracks={tracks}
selection={selection}
setSelection={setSelection}
/>
<ExternalLinks item={item} />
</>
}
>
<CastAndCrew people={item.People} api={api} />
{isEpisode ? (
<UpcomingEpisodes episode={item} />
) : (
<SimilarItems item={item} />
)}
</ItemDetailLayout>
);
};
export default DefaultView;
@@ -0,0 +1,145 @@
import {
type BaseItemDto,
BaseItemKind,
} from "@jellyfin/sdk/lib/generated-client";
import Divider from "@mui/material/Divider";
import Tab from "@mui/material/Tab";
import Tabs from "@mui/material/Tabs";
import Typography from "@mui/material/Typography";
import { useQueries } from "@tanstack/react-query";
import { AnimatePresence, motion } from "motion/react";
import React, { useState } from "react";
import { Card } from "@/components/card/card";
import {
getPersonItemsQueryOptions,
personTabs,
} from "@/utils/queries/itemDetail";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import ItemDetailLayout, { ExternalLinks } from "../itemDetailLayout";
import { getItemCardCaption, getItemCardTitle } from "../similarItems";
const PersonView = ({ item }: { item: BaseItemDto }) => {
const api = useApiInContext((s) => s.api);
const user = useCentralStore((s) => s.currentUser);
const id = item.Id ?? "";
const tabQueries = useQueries({
queries: personTabs.map((tab) =>
getPersonItemsQueryOptions(api, user?.Id, id, tab),
),
});
// Until the user picks a tab, show the first one that has items.
const [pickedTab, setPickedTab] = useState<number | null>(null);
const allLoaded = tabQueries.every((query) => query.isSuccess);
const firstNonEmptyTab = tabQueries.findIndex(
(query) => (query.data?.TotalRecordCount ?? 0) > 0,
);
const activeTab =
pickedTab ?? (allLoaded ? Math.max(firstNonEmptyTab, 0) : 0);
const [animationDirection, setAnimationDirection] = useState<
"forward" | "backwards"
>("forward");
return (
<ItemDetailLayout
item={item}
variant="person"
showTrailer={false}
showMarkPlayed={false}
main={<ExternalLinks item={item} />}
aside={
<>
{item.PremiereDate && (
<div>
<Typography variant="h6">Birth</Typography>
<Typography variant="subtitle1" sx={{ opacity: 0.8 }}>
{new Date(item.PremiereDate).toDateString()}
</Typography>
</div>
)}
{item.EndDate && (
<div>
<Typography variant="h6" sx={{ mt: 2 }}>
Death
</Typography>
<Typography variant="subtitle2" sx={{ opacity: 0.8 }}>
{new Date(item.EndDate).toDateString()}
</Typography>
</div>
)}
</>
}
>
<div className="item-detail-person-container">
<div className="item-detail-person-header">
<Tabs
variant="scrollable"
value={activeTab}
onChange={(_, newTab: number) => {
setAnimationDirection(
newTab > activeTab ? "forward" : "backwards",
);
setPickedTab(newTab);
}}
>
{personTabs.map((tab, index) => (
<Tab
key={tab.key}
label={tab.title}
disabled={tabQueries[index].data?.TotalRecordCount === 0}
/>
))}
</Tabs>
<Divider />
</div>
<AnimatePresence>
{personTabs.map((tab, index) => {
if (index !== activeTab) return null;
const query = tabQueries[index];
const isWide =
tab.kind === BaseItemKind.Photo ||
tab.kind === BaseItemKind.Episode;
return (
<motion.div
role="tabpanel"
style={{ marginTop: "1em" }}
className={`item-detail-person-cards ${isWide ? "col-4" : "col-7"}`}
key={tab.key}
initial={{
opacity: 0,
transform:
animationDirection === "forward"
? "translate(30px)"
: "translate(-30px)",
}}
animate={{ opacity: 1, transform: "translate(0px)" }}
transition={{ duration: 0.2, ease: "anticipate" }}
>
{query.data?.Items?.map((tabItem) => (
<Card
key={tabItem.Id}
item={tabItem}
cardTitle={getItemCardTitle(tabItem)}
imageType="Primary"
cardCaption={getItemCardCaption(tabItem)}
cardType={
tabItem.Type === BaseItemKind.Episode
? "thumb"
: "portrait"
}
queryKey={["item", id, tab.key]}
userId={user?.Id}
/>
))}
</motion.div>
);
})}
</AnimatePresence>
</div>
</ItemDetailLayout>
);
};
export default PersonView;
@@ -0,0 +1,367 @@
import {
type BaseItemDto,
BaseItemKind,
ItemFields,
} from "@jellyfin/sdk/lib/generated-client";
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
import { getShowApi } from "@jellyfin/sdk/lib/utils/api/show-api";
import Chip from "@mui/material/Chip";
import CircularProgress from "@mui/material/CircularProgress";
import Divider from "@mui/material/Divider";
import MenuItem from "@mui/material/MenuItem";
import TextField from "@mui/material/TextField";
import Typography from "@mui/material/Typography";
import { useQuery } from "@tanstack/react-query";
import { useNavigate } from "@tanstack/react-router";
import { motion } from "motion/react";
import React from "react";
import LikeButton from "@/components/buttons/likeButton";
import MarkPlayedButton from "@/components/buttons/markPlayedButton";
import PlayButton from "@/components/buttons/playButton";
import { Card } from "@/components/card/card";
import CardScroller from "@/components/cardScroller/cardScroller";
import EpisodeSkeleton from "@/components/skeleton/episode";
import { SeasonSelectorSkeleton } from "@/components/skeleton/seasonSelector";
import { getRuntimeCompact, getRuntimeMusic } from "@/utils/date/time";
import useDefaultSeason from "@/utils/hooks/useDefaultSeason";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import {
getSeasonsQueryOptions,
getSpecialFeaturesQueryOptions,
} from "@/utils/queries/itemDetail";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import CastAndCrew from "../castAndCrew";
import ItemDetailLayout, { ExternalLinks } from "../itemDetailLayout";
import SimilarItems from "../similarItems";
const getEpisodeDateString = (date: Date) =>
new Intl.DateTimeFormat(navigator.language ?? "en-US", {
dateStyle: "full",
}).format(date);
const SeriesView = ({ item }: { item: BaseItemDto }) => {
const api = useApiInContext((s) => s.api);
const user = useCentralStore((s) => s.currentUser);
const navigate = useNavigate();
const id = item.Id ?? "";
const seasons = useQuery(getSeasonsQueryOptions(api, user?.Id, id));
const specialFeatures = useQuery(
getSpecialFeaturesQueryOptions(api, user?.Id, id),
);
const [currentSeason, setCurrentSeason] = useDefaultSeason(seasons, id);
const currentSeasonId = seasons.data?.Items?.[currentSeason]?.Id;
const currentSeasonItem = useQuery({
queryKey: ["item", id, "season", currentSeason],
queryFn: async () => {
if (!api || !currentSeasonId) return null;
const result = await getLibraryApi(api).getItem({
userId: user?.Id,
itemId: currentSeasonId,
});
return result.data;
},
enabled: seasons.isSuccess,
networkMode: "always",
refetchOnWindowFocus: true,
});
const episodes = useQuery({
queryKey: ["item", id, "season", currentSeason, "episodes"],
queryFn: async () => {
if (!api) return null;
const result = await getShowApi(api).getEpisodes({
userId: user?.Id,
seriesId: id,
seasonId: currentSeasonId,
fields: [ItemFields.Overview],
isMissing: false,
});
return result.data;
},
enabled: seasons.isSuccess,
networkMode: "always",
refetchOnWindowFocus: true,
});
// Prefer the selected season's backdrop over the series one.
const season = currentSeasonItem.data;
const backdropOwner = season?.BackdropImageTags?.length ? season : item;
const backdropTag = backdropOwner.BackdropImageTags?.[0];
const backdropSrc =
api && backdropTag
? getImageUrlsApi(api).getItemImageUrlById(
backdropOwner.Id ?? "",
"Backdrop",
{ tag: backdropTag },
)
: undefined;
const backdropHash =
(backdropTag && backdropOwner.ImageBlurHashes?.Backdrop?.[backdropTag]) ||
"";
return (
<ItemDetailLayout
item={item}
variant="series"
backdropSrc={backdropSrc}
backdropHash={backdropHash}
playButton={
<PlayButton
item={item}
itemType={BaseItemKind.Series}
userId={user?.Id}
buttonProps={{ fullWidth: true }}
/>
}
main={<ExternalLinks item={item} />}
>
{seasons.isPending ? (
<SeasonSelectorSkeleton />
) : (
<div className="item-series-seasons-container">
<div
style={{
display: "flex",
width: "100%",
alignItems: "center",
justifyContent: "space-between",
paddingBottom: " 0.5em",
}}
>
<div style={{ display: "flex", gap: "1em" }}>
<Typography variant="h5">
{seasons.data?.Items?.[currentSeason]?.Name}
</Typography>
<Chip
label={
episodes.isPending ? (
<CircularProgress
size={20}
style={{
display: "flex",
alignItems: "center",
justifyContent: "center",
}}
/>
) : (
episodes.data?.TotalRecordCount
)
}
/>
</div>
<div style={{ display: "flex", gap: "0.75em" }}>
{season && (
<>
<LikeButton
itemId={season.Id}
isFavorite={season.UserData?.IsFavorite}
queryKey={["item", id]}
userId={user?.Id}
itemName={season.Name}
/>
<MarkPlayedButton
itemId={season.Id}
isPlayed={season.UserData?.Played}
queryKey={["item", id]}
userId={user?.Id}
itemName={season.Name}
/>
</>
)}
<TextField
value={currentSeason}
onChange={(e) => {
const seasonIndex = Number(e.target.value);
if (Number.isFinite(seasonIndex)) {
setCurrentSeason(seasonIndex);
sessionStorage.setItem(
`season-${id}`,
seasonIndex.toString(),
);
}
}}
select
slotProps={{
select: { MenuProps: { disableScrollLock: true } },
}}
size="small"
>
{seasons.data?.Items?.map((seasonItem, index) => (
<MenuItem key={seasonItem.Id} value={index}>
{seasonItem.Name}
</MenuItem>
))}
</TextField>
</div>
</div>
<Divider />
<div className="item-detail-episode-container">
{episodes.isPending ? (
<EpisodeSkeleton />
) : (
episodes.data?.Items?.map((episode) => (
<motion.div
key={episode.Id}
onClick={() =>
navigate({
to: "/item/$id",
params: { id: episode.Id ?? "" },
search: { type: BaseItemKind.Episode },
})
}
initial={{ transform: "translateY(10px)", opacity: 0 }}
whileInView={{ opacity: 1, transform: "translateY(0px)" }}
viewport={{ once: true }}
transition={{ duration: 0.2, ease: "backInOut" }}
style={{ width: "100%" }}
className="item-detail-episode"
>
<Typography variant="subtitle1" sx={{ textAlign: "center" }}>
{episode.IndexNumberEnd
? `${episode.IndexNumber} / ${episode.IndexNumberEnd}`
: (episode.IndexNumber ?? 0)}
</Typography>
<div
className={
episode.UserData?.Played
? "item-detail-episode-image-container watched"
: "item-detail-episode-image-container"
}
>
<div className="item-detail-episode-image-overlay">
<PlayButton
item={episode}
itemType={BaseItemKind.Episode}
userId={user?.Id}
size="medium"
buttonProps={{
//@ts-expect-error
color: "white",
style: { color: "black " },
}}
iconOnly
/>
</div>
<div className="item-detail-episode-image-icon-container">
<span className="material-symbols-rounded item-detail-episode-image-icon">
tv_gen
</span>
</div>
<img
alt={episode.Name ?? ""}
src={
api &&
getImageUrlsApi(api).getItemImageUrlById(
episode.Id ?? "",
"Primary",
{ tag: episode.ImageTags?.Primary, fillHeight: 300 },
)
}
className="item-detail-episode-image"
onLoad={(e) => {
e.currentTarget.style.opacity = "1";
}}
/>
{(episode.UserData?.PlaybackPositionTicks ?? 0) > 0 && (
<div className="card-progress-container">
<div
className="card-progress"
style={{
width: `${episode.UserData?.PlayedPercentage}%`,
}}
/>
</div>
)}
</div>
<div className="item-detail-episode-info">
<Typography variant="subtitle1">{episode.Name}</Typography>
<div
className="flex flex-row flex-align-center"
style={{ gap: "0.5em" }}
>
{episode.PremiereDate && (
<Chip
variant="filled"
label={getEpisodeDateString(
new Date(episode.PremiereDate),
)}
size="small"
/>
)}
<Typography variant="caption">
{getRuntimeCompact(episode.RunTimeTicks ?? 0)}
</Typography>
</div>
<Typography
variant="caption"
style={{
display: "-webkit-box",
textOverflow: "ellipsis",
overflow: "hidden",
WebkitLineClamp: 2,
WebkitBoxOrient: "vertical",
width: "100%",
opacity: 0.7,
}}
>
{episode.Overview}
</Typography>
</div>
<div
className="item-detail-episode-buttons"
onClick={(e) => e.stopPropagation()}
>
<LikeButton
itemId={episode.Id}
itemName={episode.Name}
isFavorite={episode.UserData?.IsFavorite}
queryKey={["item", id]}
userId={user?.Id}
/>
<MarkPlayedButton
itemId={episode.Id}
itemName={episode.Name}
isPlayed={episode.UserData?.Played}
queryKey={["item", id]}
userId={user?.Id}
/>
</div>
</motion.div>
))
)}
</div>
</div>
)}
<CastAndCrew people={item.People} api={api} />
{(specialFeatures.data?.length ?? 0) > 0 && (
<CardScroller
title="Special Features"
displayCards={7}
disableDecoration
>
{specialFeatures.data?.map((special) => (
<Card
key={special.Id}
item={special}
seriesId={special.SeriesId}
cardTitle={special.Name}
imageType="Primary"
cardCaption={getRuntimeMusic(special.RunTimeTicks ?? 0)}
cardType="portrait"
queryKey={["item", id, "similarItem"]}
userId={user?.Id}
onClick={() => {}}
/>
))}
</CardScroller>
)}
<SimilarItems item={item} />
</ItemDetailLayout>
);
};
export default SeriesView;
+91 -32
View File
@@ -4,6 +4,7 @@ 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 { Link } from "@tanstack/react-router";
import React, { type ReactNode, type RefObject } from "react";
import { Blurhash } from "react-blurhash";
import heroBg from "@/assets/herobg.png";
@@ -34,6 +35,7 @@ interface ItemHeaderProps {
mediaQualityInfo?: MediaQualityInfo;
scrollTargetRef?: RefObject<HTMLDivElement | null>;
children?: ReactNode;
backdropSrc?: string | null;
}
const ItemHeader = ({
@@ -42,7 +44,53 @@ const ItemHeader = ({
mediaQualityInfo,
scrollTargetRef,
children,
backdropSrc,
}: ItemHeaderProps) => {
const isEpisode = item.Type === "Episode";
// A runtime / "ends at" is meaningless for people and artists (it sums their whole catalogue)
const showRuntime = item.Type !== "MusicArtist" && item.Type !== "Person";
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,
})
}
className="item-hero-logo"
/>
) : (
<Typography
variant="h2"
sx={{
mb: 2,
fontWeight: 200,
}}
>
{isEpisode ? item.SeriesName : item.Name}
</Typography>
);
return (
<div className="item-hero">
<div className="item-hero-backdrop-container">
@@ -51,14 +99,15 @@ const ItemHeader = ({
targetRef={scrollTargetRef}
alt={item.Name ?? ""}
backdropSrc={
item.BackdropImageTags?.length
backdropSrc ??
(backdropTag
? api &&
getImageUrlsApi(api).getItemImageUrlById(
item.Id ?? "",
backdropId ?? "",
"Backdrop",
{ tag: item.BackdropImageTags[0] },
{ tag: backdropTag },
)
: undefined
: undefined)
}
fallbackSrc={heroBg}
/>
@@ -91,9 +140,6 @@ const ItemHeader = ({
},
)
}
onLoad={(e) => {
e.currentTarget.style.opacity = "1";
}}
className="item-hero-image"
/>
</div>
@@ -104,33 +150,44 @@ const ItemHeader = ({
)}
</div>
<div className="item-hero-detail flex flex-column">
{item.ImageTags?.Logo ? (
<img
alt={item.Name ?? ""}
src={
api &&
getImageUrlsApi(api).getItemImageUrlById(item.Id ?? "", "Logo", {
quality: 90,
fillWidth: 592,
fillHeight: 592,
tag: item.ImageTags.Logo,
})
}
onLoad={(e) => {
e.currentTarget.style.opacity = "1";
{isEpisode && logoId ? (
<Link
to="/item/$id"
params={{ id: logoId }}
search={{ type: "Series" }}
style={{
textDecoration: "none",
color: "inherit",
width: "fit-content",
}}
className="item-hero-logo"
/>
>
{logo}
</Link>
) : (
<Typography mb={2} fontWeight={200} variant="h2">
logo
)}
{isEpisode && (
<Typography
variant="h4"
sx={{
mb: 2,
fontWeight: 200,
}}
>
{item.ParentIndexNumber !== undefined &&
item.IndexNumber !== undefined
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - `
: ""}
{item.Name}
</Typography>
)}
<Stack
direction="row"
gap={2}
justifyItems="flex-start"
alignItems="center"
sx={{
gap: 2,
justifyItems: "flex-start",
alignItems: "center",
}}
>
{mediaQualityInfo?.isUHD && (
<img
@@ -233,12 +290,12 @@ const ItemHeader = ({
</div>
)}
{item.RunTimeTicks && (
{showRuntime && item.RunTimeTicks && (
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
{getRuntime(item.RunTimeTicks)}
</Typography>
)}
{item.RunTimeTicks && (
{showRuntime && item.RunTimeTicks && (
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
{endsAt(
item.RunTimeTicks - (item.UserData?.PlaybackPositionTicks ?? 0),
@@ -252,9 +309,11 @@ const ItemHeader = ({
{mediaQualityInfo && (
<Stack
direction="row"
gap={2}
justifyItems="flex-start"
alignItems="center"
sx={{
gap: 2,
justifyItems: "flex-start",
alignItems: "center",
}}
>
{mediaQualityInfo?.isHDR10Plus && (
<img
+4 -7
View File
@@ -12,10 +12,8 @@ $cardWidth: 18%;
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%;
@@ -47,8 +45,6 @@ $cardWidth: 18%;
&-logo {
max-width: 34rem;
max-height: 10rem;
opacity: 0;
transition: opacity $transition-time-default;
object-position: bottom;
margin-bottom: 2em;
}
@@ -74,15 +70,16 @@ $cardWidth: 18%;
height: 100vh;
object-fit: cover;
object-position: top;
opacity: 0;
transition: opacity $transition-time-default;
position: absolute;
top: 0;
left: 0;
&-container {
filter: brightness(0.8);
position: absolute;
top: -4.4em;
left: -$page-margin;
width: 100vw;
height: calc(54vh + 4.4em);
height: calc(64vh + 4.4em);
z-index: -1;
mask-image: linear-gradient(to top, transparent, black);
-webkit-mask-image: linear-gradient(
@@ -2,7 +2,7 @@ import React from "react";
import Typography from "@mui/material/Typography";
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
import { useQuery } from "@tanstack/react-query";
import {
@@ -30,7 +30,7 @@ export const ArtistAlbum = ({ user, album, boxProps }: ArtistAlbumProps) => {
queryKey: ["artist", "album", album.Id],
queryFn: async () => {
if (!api) return null;
const result = await getItemsApi(api).getItems({
const result = await getLibraryApi(api).getItems({
userId: user.Id,
parentId: album.Id,
sortOrder: [SortOrder.Ascending],
@@ -91,13 +91,15 @@ export const ArtistAlbum = ({ user, album, boxProps }: ArtistAlbumProps) => {
<div className="flex flex-column">
<Typography
variant="h5"
fontWeight={300}
style={{ opacity: "0.6" }}
sx={{
fontWeight: 300,
}}
>
{album.ProductionYear}
</Typography>
<Link
to="/album/$id"
to="/music/album/$id"
params={{ id: album.Id ?? "" }}
style={{ color: "white", textDecoration: "none" }}
>
@@ -10,32 +10,21 @@ import {
type BaseItemDto,
BaseItemKind,
} from "@jellyfin/sdk/lib/generated-client";
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
import { getLibraryLatestQueryOptions } from "@/utils/queries/items";
/**
* @description Latest Media Section
*/
export const LatestMediaSection = ({
latestMediaLib,
}: { latestMediaLib: BaseItemDto }) => {
}: {
latestMediaLib: BaseItemDto;
}) => {
const api = useApiInContext((s) => s.api);
const user = useCentralStore((s) => s.currentUser);
const fetchLatestMedia = async (library: BaseItemDto) => {
if (!api || !user?.Id) return null;
const media = await getUserLibraryApi(api).getLatestMedia({
userId: user.Id,
parentId: library.Id,
limit: 16,
fields: ["PrimaryImageAspectRatio", "ParentId"],
});
return media.data;
};
const data = useQuery({
queryKey: ["home", "latestMedia", latestMediaLib.Id],
queryFn: () => fetchLatestMedia(latestMediaLib),
enabled: !!user?.Id,
refetchOnMount: true,
});
const data = useQuery(
getLibraryLatestQueryOptions(api, user?.Id, latestMediaLib.Id),
);
if (data.isPending) {
return <CardsSkeleton />;
}
+152 -113
View File
@@ -1,6 +1,6 @@
import type { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
import { ItemSortBy, SortOrder } from "@jellyfin/sdk/lib/generated-client";
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
import {
AppBar,
Chip,
@@ -13,16 +13,18 @@ import {
import { useQueryClient, useSuspenseQuery } from "@tanstack/react-query";
import { getRouteApi, useNavigate } from "@tanstack/react-router";
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 { AVAILABLE_VIEWS, SORT_BY_OPTIONS } from "@/utils/constants/library";
import { getLibraryQueryOptions } from "@/utils/queries/library";
// import removed: header reads name/count from Zustand slice
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 { FiltersDialogTrigger } from "../filtersDialog";
import { UserAvatarMenu } from "../userAvatarMenu";
import "./libraryHeader.scss";
const route = getRouteApi("/_api/library/$id");
@@ -180,7 +182,7 @@ export const LibraryHeader = () => {
await queryClient.prefetchQuery({
queryKey: key,
queryFn: async () => {
const result = await getItemsApi(api).getItems({
const result = await getLibraryApi(api).getItems({
userId: user.Id!,
parentId: currentLibraryId,
recursive: true,
@@ -231,9 +233,8 @@ export const LibraryHeader = () => {
const libraryName = libraryNameFromStore ?? currentLibrary.data.Name;
const totalCount = itemsTotalCount;
const handleNavigateToSearch = useCallback(
() => navigate({ to: "/search", search: { query: "" } }),
[navigate],
const toggleSearchDialog = useSearchStore(
useShallow((s) => s.toggleSearchDialog),
);
const handleNavigateToHome = useCallback(
() => navigate({ to: "/home" }),
@@ -244,119 +245,157 @@ export const LibraryHeader = () => {
[navigate],
);
const [showDrawer, setShowDrawer] = useState(false);
const handleDrawerClose = useCallback(() => {
setShowDrawer(false);
}, []);
const handleDrawerOpen = useCallback(() => {
setShowDrawer(true);
}, []);
return (
<AppBar
className={
scrollTrigger
? "library-header scrolling flex flex-row"
: "library-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>
<MemoizeBackButton />
<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" }}
<>
<AppBar
data-tauri-drag-region
className={
scrollTrigger
? "library-header scrolling flex flex-row"
: "library-header flex flex-row"
}
style={appBarStyling}
elevation={0}
color="transparent"
>
<div
className="library-title-count flex flex-row flex-align-center"
title={`${libraryName}${typeof totalCount === "number" ? ` · ${totalCount.toLocaleString()} items` : ""}`}
>
<Typography variant="subtitle1" noWrap align="center">
{libraryName}
</Typography>
{typeof totalCount === "number" && (
<Chip label={totalCount} sx={{ px: 0.5, ml: 1 }} />
)}
<div className="flex flex-row" data-tauri-drag-region style={{ gap: "0.6em" }}>
<IconButton onClick={handleDrawerOpen}>
<div className="material-symbols-rounded">menu</div>
</IconButton>
<MemoizeBackButton />
<IconButton onClick={handleNavigateToHome}>
<div
className={
location.pathname === "/home"
? "material-symbols-rounded fill"
: "material-symbols-rounded"
}
>
home
</div>
</IconButton>
</div>
<TextField
select
size="small"
value={String(normalizedViewType)}
onChange={handleChangeViewType}
>
{compatibleViews.map((v) => (
<MenuItem key={String(v.value)} value={String(v.value)}>
{v.title}
</MenuItem>
))}
</TextField>
<IconButton
onClick={handleSortAscendingToggle}
aria-label="Toggle sort order"
<div
className="flex flex-row library-header-center"
style={{ gap: "0.6em" }}
>
<div
className="material-symbols-rounded"
style={{
transform: sortAscending ? "rotateX(0deg)" : "rotateX(180deg)",
className="library-title-count flex flex-row flex-align-center"
title={`${libraryName}${typeof totalCount === "number" ? ` · ${totalCount.toLocaleString()} items` : ""}`}
>
<Typography variant="subtitle1" noWrap align="center">
{libraryName}
</Typography>
{typeof totalCount === "number" && (
<Chip label={totalCount} sx={{ px: 0.5, ml: 1 }} />
)}
</div>
<TextField
select
size="small"
value={String(normalizedViewType)}
onChange={handleChangeViewType}
slotProps={{
select: {
MenuProps: {
slotProps: { paper: { className: "glass-menu-paper" } },
},
},
}}
>
sort
</div>
</IconButton>
<TextField
select
size="small"
value={normalizedSortBy}
onChange={handleChangeSortBy}
disabled={disableSortOption}
>
{SORT_BY_OPTIONS.map((option) => {
const isCompatible =
option.compatibleViewTypes?.includes(currentViewType as any) ||
option.compatibleCollectionTypes?.includes(
currentLibrary.data.CollectionType as any,
);
if (!isCompatible) return null;
const valueStr = Array.isArray(option.value)
? option.value.join(",")
: option.value;
return (
<MenuItem
key={
Array.isArray(option.value)
? option.value.join(",")
: option.value
}
value={valueStr}
onMouseEnter={() =>
prefetchItems(String(valueStr), sortAscending)
}
>
{option.title}
<MenuItem disabled value="">
<Typography variant="overline" color="textSecondary">
View
</Typography>
</MenuItem>
{compatibleViews.map((v) => (
<MenuItem key={String(v.value)} value={String(v.value)}>
{v.title}
</MenuItem>
);
})}
</TextField>
<FiltersDialogTrigger />
</div>
<div className="flex flex-row" style={{ gap: "0.6em" }}>
<IconButton onClick={handleNavigateToSearch}>
<div className="material-symbols-rounded">search</div>
</IconButton>
<IconButton onClick={handleNavigateToFavorite}>
<div className="material-symbols-rounded">favorite</div>
</IconButton>
<UserAvatarMenu />
</div>
</AppBar>
))}
</TextField>
<IconButton
onClick={handleSortAscendingToggle}
aria-label="Toggle sort order"
>
<div
className="material-symbols-rounded"
style={{
transform: sortAscending ? "rotateX(0deg)" : "rotateX(180deg)",
}}
>
sort
</div>
</IconButton>
<TextField
select
size="small"
value={normalizedSortBy}
onChange={handleChangeSortBy}
disabled={disableSortOption}
slotProps={{
select: {
MenuProps: {
slotProps: { paper: { className: "glass-menu-paper" } },
},
},
}}
>
<MenuItem disabled value="">
<Typography variant="overline" color="textSecondary">
Sort By
</Typography>
</MenuItem>
{SORT_BY_OPTIONS.map((option) => {
const isCompatible =
option.compatibleViewTypes?.includes(currentViewType as any) ||
option.compatibleCollectionTypes?.includes(
currentLibrary.data.CollectionType as any,
);
if (!isCompatible) return null;
const valueStr = Array.isArray(option.value)
? option.value.join(",")
: option.value;
return (
<MenuItem
key={
Array.isArray(option.value)
? option.value.join(",")
: option.value
}
value={valueStr}
onMouseEnter={() =>
prefetchItems(String(valueStr), sortAscending)
}
>
{option.title}
</MenuItem>
);
})}
</TextField>
<FiltersDialogTrigger />
</div>
<div className="flex flex-row" style={{ gap: "0.6em" }}>
<IconButton onClick={toggleSearchDialog}>
<div className="material-symbols-rounded">search</div>
</IconButton>
<IconButton onClick={handleNavigateToFavorite}>
<div className="material-symbols-rounded">favorite</div>
</IconButton>
<UserAvatarMenu />
</div>
</AppBar>
<NavigationDrawer open={showDrawer} onClose={handleDrawerClose} />
</>
);
};
+37 -27
View File
@@ -1,34 +1,44 @@
.library-header {
display: flex;
align-items: center;
justify-content: space-between;
inset: 1em 1em auto 1em !important;
border-radius: 9999px;
margin: 0 auto;
width: fit-content;
position: sticky;
display: flex;
align-items: center;
justify-content: space-between;
inset: 1em 2em auto 2em !important;
border-radius: 9999px;
margin: 0 auto;
width: fit-content;
position: sticky;
width: calc(100vw - 4em) !important;
z-index: 10;
z-index: 10;
padding: 0.25em !important;
transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
html.is-macos & {
// The window has an overlay titlebar: keep controls clear of the traffic lights
// without pushing the right-hand actions out of the viewport.
padding-left: 72px !important;
width: calc(100vw - 4em - 72px) !important;
left: calc(2em + 72px) !important;
right: 2em !important;
}
&::after {
content: "";
position: absolute;
backdrop-filter: blur(40px);
inset: -0.35em;
pointer-events: none;
border-radius: inherit;
box-shadow: 0 0 25px rgb(0 0 0 / 0.45);
background: rgb(0 0 0 / 0.4);
opacity: 0;
z-index: -1;
transition: opacity $transition-time-fast;
}
&.scrolling {
content: "";
position: absolute;
inset: -0.35em;
pointer-events: none;
border-radius: inherit;
// Solid titlebar surface: no glass/blur.
background-color: $clr-background-default;
border: 1px solid rgb(255 255 255 / 0.08);
box-shadow: 0 4px 20px rgb(0 0 0 / 0.4);
opacity: 0;
z-index: -1;
transition: opacity 150ms;
}
&.scrolling {
&::after {
opacity: 1;
}
}
opacity: 1;
}
}
}
+28 -17
View File
@@ -20,7 +20,6 @@ import { useApiInContext } from "@/utils/store/api";
import { useBackdropStore } from "@/utils/store/backdrop";
import { useCentralStore } from "@/utils/store/central";
import { useLibraryStateStore } from "@/utils/store/libraryState";
// @ts-expect-error: Vite worker import
import BackdropWorker from "@/utils/workers/backdrop.worker?worker";
import { Card } from "../card/card";
@@ -128,6 +127,7 @@ const LibraryItemsGrid = () => {
// --- Virtualization setup ---
const parentRef = useRef<HTMLDivElement | null>(null);
const [containerWidth, setContainerWidth] = useState<number>(0);
const [scrollMargin, setScrollMargin] = useState<number>(0);
// Determine column count based on container width (simple heuristic)
const [columns, setColumns] = useState(1);
@@ -135,6 +135,7 @@ const LibraryItemsGrid = () => {
if (!parentRef.current) return;
const width = parentRef.current.clientWidth;
setContainerWidth(width);
setScrollMargin(parentRef.current.offsetTop);
// Base desired approximate card width (including gap) 180px
const ideal = Math.max(1, Math.floor(width / 180));
setColumns(ideal);
@@ -146,7 +147,14 @@ const LibraryItemsGrid = () => {
const ro = new ResizeObserver(() => measureColumns());
ro.observe(parentRef.current);
return () => ro.disconnect();
// The header above the grid can change height (filters, wrapping): keep the
// window-virtualizer offset in sync so rows never jump while scrolling.
ro.observe(document.body);
window.addEventListener("resize", measureColumns);
return () => {
ro.disconnect();
window.removeEventListener("resize", measureColumns);
};
}, [measureColumns]);
const itemCount = items.data?.Items?.length ?? 0;
@@ -162,23 +170,30 @@ const LibraryItemsGrid = () => {
return Math.floor((containerWidth - totalGap) / columns);
}, [columns, containerWidth]);
// Approximate tallest card height (portrait ratio ~ 2:3 => height ≈ width / 0.666) + text/footer area
// We add a small buffer (20px) for hover overlays and progress bars
const estimatedTallCardHeight = useMemo(
() => Math.round(cardWidth / 0.666666 + 90),
[cardWidth],
);
// Approximate card height: width / aspect ratio + text block (title + caption).
// Square artwork (music, genres) is shorter than portrait posters.
const cardAspect = useMemo(() => {
const first = items.data?.Items?.[0];
const square =
first?.Type === BaseItemKind.MusicAlbum ||
first?.Type === BaseItemKind.Audio ||
first?.Type === BaseItemKind.Genre ||
first?.Type === BaseItemKind.MusicGenre ||
first?.Type === BaseItemKind.Studio ||
first?.Type === BaseItemKind.Playlist;
return square ? 1 : 0.666666;
}, [items.data?.Items]);
const estimateRowHeight = useCallback(
() => estimatedTallCardHeight,
[estimatedTallCardHeight],
() => Math.round(cardWidth / cardAspect + 60),
[cardWidth, cardAspect],
);
const virtualizer = useWindowVirtualizer({
count: rowCount,
estimateSize: estimateRowHeight,
overscan: 6,
scrollMargin: parentRef.current?.offsetTop ?? 0,
overscan: 4,
scrollMargin,
});
const virtualItems = virtualizer.getVirtualItems();
@@ -246,13 +261,9 @@ const LibraryItemsGrid = () => {
flexDirection: "row",
alignItems: "flex-start",
gap: `${cardGap}px`,
// Allow natural height; virtualizer will update size after measurement.
paddingBottom: "0.6em",
}}
data-index={row.index}
ref={(el) => {
if (el) virtualizer.measureElement(el);
}}
ref={virtualizer.measureElement}
>
{items.data?.Items?.slice(startIndex, endIndex).map(
(item: BaseItemDto, localIndex: number) => {
+3 -5
View File
@@ -17,10 +17,8 @@ const CreatedListItemLink = forwardRef<HTMLAnchorElement, MUIListItemLinkProps>(
(props, ref) => (
<ListItem component="a" ref={ref} {...props}>
<ListItemButton
style={{
borderRadius: "100px",
gap: "0.85em",
color: "white",
sx={{
color: "inherit",
textDecoration: "none",
}}
>
@@ -40,7 +38,7 @@ export default ListItemLink;
return (
<li>
{/* @ts-ignore /*}
{/* @ts-expect-error /*}
<ListItem
component={Link}
activeClassName="active"
+88
View File
@@ -0,0 +1,88 @@
import { getBrandingApi } from "@jellyfin/sdk/lib/utils/api/branding-api";
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
import { useQuery } from "@tanstack/react-query";
import { Link } from "@tanstack/react-router";
import React, { type ReactNode, useEffect } from "react";
import { useApiInContext } from "@/utils/store/api";
import { useBackdropStore } from "@/utils/store/backdrop";
import "./loginShell.scss";
type LoginShellProps = {
title: ReactNode;
subtitle?: ReactNode;
/** Max width of the content column. */
width?: "narrow" | "wide";
children: ReactNode;
footer?: ReactNode;
};
/** Shared full-screen layout for the sign-in pages. */
const LoginShell = ({
title,
subtitle,
width = "narrow",
children,
footer,
}: LoginShellProps) => {
const api = useApiInContext((s) => s.api);
const serverInfo = useQuery({
queryKey: ["login", "serverInfo"],
queryFn: async () =>
api ? (await getSystemApi(api).getPublicSystemInfo()).data : null,
enabled: Boolean(api),
staleTime: 5 * 60_000,
});
const branding = useQuery({
queryKey: ["login", "branding"],
queryFn: async () =>
api ? (await getBrandingApi(api).getBrandingOptions()).data : null,
enabled: Boolean(api),
staleTime: 5 * 60_000,
});
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
useEffect(() => {
setBackdrop("");
}, [setBackdrop]);
const serverName = serverInfo.data?.ServerName;
const serverHost = api?.basePath.replace(/^https?:\/\//, "");
return (
<div className="login-shell scrollY" data-tauri-drag-region>
<div className={`login-shell-content login-shell-${width}`}>
{serverHost && (
<div className="login-shell-server">
<span className="material-symbols-rounded">dns</span>
<span className="login-shell-server-name" title={serverHost}>
{serverName ?? serverHost}
</span>
<Link to="/setup/server/list" className="login-shell-server-change">
Change
</Link>
</div>
)}
<header className="login-shell-header">
<h1 className="login-shell-title">{title}</h1>
{subtitle && <p className="login-shell-subtitle">{subtitle}</p>}
</header>
<main className="login-shell-body">{children}</main>
{footer && <footer className="login-shell-footer">{footer}</footer>}
{branding.data?.LoginDisclaimer && (
<aside className="login-shell-disclaimer">
<span className="material-symbols-rounded">info</span>
<p>{branding.data.LoginDisclaimer}</p>
</aside>
)}
</div>
</div>
);
};
export default LoginShell;
+278
View File
@@ -0,0 +1,278 @@
.login-shell {
// In normal flow (not fixed) so the app bar above stays clickable
position: relative;
min-height: 100vh;
width: 100%;
display: flex;
justify-content: center;
padding: 5rem 1.5rem 3rem;
box-sizing: border-box;
color: white;
// Soft accent glow instead of a boxed card
background:
radial-gradient(ellipse 60% 45% at 50% 0%, rgb(255 41 128 / 0.14), transparent 70%),
radial-gradient(ellipse 50% 40% at 50% 100%, rgb(110 0 184 / 0.18), transparent 70%);
&-content {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
margin: auto 0;
gap: 1.5rem;
}
&-narrow {
max-width: 380px;
}
&-wide {
max-width: 880px;
}
&-server {
display: inline-flex;
align-items: center;
gap: 0.5rem;
max-width: 100%;
padding: 0.35rem 0.5rem 0.35rem 0.75rem;
border-radius: 999px;
background: rgb(255 255 255 / 0.06);
border: 1px solid rgb(255 255 255 / 0.08);
font-size: 0.85rem;
.material-symbols-rounded {
font-size: 1.1rem;
opacity: 0.6;
}
&-name {
opacity: 0.85;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
&-change {
flex-shrink: 0;
padding: 0.15rem 0.6rem;
border-radius: 999px;
color: white;
font-weight: 600;
text-decoration: none;
background: rgb(255 255 255 / 0.08);
transition: background 0.15s ease;
&:hover,
&:focus-visible {
background: rgb(255 255 255 / 0.16);
outline: none;
}
}
}
&-header {
text-align: center;
margin-top: 0.5rem;
}
&-title {
margin: 0;
font-size: clamp(1.75rem, 4vw, 2.5rem);
font-weight: 700;
letter-spacing: -0.02em;
line-height: 1.15;
}
&-subtitle {
margin: 0.5rem 0 0;
opacity: 0.65;
}
&-body {
width: 100%;
}
&-footer {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 0.5rem 1rem;
opacity: 0.85;
}
&-disclaimer {
display: flex;
gap: 0.6rem;
max-width: 480px;
padding: 0.9rem 1rem;
border-radius: 0.75rem;
background: rgb(255 255 255 / 0.04);
border: 1px solid rgb(255 255 255 / 0.08);
font-size: 0.85rem;
line-height: 1.5;
.material-symbols-rounded {
font-size: 1.2rem;
opacity: 0.6;
}
p {
margin: 0;
opacity: 0.75;
}
}
}
// Text-style secondary action used in login footers
.login-link {
all: unset;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 0.35rem;
padding: 0.4rem 0.75rem;
border-radius: 999px;
font-size: 0.9rem;
color: rgb(255 255 255 / 0.75);
text-decoration: none;
transition: background 0.15s ease, color 0.15s ease;
.material-symbols-rounded {
font-size: 1.15rem;
}
&:hover,
&:focus-visible {
color: white;
background: rgb(255 255 255 / 0.08);
}
}
// Profile picker
.profile-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(128px, 148px));
justify-content: center;
gap: 1.5rem 1rem;
}
.profile {
all: unset;
display: flex;
flex-direction: column;
align-items: center;
gap: 0.75rem;
padding: 0.75rem 0.5rem;
border-radius: 1rem;
cursor: pointer;
color: white;
text-decoration: none;
text-align: center;
&-avatar {
position: relative;
width: 112px;
height: 112px;
border-radius: 50%;
// Ring that lights up on hover / focus
box-shadow: 0 0 0 3px transparent, 0 10px 24px rgb(0 0 0 / 0.4);
transition: box-shadow 0.2s ease, transform 0.2s ease;
img,
.profile-avatar-fallback {
width: 100%;
height: 100%;
border-radius: 50%;
object-fit: cover;
}
&-fallback {
display: flex;
align-items: center;
justify-content: center;
font-size: 2.75rem;
font-weight: 700;
background: linear-gradient(135deg, $clr-accent-default, $clr-secondary-default);
}
&-add {
display: flex;
align-items: center;
justify-content: center;
background: rgb(255 255 255 / 0.06);
border: 2px dashed rgb(255 255 255 / 0.25);
box-sizing: border-box;
.material-symbols-rounded {
font-size: 2.5rem;
opacity: 0.7;
}
}
}
&-lock {
position: absolute;
right: 2px;
bottom: 2px;
width: 28px;
height: 28px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
background: rgb(18 18 24);
border: 2px solid rgb(18 18 24);
box-sizing: border-box;
.material-symbols-rounded {
font-size: 1rem;
opacity: 0.8;
}
}
&-name {
max-width: 100%;
font-weight: 600;
opacity: 0.8;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
transition: opacity 0.2s ease;
}
&:hover,
&:focus-visible {
.profile-avatar {
transform: translateY(-3px);
box-shadow: 0 0 0 3px $clr-accent-default, 0 14px 30px rgb(0 0 0 / 0.5);
}
.profile-name {
opacity: 1;
}
}
}
// Password / manual sign-in form
.login-form {
display: flex;
flex-direction: column;
gap: 1rem;
width: 100%;
&-avatar {
display: flex;
justify-content: center;
margin-bottom: 0.25rem;
.profile-avatar {
width: 96px;
height: 96px;
}
}
&-options {
display: flex;
align-items: center;
justify-content: space-between;
margin: -0.25rem 0;
}
&-submit.MuiButton-root {
height: 48px;
border-radius: 12px;
font-weight: 700;
text-transform: none;
font-size: 1rem;
}
}
@@ -0,0 +1,59 @@
import type { Api } from "@jellyfin/sdk";
import type { UserDto } from "@jellyfin/sdk/lib/generated-client";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { queryOptions } from "@tanstack/react-query";
import React, { useState } from "react";
import { useApiInContext } from "@/utils/store/api";
/** Public (listed) users of the current server; shared by the login pages. */
export const getPublicUsersQueryOptions = (api: Api | null | undefined) =>
queryOptions({
queryKey: ["login", "public-users"],
queryFn: async () =>
api ? (await getUserApi(api).getPublicUsers()).data : [],
enabled: Boolean(api),
});
type ProfileAvatarProps = {
userId: string;
name: string;
imageTag?: string | null;
/** Shows a lock badge for password-protected profiles. */
locked?: boolean;
};
/** Round profile picture, falling back to the user's initial. */
export const ProfileAvatar = ({
userId,
name,
imageTag,
locked,
}: ProfileAvatarProps) => {
const api = useApiInContext((s) => s.api);
const [failed, setFailed] = useState(false);
const showImage = api && imageTag && !failed;
return (
<span className="profile-avatar">
{showImage ? (
<img
alt=""
src={`${api.basePath}/Users/${userId}/Images/Primary?quality=85&fillWidth=224&fillHeight=224&tag=${imageTag}`}
onError={() => setFailed(true)}
/>
) : (
<span className="profile-avatar-fallback" aria-hidden>
{name.trim().charAt(0).toUpperCase() || "?"}
</span>
)}
{locked && (
<span className="profile-lock" title="Password protected">
<span className="material-symbols-rounded">lock</span>
</span>
)}
</span>
);
};
export const isPasswordProtected = (user: UserDto | undefined) =>
user?.HasPassword !== false;
+4 -2
View File
@@ -116,14 +116,16 @@ const MusicTrack = ({
>
<Typography
variant="subtitle2"
fontWeight="400"
style={{
textDecoration: "none",
}}
sx={{
fontWeight: "400",
}}
>
<Link
style={{ textDecoration: "none", color: "white" }}
to="/artist/$id"
to="/music/artist/$id"
params={{ id: artist.Id ?? "" }}
>
{artist.Name}
@@ -1,4 +1,3 @@
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import { yellow } from "@mui/material/colors";
@@ -29,10 +28,21 @@ export const EmptyNotice = ({ extraMsg }: { extraMsg?: string }) => {
>
sentiment_dissatisfied
</div>
<Typography variant="h4" fontWeight={300}>
<Typography
variant="h4"
sx={{
fontWeight: 300,
}}
>
No results found
</Typography>
<Typography variant="subtitle1" fontWeight={300} style={{ opacity: 0.5 }}>
<Typography
variant="subtitle1"
style={{ opacity: 0.5 }}
sx={{
fontWeight: 300,
}}
>
{extraMsg}
</Typography>
</Box>
@@ -29,13 +29,18 @@ export const ErrorNotice = ({ error }: { error?: Error }) => {
>
error
</div>
<Typography variant="h3" color="white" fontWeight={300}>
<Typography
variant="h3"
sx={{
color: "white",
fontWeight: 300,
}}
>
Something went wrong.
</Typography>
<Typography
fontFamily="JetBrains Mono Variable"
fontWeight={100}
variant="h5"
variant="body2"
component="pre"
style={{
padding: "0.5em",
background: "rgb(0 0 0 / 1)",
@@ -45,11 +50,16 @@ export const ErrorNotice = ({ error }: { error?: Error }) => {
maxHeight: "20em",
overflow: "auto",
marginTop: "1em",
// opacity: 0.6,
whiteSpace: "pre-wrap",
}}
sx={{
color: "grey.400",
fontFamily: "JetBrains Mono Variable",
}}
color="gray"
>
{JSON.stringify(error?.stack)}
{error
? error.stack || `${error.name}: ${error.message}`
: "Unknown error"}
</Typography>
</Box>
);
+1 -1
View File
@@ -57,7 +57,7 @@ const OutroCard = (props: { handleShowCredits: () => void }) => {
</Typography>
<div className="outro-card-content-buttons">
<Button
onClick={handlePlayNext.mutate}
onClick={() => handlePlayNext.mutate()}
//@ts-ignore
color="white"
variant="contained"
@@ -1,108 +1,228 @@
$image-size: 4em;
$art-size: 48px;
.audio-player {
position: fixed;
bottom: 0;
right: 0;
z-index: 10;
bottom: 0.75rem;
left: 50%;
transform: translateX(-50%);
width: min(1100px, calc(100% - 1.5rem));
height: 80px;
box-sizing: border-box;
z-index: 100;
display: grid;
padding: 0.5em 1.5em;
gap: 1em;
box-shadow: 0 0 20px rgb(0 0 0 / 0.25);
grid-template-columns: 30% 1fr 30%;
background: rgb(0 0 0 / 0.8) !important;
#waveform {
width: 100%;
transform: scaleY(0);
transition: transform $transition-time-default;
&[data-show="true"] {
transform: scaleY(1) !important;
}
}
&-controls {
// Equal side columns keep the transport truly centred
grid-template-columns: minmax(0, 1fr) minmax(0, 540px) minmax(0, 1fr);
align-items: center;
gap: 1.5rem;
padding: 0 0.75rem 0 1rem;
color: white;
background: rgb(18 18 24 / 0.92);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border: 1px solid rgb(255 255 255 / 0.08);
border-radius: 14px;
box-shadow: 0 12px 40px rgb(0 0 0 / 0.45);
&-info {
display: flex;
align-items: center;
justify-content: center;
gap: 0.5em;
padding: 0.5em 0;
flex-flow: column;
}
&-info {
display: grid;
gap: 1em;
grid-template-columns: minmax(0, $image-size) minmax(0, 1fr);
width: fit-content;
align-items: center;
flex-grow: 1;
width: 100%;
overflow: hidden;
gap: 0.75rem;
min-width: 0;
> .MuiIconButton-root {
flex-shrink: 0;
color: rgb(255 255 255 / 0.75);
.material-symbols-rounded {
font-size: 1.25rem;
}
}
&-text {
display: flex;
flex-direction: column;
min-width: 0;
}
&-title {
all: unset;
cursor: pointer;
font-weight: 600 !important;
line-height: 1.25 !important;
// Wrap long titles onto a second line before truncating
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
overflow-wrap: anywhere;
&:hover,
&:focus-visible {
text-decoration: underline;
}
}
&-artist {
opacity: 0.6;
a {
color: inherit;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
}
}
&-image {
width: $image-size;
aspect-ratio: 1;
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
z-index: 1;
flex-shrink: 0;
flex-grow: 1;
position: relative;
&-container {
border-radius: $border-radius_04;
all: unset;
position: relative;
flex-shrink: 0;
width: $art-size;
height: $art-size;
border-radius: 8px;
overflow: hidden;
height: fit-content;
aspect-ratio: 1;
background: rgb(255 255 255 / 0.1);
cursor: pointer;
background: rgb(255 255 255 / 0.08);
&:hover .audio-player-image-expand,
&:focus-visible .audio-player-image-expand {
opacity: 1;
}
}
&-icon {
&-icon,
&-expand {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
font-size: 2em !important;
z-index: 0;
}
&-icon {
font-size: 1.5rem !important;
opacity: 0.5;
}
// "Open player" affordance shown over the art on hover
&-expand {
z-index: 2;
inset: 0;
transform: none;
display: flex;
align-items: center;
justify-content: center;
background: rgb(0 0 0 / 0.5);
opacity: 0;
transition: opacity 0.15s ease;
}
}
&-track {
grid-template-columns: $image-size 60% 0.5fr 0.5fr !important;
}
&-playlist{
background: $clr-background-dark !important;
border: 1.2px solid rgb(255 255 255 / 0.2);
// Transport on top, compact seek row underneath
&-center {
display: flex;
flex-direction: column;
gap: 1em;
// Magic scrollbar
&::-webkit-scrollbar {
&-thumb {
height: 150px;
max-height: 33%;
}
&-track {
margin-top: 20px;
margin-bottom: 20px;
background: transparent !important;
align-items: center;
gap: 2px;
min-width: 0;
.player-controls {
gap: 0.5rem !important;
.MuiFab-root {
width: 36px;
height: 36px;
min-height: 36px;
box-shadow: none;
.material-symbols-rounded {
font-size: 1.6rem !important;
}
}
}
}
&-track{
display: grid;
gap: 1em;
grid-template-columns: 4em 1fr 4em;
cursor: pointer;
&.active{
color: $clr-accent-default;
}
&-image{
background: rgb(255 255 255 / 0.1);
border: 1.2px solid rgb(255 255 255 / 0.1);
overflow: hidden;
border-radius:5px;
width: 100%;
aspect-ratio: 1;
height: 4em;
}
&-progress {
gap: 0.6rem !important;
.MuiTypography-root {
min-width: 2.75em !important;
font-size: 0.7rem;
opacity: 0.6 !important;
}
.MuiSlider-root {
padding: 8px 0;
}
.MuiSlider-thumb {
width: 10px;
height: 10px;
opacity: 0;
transition: opacity 0.15s ease;
}
&:hover .MuiSlider-thumb,
.MuiSlider-root.Mui-active .MuiSlider-thumb {
opacity: 1;
}
}
&-actions {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 0.25rem;
min-width: 0;
.MuiIconButton-root {
color: rgb(255 255 255 / 0.75);
&:hover {
color: white;
}
}
}
&-volume {
display: flex;
align-items: center;
min-width: 0;
// Secondary control: neutral and compact
.MuiSlider-root {
width: 5.5rem !important;
color: rgb(255 255 255 / 0.85);
}
}
@media (max-width: 900px) {
.audio-player-volume,
.audio-player-progress .MuiTypography-root {
display: none;
}
}
@media (max-width: 640px) {
grid-template-columns: minmax(0, 1fr) auto auto;
gap: 0.5rem;
bottom: 0.5rem;
width: calc(100% - 1rem);
height: 64px;
.audio-player-center .player-controls > :not(:has(.MuiFab-root)),
.audio-player-progress {
display: none;
}
.audio-player-actions > :not(:last-child) {
display: none;
}
}
}
@@ -0,0 +1,129 @@
import type { Api } from "@jellyfin/sdk";
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import { getLyricApi } from "@jellyfin/sdk/lib/utils/api/lyric-api";
import { Typography } from "@mui/material";
import { queryOptions, useQuery } from "@tanstack/react-query";
import React, { useEffect, useRef } from "react";
import { secToTicks } from "@/utils/date/time";
export const getLyricsQueryOptions = (
item: BaseItemDto | undefined | null,
api: Api | undefined,
) =>
queryOptions({
queryKey: ["player", "audio", item?.Id, "lyrics"],
queryFn: async () => {
if (!item?.Id || !api) {
return null;
}
try {
const response = await getLyricApi(api).getLyrics({
itemId: item.Id,
});
return response.data;
} catch {
// Items without lyrics return 404
return null;
}
},
enabled: Boolean(item?.Id) && Boolean(api),
});
interface LyricsPanelProps {
item: BaseItemDto | undefined | null;
api: Api | undefined;
currentTime: number;
/** Seeks playback to a position in ticks; enables clicking synced lines. */
onSeek?: (ticks: number) => void;
}
const LyricsPanel = ({ item, api, currentTime, onSeek }: LyricsPanelProps) => {
const lyricsContainer = useRef<HTMLDivElement | null>(null);
const lyrics = useQuery(getLyricsQueryOptions(item, 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);
const canSeek = hasSyncedLyrics && onSeek && lyric.Start != null;
const seek = () => {
if (canSeek) onSeek(lyric.Start ?? 0);
};
return (
<Typography
variant="body1"
component="p"
className={`audio-lyrics-line ${isActive ? "active" : ""}`}
key={`${lyric.Text}-${index}`}
data-active-lyric={isActive}
{...(canSeek && {
role: "button",
tabIndex: 0,
"data-seekable": true,
onClick: seek,
onKeyDown: (e: React.KeyboardEvent) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
seek();
}
},
})}
>
{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,33 @@
import IconButton from "@mui/material/IconButton";
import Tooltip from "@mui/material/Tooltip";
import React, { type ReactNode } from "react";
import QueueButton from "@/components/buttons/queueButton";
interface PlayerActionsProps {
/** Opens the full-screen player. */
onExpand: () => void;
onClose: () => void;
/** Volume control, rendered between the queue and expand buttons. */
children?: ReactNode;
}
const PlayerActions = ({ onExpand, onClose, children }: PlayerActionsProps) => {
return (
<div className="audio-player-actions">
<QueueButton />
<div className="audio-player-volume">{children}</div>
<Tooltip title="Open player">
<IconButton onClick={onExpand} aria-label="Open player">
<span className="material-symbols-rounded">open_in_full</span>
</IconButton>
</Tooltip>
<Tooltip title="Stop and close">
<IconButton onClick={onClose} aria-label="Stop and close">
<span className="material-symbols-rounded">close</span>
</IconButton>
</Tooltip>
</div>
);
};
export default PlayerActions;
@@ -0,0 +1,62 @@
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
className="player-controls"
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,99 @@
import type { Api } from "@jellyfin/sdk";
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import Typography from "@mui/material/Typography";
import { useQuery } from "@tanstack/react-query";
import { Link } from "@tanstack/react-router";
import React from "react";
import LikeButton from "@/components/buttons/likeButton";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { getItemQueryOptions } from "@/utils/queries/items";
import { useCentralStore } from "@/utils/store/central";
interface PlayerInfoProps {
item: BaseItemDto | undefined | null;
api: Api | undefined;
/** Opens the full-screen player. */
onOpen: () => void;
}
const PlayerInfo = ({ item, api, onOpen }: PlayerInfoProps) => {
const user = useCentralStore((s) => s.currentUser);
// Fresh user data so the like button reflects changes immediately.
const itemDetails = useQuery({
...getItemQueryOptions(item?.Id ?? "", api, user?.Id),
enabled: Boolean(item?.Id && api && user?.Id),
});
if (!api || !item) return null;
const artists = item.ArtistItems?.length
? item.ArtistItems
: (item.AlbumArtists ?? []);
return (
<div className="audio-player-info">
<button
type="button"
className="audio-player-image-container"
onClick={onOpen}
aria-label="Open player"
>
<span className="material-symbols-rounded audio-player-image-icon">
music_note
</span>
<img
alt=""
className="audio-player-image"
src={getImageUrlsApi(api).getItemImageUrlById(
(!item.ImageTags?.Primary ? item.AlbumId : item.Id) ?? "",
"Primary",
{ quality: 85, fillHeight: 120, fillWidth: 120 },
)}
/>
<span className="material-symbols-rounded audio-player-image-expand">
expand_less
</span>
</button>
<div className="audio-player-info-text">
<Typography
variant="subtitle2"
component="button"
className="audio-player-info-title"
title={item.Name ?? undefined}
onClick={onOpen}
>
{item.Name}
</Typography>
<Typography
variant="caption"
noWrap
className="audio-player-info-artist"
>
{artists.map((artist, index) => (
<React.Fragment key={artist.Id ?? artist.Name}>
{index > 0 && ", "}
{artist.Id ? (
<Link to="/music/artist/$id" params={{ id: artist.Id }}>
{artist.Name}
</Link>
) : (
artist.Name
)}
</React.Fragment>
))}
</Typography>
</div>
<LikeButton
itemId={item.Id ?? undefined}
itemName={item.Name}
isFavorite={
itemDetails.data?.UserData?.IsFavorite ?? item.UserData?.IsFavorite
}
queryKey={["item", item.Id ?? ""]}
userId={user?.Id}
/>
</div>
);
};
export default PlayerInfo;
@@ -0,0 +1,135 @@
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;
/**
* "inline" puts the times beside the bar, "stacked" puts them underneath,
* "bare" renders only the slider.
*/
layout?: "inline" | "stacked" | "bare";
className?: string;
}
const PlayerProgress = ({
progress,
duration,
onSeek,
onSeekCommit,
layout = "inline",
className,
}: 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);
};
if (layout === "bare") {
return (
<Slider
className={className}
value={sliderValue}
step={1}
size="small"
max={duration}
onChange={handleChange}
onChangeCommitted={handleChangeCommitted}
aria-label="Seek"
/>
);
}
if (layout === "stacked") {
return (
<div className="player-progress-stacked">
<Slider
value={sliderValue}
step={1}
size="small"
max={duration}
onChange={handleChange}
onChangeCommitted={handleChangeCommitted}
aria-label="Seek"
/>
<div className="player-progress-stacked-times">
<span>{getRuntimeMusic(sliderValue)}</span>
<span>-{getRuntimeMusic(Math.max(duration - sliderValue, 0))}</span>
</div>
</div>
);
}
return (
<div
className={className}
style={{
width: "100%",
display: "flex",
gap: "1em",
alignItems: "center",
justifyContent: "center",
}}
>
<Typography
variant="subtitle2"
style={{
opacity: 0.8,
minWidth: "3.5em",
textAlign: "right",
fontVariantNumeric: "tabular-nums",
}}
sx={{
fontWeight: 300,
}}
>
{getRuntimeMusic(sliderValue)}
</Typography>
<Slider
value={sliderValue}
step={1}
size="small"
max={duration}
onChange={handleChange}
onChangeCommitted={handleChangeCommitted}
/>
<Typography
variant="subtitle2"
style={{
opacity: 0.8,
minWidth: "3.5em",
textAlign: "left",
fontVariantNumeric: "tabular-nums",
}}
sx={{
fontWeight: 300,
}}
>
{getRuntimeMusic(duration)}
</Typography>
</div>
);
};
export default PlayerProgress;
@@ -0,0 +1,78 @@
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": {
// Compact pill hugging the thumb; above the play FAB (zIndex.fab)
zIndex: (theme) => theme.zIndex.tooltip,
lineHeight: 1.2,
fontSize: "0.75rem",
fontWeight: 600,
fontVariantNumeric: "tabular-nums",
minWidth: "2.25em",
background: "rgb(0 0 0 / 0.75)",
padding: "2px 6px",
borderRadius: "6px",
border: "1px solid rgb(255 255 255 / 0.15)",
boxShadow: "0 2px 8px rgb(0 0 0 / 0.4)",
top: -6,
transform: "translatey(-100%) scale(0)",
"&:before": {
display: "none",
},
"&.MuiSlider-valueLabelOpen": {
transform: "translateY(-100%) scale(1)",
},
"& > *": {
transform: "rotate(0deg)",
},
},
}}
/>
</>
);
};
export default PlayerVolume;
@@ -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> | 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);
+206 -313
View File
@@ -1,37 +1,39 @@
import React, { useEffect, useMemo, useRef, useState } from "react";
import { motion } from "motion/react";
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 { useLocation, useNavigate } from "@tanstack/react-router";
import { AnimatePresence, motion } from "motion/react";
import React, { type SyntheticEvent, useEffect, useRef, useState } from "react";
import { secToTicks, ticksToSec } from "@/utils/date/time";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api";
import {
setAudioRef,
setIsMuted,
setVolume,
useAudioPlayback,
} from "@/utils/store/audioPlayback";
import { useCentralStore } from "@/utils/store/central";
import { playItemFromQueue } from "@/utils/store/playback";
import { useNavigate } from "@tanstack/react-router";
import useQueue, { getNextTrackIndex } 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 api = useApiInContext((s) => s.api);
const user = useCentralStore((s) => s.currentUser);
const navigate = useNavigate();
const location = useLocation();
const audioRef = useRef<HTMLAudioElement | null>(null);
const [url, display, item] = useAudioPlayback((state) => [
const [url, display, item, volume, isMuted] = useAudioPlayback((state) => [
state.url,
state.display,
state.item,
state.player.volume,
state.player.isMuted,
]);
const [tracks, currentTrack] = useQueue((state) => [
@@ -39,327 +41,218 @@ const AudioPlayer = () => {
state.currentItemIndex,
]);
const user = useCentralStore((s) => s.currentUser);
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 [playing, setPlaying] = useState(false);
const [progress, setProgress] = useState(0);
const [isScrubbing, setIsScrubbing] = useState(false);
const [sliderProgress, setSliderProgress] = useState(0);
// Sync volume and ref
useEffect(() => {
if (display) {
// const audioUrlRequest = new Request(audioRef.current?.dataset.src, {
// method: "GET",
// headers: {
// Authorization: api.authorizationHeader,
// },
// });
// fetch(audioUrlRequest)
// .then((res) => res)
// .then(async (result) => {
// const blob = await result.blob();
// const blobUrl = URL.createObjectURL(blob);
// audioRef.current.src = blobUrl;
// await audioRef.current.play();
// setLoading(false);
// });
// Set the audio ref in the store to allow for global control
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(
() =>
api && (
<div
// initial={{
// filter: "opacity(0)",
// }}
// animate={{
// filter: "opacity(1)",
// }}
// exit={{
// filter: "opacity(0)",
// }}
className="audio-player-info"
>
<div className="audio-player-image-container">
<img
alt={tracks?.[currentTrack]?.Name ?? "track"}
className="audio-player-image"
src={getImageUrlsApi(api).getItemImageUrlById(
(!item?.ImageTags?.Primary ? item?.AlbumId : item.Id) ?? "",
"Primary",
{
quality: 85,
fillHeight: 462,
fillWidth: 462,
},
)}
/>
<span className="material-symbols-rounded audio-player-image-icon">
music_note
</span>
</div>
<div className="audio-player-info-text">
<Typography
variant="subtitle2"
style={{
width: "100%",
}}
>
{item?.Name}
</Typography>
<Typography
variant="caption"
style={{
opacity: 0.5,
}}
noWrap
>
by {item?.Artists?.map((artist) => artist).join(",")}
</Typography>
</div>
</div>
),
[tracks?.[currentTrack]?.Id, currentTrack, api?.configuration],
);
// Media Session Metadata
useEffect(() => {
if ("mediaSession" in navigator && item) {
const imageUrl = item.ImageTags?.Primary
? api &&
getImageUrlsApi(api).getItemImageUrlById(item.Id ?? "", "Primary", {
tag: item.ImageTags.Primary,
})
: undefined;
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()
}
>
<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(
() => (
<div
style={{
display: "flex",
alignItems: "center",
justifyContent: "flex-end",
}}
>
<IconButton onClick={() => navigate({ to: "/player/audio" })}>
<span className="material-symbols-rounded">info</span>
</IconButton>
<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)
: setVolume(newVal / 100);
if (Array.isArray(newVal)) {
audioRef.current.volume = newVal[0] / 100;
} else {
audioRef.current.volume = newVal / 100;
}
}}
valueLabelDisplay="auto"
valueLabelFormat={(value) => Math.floor(value)}
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",
navigator.mediaSession.metadata = new MediaMetadata({
title: item.Name ?? "Unknown Title",
artist: item.Artists?.join(", ") ?? "Unknown Artist",
album: item.Album ?? "Unknown Album",
artwork: imageUrl
? [
{
src: imageUrl,
sizes: "512x512",
type: "image/jpeg",
},
"&.MuiSlider-valueLabelOpen": {
transform: "translateY(-120%) scale(1)",
},
"& > *": {
transform: "rotate(0deg)",
},
},
}}
/>
<IconButton
onClick={() => {
useAudioPlayback.setState(useAudioPlayback.getInitialState());
}}
>
<div className="material-symbols-rounded">close</div>
</IconButton>
</div>
),
[volume, isMuted, currentTrack],
);
]
: [],
});
}
}, [item, api]);
// if (audioRef.current) {
// audioRef.current.addEventListener("change", () => {
// console.log("Audio Player changed state : ", currentTrack);
// });
// audioRef.current.addEventListener("ended", () => {
// Media Session Action Handlers
useEffect(() => {
if ("mediaSession" in navigator) {
navigator.mediaSession.setActionHandler("play", () => {
audioRef.current?.play();
});
navigator.mediaSession.setActionHandler("pause", () => {
audioRef.current?.pause();
});
navigator.mediaSession.setActionHandler("previoustrack", () => {
if (user?.Id && api) {
playItemFromQueue("previous", user.Id, api);
}
});
navigator.mediaSession.setActionHandler("nexttrack", () => {
const nextIndex = getNextTrackIndex();
if (nextIndex !== undefined && user?.Id && api) {
playItemFromQueue(nextIndex, user.Id, api);
}
});
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 {
audioRef.current.pause();
setPlaying(false);
}
}
};
const handleTimeUpdate = (e: SyntheticEvent<HTMLAudioElement>) => {
setProgress(secToTicks(e.currentTarget.currentTime));
};
const handleEnded = () => {
if (useQueue.getState().repeatMode === "one" && audioRef.current) {
audioRef.current.currentTime = 0;
audioRef.current.play();
return;
}
setPlaying(false);
const nextIndex = getNextTrackIndex();
if (nextIndex !== undefined && api && user?.Id) {
playItemFromQueue(nextIndex, user.Id, api);
}
};
const handleSeekCommit = (value: number) => {
if (audioRef.current) {
audioRef.current.currentTime = ticksToSec(value);
setProgress(value);
}
};
const handleVolumeChange = (newVolume: number) => {
setVolume(newVolume);
};
const handleMuteToggle = () => {
setIsMuted(!isMuted);
};
const handleClose = () => {
useAudioPlayback.setState(useAudioPlayback.getInitialState());
};
const handleNavigate = () => {
navigate({ to: "/player/audio" });
};
// 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 (
<AnimatePresence mode="sync">
{display && (
<motion.div
initial={{
transform: "translateY(100%)",
}}
initial={{ transform: "translate(-50%, 150%)" }}
animate={{
transform:
location.pathname === "/player/audio"
? "translateY(100%)"
: "translateY(0%)",
? "translate(-50%, 150%)"
: "translate(-50%, 0%)",
}}
exit={{
transform: "translateY(100%)",
}}
style={{
width: "100%",
}}
transition={{
duration: 0.2,
ease: "easeInOut",
}}
className="audio-player glass"
exit={{ transform: "translate(-50%, 150%)" }}
transition={{ duration: 0.3, ease: "circOut" }}
className="audio-player"
>
{info}
<PlayerInfo item={item} api={api} onOpen={handleNavigate} />
<audio
autoPlay
src={url}
ref={audioRef}
key={item?.Id ?? "noItem"}
onTimeUpdate={(e) =>
setProgress(secToTicks(e.currentTarget.currentTime))
}
onEnded={() => {
if (tracks?.[currentTrack + 1]?.Id && api && user?.Id) {
playItemFromQueue("next", user.Id, api);
}
}}
onTimeUpdate={handleTimeUpdate}
onEnded={handleEnded}
onPlay={onPlay}
onPause={onPause}
onSeeked={updatePositionState}
onLoadedMetadata={updatePositionState}
id="audio-player"
/>
<div className="audio-player-controls">
{controls}
<div
style={{
width: "100%",
display: "flex",
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 className="audio-player-center">
<PlayerControls playing={playing} onPlayPause={handlePlayPause} />
<PlayerProgress
className="audio-player-progress"
progress={progress}
duration={item?.RunTimeTicks ?? 1}
onSeekCommit={handleSeekCommit}
/>
</div>
{buttons}
<PlayerActions onExpand={handleNavigate} onClose={handleClose}>
<PlayerVolume
volume={volume}
isMuted={isMuted}
onVolumeChange={handleVolumeChange}
onMuteToggle={handleMuteToggle}
/>
</PlayerActions>
</motion.div>
)}
</AnimatePresence>
@@ -109,7 +109,12 @@ const StatsForNerds = ({ playerRef }: StatsForNerdsProps) => {
marginBottom: "0.5em",
}}
>
<Typography variant="subtitle2" fontWeight="bold">
<Typography
variant="subtitle2"
sx={{
fontWeight: "bold",
}}
>
Stats for Nerds
</Typography>
<IconButton
@@ -136,8 +141,7 @@ const StatsForNerds = ({ playerRef }: StatsForNerdsProps) => {
<span>Video ID:</span> <span>{itemId}</span>
<span>Media Source ID:</span> <span>{mediaSourceId}</span>
<span>Play Session ID:</span> <span>{playsessionId}</span>
<span>Playback Method:</span>{" "}
<span>{mediaSource.isDirectPlay ? "Direct Play" : "Transcoding"}</span>
<span>Playback Method:</span> <span>{mediaSource.playMethod}</span>
<span>Container:</span> <span>{mediaSource.container}</span>
<span>Video Codec:</span> <span>{mediaSource.videoCodec}</span>
<span>Audio Codec:</span> <span>{mediaSource.audioCodec}</span>
@@ -1,4 +1,4 @@
import type { TrickplayInfo } from "@jellyfin/sdk/lib/generated-client";
import type { TrickplayInfoDto } from "@jellyfin/sdk/lib/generated-client";
import { Slider, Tooltip, Typography } from "@mui/material";
import type { Instance } from "@popperjs/core";
import React, {
@@ -143,7 +143,7 @@ const BubbleSlider = () => {
return false;
});
let trickplayResolution: TrickplayInfo | undefined;
let trickplayResolution: TrickplayInfoDto | undefined;
const trickplayResolutions = mediaSource.id
? itemTrickplay?.[mediaSource.id]
: null;
@@ -190,7 +190,7 @@ const BubbleSlider = () => {
const backgroundOffsetY = -(imageOffsetY * trickplayResolution?.Height);
const imgUrlParamsObject: Record<string, string> = {
api_key: String(api?.accessToken),
ApiKey: String(api?.accessToken),
MediaSourceId: mediaSource.id ?? "",
};
const imgUrlParams = new URLSearchParams(imgUrlParamsObject).toString();
@@ -199,7 +199,7 @@ const BubbleSlider = () => {
trickplayResolution.Width / trickplayResolution.Height;
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`,
backgroundPositionY: `${backgroundOffsetY}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 { useShallow } from "zustand/shallow";
import { usePlaybackStore } from "@/utils/store/playback";
@@ -24,33 +25,67 @@ const SkipSegmentButton = () => {
})),
);
if (
!mediaSegments?.Items?.length ||
currentSegmentIndex < 0 ||
!activeSegmentId ||
mediaSegments?.Items?.[currentSegmentIndex].Type === "Outro"
) {
return null; // No segments to skip
}
const shouldShow =
mediaSegments?.Items?.length &&
currentSegmentIndex >= 0 &&
activeSegmentId &&
mediaSegments?.Items?.[currentSegmentIndex].Type !== "Outro";
return (
<Button
variant="outlined"
size="large"
//@ts-ignore
color="white"
style={{
position: "absolute",
bottom:
isUserHovering || !isPlayerPlaying || isUserSeeking ? "18vh" : "2em",
right: "2em",
transition: "bottom 0.3s ease-in-out",
zIndex: 10000,
}}
onClick={skipSegment}
>
Skip {mediaSegments?.Items?.[currentSegmentIndex].Type}
</Button>
<AnimatePresence>
{shouldShow && (
<motion.div
initial={{ opacity: 0, x: 20, scale: 0.9 }}
animate={{ opacity: 1, x: 0, scale: 1 }}
exit={{ opacity: 0, x: 20, scale: 0.9 }}
transition={{
type: "spring",
stiffness: 300,
damping: 30,
}}
style={{
position: "absolute",
right: "3em",
zIndex: 10000,
bottom:
isUserHovering || !isPlayerPlaying || isUserSeeking ? "20vh" : "6em",
transition: "bottom 0.3s ease-in-out",
}}
>
<Button
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}
</Button>
</motion.div>
)}
</AnimatePresence>
);
};
@@ -1,4 +1,4 @@
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
import { getSessionApi } from "@jellyfin/sdk/lib/utils/api/session-api";
import { IconButton, Slider, Typography } from "@mui/material";
import { WebviewWindow as appWindow } from "@tauri-apps/api/webviewWindow";
import { AnimatePresence, motion } from "motion/react";
@@ -156,7 +156,7 @@ const VideoPlayerControls = ({
throw Error("API is not available, cannot report playback stopped.");
}
// Report Jellyfin server: Playback has ended/stopped
getPlaystateApi(api).reportPlaybackStopped({
getSessionApi(api).reportPlaybackStopped({
playbackStopInfo: {
Failed: false,
ItemId: itemId,
@@ -219,11 +219,23 @@ const VideoPlayerControls = ({
</div>
<div className="video-player-osd-info">
<div>
<Typography variant="h4" fontWeight={500} mb={2}>
<Typography
variant="h4"
sx={{
fontWeight: 500,
mb: 2,
}}
>
{String(itemName)}
</Typography>
{episodeTitle && (
<Typography variant="h6" fontWeight={300} mt={1}>
<Typography
variant="h6"
sx={{
fontWeight: 300,
mt: 1,
}}
>
{String(episodeTitle)}
</Typography>
)}
@@ -1,5 +1,6 @@
import {
MenuItem,
MenuList,
Popover,
Switch,
TextField,
@@ -144,10 +145,18 @@ const VideoPlayerSettingsMenu = ({
</MenuItem>
))}
</TextField>
<MenuItem onClick={toggleShowStatsForNerds}>
<Typography flexGrow={1}>Stats for Nerds</Typography>
<Switch checked={showStatsForNerds} />
</MenuItem>
<MenuList disablePadding>
<MenuItem onClick={toggleShowStatsForNerds}>
<Typography
sx={{
flexGrow: 1,
}}
>
Stats for Nerds
</Typography>
<Switch checked={showStatsForNerds} />
</MenuItem>
</MenuList>
</Popover>
);
};
@@ -1,6 +1,6 @@
import { Button, Typography } from "@mui/material";
import { motion } from "motion/react";
import React, { useMemo } from "react";
import { Box, Button, IconButton, Typography } from "@mui/material";
import { AnimatePresence, motion } from "motion/react";
import React, { useEffect, useMemo, useState } from "react";
import { useShallow } from "zustand/shallow";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api";
@@ -36,6 +36,13 @@ const UpNextFlyout = () => {
tracks: state.tracks,
})),
);
const [isHidden, setIsHidden] = useState(false);
useEffect(() => {
setIsHidden(false);
}, [activeSegmentId]);
const areControlsVisible = useMemo(() => {
return isUserHovering || isUserSeeking || !isPlayerPlaying;
}, [isUserHovering, isUserSeeking, isPlayerPlaying]);
@@ -45,7 +52,8 @@ const UpNextFlyout = () => {
if (
!api ||
!activeSegmentId ||
mediaSegments?.Items?.[currentSegmemtIndex].Type !== "Outro"
mediaSegments?.Items?.[currentSegmemtIndex].Type !== "Outro" ||
isHidden
) {
return null;
}
@@ -56,53 +64,154 @@ const UpNextFlyout = () => {
}
return (
<motion.div
className={
areControlsVisible
? "video-player-up_next_flyout floating"
: "video-player-up_next_flyout"
}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
>
<img
className="video-player-up_next_flyout-thumbnail"
src={getImageUrlsApi(api).getItemImageUrlById(item.Id, "Primary", {
tag: item.ImageTags?.Primary,
quality: 80,
fillWidth: 300,
})}
alt={"next item thumbnail"}
/>
<div className="video-player-up_next_flyout-details">
<Typography variant="h5">
{`S${item.ParentIndexNumber}:E${item.IndexNumber} `}
{item.Name}
</Typography>
<Typography
variant="subtitle2"
// noWrap
textOverflow="ellipsis"
maxWidth="100%"
<AnimatePresence>
<motion.div
className={
areControlsVisible
? "video-player-up_next_flyout floating"
: "video-player-up_next_flyout"
}
initial={{ opacity: 0, y: 50, scale: 0.95 }}
animate={{ opacity: 1, y: 0, scale: 1 }}
exit={{ opacity: 0, y: 20, scale: 0.95 }}
transition={{ duration: 0.4, ease: [0.4, 0, 0.2, 1] }}
style={{
background: "rgba(20, 20, 20, 0.6)",
backdropFilter: "blur(16px) saturate(180%)",
border: "1px solid rgba(255, 255, 255, 0.1)",
boxShadow: "0 8px 32px 0 rgba(0, 0, 0, 0.3)",
borderRadius: "24px",
padding: "16px",
display: "flex",
gap: "16px",
maxWidth: "500px",
width: "100%",
overflow: "hidden",
}}
>
<Box
sx={{
display: "-webkit-box",
webkitLineClamp: "3",
webkitBoxOrient: "vertical",
position: "relative",
width: "160px",
minWidth: "160px",
borderRadius: "8px",
overflow: "hidden",
aspectRatio: "16/9",
boxShadow: "0 4px 12px rgba(0,0,0,0.3)",
}}
>
{item.Overview}
</Typography>
<Button
onClick={skipSegment}
variant="contained"
color="primary"
className="video-player-up_next_flyout-button"
<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",
}}
>
Play
</Button>
</div>
</motion.div>
<Typography
variant="overline"
sx={{
color: "primary.main",
fontWeight: 700,
lineHeight: 1,
mb: 0.5,
letterSpacing: 1.2,
}}
>
UP NEXT
</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"
sx={{
color: "text.secondary",
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
onClick={skipSegment}
variant="contained"
color="primary"
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 Now
</Button>
<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>
</AnimatePresence>
);
};
+325
View File
@@ -0,0 +1,325 @@
.queue {
display: flex;
flex-direction: column;
min-height: 0;
height: 100%;
color: white;
&-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
padding-bottom: 0.75rem;
&-text {
display: flex;
flex-direction: column;
min-width: 0;
}
&-actions {
display: flex;
align-items: center;
gap: 0.125rem;
flex-shrink: 0;
.MuiIconButton-root {
color: rgb(255 255 255 / 0.75);
&:hover {
color: white;
}
}
}
}
&-title {
margin: 0;
font-size: 1.1rem;
font-weight: 700;
}
&-summary {
font-size: 0.8rem;
opacity: 0.6;
}
&-body {
flex: 1;
min-height: 0;
overflow-y: auto;
overflow-x: hidden;
display: flex;
flex-direction: column;
gap: 1.25rem;
// Room so focus rings and the dragged row aren't clipped
padding: 2px 2px 1rem;
margin: 0 -2px;
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-thumb {
background: rgb(255 255 255 / 0.2);
border-radius: 3px;
}
}
&-section {
display: flex;
flex-direction: column;
gap: 0.5rem;
&-label {
margin: 0;
font-size: 0.7rem;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
opacity: 0.55;
}
&-toggle {
all: unset;
display: flex;
align-items: center;
justify-content: space-between;
cursor: pointer;
padding: 0.25rem 0.5rem;
margin: 0 -0.5rem;
border-radius: 0.5rem;
&:hover,
&:focus-visible {
background: rgb(255 255 255 / 0.05);
}
.material-symbols-rounded {
opacity: 0.6;
}
}
}
&-list {
display: flex;
flex-direction: column;
gap: 2px;
}
&-hint {
margin: 0.25rem 0 0;
font-size: 0.75rem;
opacity: 0.4;
text-align: center;
}
&-empty {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.25rem;
padding: 2rem 1rem;
text-align: center;
border: 1px dashed rgb(255 255 255 / 0.12);
border-radius: 0.75rem;
&-icon {
font-size: 2.25rem;
opacity: 0.4;
margin-bottom: 0.25rem;
}
&-title {
font-weight: 600;
}
&-text {
font-size: 0.85rem;
opacity: 0.6;
}
}
}
.queue-row {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.4rem 0.5rem;
border-radius: 0.6rem;
outline: none;
background: transparent;
transition: background-color 0.15s ease;
&[role="button"] {
cursor: pointer;
}
&:hover,
&:focus-visible,
&.is-dragging {
background: rgb(255 255 255 / 0.07);
}
&:focus-visible {
box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.4);
}
&.is-dragging {
box-shadow: 0 8px 24px rgb(0 0 0 / 0.45);
background: rgb(40 40 50 / 0.95);
}
&-current {
background: rgb(255 255 255 / 0.08);
.queue-row-title {
color: $clr-accent-default;
}
}
&-history {
opacity: 0.6;
&:hover,
&:focus-visible {
opacity: 1;
}
}
&-handle {
all: unset;
display: flex;
align-items: center;
justify-content: center;
width: 1.25rem;
margin-right: -0.25rem;
cursor: grab;
touch-action: none;
opacity: 0;
transition: opacity 0.15s ease;
.material-symbols-rounded {
font-size: 1.2rem;
}
&:active {
cursor: grabbing;
}
&:focus-visible {
opacity: 1;
outline: 2px solid rgb(255 255 255 / 0.4);
border-radius: 4px;
}
}
&-art {
position: relative;
flex-shrink: 0;
width: 44px;
height: 44px;
border-radius: 6px;
overflow: hidden;
background: rgb(255 255 255 / 0.08);
img {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
&-fallback,
&-overlay,
&-play {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
}
&-fallback {
opacity: 0.4;
font-size: 1.25rem !important;
}
&-overlay,
&-play {
background: rgb(0 0 0 / 0.55);
z-index: 1;
}
&-overlay {
color: $clr-accent-default;
}
&-play {
opacity: 0;
transition: opacity 0.15s ease;
}
}
&-text {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 1px;
}
&-title {
font-size: 0.9rem;
font-weight: 600;
line-height: 1.25;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
overflow-wrap: anywhere;
}
&-subtitle {
font-size: 0.78rem;
opacity: 0.6;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&-duration {
flex-shrink: 0;
font-size: 0.78rem;
opacity: 0.55;
font-variant-numeric: tabular-nums;
}
&-remove.MuiIconButton-root {
flex-shrink: 0;
color: rgb(255 255 255 / 0.7);
opacity: 0;
transition: opacity 0.15s ease;
.material-symbols-rounded {
font-size: 1.1rem;
}
}
// Reveal row controls on hover / keyboard focus; always shown on touch screens
&:hover,
&:focus-within {
.queue-row-handle,
.queue-row-remove {
opacity: 1;
}
.queue-row-art-play {
opacity: 1;
}
}
@media (hover: none) {
.queue-row-handle,
.queue-row-remove {
opacity: 1;
}
}
}
// Queue drawer (mini player / video player)
.queue-drawer-paper.MuiPaper-root {
width: 420px;
max-width: 100%;
padding: 1.25rem 1rem 0 1.25rem;
box-sizing: border-box;
background: rgb(18 18 24 / 0.97);
border-left: 1px solid rgb(255 255 255 / 0.08);
background-image: none;
}
+178
View File
@@ -0,0 +1,178 @@
import { useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import IconButton from "@mui/material/IconButton";
import Tooltip from "@mui/material/Tooltip";
import React from "react";
import { getRuntimeMusic } from "@/utils/date/time";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api";
export const getQueueItemText = (item: BaseItemDto) => {
if (item.Type === "Episode") {
const episode = item.IndexNumberEnd
? `E${item.IndexNumber}-${item.IndexNumberEnd}`
: `E${item.IndexNumber}`;
return {
title: item.Name ?? "Unknown episode",
subtitle: [item.SeriesName, `S${item.ParentIndexNumber}:${episode}`]
.filter(Boolean)
.join(" · "),
};
}
return {
title: item.Name ?? "Unknown track",
subtitle: item.Artists?.join(", ") || item.AlbumArtist || "",
};
};
const useQueueItemImage = (item: BaseItemDto) => {
const api = useApiInContext((s) => s.api);
if (!api || !item.Id) return undefined;
const size = { fillWidth: 96, fillHeight: 96, quality: 85 };
if (item.ImageTags?.Primary) {
return getImageUrlsApi(api).getItemImageUrlById(item.Id, "Primary", {
...size,
tag: item.ImageTags.Primary,
});
}
if (item.AlbumId && item.AlbumPrimaryImageTag) {
return getImageUrlsApi(api).getItemImageUrlById(item.AlbumId, "Primary", {
...size,
tag: item.AlbumPrimaryImageTag,
});
}
return undefined;
};
type QueueRowProps = {
item: BaseItemDto;
variant: "current" | "upcoming" | "history";
onPlay?: () => void;
onRemove?: () => void;
/** Drag handle props from useSortable (upcoming rows only). */
dragHandle?: React.HTMLAttributes<HTMLButtonElement>;
isDragging?: boolean;
};
export const QueueRow = React.forwardRef<
HTMLDivElement,
QueueRowProps & { style?: React.CSSProperties }
>(({ item, variant, onPlay, onRemove, dragHandle, isDragging, style }, ref) => {
const imageUrl = useQueueItemImage(item);
const { title, subtitle } = getQueueItemText(item);
const isCurrent = variant === "current";
return (
<div
ref={ref}
style={style}
className={`queue-row queue-row-${variant} ${isDragging ? "is-dragging" : ""}`}
{...(onPlay && {
role: "button",
tabIndex: 0,
"aria-label": `Play ${title}`,
})}
onClick={onPlay}
onKeyDown={(e) => {
if (e.target !== e.currentTarget) return;
if (onPlay && (e.key === "Enter" || e.key === " ")) {
e.preventDefault();
onPlay();
} else if (onRemove && (e.key === "Delete" || e.key === "Backspace")) {
e.preventDefault();
onRemove();
}
}}
>
{dragHandle && (
<button
type="button"
className="queue-row-handle"
aria-label={`Reorder ${title}`}
onClick={(e) => e.stopPropagation()}
{...dragHandle}
>
<span className="material-symbols-rounded">drag_indicator</span>
</button>
)}
<div className="queue-row-art">
<span className="material-symbols-rounded queue-row-art-fallback">
{item.Type === "Episode" ? "tv_gen" : "music_note"}
</span>
{imageUrl && <img src={imageUrl} alt="" loading="lazy" />}
{isCurrent && (
<span className="queue-row-art-overlay material-symbols-rounded">
graphic_eq
</span>
)}
{onPlay && (
<span className="queue-row-art-play material-symbols-rounded">
play_arrow
</span>
)}
</div>
<div className="queue-row-text">
<span className="queue-row-title" title={title}>
{title}
</span>
{subtitle && <span className="queue-row-subtitle">{subtitle}</span>}
</div>
<span className="queue-row-duration">
{item.RunTimeTicks ? getRuntimeMusic(item.RunTimeTicks) : ""}
</span>
{onRemove && (
<Tooltip title="Remove from queue">
<IconButton
size="small"
className="queue-row-remove"
aria-label={`Remove ${title} from queue`}
onClick={(e) => {
e.stopPropagation();
onRemove();
}}
>
<span className="material-symbols-rounded">close</span>
</IconButton>
</Tooltip>
)}
</div>
);
});
/** An upcoming row that can be dragged to reorder. */
export const SortableQueueRow = (
props: Omit<QueueRowProps, "dragHandle" | "isDragging" | "variant">,
) => {
const {
attributes,
listeners,
setNodeRef,
setActivatorNodeRef,
transform,
transition,
isDragging,
} = useSortable({ id: props.item.Id ?? "" });
return (
<QueueRow
{...props}
ref={setNodeRef}
variant="upcoming"
isDragging={isDragging}
style={{
transform: CSS.Translate.toString(transform),
transition,
zIndex: isDragging ? 2 : undefined,
position: "relative",
}}
dragHandle={
{
...attributes,
...listeners,
ref: setActivatorNodeRef,
} as React.HTMLAttributes<HTMLButtonElement>
}
/>
);
};
+273
View File
@@ -0,0 +1,273 @@
import {
closestCenter,
DndContext,
type DragEndEvent,
KeyboardSensor,
PointerSensor,
useSensor,
useSensors,
} from "@dnd-kit/core";
import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
import {
arrayMove,
SortableContext,
sortableKeyboardCoordinates,
verticalListSortingStrategy,
} from "@dnd-kit/sortable";
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import Button from "@mui/material/Button";
import Collapse from "@mui/material/Collapse";
import IconButton from "@mui/material/IconButton";
import Tooltip from "@mui/material/Tooltip";
import { useSnackbar } from "notistack";
import React, { useMemo, useState } from "react";
import { getRuntimeCompact } from "@/utils/date/time";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import { playItemFromQueue } from "@/utils/store/playback";
import useQueue, {
clearUpcoming,
insertIntoQueue,
removeFromQueue,
reorderQueue,
shuffleUpcoming,
} from "@/utils/store/queue";
import { getQueueItemText, QueueRow, SortableQueueRow } from "./queueRow";
import "./queue.scss";
type QueueViewProps = {
/**
* "drawer": standalone queue with the now playing row and a close button.
* "panel": embedded next to a full player that already shows the current track.
*/
variant: "drawer" | "panel";
onClose?: () => void;
};
const QueueView = ({ variant, onClose }: QueueViewProps) => {
const api = useApiInContext((s) => s.api);
const userId = useCentralStore((s) => s.currentUser?.Id ?? undefined);
const { enqueueSnackbar, closeSnackbar } = useSnackbar();
const [tracks, currentIndex] = useQueue((s) => [
s.tracks,
s.currentItemIndex,
]);
const [showHistory, setShowHistory] = useState(false);
const queue = tracks ?? [];
const current = queue[currentIndex];
const history = queue.slice(0, currentIndex);
const upcoming = useMemo(
() => queue.slice(currentIndex + 1),
[queue, currentIndex],
);
const upcomingTicks = upcoming.reduce(
(total, item) => total + (item.RunTimeTicks ?? 0),
0,
);
const sensors = useSensors(
useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),
useSensor(KeyboardSensor, {
coordinateGetter: sortableKeyboardCoordinates,
}),
);
const play = (index: number) => {
playItemFromQueue(index, userId, api);
};
const remove = (item: BaseItemDto, index: number) => {
removeFromQueue(index);
const { title } = getQueueItemText(item);
enqueueSnackbar(`Removed "${title}"`, {
variant: "default",
action: (key) => (
<Button
color="inherit"
size="small"
onClick={() => {
insertIntoQueue(item, index);
closeSnackbar(key);
}}
>
Undo
</Button>
),
});
};
const clearAll = () => {
const removed = upcoming;
clearUpcoming();
enqueueSnackbar(`Cleared ${removed.length} tracks from up next`, {
action: (key) => (
<Button
color="inherit"
size="small"
onClick={() => {
const state = useQueue.getState();
reorderQueue([
...(state.tracks ?? []).slice(0, state.currentItemIndex + 1),
...removed,
]);
closeSnackbar(key);
}}
>
Undo
</Button>
),
});
};
const handleDragEnd = ({ active, over }: DragEndEvent) => {
if (!over || active.id === over.id) return;
const from = upcoming.findIndex((item) => item.Id === active.id);
const to = upcoming.findIndex((item) => item.Id === over.id);
if (from === -1 || to === -1) return;
reorderQueue([
...queue.slice(0, currentIndex + 1),
...arrayMove(upcoming, from, to),
]);
};
const summary =
upcoming.length > 0
? `${upcoming.length} ${upcoming.length === 1 ? "track" : "tracks"} · ${getRuntimeCompact(upcomingTicks)}`
: "Nothing queued";
return (
<div className={`queue queue-${variant}`}>
<header className="queue-header">
<div className="queue-header-text">
<h2 className="queue-title">
{variant === "drawer" ? "Queue" : "Up next"}
</h2>
<span className="queue-summary">{summary}</span>
</div>
<div className="queue-header-actions">
<Tooltip title="Shuffle up next">
<span>
<IconButton
onClick={shuffleUpcoming}
disabled={upcoming.length < 2}
aria-label="Shuffle up next"
>
<span className="material-symbols-rounded">shuffle</span>
</IconButton>
</span>
</Tooltip>
<Tooltip title="Clear up next">
<span>
<IconButton
onClick={clearAll}
disabled={upcoming.length === 0}
aria-label="Clear up next"
>
<span className="material-symbols-rounded">
playlist_remove
</span>
</IconButton>
</span>
</Tooltip>
{onClose && (
<IconButton onClick={onClose} aria-label="Close queue">
<span className="material-symbols-rounded">close</span>
</IconButton>
)}
</div>
</header>
<div className="queue-body">
{variant === "drawer" && current && (
<section className="queue-section">
<h3 className="queue-section-label">Now playing</h3>
<QueueRow item={current} variant="current" />
</section>
)}
<section className="queue-section">
{variant === "drawer" && (
<h3 className="queue-section-label">Up next</h3>
)}
{upcoming.length > 0 ? (
<>
<DndContext
sensors={sensors}
collisionDetection={closestCenter}
onDragEnd={handleDragEnd}
modifiers={[restrictToVerticalAxis]}
>
<SortableContext
items={upcoming.map((item) => item.Id ?? "")}
strategy={verticalListSortingStrategy}
>
<div className="queue-list">
{upcoming.map((item, offset) => {
const index = currentIndex + 1 + offset;
return (
<SortableQueueRow
key={item.Id ?? index}
item={item}
onPlay={() => play(index)}
onRemove={() => remove(item, index)}
/>
);
})}
</div>
</SortableContext>
</DndContext>
<p className="queue-hint">
Click a track to play it now · drag to reorder
</p>
</>
) : (
<div className="queue-empty">
<span className="material-symbols-rounded queue-empty-icon">
queue_music
</span>
<span className="queue-empty-title">Nothing up next</span>
<span className="queue-empty-text">
Play an album, playlist or artist to fill the queue.
</span>
</div>
)}
</section>
{history.length > 0 && (
<section className="queue-section">
<button
type="button"
className="queue-section-toggle"
onClick={() => setShowHistory((open) => !open)}
aria-expanded={showHistory}
>
<span className="queue-section-label">
Previously played · {history.length}
</span>
<span className="material-symbols-rounded">
{showHistory ? "expand_less" : "expand_more"}
</span>
</button>
<Collapse in={showHistory} unmountOnExit>
<div className="queue-list">
{history.map((item, index) => (
<QueueRow
key={item.Id ?? index}
item={item}
variant="history"
onPlay={() => play(index)}
onRemove={() => remove(item, index)}
/>
))}
</div>
</Collapse>
</section>
)}
</div>
</div>
);
};
export default QueueView;
+27 -12
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 { CSS } from "@dnd-kit/utilities";
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 { getRuntimeMusic } from "@/utils/date/time";
import useQueue from "@/utils/store/queue";
type Props = {
track: BaseItemDto;
index: number;
onRemove?: () => void;
};
const QueueTrack = (props: Props) => {
const { track, index } = props;
const { track, index, onRemove } = props;
const [currentItemIndex] = useQueue((s) => [s.currentItemIndex]);
const { attributes, listeners, setNodeRef, transform, transition } =
@@ -46,13 +43,31 @@ const QueueTrack = (props: Props) => {
<Typography className="audio-queue-track-info-name">
{track.Name}
</Typography>
<Typography fontWeight={300} className="opacity-07" variant="subtitle2">
<Typography
className="opacity-07"
variant="subtitle2"
sx={{
fontWeight: 300,
}}
>
{track.Artists?.join(", ")}
</Typography>
</div>
<Typography className="opacity-07">
{getRuntimeMusic(track.RunTimeTicks ?? 0)}
</Typography>
<div style={{ display: "flex", alignItems: "center", gap: "0.5em" }}>
<Typography className="opacity-07">
{getRuntimeMusic(track.RunTimeTicks ?? 0)}
</Typography>
{onRemove && (
<IconButton size="small" onClick={onRemove}>
<span
className="material-symbols-rounded"
style={{ fontSize: "1.2em" }}
>
close
</span>
</IconButton>
)}
</div>
</div>
);
};
+16 -2
View File
@@ -1,10 +1,24 @@
import { CircularProgress } from "@mui/material";
import { useRouterState } from "@tanstack/react-router";
import React from "react";
import React, { useEffect, useState } from "react";
/** Only show the full-screen loader for genuinely slow navigations. */
const SHOW_DELAY_MS = 250;
export default function RouterLoading() {
const routeLoading = useRouterState().isLoading;
if (!routeLoading) return null;
const [visible, setVisible] = useState(false);
useEffect(() => {
if (!routeLoading) {
setVisible(false);
return;
}
const timer = setTimeout(() => setVisible(true), SHOW_DELAY_MS);
return () => clearTimeout(timer);
}, [routeLoading]);
if (!visible) return null;
return (
<div
style={{
+421
View File
@@ -0,0 +1,421 @@
import { ItemSortBy } from "@jellyfin/sdk/lib/generated-client";
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-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 getLibraryApi(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"
spacing={1.5}
sx={{
alignItems: "center",
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"
sx={{
fontWeight: 600,
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"
sx={{
fontWeight: 600,
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
sx={{
alignItems: "center",
justifyContent: "center",
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"
sx={{
justifyContent: "flex-end",
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;
+135
View File
@@ -0,0 +1,135 @@
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";
import { getItemLinkOptions } from "@/utils/navigation/itemLink";
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();
navigate(getItemLinkOptions(itemId, itemType));
};
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
sx={{
fontWeight: 500,
}}
>
{itemName}
</Typography>
<Stack
direction="row"
spacing={1}
sx={{
alignItems: "center",
}}
>
{itemYear && (
<Typography
variant="caption"
sx={{
color: "text.secondary",
}}
>
{itemYear}
</Typography>
)}
{itemYear && itemType && (
<Typography
variant="caption"
sx={{
color: "text.secondary",
}}
>
•
</Typography>
)}
{itemType && (
<Typography
variant="caption"
sx={{
color: "text.secondary",
}}
>
{itemType}
</Typography>
)}
</Stack>
</Stack>
</Button>
);
};
export default SearchItem;
+9 -2
View File
@@ -5,7 +5,9 @@ import React, { useState } from "react";
const SettingOption = ({
setting,
}: { setting: { key: string; name: string; description: string } }) => {
}: {
setting: { key: string; name: string; description: string };
}) => {
const initValue = useQuery({
queryKey: ["setting", setting.key],
queryFn: async () => {
@@ -30,7 +32,12 @@ const SettingOption = ({
}
label={
<div className="settings-option-info">
<Typography variant="subtitle1" fontWeight={400}>
<Typography
variant="subtitle1"
sx={{
fontWeight: 400,
}}
>
{setting.name}
</Typography>
<Typography
+6 -1
View File
@@ -39,7 +39,12 @@ const SettingOptionSelect = ({
}
label={
<div className="settings-option-info">
<Typography variant="subtitle1" fontWeight={400}>
<Typography
variant="subtitle1"
sx={{
fontWeight: 400,
}}
>
{setting.name}
</Typography>
<Typography
-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;
}
+3 -1
View File
@@ -48,7 +48,9 @@ const ShowMoreText = ({
width: "100%",
}}
variant="subtitle2"
fontWeight={300}
sx={{
fontWeight: 300,
}}
>
{content}
</Typography>
+1 -1
View File
@@ -6,7 +6,7 @@ import { motion } from "motion/react";
const ItemSkeleton = () => {
return (
<motion.div
className="item item-default scrollY padded-top flex flex-column"
className="item item-detail-page item-default scrollY padded-top flex flex-column"
style={{
width: "100vw",
}}
+10 -2
View File
@@ -7,10 +7,18 @@ import "./tagChip.scss";
const TagChip = ({
label,
linkProps,
}: { label: string; linkProps?: LinkProps }) => {
}: {
label: string;
linkProps?: LinkProps;
}) => {
return (
<Link className="tag" to="/search" search={{ query: label }} {...linkProps}>
<Typography variant="subtitle2" fontWeight={300}>
<Typography
variant="subtitle2"
sx={{
fontWeight: 300,
}}
>
{label}
</Typography>
</Link>
+285 -69
View File
@@ -1,18 +1,19 @@
import { LoadingButton } from "@mui/lab";
import {
Box,
Button,
Chip,
CircularProgress,
Dialog,
DialogActions,
DialogContent,
DialogContentText,
DialogTitle,
Link,
Stack,
Typography,
} from "@mui/material";
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 React, { useLayoutEffect, useState } from "react";
import React, { useCallback, useLayoutEffect, useState } from "react";
export default function Updater() {
const [updateDialog, setUpdateDialog] = useState(false);
@@ -23,8 +24,8 @@ export default function Updater() {
async function checkForUpdates() {
try {
const update = await check();
if (update?.available) {
if (update) {
// console.log(update);
setUpdateInfo(update);
setUpdateDialog(true);
@@ -37,95 +38,310 @@ export default function Updater() {
checkForUpdates();
}, []);
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;
return (
<Dialog
open={updateDialog}
maxWidth="xs"
PaperProps={{
style: {
borderRadius: "20px",
fullWidth
slotProps={{
paper: {
className: "glass",
style: {
borderRadius: "24px",
overflow: "hidden",
},
},
className: "glass",
}}
sx={{
"& img": {
width: "100%",
backdrop: {
style: {
backdropFilter: "blur(5px)",
backgroundColor: "rgba(0, 0, 0, 0.5)",
},
},
}}
>
<DialogTitle variant="h5" align="center" textAlign={"center"}>
Update Available!
</DialogTitle>
<Box
sx={{
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
className="flex flex-center"
style={{ gap: "0.5em", padding: "0 2em 1em 2em", flexWrap: "wrap" }}
sx={{ position: "relative", zIndex: 1, pt: 5, pb: 3, px: 3 }}
>
<Chip
icon={<span className="material-symbols-rounded">update</span>}
label={`v${updateInfo.currentVersion}`}
variant="outlined"
/>
<span className="material-symbols-rounded">arrow_right_alt</span>
<Chip
icon={<span className="material-symbols-rounded">update</span>}
label={`v${updateInfo.version}`}
variant="outlined"
/>
<DialogContentText sx={{ width: "100%" }}>
<Link
href={`https://github.com/prayag17/Blink/releases/v${updateInfo.version}`}
target="_blank"
<Stack
spacing={3}
sx={{
alignItems: "center",
}}
>
<Box
sx={{
width: 72,
height: 72,
borderRadius: "50%",
display: "flex",
alignItems: "center",
justifyContent: "center",
background: (theme) =>
`linear-gradient(135deg, ${theme.palette.primary.main} 0%, ${theme.palette.secondary.main} 100%)`,
boxShadow: (theme) =>
`0 10px 25px -5px ${theme.palette.primary.main}80`,
mb: 1,
}}
>
Open changelog
</Link>
</DialogContentText>
<span
className="material-symbols-rounded"
style={{ fontSize: "36px", color: "white" }}
>
rocket_launch
</span>
</Box>
<Stack
spacing={1}
sx={{
textAlign: "center",
}}
>
<Typography
variant="h5"
sx={{
fontWeight: "900",
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"
sx={{
color: "text.secondary",
maxWidth: "25ch",
}}
>
A new version of Blink is ready for you.
</Typography>
</Stack>
<Stack
direction="row"
sx={{
alignItems: "center",
justifyContent: "space-between",
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"
sx={{
color: "text.secondary",
mb: 0.5,
}}
>
Current
</Typography>
<Typography
variant="subtitle1"
sx={{
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
sx={{
alignItems: "flex-end",
}}
>
<Typography
variant="caption"
sx={{
color: "primary.main",
mb: 0.5,
}}
>
New Version
</Typography>
<Typography
variant="subtitle1"
sx={{
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>
<DialogActions
style={{
padding: "1em",
sx={{
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
color="error"
variant="contained"
disabled={updateDialogButton}
color="inherit"
size="large"
onClick={() => setUpdateDialog(false)}
style={{ borderRadius: "10px" }}
disableElevation
sx={{
borderRadius: "14px",
flex: 1,
color: "text.secondary",
height: 48,
"&:hover": {
bgcolor: "rgba(255,255,255,0.05)",
color: "text.primary",
},
}}
>
close
Later
</Button>
<LoadingButton
style={{ borderRadius: "10px" }}
color="success"
<Button
size="large"
variant="contained"
loading={updateDialogButton}
loadingIndicator="Updating..."
loadingIndicator={
<CircularProgress
size={24}
color="inherit"
value={downloadProgress / downloadSize}
/>
}
disableElevation
onClick={async () => {
setUpdateDialogButton(true);
await updateInfo.downloadAndInstall();
enqueueSnackbar("Update has been installed! You need to relaunch Blink.", {
variant: "success",
});
await relaunch();
onClick={handleUpdate}
sx={{
borderRadius: "14px",
flex: 1,
height: 48,
background: (theme) =>
`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
</LoadingButton>
</Button>
</DialogActions>
</Dialog>
);
Loaded 100 of 168 files, more files were not shown because too many files have changed in this diff. Show more