import { useState } from "react"; import { useTranslation } from "react-i18next"; import { Icon, type IconName } from "./Icons"; import "../styles-architecture-flow.css"; type ArchitectureStepId = "Frontend" | "Api" | "Database" | "Outbox" | "External"; type ArchitectureZone = "intent" | "transaction" | "edge"; const ARCHITECTURE_STEPS: Array<{ id: ArchitectureStepId; icon: IconName; zone: ArchitectureZone; }> = [ { id: "Frontend", icon: "user", zone: "intent" }, { id: "Api", icon: "shield", zone: "transaction" }, { id: "Database", icon: "audit", zone: "transaction" }, { id: "Outbox", icon: "activity", zone: "transaction" }, { id: "External", icon: "integrations", zone: "edge" }, ]; const ZONE_TRANSLATION_KEYS: Record = { intent: "architectureZoneIntent", transaction: "architectureZoneTransaction", edge: "architectureZoneEdge", }; export function ArchitectureFlow() { const { t } = useTranslation("demo"); const [activeStepId, setActiveStepId] = useState("Database"); const activeIndex = ARCHITECTURE_STEPS.findIndex((step) => step.id === activeStepId); const activeStep = ARCHITECTURE_STEPS[activeIndex]; return (
{t("about.architectureZoneIntent")} {t("about.architectureZoneTransaction")} {t("about.architectureZoneEdge")}
    {ARCHITECTURE_STEPS.map((step, index) => { const isActive = step.id === activeStepId; const isCommitBoundary = step.id === "Outbox"; return (
  1. {index < ARCHITECTURE_STEPS.length - 1 ? (
  2. ); })}

{t("about.architectureInteractionHint")}

{t("about.architectureSelectedStep", { current: activeIndex + 1, total: ARCHITECTURE_STEPS.length })}

{t(`about.architecture${activeStep.id}`)}

{t(`about.architectureDetails.${activeStep.id}.body`)}

{t("about.architectureBoundaryLabel")}
{t(`about.${ZONE_TRANSLATION_KEYS[activeStep.zone]}`)}
{t("about.architectureEvidenceLabel")}
{t(`about.architectureDetails.${activeStep.id}.proofOne`)} {t(`about.architectureDetails.${activeStep.id}.proofTwo`)}
); }