style(webui): refine shared surface depth
Add theme-neutral media keylines and layered card shadows so avatars, previews, pickers, and shared cards remain separated without relying on hard borders. Keep the message composer radius hierarchy concentric across appearance settings and remove redundant nested canvas surfaces from forwarded-message editors. This changes visual presentation only; message composition behavior and emitted payloads remain unchanged.
This commit is contained in:
6 files changed
+60
-13
No files matched your search
@@ -128,11 +128,29 @@ export function MessageBuilder({ segments, onChange, uin, groupId, depth = 0 }:
|
||||
onChange(next);
|
||||
};
|
||||
|
||||
// Keep the top-level canvas concentric with its rows at any operator-selected
|
||||
// corner radius. At the default 12px radius this is 20px → 12px over the 8px
|
||||
// inset. Nested forward builders deliberately avoid another canvas surface:
|
||||
// cards-inside-cards add visual noise and cannot remain concentric with a
|
||||
// parent row once the operator selects a compact radius.
|
||||
const nested = depth > 0;
|
||||
const canvasRadius = 'calc(var(--radius) + 0.5rem)';
|
||||
const rowRadius = depth === 0
|
||||
? 'var(--radius)'
|
||||
: depth === 1
|
||||
? 'max(0px, calc(var(--radius) - 0.25rem))'
|
||||
: 'max(0px, calc(var(--radius) - 0.5rem))';
|
||||
|
||||
return (
|
||||
// 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">
|
||||
// The root is a bounded compose canvas, so its empty hint reads as an
|
||||
// intentional empty state rather than a stray line. Nested builders inherit
|
||||
// the surrounding node surface instead of drawing another card within it.
|
||||
<div
|
||||
className={nested
|
||||
? 'flex flex-col gap-2'
|
||||
: 'flex flex-col gap-2 border border-border/50 bg-muted/20 p-2'}
|
||||
style={nested ? undefined : { borderRadius: canvasRadius }}
|
||||
>
|
||||
{segments.length === 0 && (
|
||||
<p className="py-4 text-center text-xs text-muted-foreground">空消息 — 点下方「添加段」开始</p>
|
||||
)}
|
||||
@@ -142,7 +160,8 @@ export function MessageBuilder({ segments, onChange, uin, groupId, depth = 0 }:
|
||||
key={s._id}
|
||||
onDragOver={(e) => e.preventDefault()}
|
||||
onDrop={(e) => { e.stopPropagation(); if (dragFrom !== null) move(dragFrom, i); setDragFrom(null); }}
|
||||
className="rounded-xl border border-border/50 bg-card/60 p-2"
|
||||
className="border border-border/50 bg-card/60 p-2"
|
||||
style={{ borderRadius: rowRadius }}
|
||||
>
|
||||
{/* Drag is scoped to the grip handle only — making the whole row
|
||||
draggable hijacked text selection inside the segment inputs (you
|
||||
@@ -184,7 +203,7 @@ export function MessageBuilder({ segments, onChange, uin, groupId, depth = 0 }:
|
||||
<div className="grid grid-cols-4 gap-1">
|
||||
{COMMON.map((c) => (
|
||||
<button key={c.k} type="button" onClick={() => add(c.k)}
|
||||
className="flex flex-col items-center gap-1 rounded-lg p-2 text-xs text-muted-foreground hover:bg-accent hover:text-foreground">
|
||||
className="flex flex-col items-center gap-1 rounded-sm p-2 text-xs text-muted-foreground hover:bg-accent hover:text-foreground">
|
||||
{c.icon}{c.label}
|
||||
</button>
|
||||
))}
|
||||
@@ -194,7 +213,7 @@ export function MessageBuilder({ segments, onChange, uin, groupId, depth = 0 }:
|
||||
<div className="mt-1 grid grid-cols-4 gap-1">
|
||||
{ADVANCED.map((c) => (
|
||||
<button key={c.k} type="button" onClick={() => add(c.k)}
|
||||
className="flex flex-col items-center gap-1 rounded-lg p-2 text-xs text-muted-foreground hover:bg-accent hover:text-foreground">
|
||||
className="flex flex-col items-center gap-1 rounded-sm p-2 text-xs text-muted-foreground hover:bg-accent hover:text-foreground">
|
||||
{c.icon}{c.label}
|
||||
</button>
|
||||
))}
|
||||
|
||||
@@ -9,7 +9,7 @@ const Avatar = React.forwardRef<HTMLDivElement, AvatarProps>(
|
||||
({ className, size = 36, style, ...props }, ref) => (
|
||||
<div
|
||||
ref={ref}
|
||||
className={cn('relative inline-flex shrink-0 overflow-hidden rounded-full bg-muted', className)}
|
||||
className={cn('media-outline relative inline-flex shrink-0 overflow-hidden rounded-full bg-muted', className)}
|
||||
style={{ width: size, height: size, ...style }}
|
||||
{...props}
|
||||
/>
|
||||
|
||||
@@ -5,7 +5,7 @@ const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElemen
|
||||
({ className, ...props }, ref) => (
|
||||
<div
|
||||
ref={ref}
|
||||
className={cn('rounded-xl border bg-card text-card-foreground shadow-sm', className)}
|
||||
className={cn('ui-card rounded-xl border border-border/60 bg-card text-card-foreground', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -39,7 +39,7 @@ function Leaf({ value }: { value: string | number | boolean | null }) {
|
||||
</button>
|
||||
{showImg && (
|
||||
<span className="mt-1.5 block">
|
||||
<img src={value} alt="预览" className="max-h-48 rounded-lg border border-border/60" loading="lazy" />
|
||||
<img src={value} alt="预览" className="media-outline max-h-48 rounded-lg" loading="lazy" />
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -138,7 +138,7 @@ export function Picker({
|
||||
!selected && !value && 'text-muted-foreground',
|
||||
)}
|
||||
>
|
||||
{selected?.avatar && <img src={selected.avatar} alt="" className="h-5 w-5 shrink-0 rounded-full" />}
|
||||
{selected?.avatar && <img src={selected.avatar} alt="" className="media-outline h-5 w-5 shrink-0 rounded-full" />}
|
||||
<span className="min-w-0 flex-1 truncate text-left">
|
||||
{selected ? selected.label : value || placeholder}
|
||||
{selected?.sub && <span className="ml-1.5 text-xs text-muted-foreground tabular-nums">{selected.sub}</span>}
|
||||
@@ -217,8 +217,8 @@ export function Picker({
|
||||
{opt ? (
|
||||
<>
|
||||
{opt.avatar
|
||||
? <img src={opt.avatar} alt="" className="h-7 w-7 shrink-0 rounded-full" />
|
||||
: <span className="h-7 w-7 shrink-0 rounded-full bg-muted" />}
|
||||
? <img src={opt.avatar} alt="" className="media-outline h-7 w-7 shrink-0 rounded-full" />
|
||||
: <span className="media-outline h-7 w-7 shrink-0 rounded-full bg-muted" />}
|
||||
<span className="min-w-0 flex-1 truncate text-sm">{opt.label}</span>
|
||||
{opt.sub && <span className="shrink-0 font-mono text-meta text-muted-foreground tabular-nums">{opt.sub}</span>}
|
||||
</>
|
||||
|
||||
Reference in new issue
Block a user