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(soup): persist preview panel state into local storage (#5222)

dev-rb43c725f68b7b
diff --git a/apps/web/src/components/app/split-layout/components/PreviewButton.tsx b/apps/web/src/components/app/split-layout/components/PreviewButton.tsx
index 036abde4f8..e4c8c957f7 100644
--- a/apps/web/src/components/app/split-layout/components/PreviewButton.tsx
+++ b/apps/web/src/components/app/split-layout/components/PreviewButton.tsx
@@ -13,6 +13,7 @@ export function PreviewButton(
disabled?: boolean;
disabledLabel?: string;
onEngage?: () => void;
+ onOpenChange?: (open: boolean) => void;
} = {}
) {
const panel = useSplitPanelOrThrow();
@@ -29,13 +30,17 @@ export function PreviewButton(
const togglePreview = () => {
if (isController()) {
panel.handle.disengagePreview();
+ props.onOpenChange?.(false);
return;
}
if (!canEngage()) return;
analytics.track('preview_panel_use');
panel.handle.engagePreview();
- if (panel.handle.isControllerSplit()) props.onEngage?.();
+ if (panel.handle.isControllerSplit()) {
+ props.onOpenChange?.(true);
+ props.onEngage?.();
+ }
};
registerHotkey({
diff --git a/apps/web/src/features/next-soup/soup-view/filters-bar/soup-filters-bar.tsx b/apps/web/src/features/next-soup/soup-view/filters-bar/soup-filters-bar.tsx
index cc98488ae8..82a5cadda4 100644
--- a/apps/web/src/features/next-soup/soup-view/filters-bar/soup-filters-bar.tsx
+++ b/apps/web/src/features/next-soup/soup-view/filters-bar/soup-filters-bar.tsx
@@ -22,6 +22,7 @@ export function SoupFiltersBar(props: {
variant?: 'default' | 'tag';
hasPreviewItems: boolean;
onPreviewEngage: () => void;
+ onPreviewOpenChange?: (open: boolean) => void;
}) {
const { resetToTabDefaults, consolidatedFiltersList } =
useFilterRefinements();
@@ -80,6 +81,7 @@ export function SoupFiltersBar(props: {
disabled={!props.hasPreviewItems}
disabledLabel="No items to preview"
onEngage={props.onPreviewEngage}
+ onOpenChange={props.onPreviewOpenChange}
/>
</SplitToolbarRight>
{/* Active filters bar - shown below the toolbar when there are filters */}
diff --git a/apps/web/src/features/next-soup/soup-view/soup-view.tsx b/apps/web/src/features/next-soup/soup-view/soup-view.tsx
index 715e1fcc25..5a840ff1f2 100644
--- a/apps/web/src/features/next-soup/soup-view/soup-view.tsx
+++ b/apps/web/src/features/next-soup/soup-view/soup-view.tsx
@@ -206,6 +206,7 @@ const MobileTabLoadingBar = () => (
);
const SOUP_LIST_STATE_ENTRY_KEY = 'soup.listState';
+const INBOX_PREVIEW_OPEN_PREFERENCE_KEY = 'macro:pref:soup:inbox:preview-open';
type SoupListEntryState = {
focus: string | undefined;
virtualCache?: CacheSnapshot;
@@ -293,6 +294,10 @@ export const SoupView = (props: SoupViewProps) => {
`macro:pref:soup:${contentId}:sort`,
{ default: [] }
);
+ const [inboxPreviewOpenPreference, setInboxPreviewOpenPreference] =
+ usePreference<boolean>(INBOX_PREVIEW_OPEN_PREFERENCE_KEY, {
+ default: true,
+ });
// Shared CRM view opened via a `?crmView=` link — only honored on the
// Customers view; its pieces win over persisted/preset values in init.
@@ -396,7 +401,7 @@ export const SoupView = (props: SoupViewProps) => {
createEffect(() => {
if (initialInboxPreviewResolved || soupView.source.isLoading()) return;
initialInboxPreviewResolved = true;
- if (contentId !== 'inbox') return;
+ if (contentId !== 'inbox' || !inboxPreviewOpenPreference()) return;
if (panel.handle.lastNavigationCause() !== 'fresh') return;
if (panel.handle.isViewerSplit()) return;
if (!hasPreviewItems()) return;
@@ -636,6 +641,9 @@ export const SoupView = (props: SoupViewProps) => {
variant={props.filterBarVariant}
hasPreviewItems={hasPreviewItems()}
onPreviewEngage={openFocusedEntityInPreview}
+ onPreviewOpenChange={(open) => {
+ if (contentId === 'inbox') setInboxPreviewOpenPreference(open);
+ }}
/>
<Show when={applyDefaultCrmView}>
<CrmDefaultViewLoader />