A bot's identity was one of seven hues, and the hue picked both its colour and its stone shape. Now its colour is free and its stone is its own: - `bots.color` holds any `#rrggbb`, `bots.stone` the flat-cut shape it's drawn on. `bots.hue` stays as the palette column they replaced, read only as a fallback; `src/scripts/move-bot-colour-to-owners.ts` backfills an install from it (safe to rerun). - `src/utils/bot-color.ts` is the only place a colour is validated or resolved (`resolveBotColor`/`resolveBotStone` carry the old hue forward, `botColorNeedsPaperFace` flips the eyes to paper on a very dark body), and `src/utils/bot-stone-props.ts` gives every row its props, so a row saved before this still renders as it did. - `BotStone` takes the colour as the body's SVG `fill`, the one documented exception to the token rule: an arbitrary hex has no token to point at. `UnreadDot` follows it. - The picker keeps the palette tiles (still shape and colour together) and adds a native swatch and a hex field, so a custom colour keeps its stone. Same place as before: the header avatar's modal and Settings > Bots, for crew managers. The coordinator stays hue-less. - A recolour reaches other open tabs through `pushBotUpdated`.
48 lines
1.8 KiB
TypeScript
48 lines
1.8 KiB
TypeScript
import Button from "@moduletrace/twui/layout/Button";
|
|
import Row from "@moduletrace/twui/layout/Row";
|
|
import Span from "@moduletrace/twui/layout/Span";
|
|
import Stack from "@moduletrace/twui/layout/Stack";
|
|
import BotAvatar from "@/src/components/general/bot-avatar";
|
|
import type { BotFace } from "@/src/dict/bot-dict";
|
|
import botStoneProps from "@/src/utils/bot-stone-props";
|
|
import type { BotWithLastMessage } from "@/src/types";
|
|
|
|
type Props = {
|
|
bot: BotWithLastMessage;
|
|
linking?: boolean;
|
|
disabled?: boolean;
|
|
onLink: () => void;
|
|
};
|
|
|
|
/**
|
|
* One bot in the link-bots modal: stone, name, job, and Add.
|
|
*/
|
|
export default function LinkBotRow({ bot, linking, disabled, onLink }: Props) {
|
|
return (
|
|
<Row className="h-14 items-center gap-3 rounded-default px-3 flex-nowrap hover:bg-sunken transition-colors duration-[var(--m-fast)]">
|
|
<BotAvatar
|
|
image_media_id={bot.image_media_id}
|
|
{...botStoneProps({ color: bot.color, stone: bot.stone, hue: bot.hue })}
|
|
face={(bot.face || "idle") as BotFace}
|
|
/>
|
|
<Stack className="grow min-w-0 gap-0!">
|
|
<Span className="text-sm font-bold leading-5 text-ink truncate w-full">{bot.name}</Span>
|
|
<Span className="text-xs leading-4 text-ink-secondary truncate w-full">{bot.role || ""}</Span>
|
|
</Stack>
|
|
<Button
|
|
title={`Add ${bot.name || "this bot"}`}
|
|
type="button"
|
|
variant="ghost"
|
|
color="gray"
|
|
size="small"
|
|
loading={linking}
|
|
disabled={disabled}
|
|
onClick={onLink}
|
|
className="shrink-0"
|
|
>
|
|
Add
|
|
</Button>
|
|
</Row>
|
|
);
|
|
}
|