interface UsePlaylistResult

Returned by usePlaylist to PlaylistDetail.

Properties

fading: Record<string, FadeState>

It holds the dumps being removed, which stay listed while they fade. A dump in it can't be dragged, and during its cooldown its removal can be undone.

actionError: string | null

It says why the server refused a removal, a reorder or a delete.

applyDetails: (playlist: Playlist) => void

Shows the playlist as PlaylistEditForm saved it.

remove: (dumpId: string) => void

Fades the dump out, and takes it out of the playlist on the server when the fade ends, or when the page is left before.

undoRemove: (dumpId: string) => void

Keeps a dump that remove is fading out. Nothing was sent yet.

move: (
from: number,
to: number
) => void

Moves the dump at from to to, counted among the dumps not fading, on screen only, as a drag goes along.

saveOrder: () => void

Sends the order move left, as a drag ends.

deletePlaylist: () => Promise<void>

Leaves for home once the playlist is deleted, or sets actionError.

Usage

import { type UsePlaylistResult } from "src/hooks/playlist/usePlaylist.ts";