fixed layouts, routing and the platform switcher.

This commit is contained in:
2025-12-22 08:36:19 -05:00
parent b1a8dae8ed
commit 34e915f904
21 changed files with 254 additions and 268 deletions
@@ -0,0 +1,24 @@
// app/(builder)/parts/_components/buildDetailHref.ts
const toSlug = (str: string) =>
str
.toLowerCase()
.replace(/[^a-z0-9]+/g, "-")
.replace(/(^-|-$)/g, "");
export type BuildDetailInput = {
id: string;
name: string;
brand?: string;
};
export function buildDetailHref(
platform: string,
partRole: string,
p: BuildDetailInput
) {
const slug = toSlug(`${p.brand ?? ""} ${p.name ?? ""}`);
return `/parts/p/${encodeURIComponent(platform)}/${encodeURIComponent(
partRole
)}/${p.id}-${slug}`;
}