fix(webui): align message composer/builder (Apple-HIG)
Two alignment fixes in the 消息构建 tab: - MessageBuilder is now a bounded "compose canvas" (always bordered) so the empty hint reads as an intentional empty state inside a defined input region, instead of a stray centered line floating in the left-aligned form. - The 账号 / 目标 label rows are pinned to a fixed h-8 (== the 群聊/私聊 segmented control's height) so both labels and the selectors beneath them share a baseline — min-h-7 wasn't enough since the segmented is ~32px.
This commit is contained in:
2 files changed
+12
-5
No files matched your search
@@ -13,7 +13,6 @@ import { Picker } from '@/components/ui/picker';
|
||||
import { FaceGrid } from '@/components/ui/face-grid';
|
||||
import { FileSource } from '@/components/debug/file-source';
|
||||
import { useGroupMembers } from '@/hooks/use-debug-contacts';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
// ── segment model ──
|
||||
// `_id` is a stable React key tied to a segment's identity (so editing one field
|
||||
@@ -130,9 +129,12 @@ export function MessageBuilder({ segments, onChange, uin, groupId, depth = 0 }:
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={cn('flex flex-col gap-2', depth > 0 && 'rounded-xl border border-border/50 bg-muted/20 p-2')}>
|
||||
// A bounded "compose canvas" at every level — so the empty hint reads as an
|
||||
// intentional empty state inside a defined region rather than a stray
|
||||
// centered line floating in the left-aligned form (Apple-HIG alignment).
|
||||
<div className="flex flex-col gap-2 rounded-xl border border-border/50 bg-muted/20 p-2.5">
|
||||
{segments.length === 0 && (
|
||||
<p className="py-2 text-center text-[12px] text-muted-foreground">空消息 — 在下方添加段</p>
|
||||
<p className="py-4 text-center text-xs text-muted-foreground">空消息 — 点下方「添加段」开始</p>
|
||||
)}
|
||||
|
||||
{segments.map((s, i) => (
|
||||
|
||||
@@ -91,14 +91,19 @@ export function MessageComposer({ accounts }: { accounts: QQInfo[] }) {
|
||||
|
||||
<div className="grid gap-4 sm:grid-cols-[auto_1fr]">
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<span className="text-xs font-medium text-muted-foreground">账号</span>
|
||||
{/* Fixed h-8 == the target column's segmented-control height, so both
|
||||
label rows are exactly equal and the two selectors below share a
|
||||
baseline (min-h-7 wasn't enough — the segmented is ~32px). */}
|
||||
<div className="flex h-8 items-center">
|
||||
<span className="text-xs font-medium text-muted-foreground">账号</span>
|
||||
</div>
|
||||
<Select value={uin} onChange={(e) => setUin(e.target.value)} className="w-full sm:w-44">
|
||||
{accounts.length === 0 && <option value="">(无在线账号)</option>}
|
||||
{accounts.map((a) => <option key={a.uin} value={a.uin}>{a.nickname || a.uin}</option>)}
|
||||
</Select>
|
||||
</div>
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex h-8 items-center justify-between">
|
||||
<span className="text-xs font-medium text-muted-foreground">目标</span>
|
||||
<Segmented value={kind} onChange={(k) => { setKind(k); setTarget(''); }}
|
||||
options={[{ value: 'group', label: '群聊' }, { value: 'friend', label: '私聊' }]} />
|
||||
|
||||
Reference in new issue
Block a user