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(sidebar): add mobile app download button to sidebar footer (#7490)
Jacob Beckerman24252169eccc
diff --git a/apps/web/src/components/app/sidebar-next/footer-actions.tsx b/apps/web/src/components/app/sidebar-next/footer-actions.tsxindex 5b7f02e69d..08dffbc5f1 100644--- a/apps/web/src/components/app/sidebar-next/footer-actions.tsx+++ b/apps/web/src/components/app/sidebar-next/footer-actions.tsx@@ -3,8 +3,10 @@ import { globalSplitManager } from '@app/signal/splitLayout';import { SidebarOpenInSplitMenu } from '@components/app/app-sidebar/sidebar';import { UserIcon } from '@core/component/UserIcon';import { useSettingsState } from '@core/constant/SettingsState';+import { useSettingsTabAvailable } from '@core/constant/settingsTabsConfig';import { useEmail, useUserId } from '@core/context/user';import { TOKENS } from '@core/hotkey/tokens';+import DeviceMobileDownloadIcon from '@icon/device-mobile-download.svg';import GearIcon from '@phosphor/gear.svg';import GearFillIcon from '@phosphor-fill/gear-fill.svg';import { isRealNamePart, useOwnUserName } from '@queries/auth/user-name-self';@@ -21,10 +23,61 @@ const AVATAR_CUTOUT =const SETTINGS_CONTENT = { type: 'component', id: 'settings' } as const;+const isSettingsActive = () => {+ const content = globalSplitManager()?.activeSplit()?.content();+ return (+ content?.type === SETTINGS_CONTENT.type &&+ content.id === SETTINGS_CONTENT.id+ );+};++/**+ * Get the mobile app: opens the Mobile App settings page, which carries the+ * App Store QR code. Hidden wherever that page is unavailable, e.g. inside+ * the native app.+ */+const MobileAppButton = () => {+ const analytics = useAnalytics();+ const { openSettings, openSettingsInSplit, activeTabId } = useSettingsState();+ const isTabAvailable = useSettingsTabAvailable();++ const isActive = () => isSettingsActive() && activeTabId() === 'Mobile App';++ const open = (event: MouseEvent) => {+ event.preventDefault();+ analytics.track('sidebar_click', { view: 'mobile-app' });+ if (event.shiftKey) openSettingsInSplit('Mobile App');+ else openSettings('Mobile App');+ };++ return (+ <Show when={isTabAvailable('Mobile App')}>+ <Button+ variant="ghost"+ size="icon-md"+ class={cn(+ 'size-10 cursor-default rounded-xl',+ isActive() && 'bg-hover text-ink'+ )}+ label="Get the mobile app"+ tooltip="Get the mobile app"+ tooltipPlacement="right"+ draggable={false}+ aria-current={isActive() ? 'page' : undefined}+ data-active={isActive() ? '' : undefined}+ data-sidebar-next-item="mobile-app"+ {...pressHandlers(open)}+ >+ <NavGlyph icon={DeviceMobileDownloadIcon} class="size-5" />+ </Button>+ </Show>+ );+};+/**- * The rail's bottom action: Settings, opened like any other rail view. The- * gear carries the signed-in account's photo as a badge, so people with- * several accounts can still tell which one they are in.+ * The rail's bottom actions: the mobile app link, then Settings, opened like+ * any other rail view. The gear carries the signed-in account's photo as a+ * badge, so people with several accounts can still tell which one they are in.*/export const FooterActions = (props: {onMenuOpenChange?: (open: boolean) => void;@@ -45,14 +98,6 @@ export const FooterActions = (props: {return parts.length > 0 ? parts.join(' ') : email();});- const isActive = () => {- const content = globalSplitManager()?.activeSplit()?.content();- return (- content?.type === SETTINGS_CONTENT.type &&- content.id === SETTINGS_CONTENT.id- );- };-// An open settings split keeps its section; a fresh open lands on Account.const currentTab = () => (settingsOpen() ? activeTabId() : undefined);@@ -64,7 +109,8 @@ export const FooterActions = (props: {};return (- <div class="flex w-full shrink-0 justify-center">+ <div class="flex w-full shrink-0 flex-col items-center gap-1">+ <MobileAppButton /><SidebarOpenInSplitMenucontent={() => SETTINGS_CONTENT}// Route through settings state so the menu reuses an open settings@@ -79,7 +125,7 @@ export const FooterActions = (props: {size="icon-md"class={cn('size-10 cursor-default rounded-xl',- isActive() && 'bg-hover text-ink'+ isSettingsActive() && 'bg-hover text-ink')}label="Settings"aria-description={@@ -89,8 +135,8 @@ export const FooterActions = (props: {tooltipPlacement="right"hotkey={TOKENS.global.toggleSettings}draggable={false}- aria-current={isActive() ? 'page' : undefined}- data-active={isActive() ? '' : undefined}+ aria-current={isSettingsActive() ? 'page' : undefined}+ data-active={isSettingsActive() ? '' : undefined}data-sidebar-next-item="settings"{...pressHandlers(open)}>@@ -98,7 +144,7 @@ export const FooterActions = (props: {<NavGlyphicon={GearIcon}iconActive={GearFillIcon}- filled={isActive()}+ filled={isSettingsActive()}class={AVATAR_CUTOUT}/><div class="absolute -right-1.5 -bottom-1.5 size-4 rounded-full">diff --git a/apps/web/src/components/icon/device-mobile-download.svg b/apps/web/src/components/icon/device-mobile-download.svgnew file mode 100644index 0000000000..14d2311e3c--- /dev/null+++ b/apps/web/src/components/icon/device-mobile-download.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M176,16H80A24,24,0,0,0,56,40V216a24,24,0,0,0,24,24h96a24,24,0,0,0,24-24V40A24,24,0,0,0,176,16ZM72,64H184V192H72Zm8-32h96a8,8,0,0,1,8,8v8H72V40A8,8,0,0,1,80,32Zm96,192H80a8,8,0,0,1-8-8v-8H184v8A8,8,0,0,1,176,224Z"/><path d="M128,92v72M100,136l28,28,28-28" fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/></svg>