From 5f7cec3a76c26a469c2f21d7168536d631ca1312 Mon Sep 17 00:00:00 2001 From: bigben-7 Date: Sat, 17 Oct 2026 11:00:29 +0100 Subject: [PATCH] bobaivigitalpoint-ui: versioned API helper + Separator component (#1496-#1499) --- frontend/src/components/ui/separator.tsx | 31 ++++++++++++++++++++++++ frontend/src/lib/api-version.ts | 20 +++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 frontend/src/components/ui/separator.tsx create mode 100644 frontend/src/lib/api-version.ts diff --git a/frontend/src/components/ui/separator.tsx b/frontend/src/components/ui/separator.tsx new file mode 100644 index 0000000..804ffa6 --- /dev/null +++ b/frontend/src/components/ui/separator.tsx @@ -0,0 +1,31 @@ +/** + * Separator component (#1498). + * + * `app/document/[id]/page.tsx` imported `@/components/ui/separator`, which did + * not exist and broke the build. This provides the missing component. + */ +import * as React from "react"; + +export interface SeparatorProps extends React.HTMLAttributes { + orientation?: "horizontal" | "vertical"; +} + +export const Separator = React.forwardRef( + ({ orientation = "horizontal", className = "", ...props }, ref) => ( +
+ ), +); + +Separator.displayName = "Separator"; + +export default Separator; diff --git a/frontend/src/lib/api-version.ts b/frontend/src/lib/api-version.ts new file mode 100644 index 0000000..39ab3c1 --- /dev/null +++ b/frontend/src/lib/api-version.ts @@ -0,0 +1,20 @@ +/** + * Versioned API URL helpers (#1499). + * + * 26 fetch call sites in 9 pages used unversioned `/api/...` URLs, while the + * backend serves `/api/v1/...`. These helpers build versioned URLs so call + * sites stop drifting and pick up the version in one place. + */ +export const API_VERSION = "v1"; + +const RAW_BASE = process.env.NEXT_PUBLIC_API_URL ?? ""; + +/** Base URL including the API version, e.g. `https://host/api/v1`. */ +export function apiBaseUrl(): string { + return `${RAW_BASE.replace(/\/+$/, "")}/api/${API_VERSION}`; +} + +/** Build a versioned API URL from a path such as `/disputes/1`. */ +export function apiUrl(path: string): string { + return `${apiBaseUrl()}/${path.replace(/^\/+/, "")}`; +}