Backend modules from tastefully 8bd93d15: core-libs, core-session, api-gateway, mobile-api, services-auth, services-system, services-counter, services-member, services-log, services-email. solvway-admin-portal from babyboo f64d096ea, solvway-customer-portal from tastefully 8bd93d15. Copied as tracked files only. Literal secrets replaced with environment placeholders: - services-email: SMTP_PASSWORD, MAILGUN_API_KEY, SENDGRID_API_KEY, MAILJET_API_KEY, MAILJET_SECRET_KEY (optional, empty default) - services-system: JUMIO_TOKEN, JUMIO_SECRET (optional) - services-auth: USER_AUTH_API_SECRET (required); commented JWT secret removed - core-libs: JWT_TOKEN default removed (required), XXL_JOB_TOKEN default removed, ipgeolocation key read from IPGEOLOCATION_API_KEY - services-system EkycAppConfig: commented Jumio credentials removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
62 lines
1.8 KiB
TypeScript
62 lines
1.8 KiB
TypeScript
"use client";
|
|
|
|
import type { ReactNode } from "react";
|
|
import { Button } from "@/app/components/ui/button";
|
|
import { cn } from "@/app/lib/utils";
|
|
|
|
// A segmented choice (feedback 2026-10-28): one of a few options, as pressed buttons on a neutral grey
|
|
// track. The chosen one is a raised white segment with a ring and bold text; the others stay grey, so
|
|
// nothing unchosen reads as "on" (the warm muted brown did).
|
|
|
|
export interface SegmentOption<V extends string> {
|
|
value: V;
|
|
label: ReactNode;
|
|
/** Shown before the label, e.g. a status dot or an error dot. Gets whether the option is chosen. */
|
|
lead?: (chosen: boolean) => ReactNode;
|
|
}
|
|
|
|
export function Segmented<V extends string>({
|
|
value,
|
|
options,
|
|
onChange,
|
|
label,
|
|
disabled = false,
|
|
className,
|
|
}: {
|
|
value: V;
|
|
options: SegmentOption<V>[];
|
|
onChange: (value: V) => void;
|
|
/** The group's accessible name. */
|
|
label: string;
|
|
disabled?: boolean;
|
|
className?: string;
|
|
}) {
|
|
return (
|
|
<div role="group" aria-label={label} className={cn("inline-grid auto-cols-fr grid-flow-col gap-1 rounded-lg bg-foreground/5 p-1", className)}>
|
|
{options.map((o) => {
|
|
const chosen = o.value === value;
|
|
return (
|
|
<Button
|
|
key={o.value}
|
|
type="button"
|
|
size="sm"
|
|
variant="ghost"
|
|
aria-pressed={chosen}
|
|
disabled={disabled}
|
|
onClick={() => onChange(o.value)}
|
|
className={cn(
|
|
"gap-2",
|
|
chosen
|
|
? "bg-card font-semibold text-foreground shadow-sm ring-1 ring-foreground/15 hover:bg-card"
|
|
: "font-normal text-foreground/65 hover:bg-foreground/5 hover:text-foreground",
|
|
)}
|
|
>
|
|
{o.lead?.(chosen)}
|
|
{o.label}
|
|
</Button>
|
|
);
|
|
})}
|
|
</div>
|
|
);
|
|
}
|