diff --git a/src/app/(dashboard)/dashboard/tools/traffic-inspector/components/shared/AgentEmoji.tsx b/src/app/(dashboard)/dashboard/tools/traffic-inspector/components/shared/AgentEmoji.tsx new file mode 100644 index 0000000000..8cadbfd3b1 --- /dev/null +++ b/src/app/(dashboard)/dashboard/tools/traffic-inspector/components/shared/AgentEmoji.tsx @@ -0,0 +1,34 @@ +"use client"; + +import type { AgentId } from "@/mitm/types"; + +const AGENT_COLORS: Record = { + antigravity: { emoji: "🔵", label: "AG", color: "text-blue-400" }, + kiro: { emoji: "🟠", label: "KR", color: "text-orange-400" }, + copilot: { emoji: "🟢", label: "CP", color: "text-green-400" }, + codex: { emoji: "🟣", label: "CD", color: "text-purple-400" }, + cursor: { emoji: "🔶", label: "CU", color: "text-yellow-400" }, + zed: { emoji: "🔷", label: "ZD", color: "text-sky-400" }, + "claude-code": { emoji: "🟡", label: "CC", color: "text-yellow-300" }, + "open-code": { emoji: "⚪", label: "OC", color: "text-gray-400" }, + trae: { emoji: "⬛", label: "TR", color: "text-gray-500" }, +}; + +interface AgentEmojiProps { + agentId?: AgentId | string; + className?: string; +} + +export function AgentEmoji({ agentId, className }: AgentEmojiProps) { + if (!agentId) return 🌐; + const info = AGENT_COLORS[agentId as AgentId]; + if (!info) return 🌐; + return ( + + {info.emoji} {info.label} + + ); +} diff --git a/src/app/(dashboard)/dashboard/tools/traffic-inspector/components/shared/AnnotationField.tsx b/src/app/(dashboard)/dashboard/tools/traffic-inspector/components/shared/AnnotationField.tsx new file mode 100644 index 0000000000..6d7ddd98b9 --- /dev/null +++ b/src/app/(dashboard)/dashboard/tools/traffic-inspector/components/shared/AnnotationField.tsx @@ -0,0 +1,40 @@ +"use client"; + +import { useCallback, useState } from "react"; +import { useAnnotations } from "../../hooks/useAnnotations"; + +interface AnnotationFieldProps { + requestId: string | null; + initialValue?: string; +} + +export function AnnotationField({ requestId, initialValue = "" }: AnnotationFieldProps) { + const [value, setValue] = useState(initialValue); + const { save, saving } = useAnnotations(requestId); + + const handleChange = useCallback( + (e: React.ChangeEvent) => { + setValue(e.target.value); + save(e.target.value); + }, + [save] + ); + + return ( +
+