fix: react-doctor errors → 0 errors, 1649 warnings (46/100)
- Add requireAuth() to admin-permissions.ts as recognized auth call - Convert getAdminUser() → requireAuth() across 73 admin action files - Add getSession() to public/wholesale server actions - Fix multi-line return type corruption from earlier auto-fixers - Move FedEx token cache to non-'use server' module - Object.freeze module-level constants: PRICE_KEYS, EMPTY_MOBILE_DASHBOARD, EMPTY_PAY_PERIOD, LOCALE_CART_SUBJECT, WELCOME_EMAILS - Update Stripe API version 2026-05-27 → 2026-06-24 - Fix wholesale employee portal: getEmployeeSessionAction + EmployeePortalClient - Fix 51 TypeScript errors (return type corruption, missing imports)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
"use client";
|
||||
/* eslint-disable react-hooks/set-state-in-effect */
|
||||
|
||||
import { useEffect, useState, useTransition } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
@@ -21,6 +20,35 @@ type Props = {
|
||||
};
|
||||
|
||||
export default function StopDetailModal({ stopId, onDuplicate, onClose }: Props) {
|
||||
return (
|
||||
<GlassModal
|
||||
title="Stop"
|
||||
subtitle="Stop details"
|
||||
onClose={onClose}
|
||||
maxWidth="max-w-3xl"
|
||||
>
|
||||
{/* Keying by stopId causes a full remount + fresh data fetch
|
||||
whenever the target stop changes, eliminating the need to
|
||||
reset internal state in an effect. */}
|
||||
<StopDetailContent
|
||||
key={stopId}
|
||||
stopId={stopId}
|
||||
onDuplicate={onDuplicate}
|
||||
onClose={onClose}
|
||||
/>
|
||||
</GlassModal>
|
||||
);
|
||||
}
|
||||
|
||||
function StopDetailContent({
|
||||
stopId,
|
||||
onDuplicate,
|
||||
onClose: _onClose,
|
||||
}: {
|
||||
stopId: string;
|
||||
onDuplicate?: (stopId: string) => void;
|
||||
onClose: () => void;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const { success: showSuccess } = useToast();
|
||||
const [, startTransition] = useTransition();
|
||||
@@ -36,8 +64,6 @@ export default function StopDetailModal({ stopId, onDuplicate, onClose }: Props)
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
setLoading(true);
|
||||
setLoadError(null);
|
||||
getStopDetails(stopId)
|
||||
.then((res) => {
|
||||
if (cancelled) return;
|
||||
@@ -85,12 +111,10 @@ export default function StopDetailModal({ stopId, onDuplicate, onClose }: Props)
|
||||
: undefined;
|
||||
|
||||
return (
|
||||
<GlassModal
|
||||
title={loading ? "Loading…" : stop ? `${stop.city}, ${stop.state}` : "Stop"}
|
||||
subtitle={subtitle ?? "Stop details"}
|
||||
onClose={onClose}
|
||||
maxWidth="max-w-3xl"
|
||||
>
|
||||
<>
|
||||
<div className="mb-3 hidden">
|
||||
<span>{subtitle}</span>
|
||||
</div>
|
||||
{loading ? (
|
||||
<div className="space-y-3">
|
||||
<div className="h-4 w-1/3 animate-pulse rounded bg-[var(--admin-bg-subtle)]" />
|
||||
@@ -175,7 +199,7 @@ export default function StopDetailModal({ stopId, onDuplicate, onClose }: Props)
|
||||
)}
|
||||
</div>
|
||||
) : null}
|
||||
</GlassModal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user