composer/settings: use ActionButton iconOnly send; replace deprecated navigator.platform with lib/platform (P1-9, P2-46)

This commit is contained in:
ZacharyZhang-NY committed 2026-04-16 23:02:29 -04:00
1 parent b0b0cfa35b
commit 296c72eb3f
3 files changed
+26 -7

No files matched your search

@@ -3,17 +3,24 @@ import { AnimatePresence, motion } from "framer-motion"
import { ArrowBendUpLeft, PaperPlaneTilt, X, ChatCircle, UserCircle, Paperclip, FileText } from "@phosphor-icons/react"
import type { AgentMessageRecord, AgentRecord, DocumentRecord, MessageChannel } from "@shared/types"
import { unwrap } from "../../lib/desktop"
import { cmdOrCtrlLabel } from "../../lib/platform"
import { useAppStore } from "../../state/store"
import { InlineNotice } from "../ui"
import { ActionButton, InlineNotice } from "../ui"
import { useT } from "../../i18n"
const HUMAN_SENDER_ID = "__board__";
function SendButton({ sending, disabled, onClick, label }: { sending: boolean; disabled: boolean; onClick: () => void; label: string }) {
return (
<button type="button" onClick={onClick} disabled={disabled || sending} className="flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-primary text-primary-foreground transition hover:brightness-90 active:translate-y-px disabled:opacity-40 disabled:pointer-events-none" aria-label={label}>
{sending ? <svg className="h-4 w-4 animate-spin" viewBox="0 0 16 16" fill="none"><circle cx="8" cy="8" r="6" stroke="currentColor" strokeWidth="2" opacity="0.3" /><path d="M14 8a6 6 0 0 0-6-6" stroke="currentColor" strokeWidth="2" strokeLinecap="round" /></svg> : <PaperPlaneTilt size={18} weight="fill" />}
</button>
<ActionButton
label={label}
icon={PaperPlaneTilt}
tone="accent"
iconOnly
loading={sending}
disabled={disabled}
onClick={onClick}
/>
)
}
@@ -320,7 +327,7 @@ export function MessageComposer({ agents, companyId, channel, channelTargetId, d
/>
)}
<div className="mt-1 text-[11px] text-muted-foreground">Press {navigator.platform.includes("Mac") ? "Cmd" : "Ctrl"}+Enter to send</div>
<div className="mt-1 text-[11px] text-muted-foreground">Press {cmdOrCtrlLabel()}+Enter to send</div>
</div>
)
}
@@ -6,6 +6,7 @@ import { APP_LOCALES, LOCALE_LABELS } from "@shared/locale"
import { useLocale, useT } from "../../i18n"
import { formatTime } from "../../lib/formatters"
import { unwrap } from "../../lib/desktop"
import { isMac } from "../../lib/platform"
import { ActionButton, ConfirmDialog, EmptyState, InlineNotice, Select } from "../ui"
import { describeActionError } from "./execution-utils"
import { useAppStore } from "../../state/store"
@@ -50,8 +51,8 @@ export function SettingsPane({ snapshot, secrets, companyId, onSaved }: { snapsh
<div><div className="mb-3 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground">Keyboard Shortcuts</div>
<div className="space-y-1 border-y border-border py-3">
{([
[navigator.platform.includes("Mac") ? "⌘K" : "Ctrl+K", "Open command palette"],
[navigator.platform.includes("Mac") ? "⌘Enter" : "Ctrl+Enter", "Send message"],
[isMac() ? "⌘K" : "Ctrl+K", "Open command palette"],
[isMac() ? "⌘Enter" : "Ctrl+Enter", "Send message"],
["Escape", "Close modal / palette"],
["↑ / ↓", "Navigate palette results"],
["Enter", "Select palette result"],
+11
View File
@@ -0,0 +1,11 @@
export function isMac(): boolean {
return window.agentCompany.platform === "darwin";
}
export function cmdOrCtrlLabel(): string {
return isMac() ? "Cmd" : "Ctrl";
}
export function cmdOrCtrlSymbol(): string {
return isMac() ? "⌘" : "Ctrl+";
}