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
style(top bar): make collapsed tabs look like inset tab component (#3367)
Seamusef0ca894a1f9
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsxindex 2bd962bf30..50aa9e2680 100644--- a/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsx+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsx@@ -9,9 +9,8 @@ import { useSplitPanelOrThrow } from '@app/component/split-layout/layoutUtils';import { isListViewID, type ListView } from '@app/constants/list-views';import { type TabItem, Tabs } from '@core/component/Tabs';import { TabsInset } from '@core/component/TabsInset';+import { TabsInsetDropdown } from '@core/component/TabsInsetDropdown';import { useUserContext } from '@core/context/user';-import ChevronDownIcon from '@phosphor/caret-down.svg';-import { Dropdown, Layer } from '@ui';import { batch, createMemo, For, Match, Switch } from 'solid-js';/** Views that have tab definitions. Shared between VIEW_TAB_LISTS and VIEW_TAB_PRESETS. */@@ -150,46 +149,31 @@ export const CollapsedSoupViewTabs = () => {const { applyTabPreset } = useApplyPreset();const { activeTab } = useSoupView();+ const view = createMemo(() => {+ const v = listView();+ return v && v in VIEW_TAB_LISTS ? (v as TabbedListView) : undefined;+ });+const list = createMemo(() => {- const view = listView();- if (!view || !(view in VIEW_TAB_LISTS)) return [];- return VIEW_TAB_LISTS[view as TabbedListView];+ const v = view();+ return v ? VIEW_TAB_LISTS[v] : [];});- const activeLabel = createMemo(() => {- const tab = activeTab();- return list().find((item) => item.value === tab)?.label ?? list()[0]?.label;+ const defaultValue = createMemo(() => {+ const v = view();+ return v ? VIEW_TAB_PRESETS[v].default : undefined;});return (- <Dropdown placement="bottom-start" gutter={4}>- <Dropdown.Trigger class="flex items-center gap-1">- <span class="truncate">{activeLabel()}</span>- <ChevronDownIcon class="size-3 shrink-0" />- </Dropdown.Trigger>- <Dropdown.Portal>- <Layer depth={2}>- <Dropdown.Content class="z-action-menu bg-surface border border-edge-muted rounded-sm shadow-sm p-1">- <For each={list()}>- {(item) => (- <Dropdown.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': activeTab() === item.value,- }}- onSelect={() => {- const view = listView();- if (view) applyTabPreset(view, item.value);- }}- >- {item.label}- </Dropdown.Item>- )}- </For>- </Dropdown.Content>- </Layer>- </Dropdown.Portal>- </Dropdown>+ <TabsInsetDropdown+ list={list()}+ value={activeTab()}+ defaultValue={defaultValue()}+ onChange={(value) => {+ const v = view();+ if (v) applyTabPreset(v, value);+ }}+ />);};diff --git a/js/app/packages/app/component/settings/Agent.tsx b/js/app/packages/app/component/settings/Agent.tsxindex 5a6a520138..50988af040 100644--- a/js/app/packages/app/component/settings/Agent.tsx+++ b/js/app/packages/app/component/settings/Agent.tsx@@ -1,5 +1,5 @@import { createSignal, For, Show, Suspense } from 'solid-js';-import { Tabs } from '@core/component/Tabs';+import { TabsInset } from '@core/component/TabsInset';import { Button, Layer, Panel } from '@ui';import { McpSetupCards } from '@core/component/AI/component/McpSetupCards';import { toast } from '@core/component/Toast/Toast';@@ -412,7 +412,7 @@ export function Agent() {<div class="max-w-200 size-full"><Panel depth={2} class="relative portal-scope"><Panel.Header>- <Tabs+ <TabsInsetlist={tabList}value={agentSettingsSubTab()}defaultValue="connectors"diff --git a/js/app/packages/app/component/settings/Appearance.tsx b/js/app/packages/app/component/settings/Appearance.tsxindex e82ebc108d..7b0258df48 100644--- a/js/app/packages/app/component/settings/Appearance.tsx+++ b/js/app/packages/app/component/settings/Appearance.tsx@@ -5,7 +5,7 @@ import ThemeTools from '@theme/components/ThemeTools';import ThemeList from '@theme/components/ThemeList';import { isMobile } from '@core/mobile/isMobile';import { createSignal, Show } from 'solid-js';-import { Tabs } from '@core/component/Tabs';+import { TabsInset } from '@core/component/TabsInset';import { Panel, ToggleSwitch } from '@ui';type PanelA = 'basic' | 'advanced';@@ -51,7 +51,7 @@ export function Appearance() {><Panel depth={2}><Panel.Header>- <Tabs+ <TabsInsetonChange={(value) => setActiveTabA(value as PanelA)}list={[{ value: 'basic', label: 'Basic' },@@ -83,7 +83,7 @@ export function Appearance() {<Panel depth={2}><Panel.Header>- <Tabs+ <TabsInsetonChange={(value) => setActiveTabB(value as PanelB)}list={[{ value: 'themes', label: 'Themes' },diff --git a/js/app/packages/app/component/settings/Settings.tsx b/js/app/packages/app/component/settings/Settings.tsxindex 6b47ff4350..7b664a3329 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, createMemo, 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 { isMobile } from '@core/mobile/isMobile';@@ -7,7 +7,8 @@ import { useFeatureFlag } from '@app/lib/analytics/posthog';import { MobileApp } from './MobileApp';import { Agent } from './Agent';import { Appearance } from './Appearance';-import { Tabs } from '@core/component/Tabs';+import { TabsInset } from '@core/component/TabsInset';+import { TabsInsetDropdown } from '@core/component/TabsInsetDropdown';import { Account } from './Account';import { Shortcuts } from './Shortcuts';import { Team } from './Team';@@ -17,7 +18,6 @@ import { SplitHeaderLeft, SplitHeaderRight } from '../split-layout/components/Spimport { CollapsibleHeaderItem } from '../split-layout/components/CollapsibleHeaderItem';import { SettingsButton } from './SettingsButton';import { isTouchDevice } from '@core/mobile/isTouchDevice';-import { Dropdown, Layer } from '@ui';export function SettingsPanelComponentWrapper() {return (@@ -159,14 +159,12 @@ export function SettingsPanel(props: SettingsPanelProps) {function BottomTabs() {return (- <div class="bg-surface border-t border-edge-muted h-11 shrink-0 px-1">- <Tabs+ <div class="bg-surface border-t border-edge-muted h-11 shrink-0 px-1 flex items-center">+ <TabsInsetlist={settingsTabs()}value={activeTabId()}defaultValue="Appearance"onChange={handleTabChange}- indicatorPosition="top"- class="**:data-indicator:h-0.75"/></div>);@@ -190,7 +188,7 @@ export function SettingsPanel(props: SettingsPanelProps) {priority={1}containerClass="h-full"expanded={() => (- <Tabs+ <TabsInsetlist={settingsTabs()}value={activeTabId()}defaultValue="Appearance"@@ -198,9 +196,10 @@ export function SettingsPanel(props: SettingsPanelProps) {/>)}collapsed={() => (- <CollapsedSettingsTabs- tabs={settingsTabs()}+ <TabsInsetDropdown+ list={settingsTabs()}value={activeTabId()}+ defaultValue="Appearance"onChange={handleTabChange}/>)}@@ -242,44 +241,3 @@ export function SettingsPanel(props: SettingsPanelProps) {);}-type CollapsedSettingsTabsProps = {- tabs: { value: string; label: string }[];- value: string;- onChange: (value: string) => void;-};--function CollapsedSettingsTabs(props: CollapsedSettingsTabsProps) {- const activeLabel = createMemo(() => {- return (- props.tabs.find((item) => item.value === props.value)?.label ??- props.tabs[0]?.label- );- });-- return (- <Dropdown placement="bottom-start" gutter={4}>- <Dropdown.Trigger>- <span class="truncate">{activeLabel()}</span>- </Dropdown.Trigger>- <Dropdown.Portal>- <Layer depth={2}>- <Dropdown.Content class="z-action-menu bg-surface border border-edge-muted rounded-sm shadow-sm p-1">- <For each={props.tabs}>- {(item) => (- <Dropdown.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': props.value === item.value,- }}- onSelect={() => props.onChange(item.value)}- >- {item.label}- </Dropdown.Item>- )}- </For>- </Dropdown.Content>- </Layer>- </Dropdown.Portal>- </Dropdown>- );-}diff --git a/js/app/packages/core/component/TabsInsetDropdown.tsx b/js/app/packages/core/component/TabsInsetDropdown.tsxnew file mode 100644index 0000000000..9dbcdab912--- /dev/null+++ b/js/app/packages/core/component/TabsInsetDropdown.tsx@@ -0,0 +1,87 @@+import { DropdownMenu as KDropdownMenu } from '@kobalte/core/dropdown-menu';+import CaretDown from '@phosphor/caret-down.svg';+import { cn, Layer } from '@ui';+import { createMemo, For, type JSX, splitProps } from 'solid-js';++export type TabItem = {+ value: string;+ label: string | JSX.Element;+};++export type TabsInsetDropdownProps = {+ list: TabItem[];+ value?: string;+ defaultValue?: string;+ onChange?: (value: string) => void;+ disabled?: boolean;+ class?: string;+ depth?: 0 | 1 | 2 | 3 | 4 | 5;+ placeholder?: string | JSX.Element;+};++export const TabsInsetDropdown = (props: TabsInsetDropdownProps) => {+ const [local] = splitProps(props, [+ 'list',+ 'value',+ 'defaultValue',+ 'onChange',+ 'disabled',+ 'class',+ 'depth',+ 'placeholder',+ ]);++ const current = createMemo(() => {+ const v = local.value ?? local.defaultValue ?? local.list[0]?.value;+ return local.list.find((item) => item.value === v) ?? local.list[0];+ });++ return (+ <KDropdownMenu placement="bottom-start" gutter={4}>+ <Layer depth={local.depth ?? 0}>+ <KDropdownMenu.Trigger+ disabled={local.disabled}+ class={cn(+ 'relative flex items-center bg-surface rounded-lg p-0.5 ring ring-edge-muted cursor-default outline-none disabled:opacity-50',+ local.class+ )}+ >+ <Layer depth={2}>+ <span class="flex items-center px-2.5 py-1 text-xs font-medium ring ring-edge-muted ring-inset rounded-md bg-surface text-ink shadow-sm">+ {current()?.label ?? local.placeholder ?? ''}+ </span>+ </Layer>+ <span class="flex items-center justify-center px-1.5 text-ink-extra-muted">+ <CaretDown class="size-3" />+ </span>+ </KDropdownMenu.Trigger>+ </Layer>+ <KDropdownMenu.Portal>+ <Layer depth={local.depth ?? 2}>+ <KDropdownMenu.Content class="z-action-menu flex flex-col bg-surface rounded-lg p-0.5 ring ring-edge-muted shadow-lg min-w-32 outline-none">+ <For each={local.list}>+ {(item) => {+ const isActive = () => current()?.value === item.value;+ return (+ <Layer depth={2}>+ <KDropdownMenu.Item+ class={cn(+ 'flex items-center px-2.5 py-2 text-xs font-medium ring-inset rounded-md text-ink-extra-muted hover:bg-hover hover:text-ink focus:bg-hover focus:text-ink outline-none',+ {+ 'text-red font-bold': isActive(),+ }+ )}+ onSelect={() => local.onChange?.(item.value)}+ >+ {item.label}+ </KDropdownMenu.Item>+ </Layer>+ );+ }}+ </For>+ </KDropdownMenu.Content>+ </Layer>+ </KDropdownMenu.Portal>+ </KDropdownMenu>+ );+};