Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(style): clean up settings menu styling (#4030)

Aidan Holloway-Bidwella8873cb32a69
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/inbox-selector.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/inbox-selector.tsx
index 51c02cafc8..5c441a34f9 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/inbox-selector.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/inbox-selector.tsx
@@ -54,7 +54,7 @@ export function InboxSelector() {
label: 'Add inbox',
icon: () => <PlusIcon class="size-4" />,
onSelect: () => {
- openSettings('Account');
+ openSettings('Email');
openAddInboxDialog();
},
}
diff --git a/js/app/packages/app/component/paywall/PaywallTeamMemberView.tsx b/js/app/packages/app/component/paywall/PaywallTeamMemberView.tsx
index 61827c42b4..168395ceef 100644
--- a/js/app/packages/app/component/paywall/PaywallTeamMemberView.tsx
+++ b/js/app/packages/app/component/paywall/PaywallTeamMemberView.tsx
@@ -1,8 +1,11 @@
+import UsersThreeIcon from '@phosphor/users-three.svg';
+
const PaywallTeamMemberView = () => (
<div class="relative space-y-2 w-full">
<div class="p-4 sm:p-5 border border-edge flex flex-col gap-3 text-left rounded-sm">
<div class="flex justify-between items-start">
- <div class="font-semibold text-ink text-base sm:text-lg">
+ <div class="flex items-center gap-2 font-semibold text-ink text-base sm:text-lg">
+ <UsersThreeIcon class="size-5 shrink-0 text-accent" />
Team subscription
</div>
</div>
diff --git a/js/app/packages/app/component/settings/Account.tsx b/js/app/packages/app/component/settings/Account.tsx
index 0cf0d1c395..18fd5c7a17 100644
--- a/js/app/packages/app/component/settings/Account.tsx
+++ b/js/app/packages/app/component/settings/Account.tsx
@@ -14,11 +14,7 @@ import {
import { ShowFeatureFlag, useFeatureFlag } from '@app/lib/analytics/posthog';
import {
DISABLE_AUTO_UPDATE_UI_FLAG,
- ENABLE_EMAIL,
ENABLE_AUTO_UPDATE_UI_OVERRIDE,
- ENABLE_INBOX_RESYNC,
- ENABLE_INBOX_SYNC_STATUS,
- ENABLE_MULTI_INBOX_OVERRIDE,
ENABLE_PROFILE_PICTURES,
ENABLE_NEW_PRICING_OVERRIDE,
} from '@core/constant/featureFlags';
@@ -32,20 +28,13 @@ import {
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 ArrowsClockwiseIcon from '@phosphor-icons/core/regular/arrows-clockwise.svg?component-solid';
-import PlusIcon from '@phosphor-icons/core/regular/plus.svg?component-solid';
import { authServiceClient } from '@service-auth/client';
-import {
- type Link as EmailLink,
- SyncStatus,
-} from '@service-email/generated/schemas';
import { useEmail, useLicenseStatus, useUserId } from '@core/context/user';
import {
createEffect,
createMemo,
createResource,
createSignal,
- For,
type JSX,
Match,
Show,
@@ -57,9 +46,6 @@ import { useSettingsState } from '@core/constant/SettingsState';
import PaywallComponent from '../paywall/PaywallComponent';
import PaywallTeamMemberView from '../paywall/PaywallTeamMemberView';
import PaywallTeamOwnerView from '../paywall/PaywallTeamOwnerView';
-import { useEmailLinks, useEmailLinksStatus } from '@core/email-link';
-import { AddInboxDialog, openAddInboxDialog } from '../AddInboxDialog';
-import { useRemoveInboxMutation } from '@queries/email/link';
import {
type SupportedNotificationSettings,
useNotificationSettings,
@@ -74,8 +60,6 @@ false && fileSelector;
// 16 megabytes
const MAX_PROFILE_PICTURE_SIZE = 16 * 1000 * 1000;
-type GithubLinkStatus = 'linked' | 'unlinked' | 'reauthentication_required';
-
async function uploadProfilePicture(
file: File
): Promise<{ id: string; url: string } | void> {
@@ -262,9 +246,6 @@ function ProfilePictureRow(props: { userId: string }) {
// Not accessible if user is not authenticated
export function Account() {
const email = useEmail();
- const multiInboxFlag = useFeatureFlag('enable-multi-inbox', {
- enabledOverride: ENABLE_MULTI_INBOX_OVERRIDE,
- });
const userId = useUserId();
const licenseStatus = useLicenseStatus();
const logout = useLogout();
@@ -276,41 +257,9 @@ export function Account() {
const autoUpdateUIEnabled = createMemo(
() => ENABLE_AUTO_UPDATE_UI_OVERRIDE ?? !disableAutoUpdateUIFlag().enabled
);
- const [showEmailModal, setShowEmailModal] = createSignal<boolean>(false);
const [showDeleteModal, setShowDeleteModal] = createSignal<boolean>(false);
const [showDeleteConfirmModal, setShowDeleteConfirmModal] = createSignal<boolean>(false);
- const {
- query: emailLinksQuery,
- connect: connectEmail,
- disconnect: disconnectEmail,
- resyncInbox,
- } = useEmailLinks();
- const removeInboxMutation = useRemoveInboxMutation({
- onSuccess: () => toast.success('Inbox removed'),
- onError: () => toast.failure('Failed to remove inbox. Please try again.'),
- });
- const [removeTarget, setRemoveTarget] = createSignal<{
- id: string;
- email: string;
- isOwn: boolean;
- } | null>(null);
- const [resyncingIds, setResyncingIds] = createSignal<ReadonlySet<string>>(
- new Set()
- );
-
- // The primary inbox is the user's own is_primary link; it sorts to the top
- // and is labelled. Everything else (other own inboxes + delegated/shared) follows.
- const inboxes = createMemo(() => {
- const links = emailLinksQuery.data?.links ?? [];
- const uid = userId();
- const primary = links.find(
- (link) => link.is_primary && link.macro_id === uid
- );
- const others = links.filter((link) => link !== primary);
- return { primary, others };
- });
-
const userTeamsQuery = useUserTeamsQuery();
const ownedTeam = createMemo(() => {
const teams = userTeamsQuery.data;
@@ -333,84 +282,6 @@ export function Account() {
string | undefined
>(undefined);
- const emailActive = useEmailLinksStatus();
-
- const [isEmailActionPending, setIsEmailActionPending] = createSignal(false);
-
- const onConnectEmail = async () => {
- if (isEmailActionPending()) return;
- setIsEmailActionPending(true);
- await connectEmail().match(
- () => {},
- () => toast.failure('Failed to connect email')
- );
- setIsEmailActionPending(false);
- };
-
-
- const handleResyncInbox = async (linkId: string) => {
- setResyncingIds((prev) => new Set(prev).add(linkId));
- await resyncInbox(linkId).match(
- (res) => {
- toast.success(
- res.already_in_progress ? 'Sync already in progress' : 'Re-sync started'
- );
- },
- () => toast.failure('Failed to start re-sync')
- );
- setResyncingIds((prev) => {
- const next = new Set(prev);
- next.delete(linkId);
- return next;
- });
- };
-
- const handleRemoveInbox = () => {
- const target = removeTarget();
- if (!target) return;
- setRemoveTarget(null);
- removeInboxMutation.mutate(target.id);
- };
-
- const [githubLinkStatus, { refetch: refetchGithubLinkStatus }] =
- createResource(async (): Promise<GithubLinkStatus> => {
- const response = await authServiceClient.checkGithubLinkStatus();
-
- if (response.isOk()) {
- return response.value.reauthentication_required
- ? 'reauthentication_required'
- : 'linked';
- }
-
- const needsReauthentication = response.error.some(
- (error) => error.code === 'REAUTHENTICATION_REQUIRED'
- );
- return needsReauthentication ? 'reauthentication_required' : 'unlinked';
- });
-
- const handleGithubEnable = async () => {
- const url = await authServiceClient.initGithubLink(window.location.href);
- if (url.isOk()) {
- window.location.href = url.value;
- }
- };
-
- const handleGithubDisable = async () => {
- await authServiceClient.deleteGithubLink();
- refetchGithubLinkStatus();
- };
-
- const handleGithubReconnect = async () => {
- const url = await authServiceClient.reauthenticateGithub(
- window.location.href
- );
- if (url.isOk()) {
- window.location.href = url.value;
- } else {
- toast.failure('Failed to start GitHub reconnect flow');
- }
- };
-
const firstName = () => {
// Display any updated first name immediately without having to refetch
if (updatedFirstName() !== undefined) return updatedFirstName();
@@ -542,221 +413,15 @@ export function Account() {
<BundleUpdateRow />
</Show>
- <Show when={ENABLE_EMAIL && !multiInboxFlag().enabled}>
- <Row
- label={
- showEmailModal()
- ? 'Disabling will clear all email data from Macro'
- : 'Email'
- }
- >
- <Show
- when={showEmailModal()}
- fallback={
- <Show
- when={!emailActive()}
- fallback={
- <Button
- variant="base"
- size="sm"
- depth={3}
- disabled={isEmailActionPending()}
- onClick={() => setShowEmailModal(true)}
- >
- Disable
- </Button>
- }
- >
- <Button
- variant="base"
- size="sm"
- depth={3}
- disabled={isEmailActionPending()}
- onClick={onConnectEmail}
- >
- Enable
- </Button>
- </Show>
- }
- >
- <div class="flex flex-row">
- <Button
- variant="ghost"
- size="sm"
- depth={3}
- disabled={isEmailActionPending()}
- onClick={async () => {
- if (isEmailActionPending()) return;
- setIsEmailActionPending(true);
- await disconnectEmail().match(
- () => {
- setShowEmailModal(false);
- toast.success(
- 'Email disabled — clearing your data.'
- );
- },
- () => {
- toast.failure(
- 'Failed to disable email. Please try again.'
- );
- }
- );
- setIsEmailActionPending(false);
- }}
- >
- Confirm
- </Button>
- <Button
- variant="ghost"
- size="sm"
- depth={3}
- onClick={() => setShowEmailModal(false)}
- >
- Cancel
- </Button>
- </div>
- </Show>
- </Row>
- </Show>
-
- <Show when={ENABLE_EMAIL && multiInboxFlag().enabled}>
- <div class="bg-surface">
- <div class="flex items-center justify-between h-15.25 px-6">
- <div class="text-sm">Inboxes</div>
- <Show
- when={!emailLinksQuery.isLoading}
- fallback={
- <span class="text-sm text-ink-muted">Loading…</span>
- }
- >
- <Show
- when={emailActive()}
- fallback={
- <Button
- variant="base"
- size="sm"
- depth={3}
- disabled={isEmailActionPending()}
- onClick={onConnectEmail}
- >
- Enable
- </Button>
- }
- >
- <Tooltip label="Add inbox">
- <Button
- variant="base"
- size="sm"
- depth={3}
- onClick={openAddInboxDialog}
- aria-label="Add inbox"
- >
- <PlusIcon class="size-4" />
- </Button>
- </Tooltip>
- </Show>
- </Show>
- </div>
- <Show when={emailActive()}>
- <Show when={inboxes().primary}>
- {(primary) => (
- <InboxRow
- link={primary()}
- isPrimary
- isOwn={primary().macro_id === userId()}
- resyncing={resyncingIds().has(primary().id)}
- onResync={() => handleResyncInbox(primary().id)}
- onRemove={() =>
- setRemoveTarget({
- id: primary().id,
- email: primary().email_address,
- isOwn: primary().macro_id === userId(),
- })
- }
- />
- )}
- </Show>
- <Show when={!inboxes().primary && email()}>
- <DisabledPrimaryRow
- email={email() ?? ''}
- onEnable={onConnectEmail}
- />
- </Show>
- <For each={inboxes().others}>
- {(link) => (
- <InboxRow
- link={link}
- isPrimary={false}
- isOwn={link.macro_id === userId()}
- resyncing={resyncingIds().has(link.id)}
- onResync={() => handleResyncInbox(link.id)}
- onRemove={() =>
- setRemoveTarget({
- id: link.id,
- email: link.email_address,
- isOwn: link.macro_id === userId(),
- })
- }
- />
- )}
- </For>
- </Show>
- </div>
- </Show>
-
- <Row label="GitHub">
- <Show
- when={!githubLinkStatus.loading}
- fallback={
- <span class="text-sm text-ink-muted">Loading…</span>
- }
- >
- <Switch
- fallback={
- <Button
- variant="base"
- size="sm"
- depth={3}
- onClick={handleGithubEnable}
- >
- Enable
- </Button>
- }
- >
- <Match
- when={githubLinkStatus() === 'reauthentication_required'}
- >
- <Button
- variant="base"
- size="sm"
- depth={3}
- onClick={handleGithubReconnect}
- >
- Reconnect
- </Button>
- </Match>
- <Match when={githubLinkStatus() === 'linked'}>
- <Button
- variant="base"
- size="sm"
- depth={3}
- onClick={handleGithubDisable}
- >
- Disable
- </Button>
- </Match>
- </Switch>
- </Show>
- </Row>
-
<NotificationToggle />
</div>
- <div class="flex items-center justify-end h-10 px-6">
+ <div class="flex items-center justify-center px-6 py-6">
<Button
- variant="base"
- size="sm"
+ variant="danger"
+ size="md"
depth={3}
+ class="px-4"
onClick={logoutHandler}
>
<SignOutIcon class="size-4" />
@@ -764,58 +429,6 @@ export function Account() {
</Button>
</div>
- <Dialog
- open={removeTarget() !== null}
- onOpenChange={(open) => {
- if (!open) setRemoveTarget(null);
- }}
- position="center"
- class="w-120"
- >
- <Panel active depth={2} class="rounded-xl">
- <Panel.Header class="px-6">
- <Dialog.Title class="text-ink text-sm font-semibold">
- Remove inbox
- </Dialog.Title>
- </Panel.Header>
- <Panel.Body class="p-6 font-sans flex flex-col gap-3">
- <Dialog.Description class="text-ink-muted text-sm/tight font-normal">
- <Show
- when={removeTarget()?.isOwn}
- fallback={
- <>
- Remove access to{' '}
- <span class="text-ink">{removeTarget()?.email}</span>?
- The inbox and its data stay with its owner.
- </>
- }
- >
-
- Remove{' '}
- <span class="text-ink">{removeTarget()?.email}</span>?
- This clears all of its email data from Macro and cannot be
- undone.
-
- </Show>
- </Dialog.Description>
- <div class="pt-3 justify-end items-center gap-3 inline-flex">
- <Button
- variant="base"
- depth={3}
- onClick={() => setRemoveTarget(null)}
- >
- Cancel
- </Button>
- <Button variant="danger" depth={3} onClick={handleRemoveInbox}>
- Remove
- </Button>
- </div>
- </Panel.Body>
- </Panel>
- </Dialog>
-
- <AddInboxDialog />
-
<Show when={isNativeMobilePlatform()}>
<div class="border-t border-edge pt-4">
<Button variant="danger" depth={3} onClick={() => setShowDeleteModal(true)}>
@@ -898,127 +511,6 @@ function Row(props: { label: string; children?: any }) {
);
}
-function syncStatusLabel(status: SyncStatus): string {
- switch (status) {
- case SyncStatus.SYNCING:
- return 'Syncing…';
- case SyncStatus.UP_TO_DATE:
- return 'Up to date';
- case SyncStatus.ERROR:
- return 'Error — re-sync';
- case SyncStatus.INACTIVE:
- return 'Disabled';
- }
-}
-
-function Chip(props: { label: string }) {
- return (
- <span class="shrink-0 rounded bg-edge-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-ink-muted">
- {props.label}
- </span>
- );
-}
-
-// Placeholder shown when the account's primary inbox has been removed but other
-// inboxes remain. It is not a real link — re-enabling re-runs the Gmail enable
-// flow, which re-links and backfills.
-function DisabledPrimaryRow(props: { email: string; onEnable: () => void }) {
- return (
- <div class="bg-surface flex items-center justify-between gap-3 h-15.25 px-6">
- <div class="min-w-0 flex flex-col gap-0.5">
- <div class="flex items-center gap-2 min-w-0">
- <span class="ph-no-capture text-sm truncate text-ink-muted">
- {props.email}
- </span>
- <Chip label="Primary" />
- <Chip label="Disabled" />
- </div>
- <span class="text-xs text-ink-muted">Sync disabled</span>
- </div>
- <Button variant="base" size="sm" depth={3} onClick={props.onEnable}>
- Enable
- </Button>
- </div>
- );
-}
-
-function InboxRow(props: {
- link: EmailLink;
- isPrimary: boolean;
- isOwn: boolean;
- resyncing: boolean;
- onResync: () => void;
- onRemove: () => void;
-}) {
- return (
- <div class="bg-surface flex items-center justify-between gap-3 h-15.25 px-6">
- <div class="min-w-0 flex flex-col gap-0.5">
- <div class="flex items-center gap-2 min-w-0">
- <span class="ph-no-capture text-sm truncate">
- {props.link.email_address}
- </span>
- <Show when={props.isPrimary}>
- <Chip label="Primary" />
- </Show>
- <Show when={!props.isPrimary && !props.isOwn}>
- <Chip label="Shared" />
- </Show>
- </div>
- <Show
- when={
- ENABLE_INBOX_SYNC_STATUS &&
- props.link.sync_status !== SyncStatus.UP_TO_DATE
- }
- >
- <span
- class="flex items-center gap-1 text-xs"
- classList={{
- 'text-failure': props.link.sync_status === SyncStatus.ERROR,
- 'text-ink-muted': props.link.sync_status !== SyncStatus.ERROR,
- }}
- >
- <Show when={props.link.sync_status === SyncStatus.SYNCING}>
- <ArrowsClockwiseIcon class="size-3 animate-spin" />
- </Show>
- {syncStatusLabel(props.link.sync_status)}
- </span>
- </Show>
- </div>
- <div class="flex items-center gap-2 shrink-0">
- <Show when={ENABLE_INBOX_RESYNC}>
- <Tooltip label="Force sync">
- <Button
- variant="base"
- size="sm"
- depth={3}
- disabled={
- props.resyncing ||
- (ENABLE_INBOX_SYNC_STATUS &&
- props.link.sync_status === SyncStatus.SYNCING)
- }
- onClick={props.onResync}
- aria-label={`Force sync ${props.link.email_address}`}
- >
- <ArrowsClockwiseIcon class="size-4" />
- </Button>
- </Tooltip>
- </Show>
- <Tooltip label="Remove inbox">
- <Button
- variant="base"
- size="sm"
- depth={3}
- onClick={props.onRemove}
- aria-label={`Remove ${props.link.email_address}`}
- >
- <XIcon class="size-4" />
- </Button>
- </Tooltip>
- </div>
- </div>
- );
-}
-
function NameInput(props: {
value?: string;
placeholder?: string;
diff --git a/js/app/packages/app/component/settings/Agent.tsx b/js/app/packages/app/component/settings/Agent.tsx
index 277b11fdae..00eff6fe0f 100644
--- a/js/app/packages/app/component/settings/Agent.tsx
+++ b/js/app/packages/app/component/settings/Agent.tsx
@@ -1,5 +1,6 @@
import { 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 { McpSetupCards } from '@core/component/AI/component/McpSetupCards';
import { toast } from '@core/component/Toast/Toast';
@@ -332,15 +333,18 @@ function Connectors() {
return (
<div class="px-6 py-4 flex flex-col gap-4">
- <div class="flex items-center justify-between">
- <div class="text-sm">
- Connect the Macro agent to external MCP servers
- </div>
+ <div class="flex items-center justify-between gap-4">
+ <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>
diff --git a/js/app/packages/app/component/settings/Email.tsx b/js/app/packages/app/component/settings/Email.tsx
new file mode 100644
index 0000000000..448cd37cc1
--- /dev/null
+++ b/js/app/packages/app/component/settings/Email.tsx
@@ -0,0 +1,468 @@
+import { toast } from '@core/component/Toast/Toast';
+import { match } from 'ts-pattern';
+import { Button, Dialog, Panel, Tooltip } from '@ui';
+import { useFeatureFlag } from '@app/lib/analytics/posthog';
+import {
+ ENABLE_INBOX_RESYNC,
+ ENABLE_INBOX_SYNC_STATUS,
+ ENABLE_MULTI_INBOX_OVERRIDE,
+} from '@core/constant/featureFlags';
+import WideEmailIcon from '@icon/wide-email.svg';
+import XIcon from '@phosphor-icons/core/regular/x.svg?component-solid';
+import ArrowsClockwiseIcon from '@phosphor-icons/core/regular/arrows-clockwise.svg?component-solid';
+import PlusIcon from '@phosphor-icons/core/regular/plus.svg?component-solid';
+import {
+ type Link as EmailLink,
+ SyncStatus,
+} from '@service-email/generated/schemas';
+import { useEmail, useUserId } from '@core/context/user';
+import { createMemo, createSignal, For, Show } from 'solid-js';
+import { useEmailLinks, useEmailLinksStatus } from '@core/email-link';
+import { AddInboxDialog, openAddInboxDialog } from '../AddInboxDialog';
+import { useRemoveInboxMutation } from '@queries/email/link';
+import {
+ ConnectionHero,
+ IntegrationPanelShell,
+ StatusPill,
+} from './integration-ui';
+
+export function Email() {
+ const email = useEmail();
+ const userId = useUserId();
+ const multiInboxFlag = useFeatureFlag('enable-multi-inbox', {
+ enabledOverride: ENABLE_MULTI_INBOX_OVERRIDE,
+ });
+
+ const {
+ query: emailLinksQuery,
+ connect: connectEmail,
+ disconnect: disconnectEmail,
+ resyncInbox,
+ } = useEmailLinks();
+ const emailActive = useEmailLinksStatus();
+
+ const removeInboxMutation = useRemoveInboxMutation({
+ onSuccess: () => toast.success('Inbox removed'),
+ onError: () => toast.failure('Failed to remove inbox. Please try again.'),
+ });
+ const [removeTarget, setRemoveTarget] = createSignal<{
+ id: string;
+ email: string;
+ isOwn: boolean;
+ } | null>(null);
+ const [resyncingIds, setResyncingIds] = createSignal<ReadonlySet<string>>(
+ new Set()
+ );
+ const [showDisableDialog, setShowDisableDialog] = createSignal(false);
+ const [isEmailActionPending, setIsEmailActionPending] = createSignal(false);
+
+ // The primary inbox is the user's own is_primary link; it sorts to the top
+ // and is labelled. Everything else (other own inboxes + delegated/shared) follows.
+ const inboxes = createMemo(() => {
+ const links = emailLinksQuery.data?.links ?? [];
+ const uid = userId();
+ const primary = links.find(
+ (link) => link.is_primary && link.macro_id === uid
+ );
+ const others = links.filter((link) => link !== primary);
+ return { primary, others };
+ });
+
+ const onConnectEmail = async () => {
+ if (isEmailActionPending()) return;
+ setIsEmailActionPending(true);
+ await connectEmail().match(
+ () => {},
+ () => toast.failure('Failed to connect email')
+ );
+ setIsEmailActionPending(false);
+ };
+
+ const onDisconnectEmail = async () => {
+ if (isEmailActionPending()) return;
+ setIsEmailActionPending(true);
+ await disconnectEmail().match(
+ () => {
+ setShowDisableDialog(false);
+ toast.success('Email disabled — clearing your data.');
+ },
+ () => toast.failure('Failed to disable email. Please try again.')
+ );
+ setIsEmailActionPending(false);
+ };
+
+ const handleResyncInbox = async (linkId: string) => {
+ setResyncingIds((prev) => new Set(prev).add(linkId));
+ await resyncInbox(linkId).match(
+ (res) => {
+ toast.success(
+ res.already_in_progress
+ ? 'Sync already in progress'
+ : 'Re-sync started'
+ );
+ },
+ () => toast.failure('Failed to start re-sync')
+ );
+ setResyncingIds((prev) => {
+ const next = new Set(prev);
+ next.delete(linkId);
+ return next;
+ });
+ };
+
+ const handleRemoveInbox = () => {
+ const target = removeTarget();
+ if (!target) return;
+ setRemoveTarget(null);
+ removeInboxMutation.mutate(target.id);
+ };
+
+ return (
+ <IntegrationPanelShell title="Email">
+ <Show
+ when={multiInboxFlag().enabled}
+ fallback={
+ <ConnectionHero
+ icon={WideEmailIcon}
+ title="Email"
+ description="Connect your Gmail account so Macro can read, organize, and act on your email."
+ status={
+ <StatusPill
+ state={emailActive() ? 'connected' : 'disconnected'}
+ label={emailActive() ? 'Connected' : 'Not connected'}
+ />
+ }
+ >
+ <Show
+ when={emailActive()}
+ fallback={
+ <Button
+ variant="cta"
+ size="md"
+ depth={3}
+ disabled={isEmailActionPending()}
+ onClick={onConnectEmail}
+ >
+ Connect Gmail
+ </Button>
+ }
+ >
+ <Button
+ variant="base"
+ size="md"
+ depth={3}
+ disabled={isEmailActionPending()}
+ onClick={() => setShowDisableDialog(true)}
+ >
+ Disconnect
+ </Button>
+ </Show>
+ </ConnectionHero>
+ }
+ >
+ <Show
+ when={emailActive()}
+ fallback={
+ <ConnectionHero
+ icon={WideEmailIcon}
+ title="Email"
+ description="Connect your Gmail accounts so Macro can read, organize, and act on your email."
+ status={<StatusPill state="disconnected" label="Not connected" />}
+ >
+ <Button
+ variant="cta"
+ size="md"
+ depth={3}
+ disabled={isEmailActionPending()}
+ onClick={onConnectEmail}
+ >
+ Connect Gmail
+ </Button>
+ </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
+ </div>
+ <p class="text-sm text-ink-muted">
+ Gmail accounts Macro can read and act on.
+ </p>
+ </div>
+ <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={openAddInboxDialog}
+ >
+ <PlusIcon class="size-4" />
+ Add inbox
+ </Button>
+ </Show>
+ </div>
+
+ <div class="grid gap-px bg-edge-muted border-b border-edge-muted">
+ <Show when={inboxes().primary}>
+ {(primary) => (
+ <InboxRow
+ link={primary()}
+ isPrimary
+ isOwn={primary().macro_id === userId()}
+ resyncing={resyncingIds().has(primary().id)}
+ onResync={() => handleResyncInbox(primary().id)}
+ onRemove={() =>
+ setRemoveTarget({
+ id: primary().id,
+ email: primary().email_address,
+ isOwn: primary().macro_id === userId(),
+ })
+ }
+ />
+ )}
+ </Show>
+ <Show when={!inboxes().primary && email()}>
+ <DisabledPrimaryRow
+ email={email() ?? ''}
+ onEnable={onConnectEmail}
+ />
+ </Show>
+ <For each={inboxes().others}>
+ {(link) => (
+ <InboxRow
+ link={link}
+ isPrimary={false}
+ isOwn={link.macro_id === userId()}
+ resyncing={resyncingIds().has(link.id)}
+ onResync={() => handleResyncInbox(link.id)}
+ onRemove={() =>
+ setRemoveTarget({
+ id: link.id,
+ email: link.email_address,
+ isOwn: link.macro_id === userId(),
+ })
+ }
+ />
+ )}
+ </For>
+ </div>
+ </Show>
+ </Show>
+
+ <AddInboxDialog />
+
+ <Dialog
+ open={removeTarget() !== null}
+ onOpenChange={(open) => {
+ if (!open) setRemoveTarget(null);
+ }}
+ position="center"
+ class="w-120"
+ >
+ <Panel active depth={2} class="rounded-xl">
+ <Panel.Header class="px-6">
+ <Dialog.Title class="text-ink text-sm font-semibold">
+ Remove inbox
+ </Dialog.Title>
+ </Panel.Header>
+ <Panel.Body class="p-6 font-sans flex flex-col gap-3">
+ <Dialog.Description class="text-ink-muted text-sm/tight font-normal">
+ <Show
+ when={removeTarget()?.isOwn}
+ fallback={
+ <>
+ Remove access to{' '}
+ <span class="text-ink">{removeTarget()?.email}</span>? The
+ inbox and its data stay with its owner.
+ </>
+ }
+ >
+ Remove <span class="text-ink">{removeTarget()?.email}</span>?
+ This clears all of its email data from Macro and cannot be
+ undone.
+ </Show>
+ </Dialog.Description>
+ <div class="pt-3 justify-end items-center gap-3 inline-flex">
+ <Button
+ variant="base"
+ depth={3}
+ onClick={() => setRemoveTarget(null)}
+ >
+ Cancel
+ </Button>
+ <Button variant="danger" depth={3} onClick={handleRemoveInbox}>
+ Remove
+ </Button>
+ </div>
+ </Panel.Body>
+ </Panel>
+ </Dialog>
+
+ <Dialog
+ open={showDisableDialog()}
+ onOpenChange={setShowDisableDialog}
+ position="center"
+ class="w-120"
+ >
+ <Panel active depth={2} class="rounded-xl">
+ <Panel.Header class="px-6">
+ <Dialog.Title class="text-ink text-sm font-semibold">
+ Disconnect email
+ </Dialog.Title>
+ </Panel.Header>
+ <Panel.Body class="p-6 font-sans flex flex-col gap-3">
+ <Dialog.Description class="text-ink-muted text-sm/tight font-normal">
+ Disconnecting will clear all email data from Macro. This cannot be
+ undone.
+ </Dialog.Description>
+ <div class="pt-3 justify-end items-center gap-3 inline-flex">
+ <Button
+ variant="base"
+ depth={3}
+ disabled={isEmailActionPending()}
+ onClick={() => setShowDisableDialog(false)}
+ >
+ Cancel
+ </Button>
+ <Button
+ variant="danger"
+ depth={3}
+ disabled={isEmailActionPending()}
+ onClick={onDisconnectEmail}
+ >
+ Disconnect
+ </Button>
+ </div>
+ </Panel.Body>
+ </Panel>
+ </Dialog>
+ </IntegrationPanelShell>
+ );
+}
+
+function syncStatusLabel(status: SyncStatus): string {
+ return match(status)
+ .with(SyncStatus.SYNCING, () => 'Syncing…')
+ .with(SyncStatus.UP_TO_DATE, () => 'Up to date')
+ .with(SyncStatus.ERROR, () => 'Error — re-sync')
+ .with(SyncStatus.INACTIVE, () => 'Disabled')
+ .exhaustive();
+}
+
+function Chip(props: { label: string }) {
+ return (
+ <span class="shrink-0 rounded bg-edge-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-ink-muted">
+ {props.label}
+ </span>
+ );
+}
+
+// Placeholder shown when the account's primary inbox has been removed but other
+// inboxes remain. It is not a real link — re-enabling re-runs the Gmail enable
+// flow, which re-links and backfills.
+function DisabledPrimaryRow(props: { email: string; onEnable: () => void }) {
+ return (
+ <div class="bg-surface flex items-center justify-between gap-3 h-15.25 px-6">
+ <div class="min-w-0 flex flex-col gap-0.5">
+ <div class="flex items-center gap-2 min-w-0">
+ <span class="ph-no-capture text-sm truncate text-ink-muted">
+ {props.email}
+ </span>
+ <Chip label="Primary" />
+ <Chip label="Disabled" />
+ </div>
+ <span class="text-xs text-ink-muted">Sync disabled</span>
+ </div>
+ <Button variant="base" size="sm" depth={3} onClick={props.onEnable}>
+ Enable
+ </Button>
+ </div>
+ );
+}
+
+function InboxRow(props: {
+ link: EmailLink;
+ isPrimary: boolean;
+ isOwn: boolean;
+ resyncing: boolean;
+ onResync: () => void;
+ onRemove: () => void;
+}) {
+ return (
+ <div class="bg-surface flex items-center justify-between gap-3 h-15.25 px-6">
+ <div class="min-w-0 flex flex-col gap-0.5">
+ <div class="flex items-center gap-2 min-w-0">
+ <span class="ph-no-capture text-sm truncate">
+ {props.link.email_address}
+ </span>
+ <Show when={props.isPrimary}>
+ <Chip label="Primary" />
+ </Show>
+ <Show when={!props.isPrimary && !props.isOwn}>
+ <Chip label="Shared" />
+ </Show>
+ </div>
+ <Show
+ when={
+ ENABLE_INBOX_SYNC_STATUS &&
+ props.link.sync_status !== SyncStatus.UP_TO_DATE
+ }
+ >
+ <span
+ class="flex items-center gap-1 text-xs"
+ classList={{
+ 'text-failure': props.link.sync_status === SyncStatus.ERROR,
+ 'text-ink-muted': props.link.sync_status !== SyncStatus.ERROR,
+ }}
+ >
+ <Show when={props.link.sync_status === SyncStatus.SYNCING}>
+ <ArrowsClockwiseIcon class="size-3 animate-spin" />
+ </Show>
+ {syncStatusLabel(props.link.sync_status)}
+ </span>
+ </Show>
+ </div>
+ <div class="flex items-center gap-2 shrink-0">
+ <Show when={ENABLE_INBOX_RESYNC}>
+ <Tooltip label="Force sync">
+ <Button
+ variant="base"
+ size="sm"
+ depth={3}
+ disabled={
+ props.resyncing ||
+ (ENABLE_INBOX_SYNC_STATUS &&
+ props.link.sync_status === SyncStatus.SYNCING)
+ }
+ onClick={props.onResync}
+ aria-label={`Force sync ${props.link.email_address}`}
+ >
+ <ArrowsClockwiseIcon class="size-4" />
+ </Button>
+ </Tooltip>
+ </Show>
+ <Tooltip label="Remove inbox">
+ <Button
+ variant="base"
+ size="sm"
+ depth={3}
+ onClick={props.onRemove}
+ aria-label={`Remove ${props.link.email_address}`}
+ >
+ <XIcon class="size-4" />
+ </Button>
+ </Tooltip>
+ </div>
+ </div>
+ );
+}
diff --git a/js/app/packages/app/component/settings/GitHub.tsx b/js/app/packages/app/component/settings/GitHub.tsx
new file mode 100644
index 0000000000..c69ffb8f86
--- /dev/null
+++ b/js/app/packages/app/component/settings/GitHub.tsx
@@ -0,0 +1,156 @@
+import { toast } from '@core/component/Toast/Toast';
+import GithubIcon from '@icon/mcp-github.svg';
+import { authServiceClient } from '@service-auth/client';
+import { createResource, Show } from 'solid-js';
+import { match } from 'ts-pattern';
+import { Button } from '@ui';
+import {
+ ConnectionHero,
+ type ConnectionState,
+ IntegrationPanelShell,
+ StatusPill,
+} from './integration-ui';
+
+type GithubLinkStatus = 'linked' | 'unlinked' | 'reauthentication_required';
+
+type GithubLink = {
+ status: GithubLinkStatus;
+ // Populated once the auth service starts returning the linked account's
+ // handle on /link/github/status. Until then it stays undefined and the
+ // username line below simply doesn't render.
+ username?: string;
+};
+
+export function GitHub() {
+ const [githubLink, { refetch: refetchGithubLink }] = createResource(
+ async (): Promise<GithubLink> => {
+ const response = await authServiceClient.checkGithubLinkStatus();
+
+ if (response.isOk()) {
+ // `github_username` is not yet part of the generated response schema;
+ // read it defensively so the UI lights up automatically once the
+ // backend includes it.
+ const username =
+ (response.value as { github_username?: string | null })
+ .github_username ?? undefined;
+ return {
+ status: response.value.reauthentication_required
+ ? 'reauthentication_required'
+ : 'linked',
+ username,
+ };
+ }
+
+ const needsReauthentication = response.error.some(
+ (error) => error.code === 'REAUTHENTICATION_REQUIRED'
+ );
+ return {
+ status: needsReauthentication
+ ? 'reauthentication_required'
+ : 'unlinked',
+ };
+ }
+ );
+
+ const status = () => githubLink()?.status;
+
+ const handleGithubEnable = async () => {
+ const url = await authServiceClient.initGithubLink(window.location.href);
+ if (url.isOk()) {
+ window.location.href = url.value;
+ }
+ };
+
+ const handleGithubDisable = async () => {
+ await authServiceClient.deleteGithubLink();
+ refetchGithubLink();
+ };
+
+ const handleGithubReconnect = async () => {
+ const url = await authServiceClient.reauthenticateGithub(
+ window.location.href
+ );
+ if (url.isOk()) {
+ window.location.href = url.value;
+ } else {
+ toast.failure('Failed to start GitHub reconnect flow');
+ }
+ };
+
+ const pill = (): { state: ConnectionState; label: string } =>
+ match(status())
+ .with('linked', () => ({ state: 'connected', label: 'Connected' }) as const)
+ .with(
+ 'reauthentication_required',
+ () => ({ state: 'attention', label: 'Reconnect required' }) as const
+ )
+ .otherwise(
+ () => ({ state: 'disconnected', label: 'Not connected' }) as const
+ );
+
+ return (
+ <IntegrationPanelShell title="GitHub">
+ <Show
+ when={!githubLink.loading}
+ fallback={
+ <div class="flex items-center justify-center pt-24 text-sm text-ink-muted">
+ Loading…
+ </div>
+ }
+ >
+ <ConnectionHero
+ 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">
+ <StatusPill state={pill().state} label={pill().label} />
+ <Show when={status() === 'linked' && githubLink()?.username}>
+ {(username) => (
+ <span class="ph-no-capture text-sm text-ink">
+ @{username()}
+ </span>
+ )}
+ </Show>
+ </div>
+ }
+ >
+ <Show when={status() === 'reauthentication_required'}>
+ <Button
+ variant="cta"
+ size="md"
+ depth={3}
+ onClick={handleGithubReconnect}
+ >
+ Reconnect
+ </Button>
+ </Show>
+ <Show when={status() === 'linked'}>
+ <Button
+ variant="base"
+ size="md"
+ depth={3}
+ onClick={handleGithubDisable}
+ >
+ Disconnect
+ </Button>
+ </Show>
+ <Show
+ when={
+ status() !== 'linked' && status() !== 'reauthentication_required'
+ }
+ >
+ <Button
+ variant="cta"
+ size="md"
+ depth={3}
+ onClick={handleGithubEnable}
+ >
+ Connect GitHub
+ </Button>
+ </Show>
+ </ConnectionHero>
+ </Show>
+ </IntegrationPanelShell>
+ );
+}
diff --git a/js/app/packages/app/component/settings/Settings.tsx b/js/app/packages/app/component/settings/Settings.tsx
index c0b8cdb7aa..44c9a9ff37 100644
--- a/js/app/packages/app/component/settings/Settings.tsx
+++ b/js/app/packages/app/component/settings/Settings.tsx
@@ -8,6 +8,8 @@ import { Admin } from './Admin';
import { Appearance } from './Appearance';
import { MobileTabs } from '@core/component/MobileTabs';
import { Account } from './Account';
+import { Email } from './Email';
+import { GitHub } from './GitHub';
import { Shortcuts } from './Shortcuts';
import { Team } from './Team';
import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';
@@ -144,7 +146,7 @@ function SettingsPanel(props: SettingsPanelProps) {
<MobileTabs
list={flatTabs().map((tab) => ({ value: tab.tab, label: tab.label }))}
value={activeTabId()}
- defaultValue="Appearance"
+ defaultValue="Account"
onChange={handleTabChange}
/>
</div>
@@ -208,6 +210,16 @@ function SettingsPanel(props: SettingsPanelProps) {
<Team />
</Suspense>
</Show>
+ <Show when={isCurrentTab('Email')}>
+ <Suspense>
+ <Email />
+ </Suspense>
+ </Show>
+ <Show when={isCurrentTab('GitHub')}>
+ <Suspense>
+ <GitHub />
+ </Suspense>
+ </Show>
<Show when={isCurrentTab('Mobile App')}>
<MobileApp />
</Show>
diff --git a/js/app/packages/app/component/settings/integration-ui.tsx b/js/app/packages/app/component/settings/integration-ui.tsx
new file mode 100644
index 0000000000..e933b62bba
--- /dev/null
+++ b/js/app/packages/app/component/settings/integration-ui.tsx
@@ -0,0 +1,77 @@
+import { Panel } from '@ui';
+import { type Component, type JSX, Show } from 'solid-js';
+import { Dynamic } from 'solid-js/web';
+
+/**
+ * Shared chrome for the spare, single-purpose integration panels (Email,
+ * GitHub) nested under the Workspace settings group. Mirrors the Account
+ * panel's centered, max-width column so the settings panels feel consistent.
+ */
+export function IntegrationPanelShell(props: {
+ title: string;
+ children: JSX.Element;
+}) {
+ 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">
+ <Panel.Header class="px-6">
+ <div class="text-sm font-semibold">{props.title}</div>
+ </Panel.Header>
+ <Panel.Body scroll class="text-ink">
+ {props.children}
+ </Panel.Body>
+ </Panel>
+ </div>
+ </div>
+ );
+}
+
+/**
+ * Generous, centered hero used as the resting state of an integration panel:
+ * an icon tile, a title, a one-line explanation, an optional status pill and
+ * the primary action(s). Leans on whitespace rather than filler to make a
+ * sparse page feel intentional.
+ */
+export function ConnectionHero(props: {
+ icon: Component<{ class?: string }>;
+ title: string;
+ description: string;
+ status?: JSX.Element;
+ children?: JSX.Element;
+}) {
+ return (
+ <div class="flex flex-col items-center text-center gap-5 px-6 pt-20 pb-12">
+ <div class="flex size-16 items-center justify-center rounded-2xl bg-edge-muted">
+ <Dynamic component={props.icon} class="size-8 text-ink" />
+ </div>
+ <div class="flex flex-col items-center gap-2 max-w-100">
+ <div class="text-lg font-semibold text-ink">{props.title}</div>
+ <p class="text-sm/relaxed text-ink-muted">{props.description}</p>
+ </div>
+ <Show when={props.status}>{props.status}</Show>
+ <Show when={props.children}>
+ <div class="flex items-center gap-2 pt-1">{props.children}</div>
+ </Show>
+ </div>
+ );
+}
+
+export type ConnectionState = 'connected' | 'attention' | 'disconnected';
+
+/** Small dot-and-label pill conveying an integration's connection state. */
+export function StatusPill(props: { state: ConnectionState; label: string }) {
+ return (
+ <span
+ class="inline-flex items-center gap-1.5 rounded-full border border-edge-muted bg-surface px-2.5 py-1 text-xs font-medium"
+ classList={{
+ 'text-success': props.state === 'connected',
+ 'text-failure': props.state === 'attention',
+ 'text-ink-muted': props.state === 'disconnected',
+ }}
+ >
+ <span class="size-1.5 rounded-full bg-current" />
+ {props.label}
+ </span>
+ );
+}
diff --git a/js/app/packages/core/constant/SettingsState.tsx b/js/app/packages/core/constant/SettingsState.tsx
index 065669aac8..791d36da5a 100644
--- a/js/app/packages/core/constant/SettingsState.tsx
+++ b/js/app/packages/core/constant/SettingsState.tsx
@@ -15,9 +15,11 @@ export type SettingsTab =
| 'Mobile App'
| 'Agent'
| 'Team'
+ | 'Email'
+ | 'GitHub'
| 'Admin';
-const [activeTabId, setActiveTabId] = createSignal<SettingsTab>('Appearance');
+const [activeTabId, setActiveTabId] = createSignal<SettingsTab>('Account');
export type AgentSettingsSubTab = 'connectors' | 'mcp_server';
export const [agentSettingsSubTab, setAgentSettingsSubTab] =
diff --git a/js/app/packages/core/constant/settingsTabsConfig.tsx b/js/app/packages/core/constant/settingsTabsConfig.tsx
index f1b5c34f64..63d0c64c33 100644
--- a/js/app/packages/core/constant/settingsTabsConfig.tsx
+++ b/js/app/packages/core/constant/settingsTabsConfig.tsx
@@ -1,6 +1,8 @@
import { useFeatureFlag } from '@app/lib/analytics/posthog';
import BugIcon from '@phosphor/bug.svg';
import DeviceMobileIcon from '@phosphor/device-mobile-speaker.svg';
+import EnvelopeIcon from '@phosphor/envelope.svg';
+import GithubLogoIcon from '@phosphor/github-logo.svg';
import KeyboardIcon from '@phosphor/keyboard.svg';
import PaintBucketIcon from '@phosphor/paint-bucket.svg';
import PlugIcon from '@phosphor/plug.svg';
@@ -13,6 +15,7 @@ import { isTouchDevice } from '../mobile/isTouchDevice';
import {
DEV_MODE_ENV,
ENABLE_APP_STORE_QR_CODE,
+ ENABLE_EMAIL,
ENABLE_TEAMS_OVERRIDE,
} from './featureFlags';
import { PERMISSION_IDS } from './permissions';
@@ -41,8 +44,8 @@ export const SETTINGS_TAB_GROUPS: SettingsTabGroup[] = [
{
label: 'General',
items: [
- { tab: 'Appearance', label: 'Appearance', icon: PaintBucketIcon },
{ tab: 'Account', label: 'Account', icon: UserIconPhosphor },
+ { tab: 'Appearance', label: 'Appearance', icon: PaintBucketIcon },
{ tab: 'Mobile App', label: 'Mobile App', icon: DeviceMobileIcon },
{ tab: 'Shortcuts', label: 'Shortcuts', icon: KeyboardIcon },
],
@@ -51,6 +54,8 @@ export const SETTINGS_TAB_GROUPS: SettingsTabGroup[] = [
label: 'Workspace',
items: [
{ tab: 'Team', label: 'Team', icon: UsersThreeIcon },
+ { tab: 'Email', label: 'Email', icon: EnvelopeIcon },
+ { tab: 'GitHub', label: 'GitHub', icon: GithubLogoIcon },
{ tab: 'Agent', label: 'MCPs', icon: PlugIcon },
],
},
@@ -92,6 +97,10 @@ export const useSettingsTabAvailable = () => {
return true;
case 'Team':
return teamsFlag().enabled;
+ case 'Email':
+ return ENABLE_EMAIL;
+ case 'GitHub':
+ return true;
case 'Shortcuts':
return !isTouchDevice();
case 'Mobile App':