Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions frontend/src/components/ui/separator.tsx
Original file line number Diff line number Diff line change
@@ -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<HTMLDivElement> {
orientation?: "horizontal" | "vertical";
}

export const Separator = React.forwardRef<HTMLDivElement, SeparatorProps>(
({ orientation = "horizontal", className = "", ...props }, ref) => (
<div
ref={ref}
role="separator"
aria-orientation={orientation}
className={[
orientation === "horizontal" ? "h-px w-full" : "h-full w-px",
"bg-gray-200",
className,
].join(" ")}
{...props}
/>
),
);

Separator.displayName = "Separator";

export default Separator;
20 changes: 20 additions & 0 deletions frontend/src/lib/api-version.ts
Original file line number Diff line number Diff line change
@@ -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(/^\/+/, "")}`;
}