refactor(frontend): centralize agent emoji constants

This commit is contained in:
Abhimanyu Saharan
2026-03-03 00:44:34 +05:30
parent 773378c6f5
commit fe93832bdd
4 changed files with 38 additions and 42 deletions

View File

@@ -31,6 +31,7 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { AGENT_EMOJI_OPTIONS } from "@/lib/agent-emoji";
import { DEFAULT_IDENTITY_PROFILE } from "@/lib/agent-templates";
type IdentityProfile = {
@@ -39,19 +40,6 @@ type IdentityProfile = {
emoji: string;
};
const EMOJI_OPTIONS = [
{ value: ":gear:", label: "Gear", glyph: "⚙️" },
{ value: ":sparkles:", label: "Sparkles", glyph: "✨" },
{ value: ":rocket:", label: "Rocket", glyph: "🚀" },
{ value: ":megaphone:", label: "Megaphone", glyph: "📣" },
{ value: ":chart_with_upwards_trend:", label: "Growth", glyph: "📈" },
{ value: ":bulb:", label: "Idea", glyph: "💡" },
{ value: ":wrench:", label: "Builder", glyph: "🔧" },
{ value: ":shield:", label: "Shield", glyph: "🛡️" },
{ value: ":memo:", label: "Notes", glyph: "📝" },
{ value: ":brain:", label: "Brain", glyph: "🧠" },
];
const getBoardOptions = (boards: BoardRead[]): SearchableSelectOption[] =>
boards.map((board) => ({
value: board.id,
@@ -379,7 +367,7 @@ export default function EditAgentPage() {
<SelectValue placeholder="Select emoji" />
</SelectTrigger>
<SelectContent>
{EMOJI_OPTIONS.map((option) => (
{AGENT_EMOJI_OPTIONS.map((option) => (
<SelectItem key={option.value} value={option.value}>
{option.glyph} {option.label}
</SelectItem>

View File

@@ -28,6 +28,7 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { AGENT_EMOJI_OPTIONS } from "@/lib/agent-emoji";
import { DEFAULT_IDENTITY_PROFILE } from "@/lib/agent-templates";
type IdentityProfile = {
@@ -36,19 +37,6 @@ type IdentityProfile = {
emoji: string;
};
const EMOJI_OPTIONS = [
{ value: ":gear:", label: "Gear", glyph: "⚙️" },
{ value: ":sparkles:", label: "Sparkles", glyph: "✨" },
{ value: ":rocket:", label: "Rocket", glyph: "🚀" },
{ value: ":megaphone:", label: "Megaphone", glyph: "📣" },
{ value: ":chart_with_upwards_trend:", label: "Growth", glyph: "📈" },
{ value: ":bulb:", label: "Idea", glyph: "💡" },
{ value: ":wrench:", label: "Builder", glyph: "🔧" },
{ value: ":shield:", label: "Shield", glyph: "🛡️" },
{ value: ":memo:", label: "Notes", glyph: "📝" },
{ value: ":brain:", label: "Brain", glyph: "🧠" },
];
const getBoardOptions = (boards: BoardRead[]): SearchableSelectOption[] =>
boards.map((board) => ({
value: board.id,
@@ -232,7 +220,7 @@ export default function NewAgentPage() {
<SelectValue placeholder="Select emoji" />
</SelectTrigger>
<SelectContent>
{EMOJI_OPTIONS.map((option) => (
{AGENT_EMOJI_OPTIONS.map((option) => (
<SelectItem key={option.value} value={option.value}>
{option.glyph} {option.label}
</SelectItem>

View File

@@ -119,6 +119,7 @@ import {
resolveHumanActorName,
resolveMemberDisplayName,
} from "@/lib/display-name";
import { AGENT_EMOJI_GLYPHS } from "@/lib/agent-emoji";
import { cn } from "@/lib/utils";
import { usePageActive } from "@/hooks/usePageActive";
import {
@@ -519,19 +520,6 @@ const statusOptions = [
{ value: "done", label: "Done" },
];
const EMOJI_GLYPHS: Record<string, string> = {
":gear:": "⚙️",
":sparkles:": "✨",
":rocket:": "🚀",
":megaphone:": "📣",
":chart_with_upwards_trend:": "📈",
":bulb:": "💡",
":wrench:": "🔧",
":shield:": "🛡️",
":memo:": "📝",
":brain:": "🧠",
};
const SSE_RECONNECT_BACKOFF = {
baseMs: 1_000,
factor: 2,
@@ -2782,7 +2770,7 @@ export default function BoardDetailPage() {
if (!value) return null;
const trimmed = value.trim();
if (!trimmed) return null;
if (EMOJI_GLYPHS[trimmed]) return EMOJI_GLYPHS[trimmed];
if (AGENT_EMOJI_GLYPHS[trimmed]) return AGENT_EMOJI_GLYPHS[trimmed];
if (trimmed.startsWith(":") && trimmed.endsWith(":")) return null;
return trimmed;
};

View File

@@ -0,0 +1,32 @@
export type AgentEmojiOption = {
value: string;
label: string;
glyph: string;
};
export const AGENT_EMOJI_OPTIONS: readonly AgentEmojiOption[] = [
{ value: ":gear:", label: "Gear", glyph: "⚙️" },
{ value: ":alarm_clock:", label: "Alarm Clock", glyph: "⏰" },
{ value: ":art:", label: "Art", glyph: "🎨" },
{ value: ":brain:", label: "Brain", glyph: "🧠" },
{ value: ":wrench:", label: "Builder", glyph: "🔧" },
{ value: ":dart:", label: "Bullseye", glyph: "🎯" },
{ value: ":computer:", label: "Computer", glyph: "💻" },
{ value: ":chart_with_upwards_trend:", label: "Growth", glyph: "📈" },
{ value: ":bulb:", label: "Idea", glyph: "💡" },
{ value: ":zap:", label: "Lightning", glyph: "⚡" },
{ value: ":lock:", label: "Lock", glyph: "🔒" },
{ value: ":mailbox:", label: "Mailbox", glyph: "📬" },
{ value: ":megaphone:", label: "Megaphone", glyph: "📣" },
{ value: ":memo:", label: "Notes", glyph: "📝" },
{ value: ":owl:", label: "Owl", glyph: "🦉" },
{ value: ":robot:", label: "Robot", glyph: "🤖" },
{ value: ":rocket:", label: "Rocket", glyph: "🚀" },
{ value: ":mag:", label: "Search", glyph: "🔍" },
{ value: ":shield:", label: "Shield", glyph: "🛡️" },
{ value: ":sparkles:", label: "Sparkles", glyph: "✨" },
];
export const AGENT_EMOJI_GLYPHS: Record<string, string> = Object.fromEntries(
AGENT_EMOJI_OPTIONS.map(({ value, glyph }) => [value, glyph]),
);