feat: instant mix, remote control and stable music library
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
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
- Instant Mix button on albums, artists, the audio player and full-screen player - Remote control dialog (cast icon in app bar/header/item/player): lists other sessions, play/pause/next/prev/seek/stop, and Play-on-device for an item - Music library: repair persisted view types (CollectionFolder/undefined) and fall back to Songs when a music library has no album grouping - Music jitter: remove full-screen backdrop-filters (audio bar and player page) and the body ResizeObserver in the virtualized grid
This commit is contained in:
1 parent
cc1391bb7d
commit
a98663691d
18 files changed
+681
-22
No files matched your search
@@ -0,0 +1,27 @@
|
||||
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 useRemoteControlStore from "@/utils/store/remoteControl";
|
||||
|
||||
type CastButtonProps = {
|
||||
item?: BaseItemDto | null;
|
||||
size?: "small" | "medium" | "large";
|
||||
};
|
||||
|
||||
const CastButton = ({ item, size = "medium" }: CastButtonProps) => {
|
||||
const openDialog = useRemoteControlStore((s) => s.openDialog);
|
||||
return (
|
||||
<Tooltip title={item ? "Play on another device" : "Remote control"}>
|
||||
<IconButton
|
||||
size={size}
|
||||
aria-label={item ? "Play on another device" : "Remote control"}
|
||||
onClick={() => openDialog(item ?? null)}
|
||||
>
|
||||
<span className="material-symbols-rounded">cast</span>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
|
||||
export default CastButton;
|
||||
@@ -0,0 +1,69 @@
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import { useSnackbar } from "notistack";
|
||||
import React, { useState } from "react";
|
||||
import { startInstantMix } from "@/utils/methods/instantMix";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
|
||||
type InstantMixButtonProps = {
|
||||
item?: BaseItemDto | null;
|
||||
/** Render a text button instead of an icon (e.g. on the album page). */
|
||||
withLabel?: boolean;
|
||||
};
|
||||
|
||||
const InstantMixButton = ({ item, withLabel = false }: InstantMixButtonProps) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
const [busy, setBusy] = useState(false);
|
||||
|
||||
const handleClick = async () => {
|
||||
if (!api || !user?.Id || !item) return;
|
||||
setBusy(true);
|
||||
try {
|
||||
const { count } = await startInstantMix(api, user.Id, item);
|
||||
if (count === 0) {
|
||||
enqueueSnackbar("No tracks found for this Instant Mix", {
|
||||
variant: "warning",
|
||||
});
|
||||
} else {
|
||||
enqueueSnackbar(`Instant Mix: ${count} tracks`, {
|
||||
variant: "success",
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Instant Mix failed", error);
|
||||
enqueueSnackbar("Could not start Instant Mix", { variant: "error" });
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Tooltip title="Instant Mix">
|
||||
<span>
|
||||
{withLabel ? (
|
||||
<IconButton
|
||||
aria-label="Instant Mix"
|
||||
onClick={handleClick}
|
||||
disabled={busy || !item}
|
||||
>
|
||||
<span className="material-symbols-rounded">radio</span>
|
||||
</IconButton>
|
||||
) : (
|
||||
<IconButton
|
||||
aria-label="Instant Mix"
|
||||
onClick={handleClick}
|
||||
disabled={busy || !item}
|
||||
>
|
||||
<span className="material-symbols-rounded">radio</span>
|
||||
</IconButton>
|
||||
)}
|
||||
</span>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
|
||||
export default InstantMixButton;
|
||||
Reference in new issue
Block a user