fix(webui): refine mobile actions and avoid duplicate settings loads

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-24 23:32:22 +08:00
1 parent f8d655d612
commit c370e2a5a5
6 files changed
+50 -8

No files matched your search

+3 -2
View File
@@ -249,7 +249,7 @@ export function MessageBlockMenuActions({
"text-start text-[11px] leading-4",
"text-muted-foreground transition-colors hover:text-foreground",
"focus-visible:outline-none",
sheet && "w-full rounded-control text-sm hover:bg-muted/70",
sheet && "w-full gap-2 rounded-control px-2 text-sm hover:bg-muted/70",
)}
>
<span
@@ -260,6 +260,7 @@ export function MessageBlockMenuActions({
"group-hover:bg-muted/70 group-active:scale-[0.96]",
"group-focus-visible:ring-2 group-focus-visible:ring-ring",
"motion-reduce:transform-none",
sheet && "w-3.5",
)}
>
<Activity className="h-3.5 w-3.5" strokeWidth={1.5} aria-hidden />
@@ -281,7 +282,7 @@ export function MessageBlockMenuActions({
{timestampLabel || automationSourceLabel ? (
<div
data-message-block-metadata
className={cn("mt-0.5 w-full border-t border-border/45 px-1.5 pt-1 leading-4", sheet ? "text-xs text-muted-foreground" : "text-[10px] text-muted-foreground/45")}
className={cn("mt-0.5 w-full border-t border-border/45 px-1.5 pt-1 leading-4", sheet ? "px-2 text-xs text-muted-foreground" : "text-[10px] text-muted-foreground/45")}
>
{timestampLabel ? (
<time
@@ -432,12 +432,12 @@ function MessageBlockMenu({
onViewLinks={links.length > 0 ? () => setLinksShown(true) : undefined}
/>;
if (mobileActions) {
return <div data-message-mobile-actions className={cn("mt-1 flex items-center gap-0.5", message.role === "user" && "justify-end")}>
<MessageCopyButton message={message} className="h-11 w-11" />
return <div data-message-mobile-actions className={cn("mt-1 flex items-center", message.role === "user" ? "me-2 justify-end" : "-ms-2")}>
<MessageCopyButton message={message} className="h-11 w-8 [&_svg]:h-4 [&_svg]:w-4" />
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogTrigger asChild>
<button ref={triggerRef} type="button" data-message-block-menu-trigger aria-label={label}
className="inline-flex h-11 w-11 items-center justify-center rounded-control text-muted-foreground transition-colors hover:bg-muted/70 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
className="inline-flex h-11 w-8 items-center justify-center rounded-control text-muted-foreground transition-colors hover:bg-muted/70 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
<MoreHorizontal className="h-4 w-4" strokeWidth={1.75} aria-hidden />
</button>
</DialogTrigger>
+4 -2
View File
@@ -447,6 +447,7 @@ interface ThreadShellProps {
workspaceError?: string | null;
onWorkspaceScopeChange?: (scope: WorkspaceScopePayload) => void;
settingsSnapshot?: SettingsPayload | null;
settingsLoading?: boolean;
onOpenModelSettings?: () => void;
skills?: SkillSummary[];
}
@@ -657,6 +658,7 @@ export function ThreadShell({
workspaceError = null,
onWorkspaceScopeChange,
settingsSnapshot = null,
settingsLoading = false,
onOpenModelSettings,
skills = [],
}: ThreadShellProps) {
@@ -1094,8 +1096,8 @@ export function ThreadShell({
setSettings(settingsSnapshot);
return;
}
void refreshModelSettings();
}, [refreshModelSettings, settingsSnapshot]);
if (!settingsLoading) void refreshModelSettings();
}, [refreshModelSettings, settingsLoading, settingsSnapshot]);
useEffect(() => {
return client.onRuntimeModelUpdate(() => {
@@ -312,6 +312,7 @@ export function WorkspaceAccessMenu({
onChange?: (scope: WorkspaceScopePayload) => void;
}) {
const { t } = useTranslation();
const dismissedByPointerRef = useRef(false);
const mode = scope.access_mode;
const isFull = mode === "full";
const accessLabel = t(
@@ -358,7 +359,15 @@ export function WorkspaceAccessMenu({
<ChevronDown className={cn("thread-composer-access-chevron ml-1.5 shrink-0", isHero ? "h-3 w-3" : "h-3 w-3")} />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="start" className="w-56">
<DropdownMenuContent
align="start"
className="w-56"
onPointerDownOutside={() => { dismissedByPointerRef.current = true; }}
onCloseAutoFocus={(event) => {
if (dismissedByPointerRef.current) event.preventDefault();
dismissedByPointerRef.current = false;
}}
>
<AccessMenuItem
icon={<Hand className="h-4 w-4" />}
label={t("thread.composer.workspace.default")}