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: move reminders from sidebar to inbox (#5758)

Peter Chinman40a3474b37d2
diff --git a/apps/web/src/components/app/app-sidebar/sidebar.tsx b/apps/web/src/components/app/app-sidebar/sidebar.tsx
index 6f2739645e..4c8e3fd948 100644
--- a/apps/web/src/components/app/app-sidebar/sidebar.tsx
+++ b/apps/web/src/components/app/app-sidebar/sidebar.tsx
@@ -53,7 +53,6 @@ import {
ENABLE_CALLS,
ENABLE_CRM,
ENABLE_NEW_PRICING_OVERRIDE,
- ENABLE_REMINDERS,
} from '@core/constant/featureFlags';
import {
type SettingsTab,
@@ -84,7 +83,6 @@ import { AnimatedSearchIcon } from '@icon/wide-search';
import { AnimatedStarIcon } from '@icon/wide-star';
import { AnimatedTaskIcon } from '@icon/wide-task';
import { ContextMenu } from '@kobalte/core/context-menu';
-import BellSimpleIcon from '@phosphor/bell-simple.svg';
import CaretRightIcon from '@phosphor/caret-right.svg';
import CaretUpIcon from '@phosphor/caret-up.svg';
import CompassIcon from '@phosphor/compass.svg';
@@ -1048,17 +1046,6 @@ const RECENT_LINK: SidebarItem = {
hotkeyToken: TOKENS.sidebar.goTo.recent,
};
-const REMINDERS_LINK: SidebarItem = {
- id: 'reminders',
- label: 'Reminders',
- href: LIST_VIEW_PATHS.reminders,
- icon: BellSimpleIcon,
- // `r` is Calendar; `m` is free and the only other letter in "reminders" that
- // is not already a sidebar destination.
- hotkey: 'm',
- hotkeyToken: TOKENS.sidebar.goTo.reminders,
-};
-
/**
* Assemble the ordered sidebar link list: the static links plus Home, Getting
* started, and the flag-gated Activity, Calendar, Calls, and CRM entries in
@@ -1085,7 +1072,7 @@ const buildSidebarLinks = (
];
if (showRecent) {
- // Directly below Inbox; Activity and Reminders anchor after it.
+ // Directly below Inbox; Activity anchors after it.
const idx = links.findIndex((link) => link.id === 'inbox');
links = [...links.slice(0, idx + 1), RECENT_LINK, ...links.slice(idx + 1)];
}
@@ -1100,21 +1087,6 @@ const buildSidebarLinks = (
];
}
- if (ENABLE_REMINDERS()) {
- // Directly below Activity, or below Recent/Inbox when Activity is off.
- const anchorId = showActivity
- ? 'activity'
- : showRecent
- ? 'recent'
- : 'inbox';
- const idx = links.findIndex((l) => l.id === anchorId);
- links = [
- ...links.slice(0, idx + 1),
- REMINDERS_LINK,
- ...links.slice(idx + 1),
- ];
- }
-
if (ENABLE_CALLS()) {
const idx = links.findIndex((l) => l.id === 'channels');
links = [...links.slice(0, idx + 1), CALLS_LINK, ...links.slice(idx + 1)];
@@ -1374,7 +1346,7 @@ export const AppSidebar = (props: AppSidebarProps) => {
// lives in the collapsible Workspace section. `findLink` drops ids that
// `buildSidebarLinks` gated out, so flag-gated rows need no filter here.
const topLinks = createMemo(() =>
- ['home', 'getting-started', 'inbox', 'recent', 'activity', 'reminders']
+ ['home', 'getting-started', 'inbox', 'recent', 'activity']
.filter(
(id) => id !== 'getting-started' || !gettingStartedVisibility.hidden()
)
diff --git a/apps/web/src/features/next-soup/actions/make-mark-done-action.ts b/apps/web/src/features/next-soup/actions/make-mark-done-action.ts
index 8fd3c3b8b9..f917ec142c 100644
--- a/apps/web/src/features/next-soup/actions/make-mark-done-action.ts
+++ b/apps/web/src/features/next-soup/actions/make-mark-done-action.ts
@@ -31,6 +31,9 @@ import type { SoupState } from '../create-soup-state';
const VALID_MARK_DONE_LIST_VIEWS: `${ListView}-${string}`[] = [
'inbox-signal',
'inbox-noise',
+ // Marking a pending reminder done cancels it before it fires — same as the
+ // standalone Reminders view's Scheduled tab below.
+ 'inbox-reminders',
'mail-important',
'mail-all',
'mail-noise',
diff --git a/apps/web/src/features/next-soup/sidebar/soup-filter-presets.ts b/apps/web/src/features/next-soup/sidebar/soup-filter-presets.ts
index e193be3e3b..ef9a3009f1 100644
--- a/apps/web/src/features/next-soup/sidebar/soup-filter-presets.ts
+++ b/apps/web/src/features/next-soup/sidebar/soup-filter-presets.ts
@@ -118,9 +118,10 @@ const getInboxSignalFilters = () => {
emailShared: 'exclude',
// Reminders are off by default server-side rather than excluded by
// `defineQueryFilters` (there is no `remf` entry in ID_FIELD_NAMES), so
- // this literal is the only thing that surfaces them — and Signal is the
- // only view that sends it. Behind the flag so an unflagged user never
- // pays for the reminders lookup on every Signal fetch.
+ // this literal is the only thing that surfaces them; the inbox Reminders
+ // tab below sends it too, for the not-yet-fired slice. Behind the flag
+ // so an unflagged user never pays for the reminders lookup on every
+ // Signal fetch.
...(ENABLE_REMINDERS() ? { includeReminders: true } : {}),
// Calendar events with a not-done notification (a fired event alarm).
// Referencing `calf` opts the calendar arm into the signal query, which
@@ -219,6 +220,22 @@ export const VIEW_TAB_PRESETS: Record<ListView, ViewTabConfig> = {
clientFilters: { and: ['explicit-noise'] },
groupBy: ENABLE_NEW_INBOX() ? 'date' : undefined,
}),
+ // Pending reminders only: scheduled but not yet fired. A fired reminder
+ // has already hit the inbox — Signal surfaces it through its not-done
+ // notification — so this tab is the forward-looking complement: what is
+ // coming, not what is due. Soonest first, since "newest first" on future
+ // dates would put December above tomorrow.
+ reminders: () => ({
+ filters: defineQueryFilters({
+ include: {
+ includeReminders: true,
+ reminderCompleted: false,
+ reminderFired: false,
+ },
+ }),
+ clientFilters: { and: ['reminders-scheduled'] },
+ sortDirection: 'asc',
+ }),
},
},
agents: {
diff --git a/apps/web/src/features/next-soup/soup-view/empty-states.tsx b/apps/web/src/features/next-soup/soup-view/empty-states.tsx
index b6fd40b775..7250628148 100644
--- a/apps/web/src/features/next-soup/soup-view/empty-states.tsx
+++ b/apps/web/src/features/next-soup/soup-view/empty-states.tsx
@@ -143,6 +143,27 @@ export function EmptyState(props: {
</EmptyStatePanel>
</Match>
+ {/* The Reminders tab is not an email surface, so it sits above the
+ connect-email gate — its empty copy is the same with or without a
+ linked inbox. */}
+ <Match
+ when={props.listView === 'inbox' && soup.activeTab() === 'reminders'}
+ >
+ <EmptyStatePanel
+ graphic={EmptyStateInboxTrayGraphic}
+ title="No scheduled reminders"
+ description={
+ <>
+ Reminders you schedule wait here until they fire into Signal. Set
+ one on anything in Macro by selecting it and pressing{' '}
+ <HotkeyCap>h</HotkeyCap>, or with the option in its right-click
+ menu.
+ </>
+ }
+ documentationUrl={`${DOCS_BASE}/product/inbox`}
+ />
+ </Match>
+
<Match when={props.listView === 'inbox' && !emailActive()}>
<EmptyStatePanel
graphic={EmptyStateInboxTrayGraphic}
diff --git a/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx b/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx
index 253482ce0b..bc45548fc9 100644
--- a/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx
+++ b/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx
@@ -55,6 +55,7 @@ import {
ENABLE_FEATURED_SEARCH_RESULTS,
ENABLE_NEW_INBOX_FLAG,
ENABLE_NEW_INBOX_OVERRIDE,
+ ENABLE_REMINDERS,
ENABLE_SUPPORTED_SOUP_FOREIGN_ENTITIES_FLAG,
ENABLE_SUPPORTED_SOUP_FOREIGN_ENTITIES_OVERRIDE,
} from '@core/constant/featureFlags';
@@ -251,7 +252,14 @@ const resolveTabId = (
remembered: string | undefined
): string => {
const config = VIEW_TAB_PRESETS[view];
- return remembered && remembered in config.tabs ? remembered : config.default;
+ if (!remembered || !(remembered in config.tabs)) return config.default;
+ // A remembered tab can also be flag-gated out of the tab bar (see
+ // `useVisibleViewTabs`): restoring the inbox onto Reminders with the flag
+ // off would leave a hidden tab active, still querying reminders.
+ if (view === 'inbox' && remembered === 'reminders' && !ENABLE_REMINDERS()) {
+ return config.default;
+ }
+ return remembered;
};
const persistedPredicatesFor = (
@@ -570,11 +578,12 @@ export const SoupViewContextProvider: FlowComponent<
if (!view) return;
const entryState = panel.handle.currentEntryState();
- const tabId =
+ const tabId = resolveTabId(
+ view,
(entryState?.['soup.tab'] as string | undefined) ??
- persistedActiveTabs()[view] ??
- activeTab() ??
- VIEW_TAB_PRESETS[view].default;
+ persistedActiveTabs()[view] ??
+ activeTab()
+ );
const query =
entryState && 'search.filters' in entryState
? undefined
@@ -820,11 +829,13 @@ export const SoupViewContextProvider: FlowComponent<
const entryQuery = entryState?.['search.filters'] as Query | undefined;
const view = activeListView();
const tabId = view
- ? ((entryState?.['soup.tab'] as string | undefined) ??
- (filterPersistenceEnabled()
- ? persistedActiveTabs()[view]
- : undefined) ??
- VIEW_TAB_PRESETS[view].default)
+ ? resolveTabId(
+ view,
+ (entryState?.['soup.tab'] as string | undefined) ??
+ (filterPersistenceEnabled()
+ ? persistedActiveTabs()[view]
+ : undefined)
+ )
: undefined;
if (tabId) setActiveTab(tabId);
diff --git a/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx b/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx
index 54fa64f0a1..8dda895d11 100644
--- a/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx
+++ b/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx
@@ -22,11 +22,16 @@ import {
type TabbedListView,
VIEW_TAB_LISTS,
} from '@app/features/next-soup/soup-view/tab-lists';
+import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { PillTabs } from '@components/app/mobile/PillTabs';
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
import type { TabItem } from '@core/component/Tabs';
import { TabsInset } from '@core/component/TabsInset';
import { TabsInsetDropdown } from '@core/component/TabsInsetDropdown';
+import {
+ ENABLE_REMINDERS_FLAG,
+ ENABLE_REMINDERS_OVERRIDE,
+} from '@core/constant/featureFlags';
import { useUserContext } from '@core/context/user';
import { useIsTeamAdmin } from '@queries/team/teams';
import { batch, createMemo, For, Match, Show, Switch } from 'solid-js';
@@ -43,6 +48,23 @@ const useCurrentListView = () => {
});
};
+/**
+ * Tabs actually shown for a view. `VIEW_TAB_LISTS` is the full superset (the
+ * tab/preset consistency tests key off it); flag-gated entries are dropped
+ * here so every tab surface — segmented control, collapsed dropdown, mobile
+ * pills, and the number/cycle hotkeys — agrees on which tabs exist.
+ */
+export const useVisibleViewTabs = () => {
+ const remindersFlag = useFeatureFlag(ENABLE_REMINDERS_FLAG, {
+ enabledOverride: ENABLE_REMINDERS_OVERRIDE,
+ });
+
+ return (view: TabbedListView): TabItem[] =>
+ view === 'inbox' && !remindersFlag().enabled
+ ? VIEW_TAB_LISTS.inbox.filter((tab) => tab.value !== 'reminders')
+ : VIEW_TAB_LISTS[view];
+};
+
const PRESERVE_FILTERS_ON_TAB_CHANGE: ListView[] = ['documents', 'tasks'];
export const shouldPreserveFiltersOnTabChange = (view: ListView) =>
@@ -229,10 +251,11 @@ const CompanyModeTabs = () => {
const ViewTabs = (props: { view: TabbedListView }) => {
const { applyTabPreset } = useApplyPreset();
const { activeTab } = useSoupView();
+ const visibleViewTabs = useVisibleViewTabs();
return (
<TabsInset
- list={VIEW_TAB_LISTS[props.view]}
+ list={visibleViewTabs(props.view)}
value={activeTab()}
defaultValue={VIEW_TAB_PRESETS[props.view].default}
onChange={(value) => applyTabPreset(props.view, value)}
@@ -245,6 +268,7 @@ export const CollapsedSoupViewTabs = () => {
const listView = useCurrentListView();
const { applyTabPreset } = useApplyPreset();
const { activeTab, viewMode, setViewMode } = useSoupView();
+ const visibleViewTabs = useVisibleViewTabs();
const view = createMemo(() => {
const v = listView();
@@ -253,7 +277,7 @@ export const CollapsedSoupViewTabs = () => {
const list = createMemo(() => {
const v = view();
- return v ? VIEW_TAB_LISTS[v] : [];
+ return v ? visibleViewTabs(v) : [];
});
const defaultValue = createMemo(() => {
@@ -352,6 +376,7 @@ const MobileCompanyModeTabs = () => {
const MobileViewTabs = (props: { view: TabbedListView }) => {
const { applyTabPreset } = useApplyPreset();
const { activeTab } = useSoupView();
+ const visibleViewTabs = useVisibleViewTabs();
const activeValue = () => activeTab() ?? VIEW_TAB_PRESETS[props.view].default;
return (
@@ -360,7 +385,7 @@ const MobileViewTabs = (props: { view: TabbedListView }) => {
class={MOBILE_TAB_STRIP_CLASS}
contentClass={MOBILE_TAB_CONTENT_CLASS}
leading={<MobileFilterDrawer />}
- items={VIEW_TAB_LISTS[props.view]}
+ items={visibleViewTabs(props.view)}
value={activeValue()}
onChange={(value) => applyTabPreset(props.view, value)}
/>
diff --git a/apps/web/src/features/next-soup/soup-view/tab-lists.ts b/apps/web/src/features/next-soup/soup-view/tab-lists.ts
index fabe5dc565..545a62b4ec 100644
--- a/apps/web/src/features/next-soup/soup-view/tab-lists.ts
+++ b/apps/web/src/features/next-soup/soup-view/tab-lists.ts
@@ -21,6 +21,10 @@ export const VIEW_TAB_LISTS: Record<TabbedListView, TabItem[]> = {
{ value: 'signal', label: 'Signal' },
{ value: 'noise', label: 'Noise' },
{ value: 'all', label: 'All' },
+ // Hidden from every tab surface for unflagged users (see
+ // `useVisibleViewTabs`); listed here so the tab/preset consistency tests
+ // still cover it.
+ { value: 'reminders', label: 'Reminders' },
],
agents: [
{ value: 'owned', label: 'Owned' },
diff --git a/apps/web/src/features/next-soup/soup-view/use-soup-view-hotkeys.ts b/apps/web/src/features/next-soup/soup-view/use-soup-view-hotkeys.ts
index a1e795a1c6..47d1f8e23d 100644
--- a/apps/web/src/features/next-soup/soup-view/use-soup-view-hotkeys.ts
+++ b/apps/web/src/features/next-soup/soup-view/use-soup-view-hotkeys.ts
@@ -23,7 +23,11 @@ import { openSingleStackNotification } from '@notifications';
import { type Accessor, onCleanup } from 'solid-js';
import type { VirtualizerHandle } from 'virtua/solid';
import type { SoupState } from '../create-soup-state';
-import { type TabbedListView, VIEW_TAB_LISTS } from './soup-view-tabs';
+import {
+ type TabbedListView,
+ useVisibleViewTabs,
+ VIEW_TAB_LISTS,
+} from './soup-view-tabs';
type UseSoupViewHotkeysOptions = {
scopeId: string;
@@ -343,10 +347,11 @@ export const useSoupViewHotkeys = (options: UseSoupViewHotkeysOptions) => {
const isTabbedView = (v: string): v is TabbedListView => v in VIEW_TAB_LISTS;
+ const visibleViewTabs = useVisibleViewTabs();
const getTabKeys = () => {
const view = currentView();
if (!view || !isTabbedView(view)) return [];
- return VIEW_TAB_LISTS[view].map((t) => t.value);
+ return visibleViewTabs(view).map((t) => t.value);
};
const switchToTabIndex = (index: number) => {
diff --git a/apps/web/src/features/reminders/ReminderComposerModal.tsx b/apps/web/src/features/reminders/ReminderComposerModal.tsx
index a3341a911d..7fd62b43e8 100644
--- a/apps/web/src/features/reminders/ReminderComposerModal.tsx
+++ b/apps/web/src/features/reminders/ReminderComposerModal.tsx
@@ -16,6 +16,7 @@ import {
import {
getSoupEntityById,
optimisticUpdateSoupEntity,
+ refetchSoupEntity,
} from '@queries/soup/cache';
import { mergeRefs } from '@solid-primitives/refs';
import {
@@ -86,7 +87,14 @@ export function ReminderComposerModal() {
const [query, setQuery] = createSignal('');
const [selectedIndex, setSelectedIndex] = createSignal(0);
- const createReminder = useCreateReminderMutation();
+ // Nothing else brings a new reminder into Soup: the service emits no
+ // websocket event on create (its only outbound signals are the dispatch
+ // queue and the notification when a reminder fires), so without this fetch
+ // the Scheduled/Pending lists only learn about the reminder on their next
+ // full fetch.
+ const createReminder = useCreateReminderMutation({
+ onSuccess: (reminder) => void refetchSoupEntity(reminder.id, 'reminder'),
+ });
// Soup rows come from the normalized soup cache, not the reminders queries,
// so the mutation's own invalidation leaves an edited row reading its old
// description and firing time until a reload. Applying the response is not an
diff --git a/apps/web/src/lib/core/hotkey/tokens.ts b/apps/web/src/lib/core/hotkey/tokens.ts
index c99a078cce..d198ab16ab 100644
--- a/apps/web/src/lib/core/hotkey/tokens.ts
+++ b/apps/web/src/lib/core/hotkey/tokens.ts
@@ -126,7 +126,6 @@ export const TOKENS = {
calls: 'sidebar.goTo.calls',
companies: 'sidebar.goTo.companies',
folders: 'sidebar.goTo.folders',
- reminders: 'sidebar.goTo.reminders',
},
},