import { useState } from "react";
import { ChatBubble } from "@godxjp/ui/data-display";
import {
Actions,
ActionsCopy,
ActionsFeedback,
ActionsItem,
type ActionsFeedbackValueProp,
Text,
} from "@godxjp/ui/general";
import {
AppShell,
Flex,
PageContainer,
Sidebar,
type SidebarSectionProp,
Topbar,
} from "@godxjp/ui/layout";
import {
Bot,
Flag,
MessageSquare,
RefreshCw,
Settings,
Share2,
Users,
Volume2,
} from "lucide-react";
/**
* Actions — the strip of actions under an assistant message (Ant Design X `Actions`).
*
* Every card is one axis at rest. The first shows the strip where it belongs, under a real
* `ChatBubble`; the rest are the three variants, the `subItems` menu, the four `ActionsItem`
* statuses, and the two ready-made actions (`ActionsCopy`, `ActionsFeedback`).
*
* The strip is a WAI-ARIA toolbar: one Tab reaches it, the arrows move inside it. Ant X's own
* strip is a row of `
` and cannot be reached from the keyboard at all.
*
* Composed only from real @godxjp/ui components.
*/
const sections: SidebarSectionProp[] = [
{
label: "アシスタント",
items: [
{ id: "chat", label: "チャット", icon: MessageSquare },
{ id: "agents", label: "エージェント", icon: Bot },
{ id: "members", label: "メンバー", icon: Users },
],
},
{ label: "管理", items: [{ id: "settings", label: "設定", icon: Settings }] },
];
const ANSWER = "差分は3件でした。金額、支払期日、宛名のうちどれから直しますか。";
export default function ActionsDoc() {
const [vote, setVote] = useState
("default");
const [log, setLog] = useState("まだ何も押されていません。");
return (
{}}
product={{ name: "CoreDesk", role: "アシスタント", color: "hsl(var(--primary))" }}
/>
}
topbar={}
>
{/* WHERE IT BELONGS: under the answer it acts on. */}
in place · 回答の下
{ANSWER}
},
{ key: "copy", actionRender: },
{
key: "feedback",
actionRender: ,
},
{
key: "more",
label: "その他",
subItems: [
{ key: "share", label: "共有", icon: },
{ key: "report", label: "報告", icon: , danger: true },
],
},
]}
onClick={({ key, keyPath }) => setLog(`${key} — keyPath: ${keyPath.join(" ← ")}`)}
/>
{log}
{/* THE THREE VARIANTS. */}
variant · borderless · filled · outlined
},
{ key: "b", label: "共有", icon: },
]}
/>
},
{ key: "b", label: "共有", icon: },
]}
/>
},
{ key: "b", label: "共有", icon: },
]}
/>
{/* ACTIONSITEM — the four statuses, side by side. */}
ActionsItem · status
状態は字にもなる。読み上げのボタン名に「実行中」「失敗」が入るので、
アイコンの差し替えだけに頼らない。
} label="読み上げ" />
} label="読み上げ" status="running" />
} label="読み上げ" status="loading" />
} label="読み上げ" status="error" />
{/* THE TWO READY-MADE ACTIONS, alone. */}
ActionsCopy · ActionsFeedback
どちらも両方のボタンが画面に残る。押した側は aria-pressed
で示され、押していない側が消えることはない。
);
}