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): new topbar filter first paradigm (#900)

Jacob Beckerman6f3d8ba47a08
diff --git a/.cursor/commands/simplify.md b/.cursor/commands/simplify.md
new file mode 100644
index 0000000000..713292bad8
--- /dev/null
+++ b/.cursor/commands/simplify.md
@@ -0,0 +1,32 @@
+You are an expert code simplification specialist focused on enhancing code clarity, consistency, and maintainability while preserving exact functionality. Your expertise lies in applying project-specific best practices to simplify and improve code without altering its behavior. You prioritize readable, explicit code over overly compact solutions. This is a balance that you have mastered as a result your years as an expert software engineer.
+
+You will analyze recently modified code and apply refinements that:
+
+Preserve Functionality: Never change what the code does - only how it does it. All original features, outputs, and behaviors must remain intact.
+
+Reducing unnecessary complexity and nesting
+Eliminating redundant code and abstractions
+Improving readability through clear variable and function names
+Consolidating related logic
+Removing unnecessary comments that describe obvious code
+IMPORTANT: Avoid nested ternary operators - prefer switch statements or if/else chains for multiple conditions
+Choose clarity over brevity - explicit code is often better than overly compact code
+Maintain Balance: Avoid over-simplification that could:
+
+Reduce code clarity or maintainability
+Create overly clever solutions that are hard to understand
+Combine too many concerns into single functions or components
+Remove helpful abstractions that improve code organization
+Prioritize "fewer lines" over readability (e.g., nested ternaries, dense one-liners)
+Make the code harder to debug or extend
+Focus Scope: Only refine code that has been recently modified or touched in the current session, unless explicitly instructed to review a broader scope.
+
+Your refinement process:
+
+Identify the recently modified code sections
+Analyze for opportunities to improve elegance and consistency
+Apply project-specific best practices and coding standards
+Ensure all functionality remains unchanged
+Verify the refined code is simpler and more maintainable
+Document only significant changes that affect understanding
+You operate autonomously and proactively, refining code immediately after it's written or modified without requiring explicit requests. Your goal is to ensure all code meets the highest standards of elegance and maintainability while preserving its complete functionality.
\ No newline at end of file
diff --git a/js/app/packages/app/component/HelpDrawer.tsx b/js/app/packages/app/component/HelpDrawer.tsx
deleted file mode 100644
index 2717ef2f63..0000000000
--- a/js/app/packages/app/component/HelpDrawer.tsx
+++ /dev/null
@@ -1,338 +0,0 @@
-import { DeprecatedIconButton } from '@core/component/DeprecatedIconButton';
-import { toast } from '@core/component/Toast/Toast';
-import { fileSelector } from '@core/directive/fileSelector';
-import { useEmailLinks, useEmailLinksStatus } from '@core/email-link';
-import { TOKENS } from '@core/hotkey/tokens';
-import { isTouchDevice } from '@core/mobile/isTouchDevice';
-import { isMobileWidth } from '@core/mobile/mobileWidth';
-import type { DefaultView, ViewId } from '@core/types/view';
-import CloseIcon from '@icon/regular/x.svg';
-import { authServiceClient } from '@service-auth/client';
-import { useTutorialCompleted } from '@service-gql/client';
-import { For, type JSX, Match, Show, Switch } from 'solid-js';
-import { HotkeyExample, type HotkeyExampleProps } from './HotkeyExample';
-import { useSplitPanelOrThrow } from './split-layout/layoutUtils';
-
-false && fileSelector;
-
-export function HelpDrawer(props: { viewId?: ViewId }) {
- const emailActive = useEmailLinksStatus();
- const { connect: connectEmail } = useEmailLinks();
-
- return (
- <Switch>
- <Match
- when={
- (props.viewId === 'noise' ||
- props.viewId === 'signal' ||
- props.viewId === 'email') &&
- !emailActive()
- }
- >
- <HelpDrawerInner
- title={'Macro is better with email.'}
- subtitle={
- <span>
- Connect your email to the rest of your workspace. Use{' '}
- <span class="font-mono bg-edge/20 rounded-xs md-inline-code p-0.3">
- @mentions
- </span>{' '}
- to give email recipients access to anything in Macro.
- </span>
- }
- hotkeyExamples={[
- {
- hotkeyTokenSequence: [
- TOKENS.global.createCommand,
- TOKENS.create.email,
- ],
- },
- ]}
- cta={{
- label: 'Connect email',
- onClick: connectEmail,
- }}
- />
- </Match>
- <Match when={props.viewId === 'noise' && emailActive()}>
- <HelpDrawerInner
- title={'Filter out the noise.'}
- subtitle={
- <span>
- This is where we gather everything we think you might not need to
- see.
- </span>
- }
- hotkeyExamples={[
- {
- hotkeyTokenSequence: [
- TOKENS.global.createCommand,
- TOKENS.create.email,
- ],
- },
- {
- hotkeyTokenSequence: [
- TOKENS.global.createCommand,
- TOKENS.create.message,
- ],
- },
- {
- hotkeyTokenSequence: [TOKENS.split.go.toggleRightPanel],
- },
- ]}
- />
- </Match>
- <Match when={props.viewId === 'signal'}>
- <HelpDrawerInner
- title={'Your unified inbox.'}
- subtitle={
- 'All your important emails, messages, notifications, tasks in one place. Triage everything. No context switching.'
- }
- hotkeyExamples={[
- {
- hotkeyTokenSequence: [
- TOKENS.global.createCommand,
- TOKENS.create.email,
- ],
- },
- {
- hotkeyTokenSequence: [
- TOKENS.global.createCommand,
- TOKENS.create.message,
- ],
- },
- ]}
- cta={
- !emailActive()
- ? {
- label: 'Connect email',
- onClick: connectEmail,
- }
- : undefined
- }
- />
- </Match>
- <Match when={props.viewId === 'email'}>
- <HelpDrawerInner
- title={'Email is better with Macro.'}
- subtitle={
- <span>
- Use{' '}
- <span class="font-mono bg-edge/20 rounded-xs md-inline-code p-0.3">
- @mentions
- </span>{' '}
- to give email recipients access to anything in Macro. Ask AI to
- search your emails.
- </span>
- }
- hotkeyExamples={[
- {
- hotkeyTokenSequence: [
- TOKENS.global.createCommand,
- TOKENS.create.email,
- ],
- },
- {
- hotkeyTokenSequence: [
- TOKENS.global.createCommand,
- TOKENS.create.message,
- ],
- },
- {
- hotkeyTokenSequence: [
- TOKENS.split.goCommand,
- TOKENS.split.go.toggleRightPanel,
- ],
- },
- ]}
- />
- </Match>
- <Match when={props.viewId === 'comms'}>
- <HelpDrawerInner
- title={'Message teammates.'}
- subtitle={
- <span>
- Type{' '}
- <span class="bg-edge/20 rounded-xs md-inline-code p-0.3">@</span>{' '}
- to reference files, people, tasks, etc. Files are automatically
- shared when you press send.
- </span>
- }
- hotkeyExamples={[
- {
- hotkeyTokenSequence: [
- TOKENS.global.createCommand,
- TOKENS.create.message,
- ],
- },
- ]}
- />
- </Match>
- <Match when={props.viewId === 'docs'}>
- <HelpDrawerInner
- title={'Documents. Interlinked.'}
- subtitle={
- <span>
- Type{' '}
- <span class="bg-edge/20 rounded-xs md-inline-code p-0.3">@</span>{' '}
- to reference files, people, tasks, etc. Collaborate on documents
- with your team.
- </span>
- }
- hotkeyExamples={[
- {
- hotkeyTokenSequence: [
- TOKENS.global.createCommand,
- TOKENS.create.note,
- ],
- },
- ]}
- />
- </Match>
- <Match when={props.viewId === 'ai'}>
- <HelpDrawerInner
- title={'Ask AI anything.'}
- subtitle={
- <span>
- AI has secure access to your entire workspace. You can feed it
- context by{' '}
- <span class="font-mono bg-edge/20 rounded-xs md-inline-code p-0.3">
- @mentioning
- </span>{' '}
- any of your files, notes, contacts, emails, channels, folders, or
- tasks.
- </span>
- }
- hotkeyExamples={[
- {
- hotkeyTokenSequence: [
- TOKENS.global.createCommand,
- TOKENS.create.chat,
- ],
- },
- {
- hotkeyTokenSequence: [TOKENS.global.toggleBigChat],
- },
- ]}
- />
- </Match>
- <Match when={props.viewId === 'folders'}>
- <HelpDrawerInner
- title={'All your files, organized.'}
- subtitle={
- "Drag and drop entire folders. Once they're in Macro, you can share them with your team."
- }
- hotkeyExamples={[
- {
- hotkeyTokenSequence: [
- TOKENS.global.createCommand,
- TOKENS.create.project,
- ],
- },
- ]}
- />
- </Match>
- <Match when={true}>
- <HelpDrawerInner
- title={'Welcome to Macro.'}
- subtitle={'We use hotkeys to move fast.'}
- hotkeyExamples={[
- {
- hotkeyTokenSequence: [TOKENS.global.commandMenu],
- },
- {
- hotkeyTokenSequence: [TOKENS.global.createNewSplit],
- },
- {
- hotkeyTokenSequence: [TOKENS.split.go.toggleRightPanel],
- },
- {
- hotkeyTokenSequence: [TOKENS.global.createCommand],
- },
- ]}
- />
- </Match>
- </Switch>
- );
-}
-
-export interface HelpDrawerInnerProps {
- title: string;
- subtitle?: JSX.Element | string;
- hotkeyExamples?: HotkeyExampleProps[];
- cta?: {
- label: string;
- onClick: () => void;
- };
-}
-
-export function HelpDrawerInner(props: HelpDrawerInnerProps) {
- const splitPanelContext = useSplitPanelOrThrow();
- const {
- soupContext: { setShowHelpDrawer },
- } = splitPanelContext;
- const tuturialComplete = useTutorialCompleted();
- const hideAllHelpDrawers = () => {
- setShowHelpDrawer(new Set<DefaultView>());
- toast.success('Press ? to re-open the help drawer.');
- if (!tuturialComplete()) {
- authServiceClient
- .patchUserTutorial({ tutorialComplete: true })
- .catch(console.error);
- }
- };
- return (
- <div class="w-full shrink-0 flex flex-col text-ink-muted relative border-t border-edge-muted">
- <div class="absolute pattern-edge pattern-diagonal-4 opacity-100 w-full h-4 top-0 -translate-y-[calc(100%_+_1px)] mask-t-from-0" />
- <div class="content bg-dialog min-h-[16rem]">
- <div class="absolute top-3 right-3">
- <DeprecatedIconButton
- icon={CloseIcon}
- theme="clear"
- size="sm"
- tooltip={{ label: 'Close' }}
- onClick={hideAllHelpDrawers}
- />
- </div>
- <div class="panel h-full flex items-center justify-start max-w-[80rem]">
- <div class="left-side h-full py-8 px-4 basis-1/2 border-r border-edge-muted">
- <p class="text-2xl font-medium">{props.title}</p>
- <Show when={props.subtitle}>
- <div class="leading-[1.35] text-base text-balance">
- <div class="pt-3">{props.subtitle}</div>
- </div>
- </Show>
- <Show when={props.cta}>
- {(cta) => (
- <div class="w-full flex justify-start pt-4">
- <button
- onMouseDown={cta().onClick}
- class="cta py-2 px-2 bg-accent/75 text-panel"
- >
- <span class="font-medium">{cta().label.toUpperCase()}</span>
- </button>
- </div>
- )}
- </Show>
- </div>
- <Show
- when={props.hotkeyExamples && !(isTouchDevice() && isMobileWidth())}
- >
- <div class="hotkey-examples-container px-4 py-8 h-full basis-1/2">
- <div class="grid grid-cols-[min-content_1fr] gap-x-8 gap-y-4">
- <For each={props.hotkeyExamples}>
- {(hotkeyExample) => (
- <HotkeyExample
- hotkeyTokenSequence={hotkeyExample.hotkeyTokenSequence}
- subtitle={hotkeyExample.subtitle}
- />
- )}
- </For>
- </div>
- </div>
- </Show>
- </div>
- </div>
- </div>
- );
-}
diff --git a/js/app/packages/app/component/Launcher.tsx b/js/app/packages/app/component/Launcher.tsx
index 912d1f9075..e0a22d64a0 100644
--- a/js/app/packages/app/component/Launcher.tsx
+++ b/js/app/packages/app/component/Launcher.tsx
@@ -154,7 +154,7 @@ export const CREATABLE_BLOCKS: CreatableBlock[] = [
blockName: 'email',
hotkeyToken: TOKENS.create.email,
altHotkeyToken: TOKENS.create.emailNewSplit,
- hotkey: 'e',
+ hotkey: 'l',
keyDownHandler: () => {
createComponent({
componentId: 'email-compose',
diff --git a/js/app/packages/app/component/Onboarding.tsx b/js/app/packages/app/component/Onboarding.tsx
index 8534f1f651..1907be4be9 100644
--- a/js/app/packages/app/component/Onboarding.tsx
+++ b/js/app/packages/app/component/Onboarding.tsx
@@ -9,16 +9,11 @@ import { licenseChannel } from '@core/util/licenseUpdateBroadcastChannel';
import { updateUserInfo } from '@service-gql/client';
import { stripeServiceClient } from '@service-stripe/client';
import { useNavigate, useSearchParams } from '@solidjs/router';
-import {
- BrightJoins,
- BrightJoinsProgressMeter,
-} from '@ui/components/BrightJoins';
-import { createEffect, createSignal, onCleanup, Show } from 'solid-js';
+import { createEffect, onCleanup, Show } from 'solid-js';
export default function Onboarding() {
const { track, TrackingEvents } = withAnalytics();
- const [progress, setProgress] = createSignal(0);
const authenticated = useIsAuthenticated();
const connected = useEmailLinksStatus();
const subscribed = useHasPaidAccess();
@@ -36,8 +31,6 @@ export default function Onboarding() {
.map((b) => +!!b) // unary + converts bool to int
.reduce((a, b) => a + b);
- setProgress((p / steps.length) * 100);
-
if (p === steps.length) {
complete();
}
@@ -132,9 +125,6 @@ export default function Onboarding() {
return (
<div class="relative flex flex-col gap-4 justify-between items-center p-4 md:p-8 m-1 md:m-8 border border-edge max-w-screen overflow-x-hidden">
- <BrightJoins />
- <BrightJoinsProgressMeter progress={progress()} />
-
<header
class="flex max-md:flex-col w-full items-center gap-8"
classList={{
diff --git a/js/app/packages/app/component/PreviewPanel.tsx b/js/app/packages/app/component/PreviewPanel.tsx
index d242c8102b..0a02196c1d 100644
--- a/js/app/packages/app/component/PreviewPanel.tsx
+++ b/js/app/packages/app/component/PreviewPanel.tsx
@@ -9,7 +9,6 @@ import {
createMemo,
createRenderEffect,
createSignal,
- onCleanup,
onMount,
Show,
} from 'solid-js';
@@ -39,6 +38,13 @@ const PreviewPanelContent: Component<NonNullableFields<PreviewPanel>> = (
);
let scopedSplitPanelContextType: SplitPanelContextType = {} as any;
const splitPanelContext = useSplitPanelOrThrow();
+ const scopedLayoutRefs: SplitPanelContextType['layoutRefs'] = {
+ ...props.splitPanelContext.layoutRefs,
+ };
+ // In preview we intentionally do NOT render the split header/title row.
+ // We only provide toolbar slots (Share, etc).
+ scopedLayoutRefs.headerLeft = undefined;
+ scopedLayoutRefs.headerRight = undefined;
if (props.selectedEntity.type === 'project') {
const { getSplitCount } = useSplitLayout();
@@ -102,18 +108,15 @@ const PreviewPanelContent: Component<NonNullableFields<PreviewPanel>> = (
}, props.selectedEntity.id);
createRenderEffect(() => {
- // Temporary fix to prevent toolbarLeft overlapping right content
- if (!splitPanelContext.layoutRefs.toolbarLeft) return;
- splitPanelContext.layoutRefs.toolbarLeft.style.maxWidth = `${splitPanelContext.halfSplitState?.()?.percentage ?? 30}%`;
- onCleanup(() => {
- if (!splitPanelContext.layoutRefs.toolbarLeft) return;
- splitPanelContext.layoutRefs.toolbarLeft.style.maxWidth = '';
- });
+ // noop: previously we constrained toolbarLeft width based on the main split's
+ // halfSplitState. This caused preview topbars (e.g. the hamburger menu) to
+ // appear "hung" from the middle in preview mode.
+ // Keeping this effect slot in case we need future layout hacks.
});
return (
<div
- class="size-full"
+ class="flex flex-col size-full"
onFocusIn={(event) => {
if (interactedWith()) return;
const relatedTarget = event.relatedTarget;
@@ -137,23 +140,47 @@ const PreviewPanelContent: Component<NonNullableFields<PreviewPanel>> = (
tabIndex={-1}
ref={setContainerRef}
>
- <SplitPanelContext.Provider
- value={{
- ...props.splitPanelContext,
- ...scopedSplitPanelContextType,
- layoutRefs: {
- ...props.splitPanelContext.layoutRefs,
- headerLeft: undefined,
- headerRight: undefined,
- },
- halfSplitState: () => ({
- side: 'right',
- percentage: 30,
- }),
+ {/* Preview-specific toolbar slots so blocks can render the "share" bar (via SplitToolbarLeft/Right) */}
+ <div
+ class="relative w-full flex items-center justify-between shrink-0 h-10 pr-1 border-b border-edge-muted/50 bg-panel"
+ classList={{
+ // In spotlight/fullscreen, avoid hugging the screen edge
+ 'pl-2': splitPanelContext.handle.isSpotLight(),
+ 'pl-1': !splitPanelContext.handle.isSpotLight(),
}}
+ data-preview-split-toolbar
>
- <Dynamic component={blockInstance().element} />
- </SplitPanelContext.Provider>
+ <div
+ // In preview mode, anchor left-side controls (e.g. file menu) to the top-left
+ // so the dropdown doesn't feel like it's "hanging" from the middle of the bar.
+ class="flex h-full items-start pt-1 flex-1"
+ ref={(ref) => {
+ scopedLayoutRefs.toolbarLeft = ref;
+ }}
+ />
+ <div
+ class="flex h-full items-center"
+ ref={(ref) => {
+ scopedLayoutRefs.toolbarRight = ref;
+ }}
+ />
+ </div>
+
+ <div class="flex-1 min-h-0">
+ <SplitPanelContext.Provider
+ value={{
+ ...props.splitPanelContext,
+ ...scopedSplitPanelContextType,
+ layoutRefs: scopedLayoutRefs,
+ // Disable halfSplit positioning logic for preview topbars.
+ // The preview panel is already laid out by the outer split; applying halfSplitState
+ // here incorrectly shifts toolbar content towards the middle.
+ halfSplitState: undefined,
+ }}
+ >
+ <Dynamic component={blockInstance().element} />
+ </SplitPanelContext.Provider>
+ </div>
</div>
);
};
diff --git a/js/app/packages/app/component/Soup.tsx b/js/app/packages/app/component/Soup.tsx
index 55490a460c..e17f9bd200 100644
--- a/js/app/packages/app/component/Soup.tsx
+++ b/js/app/packages/app/component/Soup.tsx
@@ -5,15 +5,15 @@ import {
import { useHandleFileUpload } from '@app/util/handleFileUpload';
import { playSound } from '@app/util/sound';
import { useIsAuthenticated } from '@core/auth';
+import { getIconConfig } from '@core/component/EntityIcon';
import { FileDropOverlay } from '@core/component/FileDropOverlay';
-import { DeprecatedButton } from '@core/component/FormControls/DeprecatedButton';
import { SegmentedControl } from '@core/component/FormControls/SegmentControls';
-import { ContextMenuContent, MenuItem } from '@core/component/Menu';
+import { LabelAndHotKey, Tooltip } from '@core/component/Tooltip';
+import { IS_MAC } from '@core/constant/isMac';
+import { useSettingsState } from '@core/constant/SettingsState';
import { fileFolderDrop } from '@core/directive/fileFolderDrop';
import { TOKENS } from '@core/hotkey/tokens';
-import type { RegisterHotkeyReturn } from '@core/hotkey/types';
-import { isTouchDevice } from '@core/mobile/isTouchDevice';
-import { isMobileWidth } from '@core/mobile/mobileWidth';
+import type { RegisterHotkeyReturn, ValidHotkey } from '@core/hotkey/types';
import {
DEFAULT_VIEWS,
type DefaultView,
@@ -21,49 +21,526 @@ import {
type ViewLabel,
} from '@core/types/view';
import { handleFileFolderDrop } from '@core/util/upload';
-import { ContextMenu } from '@kobalte/core/context-menu';
import { Tabs } from '@kobalte/core/tabs';
import {
queryKeys,
useQueryClient as useEntityQueryClient,
} from '@macro-entity';
+import IconGear from '@macro-icons/macro-gear.svg';
+import SearchIcon from '@macro-icons/macro-magnifying-glass.svg';
+import PreviewIcon from '@macro-icons/wide/preview.svg';
+import NoiseIcon from '@macro-icons/wide/noise.svg';
+import SignalIcon from '@macro-icons/wide/signal.svg';
import { createEffectOnEntityTypeNotification } from '@notifications';
import { invalidateEntityNotifications } from '@queries/notification/user-notifications';
import { storageServiceClient } from '@service-storage/client';
+import { createElementSize } from '@solid-primitives/resize-observer';
import { Navigate } from '@solidjs/router';
import { useMutation, useQueryClient } from '@tanstack/solid-query';
import { createDroppable, useDragDropContext } from '@thisbeyond/solid-dnd';
import { registerHotkey } from 'core/hotkey/hotkeys';
import {
+ batch,
type Component,
createEffect,
createMemo,
createSignal,
For,
Match,
+ on,
onCleanup,
+ onMount,
type ParentComponent,
Show,
Switch,
} from 'solid-js';
-import { EntityModal } from './EntityModal/EntityModal';
-import { HelpDrawer } from './HelpDrawer';
import { PreviewPanel } from './PreviewPanel';
import { SuspenseContextComp } from './SuspenseContext';
-import { SplitHeaderLeft } from './split-layout/components/SplitHeader';
-import { SplitTabs } from './split-layout/components/SplitTabs';
+import {
+ SplitHeaderLeft,
+ SplitHeaderRight,
+} from './split-layout/components/SplitHeader';
import { SplitToolbarRight } from './split-layout/components/SplitToolbar';
import { SplitPanelContext } from './split-layout/context';
+import { useSplitLayout } from './split-layout/layout';
import { useSplitPanelOrThrow } from './split-layout/layoutUtils';
import { UnifiedListView } from './UnifiedListView';
+import type { SystemSortOption } from './ViewConfig';
import {
VIEWCONFIG_BASE,
VIEWCONFIG_DEFAULTS_IDS,
type ViewConfigBase,
} from './ViewConfig';
+import { ENTITY_TYPE_FILTERS } from './Soup/utils/filterConfigs';
+import { useFilterActions } from './Soup/hooks/useFilterActions';
+import {
+ FilterButton,
+ FilterDivider,
+ ShortcutLabel,
+} from './Soup/components/FilterButton';
+import { SortDropdown } from './Soup/components/SortDropdown';
false && fileFolderDrop;
+function EntityTypeIconFilter() {
+ const splitContext = useSplitPanelOrThrow();
+ const {
+ splitHotkeyScope,
+ previewState,
+ soupContext: {
+ viewsDataStore,
+ setViewDataStore,
+ selectedView,
+ setSelectedView,
+ },
+ } = splitContext;
+ const [preview, setPreview] = previewState;
+
+ const view = createMemo(() => viewsDataStore[selectedView()]);
+
+ // Search state (must be after view is defined)
+ let searchInputRef: HTMLInputElement | undefined;
+ const [searchFocused, setSearchFocused] = createSignal(false);
+ const searchText = createMemo(() => view()?.searchText ?? '');
+ const setSearchText = (text: string) => {
+ setViewDataStore(selectedView(), 'searchText', text);
+ };
+
+ // Memoized filter accessors
+ const entityTypeFilter = createMemo(
+ () => view()?.filters?.typeFilter ?? VIEWCONFIG_BASE.filters.typeFilter
+ );
+ const channelCategoryFilter = createMemo(
+ () =>
+ view()?.filters?.channelCategoryFilter ??
+ VIEWCONFIG_BASE.filters.channelCategoryFilter
+ );
+ const focusFilters = createMemo(
+ () => view()?.filters?.focusFilters ?? VIEWCONFIG_BASE.filters.focusFilters
+ );
+ const notificationFilter = createMemo(
+ () =>
+ view()?.filters?.notificationFilter ??
+ VIEWCONFIG_BASE.filters.notificationFilter
+ );
+ const unrollNotifications = createMemo(
+ () =>
+ view()?.display?.unrollNotifications ??
+ VIEWCONFIG_BASE.display.unrollNotifications
+ );
+ const documentTypeFilter = createMemo(
+ () =>
+ view()?.filters?.documentTypeFilter ??
+ VIEWCONFIG_BASE.filters.documentTypeFilter
+ );
+
+ // Use the extracted filter actions hook
+ const filterActions = useFilterActions({
+ selectedView,
+ setViewDataStore,
+ entityTypeFilter,
+ documentTypeFilter,
+ channelCategoryFilter,
+ focusFilters,
+ });
+
+ // Ensure state consistency when switching views (not continuous watching)
+ createEffect(
+ on(selectedView, (viewId) => {
+ const focus = focusFilters() ?? [];
+ if (!focus.includes('signal') && !focus.includes('noise')) return;
+
+ batch(() => {
+ if (notificationFilter() !== 'notDone') {
+ setViewDataStore(viewId, 'filters', 'notificationFilter', 'notDone');
+ }
+ if (!unrollNotifications()) {
+ setViewDataStore(viewId, 'display', 'unrollNotifications', true);
+ }
+ });
+ })
+ );
+
+ const isUnreadFilterActive = () => view()?.filters?.unreadOnly === true;
+
+ const toggleUnreadFilter = () => {
+ const current = view()?.filters?.unreadOnly ?? false;
+ setViewDataStore(selectedView(), 'filters', 'unreadOnly', !current);
+ };
+
+ const clearAllFilters = () => {
+ batch(() => {
+ setSelectedView('all');
+ setViewDataStore('all', 'filters', 'typeFilter', []);
+ setViewDataStore('all', 'filters', 'documentTypeFilter', []);
+ setViewDataStore('all', 'filters', 'focusFilters', []);
+ setViewDataStore('all', 'filters', 'notificationFilter', 'all');
+ setViewDataStore('all', 'filters', 'unreadOnly', false);
+ setViewDataStore('all', 'filters', 'channelCategoryFilter', []);
+ });
+ };
+
+ const sortType = createMemo(() => {
+ const sort = view()?.sort;
+ if (sort?.type === 'systemSortOption') {
+ return sort.sortBy;
+ }
+ return 'updated_at';
+ });
+
+ const setSortType = (sortBy: SystemSortOption) => {
+ const currentSort = view()?.sort;
+ setViewDataStore(selectedView(), 'sort', {
+ type: 'systemSortOption',
+ sortBy,
+ sortOrder: currentSort?.sortOrder ?? 'ascending',
+ });
+ };
+
+ const [sortDropdownOpen, setSortDropdownOpen] = createSignal(false);
+
+ // Register all hotkeys
+ const hotkeyConfigs: {
+ hotkey: ValidHotkey;
+ description: string;
+ handler: () => void;
+ }[] = [
+ {
+ hotkey: 'i',
+ description: 'Toggle Inbox',
+ handler: () => filterActions.toggleFocusFilter('signal'),
+ },
+ {
+ hotkey: 'o',
+ description: 'Toggle Other',
+ handler: () => filterActions.toggleFocusFilter('noise'),
+ },
+ ...ENTITY_TYPE_FILTERS.filter((f) => f.enabled).map((f) => ({
+ hotkey: f.shortcut as ValidHotkey,
+ description: `Filter by ${f.label}`,
+ handler: filterActions.getFilterHandler(f),
+ })),
+ {
+ hotkey: 'u',
+ description: 'Filter by Unread',
+ handler: () => toggleUnreadFilter(),
+ },
+ {
+ hotkey: 's',
+ description: 'Open sort menu',
+ handler: () => setSortDropdownOpen((prev) => !prev),
+ },
+ {
+ hotkey: '/',
+ description: 'Clear filters',
+ handler: () => {
+ clearAllFilters();
+ setViewDataStore('all', 'searchText', '');
+ },
+ },
+ {
+ hotkey: 'cmd+f',
+ description: 'Search',
+ handler: () => {
+ searchInputRef?.focus();
+ if (searchInputRef?.value) searchInputRef.select();
+ },
+ },
+ ];
+
+ const hotkeyDisposers = hotkeyConfigs.map((config) =>
+ registerHotkey({
+ hotkey: [config.hotkey],
+ scopeId: splitHotkeyScope,
+ description: config.description,
+ keyDownHandler: () => {
+ config.handler();
+ return true;
+ },
+ })
+ );
+
+ onCleanup(() => {
+ hotkeyDisposers.forEach((d) => d.dispose());
+ });
+
+ // Scroll shadow indicators
+ const [scrollRef, setScrollRef] = createSignal<HTMLDivElement | null>(null);
+ const [leftOpacity, setLeftOpacity] = createSignal(0);
+ const [rightOpacity, setRightOpacity] = createSignal(0);
+ const SCROLL_THRESHOLD = 10;
+
+ // Track size changes to update indicators
+ const size = createElementSize(scrollRef);
+ const containerWidth = () => size.width ?? 0;
+
+ const updateClipIndicators = () => {
+ const ref = scrollRef();
+ if (!ref) return;
+ const { scrollLeft, scrollWidth, clientWidth } = ref;
+
+ const leftAmount = Math.min(scrollLeft, SCROLL_THRESHOLD);
+ setLeftOpacity(leftAmount / SCROLL_THRESHOLD);
+
+ const maxScroll = scrollWidth - clientWidth;
+ const remainingScroll = maxScroll - scrollLeft;
+ const rightAmount = Math.min(remainingScroll, SCROLL_THRESHOLD);
+ setRightOpacity(rightAmount / SCROLL_THRESHOLD);
+ };
+
+ // Update indicators when size changes
+ createEffect(() => {
+ containerWidth(); // Track size changes
+ updateClipIndicators();
+ });
+
+ onMount(() => {
+ const ref = scrollRef();
+ if (!ref) return;
+ ref.addEventListener('scroll', updateClipIndicators);
+ onCleanup(() => ref?.removeEventListener('scroll', updateClipIndicators));
+ });
+
+ return (
+ <div class="relative h-full">
+ {/* Left clip boundary indicator */}
+ <div
+ class="absolute pointer-events-none left-0 top-px bottom-px w-3 z-2 pattern-diagonal-4 pattern-edge mask-r-from-0% border-l border-edge-muted"
+ style={{ opacity: leftOpacity() }}
+ />
+ {/* Right clip boundary indicator */}
+ <div
+ class="absolute pointer-events-none right-0 top-px bottom-px w-3 z-2 pattern-diagonal-4 pattern-edge mask-l-from-0% border-r border-edge-muted"
+ style={{ opacity: rightOpacity() }}
+ />
+ <div
+ class="flex items-center h-full overflow-x-auto scrollbar-hidden overscroll-none"
+ ref={setScrollRef}
+ >
+ {/* Inbox toggle */}
+ <FilterButton
+ icon={SignalIcon}
+ label="Inbox"
+ shortcut="i"
+ isActive={filterActions.isInboxActive}
+ onClick={() => filterActions.toggleFocusFilter('signal')}
+ />
+ {/* Other toggle */}
+ <FilterButton
+ icon={NoiseIcon}
+ label="Other"
+ shortcut="o"
+ isActive={filterActions.isOtherActive}
+ onClick={() => filterActions.toggleFocusFilter('noise')}
+ />
+ <FilterDivider />
+ {/* Unread filter */}
+ <div class="flex items-center mr-0.5 shrink-0">
+ <Tooltip
+ tooltip={<LabelAndHotKey label="Unread Only" shortcut="u" />}
+ >
+ <button
+ type="button"
+ class="flex items-center gap-1 h-[22px] pr-2.5 pl-1 active:bg-accent active:text-panel rounded-full"
+ classList={{
+ 'bg-accent text-panel': isUnreadFilterActive(),
+ 'text-ink-muted hover:text-accent hover:bg-accent/20':
+ !isUnreadFilterActive(),
+ }}
+ onClick={() => toggleUnreadFilter()}
+ >
+ <svg
+ class="size-4"
+ viewBox="0 0 24 24"
+ fill="currentColor"
+ stroke="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <circle cx="12" cy="12" r="4" />
+ </svg>
+ <span class="text-xs leading-none">
+ <ShortcutLabel label="Unread" shortcut="u" />
+ </span>
+ </button>
+ </Tooltip>
+ </div>
+ <div class="mx-0.5 w-px h-5 bg-edge-muted/50 shrink-0" />
+ {/* Entity type icons */}
+ <div class="flex items-center shrink-0">
+ <For each={ENTITY_TYPE_FILTERS.filter((f) => f.enabled)}>
+ {(filter) => {
+ const iconConfig = () => getIconConfig(filter.iconType);
+ return (
+ <FilterButton
+ icon={iconConfig().icon}
+ label={filter.label}
+ shortcut={filter.shortcut}
+ isActive={() => filterActions.isFilterConfigActive(filter)}
+ onClick={filterActions.getFilterHandler(filter)}
+ paddingClass="px-2.5"
+ />
+ );
+ }}
+ </For>
+ </div>
+ <div class="mx-0.5 w-px h-5 bg-edge-muted/50 shrink-0" />
+ {/* Preview toggle */}
+ <Tooltip
+ tooltip={<LabelAndHotKey label="Toggle Preview" shortcut="space" />}
+ >
+ <button
+ type="button"
+ class="flex items-center gap-1.5 h-[22px] px-2.5 active:bg-accent active:text-panel rounded-full"
+ classList={{
+ 'bg-accent text-panel': preview(),
+ 'text-ink-muted hover:text-accent hover:bg-accent/20': !preview(),
+ }}
+ onClick={() => {
+ playSound('open');
+ setPreview((prev) => !prev);
+ }}
+ >
+ <PreviewIcon class="size-3.5" />
+ <span class="text-xs leading-none">
+ <ShortcutLabel label="Preview" shortcut="space" />
+ </span>
+ </button>
+ </Tooltip>
+ <FilterDivider />
+ {/* Sort dropdown */}
+ <SortDropdown
+ value={sortType}
+ onChange={setSortType}
+ open={sortDropdownOpen}
+ onOpenChange={setSortDropdownOpen}
+ />
+ <FilterDivider />
+ {/* Filter search bar */}
+ <div class="flex items-center shrink-0">
+ <Tooltip tooltip={<LabelAndHotKey label="Filter" shortcut="⌘F" />}>
+ <div
+ class="relative flex items-center gap-1.5 h-[22px] px-2.5 rounded-full"
+ classList={{
+ 'bg-accent text-panel': !!searchText() && !searchFocused(),
+ 'text-ink-muted hover:text-accent hover:bg-accent/20':
+ !searchText() || searchFocused(),
+ }}
+ onClick={() => searchInputRef?.focus()}
+ >
+ <SearchIcon class="size-3.5 shrink-0" />
+ <Show when={!searchText() && !searchFocused()}>
+ <span class="text-xs leading-none pointer-events-none">
+ <span class="underline underline-offset-2 decoration-current/60">
+ {IS_MAC ? '⌘' : '^'}F
+ </span>
+ <span>ilter</span>
+ </span>
+ </Show>
+ <input
+ ref={(el) => {
+ searchInputRef = el;
+ }}
+ type="text"
+ value={searchText()}
+ onInput={(e) => setSearchText(e.currentTarget.value)}
+ onFocus={() => setSearchFocused(true)}
+ onBlur={() => setSearchFocused(false)}
+ onKeyDown={(e) => {
+ if (
+ e.key === 'Escape' ||
+ e.key === 'Enter' ||
+ e.key === 'ArrowDown'
+ ) {
+ e.preventDefault();
+ e.currentTarget.blur();
+ }
+ }}
+ class="p-0 text-xs bg-transparent border-none outline-none ring-0 focus:outline-none focus:ring-0 cursor-default"
+ style={{
+ width:
+ !searchText() && !searchFocused()
+ ? '0'
+ : `${Math.max(5, searchText().length + 1)}ch`,
+ }}
+ />
+ </div>
+ </Tooltip>
+ </div>
+ </div>
+ </div>
+ );
+}
+
+function ClearFiltersButton() {
+ const splitContext = useSplitPanelOrThrow();
+ const {
+ soupContext: { setViewDataStore, setSelectedView },
+ } = splitContext;
+
+ const clearAllFilters = () => {
+ batch(() => {
+ setSelectedView('all');
+ setViewDataStore('all', 'filters', 'typeFilter', []);
+ setViewDataStore('all', 'filters', 'documentTypeFilter', []);
+ setViewDataStore('all', 'filters', 'focusFilters', []);
+ setViewDataStore('all', 'filters', 'notificationFilter', 'all');
+ setViewDataStore('all', 'filters', 'unreadOnly', false);
+ setViewDataStore('all', 'filters', 'channelCategoryFilter', []);
+ setViewDataStore('all', 'searchText', '');
+ });
+ };
+
+ return (
+ <Tooltip tooltip={<LabelAndHotKey label="Clear filters" shortcut="/" />}>
+ <button
+ type="button"
+ class="flex items-center gap-1.5 h-[22px] px-2.5 rounded-full text-ink-muted hover:text-accent hover:bg-accent/20 active:bg-accent active:text-panel"
+ onClick={clearAllFilters}
+ >
+ <span class="text-sm leading-none">✕</span>
+ <span class="text-xs leading-none">
+ Clear
+ <span class="ml-1 font-mono opacity-70">/</span>
+ </span>
+ </button>
+ </Tooltip>
+ );
+}
+
+function SettingsButton() {
+ const { settingsOpen, toggleSettings } = useSettingsState();
+ const { getSplitCount } = useSplitLayout();
+
+ // Hide settings button when there are multiple splits
+ const isSingleSplit = () => getSplitCount() <= 1;
+
+ return (
+ <Show when={isSingleSplit()}>
+ <Tooltip
+ tooltip={
+ <LabelAndHotKey
+ label={settingsOpen() ? 'Close Settings' : 'Open Settings'}
+ hotkeyToken={TOKENS.global.toggleSettings}
+ />
+ }
+ >
+ <button
+ type="button"
+ class="relative flex items-center justify-center size-[22px] rounded-full active:bg-accent active:text-panel"
+ classList={{
+ 'bg-hover text-ink': settingsOpen(),
+ 'text-ink-muted hover:text-accent hover:bg-accent/20':
+ !settingsOpen(),
+ }}
+ onClick={() => toggleSettings()}
+ >
+ <IconGear class="size-3.5" />
+ </button>
+ </Tooltip>
+ </Show>
+ );
+}
+
const ViewTab: ParentComponent<{
viewId: ViewId;
}> = (props) => {
@@ -91,7 +568,16 @@ const SuspenseUnifiedListFallback = () => {
runWarningLog();
- return null;
+ // Return a skeleton that maintains layout instead of null to avoid black flash
+ return (
+ <div class="size-full flex flex-col gap-1 p-2 animate-pulse">
+ <div class="h-12 bg-surface-2 rounded" />
+ <div class="h-12 bg-surface-2 rounded" />
+ <div class="h-12 bg-surface-2 rounded" />
+ <div class="h-12 bg-surface-2 rounded" />
+ <div class="h-12 bg-surface-2 rounded" />
+ </div>
+ );
};
const ViewWithSearch: Component<{
@@ -114,7 +600,7 @@ const ViewWithSearch: Component<{
</Match>
<Match when={true}>
<SuspenseContextComp fallback={<SuspenseUnifiedListFallback />}>
- <UnifiedListView />
+ <UnifiedListView hideToolbar />
</SuspenseContextComp>
</Match>
</Switch>
@@ -135,8 +621,6 @@ export function Soup() {
selectedView,
setSelectedView,
entityListRefSignal: [, setEntityListRef],
- showHelpDrawer,
- setShowHelpDrawer,
},
} = splitPanelContext;
const view = createMemo(() => viewsData[selectedView()]);
@@ -157,25 +641,7 @@ export function Soup() {
hotkeyDisposers.push(
registerHotkey({
- hotkey: ['shift+/'],
- scopeId: splitHotkeyScope,
- description: () =>
- `${showHelpDrawer().has(selectedView() as DefaultView) ? 'Hide' : 'Show'} help drawer`,
- hotkeyToken: TOKENS.split.showHelpDrawer,
- keyDownHandler: () => {
- if (showHelpDrawer().has(selectedView() as DefaultView)) {
- setShowHelpDrawer(new Set<DefaultView>());
- } else {
- setShowHelpDrawer(new Set(DEFAULT_VIEWS));
- }
- return true;
- },
- })
- );
-
- hotkeyDisposers.push(
- registerHotkey({
- hotkey: ['p'],
+ hotkey: ['space'],
scopeId: splitHotkeyScope,
description: 'Toggle Preview',
hotkeyToken: TOKENS.unifiedList.togglePreview,
@@ -238,8 +704,6 @@ export function Soup() {
}
);
- const saveViewMutation = useUpsertSavedViewMutation();
-
let tabsRef: HTMLDivElement | undefined;
onCleanup(() => {
@@ -247,48 +711,6 @@ export function Soup() {
hotkeyDisposers.forEach((disposer) => disposer.dispose());
});
- const TabContextMenu = (props: { value: ViewId; label: string }) => {
- const [isModalOpen, setIsModalOpen] = createSignal(false);
- const isDefaultView = () =>
- VIEWCONFIG_DEFAULTS_IDS.includes(props.value as DefaultView);
- return (
- <Show when={!isDefaultView()}>
- <ContextMenu>
- <ContextMenu.Trigger class="absolute inset-0" />
- <ContextMenu.Portal>
- <ContextMenuContent mobileFullScreen>
- <MenuItem
- text="Rename"
- disabled={isDefaultView()}
- onClick={() => {
- setTimeout(() => {
- setIsModalOpen(true);
- });
- // Don't mutate here, let the modal handle it
- }}
- />
- <MenuItem
- text="Delete"
- disabled={isDefaultView()}
- onClick={() => {
- saveViewMutation.mutate({
- id: props.value,
- });
- }}
- />
- </ContextMenuContent>
- </ContextMenu.Portal>
- </ContextMenu>
- <EntityModal
- isOpen={isModalOpen}
- setIsOpen={setIsModalOpen}
- view={() => 'rename'}
- viewId={props.value}
- />
- </Show>
- );
- };
-
return (
<div
class="relative flex flex-col bg-panel size-full"
@@ -333,36 +755,15 @@ export function Soup() {
onChange={setSelectedView}
>
<SplitHeaderLeft>
- <SplitTabs
- list={Object.values(viewsData).map((view, index) => ({
- value: view.id,
- label: view.view,
- index: index,
- }))}
- active={selectedView}
- contextMenu={({ value, label }) => (
- <TabContextMenu value={value} label={label} />
- )}
- newButton={
- <div class="flex items-center px-2 h-full">
- <DeprecatedButton
- size="Base"
- classList={{
- '!border-transparent hover:!border-ink/50 px-1 !text-ink !bg-panel font-medium': true,
- }}
- onClick={() => {
- saveViewMutation.mutate({
- name: 'New View',
- config: VIEWCONFIG_BASE,
- });
- }}
- >
- +
- </DeprecatedButton>
- </div>
- }
- />
+ <EntityTypeIconFilter />
</SplitHeaderLeft>
+ <SplitHeaderRight>
+ <div class="flex items-center h-full gap-0.5">
+ <ClearFiltersButton />
+ <div class="mx-0.5 w-px h-5 bg-edge-muted/50 shrink-0" />
+ <SettingsButton />
+ </div>
+ </SplitHeaderRight>
<For each={Object.keys(viewsData)}>
{(viewId) => <ViewWithSearch viewId={viewId} />}
</For>
@@ -376,20 +777,12 @@ export function Soup() {
/>
</Show>
</div>
- <Show
- when={
- showHelpDrawer().has(selectedView() as DefaultView) &&
- !(isTouchDevice() && isMobileWidth())
- }
- >
- <HelpDrawer viewId={view().id} />
- </Show>
</div>
);
}
function AllView() {
- return <UnifiedListView />;
+ return <UnifiedListView hideToolbar />;
}
function EmailView() {
@@ -402,7 +795,7 @@ function EmailView() {
return (
<>
- <UnifiedListView />
+ <UnifiedListView hideToolbar />
<SplitToolbarRight>
<div class="flex flex-row items-center pr-2">
<SegmentedControl
diff --git a/js/app/packages/app/component/Soup/components/FilterButton.tsx b/js/app/packages/app/component/Soup/components/FilterButton.tsx
new file mode 100644
index 0000000000..4d0dc5c734
--- /dev/null
+++ b/js/app/packages/app/component/Soup/components/FilterButton.tsx
@@ -0,0 +1,72 @@
+import type { Component } from 'solid-js';
+import { Dynamic } from 'solid-js/web';
+import { LabelAndHotKey, Tooltip } from '@core/component/Tooltip';
+
+const SHORTCUT_SUFFIXES: Record<string, string> = { space: '␣', '/': '/' };
+
+export const ShortcutLabel: Component<{ label: string; shortcut: string }> = (
+ props
+) => {
+ const s = props.shortcut.trim();
+ if (!s) return <>{props.label}</>;
+
+ const suffix = SHORTCUT_SUFFIXES[s.toLowerCase()] ?? SHORTCUT_SUFFIXES[s];
+ if (suffix) {
+ return (
+ <>
+ {props.label}
+ <span class="ml-1 font-mono opacity-70">{suffix}</span>
+ </>
+ );
+ }
+
+ const idx = props.label.toLowerCase().indexOf(s.toLowerCase());
+ if (idx === -1) return <>{props.label}</>;
+
+ return (
+ <>
+ {props.label.slice(0, idx)}
+ <span class="underline underline-offset-2 decoration-current/60">
+ {props.label.slice(idx, idx + s.length)}
+ </span>
+ {props.label.slice(idx + s.length)}
+ </>
+ );
+};
+
+export interface FilterButtonProps {
+ icon: Component<{ class?: string }>;
+ label: string;
+ shortcut: string;
+ isActive: () => boolean;
+ onClick: () => void;
+ paddingClass?: string;
+}
+
+export const FilterButton: Component<FilterButtonProps> = (props) => (
+ <div class="flex items-center mr-0.5 shrink-0">
+ <Tooltip
+ tooltip={<LabelAndHotKey label={props.label} shortcut={props.shortcut} />}
+ >
+ <button
+ type="button"
+ class={`flex items-center gap-1 h-[22px] ${props.paddingClass ?? 'pl-2 pr-2.5'} active:bg-accent active:text-panel rounded-full`}
+ classList={{
+ 'bg-accent text-panel': props.isActive(),
+ 'text-ink-muted hover:text-accent hover:bg-accent/20':
+ !props.isActive(),
+ }}
+ onClick={props.onClick}
+ >
+ <Dynamic component={props.icon} class="size-4.5" />
+ <span class="text-xs leading-none">
+ <ShortcutLabel label={props.label} shortcut={props.shortcut} />
+ </span>
+ </button>
+ </Tooltip>
+ </div>
+);
+
+export const FilterDivider: Component = () => (
+ <div class="mx-0.5 w-px h-5 bg-edge-muted/50 shrink-0" />
+);
diff --git a/js/app/packages/app/component/Soup/components/SortDropdown.tsx b/js/app/packages/app/component/Soup/components/SortDropdown.tsx
new file mode 100644
index 0000000000..a6a8cc0dd1
--- /dev/null
+++ b/js/app/packages/app/component/Soup/components/SortDropdown.tsx
@@ -0,0 +1,130 @@
+import { type Component, createSignal, For, Show } from 'solid-js';
+import { Popover } from '@kobalte/core/popover';
+import { LabelAndHotKey, Tooltip } from '@core/component/Tooltip';
+import SortIcon from '@macro-icons/wide/sort.svg';
+import type { SystemSortOption } from '../../ViewConfig';
+import { ShortcutLabel } from './FilterButton';
+
+export interface SortOption {
+ value: SystemSortOption;
+ label: string;
+}
+
+export const SORT_OPTIONS: SortOption[] = [
+ { value: 'viewed_at', label: 'Viewed' },
+ { value: 'updated_at', label: 'Updated' },
+ { value: 'created_at', label: 'Created' },
+];
+
+export interface SortDropdownProps {
+ /** Current sort value */
+ value: () => SystemSortOption;
+ /** Handler for sort change */
+ onChange: (value: SystemSortOption) => void;
+ /** Available sort options (defaults to SORT_OPTIONS) */
+ options?: SortOption[];
+ /** Controlled open state (optional - uses internal state if not provided) */
+ open?: () => boolean;
+ /** Controlled open state setter (optional - uses internal state if not provided) */
+ onOpenChange?: (open: boolean) => void;
+}
+
+export const SortDropdown: Component<SortDropdownProps> = (props) => {
+ // Internal state for uncontrolled mode
+ const [internalOpen, setInternalOpen] = createSignal(false);
+ const [focusedIndex, setFocusedIndex] = createSignal(0);
+
+ // Use controlled or uncontrolled state
+ const open = () => props.open?.() ?? internalOpen();
+ const setOpen = (isOpen: boolean) => {
+ if (props.onOpenChange) {
+ props.onOpenChange(isOpen);
+ } else {
+ setInternalOpen(isOpen);
+ }
+ };
+
+ const options = () => props.options ?? SORT_OPTIONS;
+
+ const handleKeyDown = (e: KeyboardEvent) => {
+ const totalItems = options().length;
+
+ if (e.key === 'ArrowDown') {
+ e.preventDefault();
+ setFocusedIndex((prev) => (prev + 1) % totalItems);
+ } else if (e.key === 'ArrowUp') {
+ e.preventDefault();
+ setFocusedIndex((prev) => (prev - 1 + totalItems) % totalItems);
+ } else if (e.key === 'Enter') {
+ e.preventDefault();
+ props.onChange(options()[focusedIndex()].value);
+ setOpen(false);
+ } else if (e.key === 'Escape') {
+ e.preventDefault();
+ setOpen(false);
+ }
+ };
+
+ return (
+ <Popover
+ open={open()}
+ onOpenChange={(isOpen) => {
+ setOpen(isOpen);
+ if (isOpen) setFocusedIndex(0);
+ }}
+ placement="bottom-start"
+ gutter={4}
+ >
+ <Tooltip tooltip={<LabelAndHotKey label="Sort" shortcut="s" />}>
+ <Popover.Trigger
+ as="button"
+ type="button"
+ class="flex items-center gap-1.5 h-[22px] px-2.5 shrink-0 rounded-full active:bg-accent active:text-panel"
+ classList={{
+ 'bg-accent text-panel': open(),
+ 'text-ink-muted hover:text-accent hover:bg-accent/20': !open(),
+ }}
+ >
+ <SortIcon class="size-3.5" />
+ <span class="text-xs leading-none">
+ <ShortcutLabel label="Sort" shortcut="s" />
+ </span>
+ </Popover.Trigger>
+ </Tooltip>
+ <Popover.Portal>
+ <Popover.Content
+ class="z-50 bg-panel border border-edge-muted shadow-lg"
+ tabIndex={0}
+ ref={(el) => setTimeout(() => el?.focus(), 0)}
+ onKeyDown={handleKeyDown}
+ >
+ <div class="flex flex-col gap-1 p-2 min-w-[140px]">
+ <For each={options()}>
+ {(option, index) => (
+ <button
+ type="button"
+ class="flex items-center justify-between px-2 py-1.5 text-sm hover:bg-hover"
+ classList={{
+ 'bg-hover text-ink': props.value() === option.value,
+ 'text-ink': props.value() !== option.value,
+ 'bg-hover': focusedIndex() === index(),
+ }}
+ onClick={() => {
+ props.onChange(option.value);
+ setOpen(false);
+ }}
+ onMouseEnter={() => setFocusedIndex(index())}
+ >
+ <span>{option.label}</span>
+ <Show when={props.value() === option.value}>
+ <span class="text-ink">✓</span>
+ </Show>
+ </button>
+ )}
+ </For>
+ </div>
+ </Popover.Content>
+ </Popover.Portal>
+ </Popover>
+ );
+};
diff --git a/js/app/packages/app/component/Soup/hooks/useFilterActions.ts b/js/app/packages/app/component/Soup/hooks/useFilterActions.ts
new file mode 100644
index 0000000000..b033e54717
--- /dev/null
+++ b/js/app/packages/app/component/Soup/hooks/useFilterActions.ts
@@ -0,0 +1,189 @@
+import { produce } from 'solid-js/store';
+import type { SetStoreFunction } from 'solid-js/store';
+import type { Accessor } from 'solid-js';
+import type { ViewId } from '@core/types/view';
+import type { ExpandedEntityType } from '@macro-entity';
+import { match } from 'ts-pattern';
+import type { DocumentTypeFilter, ViewDataMap } from '../../ViewConfig';
+import {
+ type EntityTypeFilterConfig,
+ FOCUS_FILTER_CONFIGS,
+ type FocusFilterTarget,
+} from '../utils/filterConfigs';
+import {
+ isChannelCategoryActive,
+ isDocumentPresetActive,
+ isEntityTypeFilterActive,
+ isFocusFilterActive,
+} from '../utils/filterHelpers';
+
+export interface UseFilterActionsParams {
+ selectedView: Accessor<ViewId>;
+ setViewDataStore: SetStoreFunction<ViewDataMap>;
+ entityTypeFilter: Accessor<ExpandedEntityType[]>;
+ documentTypeFilter: Accessor<DocumentTypeFilter[]>;
+ channelCategoryFilter: Accessor<('people' | 'groups')[] | undefined>;
+ focusFilters: Accessor<('signal' | 'noise')[] | undefined>;
+}
+
+export function useFilterActions(params: UseFilterActionsParams) {
+ const {
+ selectedView,
+ setViewDataStore,
+ entityTypeFilter,
+ documentTypeFilter,
+ channelCategoryFilter,
+ focusFilters,
+ } = params;
+
+ const isInboxActive = () => isFocusFilterActive(focusFilters(), 'signal');
+ const isOtherActive = () => isFocusFilterActive(focusFilters(), 'noise');
+ const isEntityTypeActive = (type: ExpandedEntityType) =>
+ isEntityTypeFilterActive(entityTypeFilter(), type);
+ const isDocPresetActive = (types: DocumentTypeFilter[]) =>
+ isDocumentPresetActive(entityTypeFilter(), documentTypeFilter(), types);
+ const isChannelCatActive = (category: 'people' | 'groups') =>
+ isChannelCategoryActive(
+ entityTypeFilter(),
+ channelCategoryFilter() ?? [],
+ category
+ );
+
+ const clearTopbarTypeFilters = () => {
+ setViewDataStore(
+ selectedView(),
+ 'filters',
+ produce((filters) => {
+ filters.typeFilter = [];
+ filters.documentTypeFilter = [];
+ filters.channelCategoryFilter = [];
+ })
+ );
+ };
+
+ const toggleFocusFilter = (target: FocusFilterTarget) => {
+ const isActive = target === 'signal' ? isInboxActive() : isOtherActive();
+ const config = isActive
+ ? FOCUS_FILTER_CONFIGS.none
+ : FOCUS_FILTER_CONFIGS[target];
+ const viewId = selectedView();
+
+ setViewDataStore(viewId, 'filters', 'focusFilters', [
+ ...config.focusFilters,
+ ]);
+ setViewDataStore(
+ viewId,
+ 'filters',
+ 'notificationFilter',
+ config.notificationFilter
+ );
+ setViewDataStore(
+ viewId,
+ 'display',
+ 'unrollNotifications',
+ config.unrollNotifications
+ );
+ };
+
+ const setExclusiveEntityTypeFilter = (type: ExpandedEntityType) => {
+ if (isEntityTypeActive(type)) {
+ clearTopbarTypeFilters();
+ return;
+ }
+ setViewDataStore(
+ selectedView(),
+ 'filters',
+ produce((filters) => {
+ filters.typeFilter = [type];
+ filters.documentTypeFilter = [];
+ filters.channelCategoryFilter = [];
+ })
+ );
+ };
+
+ const toggleDocumentPreset = (preset: DocumentTypeFilter[]) => {
+ if (entityTypeFilter().length === 1 && isDocPresetActive(preset)) {
+ clearTopbarTypeFilters();
+ return;
+ }
+ setViewDataStore(
+ selectedView(),
+ 'filters',
+ produce((filters) => {
+ filters.typeFilter = ['document'];
+ filters.documentTypeFilter = preset;
+ filters.channelCategoryFilter = [];
+ })
+ );
+ };
+
+ const toggleChannelCategoryFilter = (category: 'people' | 'groups') => {
+ const isActive =
+ entityTypeFilter().length === 1 &&
+ entityTypeFilter()[0] === 'channel' &&
+ isChannelCatActive(category);
+
+ if (isActive) {
+ clearTopbarTypeFilters();
+ return;
+ }
+ setViewDataStore(
+ selectedView(),
+ 'filters',
+ produce((filters) => {
+ filters.typeFilter = ['channel'];
+ filters.channelCategoryFilter = [category];
+ filters.documentTypeFilter = [];
+ })
+ );
+ };
+
+ const getFilterHandler = (filter: EntityTypeFilterConfig): (() => void) => {
+ return match(filter)
+ .with(
+ { kind: 'documentPreset' },
+ (f) => () => toggleDocumentPreset(f.documentTypes)
+ )
+ .with(
+ { kind: 'channelCategory' },
+ (f) => () => toggleChannelCategoryFilter(f.channelCategory)
+ )
+ .with(
+ { kind: 'entityType' },
+ (f) => () => setExclusiveEntityTypeFilter(f.type)
+ )
+ .exhaustive();
+ };
+
+ const isFilterConfigActive = (filter: EntityTypeFilterConfig): boolean => {
+ return match(filter)
+ .with(
+ { kind: 'documentPreset' },
+ (f) =>
+ entityTypeFilter().length === 1 && isDocPresetActive(f.documentTypes)
+ )
+ .with(
+ { kind: 'channelCategory' },
+ (f) =>
+ entityTypeFilter().length === 1 &&
+ isChannelCatActive(f.channelCategory)
+ )
+ .with({ kind: 'entityType' }, (f) => isEntityTypeActive(f.type))
+ .exhaustive();
+ };
+
+ return {
+ isInboxActive,
+ isOtherActive,
+ isEntityTypeActive,
+ isDocPresetActive,
+ isChannelCatActive,
+ isFilterConfigActive,
+ clearTopbarTypeFilters,
+ toggleFocusFilter,
+ setExclusiveEntityTypeFilter,
+ toggleDocumentPreset,
+ toggleChannelCategoryFilter,
+ getFilterHandler,
+ };
+}
diff --git a/js/app/packages/app/component/Soup/utils/filterConfigs.ts b/js/app/packages/app/component/Soup/utils/filterConfigs.ts
new file mode 100644
index 0000000000..d73fc33f0d
--- /dev/null
+++ b/js/app/packages/app/component/Soup/utils/filterConfigs.ts
@@ -0,0 +1,124 @@
+import type { ExpandedEntityType } from '@macro-entity';
+import type { DocumentTypeFilter, FilterOptions } from '../../ViewConfig';
+import { ENABLE_TASKS_TABS } from '@core/constant/featureFlags';
+
+/**
+ * Discriminated union for entity type filter configurations.
+ * Each kind determines which fields are valid, making illegal states unrepresentable.
+ */
+export type EntityTypeFilterConfig =
+ | {
+ kind: 'entityType';
+ type: ExpandedEntityType;
+ label: string;
+ iconType: string;
+ enabled: boolean;
+ shortcut: string;
+ }
+ | {
+ kind: 'channelCategory';
+ channelCategory: 'people' | 'groups';
+ label: string;
+ iconType: string;
+ enabled: boolean;
+ shortcut: string;
+ }
+ | {
+ kind: 'documentPreset';
+ type: 'document';
+ documentTypes: DocumentTypeFilter[];
+ label: string;
+ iconType: string;
+ enabled: boolean;
+ shortcut: string;
+ };
+
+/**
+ * Entity type filter button configurations for the topbar.
+ * Only one filter can be active at a time (exclusive selection).
+ */
+export const ENTITY_TYPE_FILTERS: EntityTypeFilterConfig[] = [
+ {
+ kind: 'documentPreset',
+ type: 'document',
+ documentTypes: ['md', 'canvas'],
+ label: 'Docs',
+ iconType: 'md',
+ enabled: true,
+ shortcut: 'd',
+ },
+ {
+ kind: 'entityType',
+ type: 'chat',
+ label: 'Agents',
+ iconType: 'chat',
+ enabled: true,
+ shortcut: 'a',
+ },
+ {
+ kind: 'channelCategory',
+ channelCategory: 'people',
+ label: 'People',
+ iconType: 'channel',
+ enabled: true,
+ shortcut: 'p',
+ },
+ {
+ kind: 'channelCategory',
+ channelCategory: 'groups',
+ label: 'Teams',
+ iconType: 'directMessage',
+ enabled: true,
+ shortcut: 'm',
+ },
+ {
+ kind: 'entityType',
+ type: 'task',
+ label: 'Tasks',
+ iconType: 'task',
+ enabled: ENABLE_TASKS_TABS,
+ shortcut: 't',
+ },
+ {
+ kind: 'entityType',
+ type: 'email',
+ label: 'Mail',
+ iconType: 'email',
+ enabled: true,
+ shortcut: 'l',
+ },
+ {
+ kind: 'documentPreset',
+ type: 'document',
+ documentTypes: ['code', 'image', 'pdf', 'unknown'],
+ label: 'Files',
+ iconType: 'project',
+ enabled: true,
+ shortcut: 'f',
+ },
+];
+
+/**
+ * Focus filter coupling configuration.
+ * Defines the coupled state that must be set together when toggling inbox/other filters.
+ * This makes the coupling explicit and centralized rather than scattered across toggle functions.
+ */
+export const FOCUS_FILTER_CONFIGS = {
+ signal: {
+ focusFilters: ['signal'] as const,
+ notificationFilter: 'notDone' as FilterOptions['notificationFilter'],
+ unrollNotifications: true,
+ },
+ noise: {
+ focusFilters: ['noise'] as const,
+ notificationFilter: 'notDone' as FilterOptions['notificationFilter'],
+ unrollNotifications: true,
+ },
+ none: {
+ focusFilters: [] as ('signal' | 'noise')[],
+ notificationFilter: 'all' as FilterOptions['notificationFilter'],
+ unrollNotifications: false,
+ },
+} as const;
+
+export type FocusFilterTarget = 'signal' | 'noise';
diff --git a/js/app/packages/app/component/Soup/utils/filterHelpers.ts b/js/app/packages/app/component/Soup/utils/filterHelpers.ts
new file mode 100644
index 0000000000..fa75828c5a
--- /dev/null
+++ b/js/app/packages/app/component/Soup/utils/filterHelpers.ts
@@ -0,0 +1,65 @@
+import type { ExpandedEntityType } from '@macro-entity';
+import type { DocumentTypeFilter } from '../../ViewConfig';
+
+/**
+ * Pure helper for set equality comparison.
+ */
+export const sameSet = <T>(a: readonly T[], b: readonly T[]): boolean => {
+ if (a.length !== b.length) return false;
+ const setA = new Set(a);
+ return b.every((x) => setA.has(x));
+};
+
+/**
+ * Pure predicate: is a specific document preset filter active?
+ * Checks if typeFilter is exactly ['document'] and documentTypeFilter matches targetTypes.
+ */
+export const isDocumentPresetActive = (
+ typeFilter: readonly ExpandedEntityType[],
+ documentTypeFilter: readonly DocumentTypeFilter[],
+ targetTypes: readonly DocumentTypeFilter[]
+): boolean => {
+ if (typeFilter.length !== 1 || typeFilter[0] !== 'document') return false;
+ return sameSet(documentTypeFilter, targetTypes);
+};
+
+/**
+ * Pure predicate: is a specific channel category filter active?
+ * Checks if typeFilter includes 'channel' and categoryFilter is exactly [targetCategory].
+ */
+export const isChannelCategoryActive = (
+ typeFilter: readonly ExpandedEntityType[],
+ categoryFilter: readonly ('people' | 'groups')[],
+ targetCategory: 'people' | 'groups'
+): boolean => {
+ if (typeFilter.length !== 1 || typeFilter[0] !== 'channel') return false;
+ return categoryFilter.length === 1 && categoryFilter[0] === targetCategory;
+};
+
+/**
+ * Pure predicate: is a specific entity type filter active (exclusive)?
+ * Checks if typeFilter is exactly [type].
+ */
+export const isEntityTypeFilterActive = (
+ typeFilter: readonly ExpandedEntityType[],
+ type: ExpandedEntityType
+): boolean => {
+ return typeFilter.length === 1 && typeFilter[0] === type;
+};
+
+/**
+ * Pure predicate: is a focus filter (signal/noise) active?
+ * Signal = Inbox, Noise = Other.
+ */
+export const isFocusFilterActive = (
+ focusFilters: readonly ('signal' | 'noise')[] | undefined,
+ target: 'signal' | 'noise'
+): boolean => {
+ if (!focusFilters || focusFilters.length === 0) return false;
+ // Inbox active means signal is in list and noise is not
+ // Other active means noise is in list and signal is not
+ const hasTarget = focusFilters.includes(target);
+ const opposite = target === 'signal' ? 'noise' : 'signal';
+ const hasOpposite = focusFilters.includes(opposite);
+ return hasTarget && !hasOpposite;
+};
diff --git a/js/app/packages/app/component/SoupContext.tsx b/js/app/packages/app/component/SoupContext.tsx
index 0410ed9d97..390adc8f8c 100644
--- a/js/app/packages/app/component/SoupContext.tsx
+++ b/js/app/packages/app/component/SoupContext.tsx
@@ -4,10 +4,10 @@ import { toast } from '@core/component/Toast/Toast';
import { HotkeyTags } from '@core/hotkey/constants';
import { activeScope, hotkeyScopeTree } from '@core/hotkey/state';
import { TOKENS } from '@core/hotkey/tokens';
-import { HOTKEY_PRIORITY_LOW, type ValidHotkey } from '@core/hotkey/types';
+import { HOTKEY_PRIORITY_LOW } from '@core/hotkey/types';
import { getHotkeyCommand, runCommand } from '@core/hotkey/utils';
import { isModality } from '@core/mobile/inputModality';
-import { DEFAULT_VIEWS, type DefaultView, type ViewId } from '@core/types/view';
+import type { DefaultView, ViewId } from '@core/types/view';
import { getActualTarget } from '@core/util/getActualTarget';
import { isInteractiveElement } from '@core/util/isInteractiveElement';
import { filterMap } from '@core/util/list';
@@ -18,7 +18,6 @@ import { waitForFrames } from '@core/util/sleep';
import { type EntityData, isTaskEntity } from '@macro-entity';
import { entityHasUnreadNotifications } from '@notifications';
import type { PreviewViewStandardLabel } from '@service-email/generated/schemas';
-import { useTutorialCompleted } from '@service-gql/client';
import type { PropertiesEntityType } from '@service-properties/client';
import { useSetPropertyStatusCompleteMutation } from '@queries/properties/entity';
import { storageServiceClient } from '@service-storage/client';
@@ -92,8 +91,6 @@ export type SoupContext = {
entityListRefSignal: Signal<HTMLDivElement | undefined>;
entitiesSignal: Signal<EntityData[] | undefined>;
emailViewSignal: Signal<PreviewViewStandardLabel>;
- showHelpDrawer: Accessor<Set<DefaultView>>;
- setShowHelpDrawer: Setter<Set<DefaultView>>;
actionRegistry: EntityActionRegistry;
isRenderedFromPreview: boolean;
navigateThroughList: NavigateListFn;
@@ -119,8 +116,6 @@ export function createStubSoupContext(): SoupContext {
entityListRefSignal: createSignal(),
entitiesSignal: createSignal(),
emailViewSignal: createSignal<PreviewViewStandardLabel>('all'),
- showHelpDrawer: () => new Set(),
- setShowHelpDrawer: () => {},
actionRegistry: createEntityActionRegistry(),
navigateThroughList: async () => ({
success: false,
@@ -138,7 +133,7 @@ export function createStubSoupContext(): SoupContext {
};
}
-const DEFAULT_VIEW_ID: DefaultView = 'signal';
+const DEFAULT_VIEW_ID: DefaultView = 'all';
const DEFAULT_VIEW_IDS_SET = new Set(VIEWCONFIG_DEFAULTS_IDS);
@@ -163,10 +158,6 @@ export function createSoupContext(props: CreateSoupContextProps): SoupContext {
const collapseEntitySignal = createSignal<CollapseEntityFn | undefined>(
undefined
);
- const tutorialCompleted = useTutorialCompleted();
- const [showHelpDrawer, setShowHelpDrawer] = createSignal<Set<DefaultView>>(
- !tutorialCompleted() ? new Set(DEFAULT_VIEWS) : new Set()
- );
let navigateThroughListFn: NavigateListFn | undefined;
const parentContextSignal = createSignal<SoupContext | undefined>(
@@ -187,8 +178,6 @@ export function createSoupContext(props: CreateSoupContextProps): SoupContext {
entitiesSignal,
emailViewSignal,
collapseEntitySignal,
- showHelpDrawer,
- setShowHelpDrawer,
actionRegistry: createEntityActionRegistry(),
isRenderedFromPreview: props?.isRenderedFromPreview ?? false,
parentContextSignal,
@@ -324,7 +313,6 @@ export function createNavigationEntityListShortcut({
entityListRefSignal: [entityListRef],
virtualizerHandleSignal: [virtualizerHandle],
selectedView,
- setSelectedView,
entitiesSignal: [entities],
actionRegistry,
parentContextSignal: [getParentContext],
@@ -332,7 +320,6 @@ export function createNavigationEntityListShortcut({
activeContextSignal: [activeContext, setActiveContext],
} = soupContext;
const viewData = createMemo(() => viewsData[selectedView()]);
- const viewIds = createMemo<ViewId[]>(() => Object.keys(viewsData));
const [attachEntityHotkeys, _entityHotkeyScope] = useHotkeyDOMScope('entity');
const selectedEntity = () => viewData().selectedEntity;
@@ -449,6 +436,7 @@ export function createNavigationEntityListShortcut({
actionRegistry.register(
'mark_as_done',
async (multiSelectEntities) => {
+ console.log(selectedView());
const handler =
VIEWCONFIG_DEFAULTS[selectedView() as DefaultView]?.hotkeyOptions?.e;
@@ -527,6 +515,7 @@ export function createNavigationEntityListShortcut({
setViewDataStore(selectedView(), 'multiSelectEntities', []);
+ console.log('marked as done');
toast.success('Marked as done');
}
@@ -1381,67 +1370,10 @@ export function createNavigationEntityListShortcut({
hide: true,
});
- const navigateThroughViews = ({
- axis,
- }: {
- axis: 'start' | 'end'; // movement direction
- }) => {
- let index = viewIds().indexOf(selectedView());
- const maxLength = viewIds().length;
- index = (index + (axis === 'start' ? -1 : 1) + maxLength) % maxLength;
- const newViewId = viewIds()[index];
- setSelectedView(newViewId);
- };
-
const splitIsUnifiedList = createMemo(
() => splitHandle.content().id === 'unified-list'
);
- for (let i = 0; i < viewIds().length && i < 9; i++) {
- const viewId = viewIds()[i];
- const viewData = viewsData[viewId];
- registerHotkey({
- hotkeyToken:
- TOKENS.soup.tabs[i.toString() as keyof typeof TOKENS.soup.tabs],
- hotkey: [(i + 1).toString() as ValidHotkey],
- scopeId: splitHotkeyScope,
- description: viewData.view,
- condition: splitIsUnifiedList,
- keyDownHandler: () => {
- setSelectedView(viewData.id);
- return true;
- },
- // displayPriority: 0,
- hide: true,
- });
- }
- 1;
-
- registerHotkey({
- hotkey: 'tab',
- scopeId: splitHotkeyScope,
- description: 'Next View',
- condition: splitIsUnifiedList,
- keyDownHandler: () => {
- navigateThroughViews({ axis: 'end' });
- return true;
- },
- // displayPriority: 0,
- hide: true,
- });
- registerHotkey({
- hotkey: 'shift+tab',
- scopeId: splitHotkeyScope,
- description: 'Previous View',
- condition: splitIsUnifiedList,
- keyDownHandler: () => {
- navigateThroughViews({ axis: 'start' });
- return true;
- },
- // displayPriority: 0,
- hide: true,
- });
-
registerEntityHotkey({
hotkey: ['enter'],
hotkeyToken: TOKENS.entity.open,
diff --git a/js/app/packages/app/component/SuspenseContext.tsx b/js/app/packages/app/component/SuspenseContext.tsx
index 77d192af48..8dbd062eeb 100644
--- a/js/app/packages/app/component/SuspenseContext.tsx
+++ b/js/app/packages/app/component/SuspenseContext.tsx
@@ -32,6 +32,7 @@ export const SuspenseContextComp: ParentComponent<{
fallback?: JSX.Element;
}> = (props) => {
const _id = props.id ?? createUniqueId(); // for debugging
+
const Fallback: ParentComponent = () => {
setIsPending(true);
onCleanup(() => {
diff --git a/js/app/packages/app/component/UnifiedListEmptyState.tsx b/js/app/packages/app/component/UnifiedListEmptyState.tsx
index bed9cfb734..0c18dd5f05 100644
--- a/js/app/packages/app/component/UnifiedListEmptyState.tsx
+++ b/js/app/packages/app/component/UnifiedListEmptyState.tsx
@@ -5,48 +5,15 @@ import { folderSelector } from '@core/directive/folderSelector';
import { useEmailLinksStatus } from '@core/email-link';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { isMobileWidth } from '@core/mobile/mobileWidth';
-import type { DefaultView, ViewId } from '@core/types/view';
+import type { ViewId } from '@core/types/view';
import { handleFolderSelect } from '@core/util/upload';
-import { createMemo, Match, onCleanup, onMount, Show, Switch } from 'solid-js';
-import { useSplitPanelOrThrow } from './split-layout/layoutUtils';
+import { createMemo, Match, Show, Switch } from 'solid-js';
false && fileSelector;
false && folderSelector;
-const EMPTY_STATE_HELP_DRAWER_TIMEOUT_MS = 0;
-
const DEFAULT_EMPTY_MESSAGE = 'No items to show.';
-function EmptyStateHelpDrawer(props: {
- message?: string;
- helpDrawer: DefaultView;
- showDropZone?: boolean;
-}) {
- const {
- soupContext: { setShowHelpDrawer },
- } = useSplitPanelOrThrow();
-
- let timeoutId: ReturnType<typeof setTimeout> | undefined;
-
- // because the empty state can sometimes be mounted and unmounted rapidly, we need to
- // ensure that the help drawer is only shown when this state is stable
- onMount(() => {
- timeoutId = setTimeout(() => {
- setShowHelpDrawer((prev) => new Set([...prev, props.helpDrawer]));
- }, EMPTY_STATE_HELP_DRAWER_TIMEOUT_MS);
- });
- onCleanup(() => {
- clearTimeout(timeoutId);
- });
-
- return (
- <EmptyStateInner
- message={props.message}
- showDropZone={props.showDropZone}
- />
- );
-}
-
export function EmptyState(props: {
viewId?: ViewId;
search?: boolean;
@@ -63,10 +30,7 @@ export function EmptyState(props: {
<EmptyStateInner />
</Match>
<Match when={props.viewId === 'noise' && !emailActive()}>
- <EmptyStateHelpDrawer
- message={'Email not connected.'}
- helpDrawer={'noise'}
- />
+ <EmptyStateInner message={'Email not connected.'} />
</Match>
<Match
when={
@@ -79,45 +43,25 @@ export function EmptyState(props: {
<EmptyStateInner message={'Inbox zero.'} />
</Match>
<Match when={props.viewId === 'signal' && !emailActive()}>
- <EmptyStateHelpDrawer
- message={'Nothing to show. Email not connected.'}
- helpDrawer={'signal'}
- />
+ <EmptyStateInner message={'Nothing to show. Email not connected.'} />
</Match>
<Match when={props.viewId === 'email' && !emailActive()}>
- <EmptyStateHelpDrawer
- message={'Nothing to show. Email not connected.'}
- helpDrawer={'email'}
- />
+ <EmptyStateInner message={'Nothing to show. Email not connected.'} />
</Match>
<Match when={props.viewId === 'people'}>
- <EmptyStateHelpDrawer
- message={'No messages to show.'}
- helpDrawer={'people'}
- />
+ <EmptyStateInner message={'No messages to show.'} />
</Match>
<Match when={props.viewId === 'files'}>
- <EmptyStateHelpDrawer
- message={'No files to show.'}
- helpDrawer={'files'}
- showDropZone
- />
+ <EmptyStateInner message={'No files to show.'} showDropZone />
</Match>
<Match when={props.viewId === 'folders'}>
- <EmptyStateHelpDrawer
- message={'No folders to show.'}
- helpDrawer={'folders'}
- showDropZone
- />
+ <EmptyStateInner message={'No folders to show.'} showDropZone />
</Match>
<Match when={props.viewId === 'tasks'}>
- <EmptyStateHelpDrawer
- message={'No tasks to show.'}
- helpDrawer={'tasks'}
- />
+ <EmptyStateInner message={'No tasks to show.'} />
</Match>
<Match when={props.viewId === 'all'}>
- <EmptyStateHelpDrawer helpDrawer={'all'} />
+ <EmptyStateInner />
</Match>
<Match when={true}>
<EmptyStateInner />
diff --git a/js/app/packages/app/component/UnifiedListView.tsx b/js/app/packages/app/component/UnifiedListView.tsx
index ef3f0b0998..2276598f26 100644
--- a/js/app/packages/app/component/UnifiedListView.tsx
+++ b/js/app/packages/app/component/UnifiedListView.tsx
@@ -2,7 +2,11 @@ import {
useGlobalBlockOrchestrator,
useGlobalNotificationSource,
} from '@app/component/GlobalAppState';
-import { noiseFilter, signalFilter } from '@app/component/soupFilters';
+import {
+ explicitNoiseFilter,
+ noiseFilter,
+ signalFilter,
+} from '@app/component/soupFilters';
import { URL_PARAMS as CHANNEL_PARAMS } from '@block-channel/constants';
import { codeFileExtensions } from '@block-code/util/languageSupport';
import { DeprecatedIconButton } from '@core/component/DeprecatedIconButton';
@@ -238,7 +242,11 @@ export function UnifiedListView(props: UnifiedListViewProps) {
);
const defaultDisplayOptions = mergeProps(
VIEWCONFIG_BASE.display,
- props.defaultDisplayOptions
+ props.defaultDisplayOptions,
+ // When the toolbar is hidden (e.g. `Soup`'s topbar is used instead), users
+ // have no in-view way to toggle this on. Default it to on so unread dots
+ // are visible in the list.
+ props.hideToolbar ? { showUnreadIndicator: true } : {}
);
const splitContext = useSplitPanelOrThrow();
@@ -301,6 +309,7 @@ export function UnifiedListView(props: UnifiedListViewProps) {
const rawSearchText = createMemo<string>(() => view()?.searchText ?? '');
const searchText = createMemo(() => rawSearchText()?.trim() ?? '');
+ // Track entity list ref changes
createEffect(
on(
[localEntityListRef, () => entities_()?.at(0), searchText],
@@ -308,10 +317,7 @@ export function UnifiedListView(props: UnifiedListViewProps) {
if (!localEntityListRef) return;
setEntityListRef(localEntityListRef);
- if (view()?.hasUserInteractedEntity) {
- return;
- }
-
+ if (view()?.hasUserInteractedEntity) return;
if (isTouchDevice()) return;
if (!firstEntity) return;
@@ -320,6 +326,61 @@ export function UnifiedListView(props: UnifiedListViewProps) {
)
);
+ // Stable key for filter state - changes trigger selection reset
+ const filterKey = createMemo(() =>
+ stringify({ viewId: selectedView(), filters: view()?.filters })
+ );
+
+ // Reset selection and scroll when filters change
+ createEffect(
+ on(
+ filterKey,
+ (_current, prev) => {
+ if (isTouchDevice()) return;
+ if (prev === undefined) return; // Skip initial run
+
+ batch(() => {
+ setViewDataStore(selectedView(), 'selectedEntity', undefined);
+ setViewDataStore(selectedView(), 'hasUserInteractedEntity', false);
+ });
+ virtualizerHandle()?.scrollToIndex(0);
+ },
+ { defer: true }
+ )
+ );
+
+ // Auto-select first entity when no selection exists
+ createEffect(() => {
+ if (isTouchDevice()) return;
+ if (view()?.hasUserInteractedEntity) return;
+ if (selectedEntity()) return;
+
+ const first = entities_()?.at(0);
+ if (first) setSelectedEntity(first);
+ });
+
+ // Always keep an entity selected when the list has items (e.g. after deletes).
+ createEffect(
+ on([entities_, selectedEntity], () => {
+ if (isTouchDevice()) return;
+
+ const list = entities_() ?? [];
+ const first = list.at(0);
+ if (!first) return;
+
+ const current = selectedEntity();
+ if (!current) {
+ setSelectedEntity(first);
+ return;
+ }
+
+ const existsInList = entityById().has(current.id);
+ if (!existsInList) {
+ setSelectedEntity(first);
+ }
+ })
+ );
+
const notificationFilter = createMemo(
() =>
view()?.filters?.notificationFilter ??
@@ -367,6 +428,10 @@ export function UnifiedListView(props: UnifiedListViewProps) {
);
};
+ const unreadOnly = createMemo(
+ () => view()?.filters?.unreadOnly ?? defaultFilterOptions.unreadOnly
+ );
+
const entityTypeFilter = createMemo(
() => view()?.filters?.typeFilter ?? defaultFilterOptions.typeFilter
);
@@ -383,6 +448,7 @@ export function UnifiedListView(props: UnifiedListViewProps) {
view()?.filters?.documentTypeFilter ??
defaultFilterOptions.documentTypeFilter
);
+
const setFileTypeFilter: SetStoreFunction<
ViewData['filters']['documentTypeFilter']
> = (...args: any[]) => {
@@ -399,6 +465,10 @@ export function UnifiedListView(props: UnifiedListViewProps) {
() => view()?.filters?.projectFilter ?? defaultFilterOptions.projectFilter
);
+ const channelCategoryFilter = () =>
+ view()?.filters?.channelCategoryFilter ??
+ defaultFilterOptions.channelCategoryFilter;
+
const { all: emailRecipientOptions } = useCombinedRecipients(['user']);
const fromFilter = createMemo(() => view()?.filters.fromFilter);
const hasFromFilter = createMemo(() => fromFilter() !== undefined);
@@ -491,27 +561,23 @@ export function UnifiedListView(props: UnifiedListViewProps) {
setViewDataStore(selectedView(), 'sort', 'sortOrder', order);
};
- const showUnrollNotifications = createMemo(
- () =>
- view()?.display?.unrollNotifications ??
- defaultDisplayOptions.unrollNotifications
- );
- const setShowUnrollNotifications = (
- showUnrollNotifications: DisplayOptions['unrollNotifications']
- ) => {
- setViewDataStore(
- selectedView(),
- 'display',
- 'unrollNotifications',
- showUnrollNotifications
- );
- };
+ // Inbox + notification unrolling are coupled:
+ // - inbox=true => unroll=true
+ // - inbox=false => unroll=false
+ const showUnrollNotifications = createMemo(() => {
+ const focusFilters = view()?.filters?.focusFilters ?? [];
+ return focusFilters.includes('signal') && !focusFilters.includes('noise');
+ });
- const showUnreadIndicator = createMemo(
- () =>
+ const showUnreadIndicator = createMemo(() => {
+ // When the toolbar is hidden, the user has no in-view way to toggle this.
+ // Keep unread indicators visible by default in these contexts.
+ if (props.hideToolbar) return true;
+ return (
view()?.display?.showUnreadIndicator ??
defaultDisplayOptions.showUnreadIndicator
- );
+ );
+ });
const setShowUnreadIndicator = (
showUnreadIndicator: DisplayOptions['showUnreadIndicator']
) => {
@@ -554,7 +620,7 @@ export function UnifiedListView(props: UnifiedListViewProps) {
SEARCH_SERVICE_DEBOUNCE_MS
);
- const [isSearchLoading, setIsSearchLoading] = createSignal(false);
+ const [, setIsSearchLoading] = createSignal(false);
const currentViewConfigBase = createMemo(() => {
const viewKey = selectedView();
@@ -588,9 +654,10 @@ export function UnifiedListView(props: UnifiedListViewProps) {
});
const { setFilters: setOptionalFilters, filterFn: optionalFilter } =
- createFilterComposer();
+ createFilterComposer([signalFilter.predicate]);
+ // Initialize with default inbox filter since focusFilters defaults to ['signal']
const { setFilters: setRequiredFilters, filterFn: requiredFilter } =
- createFilterComposer();
+ createFilterComposer([signalFilter.predicate]);
const toggleFileTypeFilter = (fileType: DocumentTypeFilter) => {
batch(() => {
@@ -692,7 +759,9 @@ export function UnifiedListView(props: UnifiedListViewProps) {
if (importantFilter()) filterFns.push(importantFilterFn);
- if (notificationFilter() === 'unread') filterFns.push(unreadFilterFn);
+ const shouldFilterUnread =
+ unreadOnly() === true || notificationFilter() === 'unread';
+ if (shouldFilterUnread) filterFns.push(unreadFilterFn);
if (notificationFilter() === 'notDone') filterFns.push(notDoneFilterFn);
@@ -700,14 +769,14 @@ export function UnifiedListView(props: UnifiedListViewProps) {
const hasSignalFilter = focusFilters_?.includes('signal') === true;
const hasNoiseFilter = focusFilters_?.includes('noise') === true;
- // We only want to apply these filters when their opposite is not in the list
- // because the filters negate each other
if (hasSignalFilter && !hasNoiseFilter) {
filterFns.push(signalFilter.predicate);
- }
-
- if (hasNoiseFilter && !hasSignalFilter) {
+ } else if (hasNoiseFilter && !hasSignalFilter) {
filterFns.push(noiseFilter.predicate);
+ } else if (!hasSignalFilter && !hasNoiseFilter) {
+ filterFns.push(
+ (entity) => !explicitNoiseFilter.predicate(entity, undefined)
+ );
}
setRequiredFilters(filterFns);
@@ -731,6 +800,21 @@ export function UnifiedListView(props: UnifiedListViewProps) {
});
}
+ const channelCategoryFilter_ = channelCategoryFilter() ?? [];
+ if (channelCategoryFilter_.length > 0) {
+ filterFns.push((entity) => {
+ if (entity.type !== 'channel') return true;
+ const isDm = entity.channelType === 'direct_message';
+ const includePeople = channelCategoryFilter_.includes('people');
+ const includeGroups = channelCategoryFilter_.includes('groups');
+ // Defensive: if both are selected, behave like "no refinement".
+ if (includePeople && includeGroups) return true;
+ if (includePeople) return isDm;
+ if (includeGroups) return !isDm;
+ return true;
+ });
+ }
+
const fileTypeCompatibilityFilter_ = fileTypeCompatibilityFilter();
if (fileTypeCompatibilityFilter_)
filterFns.push(fileTypeCompatibilityFilter_);
@@ -1505,10 +1589,6 @@ export function UnifiedListView(props: UnifiedListViewProps) {
return (
<>
<Show when={!props.hideToolbar}>
- <SearchBar
- isLoading={isSearchLoading}
- setIsLoading={setIsSearchLoading}
- />
<SplitToolbarRight order={5}>
<div class="flex flex-row items-center gap-1 p-1 h-full select-none">
<Show when={isViewConfigChanged()}>
@@ -1710,12 +1790,6 @@ export function UnifiedListView(props: UnifiedListViewProps) {
/>
</section>
<section class="gap-1 grid p-2">
- <ToggleSwitch
- size="SM"
- label="Unroll Notifications"
- checked={showUnrollNotifications()}
- onChange={setShowUnrollNotifications}
- />
<ToggleSwitch
size="SM"
label="Indicate Unread"
@@ -2049,7 +2123,7 @@ const EntityTypeToggle = (props: {
);
};
-function SearchBar(props: {
+function _SearchBar(props: {
isLoading: Accessor<boolean>;
setIsLoading: Setter<boolean>;
}) {
diff --git a/js/app/packages/app/component/ViewConfig.tsx b/js/app/packages/app/component/ViewConfig.tsx
index e4e840f374..d668776be1 100644
--- a/js/app/packages/app/component/ViewConfig.tsx
+++ b/js/app/packages/app/component/ViewConfig.tsx
@@ -25,7 +25,6 @@ import stringify from 'json-stable-stringify';
import { queryClient } from '../../macro-entity/src/queries/client';
import type { PropertyFilter } from './PropertyFilterTypes';
import type { SoupContext } from './SoupContext';
-import { noiseFilter, signalFilter } from './soupFilters';
// for custom views that extend the unified list view
export type ViewType = 'project';
@@ -69,6 +68,15 @@ export type FilterOptions = {
projectFilter?: string;
fromFilter?: WithCustomUserInput<'user' | 'contact'>[];
focusFilters?: ('signal' | 'noise')[];
+ unreadOnly?: boolean;
+ /**
+ * Further refines `channel` entities:
+ * - `people`: direct messages
+ * - `groups`: non-DM channels (private / organization / public)
+ *
+ * Empty array means "no refinement" (i.e. include all channels).
+ */
+ channelCategoryFilter?: Array<'people' | 'groups'>;
propertyFilters?: PropertyFilter[];
};
@@ -144,6 +152,9 @@ export const VIEWCONFIG_BASE: ViewConfigBase = {
documentTypeFilter: [],
projectFilter: undefined,
fromFilter: [],
+ focusFilters: ['signal'],
+ unreadOnly: false,
+ channelCategoryFilter: [],
propertyFilters: [],
},
display: {
@@ -201,6 +212,7 @@ const ALL_VIEWCONFIG_DEFAULTS = {
});
}
if (extra?.notificationSource) {
+ console.log('marking notification as done');
markNotificationsForEntityAsDone(extra.notificationSource, entity);
}
return true;
@@ -301,9 +313,14 @@ const ALL_VIEWCONFIG_DEFAULTS = {
sortBy: 'viewed_at',
},
hotkeyOptions: {
- e: (entity: EntityData) => {
+ e: (entity, extra) => {
if (entity.type === 'email') {
- archiveEmail(entity.id, { isDone: entity.done });
+ archiveEmail(entity.id, {
+ isDone: entity.done,
+ });
+ }
+ if (extra?.notificationSource) {
+ markNotificationsForEntityAsDone(extra.notificationSource, entity);
}
return true;
},
@@ -348,29 +365,6 @@ export const VIEWCONFIG_FILTER_DOCUMENT_TYPE_FILTER: readonly FilterOptions['doc
export const VIEWCONFIG_FILTER_ENTITY_TYPE: readonly FilterOptions['typeFilter'][number][] =
['channel', 'chat', 'document', 'email', 'project', 'task'] as const;
-export const VIEW_CLIENT_FILTERS: Record<ViewId, ClientFilter[]> = {
- signal: [signalFilter],
- noise: [noiseFilter],
- people: [],
- files: [],
- tasks: [],
- folders: [],
- all: [],
-};
-
-export function applyClientFilters(
- entityList: WithNotification<EntityData>[],
- viewId: ViewId,
- ctx?: ClientFilterContext
-): WithNotification<EntityData>[] {
- const filters = VIEW_CLIENT_FILTERS[viewId] ?? [];
- if (filters.length === 0) return entityList;
-
- return entityList.filter((entity) => {
- return filters.every((filter) => filter.predicate(entity, ctx));
- });
-}
-
export async function archiveEmail(
id: string,
options: { isDone: boolean; optimisticallyExclude?: boolean }
diff --git a/js/app/packages/app/component/dock/Dock.tsx b/js/app/packages/app/component/dock/Dock.tsx
index 92a2ff001d..724d80a4d2 100644
--- a/js/app/packages/app/component/dock/Dock.tsx
+++ b/js/app/packages/app/component/dock/Dock.tsx
@@ -10,7 +10,6 @@ import { globalSplitManager } from '@app/signal/splitLayout';
import { ClippedPanel } from '@core/component/ClippedPanel';
import { isMobileWidth } from '@core/mobile/mobileWidth';
import { PresentModeGlitch } from './PresentModeGlitch';
-import IconQuestion from '@icon/regular/question.svg';
import { withAnalytics } from '@coparse/analytics';
import SplitIcon from '@macro-icons/new-split.svg';
import IconAI from '@macro-icons/wide/star.svg';
@@ -18,7 +17,6 @@ import IconGear from '@macro-icons/macro-gear.svg';
import IconLogo from '@macro-icons/macro-logo.svg';
import { BasicTierLimit } from './BasicTierLimit';
import { setKonsoleOpen } from '../command/state';
-import { getActiveCommandByToken, runCommand } from '@core/hotkey/utils';
import { Hotkey } from '@core/component/Hotkey';
import { setCreateMenuOpen } from '../Launcher';
import { useHasPaidAccess } from '@core/auth';
@@ -41,14 +39,6 @@ export function Dock() {
const { settingsOpen, toggleSettings } = useSettingsState();
const hasPaid = useHasPaidAccess();
- const isSoupActive = createMemo(() => {
- const splitId = globalSplitManager()?.activeSplitId();
- if (!splitId) { return false };
- const split = globalSplitManager()?.getSplit(splitId);
- if (!split) { return false };
- return split.content().id === 'unified-list';
- });
-
async function enterPresentMode() {
try {
playSound('Stab_Destruct');
@@ -251,10 +241,6 @@ export function Dock() {
<BasicTierLimit />
</Show>
- {/*<Show when={hasPaid()}>
- <Hints />
- </Show>*/}
-
<div class="w-full"/>
<Show when={ENABLE_DOCK_NOTITIFCATIONS}>
@@ -278,22 +264,6 @@ export function Dock() {
'height': '38px',
'gap': '4px'
}}>
- <Show when={isSoupActive()}>
- <Button
- class="p-1 *:h-4"
- onClick={() => {
- globalSplitManager()?.returnFocus();
- const showHelp = getActiveCommandByToken(TOKENS.split.showHelpDrawer);
- if (!showHelp) { return };
- runCommand(showHelp);
- }}
-
- tooltip={<LabelAndHotKey label='Help' hotkeyToken={TOKENS.split.showHelpDrawer} />}
- >
- <IconQuestion />
- </Button>
- </Show>
-
<Button
onClick={() => {
if (isRightPanelCollapsed()) { track(TrackingEvents.RIGHTBAR.OPEN) }
diff --git a/js/app/packages/app/component/dock/Hints.tsx b/js/app/packages/app/component/dock/Hints.tsx
deleted file mode 100644
index a54cf91bd7..0000000000
--- a/js/app/packages/app/component/dock/Hints.tsx
+++ /dev/null
@@ -1,238 +0,0 @@
-import { useSettingsState } from '@core/constant/SettingsState';
-import { useBigChat } from '@core/signal/layout/bigChat';
-import { GlitchText } from '@ui/components/GlitchText';
-import { createMemo, createSignal, onCleanup, onMount } from 'solid-js';
-import { setKonsoleMode, setKonsoleOpen } from '../command/state';
-import { setCreateMenuOpen } from '../Launcher';
-
-type HintItem = {
- text: string;
- onClick?: () => void;
-};
-
-type HintState = 'hidden' | 'animating' | 'visible' | 'fading' | 'grace-period';
-
-const FADE_DELAY = 1000;
-const GRACE_PERIOD = 3000; // 3 seconds to interact with completed hint
-
-export default function Hints() {
- const [bigChatOpen, setBigChatOpen] = useBigChat();
- const { toggleSettings, setActiveTabId } = useSettingsState();
-
- const HINT_LIST: HintItem[] = [
- {
- text: 'Use ⌘K to find anything instantly',
- onClick: () => setKonsoleOpen(true),
- },
- {
- text: '⌘P for full text search',
- onClick: () => {
- setKonsoleMode('FULL_TEXT_SEARCH');
- setKonsoleOpen(true);
- },
- },
- { text: 'Bigger screens can fit more splits' },
- { text: 'Make today your mission' },
- {
- text: 'Hit C to create anything',
- onClick: () => setCreateMenuOpen(true),
- },
- {
- text: 'You can customize your color scheme in settings',
- onClick: () => {
- toggleSettings();
- setActiveTabId('Appearance');
- },
- },
- {
- text: '40.7411857, -73.9957703',
- onClick: () =>
- window.open(
- 'https://www.google.com/maps/place/54+W+21st+St+s503,+New+York,+NY+10010/@40.7411857,-73.9957703,17z',
- '_blank'
- ),
- },
- {
- text: 'market.macro.com',
- onClick: () => window.open('https://market.macro.com', '_blank'),
- },
- {
- text: 'alt-click will open items in a new split',
- },
- {
- text: '⌘J to ask AI something quickly',
- onClick: () => setBigChatOpen(!bigChatOpen()),
- },
- ];
-
- // State management
- const [hintState, setHintState] = createSignal<HintState>('hidden');
- const [isHovered, setIsHovered] = createSignal(false);
- const [currentHintText, setCurrentHintText] = createSignal<string>('');
- const [recentHints, setRecentHints] = createSignal<number[]>([]);
-
- let fadeTimeoutId: number | undefined;
- let gracePeriodStart: number | null = null;
-
- // Computed values for derived state
- const isAnimating = createMemo(() => hintState() === 'animating');
- const shouldShow = createMemo(() => hintState() !== 'hidden');
- const isClickable = createMemo(() => {
- const recent = recentHints();
- const currentHintIndex = recent[0];
- return (
- currentHintIndex !== undefined && HINT_LIST[currentHintIndex]?.onClick
- );
- });
- const withinGracePeriod = createMemo(() => {
- return (
- gracePeriodStart !== null && Date.now() - gracePeriodStart < GRACE_PERIOD
- );
- });
-
- const clearFadeTimeout = () => {
- if (fadeTimeoutId !== undefined) window.clearTimeout(fadeTimeoutId);
- };
-
- const handleGlitchComplete = () => {
- setHintState('visible');
- gracePeriodStart = Date.now();
-
- // Start fade-out timer only if not hovering
- if (!isHovered()) {
- fadeTimeoutId = window.setTimeout(() => {
- if (!isHovered()) {
- // Start CSS fade transition
- setHintState('fading');
- // After CSS transition completes (2s), set to hidden
- fadeTimeoutId = window.setTimeout(() => {
- setHintState('hidden');
- }, 2000); // Match CSS transition duration
- }
- }, FADE_DELAY);
- }
- };
-
- const startNewHint = (forceIndex?: number) => {
- clearFadeTimeout();
-
- let hintIndex: number;
- if (forceIndex !== undefined) {
- hintIndex = forceIndex;
- } else {
- // Get available hints (excluding recent 3)
- const recent = recentHints();
- const availableIndices = HINT_LIST.map((_, i) => i).filter(
- (i) => !recent.includes(i)
- );
-
- // If no available hints (edge case), use any hint
- if (availableIndices.length === 0) {
- hintIndex = Math.floor(Math.random() * HINT_LIST.length);
- } else {
- hintIndex =
- availableIndices[Math.floor(Math.random() * availableIndices.length)];
- }
- }
-
- // Update recent hints history (keep last 3)
- setRecentHints((prev) => [hintIndex, ...prev.slice(0, 2)]);
-
- const hint = HINT_LIST[hintIndex].text;
-
- gracePeriodStart = null; // Reset grace period
- setCurrentHintText(hint);
- setHintState('animating');
- };
-
- const handleMouseEnter = () => {
- setIsHovered(true);
-
- // If currently animating, let it finish
- if (isAnimating()) {
- return;
- }
-
- // If hint is already visible, keep it visible and cancel any fade timers
- if (hintState() === 'visible') {
- clearFadeTimeout();
- return;
- }
-
- // If fading or within grace period, restore current hint (don't change text!)
- if (hintState() === 'fading' || withinGracePeriod()) {
- clearFadeTimeout();
- setHintState('visible');
- return;
- }
-
- // Only start new hint if we're in hidden state AND not in grace period
- if (hintState() === 'hidden' && !withinGracePeriod()) {
- startNewHint();
- }
- };
-
- const handleMouseLeave = () => {
- setIsHovered(false);
-
- // If hint is visible, start fade timer
- if (hintState() === 'visible') {
- clearFadeTimeout(); // Cancel any existing timer
- fadeTimeoutId = window.setTimeout(() => {
- if (!isHovered()) {
- // Start CSS fade transition
- setHintState('fading');
- // After CSS transition completes (2s), set to hidden
- fadeTimeoutId = window.setTimeout(() => {
- setHintState('hidden');
- }, 2000); // Match CSS transition duration
- }
- }, FADE_DELAY);
- }
- };
-
- const handleClick = () => {
- const recent = recentHints();
- const currentHintIndex = recent[0];
-
- if (currentHintIndex !== undefined) {
- const currentHint = HINT_LIST[currentHintIndex];
-
- // Only handle click if there's an onClick function
- if (currentHint.onClick) {
- currentHint.onClick();
- }
- }
- };
-
- onMount(() => {
- // Auto-trigger first hint on mount
- startNewHint(0);
- });
-
- onCleanup(() => {
- clearFadeTimeout();
- });
-
- return (
- <p
- onMouseEnter={handleMouseEnter}
- onMouseLeave={handleMouseLeave}
- onClick={handleClick}
- class="flex flex-1 whitespace-nowrap justify-center items-center w-full h-full font-mono text-center transition duration-[2s]"
- classList={{
- 'opacity-100': shouldShow(),
- 'opacity-0': !shouldShow(),
- 'cursor-pointer hover:text-glow hover:text-accent transition duration-300':
- !!isClickable(),
- }}
- >
- <GlitchText
- to={currentHintText()}
- framerate={60}
- cycles={1}
- onComplete={handleGlitchComplete}
- />
- </p>
- );
-}
diff --git a/js/app/packages/app/component/settings/Shortcuts.tsx b/js/app/packages/app/component/settings/Shortcuts.tsx
index 68f7491471..3cbee12186 100644
--- a/js/app/packages/app/component/settings/Shortcuts.tsx
+++ b/js/app/packages/app/component/settings/Shortcuts.tsx
@@ -32,7 +32,7 @@ const shortcutSections: ShortcutSection[] = [
{ keys: ['x'], description: `Select items (then ${IS_MAC ? '⌘' : 'Ctrl'}+K to bring up actions)` },
{ keys: ['shift+j', 'shift+arrowdown'], description: `Select down` },
{ keys: ['shift+k', 'shift+arrowup'], description: `Select up` },
- { keys: ['p'], description: 'Preview an item in the side panel' },
+ { keys: ['space'], description: 'Preview an item in the side panel' },
{ keys: ['enter'], description: 'Open an item fullscreen' },
{ keys: [`${cmdOrCtrl}+f`], description: 'Search (uses current filters)' },
],
@@ -42,6 +42,9 @@ const shortcutSections: ShortcutSection[] = [
items: [
{ keys: ['d'], description: 'Filter to docs' },
{ keys: ['l'], description: 'Filter to email' },
+ { keys: ['p'], description: 'Filter to people (direct messages)' },
+ { keys: ['m'], description: 'Filter to teams' },
+ { keys: ['f'], description: 'Filter to files' },
],
},
{
diff --git a/js/app/packages/app/component/soupFilters.ts b/js/app/packages/app/component/soupFilters.ts
index f8929a218c..a2195314a9 100644
--- a/js/app/packages/app/component/soupFilters.ts
+++ b/js/app/packages/app/component/soupFilters.ts
@@ -195,7 +195,7 @@ const getMetadataValue = (
return undefined;
};
-const isSignalEmail = (entity: Extract<EntityData, { type: 'email' }>) => {
+const getEmailSignalInfo = (entity: Extract<EntityData, { type: 'email' }>) => {
const labelTokens = getLabelTokens(entity.labels);
const priorityLabels = SIGNAL_PRIORITY_LABELS();
const depriorityLabels = SIGNAL_DEPRIORITY_LABELS();
@@ -220,11 +220,22 @@ const isSignalEmail = (entity: Extract<EntityData, { type: 'email' }>) => {
)
: false;
- return (
- hasPriorityMetadata ||
- hasPriorityLabel ||
- (!hasDeprioritizingLabel && !hasDeprioritizingMetadata)
- );
+ return {
+ hasPriority: hasPriorityMetadata || hasPriorityLabel,
+ hasDepriority: hasDeprioritizingLabel || hasDeprioritizingMetadata,
+ };
+};
+
+const isSignalEmail = (entity: Extract<EntityData, { type: 'email' }>) => {
+ const { hasPriority, hasDepriority } = getEmailSignalInfo(entity);
+ // Signal = has priority indicators OR has no depriority indicators
+ return hasPriority || !hasDepriority;
+};
+
+const isNoiseEmail = (entity: Extract<EntityData, { type: 'email' }>) => {
+ const { hasPriority, hasDepriority } = getEmailSignalInfo(entity);
+ // Noise = has depriority indicators AND no priority indicators
+ return hasDepriority && !hasPriority;
};
const hasRecentlyViewed = (entity: EntityData) => {
@@ -275,3 +286,19 @@ export const noiseFilter: ClientFilter = {
return !signalFilter.predicate(entity, ctx);
},
};
+
+/**
+ * Explicit noise filter - only returns true for items with explicit noise indicators.
+ * Currently only emails can be "explicit noise" (those with depriority labels/metadata).
+ * Non-email items are never considered explicit noise (they're neutral).
+ */
+export const explicitNoiseFilter: ClientFilter = {
+ id: 'explicitNoise',
+ predicate: (entity, _ctx) => {
+ if (entity.type === 'email') {
+ return isNoiseEmail(entity);
+ }
+ // Non-email items are never explicit noise
+ return false;
+ },
+};
diff --git a/js/app/packages/app/component/split-layout/components/SplitDrawer.tsx b/js/app/packages/app/component/split-layout/components/SplitDrawer.tsx
index cf101bb1f5..fb30ee15b3 100644
--- a/js/app/packages/app/component/split-layout/components/SplitDrawer.tsx
+++ b/js/app/packages/app/component/split-layout/components/SplitDrawer.tsx
@@ -2,7 +2,6 @@ import { DeprecatedIconButton } from '@core/component/DeprecatedIconButton';
import { ScopedPortal } from '@core/component/ScopedPortal';
import { TOKENS } from '@core/hotkey/tokens';
import CloseIcon from '@icon/regular/x.svg';
-import { BrightJoins } from '@ui/components/BrightJoins';
import { registerHotkey } from 'core/hotkey/hotkeys';
import { type JSX, type ParentProps, Show } from 'solid-js';
import { useSplitPanel } from '../layoutUtils';
@@ -122,7 +121,6 @@ export function SplitDrawer(
/>
<div class={getPositionClasses()} style={{ ...getSizeStyle() }}>
<div class={getGradientMaskClasses()} />
- <BrightJoins dots={[true, true, true, true]} />
<div class="flex items-center justify-start gap-2 shrink-0">
<Show when={props.title}>
<h3 class="text-md font-medium text-content-secondary shrink truncate m-3">
diff --git a/js/app/packages/app/component/split-layout/components/SplitHeader.tsx b/js/app/packages/app/component/split-layout/components/SplitHeader.tsx
index f772d8e302..eddc9ec038 100644
--- a/js/app/packages/app/component/split-layout/components/SplitHeader.tsx
+++ b/js/app/packages/app/component/split-layout/components/SplitHeader.tsx
@@ -11,7 +11,7 @@ import CollapseIcon from '@icon/regular/arrows-in.svg';
import ExpandIcon from '@icon/regular/arrows-out.svg';
import CaretLeft from '@icon/regular/caret-left.svg';
import CaretRight from '@icon/regular/caret-right.svg';
-import SplitIcon from '@icon/regular/square-split-horizontal.svg';
+import SplitIcon from '@icon/regular/square-half.svg';
import CloseIcon from '@icon/regular/x.svg';
import IconGear from '@macro-icons/macro-gear.svg';
import { Button } from '@ui/components/Button';
@@ -99,6 +99,7 @@ function SplitSpotlightButton() {
function SplitCloseButton() {
const context = useContext(SplitPanelContext);
if (!context) return null;
+
return (
<Button
class="p-1 *:h-4"
@@ -110,7 +111,7 @@ function SplitCloseButton() {
);
}
-function SplitPreviewToggle() {
+function _SplitPreviewToggle() {
const context = useContext(SplitPanelContext);
if (!ENABLE_PREVIEW || !context || !context.previewState) return null;
@@ -147,7 +148,7 @@ function SplitPreviewToggle() {
);
}
-function SplitControlButtons() {
+function _SplitControlButtons() {
return (
<div class="flex flex-row items-center px-2 h-full shrink-0">
<div class="touch:mobile-width:hidden">
@@ -200,14 +201,20 @@ export function SplitHeader(props: { ref: Setter<HTMLDivElement | null> }) {
return (
<div
- class="isolate relative w-full h-10 overflow-clip text-ink shrink-0"
+ class="isolate relative w-full h-10 overflow-clip text-ink shrink-0 border-b border-edge-muted/50"
data-split-header
ref={props.ref}
>
- <div class="absolute inset-0 flex justify-start items-center bg-panel border-b border-b-edge-muted">
- <SplitControlButtons />
+ <div class="absolute inset-0 flex justify-start items-center bg-panel">
+ <div class="z-2 relative flex items-center bg-panel pl-2 h-full">
+ <div class="touch:mobile-width:hidden">
+ <SplitCloseButton />
+ </div>
+ <SplitBackButton />
+ <SplitForwardButton />
+ </div>
<div
- class="relative w-fit min-w-0 h-full shrink"
+ class="relative w-fit min-w-0 h-full shrink pl-2"
ref={(ref) => {
ctx.layoutRefs.headerLeft = ref;
}}
@@ -225,7 +232,6 @@ export function SplitHeader(props: { ref: Setter<HTMLDivElement | null> }) {
/>
<div class="z-2 relative flex items-center bg-panel pr-2 h-full">
<EntityNavigationIndicator />
- <SplitPreviewToggle />
<SplitSpotlightButton />
</div>
</Show>
diff --git a/js/app/packages/app/component/split-layout/components/SplitLabel.tsx b/js/app/packages/app/component/split-layout/components/SplitLabel.tsx
index 04cb6128c6..267f16059f 100644
--- a/js/app/packages/app/component/split-layout/components/SplitLabel.tsx
+++ b/js/app/packages/app/component/split-layout/components/SplitLabel.tsx
@@ -97,7 +97,7 @@ export function SplitLabel(props: {
export function SplitHeaderBadge(props: { text: string; tooltip?: string }) {
return (
- <span class="mx-1 p-0.5 px-2 border border-edge-muted rounded-full text-[0.625rem] text-ink-muted">
+ <span class="mx-1 p-0.5 px-2 rounded-none text-[0.625rem] text-ink-muted">
<Tooltip tooltip={props.tooltip} spanMode>
<span class="font-mono uppercase">{props.text}</span>
</Tooltip>
diff --git a/js/app/packages/app/component/split-layout/components/SplitTabs.tsx b/js/app/packages/app/component/split-layout/components/SplitTabs.tsx
index 245d46b8d1..637ff1e29f 100644
--- a/js/app/packages/app/component/split-layout/components/SplitTabs.tsx
+++ b/js/app/packages/app/component/split-layout/components/SplitTabs.tsx
@@ -181,9 +181,6 @@ export function SplitTabs(props: {
</span>
<span class="truncate">{label}</span>
</span>
- {/* <Show when={isActive()}>
- <BrightJoins dots={[true, true, true, true]} />
- </Show> */}
{props.contextMenu?.({ label, value })}
</Tabs.Trigger>
);
diff --git a/js/app/packages/app/component/split-layout/components/SplitToolbar.tsx b/js/app/packages/app/component/split-layout/components/SplitToolbar.tsx
index a9b22ccb69..2540951ee0 100644
--- a/js/app/packages/app/component/split-layout/components/SplitToolbar.tsx
+++ b/js/app/packages/app/component/split-layout/components/SplitToolbar.tsx
@@ -12,6 +12,7 @@ import { useSplitPanelOrThrow } from '../layoutUtils';
export function SplitToolbar(props: { ref: Setter<HTMLDivElement | null> }) {
const panel = useSplitPanelOrThrow();
+ const [preview] = panel.previewState;
const [hasContent, setHasContent] = createSignal(false);
const checkContent = () => {
@@ -37,28 +38,33 @@ export function SplitToolbar(props: { ref: Setter<HTMLDivElement | null> }) {
onCleanup(() => observer.disconnect());
});
+ // Hide toolbar when preview is open
+ // The preview panel renders blocks directly without using SplitContainer,
+ // so this only affects the main unified list toolbar
return (
- <div
- class="relative w-full flex items-center justify-between shrink-0"
- classList={{
- 'h-10 px-1 border-b border-edge-muted/50': hasContent(),
- }}
- data-split-toolbar
- ref={props.ref}
- >
+ <Show when={!preview()}>
<div
- class="flex h-full items-center flex-1"
- ref={(ref) => {
- panel.layoutRefs.toolbarLeft = ref;
+ class="relative w-full flex items-center justify-between shrink-0"
+ classList={{
+ 'h-10 px-1 border-b border-edge-muted/50': hasContent(),
}}
- />
- <div
- class="flex h-full items-center"
- ref={(ref) => {
- panel.layoutRefs.toolbarRight = ref;
- }}
- />
- </div>
+ data-split-toolbar
+ ref={props.ref}
+ >
+ <div
+ class="flex h-full items-center flex-1"
+ ref={(ref) => {
+ panel.layoutRefs.toolbarLeft = ref;
+ }}
+ />
+ <div
+ class="flex h-full items-center"
+ ref={(ref) => {
+ panel.layoutRefs.toolbarRight = ref;
+ }}
+ />
+ </div>
+ </Show>
);
}
diff --git a/js/app/packages/app/index.css b/js/app/packages/app/index.css
index c44f60c9a2..bef9be2d7b 100644
--- a/js/app/packages/app/index.css
+++ b/js/app/packages/app/index.css
@@ -501,7 +501,7 @@
@theme default {
/* Font families */
- --font-sans: "Forma Macro", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
+ --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--font-mono: "Forma DJR Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
--font-serif: "Georgia", ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
@@ -598,7 +598,7 @@
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
- font-size: 16.5px;
+ font-size: 16px;
/* Need to set opsz here so that it will apply to MD */
font-variation-settings: "opsz" 11;
font-synthesis: none;
diff --git a/js/app/packages/app/public/crosshair-cursor.svg b/js/app/packages/app/public/crosshair-cursor.svg
index fce8faff8b..7434877ea3 100644
--- a/js/app/packages/app/public/crosshair-cursor.svg
+++ b/js/app/packages/app/public/crosshair-cursor.svg
@@ -1,12 +1,3 @@
-<<<<<<< HEAD
-<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
- <!-- Horizontal line -->
- <line x1="0" y1="16" x2="32" y2="16" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
- <!-- Vertical line -->
- <line x1="16" y1="0" x2="16" y2="32" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
- <!-- Center circle -->
- <circle cx="16" cy="16" r="2" fill="currentColor"/>
-=======
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
<!-- Outer guides with white outline for visibility -->
<line x1="16" y1="2" x2="16" y2="8" stroke="white" stroke-width="2.5" stroke-linecap="round"/>
@@ -17,16 +8,15 @@
<line x1="16" y1="24" x2="16" y2="30" stroke="black" stroke-width="1.5" stroke-linecap="round"/>
<line x1="2" y1="16" x2="8" y2="16" stroke="black" stroke-width="1.5" stroke-linecap="round"/>
<line x1="24" y1="16" x2="30" y2="16" stroke="black" stroke-width="1.5" stroke-linecap="round"/>
-
+
<!-- Center crosshair lines with white outline -->
<line x1="16" y1="10" x2="16" y2="22" stroke="white" stroke-width="3" stroke-linecap="round"/>
<line x1="10" y1="16" x2="22" y2="16" stroke="white" stroke-width="3" stroke-linecap="round"/>
<line x1="16" y1="10" x2="16" y2="22" stroke="black" stroke-width="2" stroke-linecap="round"/>
<line x1="10" y1="16" x2="22" y2="16" stroke="black" stroke-width="2" stroke-linecap="round"/>
-
+
<!-- Center dot with white outline -->
<circle cx="16" cy="16" r="2" fill="white"/>
<circle cx="16" cy="16" r="1.5" fill="black"/>
->>>>>>> d66401546b933e7e781d745cc2e4417cb14f5413
</svg>
diff --git a/js/app/packages/block-channel/component/Attachment.tsx b/js/app/packages/block-channel/component/Attachment.tsx
index d1a58e3064..be8ec7ce28 100644
--- a/js/app/packages/block-channel/component/Attachment.tsx
+++ b/js/app/packages/block-channel/component/Attachment.tsx
@@ -14,6 +14,7 @@ import {
STATIC_VIDEO,
} from '@core/store/cacheChannelInput';
import { matches } from '@core/util/match';
+import { openInNewSplitForMention } from '@core/util/openInNewSplit';
import { truncateString } from '@core/util/string';
import XIcon from '@icon/regular/x.svg';
import Spinner from '@phosphor-icons/core/bold/spinner-gap-bold.svg?component-solid';
@@ -26,7 +27,7 @@ type AttachmentProps = {
};
export function Attachment(props: AttachmentProps) {
- const { insertSplit } = useSplitLayout();
+ const { insertSplit, replaceOrInsertSplit } = useSplitLayout();
const [hover, setHover] = createSignal(false);
const attachmentName = () => {
@@ -99,12 +100,14 @@ export function Attachment(props: AttachmentProps) {
)
}
text={truncateString(attachmentName(), 30)}
- onClick={() => {
+ onClick={(e) => {
if (props.attachment.pending) return;
- insertSplit({
+ const inNewSplit = openInNewSplitForMention(e.altKey, true);
+ const open = inNewSplit ? insertSplit : replaceOrInsertSplit;
+ open({
type: fileTypeToBlockName(blockName()),
id: props.attachment.id,
- });
+ })?.activate?.();
}}
/>
)}
diff --git a/js/app/packages/block-channel/component/BaseInput.tsx b/js/app/packages/block-channel/component/BaseInput.tsx
index 29b2d89ad4..47fcb02bfe 100644
--- a/js/app/packages/block-channel/component/BaseInput.tsx
+++ b/js/app/packages/block-channel/component/BaseInput.tsx
@@ -36,7 +36,6 @@ import type { SimpleMention } from '@service-comms/generated/models/simpleMentio
import { staticFileClient } from '@service-static-files/client';
import { createCallback } from '@solid-primitives/rootless';
import { leading, throttle } from '@solid-primitives/scheduled';
-import { BrightJoins } from '@ui/components/BrightJoins';
import { activeElement } from 'app/signal/focus';
import { toast } from 'core/component/Toast/Toast';
import { registerHotkey, useHotkeyDOMScope } from 'core/hotkey/hotkeys';
@@ -439,9 +438,6 @@ export function BaseInput(props: BaseInputProps) {
},
}}
>
- <Show when={!props.isReplyInput}>
- <BrightJoins dots={[false, false, true, true]} />
- </Show>
<Show when={isDraggedOver() || isDraggingOverChannel()}>
<FileDropOverlay valid={isValidChannelDrag()}>
<Show when={!isValidChannelDrag()}>
diff --git a/js/app/packages/block-email/component/BaseInput.tsx b/js/app/packages/block-email/component/BaseInput.tsx
index 24e0e18877..5460e49547 100644
--- a/js/app/packages/block-email/component/BaseInput.tsx
+++ b/js/app/packages/block-email/component/BaseInput.tsx
@@ -48,7 +48,6 @@ import type {
MessageWithBodyReplyless,
} from '@service-email/generated/schemas';
import { useEmail, useUserId } from '@service-gql/client';
-import { BrightJoins } from '@ui/components/BrightJoins';
import { Button } from '@ui/components/Button';
import {
defaultSelectionData,
@@ -714,7 +713,6 @@ export function BaseInput(props: {
}}
class="relative flex flex-col flex-1 bg-input border-t border-x border-edge-muted rounded-t-[5px] -mb-[7px] max-w-full"
>
- <BrightJoins dots={[false, false, true, true]} />
{/* Top Bar */}
<div class="flex items-start gap-2 p-2">
<DropdownMenu>
diff --git a/js/app/packages/block-email/component/MessageContainer.tsx b/js/app/packages/block-email/component/MessageContainer.tsx
index e8d76d9a79..632577e01c 100644
--- a/js/app/packages/block-email/component/MessageContainer.tsx
+++ b/js/app/packages/block-email/component/MessageContainer.tsx
@@ -157,7 +157,7 @@ export function MessageContainer(props: MessageContainerProps) {
const onClickAttachment = async (
attachment: Attachment,
- fileType?: FileType
+ fileType: FileType | undefined
) => {
const dbId = attachment.db_id;
if (!dbId) return;
@@ -199,7 +199,7 @@ export function MessageContainer(props: MessageContainerProps) {
replaceOrInsertSplit({
type: blockName,
id: document_id,
- });
+ })?.activate?.();
};
const handleExpand = () => {
diff --git a/js/app/packages/block-email/component/TopBar.tsx b/js/app/packages/block-email/component/TopBar.tsx
index 91e84fd363..19f102fd81 100644
--- a/js/app/packages/block-email/component/TopBar.tsx
+++ b/js/app/packages/block-email/component/TopBar.tsx
@@ -1,18 +1,9 @@
import { SplitHeaderLeft } from '@app/component/split-layout/components/SplitHeader';
-import {
- SplitHeaderBadge,
- StaticSplitLabel,
-} from '@app/component/split-layout/components/SplitLabel';
-import {
- SplitToolbarLeft,
- SplitToolbarRight,
-} from '@app/component/split-layout/components/SplitToolbar';
+import { StaticSplitLabel } from '@app/component/split-layout/components/SplitLabel';
+import { SplitToolbarRight } from '@app/component/split-layout/components/SplitToolbar';
import { hasPermissions, Permissions } from '@core/component/SharePermissions';
import { ShareButton } from '@core/component/TopBar/ShareButton';
-import {
- DEV_MODE_ENV,
- ENABLE_EMAIL_SHARING,
-} from '@core/constant/featureFlags';
+import { ENABLE_EMAIL_SHARING } from '@core/constant/featureFlags';
import { Show } from 'solid-js';
import { useEmailContext } from './EmailContext';
import { EmailPropertiesModal } from './EmailPropertiesModal';
@@ -25,11 +16,7 @@ export function TopBar(props: { id: string; title: string }) {
<SplitHeaderLeft>
<StaticSplitLabel iconType="email" label={props.title} />
</SplitHeaderLeft>
- <SplitToolbarLeft>
- <div class="flex items-center h-full p-1">
- <SplitHeaderBadge text="beta" tooltip="Email is in Beta" />
- </div>
- </SplitToolbarLeft>
+
<SplitToolbarRight>
<div class="flex items-center gap-2">
<EmailPropertiesModal
@@ -40,7 +27,7 @@ export function TopBar(props: { id: string; title: string }) {
Permissions.CAN_EDIT
)}
/>
- <Show when={ENABLE_EMAIL_SHARING || DEV_MODE_ENV}>
+ <Show when={ENABLE_EMAIL_SHARING}>
<ShareButton
id={props.id}
name={props.title}
diff --git a/js/app/packages/core/component/AI/component/AIChatEmptyState.tsx b/js/app/packages/core/component/AI/component/AIChatEmptyState.tsx
index 61519e0097..80a88ac809 100644
--- a/js/app/packages/core/component/AI/component/AIChatEmptyState.tsx
+++ b/js/app/packages/core/component/AI/component/AIChatEmptyState.tsx
@@ -1,6 +1,5 @@
import { modifierMap } from '@core/component/Hotkey';
import { isMobileWidth } from '@core/mobile/mobileWidth';
-import { BrightJoins } from '@ui/components/BrightJoins';
import { Show } from 'solid-js';
import { useOpenInstructionsMd } from '../util/instructions';
@@ -8,7 +7,6 @@ export function AiChatEmptyState() {
const openInstructions = useOpenInstructionsMd();
return (
<div class="relative p-2 border border-edge-muted bg-dialog text-sm flex flex-col gap-2 text-ink">
- <BrightJoins dots={[true, true, true, true]} />
<Show when={!isMobileWidth()}>
<div class="grid justify-start grid-cols-[max-content_auto] gap-y-1 grid-template items-center">
<span class="p-1 bg-accent text-panel mr-2 text-center">@</span>
diff --git a/js/app/packages/core/component/AI/component/input/Attachment.tsx b/js/app/packages/core/component/AI/component/input/Attachment.tsx
index 71b9589d75..7f420c9008 100644
--- a/js/app/packages/core/component/AI/component/input/Attachment.tsx
+++ b/js/app/packages/core/component/AI/component/input/Attachment.tsx
@@ -8,6 +8,8 @@ import { EntityIcon } from '@core/component/EntityIcon';
import { ImagePreview } from '@core/component/ImagePreview';
import { toast } from '@core/component/Toast/Toast';
import { fileTypeToBlockName } from '@core/constant/allBlocks';
+import { openInNewSplitForMention } from '@core/util/openInNewSplit';
+import { useSplitNavigationHandler } from '@core/util/useSplitNavigationHandler';
import BuildingIcon from '@icon/duotone/building-office-duotone.svg';
import GlobeIcon from '@icon/duotone/globe-duotone.svg';
import ChannelIcon from '@icon/duotone/hash-duotone.svg';
@@ -102,7 +104,7 @@ function ChatAttachment(props: {
attachment: Attachment;
onRemove: () => void;
}) {
- const { replaceOrInsertSplit } = useSplitLayout();
+ const { insertSplit, replaceOrInsertSplit } = useSplitLayout();
const name = createMemo(() => {
const attachment = props.attachment;
if (!attachment.metadata) return '';
@@ -127,16 +129,19 @@ function ChatAttachment(props: {
: 'channel';
});
- const onClick = () => {
+ const onClick = (e: MouseEvent) => {
const attachment = props.attachment;
if (isImageAttachment(attachment)) return;
const block_ = block();
if (!block_) return;
- replaceOrInsertSplit({
+ const inNewSplit = openInNewSplitForMention(e.altKey, true);
+ const open = inNewSplit ? insertSplit : replaceOrInsertSplit;
+ open({
id: attachment.attachmentId,
type: block_,
- });
+ })?.activate?.();
};
+ const navHandlers = useSplitNavigationHandler<HTMLDivElement>(onClick);
return (
<Switch>
<Match when={isImageAttachment(props.attachment)}>
@@ -152,7 +157,7 @@ function ChatAttachment(props: {
hover:bg-hover hover-transition-bg cursor-default
text-sm
`}
- onClick={onClick}
+ {...navHandlers}
>
<Switch>
<Match
diff --git a/js/app/packages/core/component/AI/component/input/useChatInput.tsx b/js/app/packages/core/component/AI/component/input/useChatInput.tsx
index 65833a046e..205788505e 100644
--- a/js/app/packages/core/component/AI/component/input/useChatInput.tsx
+++ b/js/app/packages/core/component/AI/component/input/useChatInput.tsx
@@ -24,7 +24,6 @@ import PlusIcon from '@icon/regular/plus.svg';
import XIcon from '@icon/regular/x.svg';
import Stop from '@phosphor-icons/core/regular/stop.svg';
import { createCallback } from '@solid-primitives/rootless';
-import { BrightJoins } from '@ui/components/BrightJoins';
import { Button } from '@ui/components/Button';
import type { LexicalEditor } from 'lexical';
import type { Accessor, Component, Setter } from 'solid-js';
@@ -216,7 +215,6 @@ function ChatInput(props: ChatInputInternalProps) {
ref={containerRef}
class="relative flex flex-col flex-1 items-center justify-between bg-input border-t border-x border-edge-muted rounded-t-[5px] -mb-[7px]"
>
- <BrightJoins dots={[false, false, true, true]} />
<div class="relative w-full z-0 px-3 pt-2 sm:pb-4 flex-1 overflow-hidden placeholder:text-ink-placeholder placeholder:opacity-50">
<div
id="chat-input-text-area"
diff --git a/js/app/packages/core/component/ItemPreview.tsx b/js/app/packages/core/component/ItemPreview.tsx
index 08ff863d00..1c5a762053 100644
--- a/js/app/packages/core/component/ItemPreview.tsx
+++ b/js/app/packages/core/component/ItemPreview.tsx
@@ -2,6 +2,7 @@ import type { BlockAlias, BlockName } from '@core/block';
import { fileTypeToBlockName } from '@core/constant/allBlocks';
import { isAccessiblePreviewItem, useItemPreview } from '@core/signal/preview';
import { matches } from '@core/util/match';
+import { openInNewSplitForMention } from '@core/util/openInNewSplit';
import { truncateString } from '@core/util/string';
import { useSplitNavigationHandler } from '@core/util/useSplitNavigationHandler';
import BuildingIcon from '@icon/duotone/building-office-duotone.svg';
@@ -80,7 +81,7 @@ function useItemPreviewData(props: ItemPreviewProps) {
}
const _type = subType ?? fileType ?? type;
if (!_type) return;
- openItem(_type, id, altKey);
+ openItem(_type, id, openInNewSplitForMention(altKey, true));
}
const name = () => {
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/ContactMention.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/ContactMention.tsx
index b890268769..a5f6cb041e 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/ContactMention.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/ContactMention.tsx
@@ -1,4 +1,5 @@
import { useSplitNavigationHandler } from '@core/util/useSplitNavigationHandler';
+import { openInNewSplitForMention } from '@core/util/openInNewSplit';
import BuildingIcon from '@icon/regular/buildings.svg';
import UserIcon from '@icon/regular/user.svg';
import type { ContactMentionDecoratorProps } from '@lexical-core';
@@ -32,7 +33,8 @@ export function ContactMention(props: ContactMentionDecoratorProps) {
const openContact = (e: MouseEvent | KeyboardEvent | null) => {
// The contactId is the email or @domain
const contactId = encodeURIComponent(props.emailOrDomain);
- if (e?.altKey) {
+ const inNewSplit = openInNewSplitForMention(e?.altKey, e != null);
+ if (inNewSplit) {
insertSplit({
type: 'contact',
id: contactId,
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx
index 57c249e0db..d9369824b4 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx
@@ -25,6 +25,7 @@ import {
useItemPreview,
} from '@core/signal/preview';
import { matches } from '@core/util/match';
+import { openInNewSplitForMention } from '@core/util/openInNewSplit';
import { useSplitNavigationHandler } from '@core/util/useSplitNavigationHandler';
import EyeSlashDuo from '@icon/duotone/eye-slash-duotone.svg';
import TrashSimple from '@icon/duotone/trash-simple-duotone.svg';
@@ -251,7 +252,7 @@ export function DocumentMention(props: DocumentMentionDecoratorProps) {
props.blockName,
props.documentId,
props.blockParams,
- e?.altKey ?? false
+ openInNewSplitForMention(e?.altKey, e != null)
);
});
diff --git a/js/app/packages/core/component/Properties/hooks/useTaskProperties.ts b/js/app/packages/core/component/Properties/hooks/useTaskProperties.ts
index 771c291167..0a4551d52a 100644
--- a/js/app/packages/core/component/Properties/hooks/useTaskProperties.ts
+++ b/js/app/packages/core/component/Properties/hooks/useTaskProperties.ts
@@ -38,5 +38,8 @@ export function useTaskProperties(
TASK_PROPERTY_DEFINITION_IDS
);
- return createMemo(() => query.data ?? {});
+ return () => {
+ if (query.isLoading || !query.data) return {};
+ return query.data;
+ };
}
diff --git a/js/app/packages/core/util/openInNewSplit.test.ts b/js/app/packages/core/util/openInNewSplit.test.ts
new file mode 100644
index 0000000000..4d843befea
--- /dev/null
+++ b/js/app/packages/core/util/openInNewSplit.test.ts
@@ -0,0 +1,16 @@
+import { describe, expect, it } from 'vitest';
+import { openInNewSplitForMention } from './openInNewSplit';
+
+describe('openInNewSplitForMention', () => {
+ it('opens in a new split by default for mouse/keyboard interactions', () => {
+ expect(openInNewSplitForMention(false, true)).toBe(true);
+ });
+
+ it('opens in the current split when Option (alt) is held', () => {
+ expect(openInNewSplitForMention(true, true)).toBe(false);
+ });
+
+ it('defaults to current split when there is no event (e.g. touch)', () => {
+ expect(openInNewSplitForMention(undefined, false)).toBe(false);
+ });
+});
diff --git a/js/app/packages/core/util/openInNewSplit.ts b/js/app/packages/core/util/openInNewSplit.ts
new file mode 100644
index 0000000000..a216a4855b
--- /dev/null
+++ b/js/app/packages/core/util/openInNewSplit.ts
@@ -0,0 +1,16 @@
+/**
+ * Macro uses "splits" as its tab-like navigation concept.
+ *
+ * For @mention pills we want:
+ * - default click/enter: open in a new split
+ * - holding Option (alt): open in the current split
+ *
+ * We also want touch opens (which typically call handlers without a keyboard/mouse
+ * event) to remain in the current split to avoid surprising split creation.
+ */
+export function openInNewSplitForMention(
+ altKey: boolean | undefined,
+ defaultOpenInNewSplit: boolean
+): boolean {
+ return altKey ? false : defaultOpenInNewSplit;
+}
diff --git a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
index d62d0c8290..56661c5ab6 100644
--- a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
+++ b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
@@ -75,19 +75,12 @@ export const ENTITY_HEIGHT = 40;
function UnreadIndicator(props: { active?: boolean }) {
return (
<div class="flex size-4 items-center justify-center">
- <svg
- xmlns="http://www.w3.org/2000/svg"
+ <div
classList={{
- 'fill-accent': true,
+ 'bg-accent rounded-full size-2': true,
'opacity-0': !props.active,
}}
- viewBox="0 0 8 8"
- width="75%"
- height="75%"
- fill="none"
- >
- <path d="M3.39622 8C3.29136 8 3.23894 7.94953 3.23894 7.84858L3.33068 5.13565L0.932129 6.58675C0.836012 6.63722 0.76174 6.6204 0.709312 6.53628L0.0801831 5.56467C0.0190178 5.47213 0.0364936 5.40063 0.132611 5.35016L2.58359 4.07571L0.09329 2.88959C-0.00282696 2.83912 -0.0246717 2.77182 0.0277557 2.6877L0.59135 1.58991C0.643778 1.49737 0.71805 1.47634 0.814167 1.52681L3.31758 2.95268L3.21272 0.151421C3.21272 0.0504735 3.26515 0 3.37 0H4.57583C4.68069 0 4.73312 0.0504735 4.73312 0.151421L4.64137 2.94006L7.14478 1.40063C7.2409 1.34175 7.3108 1.35857 7.35449 1.4511L7.97051 2.46057C8.02294 2.5531 8.00546 2.6204 7.91808 2.66246L5.40157 4L7.82633 5.18612C7.91371 5.23659 7.93556 5.30389 7.89187 5.38801L7.36759 6.4858C7.32391 6.58675 7.25837 6.60778 7.17099 6.54889L4.6938 5.13565L4.78554 7.84858C4.79428 7.94953 4.74185 8 4.62826 8H3.39622Z" />
- </svg>
+ />
</div>
);
}
@@ -899,7 +892,7 @@ export function EntityWithEverything(
use:draggable
use:droppable
data-checked={props.checked}
- class="everything-entity w-full relative group/entity hover:bg-hover/30"
+ class="everything-entity w-full relative group/entity hover:bg-hover/30 mx-[1px]"
style={{
'min-height': `${ENTITY_HEIGHT}px`,
}}
@@ -1012,9 +1005,21 @@ export function EntityWithEverything(
class="min-h-10 min-w-[50px] flex flex-row items-center gap-2 col-2 @max-md/uList:col-auto @max-md/uList:w-full @max-md/uList:min-h-0 @max-md/uList:items-start"
classList={{
grow: props.contentPlacement === 'bottom-row',
- 'opacity-70': props.fadeIfRead && !props.unreadIndicatorActive,
}}
>
+ {/* When the left checkbox column is hidden in narrow split containers, we still want
+ unread indicators to be visible. */}
+ <Show
+ when={
+ props.showLeftColumnIndicator &&
+ !props.checked &&
+ !props.highlighted
+ }
+ >
+ <div class="flex size-4 items-center justify-center @min-md/split:hidden">
+ <UnreadIndicator active={props.unreadIndicatorActive} />
+ </div>
+ </Show>
{/* Icon/Checkbox container - in narrow mode, shows icon by default, checkbox on hover */}
{/* For emails, icon is inline with sender, so hide this container in narrow mode */}
<div class="flex size-5 shrink-0 items-center justify-center relative group/icon-checkbox @max-md/uList:hidden">
diff --git a/js/app/packages/macro-entity/src/utils/filter.ts b/js/app/packages/macro-entity/src/utils/filter.ts
index bbfcd71271..be15116180 100644
--- a/js/app/packages/macro-entity/src/utils/filter.ts
+++ b/js/app/packages/macro-entity/src/utils/filter.ts
@@ -12,8 +12,10 @@ export function composeFilters<T extends EntityData>(
return (entity: T) => filters.every((filter) => filter(entity));
}
-export function createFilterComposer<T extends EntityData = EntityData>() {
- const [filters, setFilters] = createSignal<EntityFilter<T>[]>([]);
+export function createFilterComposer<T extends EntityData = EntityData>(
+ initialFilters: EntityFilter<T>[] = []
+) {
+ const [filters, setFilters] = createSignal<EntityFilter<T>[]>(initialFilters);
const filterFn = createMemo(() => composeFilters(...filters()));
diff --git a/js/app/packages/macro-icons/wide/noise.svg b/js/app/packages/macro-icons/wide/noise.svg
new file mode 100644
index 0000000000..063651fd3a
--- /dev/null
+++ b/js/app/packages/macro-icons/wide/noise.svg
@@ -0,0 +1,3 @@
+<svg width="100%" height="100%" viewBox="0 0 24 24" fill="currentColor" stroke="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M20.56 13.51H21V13.07V12.01H19.94H19.85H19.71L17.87 7.40003L16.41 12.75L15.28 9.54003L13.76 11.3L11.84 6.03003L10.38 12.34L9.1 8.37003L7.5 12.11L6.08 8.79003L4.33 12.01H4.2H4.17H3V12.99V13.51H3.63H5.22L5.92 12.22L7.5 15.91L8.9 12.64L10.62 17.97L12.16 11.29L13.24 14.22L14.72 12.48L16.59 17.77L18.13 12.12L18.69 13.51H20.56Z"/>
+</svg>
diff --git a/js/app/packages/macro-icons/wide/preview.svg b/js/app/packages/macro-icons/wide/preview.svg
new file mode 100644
index 0000000000..0adf3154ce
--- /dev/null
+++ b/js/app/packages/macro-icons/wide/preview.svg
@@ -0,0 +1,4 @@
+<svg width="100%" height="100%" viewBox="0 0 24 24" fill="currentColor" stroke="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M12 6C14.8251 6 17.0617 7.44762 18.5537 8.82422C19.3047 9.51721 19.8852 10.2084 20.2783 10.7266C20.4752 10.986 20.6264 11.2035 20.7295 11.3584C20.7811 11.4359 20.8212 11.4983 20.8486 11.542C20.8623 11.5638 20.8733 11.5813 20.8809 11.5938L20.8926 11.6133L20.8936 11.6152L20.25 12L20.8936 12.3848L20.8926 12.3867L20.8809 12.4062C20.8733 12.4187 20.8623 12.4362 20.8486 12.458C20.8212 12.5017 20.7811 12.5641 20.7295 12.6416C20.6264 12.7965 20.4752 13.014 20.2783 13.2734C19.8852 13.7916 19.3047 14.4828 18.5537 15.1758C17.0617 16.5524 14.8251 18 12 18C9.17491 18 6.93826 16.5524 5.44629 15.1758C4.69526 14.4828 4.11484 13.7916 3.72168 13.2734C3.52484 13.014 3.37365 12.7965 3.27051 12.6416C3.2189 12.5641 3.17884 12.5017 3.15137 12.458C3.13767 12.4362 3.12674 12.4187 3.11914 12.4062L3.10742 12.3867L3.10645 12.3848L3.75 12L3.10645 11.6152L3.10742 11.6133L3.11914 11.5938C3.12674 11.5813 3.13767 11.5638 3.15137 11.542C3.17884 11.4983 3.2189 11.4359 3.27051 11.3584C3.37365 11.2035 3.52484 10.986 3.72168 10.7266C4.11484 10.2084 4.69526 9.51721 5.44629 8.82422C6.93826 7.44762 9.17491 6 12 6ZM12 7.5C9.70529 7.5 7.81687 8.67751 6.46387 9.92578C5.79269 10.5451 5.27066 11.1667 4.91699 11.6328C4.81254 11.7705 4.72321 11.8946 4.64941 12C4.72321 12.1054 4.81254 12.2295 4.91699 12.3672C5.27066 12.8333 5.79269 13.4549 6.46387 14.0742C7.81687 15.3225 9.70529 16.5 12 16.5C14.2947 16.5 16.1831 15.3225 17.5361 14.0742C18.2073 13.4549 18.7293 12.8333 19.083 12.3672C19.1873 12.2297 19.2759 12.1053 19.3496 12C19.2759 11.8947 19.1873 11.7703 19.083 11.6328C18.7293 11.1667 18.2073 10.5451 17.5361 9.92578C16.1831 8.67751 14.2947 7.5 12 7.5ZM15.1777 12.001L11.9961 15.1836L8.81445 12.001L11.9961 8.81934L15.1777 12.001ZM10.9355 12.001L11.9961 13.0615L13.0557 12.001L11.9961 10.9404L10.9355 12.001ZM3.75 12L3.10547 12.3838L2.87695 12L3.10547 11.6162L3.75 12ZM21.123 12L20.8945 12.3838L20.25 12L20.8945 11.6162L21.123 12Z"/>
+</svg>
+
diff --git a/js/app/packages/macro-icons/wide/signal.svg b/js/app/packages/macro-icons/wide/signal.svg
new file mode 100644
index 0000000000..53246c28f2
--- /dev/null
+++ b/js/app/packages/macro-icons/wide/signal.svg
@@ -0,0 +1,3 @@
+<svg width="100%" height="100%" viewBox="0 0 24 24" fill="currentColor" stroke="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M17.27 11.25C16.62 8.37 15.99 6 14.33 6C12.56 6 11.96 8.71 11.26 11.84C10.98 13.12 10.22 16.5 9.66 16.5C9.1 16.5 8.34 13.11 8.06 11.84C8.02 11.64 7.97 11.45 7.93 11.25H3V12.75H6.73C7.38 15.63 8.01 18 9.66 18C11.43 18 12.03 15.29 12.73 12.16C13.01 10.89 13.77 7.5 14.33 7.5C14.89 7.5 15.65 10.89 15.93 12.16C15.97 12.36 16.02 12.55 16.06 12.75H21V11.25H17.27Z"/>
+</svg>
diff --git a/js/app/packages/macro-icons/wide/sort.svg b/js/app/packages/macro-icons/wide/sort.svg
new file mode 100644
index 0000000000..1cfccfbb04
--- /dev/null
+++ b/js/app/packages/macro-icons/wide/sort.svg
@@ -0,0 +1,5 @@
+<svg width="100%" height="100%" viewBox="0 0 24 24" fill="currentColor" stroke="none" xmlns="http://www.w3.org/2000/svg">
+<rect x="3" y="6" width="18" height="2"/>
+<rect x="6" y="11" width="12" height="2"/>
+<rect x="9" y="16" width="6" height="2"/>
+</svg>
diff --git a/js/app/packages/queries/properties/bulk.ts b/js/app/packages/queries/properties/bulk.ts
index 4eefd2284a..cbdcce369a 100644
--- a/js/app/packages/queries/properties/bulk.ts
+++ b/js/app/packages/queries/properties/bulk.ts
@@ -65,7 +65,7 @@ export function useBulkEntityPropertiesQuery(
}).queryKey,
queryFn: () =>
fetchBulkProperties(entityType, entityIds(), propertyDefinitionIds),
- staleTime: 0,
+ refetchOnMount: false,
enabled: entityIds().length > 0,
}),
() => queryClient
diff --git a/js/app/packages/ui/components/BrightJoins.stories.tsx b/js/app/packages/ui/components/BrightJoins.stories.tsx
deleted file mode 100644
index 8a079674ae..0000000000
--- a/js/app/packages/ui/components/BrightJoins.stories.tsx
+++ /dev/null
@@ -1,85 +0,0 @@
-import {
- BrightJoins,
- BrightJoinsProgressMeter,
-} from '@ui/components/BrightJoins';
-import type { Meta, StoryObj } from 'storybook-solidjs-vite';
-
-type DotsArray = [boolean, boolean, boolean, boolean];
-
-interface StoryArgs {
- dots: string[];
- class?: string;
- progress?: number;
- progressMeterClass?: string;
-}
-
-function dotsToBooleanArray(dots?: string[]): DotsArray {
- if (!dots) return [false, false, false, false];
- return [
- dots.includes('TL'),
- dots.includes('TR'),
- dots.includes('BR'),
- dots.includes('BL'),
- ];
-}
-
-const meta: Meta<StoryArgs> = {
- component: BrightJoins as unknown as Meta<StoryArgs>['component'],
- argTypes: {
- dots: {
- control: { type: 'check' },
- options: ['TL', 'TR', 'BR', 'BL'],
- description: 'Which corner dots to show',
- },
- },
- args: {
- dots: ['TL', 'TR', 'BR', 'BL'],
- },
- render: (_, context) => {
- const dots = () => dotsToBooleanArray(context.args.dots);
- return (
- <div class="relative border border-edge-muted p-8 w-80 h-32">
- <BrightJoins dots={dots()} class={context.args.class} />
- </div>
- );
- },
-};
-
-export default meta;
-type Story = StoryObj<StoryArgs>;
-
-export const Default: Story = {};
-
-export const WithProgress: Story = {
- args: {
- dots: ['TR', 'TL', 'BR', 'BL'],
- progress: 50,
- progressMeterClass: '',
- },
- argTypes: {
- progress: {
- control: { type: 'range', min: 0, max: 100, step: 1 },
- },
- progressMeterClass: {
- control: { type: 'text' },
- },
- },
- render: (_, context) => {
- const dots = () => dotsToBooleanArray(context.args.dots);
- return (
- <div class="relative border border-edge-muted p-8 w-80 h-32">
- <BrightJoins dots={dots()} class={context.args.class} />
- <BrightJoinsProgressMeter
- progress={context.args.progress ?? 0}
- class={context.args.progressMeterClass}
- />
- </div>
- );
- },
-};
-
-export const OnlyOneCorner: Story = {
- args: {
- dots: ['TL'],
- },
-};
diff --git a/js/app/packages/ui/utils/classname.ts b/js/app/packages/ui/utils/classname.ts
index 0c7d77dc62..92b40bcf8f 100644
--- a/js/app/packages/ui/utils/classname.ts
+++ b/js/app/packages/ui/utils/classname.ts
@@ -1,6 +1,40 @@
import { twMerge } from 'tailwind-merge';
-import { clsx, type ClassValue } from 'clsx';
+
+// Local `clsx`-compatible types + implementation (so we don't depend on the external
+// `clsx` package being installed).
+export type ClassValue =
+ | string
+ | number
+ | null
+ | boolean
+ | undefined
+ | ClassValue[]
+ | Record<string, boolean | null | undefined>;
+
+const clsx = (...args: ClassValue[]): string => {
+ const out: string[] = [];
+
+ const push = (v: ClassValue): void => {
+ if (!v) return;
+ if (typeof v === 'string' || typeof v === 'number') {
+ out.push(String(v));
+ return;
+ }
+ if (Array.isArray(v)) {
+ for (const item of v) push(item);
+ return;
+ }
+ if (typeof v === 'object') {
+ for (const [k, enabled] of Object.entries(v)) {
+ if (enabled) out.push(k);
+ }
+ }
+ };
+
+ for (const a of args) push(a);
+ return out.join(' ');
+};
export const cn = (...args: ClassValue[]) => {
- return twMerge(clsx(args));
+ return twMerge(clsx(...args));
};