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(web): drop the sidebar rail's footer action buttons (#6534)

Jacob Beckerman5a52778b7843
diff --git a/apps/web/src/components/app/sidebar-next/footer-actions.tsx b/apps/web/src/components/app/sidebar-next/footer-actions.tsx
index 60d4d4b1e4..bb1b7e21ef 100644
--- a/apps/web/src/components/app/sidebar-next/footer-actions.tsx
+++ b/apps/web/src/components/app/sidebar-next/footer-actions.tsx
@@ -1,35 +1,19 @@
-import { runCreateAction } from '@app/features/command/Launcher';
-import { globalSplitManager } from '@app/signal/splitLayout';
-import { CALENDAR_BLOCK_ID } from '@block-calendar/types';
import { SidebarSettingsWidget } from '@components/app/app-sidebar/sidebar';
-import {
- enableChatV3Agents,
- isFeatureEnabled,
-} from '@core/constant/featureFlags';
import {
type SettingsTab,
useSettingsState,
} from '@core/constant/SettingsState';
import { useSettingsTabAvailable } from '@core/constant/settingsTabsConfig';
-import { TOKENS } from '@core/hotkey/tokens';
-import CalendarPlusIcon from '@phosphor/calendar-plus.svg';
-import SparkleIcon from '@phosphor/sparkle.svg';
-import { Button } from '@ui';
-import { Show } from 'solid-js';
-import { MoreAppsPopover } from './more-apps-popover';
-import { useNavItemGates } from './use-nav-item-gates';
/**
- * The rail's bottom actions, stacked: new AI chat, calendar in a new split, and
- * the More Apps grid, with the account card below a divider. Settings is
- * reached from that card's menu rather than its own button.
+ * The rail's bottom actions: the account card. Settings is reached from that
+ * card's menu rather than its own button.
*/
export const FooterActions = (props: {
onMenuOpenChange?: (open: boolean) => void;
}) => {
const { openSettings, selectTab, settingsOpen } = useSettingsState();
const isTabAvailable = useSettingsTabAvailable();
- const gates = useNavItemGates();
// Same handling as `AppSidebar`: retarget the panel when it is already open
// rather than reopening it, and ignore tabs this account cannot reach.
@@ -42,79 +26,23 @@ export const FooterActions = (props: {
openSettings(tab);
};
- const canOpenNewSplit = () => globalSplitManager()?.canAppendSplit() ?? true;
-
- const openCalendarInNewSplit = () => {
- const manager = globalSplitManager();
- if (!manager?.canAppendSplit()) return;
- manager.createNewSplit({
- content: { type: 'calendar', id: CALENDAR_BLOCK_ID },
- activate: true,
- allowDuplicate: false,
- referredFrom: 'sidebar',
- });
- };
-
return (
- <div class="flex w-full shrink-0 flex-col gap-2">
- <div class="flex w-full flex-col items-center gap-1">
- <Button
- size="icon-md"
- variant="ghost"
- class="text-ink-subtle hover:text-ink rounded-xl"
- label="New AI chat in a new split"
- hotkey={TOKENS.create.chatNewSplit}
- onClick={() =>
- // The two creatables both bind `a` and are mutually exclusive on the
- // agents flag, so pick the one that is actually registered.
- // `shouldInsert` is what `createBlock` turns into `preferNewSplit`.
- runCreateAction(
- isFeatureEnabled(enableChatV3Agents) ? 'agent' : 'chat',
- {
- shouldInsert: true,
- source: 'sidebar',
- }
- )
- }
- >
- <SparkleIcon />
- </Button>
-
- <Show when={gates().showCalendar}>
- <Button
- size="icon-md"
- variant="ghost"
- class="text-ink-subtle hover:text-ink rounded-xl"
- label="Open calendar in a new split"
- disabled={!canOpenNewSplit()}
- onClick={openCalendarInNewSplit}
- >
- <CalendarPlusIcon />
- </Button>
- </Show>
-
- <MoreAppsPopover onOpenChange={props.onMenuOpenChange} />
- </div>
-
- {/* Inset within the sidebar's `px-3` rather than breaking out of it, so
- the rule stops short of the edges. `my-2` sits on top of the wrapper's
- `gap-2`, giving it 16px of clearance above and below. */}
- <div class="my-2 h-px shrink-0 self-stretch bg-edge-muted" />
-
- {/*
- The account card from the old sidebar, reused whole. Its trigger already
- collapses to the bare avatar under that sidebar's slim contract, so the
- group is scoped to this wrapper — setting `data-slim` on the rail root
- would expose every descendant to those selectors.
- */}
- <div class="group/sidebar flex w-full justify-center" data-slim="true">
- <SidebarSettingsWidget
- compact
- isSlim={() => true}
- onSelect={openSettingsTab}
- onMenuOpenChange={props.onMenuOpenChange}
- />
- </div>
+ /*
+ The account card from the old sidebar, reused whole. Its trigger already
+ collapses to the bare avatar under that sidebar's slim contract, so the
+ group is scoped to this wrapper — setting `data-slim` on the rail root
+ would expose every descendant to those selectors.
+ */
+ <div
+ class="group/sidebar flex w-full shrink-0 justify-center"
+ data-slim="true"
+ >
+ <SidebarSettingsWidget
+ compact
+ isSlim={() => true}
+ onSelect={openSettingsTab}
+ onMenuOpenChange={props.onMenuOpenChange}
+ />
</div>
);
};
diff --git a/apps/web/src/components/app/sidebar-next/more-apps-popover.tsx b/apps/web/src/components/app/sidebar-next/more-apps-popover.tsx
deleted file mode 100644
index 8474b2561c..0000000000
--- a/apps/web/src/components/app/sidebar-next/more-apps-popover.tsx
+++ /dev/null
@@ -1,93 +0,0 @@
-import { sidebarContent } from '@components/app/app-sidebar/sidebar';
-import { isTauri } from '@core/util/platform';
-import { openExternalUrl } from '@core/util/url';
-import SquaresFourIcon from '@phosphor/squares-four.svg';
-import { Button, Dropdown } from '@ui';
-import { createSignal, For } from 'solid-js';
-import { NavGlyph } from './nav-glyph';
-import { type SidebarNextNavItem, visibleNavItems } from './nav-items';
-import { splitContentUrl } from './urls';
-import { useNavItemGates } from './use-nav-item-gates';
-
-/**
- * One cell of the grid. A real `<a href>` so cmd-click, middle-click and the
- * browser's own "open in new tab" work — the point of the grid. Plain
- * left-click still routes through `openExternalUrl`, because Tauri needs a
- * `_self` navigation to hand the URL to the system browser.
- *
- * The only surface in the rail that isn't a `Button`: it stacks a label under
- * the glyph, and has no active state of its own — every entry opens a new tab —
- * so the outline-to-fill swap runs off hover instead.
- */
-const AppTile = (props: { item: SidebarNextNavItem }) => {
- const [hovering, setHovering] = createSignal(false);
- const url = () =>
- splitContentUrl(sidebarContent(props.item.id, props.item.params));
-
- return (
- <a
- href={url()}
- target="_blank"
- rel="noopener noreferrer"
- draggable={false}
- data-sidebar-next-tile={props.item.id}
- class="flex aspect-square cursor-default select-none flex-col items-center justify-center gap-2 rounded-xl text-[12px] text-ink outline-none transition-colors duration-150 ease-out hover:bg-hover focus-visible:ring-2 focus-visible:ring-accent/40 motion-reduce:transition-none"
- onMouseEnter={() => setHovering(true)}
- onMouseLeave={() => setHovering(false)}
- onClick={(event) => {
- // Let the browser handle the modified clicks it already does better
- // than we can.
- if (
- event.button !== 0 ||
- event.metaKey ||
- event.ctrlKey ||
- event.shiftKey ||
- event.altKey
- ) {
- return;
- }
- if (!isTauri()) return;
- event.preventDefault();
- openExternalUrl(new URL(url(), window.location.origin).href);
- }}
- >
- <NavGlyph
- icon={props.item.icon}
- iconActive={props.item.iconActive}
- filled={hovering()}
- class="size-6"
- />
- <span class="max-w-full truncate">{props.item.label}</span>
- </a>
- );
-};
-
-/** The grid of every nav, each opening in a new browser tab. */
-export const MoreAppsPopover = (props: {
- onOpenChange?: (open: boolean) => void;
-}) => {
- const gates = useNavItemGates();
-
- return (
- <Dropdown onOpenChange={props.onOpenChange} placement="top" gutter={8}>
- <Dropdown.Trigger
- as={Button}
- size="icon-md"
- variant="ghost"
- class="text-ink-subtle hover:text-ink rounded-xl"
- label="More apps"
- >
- <SquaresFourIcon />
- </Dropdown.Trigger>
- <Dropdown.Content class="w-72 rounded-2xl">
- {/* Group rather than a bare div: it paints the `bg-menu` ground that
- Content's inner `bg-edge-muted` wrapper otherwise shows through. */}
- <Dropdown.Group class="grid grid-cols-3 gap-2 rounded-2xl p-3">
- <For each={visibleNavItems(gates())}>
- {(item) => <AppTile item={item} />}
- </For>
- </Dropdown.Group>
- </Dropdown.Content>
- </Dropdown>
- );
-};
diff --git a/apps/web/src/components/app/sidebar-next/urls.ts b/apps/web/src/components/app/sidebar-next/urls.ts
deleted file mode 100644
index 6ea49a2ef2..0000000000
--- a/apps/web/src/components/app/sidebar-next/urls.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { ROUTER_BASE_CONCAT } from '@app/constants/routerBase';
-import type { SplitContent } from '@components/app/split-layout/layoutManager';
-
-/**
- * The browser URL a split content deserializes from, e.g.
- * `/app/component/documents` or `/app/calendar/view`.
- *
- * Mirrors `contentUrlSegments` in `layoutManager` and the `decodePairs` reader
- * in `layoutUtils`: the layout URL is `<type>/<id>` pairs, so the bare
- * `LIST_VIEW_PATHS` entries (`/documents`) are *not* usable as tab URLs —
- * `decodePairs` breaks on the missing id and falls back to the inbox.
- */
-export const splitContentUrl = (content: SplitContent): string => {
- // Aliased blocks serialise under their alias, matching `getAliasOrType`.
- const type =
- content.type === 'component'
- ? content.type
- : (content.aliasContext?.alias ?? content.type);
- return `${ROUTER_BASE_CONCAT}${type}/${content.id}`;
-};