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.

fix(projects): collapse section tabs to icons in narrow splits (#9201)

gbirmand5367dead779
diff --git a/apps/web/src/components/entity-detail/EntityDetailTopBar.tsx b/apps/web/src/components/entity-detail/EntityDetailTopBar.tsx
index 8bd983f914..094d30cd79 100644
--- a/apps/web/src/components/entity-detail/EntityDetailTopBar.tsx
+++ b/apps/web/src/components/entity-detail/EntityDetailTopBar.tsx
@@ -1,15 +1,36 @@
import { SidePanel } from '@components/app/side-panel';
+import { createElementSize } from '@solid-primitives/resize-observer';
import { cn } from '@ui';
-import { type JSX, type ParentProps, Show } from 'solid-js';
+import {
+ type Accessor,
+ createMemo,
+ createSignal,
+ type JSX,
+ type ParentProps,
+ Show,
+} from 'solid-js';
import { ViewBreadcrumbs, ViewShell } from '../view-shell';
import { EntityDetailBreadcrumbSkeleton } from './EntityDetailBreadcrumbSkeleton';
+/** Header actions drop their labels first, at `@max-[600px]/split-header`. */
+const COMPACT_NAVIGATION_WIDTH = 600;
+
/** The shared Tasks detail chrome for tasks and native projects. */
export function EntityDetailTopBar(
- props: ParentProps<{ navigation?: JSX.Element; titleMenu?: JSX.Element }>
+ props: ParentProps<{
+ /** Collapses while `compact`, so the title keeps its room. */
+ navigation?: (compact: Accessor<boolean>) => JSX.Element;
+ titleMenu?: JSX.Element;
+ }>
) {
+ const [topBar, setTopBar] = createSignal<HTMLDivElement>();
+ const size = createElementSize(topBar);
+ const compact = createMemo(
+ () => (size.width ?? Infinity) < COMPACT_NAVIGATION_WIDTH
+ );
return (
<ViewShell.TopBar
+ ref={setTopBar}
class={cn(
'touch:flex touch:h-auto touch:min-h-12 touch:pt-[calc(var(--mobile-content-inset-top,var(--safe-top,0px))+0.75rem)]',
props.navigation && 'gap-3'
@@ -22,7 +43,7 @@ export function EntityDetailTopBar(
{props.titleMenu}
</ViewBreadcrumbs.Outlet>
<Show when={props.navigation}>
- <div class="min-w-0 overflow-x-auto">{props.navigation}</div>
+ {(navigation) => <div class="shrink-0">{navigation()(compact)}</div>}
</Show>
<div class="ml-auto flex shrink-0 items-center gap-2 touch:gap-1">
<SidePanel.HeaderActionsOutlet />
diff --git a/apps/web/src/features/crm/browser-test/mobile-insets.tsx b/apps/web/src/features/crm/browser-test/mobile-insets.tsx
index e7d484f0e3..1e84789357 100644
--- a/apps/web/src/features/crm/browser-test/mobile-insets.tsx
+++ b/apps/web/src/features/crm/browser-test/mobile-insets.tsx
@@ -52,11 +52,11 @@ function Fixture() {
<SidePanel.Root defaultOpen={false}>
<ViewBreadcrumbs.Root value="project" onChange={() => {}}>
<EntityDetailTopBar
- navigation={
+ navigation={() => (
<Button onClick={() => setSection('tasks')}>
Project tasks
</Button>
- }
+ )}
/>
</ViewBreadcrumbs.Root>
</SidePanel.Root>
diff --git a/apps/web/src/features/projects/project-detail.tsx b/apps/web/src/features/projects/project-detail.tsx
index 22d87e6b18..3c8680a553 100644
--- a/apps/web/src/features/projects/project-detail.tsx
+++ b/apps/web/src/features/projects/project-detail.tsx
@@ -5,6 +5,7 @@ import {
makeCopyLinkAction,
} from '@app/features/next-soup/actions';
import type { ComposeTaskProps } from '@app/features/task-composer/core/types';
+import { t } from '@app/lib/i18n';
import { useNavigate } from '@app/lib/split-router';
import {
projectDetailRoute,
@@ -17,10 +18,12 @@ import {
useSplitDisplayName,
useSplitPanelOrThrow,
} from '@components/app/split-layout/layoutUtils';
+import { getIconConfig } from '@core/component/EntityIcon';
import { toast } from '@core/component/Toast/Toast';
import { ShareTrigger } from '@core/component/TopBar/ShareButton';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { fireAndForget } from '@core/util/fireAndForget';
+import SquaresFourIcon from '@icon/system/regular/squares-four.svg';
import StackIcon from '@icon/system/regular/stack.svg';
import { SYSTEM_PROPERTY_IDS } from '@property/identifiers';
import type { Property } from '@property/types';
@@ -255,19 +258,28 @@ function ProjectDetailHost(props: ProjectDetailProps) {
)}
</Show>
}
- navigation={
+ navigation={(compact) => (
<Tabs
- aria-label="Project sections"
+ aria-label={t('tabs.projectSections')}
touch="inset"
class="shrink-0"
options={[
- { value: 'overview', label: 'Overview' },
- { value: 'tasks', label: 'Tasks' },
+ {
+ value: 'overview',
+ label: t('tabs.project-overview'),
+ icon: compact() ? SquaresFourIcon : undefined,
+ },
+ {
+ value: 'tasks',
+ label: t('tabs.project-tasks'),
+ icon: compact() ? getIconConfig('task').icon : undefined,
+ },
]}
+ iconOnly={compact()}
value={props.route.section}
onChange={section}
/>
- }
+ )}
>
<Show when={source.project()}>
{(project) => (
diff --git a/apps/web/src/lib/i18n/locales/en/tabs.ts b/apps/web/src/lib/i18n/locales/en/tabs.ts
index bc3a535a6a..851466ab02 100644
--- a/apps/web/src/lib/i18n/locales/en/tabs.ts
+++ b/apps/web/src/lib/i18n/locales/en/tabs.ts
@@ -20,4 +20,9 @@ export default {
'record-tasks': 'Tasks',
'record-calls': 'Calls',
'record-databases': 'Databases',
+
+ // Project sections.
+ projectSections: 'Project sections',
+ 'project-overview': 'Overview',
+ 'project-tasks': 'Tasks',
};
diff --git a/docs/agent-guide/tasks.md b/docs/agent-guide/tasks.md
index 0b88215552..587bfaec83 100644
--- a/docs/agent-guide/tasks.md
+++ b/docs/agent-guide/tasks.md
@@ -758,9 +758,11 @@ shows the Projects return breadcrumb and the project name, with the same Share
and side-panel controls as task detail. `Project actions` (the dots button
after the name) opens the row context menu's entries for this project,
including `Delete` for its owner. Choose Overview or Tasks using the inset
-tabs in that top bar. In Tasks, an outlined circular search button expands into
-a focused `Search in <project name>` field. Close or Escape clears the query and
-restores focus to the button. The task toolbar stays the same height and scrolls
+tabs in that top bar; below 600px they collapse to icons, with tooltips on
+desktop, and the project name truncates instead. In Tasks, an outlined
+circular search button expands into a focused `Search in <project name>` field.
+Close or Escape clears the query and restores focus to the button. The task
+toolbar stays the same height and scrolls
horizontally in narrow splits, keeping list controls, Add existing tasks, and New
task accessible. Opening an associated task extends the breadcrumb trail; choose
the project breadcrumb to return, or Projects to restore the collection and its