scroll positions remembered
Deploy / deploy (push) Successful in 2m30s

This commit is contained in:
twotalesanimation
2026-06-19 12:58:47 +02:00
parent ef6e41f8e0
commit 1a77a82566
2 changed files with 30 additions and 2 deletions
@@ -71,6 +71,8 @@ interface ShotStatusClientProps {
canManage: boolean;
}
const SCROLL_KEY = 'shot-status-scroll';
const STATUS_CONFIG: Record<string, { label: string; color: string; icon: React.ElementType }> = {
WAITING: { label: "Waiting", color: "bg-zinc-500/10 text-zinc-400 border-zinc-500/20", icon: Clock },
IN_PROGRESS: { label: "In Progress", color: "bg-blue-500/10 text-blue-400 border-blue-500/20", icon: Film },
@@ -341,6 +343,7 @@ function ShotTable({
<Link
href={`/projects/${projectId}/shots/${shot.id}`}
className="font-mono text-sm text-white hover:text-blue-400 transition-colors"
onClick={() => sessionStorage.setItem(SCROLL_KEY, String(window.scrollY))}
>
{shot.shotCode}
</Link>
@@ -399,6 +402,15 @@ export function ShotStatusClient({
const router = useRouter();
const { toast } = useToast();
// Restore scroll position when shots load
useEffect(() => {
const saved = sessionStorage.getItem(SCROLL_KEY);
if (saved) {
sessionStorage.removeItem(SCROLL_KEY);
requestAnimationFrame(() => window.scrollTo(0, parseInt(saved, 10)));
}
}, [shots]);
// Restore last selected project if no project is currently selected
useEffect(() => {
if (!selectedProjectId) {