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
feat(settings): settings UI updates (#4169)
Aidan Holloway-Bidwellaa1e0240f182
diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsxindex 4b4f3d5c8e..342f7cac87 100644--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx@@ -38,6 +38,7 @@ import { globalSplitManager } from '@app/signal/splitLayout';import { InCallPanel } from '@channel/Call';import { useCallContextOptional } from '@channel/Call/CallContext';import { useHasPaidAccess } from '@core/auth';+import { useLogout } from '@core/auth/logout';import { ContextMenuContent, MenuItem } from '@core/component/ContextMenu';import { inboxIconProps } from '@core/component/inboxIcon';import { UserIcon } from '@core/component/UserIcon';@@ -83,6 +84,7 @@ import CaretDownIcon from '@phosphor/caret-down.svg';import CaretUpIcon from '@phosphor/caret-up.svg';import HomeIcon from '@phosphor/house.svg';import PlayIcon from '@phosphor/play.svg';+import SignOutIcon from '@phosphor/sign-out.svg';import { useEmailLinksQuery } from '@queries/email/link';import { debounce } from '@solid-primitives/scheduled';import { makePersisted } from '@solid-primitives/storage';@@ -643,6 +645,7 @@ const SidebarSettingsWidget = (props: SidebarSettingsWidgetProps) => {const userId = useUserId();const [onboardingModalOpen, setOnboardingModalOpen] = createSignal(false);const { groups: settingGroups } = useSettingsTabs();+ const logout = useLogout();return (<Dropdown placement="top-start" gutter={6}>@@ -715,6 +718,17 @@ const SidebarSettingsWidget = (props: SidebarSettingsWidgetProps) => {</Dropdown.Group>)}</For>+ <Dropdown.Group>+ <Dropdown.Item+ class="flex items-center gap-2 px-2.5 py-2 text-sm cursor-default outline-none text-ink-muted"+ onSelect={() => logout()}+ >+ <span class="size-5 flex items-center justify-center">+ <SignOutIcon class="size-4 shrink-0 text-ink-extra-muted" />+ </span>+ <span class="text-ink">Log out</span>+ </Dropdown.Item>+ </Dropdown.Group></Dropdown.Content><InteractiveOnboardingModalopen={onboardingModalOpen()}diff --git a/js/app/packages/app/component/settings/Account.tsx b/js/app/packages/app/component/settings/Account.tsxindex 6451ef9355..0a887f6f08 100644--- a/js/app/packages/app/component/settings/Account.tsx+++ b/js/app/packages/app/component/settings/Account.tsx@@ -1,12 +1,12 @@-import { capitalize } from '@block-pdf/util/StringUtils';-import { useHasPaidAccess } from '@core/auth/license';import { UserIcon } from '@core/component/UserIcon';import { useLogout } from '@core/auth/logout';import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';+import { isMobile } from '@core/mobile/isMobile';import { toast } from '@core/component/Toast/Toast';import { staticFileIdEndpoint } from '@core/constant/servers';import { createStaticFile } from '@core/util/create';-import { Dialog, Button, Panel, Tooltip } from '@ui';+import { openFilePicker } from '@core/util/upload';+import { Dialog, Button, Panel, Tooltip, ToggleSwitch, Dropdown } from '@ui';import {blockNameToFileExtensions,blockNameToMimeTypes,@@ -19,17 +19,19 @@ import {ENABLE_NEW_PRICING_OVERRIDE,} from '@core/constant/featureFlags';import { useUserTeamsQuery } from '@queries/team';-import { usePaywallState } from '@core/constant/PaywallState';-import { fileSelector } from '@core/directive/fileSelector';import {type ProfilePictureItem,useProfilePictureUrl,} from '@core/signal/profilePicture';import IconUpload from '@phosphor-icons/core/regular/upload-simple.svg?component-solid';import SignOutIcon from '@phosphor-icons/core/regular/sign-out.svg?component-solid';-import XIcon from '@phosphor-icons/core/regular/x.svg?component-solid';+import PencilIcon from '@phosphor/pencil-simple.svg';+import TrashIcon from '@phosphor/trash.svg';+import CheckIcon from '@phosphor/check.svg';+import SpinnerIcon from '@phosphor/spinner-gap.svg';+import WarningCircleIcon from '@phosphor/warning-circle.svg';import { authServiceClient } from '@service-auth/client';-import { useEmail, useLicenseStatus, useUserId } from '@core/context/user';+import { useEmail, useUserId } from '@core/context/user';import {createEffect,createMemo,@@ -37,6 +39,7 @@ import {createSignal,type JSX,Match,+ onCleanup,Show,Switch,} from 'solid-js';@@ -44,8 +47,8 @@ import { usePermissions } from '@core/context/user';import { PERMISSION_IDS } from '@core/constant/permissions';import { useSettingsState } from '@core/constant/SettingsState';import PaywallComponent from '../paywall/PaywallComponent';-import PaywallTeamMemberView from '../paywall/PaywallTeamMemberView';import PaywallTeamOwnerView from '../paywall/PaywallTeamOwnerView';+import UsersThreeIcon from '@phosphor/users-three.svg';import {type SupportedNotificationSettings,useNotificationSettings,@@ -53,9 +56,7 @@ import {import { useAnalytics } from '@app/component/analytics-context';import { useTauri, type BundleUpdateStatus } from '@macro/tauri';import { invoke } from '@tauri-apps/api/core';--// NOTE: solid directives-false && fileSelector;+import { Transition } from 'solid-transition-group';// 16 megabytesconst MAX_PROFILE_PICTURE_SIZE = 16 * 1000 * 1000;@@ -110,6 +111,32 @@ function formatBundleUpdateStatus(status: BundleUpdateStatus): string {}}+/**+ * Save one name field with an optimistic update and rollback on failure.+ * Returns whether the save succeeded, which drives NameInput's status icon.+ */+async function saveUserName(+ value: string,+ field: 'first_name' | 'last_name',+ prev: string | undefined,+ setValue: (next: string | undefined) => void+): Promise<boolean> {+ setValue(value); // optimistic+ try {+ const res = await authServiceClient.putUserName(+ field === 'first_name' ? { first_name: value } : { last_name: value }+ );+ if (res.isErr()) {+ setValue(prev); // rollback on a returned error+ return false;+ }+ return true;+ } catch {+ setValue(prev); // rollback if the call throws before returning a Result+ return false;+ }+}+function useUserName() {const fetchUserName = async () => {const response = await authServiceClient.getUserName();@@ -152,6 +179,15 @@ function ProfilePictureRow(props: { userId: string }) {mutateProfilePicture(response.url);};+ const pickProfilePicture = () =>+ openFilePicker(+ {+ acceptedMimeTypes: blockNameToMimeTypes.image,+ acceptedFileExtensions: blockNameToFileExtensions.image,+ },+ handleUpload+ );+const handleRemove = async () => {setIsRemoving(true);const removed = await removeProfilePicture();@@ -164,42 +200,63 @@ function ProfilePictureRow(props: { userId: string }) {return (<><Row label="Profile Picture">- <div class="flex items-center gap-3">- <UserIcon- id={props.userId}- isDeleted={false}- size="lg"- class="bg-transparent"- />- <div class="flex items-center gap-2">- <Show when={profilePictureUrl()}>- <Tooltip label="Remove profile picture">- <Button- variant="danger"- size="icon-sm"- depth={3}- disabled={isRemoving()}- onClick={() => setShowRemoveConfirmModal(true)}- aria-label="Remove profile picture"- >- <XIcon class="size-4" />- </Button>- </Tooltip>- </Show>- <span- class="inline-flex"- use:fileSelector={{- acceptedFileExtensions: blockNameToFileExtensions.image,- acceptedMimeTypes: blockNameToMimeTypes.image,- onSelect: handleUpload,- }}- >- <Button variant="base" size="sm" depth={3}>- <IconUpload class="size-4" />- Upload- </Button>- </span>- </div>+ <div class="relative size-12 shrink-0">+ <Show+ when={profilePictureUrl()}+ fallback={+ // No picture: a filled circle that stands out from the surface,+ // with the upload icon always visible. The whole circle uploads.+ <span+ tabindex="0"+ role="button"+ aria-label="Upload profile picture"+ onClick={pickProfilePicture}+ class="flex size-full cursor-pointer items-center justify-center rounded-full bg-edge text-ink-muted transition-colors hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent"+ >+ <IconUpload class="size-5" />+ </span>+ }+ >+ {/* Has picture: hover reveals an edit affordance; clicking opens a+ menu to replace or remove the picture. */}+ <Dropdown>+ <Dropdown.Trigger+ as="div"+ tabindex="0"+ aria-label="Edit profile picture"+ class="group block size-full cursor-pointer rounded-full outline-none focus-visible:ring-2 focus-visible:ring-accent"+ >+ <div class="size-full overflow-hidden rounded-full">+ <UserIcon+ id={props.userId}+ isDeleted={false}+ size="fill"+ suppressClick+ showTooltip={false}+ class="bg-transparent"+ />+ </div>+ <div class="pointer-events-none absolute -inset-px z-10 flex items-center justify-center rounded-full bg-overlay text-ink opacity-0 transition-opacity group-hover:opacity-100">+ <PencilIcon class="size-5" />+ </div>+ </Dropdown.Trigger>+ <Dropdown.Content class="w-48">+ <Dropdown.Group>+ <Dropdown.Item onSelect={pickProfilePicture}>+ <IconUpload class="size-4" />+ Upload new picture+ </Dropdown.Item>+ <Dropdown.Item+ class="text-failure"+ onSelect={() => setShowRemoveConfirmModal(true)}+ >+ <TrashIcon class="size-4" />+ Remove picture+ </Dropdown.Item>+ </Dropdown.Group>+ </Dropdown.Content>+ </Dropdown>+ </Show></div></Row><Dialog@@ -247,12 +304,9 @@ function ProfilePictureRow(props: { userId: string }) {export function Account() {const email = useEmail();const userId = useUserId();- const licenseStatus = useLicenseStatus();const logout = useLogout();- const { showPaywall } = usePaywallState();- const hasPaidAccess = useHasPaidAccess();const permissions = usePermissions();- const { toggleSettings } = useSettingsState();+ const { toggleSettings } = useSettingsState();const disableAutoUpdateUIFlag = useFeatureFlag(DISABLE_AUTO_UPDATE_UI_FLAG);const autoUpdateUIEnabled = createMemo(() => ENABLE_AUTO_UPDATE_UI_OVERRIDE ?? !disableAutoUpdateUIFlag().enabled@@ -271,8 +325,15 @@ export function Account() {const teams = userTeamsQuery.data;const uid = userId();if (!teams || !uid) return false;- return teams.some((t) => t.owner_id !== uid);+ // Only a "non-owner member" if they own no team at all but belong to one.+ const ownsAnyTeam = teams.some((t) => t.owner_id === uid);+ return !ownsAnyTeam && teams.some((t) => t.owner_id !== uid);+ });++ const newPricingFlag = useFeatureFlag('enable-new-pricing', {+ enabledOverride: ENABLE_NEW_PRICING_OVERRIDE,});+ const newPricingEnabled = () => newPricingFlag().enabled;const userName = useUserName();const [updatedFirstName, setUpdatedFirstName] = createSignal<@@ -302,10 +363,6 @@ export function Account() {return undefined;};- const logoutHandler = () => {- logout();- };-const deleteAccountHandler = async () => {await authServiceClient.deleteUser();logout();@@ -316,14 +373,22 @@ export function Account() {<div class="max-w-200 size-full"><Panel depth={2} class="h-full overflow-hidden text-ink"><Panel.Header class="px-6">- <div class="text-sm font-semibold">Account</div>+ <div class="flex items-center gap-2">+ <div class="text-sm font-semibold">Account</div>+ <TeamSubscriptionPill show={isNonOwnerTeamMember()} />+ </div></Panel.Header><Panel.Body scroll class="text-ink"><Show- when={permissions()?.includes(- PERMISSION_IDS.WRITE_STRIPE_SUBSCRIPTION- )}+ when={+ permissions()?.includes(+ PERMISSION_IDS.WRITE_STRIPE_SUBSCRIPTION+ ) &&+ // Team members get the header pill instead of a card here, so+ // skip this billing block rather than leaving it empty.+ !(newPricingEnabled() && isNonOwnerTeamMember())+ }><div class="px-4 py-2 w-full border-b border-edge-muted"><ShowFeatureFlag@@ -349,15 +414,11 @@ export function Account() {<Match when={ownedTeam()}>{(team) => <PaywallTeamOwnerView team={team()} />}</Match>- <Match when={isNonOwnerTeamMember()}>- <PaywallTeamMemberView />- </Match></Switch></ShowFeatureFlag></div></Show>-- <div class="grid gap-px bg-edge-muted border-b border-edge-muted">+ <div class="grid settings-row-dividers"><Show when={ENABLE_PROFILE_PICTURES}><Show when={userId()} keyed>{(id) => <ProfilePictureRow userId={id} />}@@ -373,10 +434,14 @@ export function Account() {<Row label="First Name"><NameInputvalue={firstName()}- onSave={(newValue) => {- setUpdatedFirstName(newValue);- authServiceClient.putUserName({ first_name: newValue });- }}+ onSave={(newValue) =>+ saveUserName(+ newValue,+ 'first_name',+ updatedFirstName(),+ setUpdatedFirstName+ )+ }placeholder="Enter First Name"/></Row>@@ -384,32 +449,18 @@ export function Account() {<Row label="Last Name"><NameInputvalue={lastName()}- onSave={(newValue) => {- setUpdatedLastName(newValue);- authServiceClient.putUserName({ last_name: newValue });- }}+ onSave={(newValue) =>+ saveUserName(+ newValue,+ 'last_name',+ updatedLastName(),+ setUpdatedLastName+ )+ }placeholder="Enter Last Name"/></Row>- <Row label="License Status">- <div class="flex items-center gap-3">- <span class="text-sm text-ink-muted">- {capitalize(licenseStatus() ?? '')}- </span>- <Show when={!hasPaidAccess()}>- <Button- variant="active"- size="sm"- depth={3}- onClick={() => showPaywall()}- >- Upgrade- </Button>- </Show>- </div>- </Row>-<Show when={autoUpdateUIEnabled()}><BundleVersionRow /><BundleUpdateRow />@@ -418,18 +469,20 @@ export function Account() {<NotificationToggle /></div>- <div class="flex items-center justify-center px-6 py-6">- <Button- variant="danger"- size="md"- depth={3}- class="px-4"- onClick={logoutHandler}- >- <SignOutIcon class="size-4" />- Logout- </Button>- </div>+ <Show when={isMobile()}>+ <div class="flex items-center justify-center px-6 py-6">+ <Button+ variant="base"+ size="md"+ depth={3}+ class="px-4"+ onClick={() => logout()}+ >+ <SignOutIcon class="size-4" />+ Log out+ </Button>+ </div>+ </Show><Show when={isNativeMobilePlatform()}><div class="border-t border-edge pt-4">@@ -513,13 +566,45 @@ function Row(props: { label: string; children?: any }) {);}+/**+ * Team members can't manage their subscription (the owner does), so instead of+ * a full billing card we show a compact, informational pill next to the Account+ * header with the explanation in a hover tooltip. Gated to the new-pricing+ * rollout, matching where the team-member card used to appear.+ */+function TeamSubscriptionPill(props: { show: boolean }) {+ return (+ <Show when={props.show}>+ <ShowFeatureFlag+ key="enable-new-pricing"+ enabledOverride={ENABLE_NEW_PRICING_OVERRIDE}+ >+ <Tooltip+ label="Your subscription is managed by your team owner. Contact them to make changes."+ placement="bottom"+ >+ <span class="inline-flex items-center gap-1.5 rounded-full border border-edge-muted px-2 py-0.5 text-xs font-medium text-ink-muted">+ <UsersThreeIcon class="size-3.5 shrink-0 text-accent" />+ Team Subscription+ </span>+ </Tooltip>+ </ShowFeatureFlag>+ </Show>+ );+}++type SaveStatus = 'idle' | 'saving' | 'saved' | 'error';+function NameInput(props: {value?: string;placeholder?: string;- onSave: (value: string) => void;+ /** Returns whether the save succeeded so we can show status / revert. */+ onSave: (value: string) => Promise<boolean>;}) {const [inputValue, setInputValue] = createSignal(props.value ?? '');const [isFocused, setIsFocused] = createSignal(false);+ const [status, setStatus] = createSignal<SaveStatus>('idle');+ let savedTimer: ReturnType<typeof setTimeout> | undefined;// Keep local input synced with external value, but don't clobber while typing.createEffect(() => {@@ -528,10 +613,22 @@ function NameInput(props: {}});- const commit = () => {+ onCleanup(() => clearTimeout(savedTimer));++ const commit = async () => {const next = inputValue();- if (next === (props.value ?? '')) return;- props.onSave(next);+ if (next === (props.value ?? '')) return; // nothing changed+ clearTimeout(savedTimer);+ setStatus('saving');+ let ok = false;+ try {+ ok = await props.onSave(next);+ } catch {+ ok = false;+ }+ setStatus(ok ? 'saved' : 'error');+ // Auto-clear the "Saved" check; leave the error visible until next edit.+ if (ok) savedTimer = setTimeout(() => setStatus('idle'), 2000);};const handleKeyDown: JSX.EventHandler<HTMLInputElement, KeyboardEvent> = (@@ -548,15 +645,18 @@ function NameInput(props: {};return (- <div class="ph-no-capture group relative flex items-center gap-1 rounded-lg h-7 mobile:h-9 px-2 border text-xs bg-transparent text-ink-muted border-edge-muted hover:text-ink focus-within:text-ink focus-within:border-accent">+ <div class="ph-no-capture group relative flex items-center gap-1.5 rounded-lg h-7 mobile:h-9 px-2 border text-xs bg-transparent text-ink-muted border-edge-muted hover:text-ink focus-within:text-ink focus-within:border-accent"><inputtype="text"class="flex-1 min-w-0 bg-transparent outline-none border-0 p-0 text-xs placeholder:text-ink-extra-muted"value={inputValue()}onInput={(e) => setInputValue(e.currentTarget.value)}- onFocus={() => setIsFocused(true)}+ onFocus={() => {+ setIsFocused(true);+ setStatus('idle'); // clear prior status while editing+ }}onBlur={() => {- commit();+ void commit();setIsFocused(false);}}onKeyDown={handleKeyDown}@@ -565,6 +665,30 @@ function NameInput(props: {spellcheck={false}data-1p-ignore/>+ {/* Fixed-width slot so the status icon never widens / shifts the input. */}+ <div class="flex size-3.5 shrink-0 items-center justify-center">+ <Transition+ mode="outin"+ enterActiveClass="transition-opacity duration-200 ease-out"+ enterClass="opacity-0"+ exitActiveClass="transition-opacity duration-150 ease-in"+ exitToClass="opacity-0"+ >+ <Switch>+ <Match when={status() === 'saving'}>+ <SpinnerIcon class="size-3.5 animate-spin text-ink-muted" />+ </Match>+ <Match when={status() === 'saved'}>+ <CheckIcon class="size-3.5 text-success" />+ </Match>+ <Match when={status() === 'error'}>+ <Tooltip label="Couldn't save — try again" placement="top">+ <WarningCircleIcon class="size-3.5 text-failure" />+ </Tooltip>+ </Match>+ </Switch>+ </Transition>+ </div></div>);}@@ -587,22 +711,18 @@ function NotificationSettings(props: {}) {const analytics = useAnalytics()- const handleToggle = () => {+ const handleToggle = (checked: boolean) => {analytics.track('notifications_toggled')- props.settings.toggle(!props.settings.isEnabled())+ props.settings.toggle(checked)}return (<Row label="Notifications">- <Button- variant="base"- size="sm"- depth={3}- onClick={handleToggle}- >- {props.settings.isEnabled() ? "Disable" : "Enable"}- </Button>+ <ToggleSwitch+ checked={props.settings.isEnabled()}+ onChange={handleToggle}+ /></Row>);}diff --git a/js/app/packages/app/component/settings/Agent.tsx b/js/app/packages/app/component/settings/Agent.tsxindex 00eff6fe0f..ef0e90e14e 100644--- a/js/app/packages/app/component/settings/Agent.tsx+++ b/js/app/packages/app/component/settings/Agent.tsx@@ -1,7 +1,10 @@-import { createSignal, For, Show, Suspense } from 'solid-js';+import { createEffect, createSignal, For, Show, Suspense } from 'solid-js';import { TabsInset } from '@core/component/TabsInset';import PlusIcon from '@phosphor-icons/core/regular/plus.svg?component-solid';-import { Button, Layer, Panel } from '@ui';+import PlugIcon from '@phosphor-icons/core/regular/plug.svg?component-solid';+import { Button, Layer, Panel, ToggleSwitch } from '@ui';+import CheckIcon from '@phosphor-icons/core/regular/check.svg?component-solid';+import XIcon from '@phosphor-icons/core/regular/x.svg?component-solid';import { McpSetupCards } from '@core/component/AI/component/McpSetupCards';import { toast } from '@core/component/Toast/Toast';import type {@@ -196,11 +199,47 @@ function AddServerForm(props: {);}+// We have no server-side signal for a failed auth, so we remember locally that a+// connect attempt was made. A disconnected server with a recorded attempt is+// treated as a failed connection; the flag is cleared once it authenticates.+const AUTH_ATTEMPT_PREFIX = 'mcp:auth-attempted:';++function readAuthAttempted(url: string): boolean {+ try {+ return localStorage.getItem(AUTH_ATTEMPT_PREFIX + url) === '1';+ } catch {+ return false;+ }+}++function writeAuthAttempted(url: string, attempted: boolean): void {+ try {+ if (attempted) localStorage.setItem(AUTH_ATTEMPT_PREFIX + url, '1');+ else localStorage.removeItem(AUTH_ATTEMPT_PREFIX + url);+ } catch {+ // Ignore storage failures (private mode, quota, etc.)+ }+}+function ServerRow(props: { server: ServerResponse }) {const updateMutation = useUpdateMcpServerMutation();const deleteMutation = useDeleteMcpServerMutation();const authMutation = useStartMcpAuthMutation();const [confirmDelete, setConfirmDelete] = createSignal(false);+ const [attempted, setAttempted] = createSignal(+ readAuthAttempted(props.server.url)+ );++ // A recorded attempt on a still-disconnected server means the last connect+ // attempt didn't succeed. Clear the flag once the server authenticates.+ createEffect(() => {+ if (props.server.authenticated && attempted()) {+ writeAuthAttempted(props.server.url, false);+ setAttempted(false);+ }+ });++ const connectionFailed = () => !props.server.authenticated && attempted();const handleToggleEnabled = () => {updateMutation.mutate(@@ -238,33 +277,49 @@ function ServerRow(props: { server: ServerResponse }) {{onSuccess: (result: StartAuthResponse) => {window.open(result.authorization_url, '_blank');+ writeAuthAttempted(props.server.url, true);+ setAttempted(true);},onError: () => {+ writeAuthAttempted(props.server.url, true);+ setAttempted(true);toast.failure('Failed to start authorization');},});};- const Icon = () => QUICK_CONNECT_ICON_MAP.get(props.server.url);+ const Icon = (): SvgIcon =>+ QUICK_CONNECT_ICON_MAP.get(props.server.url) ?? (PlugIcon as SvgIcon);return (- <div class="bg-panel flex items-center gap-4 px-6 py-3">- <Show when={Icon()}>- {(IconComp) => {- const C = IconComp() as SvgIcon;- return <C class="size-5 shrink-0 text-accent" />;- }}- </Show>+ <div class="bg-panel flex items-center gap-4 @max-[480px]:gap-2 px-6 @max-[480px]:px-3 py-3">+ {(() => {+ const C = Icon();+ return <C class="size-5 shrink-0 text-accent" />;+ })()}<div class="flex-1 min-w-0">- <div class="text-sm font-medium text-ink truncate">- {props.server.server_name}+ <div class="flex items-center gap-1.5">+ <span class="min-w-0 truncate text-sm font-medium text-ink">+ {props.server.server_name}+ </span>+ <Show when={props.server.authenticated}>+ <CheckIcon class="size-3 shrink-0 text-success" />+ </Show>+ <Show when={connectionFailed()}>+ <XIcon class="size-3 shrink-0 text-failure" />+ </Show></div>- <div class="text-xs text-muted truncate">{props.server.url}</div>+ <div class="text-xs text-ink-muted truncate">{props.server.url}</div></div><div class="flex items-center gap-2 shrink-0"><Show when={!props.server.authenticated}>+ <Show when={connectionFailed()}>+ <span class="text-xs text-failure whitespace-nowrap">+ Last connection attempt failed+ </span>+ </Show><Buttonvariant="active"size="sm"@@ -272,21 +327,22 @@ function ServerRow(props: { server: ServerResponse }) {disabled={authMutation.isPending}onClick={handleAuth}>- {authMutation.isPending ? 'Connecting...' : 'Connect'}+ {authMutation.isPending+ ? 'Connecting...'+ : connectionFailed()+ ? 'Try Again'+ : 'Connect'}</Button></Show><Show when={props.server.authenticated}>- <span class="text-xs text-green-500">Connected</span>- <Button- variant="base"- size="sm"- depth={3}+ <ToggleSwitch+ checked={props.server.enabled}disabled={updateMutation.isPending}- onClick={handleToggleEnabled}- >- {props.server.enabled ? 'Disable' : 'Enable'}- </Button>+ onChange={handleToggleEnabled}+ label={props.server.enabled ? 'Enabled' : 'Disabled'}+ labelClass="@max-[480px]:hidden inline-block w-14 text-left text-xs text-ink-muted whitespace-nowrap"+ /></Show><Show@@ -317,9 +373,12 @@ function ServerRow(props: { server: ServerResponse }) {variant="base"size="sm"depth={3}+ tooltip="Remove"+ class="@max-[480px]:border-transparent"onClick={() => setConfirmDelete(true)}>- Remove+ <span class="@max-[480px]:hidden">Remove</span>+ <XIcon class="hidden size-4 @max-[480px]:block" /></Button></Show></div>@@ -330,24 +389,16 @@ function ServerRow(props: { server: ServerResponse }) {function Connectors() {const serversQuery = useMcpServersQuery();const [showAddDialog, setShowAddDialog] = createSignal(false);+ const hasServers = () => (serversQuery.data?.length ?? 0) > 0;return (- <div class="px-6 py-4 flex flex-col gap-4">- <div class="flex items-center justify-between gap-4">+ <div class="@container">+ <div class="px-6 @max-[480px]:px-2 py-4 flex flex-col gap-4">+ <Show when={!hasServers()}><div class="text-sm">Connect the Macro agent to external MCP servers</div>- <Button- variant="active"- size="sm"- depth={3}- class="shrink-0"- onClick={() => { setShowAddDialog(true) }}- >- <PlusIcon class="size-4" />- Add Server- </Button>- </div>+ </Show><Show when={serversQuery.isLoading}><div class="text-sm text-ink-muted py-8 text-center">Loading...</div>@@ -378,7 +429,7 @@ function Connectors() {</div>}>- <div class="grid gap-px bg-edge-muted rounded-sm overflow-hidden border border-edge-muted">+ <div class="flex flex-col rounded-sm overflow-hidden border border-edge-muted settings-row-dividers @max-[480px]:[&>*:not(:last-child)]:after:inset-x-3"><For each={servers()}>{(server) => <ServerRow server={server} />}</For>@@ -387,19 +438,32 @@ function Connectors() {)}</Show>+ <div class="flex justify-center">+ <Button+ variant="active"+ size="sm"+ depth={3}+ onClick={() => setShowAddDialog(true)}+ >+ <PlusIcon class="size-4" />+ Add Server+ </Button>+ </div>+<AddServerFormopen={showAddDialog()}onOpenChange={setShowAddDialog}existingUrls={new Set(serversQuery.data?.map((s) => s.url) ?? [])}/></div>+ </div>);}function McpServer() {return (<div class="px-6">- <div class="text-sm py-4"> Connect agents to Macro </div>+ <div class="text-sm py-4"> Connect agents to Macro's MCP Server </div><McpSetupCards class="max-w-none" /></div>);diff --git a/js/app/packages/app/component/settings/Appearance.tsx b/js/app/packages/app/component/settings/Appearance.tsxindex 60661f9b5c..bfb6dfda8c 100644--- a/js/app/packages/app/component/settings/Appearance.tsx+++ b/js/app/packages/app/component/settings/Appearance.tsx@@ -80,7 +80,7 @@ function UserInterface() {const darkThemes = () => themes().filter((theme) => isTokensDark(theme.tokens));return (- <div class="flex flex-col">+ <div class="flex flex-col settings-row-dividers"><div class="bg-surface flex items-center justify-between h-15.25 px-6"><div class="text-sm">Monochrome Icons</div><ToggleSwitch@@ -97,35 +97,38 @@ function UserInterface() {/></div>- <div class="bg-surface flex items-center justify-between h-15.25 px-6">- <div class="flex flex-col gap-0.5">- <div class="text-sm">Auto-detect color scheme</div>- <div class="text-xs text-ink-muted">- Switch theme with your system's light/dark mode+ {/* Auto-detect and its dependent theme pickers form one group: keep the+ divider above the group, but none between it and its sub-settings. */}+ <div class="flex flex-col">+ <div class="bg-surface flex items-center justify-between h-15.25 px-6">+ <div class="flex flex-col gap-0.5">+ <div class="text-sm">Auto-detect color scheme</div>+ <div class="text-xs text-ink-muted">+ Switch theme with your system's light/dark mode+ </div></div>+ <ToggleSwitch+ onChange={setThemeShouldMatchSystem}+ checked={themeShouldMatchSystem()}+ /></div>- <ToggleSwitch- onChange={setThemeShouldMatchSystem}- checked={themeShouldMatchSystem()}- />- </div>- <ThemePreferenceRow- label="Default light theme"- value={lightModeTheme}- options={lightThemes}- onSelect={setLightModeTheme}- disabled={() => !themeShouldMatchSystem()}- />-- <ThemePreferenceRow- label="Default dark theme"- value={darkModeTheme}- options={darkThemes}- onSelect={setDarkModeTheme}- disabled={() => !themeShouldMatchSystem()}- />+ <ThemePreferenceRow+ label="Default light theme"+ value={lightModeTheme}+ options={lightThemes}+ onSelect={setLightModeTheme}+ disabled={() => !themeShouldMatchSystem()}+ />+ <ThemePreferenceRow+ label="Default dark theme"+ value={darkModeTheme}+ options={darkThemes}+ onSelect={setDarkModeTheme}+ disabled={() => !themeShouldMatchSystem()}+ />+ </div></div>);}diff --git a/js/app/packages/app/component/settings/Email.tsx b/js/app/packages/app/component/settings/Email.tsxindex ffe636de40..9d038ed858 100644--- a/js/app/packages/app/component/settings/Email.tsx+++ b/js/app/packages/app/component/settings/Email.tsx@@ -79,6 +79,9 @@ export function Email() {});const hasAdditionalInboxes = createMemo(() => inboxes().others.length > 0);+ const hasConnectedInboxes = createMemo(+ () => inboxes().primary != null || inboxes().others.length > 0+ );const onConnectEmail = async () => {if (isEmailActionPending()) return;@@ -193,40 +196,23 @@ export function Email() {</ConnectionHero>}>- <div class="px-6 py-8 flex items-center gap-4 border-b border-edge-muted">- <div class="flex size-11 items-center justify-center rounded-xl bg-edge-muted shrink-0">- <WideEmailIcon class="size-5 text-ink" />- </div>- <div class="flex flex-col gap-1 min-w-0">- <div class="text-base font-semibold text-ink">- Connected inboxes+ <Show when={!hasConnectedInboxes()}>+ <div class="px-6 py-8 flex items-center gap-4 border-b border-edge-muted">+ <div class="flex size-11 items-center justify-center rounded-xl bg-edge-muted shrink-0">+ <WideEmailIcon class="size-5 text-ink" />+ </div>+ <div class="flex flex-1 flex-col gap-1 min-w-0">+ <div class="text-base font-semibold text-ink">+ Connected inboxes+ </div>+ <p class="text-sm text-ink-muted">+ Gmail accounts Macro can read and act on.+ </p></div>- <p class="text-sm text-ink-muted">- Gmail accounts Macro can read and act on.- </p></div>- <Show when={multiInboxFlag().enabled}>- <Show- when={!emailLinksQuery.isLoading}- fallback={- <span class="ml-auto text-sm text-ink-muted">Loading…</span>- }- >- <Button- variant="active"- size="sm"- depth={3}- class="ml-auto shrink-0"- onClick={() => guardAddInbox(openAddInboxDialog)}- >- <PlusIcon class="size-4" />- Add inbox- </Button>- </Show>- </Show>- </div>+ </Show>- <div class="grid gap-px bg-edge-muted border-b border-edge-muted">+ <div class="grid settings-row-dividers"><Show when={inboxes().primary}>{(primary) => (<InboxRow@@ -271,6 +257,26 @@ export function Email() {/>)}</For>+ <Show when={multiInboxFlag().enabled}>+ <div class="px-6 py-4 flex justify-center">+ <Show+ when={!emailLinksQuery.isLoading}+ fallback={+ <span class="text-sm text-ink-muted">Loading…</span>+ }+ >+ <Button+ variant="active"+ size="sm"+ depth={3}+ onClick={() => guardAddInbox(openAddInboxDialog)}+ >+ <PlusIcon class="size-4" />+ Add inbox+ </Button>+ </Show>+ </div>+ </Show></div></Show></Show>diff --git a/js/app/packages/app/component/settings/GitHub.tsx b/js/app/packages/app/component/settings/GitHub.tsxindex fb0b319076..806f58761d 100644--- a/js/app/packages/app/component/settings/GitHub.tsx+++ b/js/app/packages/app/component/settings/GitHub.tsx@@ -77,56 +77,57 @@ export function GitHub() {icon={GithubIcon}title="GitHub"description="Connect your GitHub account so Macro can surface pull requests and issues alongside your work."- status={- <div class="flex flex-col items-center gap-2">+ >+ <div class="flex flex-col items-center gap-2">+ <div class="flex items-center gap-3"><StatusPill state={pill().state} label={pill().label} />- <Show when={status() === 'linked' && githubLink.data?.username}>- {(username) => (- <span class="ph-no-capture text-sm text-ink">- @{username()}- </span>- )}+ <Show when={status() === 'reauthentication_required'}>+ <Button+ variant="cta"+ size="sm"+ depth={3}+ onClick={handleGithubReconnect}+ disabled={reauthenticateGithub.isPending}+ >+ Reconnect+ </Button>+ </Show>+ <Show when={status() === 'linked'}>+ <Button+ variant="base"+ size="sm"+ depth={3}+ onClick={handleGithubDisable}+ disabled={deleteGithubLink.isPending}+ >+ Disconnect+ </Button>+ </Show>+ <Show+ when={+ status() !== 'linked' &&+ status() !== 'reauthentication_required'+ }+ >+ <Button+ variant="cta"+ size="sm"+ depth={3}+ onClick={handleGithubEnable}+ disabled={initGithubLink.isPending}+ >+ Connect GitHub+ </Button></Show></div>- }- >- <Show when={status() === 'reauthentication_required'}>- <Button- variant="cta"- size="md"- depth={3}- onClick={handleGithubReconnect}- disabled={reauthenticateGithub.isPending}- >- Reconnect- </Button>- </Show>- <Show when={status() === 'linked'}>- <Button- variant="base"- size="md"- depth={3}- onClick={handleGithubDisable}- disabled={deleteGithubLink.isPending}- >- Disconnect- </Button>- </Show>- <Show- when={- status() !== 'linked' && status() !== 'reauthentication_required'- }- >- <Button- variant="cta"- size="md"- depth={3}- onClick={handleGithubEnable}- disabled={initGithubLink.isPending}- >- Connect GitHub- </Button>- </Show>+ <Show when={status() === 'linked' && githubLink.data?.username}>+ {(username) => (+ <span class="ph-no-capture text-sm text-ink">+ @{username()}+ </span>+ )}+ </Show>+ </div></ConnectionHero></Show></IntegrationPanelShell>diff --git a/js/app/packages/app/component/settings/Settings.tsx b/js/app/packages/app/component/settings/Settings.tsxindex 0b02f0837f..460ae6a209 100644--- a/js/app/packages/app/component/settings/Settings.tsx+++ b/js/app/packages/app/component/settings/Settings.tsx@@ -1,6 +1,7 @@import { For, onMount, Show, Suspense } from 'solid-js';import { type SettingsTab, useSettingsState } from '@core/constant/SettingsState';import { useSettingsTabs } from '@core/constant/settingsTabsConfig';+import { useLogout } from '@core/auth/logout';import { isMobile } from '@core/mobile/isMobile';import { MobileApp } from './MobileApp';import { Agent } from './Agent';@@ -20,6 +21,7 @@ import { Button, SideNav } from '@ui';import ColumnsPlusRight from '@phosphor/columns-plus-right.svg';import ArrowsOut from '@phosphor/arrows-out.svg';import CloseIcon from '@phosphor/x.svg';+import SignOutIcon from '@phosphor/sign-out.svg';import {SplitHeaderLeft,SplitHeaderRight,@@ -50,6 +52,7 @@ export function SettingsPanel(props: SettingsPanelProps) {setActiveTabId,} = useSettingsState();const { groups, flatTabs, isAvailable } = useSettingsTabs();+ const logout = useLogout();const variant = () => props.variant ?? 'split';@@ -241,6 +244,16 @@ export function SettingsPanel(props: SettingsPanelProps) {</SideNav.Group>)}</For>+ <div class="mt-auto border-t border-edge-muted pt-2">+ <button+ type="button"+ onClick={() => logout()}+ class="flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-ink-extra-muted cursor-default hover:bg-ink/3 hover:text-ink"+ >+ <SignOutIcon class="size-4 shrink-0" />+ <span class="whitespace-nowrap">Log out</span>+ </button>+ </div></SideNav></Show>diff --git a/js/app/packages/app/component/settings/Team.tsx b/js/app/packages/app/component/settings/Team.tsxindex 7d9e4b8fda..c436236407 100644--- a/js/app/packages/app/component/settings/Team.tsx+++ b/js/app/packages/app/component/settings/Team.tsx@@ -9,6 +9,8 @@ import EnvelopeIcon from '@phosphor/envelope.svg';import XIcon from '@phosphor/x.svg';import CaretDownIcon from '@phosphor/caret-down.svg';import CheckIcon from '@phosphor/check.svg';+import MagnifyingGlassIcon from '@phosphor/magnifying-glass.svg';+import InfoIcon from '@phosphor/info.svg';import { Tooltip } from '@ui';import { Button } from '@ui';@@ -22,6 +24,8 @@ import {createSignal,For,Index,+ type JSX,+ mapArray,Match,Show,Suspense,@@ -55,6 +59,8 @@ import { usePaywallState } from '@core/constant/PaywallState';import { useFeatureFlag } from '@app/lib/analytics/posthog';import { z } from 'zod';import { getTeamSlugError, normalizeTeamSlugInput } from './teamSlug';+import { debouncedDependent } from '@core/util/debounce';+import { fuzzyFilter } from '@core/util/fuzzy';function useRequiresPaidUpgrade() {const hasPaidAccess = useHasPaidAccess();@@ -237,7 +243,9 @@ function InviteEmailsInput(props: {props.onChange([...props.invites, { email: '' }]);requestAnimationFrame(() => {const inputs = containerRef?.querySelectorAll('input[type="text"]');- const lastInput = inputs?.[inputs.length - 1] as HTMLInputElement | undefined;+ const lastInput = inputs?.[inputs.length - 1] as+ | HTMLInputElement+ | undefined;lastInput?.focus();});};@@ -307,9 +315,10 @@ function MemberRow(props: {return (<div- class="flex items-center justify-between py-2 px-6 gap-2 bg-surface hover:bg-hover"- classList={{ 'border-b': !props.isLast }}- style={{ 'border-color': 'var(--b3)' }}+ class={cn(+ 'flex items-center justify-between py-2 px-6 gap-2 bg-surface hover:bg-hover',+ !props.isLast && 'settings-row-divider'+ )}><div class="flex items-center gap-3 min-w-0 flex-1"><div class="shrink-0">@@ -336,10 +345,7 @@ function MemberRow(props: {</span>}>- <RoleSelect- value={props.member.role}- onChange={props.onRoleChange}- />+ <RoleSelect value={props.member.role} onChange={props.onRoleChange} /></Show><Show when={props.isOwner}><Show@@ -493,40 +499,42 @@ function TeamInvites() {rejectMutation.variables?.teamInviteId === inviteId;return (- <>- <Panel.Header class="px-6">- <div class="text-sm font-semibold">Team</div>- </Panel.Header>- <Panel.Body>- <Show when={invites().length > 0}>- <section class="px-6 py-4">- <header class="mb-2">- <h3 class="text-sm font-medium">You've been invited to join a team</h3>- </header>- <div class="border border-edge rounded-sm px-3">- <For each={invites()}>- {(invite) => (- <UserInviteRow- invite={invite}- onAccept={() =>- joinTeamMutation.mutate({ teamInviteId: invite.id })- }- onDecline={() =>- rejectMutation.mutate({ teamInviteId: invite.id })- }- isAccepting={isAccepting(invite.id)}- isDeclining={isDeclining(invite.id)}- requiresUpgrade={requiresUpgrade()}- onUpgrade={() => showPaywall()}- />- )}- </For>- </div>- </section>- </Show>- </Panel.Body>- </>- );+ <Panel depth={2} class="h-full overflow-hidden text-ink">+ <Panel.Header class="px-6">+ <div class="text-sm font-semibold">Team</div>+ </Panel.Header>+ <Panel.Body>+ <Show when={invites().length > 0}>+ <section class="px-6 py-4">+ <header class="mb-2">+ <h3 class="text-sm font-medium">+ You've been invited to join a team+ </h3>+ </header>+ <div class="border border-edge rounded-sm px-3">+ <For each={invites()}>+ {(invite) => (+ <UserInviteRow+ invite={invite}+ onAccept={() =>+ joinTeamMutation.mutate({ teamInviteId: invite.id })+ }+ onDecline={() =>+ rejectMutation.mutate({ teamInviteId: invite.id })+ }+ isAccepting={isAccepting(invite.id)}+ isDeclining={isDeclining(invite.id)}+ requiresUpgrade={requiresUpgrade()}+ onUpgrade={() => showPaywall()}+ />+ )}+ </For>+ </div>+ </section>+ </Show>+ </Panel.Body>+ </Panel>+ );}const TEAM_NAME_MAX_LENGTH = 50;@@ -598,7 +606,10 @@ function CreateTeamDialog(props: { open: boolean; onClose: () => void }) {.map((i) => ({ email: i.email.trim() }));createTeamMutation.mutate(- { name: result.data, invites: inviteEntries.length > 0 ? inviteEntries : undefined },+ {+ name: result.data,+ invites: inviteEntries.length > 0 ? inviteEntries : undefined,+ },{ onSuccess: props.onClose });};@@ -630,18 +641,18 @@ function CreateTeamDialog(props: { open: boolean; onClose: () => void }) {</span></div><input- ref={teamNameInputRef}- type="text"- value={teamName()}- onInput={(e) => handleTeamNameChange(e.currentTarget.value)}- onBlur={() => validateTeamName()}- placeholder="My Team"- class={cn(- 'w-full px-3 py-2 text-sm border rounded-lg bg-surface text-ink placeholder:text-ink/30 outline-none',- teamNameError()- ? 'border-failure focus:border-failure'- : 'border-edge-muted focus:border-accent'- )}+ ref={teamNameInputRef}+ type="text"+ value={teamName()}+ onInput={(e) => handleTeamNameChange(e.currentTarget.value)}+ onBlur={() => validateTeamName()}+ placeholder="My Team"+ class={cn(+ 'w-full px-3 py-2 text-sm border rounded-lg bg-surface text-ink placeholder:text-ink/30 outline-none',+ teamNameError()+ ? 'border-failure focus:border-failure'+ : 'border-edge-muted focus:border-accent'+ )}/><Show when={teamNameError()}><p class="text-xs text-failure-ink">{teamNameError()}</p>@@ -653,10 +664,10 @@ function CreateTeamDialog(props: { open: boolean; onClose: () => void }) {Invite members (optional)</label><InviteEmailsInput- invites={invites()}- onChange={setInvites}- errors={inviteErrors()}- onErrorsChange={setInviteErrors}+ invites={invites()}+ onChange={setInvites}+ errors={inviteErrors()}+ onErrorsChange={setInviteErrors}/></div></Show>@@ -679,10 +690,7 @@ function CreateTeamDialog(props: { open: boolean; onClose: () => void }) {}onClick={handleCreate}>- <Show- when={createTeamMutation.isPending}- fallback="Create Team"- >+ <Show when={createTeamMutation.isPending} fallback="Create Team"><SpinnerIcon class="size-4 animate-spin" /></Show></Button>@@ -699,7 +707,8 @@ function EmptyTeamState() {const { showPaywall } = usePaywallState();return (- <>+ <>+ <Panel depth={2} class="h-full overflow-hidden text-ink"><Panel.Header class="px-6"><div class="text-sm font-semibold">Team</div></Panel.Header>@@ -714,8 +723,8 @@ function EmptyTeamState() {fallback={<><p class="text-xs text-ink-muted max-w-xs mb-4">- Teams are available on paid plans. Upgrade to create and manage- teams.+ Teams are available on paid plans. Upgrade to create and+ manage teams.</p><Buttonvariant="active"@@ -728,7 +737,8 @@ function EmptyTeamState() {}><p class="text-xs text-ink-muted max-w-xs mb-4">- Create a team to collaborate with others and manage access together.+ Create a team to collaborate with others and manage access+ together.</p><Buttonvariant="active"@@ -741,15 +751,93 @@ function EmptyTeamState() {</Show></div></Panel.Body>+ </Panel>- <Show when={showCreateModal()}>- <CreateTeamDialog- open={showCreateModal()}- onClose={() => setShowCreateModal(false)}- />- </Show>- </>- );+ <Show when={showCreateModal()}>+ <CreateTeamDialog+ open={showCreateModal()}+ onClose={() => setShowCreateModal(false)}+ />+ </Show>+ </>+ );+}++/** Shared styling for the editable Name/Slug fields in the team-details card. */+const TEAM_FIELD_CLASS =+ 'w-48 h-8 px-2.5 rounded-lg border bg-surface text-sm text-ink outline-none focus:border-accent';++/** A team-details row: label + info tooltip on the left, its control on the right. */+function MetadataRow(props: {+ label: string;+ hint: string;+ children: JSX.Element;+}) {+ return (+ <div class="flex items-center gap-3 w-full px-4 py-2">+ <div class="flex items-center gap-1.5 min-w-0">+ <span class="text-sm">{props.label}</span>+ <Tooltip label={props.hint} placement="top">+ <InfoIcon class="size-3.5 text-ink-muted hover:text-ink" />+ </Tooltip>+ </div>+ {props.children}+ </div>+ );+}++/** Disabled field shown to non-owners, with a tooltip explaining why it's locked. */+function ReadOnlyField(props: { value: string; tooltip: string }) {+ return (+ <Tooltip label={props.tooltip} placement="top">+ <input+ type="text"+ value={props.value}+ disabled+ class={cn(+ TEAM_FIELD_CLASS,+ 'border-edge-muted text-ink-muted pointer-events-none opacity-70'+ )}+ />+ </Tooltip>+ );+}++/** The Save / Cancel cluster shown while an inline field has unsaved changes. */+function SaveCancelButtons(props: {+ onSave: () => void;+ onCancel: () => void;+ saveDisabled?: boolean;+ pending?: boolean;+}) {+ return (+ <div class="flex items-center gap-1 shrink-0">+ <Tooltip label="Save">+ <Button+ variant="active"+ size="icon-sm"+ class="rounded-xs"+ disabled={props.saveDisabled}+ onClick={props.onSave}+ >+ <Show when={props.pending} fallback={<CheckIcon class="size-4" />}>+ <SpinnerIcon class="size-4 animate-spin" />+ </Show>+ </Button>+ </Tooltip>+ <Tooltip label="Cancel">+ <Button+ variant="ghost"+ size="icon-sm"+ class="rounded-xs"+ disabled={props.pending}+ onClick={props.onCancel}+ >+ <XIcon class="size-4" />+ </Button>+ </Tooltip>+ </div>+ );}function TeamManagement(props: {@@ -867,6 +955,38 @@ function TeamManagement(props: {});});+ const [memberQuery, setMemberQuery] = createSignal('');+ // The input stays live (`memberQuery`); filtering reads this debounced view so+ // a burst of typing collapses to one O(n) scan instead of one per keystroke.+ const debouncedMemberQuery = debouncedDependent(memberQuery, 120);++ // Resolve each member's display name reactively. `mapArray` keeps one stable+ // name lookup per member (not recreated on every keystroke / re-render), and+ // disposes it when the member leaves the list.+ const memberSearchIndex = mapArray(members, (member) => {+ const macroId = tryMacroId(member.user_id);+ const [displayName] = useDisplayName(macroId);+ const email = macroId ? macroIdToEmail(macroId) : '';+ // Memoized so the lowercased search string is built once (and only rebuilt+ // when the name resolves), not re-allocated for every member on each scan.+ const haystack = createMemo(() =>+ `${displayName()} ${email}`.toLowerCase()+ );+ return { member, haystack };+ });++ // Only worth showing the filter once the list is long enough to scan.+ const showMemberSearch = () => members().length > 5;++ const filteredMembers = createMemo(() => {+ const q = debouncedMemberQuery().trim().toLowerCase();+ if (!q) return members();+ // Shared uFuzzy-backed filter (ranks by relevance, favoring contiguity).+ return fuzzyFilter(q, memberSearchIndex(), (entry) => entry.haystack()).map(+ (entry) => entry.member+ );+ });+const isOwner = createMemo(() => {const currentUserId = userId();if (!currentUserId) return false;@@ -877,8 +997,13 @@ function TeamManagement(props: {const newName = editingTeamName()?.trim();if (!props.teamId || !newName) return;+ // Validate against the same schema as the create flow (e.g. max length)+ // so rename can't push a name the create path would reject.+ const parsed = teamNameSchema.safeParse(newName);+ if (!parsed.success) return;+patchTeamMutation.mutate(- { teamId: props.teamId, request: { name: newName } },+ { teamId: props.teamId, request: { name: parsed.data } },{ onSuccess: () => setEditingTeamName(undefined) });};@@ -903,8 +1028,13 @@ function TeamManagement(props: {if (!props.teamId || editedSlug === undefined) return;if (!validateTeamSlug(editedSlug) || !hasTeamSlugChanged()) return;+ // Persist the normalized slug so the saved value matches the "Will save as"+ // preview (and the backend's UPPERCASE_UNDERSCORE format).patchTeamMutation.mutate(- { teamId: props.teamId, request: { slug: editedSlug } },+ {+ teamId: props.teamId,+ request: { slug: normalizeTeamSlugInput(editedSlug) },+ },{onSuccess: () => {setEditingTeamSlug(undefined);@@ -993,29 +1123,15 @@ function TeamManagement(props: {};return (- <>- <Panel.Header class="justify-between px-6">- <div class="text-sm font-semibold">Team</div>- <Show when={isOwner()}>- <div class="flex items-center gap-2">- <Button- variant="base"- size="sm"- class="rounded-xs"- tooltip={- requiresUpgrade()- ? 'Inviting members requires a paid plan'- : undefined- }- onClick={() =>- requiresUpgrade()- ? showPaywall()- : setShowInviteModal(true)- }- >- <PlusIcon class="size-4" />- Invite- </Button>+ <>+ <div+ class="grid size-full min-h-0 gap-2"+ style={{ 'grid-template-rows': 'min-content minmax(0, 1fr)' }}+ >+ <Panel depth={2} class="overflow-hidden text-ink">+ <Panel.Header class="justify-between px-6">+ <div class="text-sm font-semibold">Team</div>+ <Show when={isOwner()}><Buttonvariant="danger"size="sm"@@ -1025,201 +1141,254 @@ function TeamManagement(props: {<TrashIcon class="size-4" />Delete Team</Button>- </div>- </Show>- </Panel.Header>-- <Panel.Body>- <div class="flex h-full flex-col">- <div class="flex flex-col gap-2 px-2 py-2 border-b border-edge-muted shrink-0">- <div class="flex items-center justify-between w-full border border-edge rounded-sm px-4 py-2">- <span class="text-sm text-ink-muted">Name</span>- <Show- when={isOwner()}- fallback={<span class="text-sm text-ink">{props.teamName}</span>}+ </Show>+ </Panel.Header>+ <Panel.Body class="@container">+ <div class="grid grid-cols-1 items-start gap-2 px-2 py-2 @[680px]:grid-cols-2">+ <MetadataRow+ label="Name"+ hint="What your team is called — shown in invitations and billing.">- <div class="flex items-center gap-2">- <input- type="text"- value={teamNameValue()}- onInput={(e) => setEditingTeamName(e.currentTarget.value)}- placeholder="Enter team name"- class="text-sm bg-surface border-none outline-none text-ink text-right w-48"- />- <Show when={hasTeamNameChanged()}>- <div class="flex items-center gap-1 shrink-0">- <Tooltip label="Save">- <Button- variant="active"- size="icon-sm"- class="rounded-xs"- disabled={- patchTeamMutation.isPending ||- !editingTeamName()?.trim()+ <Show+ when={isOwner()}+ fallback={+ <ReadOnlyField+ value={props.teamName}+ tooltip="Only the team owner can change the team name."+ />+ }+ >+ <div class="flex items-center gap-2">+ <input+ type="text"+ value={teamNameValue()}+ onInput={(e) => setEditingTeamName(e.currentTarget.value)}+ onKeyDown={(e) => {+ if (e.key === 'Enter') {+ if (+ hasTeamNameChanged() &&+ editingTeamName()?.trim()+ ) {+ handleSaveTeamName();}- onClick={handleSaveTeamName}- >- <Show- when={patchTeamMutation.isPending}- fallback={<CheckIcon class="size-4" />}- >- <SpinnerIcon class="size-4 animate-spin" />- </Show>- </Button>- </Tooltip>- <Tooltip label="Cancel">- <Button- variant="ghost"- size="icon-sm"- class="rounded-xs"- disabled={patchTeamMutation.isPending}- onClick={handleCancelTeamNameEdit}- >- <XIcon class="size-4" />- </Button>- </Tooltip>+ } else if (e.key === 'Escape') {+ handleCancelTeamNameEdit();+ e.currentTarget.blur();+ }+ }}+ placeholder="Enter team name"+ class={cn(TEAM_FIELD_CLASS, 'border-edge-muted')}+ />+ <Show when={hasTeamNameChanged()}>+ <SaveCancelButtons+ onSave={handleSaveTeamName}+ onCancel={handleCancelTeamNameEdit}+ saveDisabled={+ patchTeamMutation.isPending ||+ !editingTeamName()?.trim()+ }+ pending={patchTeamMutation.isPending}+ />+ </Show>+ </div>+ </Show>+ </MetadataRow>+ <MetadataRow+ label="Slug"+ hint="Short code in task references like ENG-42 (GitHub, branch names)."+ >+ <Show+ when={isOwner()}+ fallback={+ <ReadOnlyField+ value={props.teamSlug}+ tooltip="Only the team owner can change the team slug."+ />+ }+ >+ <div class="flex items-center gap-2">+ <div class="flex flex-col items-end gap-1 min-w-0">+ <input+ type="text"+ value={teamSlugValue()}+ onInput={(e) =>+ handleTeamSlugChange(e.currentTarget.value)+ }+ onKeyDown={(e) => {+ if (e.key === 'Enter') {+ if (canSaveTeamSlug()) handleSaveTeamSlug();+ } else if (e.key === 'Escape') {+ handleCancelTeamSlugEdit();+ e.currentTarget.blur();+ }+ }}+ placeholder="Enter team slug"+ class={TEAM_FIELD_CLASS}+ classList={{+ 'border-failure': !!teamSlugError(),+ 'border-edge-muted': !teamSlugError(),+ }}+ />+ <Show when={teamSlugError()}>+ <p class="text-xs text-failure-ink text-right">+ {teamSlugError()}+ </p>+ </Show>+ <Show when={normalizedTeamSlugPreview()}>+ <p class="text-xs text-ink-muted text-right">+ Will save as {normalizedTeamSlugPreview()}+ </p>+ </Show></div>- </Show>- </div>- </Show>+ <Show when={hasTeamSlugInputChanged()}>+ <SaveCancelButtons+ onSave={handleSaveTeamSlug}+ onCancel={handleCancelTeamSlugEdit}+ saveDisabled={!canSaveTeamSlug()}+ pending={patchTeamMutation.isPending}+ />+ </Show>+ </div>+ </Show>+ </MetadataRow></div>- <div class="flex items-center justify-between w-full border border-edge rounded-sm px-4 py-2 gap-3">- <span class="text-sm text-ink-muted">Slug</span>- <Show- when={isOwner()}- fallback={- <span class="text-sm text-ink">{props.teamSlug}</span>+ </Panel.Body>+ </Panel>++ <Panel depth={2} class="min-h-0 overflow-hidden text-ink">+ <Panel.Header class="justify-between px-6">+ <div class="text-sm font-semibold">Members</div>+ <Show when={isOwner()}>+ <Button+ variant="base"+ size="sm"+ class="rounded-xs"+ tooltip={+ requiresUpgrade()+ ? 'Inviting members requires a paid plan'+ : undefined+ }+ onClick={() =>+ requiresUpgrade() ? showPaywall() : setShowInviteModal(true)}>- <div class="flex items-center gap-2 min-w-0">- <div class="flex flex-col items-end gap-1 min-w-0">+ <PlusIcon class="size-4" />+ Invite+ </Button>+ </Show>+ </Panel.Header>+ <Panel.Body>+ <div class="flex h-full flex-col">+ <Show when={showMemberSearch()}>+ <div class="px-6 py-2 shrink-0">+ <label class="flex items-center gap-2 h-8 px-2.5 rounded-lg border border-edge-muted text-ink-muted focus-within:border-accent focus-within:text-ink">+ <MagnifyingGlassIcon class="size-4 shrink-0" /><inputtype="text"- value={teamSlugValue()}- onInput={(e) =>- handleTeamSlugChange(e.currentTarget.value)- }- onBlur={() => {- const editing = editingTeamSlug();- if (editing !== undefined) {- validateTeamSlug(editing);- }- }}- placeholder="Enter team slug"- class="text-sm bg-surface border-none outline-none text-ink text-right w-48"+ value={memberQuery()}+ onInput={(e) => setMemberQuery(e.currentTarget.value)}+ placeholder="Filter members"+ class="flex-1 min-w-0 bg-transparent text-sm text-ink outline-none placeholder:text-ink-extra-muted"/>- <Show when={teamSlugError()}>- <p class="text-xs text-failure-ink text-right">- {teamSlugError()}- </p>+ <Show when={memberQuery()}>+ <button+ type="button"+ class="shrink-0 text-ink-muted hover:text-ink"+ aria-label="Clear filter"+ onClick={() => setMemberQuery('')}+ >+ <XIcon class="size-4" />+ </button></Show>- <Show when={normalizedTeamSlugPreview()}>- <p class="text-xs text-ink-muted text-right">- Will save as {normalizedTeamSlugPreview()}- </p>- </Show>- </div>- <Show when={hasTeamSlugInputChanged()}>- <div class="flex items-center gap-1 shrink-0">- <Tooltip label="Save">- <Button- variant="active"- size="icon-sm"- class="rounded-xs"- disabled={!canSaveTeamSlug()}- onClick={handleSaveTeamSlug}- >- <Show- when={patchTeamMutation.isPending}- fallback={<CheckIcon class="size-4" />}- >- <SpinnerIcon class="size-4 animate-spin" />- </Show>- </Button>- </Tooltip>- <Tooltip label="Cancel">- <Button- variant="ghost"- size="icon-sm"- class="rounded-xs"- disabled={patchTeamMutation.isPending}- onClick={handleCancelTeamSlugEdit}- >- <XIcon class="size-4" />- </Button>- </Tooltip>- </div>- </Show>+ </label></div></Show>- </div>- </div>- <div class="relative min-h-0 flex-1">- <Show- when={!teamQuery.isLoading}- fallback={- <div class="animate-pulse bg-ink-extra-muted rounded h-16" />- }- >- <div- ref={setMemberListWrapperRef}- class="relative h-full min-h-0"- >- <VList- data={members()}- class="h-full scrollbar-hidden"- style={{- height: '100%',- width: '100%',- }}- bufferSize={500}- data-team-members-list-container+ <div class="relative min-h-0 flex-1">+ <Show+ when={!teamQuery.isLoading}+ fallback={+ <div class="animate-pulse bg-ink-extra-muted rounded h-16" />+ }>- {(member, index) => (- <MemberRow- member={member}- isOwner={isOwner()}- isCurrentUser={member.user_id === userId()}- isLast={index() === members().length - 1}- onRemove={() => setShowRemoveModal(member)}- onRoleChange={(newRole) => {- if (!props.teamId) return;- patchTeamMutation.mutate({- teamId: props.teamId,- request: {- user_role_updates: [- { team_user_id: member.user_id, role: newRole },- ],- },- });- }}- />- )}- </VList>- <CustomScrollbar scrollContainer={memberListScrollContainer} />+ <Show+ when={filteredMembers().length > 0}+ fallback={+ <div class="flex justify-center px-6 pt-4 text-center text-sm text-ink-muted">+ No members match “{memberQuery()}”+ </div>+ }+ >+ <div+ ref={setMemberListWrapperRef}+ class="relative h-full min-h-0"+ >+ <VList+ data={filteredMembers()}+ class="h-full scrollbar-hidden"+ style={{+ height: '100%',+ width: '100%',+ }}+ bufferSize={500}+ data-team-members-list-container+ >+ {(member, index) => (+ <MemberRow+ member={member}+ isOwner={isOwner()}+ isCurrentUser={member.user_id === userId()}+ isLast={index() === filteredMembers().length - 1}+ onRemove={() => setShowRemoveModal(member)}+ onRoleChange={(newRole) => {+ if (!props.teamId) return;+ patchTeamMutation.mutate({+ teamId: props.teamId,+ request: {+ user_role_updates: [+ {+ team_user_id: member.user_id,+ role: newRole,+ },+ ],+ },+ });+ }}+ />+ )}+ </VList>+ <CustomScrollbar+ scrollContainer={memberListScrollContainer}+ />+ </div>+ </Show>+ </Show></div>- </Show>- </div>- <Show when={isOwner() && (invitesQuery.data?.invites?.length ?? 0) > 0}>- <section class="px-6 py-4 border-t border-edge-muted shrink-0">- <h3 class="text-sm font-medium mb-2">Pending Invites</h3>- <div class="border border-edge rounded-sm px-3">- <For each={invitesQuery.data?.invites ?? []}>- {(invite) => (- <InviteRow- invite={invite}- isOwner={isOwner()}- onCancel={() => setShowCancelInviteModal(invite)}- />- )}- </For>- </div>- </section>- </Show>- </div>- </Panel.Body>+ <Show+ when={+ isOwner() && (invitesQuery.data?.invites?.length ?? 0) > 0+ }+ >+ <section class="px-6 py-4 border-t border-edge-muted shrink-0">+ <h3 class="text-sm font-medium mb-2">Pending Invites</h3>+ <div class="border border-edge rounded-sm px-3">+ <For each={invitesQuery.data?.invites ?? []}>+ {(invite) => (+ <InviteRow+ invite={invite}+ isOwner={isOwner()}+ onCancel={() => setShowCancelInviteModal(invite)}+ />+ )}+ </For>+ </div>+ </section>+ </Show>+ </div>+ </Panel.Body>+ </Panel>+ </div><Dialogopen={showDeleteTeamModal()}@@ -1227,11 +1396,7 @@ function TeamManagement(props: {><Panel depth={2} active class="max-h-[75vh] text-ink rounded-xl"><Panel.Header class="px-2 gap-1">- <Dialog.CloseButton- as={Button}- variant="ghost"- size="icon-sm"- >+ <Dialog.CloseButton as={Button} variant="ghost" size="icon-sm"><XIcon /></Dialog.CloseButton><Dialog.Title as="span" class="text-sm font-medium p-0 m-0">@@ -1291,11 +1456,7 @@ function TeamManagement(props: {><Panel depth={2} active class="max-h-[75vh] text-ink rounded-xl"><Panel.Header class="px-2 gap-1">- <Dialog.CloseButton- as={Button}- variant="ghost"- size="icon-sm"- >+ <Dialog.CloseButton as={Button} variant="ghost" size="icon-sm"><XIcon /></Dialog.CloseButton><Dialog.Title as="span" class="text-sm font-medium p-0 m-0">@@ -1340,11 +1501,7 @@ function TeamManagement(props: {><Panel depth={2} active class="max-h-[75vh] text-ink rounded-xl"><Panel.Header class="px-2 gap-1">- <Dialog.CloseButton- as={Button}- variant="ghost"- size="icon-sm"- >+ <Dialog.CloseButton as={Button} variant="ghost" size="icon-sm"><XIcon /></Dialog.CloseButton><Dialog.Title as="span" class="text-sm font-medium p-0 m-0">@@ -1352,51 +1509,41 @@ function TeamManagement(props: {</Dialog.Title></Panel.Header><Panel.Body class="p-3 flex flex-col gap-3">- <p>- Are you sure you want to cancel the invitation for{' '}- <span class="font-medium">- {showCancelInviteModal()?.email}- </span>- ?- </p>- <div class="flex justify-end gap-1 pt-2">- <Button- variant="ghost"- class="rounded-xs"- disabled={deleteInviteMutation.isPending}- onClick={() => setShowCancelInviteModal(null)}- >- Keep- </Button>- <Button- variant="danger"- class="rounded-xs"- disabled={deleteInviteMutation.isPending}- onClick={handleCancelInvite}- >- <Show- when={deleteInviteMutation.isPending}- fallback="Cancel Invite"- >- <SpinnerIcon class="size-4 animate-spin" />- </Show>- </Button>- </div>+ <p>+ Are you sure you want to cancel the invitation for{' '}+ <span class="font-medium">{showCancelInviteModal()?.email}</span>?+ </p>+ <div class="flex justify-end gap-1 pt-2">+ <Button+ variant="ghost"+ class="rounded-xs"+ disabled={deleteInviteMutation.isPending}+ onClick={() => setShowCancelInviteModal(null)}+ >+ Keep+ </Button>+ <Button+ variant="danger"+ class="rounded-xs"+ disabled={deleteInviteMutation.isPending}+ onClick={handleCancelInvite}+ >+ <Show+ when={deleteInviteMutation.isPending}+ fallback="Cancel Invite"+ >+ <SpinnerIcon class="size-4 animate-spin" />+ </Show>+ </Button>+ </div></Panel.Body></Panel></Dialog>- <Dialog- open={showInviteModal()}- onOpenChange={handleInviteModalClose}- >+ <Dialog open={showInviteModal()} onOpenChange={handleInviteModalClose}><Panel depth={2} active class="max-h-[75vh] text-ink rounded-xl"><Panel.Header class="px-2 gap-1">- <Dialog.CloseButton- as={Button}- variant="ghost"- size="icon-sm"- >+ <Dialog.CloseButton as={Button} variant="ghost" size="icon-sm"><XIcon /></Dialog.CloseButton><Dialog.Title as="span" class="text-sm font-medium p-0 m-0">@@ -1423,9 +1570,7 @@ function TeamManagement(props: {<Buttonvariant={hasValidInvites() ? 'active' : 'ghost'}class="rounded-xs"- disabled={- !hasValidInvites() || inviteToTeamMutation.isPending- }+ disabled={!hasValidInvites() || inviteToTeamMutation.isPending}onClick={handleInvite}><Show@@ -1485,11 +1630,15 @@ export function Team() {return (<div class="h-full overflow-hidden flex justify-center p-2"><div class="max-w-200 size-full">- <Panel depth={2} class="h-full overflow-hidden text-ink">- <Suspense fallback={<div class="animate-pulse bg-ink-extra-muted rounded h-4 w-32 m-6" />}>- <TeamContent />- </Suspense>- </Panel>+ {/* Each state renders its own Panel(s): TeamManagement is a two-card+ layout (details + members); the others are a single card. */}+ <Suspense+ fallback={+ <div class="animate-pulse bg-ink-extra-muted rounded h-4 w-32 m-6" />+ }+ >+ <TeamContent />+ </Suspense></div></div>);diff --git a/js/app/packages/app/index.css b/js/app/packages/app/index.cssindex 104fe04be4..748f1568b0 100644--- a/js/app/packages/app/index.css+++ b/js/app/packages/app/index.css@@ -406,6 +406,39 @@ a {}}+/* Subtle, inset divider between settings rows (Account/Appearance/Email/Agent).+ Apply to a list container whose direct children are full-width rows with px-6+ padding; draws the line under every row except the last. */+@utility settings-row-dividers {+ & > *:not(:last-child) {+ position: relative;+ &::after {+ content: "";+ position: absolute;+ inset-inline: calc(var(--spacing) * 6);+ bottom: 0;+ height: 1px;+ background-color: color-mix(in oklab, var(--color-ink-muted) 5%, transparent);+ pointer-events: none;+ }+ }+}++/* Row-level variant of `settings-row-dividers` for lists that render rows+ individually (e.g. virtualized). Apply to the row; gate on "not the last row". */+@utility settings-row-divider {+ position: relative;+ &::after {+ content: "";+ position: absolute;+ inset-inline: calc(var(--spacing) * 6);+ bottom: 0;+ height: 1px;+ background-color: color-mix(in oklab, var(--color-ink-muted) 5%, transparent);+ pointer-events: none;+ }+}+@utility no-select-children {* {user-select: none;diff --git a/js/app/packages/ui/components/ToggleSwitch.tsx b/js/app/packages/ui/components/ToggleSwitch.tsxindex ccf225a8d0..f547afd9ba 100644--- a/js/app/packages/ui/components/ToggleSwitch.tsx+++ b/js/app/packages/ui/components/ToggleSwitch.tsx@@ -51,7 +51,7 @@ export const ToggleSwitch = (props: ToggleSwitchProps): JSX.Element => {{...others}><KobalteSwitch.Input class="sr-only" />- <KobalteSwitch.Control class="relative h-4 w-6 rounded-full bg-edge transition-colors duration-100 data-checked:bg-accent">+ <KobalteSwitch.Control class="relative h-4 w-6 rounded-full bg-ink-muted/40 transition-colors duration-100 data-checked:bg-accent"><KobalteSwitch.Thumbclass={cn('absolute top-0.5 left-0.5 h-3 rounded-full bg-surface transition-all duration-100 ease-in-out',