CI (SIAX Cloud) / integration (push) Skipped
masterplan-lock / check (push) Successful in 7s
Security Scan (SIAX Cloud) / security (push) Successful in 20s
CI (SIAX Cloud) / security (push) Successful in 47s
masterplan-lock / check (pull_request) Successful in 10s
CI (SIAX Cloud) / quality (push) Successful in 1m11s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 32s
CI (SIAX Cloud) / security (pull_request) Successful in 42s
CI (SIAX Cloud) / integration (pull_request) Successful in 56s
CI (SIAX Cloud) / quality (pull_request) Successful in 59s
axe-core 4.10.2 mot 0pt.app 2026-09-26: en enda regel, color-contrast, impact=serious, 82 noder. Estatets största enskilda a11y-defekt. Alla 82 har samma form: en Tailwind-alfamodifierare på en textfärg. Uppmätt WCAG 2.2-kontrast mot bägge temabakgrunderna i styles/globals.css: text-muted-foreground 4.73:1 ljust 7.63:1 mörkt GODKÄNT text-muted-foreground/70 2.71:1 4.20:1 faller text-muted-foreground/60 2.29:1 3.37:1 faller text-muted-foreground/50 1.96:1 2.67:1 faller text-muted-foreground/40 1.69:1 2.11:1 faller text-foreground/20 1.57:1 1.74:1 faller Den omodifierade token klarar AA i bägge teman, så åtgärden är helt enkelt att aldrig tona den. Elva textställen bytte till text-muted-foreground. Kopieringsknappen i app/portal går från 1.57:1 till 4.73:1 i viloläge och 19.79:1 vid hover — den föll även 1.4.11 för icke-textkomponenter. Toastens stängknapp klarade redan 1.4.11 (3.71:1) men blir 4.73:1. Kvar med alfa är endast den dekorativa masthead-siffran i app/bestall, som redan bär aria-hidden + select-none + pointer-events-none. Den är undantagen både av WCAG och av axe, och guarden nedan tillåter den på just den grunden. scripts/ci/check-text-contrast.mjs är en blockerande källkodsgrind i quality-jobbet. Den är avsiktligt inte en axe-körning: den fullständiga axe-jobb som UI-09 också begär kräver build + serve i CI och spåras separat. Tills det finns stoppar den här grinden regressionen vid den form som orsakade defekten. Refs: UI-09 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
137 lines
6.7 KiB
TypeScript
137 lines
6.7 KiB
TypeScript
"use client";
|
|
|
|
import Link from "next/link";
|
|
import { useRouter } from "next/navigation";
|
|
import { useEffect, useState } from "react";
|
|
import { Header } from "@/components/header";
|
|
import { OrderStepper } from "@/components/order-stepper";
|
|
import { SERVICES, DESTINATIONS_CRM, serviceById } from "@/lib/services";
|
|
import { createOrder } from "@/lib/order-client";
|
|
import { useT } from "@/components/locale-provider";
|
|
|
|
export default function DescribePage() {
|
|
const t = useT();
|
|
const PLACEHOLDER = t({
|
|
en: "E.g. \"Consolidate our admin data and push every Swedish customer with revenue and decision-makers to HubSpot\" or \"Scrape every Norwegian construction company with email\".",
|
|
sv: "T.ex. \"Konsolidera vår admindata och pusha alla svenska kunder med omsättning och beslutsfattare till HubSpot\" eller \"Skrapa alla norska bolag inom bygg med e-post\".",
|
|
});
|
|
const router = useRouter();
|
|
const [service, setService] = useState("data");
|
|
const [text, setText] = useState("");
|
|
const [destination, setDestination] = useState<string>("");
|
|
const [busy, setBusy] = useState(false);
|
|
const [rationale, setRationale] = useState("");
|
|
|
|
useEffect(() => {
|
|
const s = new URLSearchParams(window.location.search).get("service");
|
|
if (s && serviceById(s)) setService(s);
|
|
}, []);
|
|
|
|
const svc = serviceById(service);
|
|
const showDest = service === "consolidation" || service === "enrichment" || service === "icp";
|
|
|
|
async function submit() {
|
|
if (busy || !text.trim()) return;
|
|
setBusy(true);
|
|
setRationale("");
|
|
let config: Record<string, unknown> = { service_type: service, description: text, destination: destination || null };
|
|
try {
|
|
const ai = await fetch("/api/ai/parse", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ text: `${svc?.name ?? ""}. ${text}` }) });
|
|
if (ai.ok) {
|
|
const d = await ai.json();
|
|
config = { ...d.config, service_type: service, description: text, destination: destination || d.config?.destination || null };
|
|
setRationale(d.rationale ?? "");
|
|
}
|
|
} catch {}
|
|
const flow = svc?.flow === "subscription" ? "subscription" : "custom";
|
|
const id = await createOrder(flow, config);
|
|
if (id) { router.push(`/bestall/forskott?order=${encodeURIComponent(id)}`); return; }
|
|
setBusy(false);
|
|
}
|
|
|
|
return (
|
|
<main id="main-content" className="min-h-screen bg-background text-foreground">
|
|
<Header />
|
|
<OrderStepper active={1} />
|
|
<div className="mx-auto max-w-[60rem] px-6 py-16">
|
|
<p className="font-mono text-[11px] uppercase tracking-[0.16em] text-muted-foreground">{t({ en: "Tailored — Describe", sv: "Skräddarsytt — Beskriv" })}</p>
|
|
<h1 className="mt-4 max-w-[16ch] text-5xl font-medium leading-[0.95] tracking-[-0.035em] md:text-7xl">{t({ en: "Describe your need.", sv: "Beskriv behovet." })}</h1>
|
|
<p className="mt-5 max-w-[48ch] font-mono text-[12px] uppercase tracking-[0.06em] text-muted-foreground">
|
|
{t({ en: "Say it in plain words. We interpret, price, and scope it — you approve.", sv: "Säg det på svenska. Vi tolkar, prissätter, scopar — du godkänner." })}
|
|
</p>
|
|
|
|
<div className="mt-10">
|
|
<p className="font-mono text-[11px] uppercase tracking-[0.12em] text-muted-foreground">{t({ en: "Service", sv: "Tjänst" })}</p>
|
|
<div className="mt-3 flex flex-wrap gap-2">
|
|
{SERVICES.map((s) => (
|
|
<button
|
|
key={s.id}
|
|
onClick={() => setService(s.id)}
|
|
aria-pressed={service === s.id}
|
|
className="border px-3 py-2 font-mono text-[11px] uppercase tracking-[0.08em] transition-colors"
|
|
style={{
|
|
borderColor: service === s.id ? "var(--foreground)" : "var(--border)",
|
|
backgroundColor: service === s.id ? "var(--foreground)" : "transparent",
|
|
color: service === s.id ? "var(--background)" : "var(--foreground)",
|
|
}}
|
|
>
|
|
{t(s.name)}
|
|
</button>
|
|
))}
|
|
</div>
|
|
{svc ? <p className="mt-3 text-sm text-muted-foreground">{t(svc.covers)} <span className="text-muted-foreground">→ {t(svc.deliverable)}</span></p> : null}
|
|
</div>
|
|
|
|
<div className="mt-8">
|
|
<p className="font-mono text-[11px] uppercase tracking-[0.12em] text-muted-foreground">{t({ en: "Your need", sv: "Ditt behov" })}</p>
|
|
<textarea
|
|
value={text}
|
|
onChange={(e) => setText(e.target.value)}
|
|
placeholder={PLACEHOLDER}
|
|
aria-label={t({ en: "Describe your data need", sv: "Beskriv ditt databehov" })}
|
|
rows={5}
|
|
className="mt-3 w-full resize-none border border-border bg-input px-4 py-3 text-sm outline-none focus:border-foreground"
|
|
/>
|
|
</div>
|
|
|
|
{showDest ? (
|
|
<div className="mt-6">
|
|
<p className="font-mono text-[11px] uppercase tracking-[0.12em] text-muted-foreground">{t({ en: "Deliver to (CRM/ERP)", sv: "Leverera till (CRM/ERP)" })}</p>
|
|
<div className="mt-3 flex flex-wrap gap-2">
|
|
{DESTINATIONS_CRM.map((d) => (
|
|
<button
|
|
key={d}
|
|
onClick={() => setDestination(destination === d ? "" : d)}
|
|
aria-pressed={destination === d}
|
|
className="border px-3 py-2 font-mono text-[11px] uppercase tracking-[0.08em] transition-colors"
|
|
style={{
|
|
borderColor: destination === d ? "var(--accent-red)" : "var(--border)",
|
|
backgroundColor: destination === d ? "rgba(228,0,20,0.06)" : "transparent",
|
|
}}
|
|
>
|
|
{d}
|
|
</button>
|
|
))}
|
|
</div>
|
|
</div>
|
|
) : null}
|
|
|
|
{rationale ? <p className="mt-6 font-mono text-[11px] text-muted-foreground">{rationale}</p> : null}
|
|
|
|
<div className="mt-10 flex flex-wrap items-center gap-4">
|
|
<button
|
|
onClick={submit}
|
|
disabled={busy || !text.trim()}
|
|
className="bg-foreground px-6 py-3.5 font-mono text-[12px] uppercase tracking-[0.1em] text-background transition-colors hover:bg-[var(--accent-red)] disabled:opacity-50"
|
|
>
|
|
{busy ? t({ en: "Interpreting…", sv: "Tolkar…" }) : t({ en: "Get estimate →", sv: "Få estimat →" })}
|
|
</button>
|
|
<Link href="/bestall" className="font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground underline-offset-4 hover:text-foreground hover:underline">
|
|
{t({ en: "Or build it in detail", sv: "Eller bygg detaljerat" })}
|
|
</Link>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
);
|
|
}
|