feat(web): configurable browser defaults in Settings → Integrations #7082
Mergedjuliusmarmingemerged 8 commits into
main fromrefs/pull/7082/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- apps/web/src/components/settings/IntegrationsSettings.tsx lines 176 to 182OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +162,21 @@162+163+ return (164+ <SettingsRow165+ {...searchableSetting("browser-default-viewport")}166+ description="The viewport a browser tab opens at, for both you and agents. Fill sizes the page to the panel; any other choice opens the device toolbar at that size."167+ resetAction={168+ !disabled && viewport._tag !== DEFAULT_BROWSER_VIEWPORT._tag ? (169+ <SettingResetButton170+ label="default browser viewport"171+ onClick={() => updateSettings({ browserDefaultViewport: DEFAULT_BROWSER_VIEWPORT })}172+ />173+ ) : null174+ }175+ control={176+ <div className="flex w-full items-center gap-2 sm:w-auto">177+ <Select178+ value={viewportSelectValue(viewport)}179+ onValueChange={selectViewport}180+ disabled={disabled}181+ >182+ <SelectTrigger className="w-full sm:w-44" aria-label="Default browser viewport">
- apps/web/src/components/preview/PreviewAutomationHosts.tsx line 435Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -428,4 +432,4 @@428432 updatePreviewServerSnapshot(threadRef, resizeResult.value);429433 }430434 }431- const shouldPresentPreview = shouldOpenPreviewMiniPlayer(input);435+ const shouldPresentPreview = shouldOpenPreviewMiniPlayer(@@ -0,0 +27,21 @@27+ readonly viewport: PreviewViewportSetting;28+ readonly zoomFactor: number;29+ readonly appearance: PreviewAppearancePreference;30+ readonly autoShowFloatingPreview: boolean;31+}32+33+const toBrowserDefaults = (settings: {34+ readonly browserDefaultViewport: PreviewViewportSetting;35+ readonly browserDefaultZoomFactor: number;36+ readonly browserDefaultAppearance: PreviewAppearancePreference;37+ readonly browserAutoShowFloatingPreview: boolean;38+}): BrowserDefaults => ({39+ viewport: settings.browserDefaultViewport,40+ zoomFactor: settings.browserDefaultZoomFactor,41+ appearance: settings.browserDefaultAppearance,42+ autoShowFloatingPreview: settings.browserAutoShowFloatingPreview,43+});44+45+/** Non-hook accessor for imperative open paths (menu actions, automation hosts). */46+export function getBrowserDefaults(): BrowserDefaults {47+ return toBrowserDefaults(getClientSettings());
- apps/web/src/components/settings/IntegrationsSettings.tsx line 404OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +384,21 @@384+ * Frames the client-local preview defaults as one unavailable block.385+ *386+ * Disabling each control on its own left the labels and descriptions at full387+ * strength, so the group still read as editable. Boxing it puts the reason at388+ * the top and dims everything it covers, which is also why the explanation389+ * sits outside the dimmed area — the one part that must stay readable is the390+ * part saying why the rest isn't.391+ *392+ * Disabled rather than hidden because these are *client* settings: editing393+ * them from a browser tab would write preferences belonging to a different394+ * client, reading as though the desktop app had been configured when it395+ * hadn't.396+ */397+function DesktopOnlyBrowserDefaults({ children }: { readonly children: ReactNode }) {398+ return (399+ <div className="rounded-xl border border-border/60 bg-muted/20 py-1.5">400+ <div className="flex items-start gap-2 px-3 py-2 text-[12px] leading-relaxed text-muted-foreground sm:px-4">401+ <InfoIcon className="mt-0.5 size-3.5 shrink-0 text-warning" />402+ <p>Only available in the desktop app.</p>403+ </div>404+ <div className="opacity-64">{children}</div>apps/web/src/components/settings/IntegrationsSettings.tsx line 205OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +185,21 @@185+ <SelectPopup align="end" alignItemWithTrigger={false} className="min-w-64">186+ <SelectItem value={FILL_VALUE}>Fill panel</SelectItem>187+ <SelectItem value={RESPONSIVE_VALUE}>Responsive</SelectItem>188+ <SelectGroup>189+ <SelectGroupLabel>Standard</SelectGroupLabel>190+ {PREVIEW_VIEWPORT_PRESETS.map((preset) => (191+ <SelectItem key={preset.id} value={preset.id}>192+ <span className="flex w-full items-center justify-between gap-5">193+ <span>{preset.label}</span>194+ <span className="text-xs tabular-nums text-muted-foreground">195+ {preset.detail}196+ </span>197+ </span>198+ </SelectItem>199+ ))}200+ </SelectGroup>201+ </SelectPopup>202+ </Select>203+204+ {sized ? (205+ <div className="flex shrink-0 items-center gap-1">
- packages/contracts/src/settings.ts line 149Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -114 +129,21 @@129+export const DEFAULT_BROWSER_AUTO_SHOW_FLOATING_PREVIEW = true;130+114131 export const ClientSettingsSchema = Schema.Struct({132+ browserDefaultViewport: PreviewViewportSetting.pipe(133+ Schema.withDecodingDefault(Effect.succeed(DEFAULT_BROWSER_VIEWPORT)),134+ ),135+ browserDefaultZoomFactor: PreviewZoomFactor.pipe(136+ Schema.withDecodingDefault(Effect.succeed(DEFAULT_PREVIEW_ZOOM_FACTOR)),137+ ),138+ browserDefaultAppearance: PreviewAppearancePreference.pipe(139+ Schema.withDecodingDefault(Effect.succeed(DEFAULT_PREVIEW_APPEARANCE)),140+ ),141+ /**142+ * Whether an agent opening a preview pops the floating mini player into143+ * view. Only applies when the agent didn't ask either way — an explicit144+ * `open`/`show` on `preview_open` still wins, since that is the agent145+ * deliberately showing or hiding its work.146+ */147+ browserAutoShowFloatingPreview: Schema.Boolean.pipe(148+ Schema.withDecodingDefault(Effect.succeed(DEFAULT_BROWSER_AUTO_SHOW_FLOATING_PREVIEW)),149+ ),
github-actions[bot](GitHub profile, opens in a new tab) added labels📱 Native Change
- @@ -658,3 +664,4 @@658664 fontSizePrompt: DEFAULT_UNIFIED_SETTINGS.fontSizePrompt,659665 fontSizeCode: DEFAULT_UNIFIED_SETTINGS.fontSizeCode,660666 fontSizeTerminal: DEFAULT_UNIFIED_SETTINGS.fontSizeTerminal,667+ browserDefaultViewport: DEFAULT_UNIFIED_SETTINGS.browserDefaultViewport,
juliusmarminge merged this949feb6
juliusmarminge closed this
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
527f8926-ffd2-424c-a26f-9e42bbb43f03You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Comment `@coderabbitai help` to get the list of available commands.