Fix TypeScript errors in products page and Harvest Reach components

This commit is contained in:
2026-06-02 03:51:54 +00:00
parent 7203cf1ead
commit d44506dd01
8 changed files with 473 additions and 7 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ export default async function AdminProductsPage() {
return (
<div className="min-h-screen bg-[var(--admin-bg)]">
<ProductsClient products={products ?? []} brandId={brandId} />
<ProductsClient products={products ?? []} brandId={brandId ?? undefined} />
</div>
);
}
@@ -14,7 +14,7 @@ type Props = {
};
// Icon components
const LayersIcon = (className: string) => (
const LayersIcon = ({ className }: { className: string }) => (
<svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<polygon points="12 2 2 7 12 12 22 7 12 2"/>
<polyline points="2 17 12 22 22 17"/>
@@ -6,7 +6,7 @@ import { AdminButton, AdminIconButton, AdminSearchInput } from "@/components/adm
// Icon components
const Icons = {
plus: (className: string) => (
Plus: ({ className }: { className: string }) => (
<svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M12 5v14M5 12h14" />
</svg>
@@ -47,7 +47,7 @@ export default function SegmentListSidebar({ segments, activeSegmentId, onSelect
variant="primary"
size="sm"
>
<Icons.plus className="w-4 h-4" />
<Icons.Plus className="w-4 h-4" />
</AdminIconButton>
</div>
+7 -1
View File
@@ -74,7 +74,7 @@ const PackageIconHeader = () => (
</svg>
);
export default function ProductsClient({ products, brandId }: { products: Product[]; brandId: string }) {
export default function ProductsClient({ products, brandId }: { products: Product[]; brandId?: string }) {
const router = useRouter();
const [, startTransition] = useTransition();
const [search, setSearch] = useState("");
@@ -234,6 +234,12 @@ export default function ProductsClient({ products, brandId }: { products: Produc
}
try {
if (!brandId) {
setError("Brand ID is required");
setSaving(false);
return;
}
let result;
const imageUrl = pendingImageUrl || formData.image_url || null;