Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(settings): propper settings view on mobile (#2790)
Fake-Userc4d1938562ce
diff --git a/js/app/packages/app/component/settings/Appearance.tsx b/js/app/packages/app/component/settings/Appearance.tsxindex 80c63914a1..0d952f9308 100644--- a/js/app/packages/app/component/settings/Appearance.tsx+++ b/js/app/packages/app/component/settings/Appearance.tsx@@ -6,12 +6,12 @@ import ThemeList from '../../../block-theme/components/ThemeList';export function Appearance() {return (<div- class="absolute inset-0 overflow-hidden bg-edge-muted @container gap-px grid grid-cols-1 grid-rows-[min-content_min-content_1fr_1fr] @[650px]:grid-cols-2 @[650px]:grid-rows-[min-content_min-content_1fr] mobile:flex"+ class="absolute inset-0 overflow-hidden bg-edge-muted @container gap-px grid grid-cols-1 grid-rows-[min-content_min-content_1fr_1fr] @[650px]:grid-cols-2 @[650px]:grid-rows-[min-content_min-content_1fr]">- <div class="mobile:hidden @[650px]:col-span-2"><ThemeTools /></div>- <div class="mobile:hidden @[650px]:col-span-2"><ThemeEditorBasic /></div>- <div class="mobile:flex-1 overflow-hidden"><ThemeList/></div>- <div class="mobile:hidden overflow-hidden"><ThemeEditorAdvanced /></div>+ <div class="@[650px]:col-span-2"><ThemeTools /></div>+ <div class="@[650px]:col-span-2"><ThemeEditorBasic /></div>+ <div class="overflow-hidden"><ThemeList/></div>+ <div class="overflow-hidden"><ThemeEditorAdvanced /></div></div>);}diff --git a/js/app/packages/app/component/settings/Settings.tsx b/js/app/packages/app/component/settings/Settings.tsxindex 1e59f63b72..4b4ba367a0 100644--- a/js/app/packages/app/component/settings/Settings.tsx+++ b/js/app/packages/app/component/settings/Settings.tsx@@ -1,4 +1,4 @@-import { createEffect, For, onMount, Show, Suspense } from 'solid-js';+import { createEffect, onMount, Show, Suspense } from 'solid-js';import { type SettingsTab, useSettingsState } from '@core/constant/SettingsState';import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';import { usePermissions } from '@core/context/user';@@ -9,17 +9,13 @@ import { Appearance } from './Appearance';import { Tabs } from '@core/component/Tabs';import { Account } from './Account';import { Shortcuts } from './Shortcuts';-import { isMobile } from '@core/mobile/isMobile';import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';import type { ValidHotkey } from '@core/hotkey/types';import { SplitHeaderLeft, SplitHeaderRight } from '../split-layout/components/SplitHeader';import { SettingsButton } from './SettingsButton';-import { CollapsibleHeaderItem } from '../split-layout/components/CollapsibleHeaderItem';-import { DropdownMenu } from '@kobalte/core/dropdown-menu';-import ChevronDownIcon from '@icon/regular/caret-down.svg';/**- * Wrapper specifically for in-Split version of Settings Panel used on Mobile. Includes the correct Header button.+ * Wrapper for Settings Panel used in the split layout. Includes the correct Header button.*/export function SettingsPanelComponentWrapper() {return (@@ -59,9 +55,9 @@ export function SettingsPanel(props: SettingsPanelProps) {{ value: 'Account', label: 'Account' },];- if (!isMobile()) { tabs.push({ value: 'Shortcuts', label: 'Shortcuts' }) }+ tabs.push({ value: 'Shortcuts', label: 'Shortcuts' });if (permissions()?.includes('write:stripe_subscription') && !isNativeMobilePlatform()) { tabs.push({ value: 'Subscription', label: 'Subscription' }) }- if (ENABLE_APP_STORE_QR_CODE && !isNativeMobilePlatform()) { tabs.push({ value: 'Mobile App', label: 'Mobile App' }) }+ if (ENABLE_APP_STORE_QR_CODE && !isNativeMobilePlatform()) { tabs.push({ value: 'Mobile App', label: 'App' }) }if (isNativeMobilePlatform() && DEV_MODE_ENV) { tabs.push({ value: 'Mobile', label: 'Mobile Dev Tools' }) }return tabs;};@@ -148,47 +144,7 @@ export function SettingsPanel(props: SettingsPanelProps) {}};- const activeLabel = () => {- const tab = activeTabId();- return settingsTabs().find((item) => item.value === tab)?.label ?? settingsTabs()[0]?.label;- };-- const SettingsTabs = () => (- <Tabs- list={settingsTabs()}- value={activeTabId()}- defaultValue="Appearance"- onChange={handleTabChange}- />- );-- const CollapsedSettingsTabs = () => (- <DropdownMenu placement="bottom-start" gutter={4}>- <DropdownMenu.Trigger class="flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-xs border border-edge-muted hover:bg-ink/6 transition-colors">- <span class="truncate">{activeLabel()}</span>- <ChevronDownIcon class="size-3 shrink-0" />- </DropdownMenu.Trigger>- <DropdownMenu.Portal>- <DropdownMenu.Content class="z-action-menu bg-surface-0 border border-edge-muted rounded-sm shadow-sm p-1">- <For each={settingsTabs()}>- {(item) => (- <DropdownMenu.Item- class="w-full px-2 py-1.5 text-left text-xs transition-colors hover:bg-ink/5 focus:bg-ink/5 outline-none cursor-default rounded-md"- classList={{- 'font-semibold': activeTabId() === item.value,- }}- onSelect={() => handleTabChange(item.value)}- >- {item.label}- </DropdownMenu.Item>- )}- </For>- </DropdownMenu.Content>- </DropdownMenu.Portal>- </DropdownMenu>- );-- const MobileSettingsTabs = () => (+ const BottomTabs = () => (<div class="bg-panel border-t border-edge-muted h-11 px-1"><Tabslist={settingsTabs()}@@ -203,65 +159,44 @@ export function SettingsPanel(props: SettingsPanelProps) {return (<div- class="size-full outline-none bracket-never"+ class="size-full flex flex-col outline-none bracket-never"classList={{invisible: props.hide,}}tabIndex={0}ref={settingsContainerRef}>- {/* Tabs in split header */}+ {/* Header */}<SplitHeaderLeft><div class="h-full flex gap-3 items-center">- <Show when={!isMobile()}>- <h1 class="font-semibold text-ink select-none text-sm shrink-0">- Settings- </h1>- <CollapsibleHeaderItem- id="settings-tabs"- priority={1}- expanded={() => <SettingsTabs />}- collapsed={() => <CollapsedSettingsTabs />}- containerClass="h-full"- />- </Show>+ <h1 class="font-semibold text-ink select-none text-sm shrink-0">+ Settings+ </h1></div></SplitHeaderLeft>{/* Content area */}- <div class="flex-1 min-h-0 flex flex-col overflow-hidden">+ <div class="relative flex-grow min-h-1 overflow-auto"><Show when={activeTabId() === 'Account'}>- <div class="size-full">- <Suspense>- <Account />- </Suspense>- </div>+ <Suspense>+ <Account />+ </Suspense></Show><Show when={activeTabId() === 'Subscription' && permissions()?.includes('write:stripe_subscription') && !isNativeMobilePlatform()}>- <div class="size-full">- <Subscription />- </div>+ <Subscription /></Show><Show when={activeTabId() === 'Appearance'}>- <div class="size-full">- <Appearance />- </div>+ <Appearance /></Show><Show when={activeTabId() === 'Shortcuts'}>- <div class="size-full">- <Shortcuts />- </div>+ <Shortcuts /></Show><Show when={activeTabId() === 'Mobile App' && ENABLE_APP_STORE_QR_CODE && !isNativeMobilePlatform()}>- <div class="size-full">- <MobileApp />- </div>+ <MobileApp /></Show></div>- {/* Mobile bottom tabs */}- <Show when={isMobile()}>- <MobileSettingsTabs />- </Show>+ {/* Bottom tabs */}+ <BottomTabs /></div>);}diff --git a/js/app/packages/core/constant/SettingsState.tsx b/js/app/packages/core/constant/SettingsState.tsxindex 8094046fa2..c4724f4fee 100644--- a/js/app/packages/core/constant/SettingsState.tsx+++ b/js/app/packages/core/constant/SettingsState.tsx@@ -1,6 +1,5 @@import { useSplitLayout } from '@app/component/split-layout/layout';import { globalSplitManager } from '@app/signal/splitLayout';-import { isMobile } from '@core/mobile/isMobile';import { createSignal } from 'solid-js';export type SettingsTab =@@ -18,7 +17,7 @@ export const [activeTabId, setActiveTabId] =createSignal<SettingsTab>('Appearance');export const useSettingsState = () => {- const { replaceSplit, insertSplit } = useSplitLayout();+ const { insertSplit } = useSplitLayout();const getSettingsSplit = () => {const splitManager = globalSplitManager();@@ -36,11 +35,7 @@ export const useSettingsState = () => {const openSettings = (activeTabId?: SettingsTab) => {if (activeTabId) setActiveTabId(activeTabId);if (isOpen()) return; // Already open- if (isMobile()) {- replaceSplit({ content: { type: 'component', id: 'settings' } });- } else {- insertSplit({ type: 'component', id: 'settings' });- }+ insertSplit({ type: 'component', id: 'settings' });};const closeSettings = () => {