Download this file
| 1 | import SwiftUI |
| 2 | |
| 3 | // đŸ¤– The web's agentTag chip (shell.js): "AI" for an LLM-backed helper, "BOT" |
| 4 | // for a deterministic one, and natively also "APP" beside mini-app threads. |
| 5 | // muted = the quiet list variant; solid = the accent-filled picker variant. |
| 6 | public struct AgentBadge: View { |
| 7 | public let text: String |
| 8 | public var muted = true |
| 9 | |
| 10 | public init(_ text: String, muted: Bool = true) { |
| 11 | self.text = text |
| 12 | self.muted = muted |
| 13 | } |
| 14 | |
| 15 | public var body: some View { |
| 16 | Text(text) |
| 17 | .font(.system(size: 9, weight: .semibold)) |
| 18 | .kerning(0.3) |
| 19 | .padding(.horizontal, 5) |
| 20 | .padding(.vertical, 2) |
| 21 | .background(RoundedRectangle(cornerRadius: 6, style: .continuous) |
| 22 | .fill(muted ? AnyShapeStyle(.primary.opacity(0.08)) : AnyShapeStyle(.tint))) |
| 23 | .foregroundStyle(muted ? AnyShapeStyle(.secondary) : AnyShapeStyle(.white)) |
| 24 | } |
| 25 | } |
| 26 | |