feat: toast feedback, skip-to-content, deposit success notification

- toast.success/error on order creation (bestall/page.tsx)
- toast.success/error on order approval (validera/page.tsx) + fix silent
  success even when API failed (was always setting approved=true)
- toast.success/error on subscription creation (portal/subscriptions)
- toast.success/error on admin status advance (admin/page.tsx)
- toast.success on production page when Stripe redirects back with ?deposit=success
- layout.tsx: skip-to-main-content link (sr-only, visible on focus)
- app/page.tsx: id="main-content" anchor for skip link

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
2026-06-25 17:41:59 +02:00
co-authored by Claude Sonnet 4.6
parent df63d3a6dd
commit b95507e601
7 changed files with 60 additions and 12 deletions
+12 -2
View File
@@ -1,6 +1,7 @@
"use client";
import { useCallback, useEffect, useState } from "react";
import { toast } from "sonner";
import { useT } from "@/components/locale-provider";
import { PortalShell, StatusPill } from "@/components/portal-shell";
import { LoadingSkeleton, ErrorState, EmptyState } from "@/components/states";
@@ -56,8 +57,17 @@ export default function AdminPage() {
async function advance(id: string, status: string) {
const next = NEXT_STATUS[status];
if (!next) return;
await fetch(`/api/orders/${id}`, { method: "PATCH", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ status: next }) });
void load();
try {
const r = await fetch(`/api/orders/${id}`, { method: "PATCH", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ status: next }) });
if (r.ok) {
toast.success(`${id.slice(0, 8)}… → ${next}`);
void load();
} else {
toast.error(t({ en: "Could not advance order.", sv: "Kunde inte flytta fram ordern." }));
}
} catch {
toast.error(t({ en: "Network error.", sv: "Nätverksfel." }));
}
}
return (