dev #46

Merged
root merged 13 commits from dev into main 2026-05-25 04:49:05 +03:00
2 changed files with 41 additions and 13 deletions
Showing only changes of commit df85ebad83 - Show all commits

View File

@@ -54,6 +54,9 @@ export interface CategorySchema {
parts: Part[];
schemaPics: SchemaPic[];
hotspots: Hotspot[];
/** True when a source (e.g. PL24) fetch failed and the empty lists are a
* load error rather than a genuinely empty category — UI should offer retry. */
loadError?: boolean;
}
export function useCategoryParts(vehicleId: string, categoryId: string) {

View File

@@ -238,19 +238,44 @@ function VehicleCategoryPage() {
<CategoryColumns categories={data.children} vehicleId={id} />
))}
{/* Leaf category — show schema viewer */}
{data && !hasChildren && (
<Suspense fallback={<SchemaViewerFallback />}>
<SchemaViewer
schemaPic={data.schemaPics?.[0] ?? null}
hotspots={data.hotspots ?? []}
parts={data.parts ?? []}
isLoading={isLoading}
vehicleId={id}
categoryId={categoryId}
/>
</Suspense>
)}
{/* Leaf category — schema viewer, or a retry prompt when the source
catalog fetch failed (vs a genuinely empty category). */}
{data &&
!hasChildren &&
(data.loadError ? (
<div
role="alert"
className="flex flex-col items-start gap-3 rounded-lg border border-destructive/40 bg-destructive/5 p-5 text-sm"
>
<div>
<p className="font-medium text-destructive">Katalog şu an yüklenemedi</p>
<p className="mt-1 text-muted-foreground">
Bu kategori tedarikçi katalogundan alınamadı. Lütfen birazdan tekrar deneyin.
</p>
</div>
<Button
type="button"
size="sm"
variant="outline"
onClick={() => refetch()}
disabled={isFetching}
data-faro-user-action-name="category-loaderror-retry"
>
{isFetching ? "Yükleniyor…" : "Tekrar dene"}
</Button>
</div>
) : (
<Suspense fallback={<SchemaViewerFallback />}>
<SchemaViewer
schemaPic={data.schemaPics?.[0] ?? null}
hotspots={data.hotspots ?? []}
parts={data.parts ?? []}
isLoading={isLoading}
vehicleId={id}
categoryId={categoryId}
/>
</Suspense>
))}
</div>
);
}