b596c97faf
Deploy / deploy (push) Successful in 3m12s
Check shots on the Playlist page and "Play selection" plays them back to back without slate or handles. The cut comes from the version's handle and slate metadata (new cutSpan in lib/handles); the media is never changed. SequencePlayer double-buffers two videos: the next clip is parked a few frames before its cut-in and pre-rolled hidden, the outgoing clip pauses on its last cut frame, and the cut fires on the incoming clip's cut-in frame (requestVideoFrameCallback), with the start time calibrated at each cut. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
602 lines
21 KiB
TypeScript
602 lines
21 KiB
TypeScript
"use client";
|
|
|
|
import { useState, useEffect, useRef, useCallback, useMemo, startTransition } from "react";
|
|
import Image from "next/image";
|
|
import Link from "next/link";
|
|
import { ReviewPlayer, type ReviewPlayerRef } from "@/components/player/ReviewPlayer";
|
|
import { SequencePlayer, type SequenceClip } from "@/components/player/SequencePlayer";
|
|
import { useReviewStore } from "@/hooks/use-review-player";
|
|
import {
|
|
Select,
|
|
SelectContent,
|
|
SelectItem,
|
|
SelectTrigger,
|
|
SelectValue,
|
|
} from "@/components/ui/select";
|
|
import { Badge } from "@/components/ui/badge";
|
|
import { cn } from "@/lib/utils";
|
|
import { Button } from "@/components/ui/button";
|
|
import { internallyApproveShot, shareWithClient } from "@/actions/shots";
|
|
import { useToast } from "@/components/ui/use-toast";
|
|
import {
|
|
Film,
|
|
Loader2,
|
|
CheckCircle2,
|
|
AlertCircle,
|
|
Clock,
|
|
ExternalLink,
|
|
ShieldCheck,
|
|
Send,
|
|
ListVideo,
|
|
X,
|
|
} from "lucide-react";
|
|
|
|
interface Project {
|
|
id: string;
|
|
name: string;
|
|
code: string;
|
|
projectType: string;
|
|
}
|
|
|
|
interface PlaylistVersion {
|
|
id: string;
|
|
versionNumber: number;
|
|
fileUrl: string;
|
|
thumbnailUrl: string | null;
|
|
posterUrl: string | null;
|
|
fps: number;
|
|
duration?: number | null;
|
|
frameCount?: number | null;
|
|
hqFileUrl?: string | null;
|
|
handleHead?: number | null;
|
|
handleTail?: number | null;
|
|
pictureStartFrame?: number | null;
|
|
approvalStatus: string;
|
|
taskTitle: string;
|
|
}
|
|
|
|
interface PlaylistShot {
|
|
id: string;
|
|
shotCode: string;
|
|
episode: string | null;
|
|
status: string;
|
|
shotApprovalStatus: string;
|
|
sharedWithClient: boolean;
|
|
thumbnailUrl: string | null;
|
|
latestVersion: PlaylistVersion;
|
|
}
|
|
|
|
interface PlaylistClientProps {
|
|
projects: Project[];
|
|
userRole: string;
|
|
}
|
|
|
|
const APPROVAL_COLORS: Record<string, string> = {
|
|
PENDING_REVIEW: "bg-amber-500/10 text-amber-400 border-amber-500/20",
|
|
APPROVED: "bg-emerald-500/10 text-emerald-400 border-emerald-500/20",
|
|
REJECTED: "bg-red-500/10 text-red-400 border-red-500/20",
|
|
NEEDS_CHANGES: "bg-orange-500/10 text-orange-400 border-orange-500/20",
|
|
};
|
|
|
|
const APPROVAL_ICONS: Record<string, React.ElementType> = {
|
|
PENDING_REVIEW: Clock,
|
|
APPROVED: CheckCircle2,
|
|
REJECTED: AlertCircle,
|
|
NEEDS_CHANGES: AlertCircle,
|
|
};
|
|
|
|
export function PlaylistClient({ projects, userRole }: PlaylistClientProps) {
|
|
const playerRef = useRef<ReviewPlayerRef>(null);
|
|
const reset = useReviewStore((s) => s.reset);
|
|
const { toast } = useToast();
|
|
|
|
const [projectId, setProjectId] = useState<string | null>(null);
|
|
const [shots, setShots] = useState<PlaylistShot[]>([]);
|
|
const [activeShot, setActiveShot] = useState<PlaylistShot | null>(null);
|
|
const [isLoading, setIsLoading] = useState(false);
|
|
const [isActioning, setIsActioning] = useState(false);
|
|
/** Shots checked for the seamless playlist, by shot id. */
|
|
const [selected, setSelected] = useState<Set<string>>(new Set());
|
|
const [sequenceMode, setSequenceMode] = useState(false);
|
|
const lastChecked = useRef<string | null>(null);
|
|
|
|
const canApprove = ["ADMIN", "PRODUCER", "SUPERVISOR"].includes(userRole);
|
|
|
|
// Restore last project from localStorage on mount
|
|
useEffect(() => {
|
|
const saved = localStorage.getItem("playlist:lastProjectId");
|
|
if (saved && projects.some((p) => p.id === saved)) {
|
|
setProjectId(saved);
|
|
}
|
|
}, [projects]);
|
|
|
|
// Fetch shots whenever project changes
|
|
useEffect(() => {
|
|
if (!projectId) {
|
|
setShots([]);
|
|
setActiveShot(null);
|
|
return;
|
|
}
|
|
let cancelled = false;
|
|
setIsLoading(true);
|
|
fetch(`/api/playlist?projectId=${projectId}`)
|
|
.then((r) => r.json())
|
|
.then((data) => {
|
|
if (cancelled) return;
|
|
const list: PlaylistShot[] = data.shots ?? [];
|
|
setShots(list);
|
|
setSelected(loadSelection(projectId, list));
|
|
lastChecked.current = null;
|
|
setSequenceMode(false);
|
|
// Auto-select the first shot, or keep the current one if it still exists
|
|
setActiveShot((prev) => {
|
|
const stillExists = prev && list.some((s) => s.id === prev.id);
|
|
return stillExists ? prev : (list[0] ?? null);
|
|
});
|
|
})
|
|
.catch(() => {
|
|
if (!cancelled) setShots([]);
|
|
})
|
|
.finally(() => {
|
|
if (!cancelled) setIsLoading(false);
|
|
});
|
|
return () => { cancelled = true; };
|
|
}, [projectId]);
|
|
|
|
const handleProjectChange = (id: string) => {
|
|
localStorage.setItem("playlist:lastProjectId", id);
|
|
setProjectId(id);
|
|
};
|
|
|
|
const handleSelectShot = useCallback((shot: PlaylistShot) => {
|
|
reset();
|
|
setSequenceMode(false);
|
|
setActiveShot(shot);
|
|
}, [reset]);
|
|
|
|
const updateSelection = useCallback(
|
|
(next: Set<string>) => {
|
|
setSelected(next);
|
|
if (projectId) saveSelection(projectId, next);
|
|
if (next.size === 0) setSequenceMode(false);
|
|
},
|
|
[projectId]
|
|
);
|
|
|
|
/** Toggle one shot; shift-click sets every shot between it and the last one checked. */
|
|
const toggleChecked = (shot: PlaylistShot, shift: boolean) => {
|
|
const next = new Set(selected);
|
|
const on = !selected.has(shot.id);
|
|
const from = lastChecked.current ? shots.findIndex((s) => s.id === lastChecked.current) : -1;
|
|
const to = shots.findIndex((s) => s.id === shot.id);
|
|
const range = shift && from >= 0 ? shots.slice(Math.min(from, to), Math.max(from, to) + 1) : [shot];
|
|
for (const s of range) {
|
|
if (on) next.add(s.id);
|
|
else next.delete(s.id);
|
|
}
|
|
lastChecked.current = shot.id;
|
|
updateSelection(next);
|
|
};
|
|
|
|
const setGroupChecked = (group: PlaylistShot[], on: boolean) => {
|
|
const next = new Set(selected);
|
|
for (const s of group) {
|
|
if (on) next.add(s.id);
|
|
else next.delete(s.id);
|
|
}
|
|
updateSelection(next);
|
|
};
|
|
|
|
// The playlist, in edit order. Keyed on the versions it plays so a refresh
|
|
// (e.g. after approving a shot) doesn't restart playback.
|
|
const clipKey = shots
|
|
.filter((s) => selected.has(s.id))
|
|
.map((s) => s.latestVersion.id)
|
|
.join(",");
|
|
const clips = useMemo<SequenceClip[]>(
|
|
() =>
|
|
shots
|
|
.filter((s) => selected.has(s.id))
|
|
.map((s) => ({
|
|
id: s.latestVersion.id,
|
|
label: s.shotCode,
|
|
sublabel: `v${String(s.latestVersion.versionNumber).padStart(3, "0")}`,
|
|
url: s.latestVersion.fileUrl,
|
|
hqUrl: s.latestVersion.hqFileUrl,
|
|
fps: s.latestVersion.fps,
|
|
duration: s.latestVersion.duration,
|
|
handles: s.latestVersion,
|
|
})),
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
[clipKey]
|
|
);
|
|
|
|
const handleClipChange = useCallback(
|
|
(clip: SequenceClip) => {
|
|
// A transition, so re-rendering the page (shot list and all) yields to
|
|
// the video: rendered in one go, it dropped the frame after every cut.
|
|
startTransition(() => {
|
|
setActiveShot(shots.find((s) => s.latestVersion.id === clip.id) ?? null);
|
|
});
|
|
},
|
|
[shots]
|
|
);
|
|
|
|
const refreshShots = useCallback(() => {
|
|
if (!projectId) return;
|
|
fetch(`/api/playlist?projectId=${projectId}`)
|
|
.then((r) => r.json())
|
|
.then((data) => {
|
|
const list: PlaylistShot[] = data.shots ?? [];
|
|
setShots(list);
|
|
setActiveShot((prev) => prev ? (list.find((s) => s.id === prev.id) ?? prev) : null);
|
|
})
|
|
.catch(() => {});
|
|
}, [projectId]);
|
|
|
|
const handleInternallyApprove = async () => {
|
|
if (!activeShot) return;
|
|
setIsActioning(true);
|
|
try {
|
|
await internallyApproveShot(activeShot.id);
|
|
toast({ title: "Shot internally approved", description: "Status: Ready for Client" });
|
|
refreshShots();
|
|
} catch (e) {
|
|
toast({ title: "Failed", description: (e as Error).message, variant: "destructive" });
|
|
} finally {
|
|
setIsActioning(false);
|
|
}
|
|
};
|
|
|
|
const handleShareWithClient = async () => {
|
|
if (!activeShot) return;
|
|
setIsActioning(true);
|
|
try {
|
|
await shareWithClient(activeShot.id);
|
|
toast({ title: "Shared with client", description: "Status: Client Review" });
|
|
refreshShots();
|
|
} catch (e) {
|
|
toast({ title: "Failed", description: (e as Error).message, variant: "destructive" });
|
|
} finally {
|
|
setIsActioning(false);
|
|
}
|
|
};
|
|
|
|
// Group shots by episode for episodic projects
|
|
const selectedProject = projects.find((p) => p.id === projectId);
|
|
const isEpisodic = selectedProject?.projectType === "EPISODIC";
|
|
|
|
const episodeGroups: [string, PlaylistShot[]][] = isEpisodic
|
|
? (() => {
|
|
const map = new Map<string, PlaylistShot[]>();
|
|
for (const shot of shots) {
|
|
const key = shot.episode ?? "(No Episode)";
|
|
if (!map.has(key)) map.set(key, []);
|
|
map.get(key)!.push(shot);
|
|
}
|
|
return Array.from(map.entries());
|
|
})()
|
|
: [];
|
|
|
|
return (
|
|
<div className="flex h-full overflow-hidden flex-col">
|
|
{/* Toolbar */}
|
|
<div className="flex items-center gap-4 px-4 py-2.5 border-b border-border bg-card shrink-0">
|
|
<span className="text-sm font-semibold text-white">Playlist</span>
|
|
<div className="flex items-center gap-2">
|
|
<label className="text-xs text-zinc-400 shrink-0">Project:</label>
|
|
<Select value={projectId ?? ""} onValueChange={handleProjectChange}>
|
|
<SelectTrigger className="w-64 h-8 text-sm">
|
|
<SelectValue placeholder="Select a project..." />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
{projects.map((p) => (
|
|
<SelectItem key={p.id} value={p.id}>
|
|
<span className="font-mono text-xs text-zinc-400 mr-2">{p.code}</span>
|
|
{p.name}
|
|
</SelectItem>
|
|
))}
|
|
</SelectContent>
|
|
</Select>
|
|
</div>
|
|
|
|
{selected.size > 0 && (
|
|
sequenceMode ? (
|
|
<Button
|
|
size="sm"
|
|
variant="outline"
|
|
onClick={() => setSequenceMode(false)}
|
|
className="h-7 text-xs gap-1"
|
|
>
|
|
<X className="h-3 w-3" />
|
|
Exit playlist
|
|
</Button>
|
|
) : (
|
|
<Button
|
|
size="sm"
|
|
onClick={() => {
|
|
reset();
|
|
setSequenceMode(true);
|
|
}}
|
|
className="h-7 text-xs gap-1"
|
|
title="Play the checked shots back to back: cut only, no slate or handles"
|
|
>
|
|
<ListVideo className="h-3.5 w-3.5" />
|
|
Play selection ({selected.size})
|
|
</Button>
|
|
)
|
|
)}
|
|
|
|
{activeShot && (
|
|
<div className="flex items-center gap-2 ml-auto">
|
|
<span className="font-mono text-sm text-white">{activeShot.shotCode}</span>
|
|
<Badge className={cn("text-xs gap-1", APPROVAL_COLORS[activeShot.latestVersion.approvalStatus])}>
|
|
{(() => {
|
|
const Icon = APPROVAL_ICONS[activeShot.latestVersion.approvalStatus] ?? Clock;
|
|
return <Icon className="h-3 w-3" />;
|
|
})()}
|
|
{activeShot.latestVersion.approvalStatus.replace(/_/g, " ")}
|
|
</Badge>
|
|
|
|
{canApprove && activeShot.shotApprovalStatus === "PENDING" && (
|
|
<Button
|
|
size="sm"
|
|
variant="outline"
|
|
disabled={isActioning}
|
|
onClick={handleInternallyApprove}
|
|
className="h-7 text-xs gap-1 text-purple-400 border-purple-500/30 hover:bg-purple-500/10"
|
|
>
|
|
<ShieldCheck className="h-3 w-3" />
|
|
<span className="hidden sm:inline">Internally Approve</span>
|
|
</Button>
|
|
)}
|
|
|
|
{canApprove && activeShot.shotApprovalStatus === "INTERNALLY_APPROVED" && !activeShot.sharedWithClient && (
|
|
<Button
|
|
size="sm"
|
|
variant="outline"
|
|
disabled={isActioning}
|
|
onClick={handleShareWithClient}
|
|
className="h-7 text-xs gap-1 text-amber-400 border-amber-500/30 hover:bg-amber-500/10"
|
|
>
|
|
<Send className="h-3 w-3" />
|
|
<span className="hidden sm:inline">Share with Client</span>
|
|
</Button>
|
|
)}
|
|
|
|
<Link
|
|
href={`/review/${activeShot.latestVersion.id}`}
|
|
className="text-zinc-500 hover:text-zinc-200 transition-colors"
|
|
title="Open full review page"
|
|
>
|
|
<ExternalLink className="h-3.5 w-3.5" />
|
|
</Link>
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
{/* Body: player + shot panel */}
|
|
<div className="flex flex-1 min-h-0 overflow-hidden">
|
|
{/* Player */}
|
|
<div className="flex-1 min-w-0 bg-black flex flex-col">
|
|
{sequenceMode && clips.length > 0 ? (
|
|
<SequencePlayer clips={clips} onClipChange={handleClipChange} />
|
|
) : activeShot ? (
|
|
<ReviewPlayer
|
|
key={activeShot.latestVersion.id}
|
|
ref={playerRef}
|
|
videoUrl={activeShot.latestVersion.fileUrl}
|
|
versionId={activeShot.latestVersion.id}
|
|
fps={activeShot.latestVersion.fps}
|
|
comments={[]}
|
|
annotations={[]}
|
|
handles={activeShot.latestVersion}
|
|
hqVideoUrl={activeShot.latestVersion.hqFileUrl}
|
|
/>
|
|
) : (
|
|
<div className="flex-1 flex flex-col items-center justify-center gap-3 text-zinc-600">
|
|
<Film className="h-12 w-12 opacity-30" />
|
|
<p className="text-sm">
|
|
{!projectId
|
|
? "Select a project to start"
|
|
: isLoading
|
|
? ""
|
|
: "No shots with video versions found"}
|
|
</p>
|
|
{isLoading && <Loader2 className="h-5 w-5 animate-spin opacity-50" />}
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
{/* Shot panel */}
|
|
<div className="w-64 xl:w-72 shrink-0 flex flex-col border-l border-border bg-zinc-950 overflow-hidden">
|
|
<div className="px-3 py-2.5 border-b border-border shrink-0 flex items-center justify-between">
|
|
<span className="text-xs font-medium text-zinc-400 uppercase tracking-wider">Shots</span>
|
|
{shots.length > 0 && (
|
|
<div className="flex items-center gap-2 text-xs">
|
|
{selected.size > 0 ? (
|
|
<button
|
|
onClick={() => updateSelection(new Set())}
|
|
className="text-zinc-500 hover:text-zinc-200"
|
|
>
|
|
Clear
|
|
</button>
|
|
) : (
|
|
<button
|
|
onClick={() => setGroupChecked(shots, true)}
|
|
className="text-zinc-500 hover:text-zinc-200"
|
|
>
|
|
Select all
|
|
</button>
|
|
)}
|
|
<span className="text-zinc-600">
|
|
{selected.size > 0 ? `${selected.size}/${shots.length}` : shots.length}
|
|
</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
<div className="flex-1 overflow-y-auto">
|
|
{isLoading ? (
|
|
<div className="flex items-center justify-center py-16 text-zinc-600">
|
|
<Loader2 className="h-5 w-5 animate-spin" />
|
|
</div>
|
|
) : !projectId ? (
|
|
<div className="flex flex-col items-center justify-center py-16 gap-2 text-zinc-600">
|
|
<Film className="h-7 w-7 opacity-30" />
|
|
<p className="text-xs text-center">Select a project</p>
|
|
</div>
|
|
) : shots.length === 0 ? (
|
|
<div className="flex flex-col items-center justify-center py-16 gap-2 text-zinc-600">
|
|
<Film className="h-7 w-7 opacity-30" />
|
|
<p className="text-xs text-center">No video versions found</p>
|
|
</div>
|
|
) : isEpisodic ? (
|
|
<div>
|
|
{episodeGroups.map(([episode, episodeShots]) => (
|
|
<div key={episode}>
|
|
<label className="px-3 py-1.5 bg-zinc-900/80 sticky top-0 z-10 border-b border-zinc-800 flex items-center gap-2 cursor-pointer">
|
|
<input
|
|
type="checkbox"
|
|
className="h-3 w-3 accent-blue-500 cursor-pointer"
|
|
checked={episodeShots.every((s) => selected.has(s.id))}
|
|
onChange={(e) => setGroupChecked(episodeShots, e.target.checked)}
|
|
title="Select this episode"
|
|
/>
|
|
<span className="text-[10px] font-semibold text-zinc-500 uppercase tracking-wider">
|
|
Ep {episode}
|
|
</span>
|
|
</label>
|
|
{episodeShots.map((shot) => (
|
|
<ShotThumbnail
|
|
key={shot.id}
|
|
shot={shot}
|
|
isActive={activeShot?.id === shot.id}
|
|
isChecked={selected.has(shot.id)}
|
|
onToggle={(shift) => toggleChecked(shot, shift)}
|
|
onClick={() => handleSelectShot(shot)}
|
|
/>
|
|
))}
|
|
</div>
|
|
))}
|
|
</div>
|
|
) : (
|
|
<div>
|
|
{shots.map((shot) => (
|
|
<ShotThumbnail
|
|
key={shot.id}
|
|
shot={shot}
|
|
isActive={activeShot?.id === shot.id}
|
|
isChecked={selected.has(shot.id)}
|
|
onToggle={(shift) => toggleChecked(shot, shift)}
|
|
onClick={() => handleSelectShot(shot)}
|
|
/>
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
function ShotThumbnail({
|
|
shot,
|
|
isActive,
|
|
isChecked,
|
|
onToggle,
|
|
onClick,
|
|
}: {
|
|
shot: PlaylistShot;
|
|
isActive: boolean;
|
|
isChecked: boolean;
|
|
onToggle: (shift: boolean) => void;
|
|
onClick: () => void;
|
|
}) {
|
|
const thumb = shot.latestVersion.thumbnailUrl ?? shot.latestVersion.posterUrl ?? shot.thumbnailUrl;
|
|
const ApprovalIcon = APPROVAL_ICONS[shot.latestVersion.approvalStatus] ?? Clock;
|
|
|
|
return (
|
|
<div
|
|
role="button"
|
|
tabIndex={0}
|
|
onClick={onClick}
|
|
onKeyDown={(e) => {
|
|
if (e.key === "Enter") onClick();
|
|
}}
|
|
className={cn(
|
|
"w-full flex items-start gap-2.5 px-3 py-2.5 text-left transition-colors border-b border-zinc-800/60 group cursor-pointer",
|
|
isActive
|
|
? "bg-blue-500/10 border-l-2 border-l-blue-500"
|
|
: "hover:bg-zinc-800/40 border-l-2 border-l-transparent"
|
|
)}
|
|
>
|
|
<input
|
|
type="checkbox"
|
|
checked={isChecked}
|
|
onChange={() => {}}
|
|
onClick={(e) => {
|
|
e.stopPropagation();
|
|
onToggle(e.shiftKey);
|
|
}}
|
|
className="mt-3 h-3.5 w-3.5 shrink-0 accent-blue-500 cursor-pointer"
|
|
title="Add to playlist (shift-click for a range)"
|
|
/>
|
|
{/* Thumbnail */}
|
|
<div className="w-20 aspect-[2.39/1] rounded overflow-hidden bg-zinc-800 shrink-0 flex items-center justify-center">
|
|
{thumb ? (
|
|
<Image
|
|
src={thumb}
|
|
alt={shot.shotCode}
|
|
width={80}
|
|
height={34}
|
|
className="object-cover w-full h-full"
|
|
/>
|
|
) : (
|
|
<Film className="h-4 w-4 text-zinc-600" />
|
|
)}
|
|
</div>
|
|
|
|
{/* Info */}
|
|
<div className="flex-1 min-w-0 pt-0.5">
|
|
<p className="font-mono text-xs font-semibold text-white truncate">{shot.shotCode}</p>
|
|
<p className="text-[10px] text-zinc-500 truncate">{shot.latestVersion.taskTitle}</p>
|
|
<div className={cn(
|
|
"flex items-center gap-1 mt-0.5 text-[10px]",
|
|
APPROVAL_COLORS[shot.latestVersion.approvalStatus]?.split(" ").find(c => c.startsWith("text-")) ?? "text-zinc-400"
|
|
)}>
|
|
<ApprovalIcon className="h-2.5 w-2.5 shrink-0" />
|
|
<span className="truncate">
|
|
v{String(shot.latestVersion.versionNumber).padStart(3, "0")}
|
|
{" · "}
|
|
{shot.latestVersion.approvalStatus.replace(/_/g, " ")}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const selectionKey = (projectId: string) => `playlist:selection:${projectId}`;
|
|
|
|
/** The checked shots remembered for this project, minus any no longer listed. */
|
|
function loadSelection(projectId: string, shots: PlaylistShot[]): Set<string> {
|
|
try {
|
|
const ids: unknown = JSON.parse(localStorage.getItem(selectionKey(projectId)) ?? "[]");
|
|
if (!Array.isArray(ids)) return new Set();
|
|
const listed = new Set(shots.map((s) => s.id));
|
|
return new Set(ids.filter((id): id is string => typeof id === "string" && listed.has(id)));
|
|
} catch {
|
|
return new Set();
|
|
}
|
|
}
|
|
|
|
function saveSelection(projectId: string, selected: Set<string>) {
|
|
try {
|
|
localStorage.setItem(selectionKey(projectId), JSON.stringify([...selected]));
|
|
} catch {
|
|
// Storage unavailable: the selection just isn't remembered.
|
|
}
|
|
}
|