Update frontend UI/UX

This commit is contained in:
2026-10-20 04:59:08 +01:00
parent 59f5acb7bc
commit e2093b0df6
17 changed files with 163 additions and 11 deletions
@@ -0,0 +1,48 @@
import { useContext } from "react";
import Link from "@moduletrace/twui/layout/Link";
import Span from "@moduletrace/twui/layout/Span";
import BotAvatar from "@/src/components/general/bot-avatar";
import type { BotFace, BotHue } from "@/src/dict/bot-dict";
import { AppContext } from "@/src/pages/__root";
import { CrewBotsContext } from "../(data)/crew-bots-context";
type Props = {
bot_id: number;
};
/**
* A crew member a bot named in a message (`botRef`): a link to its
* conversation, in the open workspace when it's in the crew there, else
* its own chat. A bot the user doesn't reach is shown by name only.
*/
export default function BotRefChip({ bot_id }: Props) {
const { pageProps } = useContext(AppContext);
const workspace_id = pageProps?.workspace?.id;
const bots = useContext(CrewBotsContext);
const bot = bots.find((b) => b.id == bot_id);
if (!bot) {
return <Span className="font-bold">{`bot ${bot_id}`}</Span>;
}
return (
<Link
href={
workspace_id
? `/admin/workspaces/${workspace_id}/bots/${bot.id}`
: `/admin/bots/${bot.id}`
}
title={`Open ${bot.name}`}
className="inline-flex h-6 gap-1.5 items-center px-1.5 align-middle rounded-default-xs border-0 bg-sunken text-[13px] font-bold leading-4 text-ink whitespace-nowrap hover:opacity-80"
>
<BotAvatar
image_media_id={bot.image_media_id}
hue={(bot.hue || null) as BotHue | null}
face={(bot.face || "idle") as BotFace}
label={bot.name || ""}
size={18}
/>
{bot.name}
</Link>
);
}