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(calendar): let users turn off the next-meeting sidebar badge (#8657)

gbirman1420a6facddb
diff --git a/apps/web/src/components/app/sidebar-next/list-nav.tsx b/apps/web/src/components/app/sidebar-next/list-nav.tsx
index a4878906ea..9e9e1827d7 100644
--- a/apps/web/src/components/app/sidebar-next/list-nav.tsx
+++ b/apps/web/src/components/app/sidebar-next/list-nav.tsx
@@ -1,4 +1,5 @@
import { parseAgentsRoute } from '@app/features/agents-view/core/route';
+import { NextMeetingBadgePill } from '@app/features/meetings/components/next-meeting-badge-pill';
import { useAnalytics } from '@app/lib/analytics/analytics-context';
import { t } from '@app/lib/i18n';
import { useSplitRouter } from '@app/lib/split-router';
@@ -188,15 +189,7 @@ export const ListNav = (props: ListNavProps) => {
</span>
</Show>
<Show when={!isGoToLeaderActive() && props.badge}>
- {(badge) => (
- <span
- aria-hidden="true"
- data-sidebar-badge
- class="pointer-events-none absolute bottom-0 left-1/2 -translate-x-1/2 rounded-full bg-accent px-1 text-[9px] font-semibold leading-3 text-surface ring-2 ring-panel"
- >
- {badge()}
- </span>
- )}
+ {(badge) => <NextMeetingBadgePill label={badge()} />}
</Show>
<Show when={isGoToLeaderActive() && props.item.hotkeyToken}>
{(token) => (
diff --git a/apps/web/src/components/app/sidebar-next/sidebar-rail.tsx b/apps/web/src/components/app/sidebar-next/sidebar-rail.tsx
index b7aa5d6c0b..0c54e379e0 100644
--- a/apps/web/src/components/app/sidebar-next/sidebar-rail.tsx
+++ b/apps/web/src/components/app/sidebar-next/sidebar-rail.tsx
@@ -1,3 +1,4 @@
+import { useCalendarPreferences } from '@app/features/calendar/utils/preferences';
import { useHasActiveChannelsCall } from '@app/features/channels-view/use-has-active-call';
import { useAnalytics } from '@app/lib/analytics/analytics-context';
import { globalSplitManager } from '@app/signal/splitLayout';
@@ -41,6 +42,7 @@ export const SidebarRail = () => {
const analytics = useAnalytics();
const layout = useSplitLayout();
const hasUnread = useNavigationUnread();
+ const [calendarPreferences] = useCalendarPreferences();
const _openHome = (event: MouseEvent) => {
if (event.button !== 0) return;
@@ -84,7 +86,12 @@ export const SidebarRail = () => {
/>
</Suspense>
</Match>
- <Match when={item.id === 'calendar'}>
+ <Match
+ when={
+ item.id === 'calendar' &&
+ calendarPreferences.showNextMeetingBadge
+ }
+ >
<Suspense fallback={<ListNav item={item} />}>
<CalendarListNav item={item} />
</Suspense>
diff --git a/apps/web/src/features/calendar/calendar-settings.tsx b/apps/web/src/features/calendar/calendar-settings.tsx
index ce52597777..f0f93e548f 100644
--- a/apps/web/src/features/calendar/calendar-settings.tsx
+++ b/apps/web/src/features/calendar/calendar-settings.tsx
@@ -13,6 +13,7 @@ import {
type ConnectedCalendarAccount,
ConnectedCalendars,
} from './components/connected-calendars';
+import { NextMeetingCountdownSetting } from './components/next-meeting-countdown-setting';
import {
TurnOffCalendarDialog,
type TurnOffCalendarTarget,
@@ -156,6 +157,7 @@ export function CalendarSettings() {
description="Manage your connected accounts, calendar visibility, and colors."
>
<CalendarConnectionSettings />
+ <NextMeetingCountdownSetting />
<CalendarTeamSettings />
</SettingsPage>
);
diff --git a/apps/web/src/features/calendar/components/next-meeting-countdown-setting.test.tsx b/apps/web/src/features/calendar/components/next-meeting-countdown-setting.test.tsx
new file mode 100644
index 0000000000..2c29008ac0
--- /dev/null
+++ b/apps/web/src/features/calendar/components/next-meeting-countdown-setting.test.tsx
@@ -0,0 +1,32 @@
+import { cleanup, fireEvent, render } from '@solidjs/testing-library';
+import { afterEach, expect, it, vi } from 'vitest';
+import { CALENDAR_PREFERENCES_KEY } from '../calendar-preferences';
+
+afterEach(() => {
+ cleanup();
+ localStorage.clear();
+ vi.resetModules();
+});
+
+it('previews the countdown pill and hides it when switched off', async () => {
+ const { NextMeetingCountdownSetting } = await import(
+ './next-meeting-countdown-setting'
+ );
+ const ui = render(() => <NextMeetingCountdownSetting />);
+ const toggle = ui.getByRole('switch', { name: 'Next meeting countdown' });
+ const preview = () =>
+ ui.container.querySelector('[data-next-meeting-preview]');
+
+ expect(toggle.getAttribute('aria-checked') ?? '').not.toBe('false');
+ expect(preview()?.getAttribute('data-next-meeting-preview')).toBe('shown');
+ expect(preview()?.textContent).toBe('23m');
+
+ fireEvent.click(toggle);
+
+ expect(preview()?.getAttribute('data-next-meeting-preview')).toBe('hidden');
+ expect(preview()?.textContent).toBe('');
+ expect(
+ JSON.parse(localStorage.getItem(CALENDAR_PREFERENCES_KEY) ?? '{}')
+ .showNextMeetingBadge
+ ).toBe(false);
+});
diff --git a/apps/web/src/features/calendar/components/next-meeting-countdown-setting.tsx b/apps/web/src/features/calendar/components/next-meeting-countdown-setting.tsx
new file mode 100644
index 0000000000..59b2fd00cc
--- /dev/null
+++ b/apps/web/src/features/calendar/components/next-meeting-countdown-setting.tsx
@@ -0,0 +1,52 @@
+import { NextMeetingBadgePill } from '@app/features/meetings/components/next-meeting-badge-pill';
+import {
+ SettingsCard,
+ SettingsRow,
+ SettingsSection,
+} from '@app/features/settings/primitives';
+import CalendarBlankIcon from '@phosphor/calendar-blank.svg';
+import { ToggleSwitch } from '@ui';
+import { Show } from 'solid-js';
+import { useCalendarPreferences } from '../utils/preferences';
+
+/** The sidebar's Calendar button as it will look, pill and all. */
+function NextMeetingBadgePreview(props: { shown: boolean }) {
+ return (
+ <span
+ aria-hidden="true"
+ data-next-meeting-preview={props.shown ? 'shown' : 'hidden'}
+ class="relative flex size-10 shrink-0 items-center justify-center rounded-xl border border-edge-muted bg-page text-ink"
+ >
+ <CalendarBlankIcon class="size-5" />
+ <Show when={props.shown}>
+ <NextMeetingBadgePill label="23m" class="ring-page" />
+ </Show>
+ </span>
+ );
+}
+
+/** Settings → Calendar switch for the sidebar Calendar button's countdown. */
+export function NextMeetingCountdownSetting() {
+ const [preferences, setPreferences] = useCalendarPreferences();
+ return (
+ <SettingsSection title="Sidebar">
+ <SettingsCard>
+ <SettingsRow
+ label="Next meeting countdown"
+ description="Count down to your next meeting on the sidebar's Calendar icon, and show Now while one is happening."
+ >
+ <NextMeetingBadgePreview shown={preferences.showNextMeetingBadge} />
+ <ToggleSwitch
+ size="md"
+ label="Next meeting countdown"
+ labelClass="sr-only"
+ checked={preferences.showNextMeetingBadge}
+ onChange={(checked) =>
+ setPreferences('showNextMeetingBadge', checked)
+ }
+ />
+ </SettingsRow>
+ </SettingsCard>
+ </SettingsSection>
+ );
+}
diff --git a/apps/web/src/features/calendar/utils/preferences.test.ts b/apps/web/src/features/calendar/utils/preferences.test.ts
index 6d10037fe9..19ae8079f8 100644
--- a/apps/web/src/features/calendar/utils/preferences.test.ts
+++ b/apps/web/src/features/calendar/utils/preferences.test.ts
@@ -24,4 +24,38 @@ describe('calendar preferences', () => {
expect(hidden).toEqual(['team-ooo', 'holidays']);
});
+
+ it('shows the next meeting badge for saved preferences without the setting', async () => {
+ localStorage.setItem(
+ CALENDAR_PREFERENCES_KEY,
+ JSON.stringify({ hiddenSourceIds: [] })
+ );
+ const { useCalendarPreferences } = await import('./preferences');
+
+ const show = createRoot((dispose) => {
+ const [preferences] = useCalendarPreferences();
+ const value = preferences.showNextMeetingBadge;
+ dispose();
+ return value;
+ });
+
+ expect(show).toBe(true);
+ });
+
+ it('keeps the next meeting badge off across reloads', async () => {
+ localStorage.setItem(
+ CALENDAR_PREFERENCES_KEY,
+ JSON.stringify({ showNextMeetingBadge: false })
+ );
+ const { useCalendarPreferences } = await import('./preferences');
+
+ const show = createRoot((dispose) => {
+ const [preferences] = useCalendarPreferences();
+ const value = preferences.showNextMeetingBadge;
+ dispose();
+ return value;
+ });
+
+ expect(show).toBe(false);
+ });
});
diff --git a/apps/web/src/features/calendar/utils/preferences.ts b/apps/web/src/features/calendar/utils/preferences.ts
index 6f7551e034..0277e242b5 100644
--- a/apps/web/src/features/calendar/utils/preferences.ts
+++ b/apps/web/src/features/calendar/utils/preferences.ts
@@ -20,6 +20,7 @@ interface CalendarPreferences {
showWeekends: boolean;
weekStartsOn: CalendarWeekStart;
timeFormat: CalendarTimeFormat;
+ showNextMeetingBadge: boolean;
}
/** One persisted store, so preference changes reach invitation cards outside the calendar. */
@@ -32,6 +33,7 @@ export const useCalendarPreferences = createSharedRoot(() => {
showWeekends: true,
weekStartsOn: 0,
timeFormat: getDefaultCalendarTimeFormat(),
+ showNextMeetingBadge: true,
};
const [preferences, setPreferences] = makePersisted(
createStore<CalendarPreferences>(defaultPreferences),
diff --git a/apps/web/src/features/meetings/components/next-meeting-badge-pill.tsx b/apps/web/src/features/meetings/components/next-meeting-badge-pill.tsx
new file mode 100644
index 0000000000..1bd059addb
--- /dev/null
+++ b/apps/web/src/features/meetings/components/next-meeting-badge-pill.tsx
@@ -0,0 +1,21 @@
+import { cn } from '@ui';
+
+/**
+ * The accent pill under the sidebar's Calendar glyph (`Now`, `23m`). Positioned
+ * against the nearest `relative` ancestor; `class` overrides the ring so it
+ * matches whatever surface sits behind the glyph.
+ */
+export function NextMeetingBadgePill(props: { label: string; class?: string }) {
+ return (
+ <span
+ aria-hidden="true"
+ data-sidebar-badge
+ class={cn(
+ 'pointer-events-none absolute bottom-0 left-1/2 -translate-x-1/2 rounded-full bg-accent px-1 text-[9px] font-semibold leading-3 text-surface ring-2 ring-panel',
+ props.class
+ )}
+ >
+ {props.label}
+ </span>
+ );
+}
diff --git a/apps/web/src/features/settings/core/settings-search.ts b/apps/web/src/features/settings/core/settings-search.ts
index 0a76dd140e..e7eed4428e 100644
--- a/apps/web/src/features/settings/core/settings-search.ts
+++ b/apps/web/src/features/settings/core/settings-search.ts
@@ -80,6 +80,12 @@ const SETTINGS: Setting[] = [
keywords:
'google gmail connect accounts visibility show hide color colour subcalendar',
},
+ {
+ tab: 'Calendar',
+ title: 'Next meeting countdown',
+ target: 'Next meeting countdown',
+ keywords: 'sidebar badge upcoming meeting minutes now timer hide',
+ },
{
tab: 'Agents',
title: 'Team agents',
diff --git a/docs/agent-guide/calendar.md b/docs/agent-guide/calendar.md
index 12f4486946..f697036e33 100644
--- a/docs/agent-guide/calendar.md
+++ b/docs/agent-guide/calendar.md
@@ -283,6 +283,12 @@ color field (Shift makes larger steps). **Reset to default** clears the override
Visibility and colors share the calendar sidebar's browser-local preferences,
survive reload, and do not change the Google calendar or booking conflict checks.
+The **Sidebar** section's **Next meeting countdown** switch (on by default, saved in
+the same browser-local preferences) controls the app rail's Calendar badge:
+`Now` during a meeting, or minutes until one under an hour away. Turning it off
+hides the badge and stops its upcoming-events fetch. The row previews the
+Calendar button beside the switch, with a sample `23m` pill only while it is on.
+
The calendar header has a `Booking links` dropdown. Select an active link to
copy it. The `Manage booking links` footer opens the Scheduling workspace, even
while links load or when none are active. At narrow desktop pane widths, the
diff --git a/docs/agent-guide/navigation.md b/docs/agent-guide/navigation.md
index 254a948387..aa0ea0dec5 100644
--- a/docs/agent-guide/navigation.md
+++ b/docs/agent-guide/navigation.md
@@ -470,7 +470,9 @@ External (plug icon, `g x`) appears on the rail only with the
its surface and item styling with the sidebar right-click menus.
- Nav: `Home`, `Drive`, `Email`, `Chat`, `Tasks`, `Calendar`,
`Agents`, `Customers`. Calendar and Customers appear only when
- their features are enabled.
+ their features are enabled. Calendar shows a next-meeting badge (`Now`, or
+ minutes under an hour away) unless **Next meeting countdown** is off in
+ **Settings → Calendar**.
- Bottom: `Settings` (`Ctrl ;`) — a gear with the signed-in account's profile
photo as a badge in its corner. It opens Settings directly in the active
split (Shift-click for a new split); there is no account menu. Log out lives