Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix: various ui issues in new app views (#6381)

dev-rb54f5599b147c
diff --git a/apps/web/src/features/channels-view/components/ChannelsMobileView.tsx b/apps/web/src/features/channels-view/components/ChannelsMobileView.tsx
index fc498b4414..15d180dd0a 100644
--- a/apps/web/src/features/channels-view/components/ChannelsMobileView.tsx
+++ b/apps/web/src/features/channels-view/components/ChannelsMobileView.tsx
@@ -30,6 +30,7 @@ import { channelMentionsUser } from '../utils';
import { ChannelsEmptyState } from './ChannelsEmptyState';
import {
CHANNEL_ACTION_VIEW_CONTEXT,
+ CONVERSATION_CARD_HEIGHT,
ConversationCard,
} from './rail/ChannelRailItems';
import { useChannelCalls } from './rail/hooks/useChannelCalls';
@@ -43,8 +44,7 @@ const MOBILE_CHANNEL_TABS: PillTabItem<ChannelsQueryScope>[] = [
const MOBILE_TAB_STRIP_CLASS =
'-ml-(--mobile-chrome-gutter) w-[100cqw] max-w-none flex-none';
const MOBILE_TAB_CONTENT_CLASS = 'px-(--mobile-chrome-gutter)';
-const MOBILE_CHANNEL_ITEM_SIZE = 72;
-const MOBILE_CHANNEL_BUFFER_SIZE = MOBILE_CHANNEL_ITEM_SIZE * 6;
+const MOBILE_CHANNEL_BUFFER_SIZE = CONVERSATION_CARD_HEIGHT * 6;
const LOAD_MORE_THRESHOLD = 300;
export function ChannelsMobileView(props: {
@@ -186,7 +186,7 @@ export function ChannelsMobileView(props: {
data={visibleChannels()}
scrollRef={viewport()}
startMargin={topInset()}
- itemSize={MOBILE_CHANNEL_ITEM_SIZE}
+ itemSize={CONVERSATION_CARD_HEIGHT}
bufferSize={MOBILE_CHANNEL_BUFFER_SIZE}
onScroll={checkNearEnd}
>
diff --git a/apps/web/src/features/channels-view/components/rail/ChannelRailItems.tsx b/apps/web/src/features/channels-view/components/rail/ChannelRailItems.tsx
index 0bcf223c8f..82abde568f 100644
--- a/apps/web/src/features/channels-view/components/rail/ChannelRailItems.tsx
+++ b/apps/web/src/features/channels-view/components/rail/ChannelRailItems.tsx
@@ -6,6 +6,7 @@ import {
import { SoupEntityContextMenu } from '@app/features/soup/SoupEntityContextMenu';
import { joinChannelCall } from '@channel/Call/join-channel-call';
import { StaticMarkdown } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
+import { inlineWrappingMarkdownTheme } from '@core/component/LexicalMarkdown/theme';
import { toast } from '@core/component/Toast/Toast';
import { useUserId } from '@core/context/user';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
@@ -26,6 +27,8 @@ import { rowKeyForChannel, useChannelsRail } from './ChannelsRailContext';
export type ChannelCallStatus = 'active' | 'incoming';
+export const CONVERSATION_CARD_HEIGHT = 80;
+
export type ChannelRailItemProps = {
id: string;
channel: ChannelEntity;
@@ -142,43 +145,59 @@ export function ChannelMutedIndicator(props: {
export function IncomingCallActions(props: {
callId: string | undefined;
channelId: string;
+ class?: string;
+ layout?: 'compact' | 'wide';
}) {
+ const isWide = () => props.layout === 'wide';
+
return (
<Show when={props.callId}>
{(callId) => (
- <span class="flex shrink-0 items-center gap-1">
+ <span
+ class={cn(
+ 'shrink-0 items-center',
+ isWide() ? 'grid w-full grid-cols-2 gap-2' : 'flex gap-1',
+ props.class
+ )}
+ >
<Button
- variant="success"
- size="icon-xs"
- class="rounded-md"
- label="Accept incoming call"
+ variant="danger"
+ size={isWide() ? 'sm' : 'icon-xs'}
+ fullWidth={isWide()}
+ class={cn('rounded-md', isWide() && 'h-7 flex-1')}
+ label="Decline incoming call"
+ tooltipDisabled={isWide()}
onPointerDown={(event) => event.stopPropagation()}
onMouseDown={(event) => event.stopPropagation()}
onClick={(event) => {
event.preventDefault();
event.stopPropagation();
- void joinChannelCall(props.channelId).catch((error) => {
- console.error('Failed to join call', error);
- toast.failure('Failed to join call');
- });
+ dismissIncomingCallEverywhere(callId());
}}
>
- <PhoneIncomingIcon class="incoming-call-shake size-3" />
+ <XIcon class="size-3" />
+ <Show when={isWide()}>Decline</Show>
</Button>
<Button
- variant="danger"
- size="icon-xs"
- class="rounded-md"
- label="Decline incoming call"
+ variant="success"
+ size={isWide() ? 'sm' : 'icon-xs'}
+ fullWidth={isWide()}
+ class={cn('rounded-md', isWide() && 'h-7 flex-1')}
+ label="Accept incoming call"
+ tooltipDisabled={isWide()}
onPointerDown={(event) => event.stopPropagation()}
onMouseDown={(event) => event.stopPropagation()}
onClick={(event) => {
event.preventDefault();
event.stopPropagation();
- dismissIncomingCallEverywhere(callId());
+ void joinChannelCall(props.channelId).catch((error) => {
+ console.error('Failed to join call', error);
+ toast.failure('Failed to join call');
+ });
}}
>
- <XIcon class="size-3" />
+ <PhoneIncomingIcon class="incoming-call-shake size-3" />
+ <Show when={isWide()}>Join</Show>
</Button>
</span>
)}
@@ -263,6 +282,8 @@ function MessageSenderName(props: { id?: string }) {
export function ConversationCard(props: ConversationCardProps) {
const latestRootMessage = () => props.channel.latestRootMessage;
+ const hasMessageMetadata = () =>
+ Boolean(latestRootMessage()?.threadId || props.mentionedCurrentUser);
return (
<div
@@ -270,7 +291,7 @@ export function ConversationCard(props: ConversationCardProps) {
role="treeitem"
tabIndex={-1}
class={cn(
- 'relative w-full min-w-0 overflow-hidden px-2 py-3 text-left outline-none',
+ 'relative min-h-20 w-full min-w-0 overflow-hidden px-2 py-4 text-left outline-none',
props.selected && !isTouchDevice() && 'bg-active',
!props.selected && !isTouchDevice() && props.focused && 'bg-hover',
(!props.selected || isTouchDevice()) && 'bg-transparent',
@@ -303,13 +324,10 @@ export function ConversationCard(props: ConversationCardProps) {
<span class="min-w-0 flex-1 truncate text-sm font-medium text-ink">
{props.channel.name}
</span>
- <ChannelMutedIndicator muted={props.muted} />
+ <ChannelMutedIndicator muted={props.muted} class="size-3.5" />
<ChannelCallIndicator
status={props.incomingCallId ? undefined : props.callStatus}
- />
- <IncomingCallActions
- callId={props.incomingCallId}
- channelId={props.channel.id}
+ class="size-3.5"
/>
<Show when={latestRootMessage()?.createdAt}>
{(createdAt) => (
@@ -328,9 +346,7 @@ export function ConversationCard(props: ConversationCardProps) {
</Show>
</span>
<Show when={props.showLatestMessage !== false}>
- <Show
- when={latestRootMessage()?.threadId || props.mentionedCurrentUser}
- >
+ <Show when={hasMessageMetadata()}>
<span class="flex min-w-0 items-center gap-2 text-xxs leading-4 text-ink-extra-muted">
<Show when={latestRootMessage()?.threadId}>
<span
@@ -349,22 +365,27 @@ export function ConversationCard(props: ConversationCardProps) {
</Show>
</span>
</Show>
- <div class="flex min-w-0 items-center gap-1 overflow-hidden whitespace-nowrap text-xs leading-4">
+ <div class="min-w-0 overflow-hidden text-sm">
<Switch>
<Match when={latestRootMessage()}>
{(message) => (
- <>
- <span class="shrink-0 font-medium text-ink-muted">
- <MessageSenderName id={props.senderId} />:
- </span>
+ <div class="line-clamp-2 min-w-0 text-ink-muted">
+ <span class="inline-flex min-w-0 font-medium">
+ <span class="min-w-0 truncate">
+ <MessageSenderName id={props.senderId} />
+ </span>
+ <span class="shrink-0">:</span>
+ </span>{' '}
<Show when={message().content.trim()}>
{(content) => (
- <div class="min-w-0 flex-1 truncate text-ink-muted [&_*]:my-0 [&_*]:truncate">
- <StaticMarkdown markdown={content()} singleLine />
- </div>
+ <StaticMarkdown
+ markdown={content()}
+ singleLine
+ theme={inlineWrappingMarkdownTheme}
+ />
)}
</Show>
- </>
+ </div>
)}
</Match>
<Match when={true}>
@@ -375,6 +396,12 @@ export function ConversationCard(props: ConversationCardProps) {
</Switch>
</div>
</Show>
+ <IncomingCallActions
+ callId={props.incomingCallId}
+ channelId={props.channel.id}
+ class="mt-3"
+ layout="wide"
+ />
</div>
</div>
</div>
diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRailSection.tsx b/apps/web/src/features/channels-view/components/rail/ChannelsRailSection.tsx
index 67297c9820..4454a1fb2f 100644
--- a/apps/web/src/features/channels-view/components/rail/ChannelsRailSection.tsx
+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRailSection.tsx
@@ -17,14 +17,12 @@ function SectionScrollArea(props: {
activityTargetId?: string;
activityLabel?: string;
activityTooltip?: boolean;
- onActivityVisible?: (targetId: string) => void;
children: JSX.Element;
}) {
const [scrollRoot, setScrollRoot] = createSignal<HTMLDivElement>();
const activity = useOffscreenActivity({
scrollRoot,
targetId: () => props.activityTargetId,
- onTargetVisible: (targetId) => props.onActivityVisible?.(targetId),
});
return (
@@ -57,7 +55,7 @@ function SectionScrollArea(props: {
>
<button
type="button"
- class="flex h-7 max-w-full items-center gap-1 rounded-full border border-edge bg-lift px-2 text-xxs font-medium text-ink-muted shadow-sm transition-colors hover:bg-surface hover:text-ink focus-visible:ring-2 focus-visible:ring-accent"
+ class="flex h-7 max-w-full items-center gap-1 rounded-full border border-edge bg-surface px-2 text-xxs font-medium text-ink-muted shadow-sm transition-colors hover:text-ink focus-visible:ring-2 focus-visible:ring-accent"
aria-label={`${props.activityLabel ?? 'New activity'} ${
direction() === 'start' ? 'above' : 'below'
}; scroll to it`}
@@ -132,7 +130,6 @@ function CollapsibleSectionContent(props: {
activityTargetId?: string;
activityLabel?: string;
activityTooltip?: boolean;
- onActivityVisible?: (targetId: string) => void;
children: JSX.Element;
}) {
return (
@@ -144,7 +141,6 @@ function CollapsibleSectionContent(props: {
activityTargetId={props.activityTargetId}
activityLabel={props.activityLabel}
activityTooltip={props.activityTooltip}
- onActivityVisible={props.onActivityVisible}
>
{props.children}
</SectionScrollArea>
@@ -182,7 +178,7 @@ export function RailListLoadingMore(props: {
'flex items-center',
props.variant === 'slim' && 'h-10 justify-center',
props.variant === 'channel' && 'h-10 gap-2 px-2',
- props.variant === 'recent' && 'h-18 items-start gap-3 px-2 py-2'
+ props.variant === 'recent' && 'h-20 items-start gap-3 px-2 py-2'
)}
>
<div
diff --git a/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx b/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx
index 93855b45cb..979ffca490 100644
--- a/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx
+++ b/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx
@@ -18,6 +18,7 @@ import {
ChannelCallIndicator,
ChannelMutedIndicator,
ChannelRailItemContextMenu,
+ CONVERSATION_CARD_HEIGHT,
ConversationCard,
IncomingCallActions,
isPrimaryMouseDown,
@@ -163,7 +164,7 @@ function ExpandedHeader() {
function ExpandedGroupSection(props: { config: GroupConfig }) {
const rail = useChannelsRail();
const [scrollRoot, setScrollRoot] = createSignal<HTMLDivElement>();
- const { state: section, clearVisibleActivity } = useChannelRailSectionState(
+ const { state: section } = useChannelRailSectionState(
() => props.config.group
);
const pagination = useChannelRailVirtualizer(() => props.config.group);
@@ -220,7 +221,6 @@ function ExpandedGroupSection(props: { config: GroupConfig }) {
class="flex min-h-0 flex-col gap-0.5"
activityTargetId={section().targetId}
activityLabel={section().label}
- onActivityVisible={clearVisibleActivity}
>
<Switch>
<Match
@@ -370,7 +370,7 @@ function ExpandedRecents() {
ref={pagination.registerVirtualizer}
data={scope().items}
scrollRef={scrollRoot()}
- itemSize={72}
+ itemSize={CONVERSATION_CARD_HEIGHT}
bufferSize={360}
keepMounted={scope().keepMounted}
onScroll={pagination.loadMoreNearEnd}
diff --git a/apps/web/src/features/channels-view/components/rail/SlimChannelsRail.tsx b/apps/web/src/features/channels-view/components/rail/SlimChannelsRail.tsx
index 9782326ecd..8be897eb92 100644
--- a/apps/web/src/features/channels-view/components/rail/SlimChannelsRail.tsx
+++ b/apps/web/src/features/channels-view/components/rail/SlimChannelsRail.tsx
@@ -267,7 +267,7 @@ function SlimGroupSection(props: { config: GroupConfig }) {
const forceEmptyState = useDebugSetting(
DEBUG_SETTING_KEYS.FORCE_EMPTY_STATES
);
- const { state: section, clearVisibleActivity } = useChannelRailSectionState(
+ const { state: section } = useChannelRailSectionState(
() => props.config.group
);
const pagination = useChannelRailVirtualizer(() => props.config.group);
@@ -317,7 +317,6 @@ function SlimGroupSection(props: { config: GroupConfig }) {
class="flex min-h-0 w-full flex-col items-center gap-0.5"
activityTargetId={section().targetId}
activityTooltip
- onActivityVisible={clearVisibleActivity}
>
<Switch>
<Match when={forceEmptyState()}>{null}</Match>
diff --git a/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailActivity.ts b/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailActivity.ts
index 9d900aa3d4..07be22b4ee 100644
--- a/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailActivity.ts
+++ b/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailActivity.ts
@@ -29,8 +29,6 @@ export function useChannelRailActivity(
const [activityTargets, setActivityTargets] = createStore<
Partial<Record<ChannelsGroup, ChannelActivityTarget>>
>({});
- const [acknowledgedNotificationIds, setAcknowledgedNotificationIds] =
- createStore<Record<string, boolean>>({});
const channelsById = createMemo(
() => new Map(channels().map((channel) => [channel.id, channel]))
@@ -43,11 +41,11 @@ export function useChannelRailActivity(
const notificationActivity = createMemo(() => {
const unreadChannelIds = new Set<string>();
+ const unreadNotificationIds = new Set<string>();
const unreadCounts: Record<ChannelsGroup, number> = {
channels: 0,
direct_messages: 0,
};
- const notificationIdsByChannel = new Map<string, string[]>();
const latestTargets: Partial<Record<ChannelsGroup, ChannelActivityTarget>> =
{};
const notifications = [...notificationSource.notifications()].sort((a, b) =>
@@ -66,20 +64,14 @@ export function useChannelRailActivity(
notification.entity_id
);
unreadChannelIds.add(notification.entity_id);
- const notificationIds =
- notificationIdsByChannel.get(notification.entity_id) ?? [];
- notificationIds.push(notification.id);
- notificationIdsByChannel.set(notification.entity_id, notificationIds);
+ unreadNotificationIds.add(notification.id);
const channel = channelsById().get(notification.entity_id);
if (!channel) continue;
const group = channelGroup(channel);
if (isFirstUnreadForChannel) unreadCounts[group] += 1;
- if (
- !latestTargets[group] &&
- !acknowledgedNotificationIds[notification.id]
- ) {
+ if (!latestTargets[group]) {
latestTargets[group] = {
channelId: channel.id,
source: {
@@ -92,8 +84,8 @@ export function useChannelRailActivity(
return {
latestTargets,
- notificationIdsByChannel,
unreadChannelIds,
+ unreadNotificationIds,
unreadCounts,
};
});
@@ -119,7 +111,12 @@ export function useChannelRailActivity(
}
const channel = channelsById().get(notification.entity_id);
- if (channel) recordActivity(channel);
+ if (channel) {
+ recordActivity(channel, {
+ type: 'notification',
+ notificationId: notification.id,
+ });
+ }
})
);
@@ -182,7 +179,21 @@ export function useChannelRailActivity(
const target = (group: ChannelsGroup): ChannelActivityTarget | undefined => {
const recordedTarget = activityTargets[group];
- if (recordedTarget) return recordedTarget;
+ if (recordedTarget?.source.type === 'call') return recordedTarget;
+ if (
+ recordedTarget?.source.type === 'notification' &&
+ notificationActivity().unreadNotificationIds.has(
+ recordedTarget.source.notificationId
+ )
+ ) {
+ return recordedTarget;
+ }
+ if (
+ recordedTarget?.source.type === 'message' &&
+ notificationActivity().unreadChannelIds.has(recordedTarget.channelId)
+ ) {
+ return recordedTarget;
+ }
return notificationActivity().latestTargets[group];
};
@@ -199,23 +210,8 @@ export function useChannelRailActivity(
: 'Active call';
};
- const clearTarget = (group: ChannelsGroup, channelId: string) => {
- if (targetChannelId(group) !== channelId) return;
-
- for (const notificationId of notificationActivity().notificationIdsByChannel.get(
- channelId
- ) ?? []) {
- setAcknowledgedNotificationIds(notificationId, true);
- }
-
- if (activityTargets[group]?.channelId === channelId) {
- setActivityTargets(group, undefined);
- }
- };
-
return {
callStatuses: calls.callStatuses,
- clearTarget,
incomingCallIds: calls.incomingCallIds,
targetChannelId,
targetLabel,
diff --git a/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailState.ts b/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailState.ts
index 4f262b857d..bf7000a21e 100644
--- a/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailState.ts
+++ b/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailState.ts
@@ -132,19 +132,5 @@ export function useChannelRailSectionState(group: Accessor<ChannelsGroup>) {
};
});
- const clearVisibleActivity = (visibleTargetId: string) => {
- const section = group();
- const targetChannelId = rail.channelActivity.targetChannelId(section);
- if (
- targetChannelId === undefined ||
- domIdForRow(rail.railId, rowKeyForChannel(targetChannelId)) !==
- visibleTargetId
- ) {
- return;
- }
-
- rail.channelActivity.clearTarget(section, targetChannelId);
- };
-
- return { state, clearVisibleActivity };
+ return { state };
}
diff --git a/apps/web/src/features/channels-view/components/rail/hooks/useOffscreenActivity.ts b/apps/web/src/features/channels-view/components/rail/hooks/useOffscreenActivity.ts
index 64f47068d6..07305f3f6f 100644
--- a/apps/web/src/features/channels-view/components/rail/hooks/useOffscreenActivity.ts
+++ b/apps/web/src/features/channels-view/components/rail/hooks/useOffscreenActivity.ts
@@ -5,7 +5,6 @@ type ActivityDirection = 'start' | 'end';
export function useOffscreenActivity(options: {
scrollRoot: Accessor<HTMLDivElement | undefined>;
targetId: Accessor<string | undefined>;
- onTargetVisible?: (targetId: string) => void;
}) {
const [direction, setDirection] = createSignal<ActivityDirection>();
let measuredTargetId: string | undefined;
@@ -36,9 +35,7 @@ export function useOffscreenActivity(options: {
targetBounds.top < rootBounds.bottom;
if (targetIsVisible || root.scrollHeight <= root.clientHeight + 1) {
- const wasOffscreen = direction() !== undefined;
setDirection(undefined);
- if (wasOffscreen) options.onTargetVisible?.(targetId);
return;
}
diff --git a/apps/web/src/features/favorites/FavoriteContextMenu.tsx b/apps/web/src/features/favorites/FavoriteContextMenu.tsx
new file mode 100644
index 0000000000..c1146f7bc3
--- /dev/null
+++ b/apps/web/src/features/favorites/FavoriteContextMenu.tsx
@@ -0,0 +1,89 @@
+import { globalSplitManager } from '@app/signal/splitLayout';
+import { favoriteSplitContent } from '@app/util/favorites';
+import { useSplitLayout } from '@components/app/split-layout/layout';
+import {
+ ContextMenuContent,
+ MenuGroup,
+ MenuItem,
+ MenuSeparator,
+} from '@core/component/ContextMenu';
+import { ContextMenu } from '@kobalte/core/context-menu';
+import { useRemoveFavoriteMutation } from '@queries/favorites/favorites';
+import type { Favorite } from '@service-storage/generated/schemas/favorite';
+import { cn } from '@ui';
+import { type JSX, type ParentProps, Show } from 'solid-js';
+
+type FavoriteContextMenuProps = ParentProps<{
+ favorite: Favorite;
+ additionalActions?: JSX.Element;
+ triggerClass?: string;
+ onOpenChange?: (open: boolean) => void;
+}>;
+
+/** Shared navigation and removal menu for favorite rows. */
+export function FavoriteContextMenu(props: FavoriteContextMenuProps) {
+ const layout = useSplitLayout();
+ const removeMutation = useRemoveFavoriteMutation();
+ const content = () => favoriteSplitContent(props.favorite);
+ const openFavorite = (preferNewSplit: boolean) => {
+ const split = layout.openWithSplit(content(), {
+ referredFrom: 'sidebar',
+ activate: true,
+ preferNewSplit,
+ });
+ globalSplitManager()?.returnFocus();
+ return split;
+ };
+ const canOpenInNewSplit = () =>
+ globalSplitManager()?.canAppendSplit() ?? false;
+ const canOpenFullscreen = () => layout.getSplitCount() > 1;
+
+ return (
+ <ContextMenu onOpenChange={props.onOpenChange}>
+ <ContextMenu.Trigger class={cn('w-full', props.triggerClass)}>
+ {props.children}
+ </ContextMenu.Trigger>
+ <ContextMenu.Portal>
+ <ContextMenuContent class="text-xs text-ink-muted">
+ <MenuGroup>
+ <MenuItem
+ text="Open in new split"
+ disabled={!canOpenInNewSplit()}
+ onClick={() => {
+ if (canOpenInNewSplit()) openFavorite(true);
+ }}
+ />
+ <Show when={canOpenFullscreen()}>
+ <MenuItem
+ text="Open fullscreen"
+ onClick={() => {
+ layout.replaceAllSplits(content(), {
+ referredFrom: 'sidebar',
+ });
+ globalSplitManager()?.returnFocus();
+ }}
+ />
+ </Show>
+ <MenuItem
+ text="Open in current split"
+ onClick={() => openFavorite(false)}
+ />
+ </MenuGroup>
+ {props.additionalActions}
+ <MenuSeparator />
+ <MenuGroup>
+ <MenuItem
+ text="Remove from favorites"
+ onClick={() =>
+ removeMutation.mutate({
+ entityType: props.favorite.entityType,
+ entityId: props.favorite.entityId,
+ })
+ }
+ />
+ </MenuGroup>
+ </ContextMenuContent>
+ </ContextMenu.Portal>
+ </ContextMenu>
+ );
+}
diff --git a/apps/web/src/features/favorites/sidebar/favorites-section.tsx b/apps/web/src/features/favorites/sidebar/favorites-section.tsx
index ee294cd74b..fed9cd34cf 100644
--- a/apps/web/src/features/favorites/sidebar/favorites-section.tsx
+++ b/apps/web/src/features/favorites/sidebar/favorites-section.tsx
@@ -16,7 +16,6 @@ import {
} from '@components/app/GlobalAppState';
import { useSplitLayout } from '@components/app/split-layout/layout';
import {
- ContextMenuContent,
MenuGroup,
MenuItem,
MenuSeparator,
@@ -28,7 +27,6 @@ import {
} from '@core/constant/featureFlags';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import type { EntityData } from '@entity';
-import { ContextMenu } from '@kobalte/core/context-menu';
import { Tooltip as KobalteTooltip } from '@kobalte/core/tooltip';
import { isChannelNotification } from '@notifications/notification-helpers';
import { getChannelNotificationParams } from '@notifications/notification-navigation';
@@ -37,7 +35,6 @@ import CaretDownIcon from '@phosphor/caret-down.svg';
import {
favoriteEntityKey,
useFavoritesData,
- useRemoveFavoriteMutation,
useReorderFavoritesMutation,
} from '@queries/favorites/favorites';
import type { Favorite } from '@service-storage/generated/schemas/favorite';
@@ -57,6 +54,7 @@ import {
type ParentProps,
Show,
} from 'solid-js';
+import { FavoriteContextMenu } from '../FavoriteContextMenu';
/**
* Drag data carried by favorite row sortables. Distinct from `EntityDragData`
@@ -344,7 +342,6 @@ const FavoriteRow = (props: {
const muteAction = makeMuteAction({
notificationSource: () => notificationSource,
});
- const removeMutation = useRemoveFavoriteMutation();
// Favorites already store the canonical notification type (`email_thread`),
// which the mute mapping accepts as-is.
const favoriteAsEntity = () =>
@@ -406,20 +403,6 @@ const FavoriteRow = (props: {
};
const open = (e: MouseEvent) => openFavorite(e.shiftKey);
- const canOpenInNewSplit = () =>
- globalSplitManager()?.canAppendSplit() ?? false;
- const canOpenFullscreen = () => layout.getSplitCount() > 1;
- const openInCurrentSplit = () => openFavorite(false);
- const openInNewSplit = () => {
- if (canOpenInNewSplit()) openFavorite(true);
- };
- const openFullscreen = () => {
- const split = layout.replaceAllSplits(content(), {
- referredFrom: 'sidebar',
- });
- globalSplitManager()?.returnFocus();
- return split;
- };
const markAllAsRead = () => {
void notificationSource.bulkMarkAsRead(props.notifications());
};
@@ -427,13 +410,6 @@ const FavoriteRow = (props: {
void notificationSource.bulkMarkAsDone(props.notifications());
};
- const removeFromFavorites = () => {
- removeMutation.mutate({
- entityType: props.favorite.entityType,
- entityId: props.favorite.entityId,
- });
- };
-
const isUnreadChannelFavorite = () =>
props.favorite.entityType === 'channel' && props.notifications().length > 0;
const [contextMenuOpen, setContextMenuOpen] = createSignal(false);
@@ -484,36 +460,12 @@ const FavoriteRow = (props: {
sortable.isActiveDraggable && 'opacity-40'
)}
>
- <ContextMenu onOpenChange={setContextMenuOpen}>
- <ContextMenu.Trigger class="w-full h-7">
- <Show when={isUnreadChannelFavorite()} fallback={row}>
- <FavoriteChannelHoverCard
- channelId={props.favorite.entityId}
- notifications={props.notifications()}
- disabled={contextMenuOpen()}
- onOpenChange={setHoverPreviewOpen}
- >
- {row}
- </FavoriteChannelHoverCard>
- </Show>
- </ContextMenu.Trigger>
-
- <ContextMenu.Portal>
- <ContextMenuContent class="text-xs text-ink-muted">
- <MenuGroup>
- <MenuItem
- text="Open in new split"
- onClick={openInNewSplit}
- disabled={!canOpenInNewSplit()}
- />
- <Show when={canOpenFullscreen()}>
- <MenuItem text="Open fullscreen" onClick={openFullscreen} />
- </Show>
- <MenuItem
- text="Open in current split"
- onClick={openInCurrentSplit}
- />
- </MenuGroup>
+ <FavoriteContextMenu
+ favorite={props.favorite}
+ triggerClass="h-7"
+ onOpenChange={setContextMenuOpen}
+ additionalActions={
+ <>
<Show when={props.notifications().length > 0}>
<MenuSeparator />
<MenuGroup>
@@ -534,16 +486,20 @@ const FavoriteRow = (props: {
/>
</MenuGroup>
</Show>
- <MenuSeparator />
- <MenuGroup>
- <MenuItem
- text="Remove from favorites"
- onClick={removeFromFavorites}
- />
- </MenuGroup>
- </ContextMenuContent>
- </ContextMenu.Portal>
- </ContextMenu>
+ </>
+ }
+ >
+ <Show when={isUnreadChannelFavorite()} fallback={row}>
+ <FavoriteChannelHoverCard
+ channelId={props.favorite.entityId}
+ notifications={props.notifications()}
+ disabled={contextMenuOpen()}
+ onOpenChange={setHoverPreviewOpen}
+ >
+ {row}
+ </FavoriteChannelHoverCard>
+ </Show>
+ </FavoriteContextMenu>
</div>
);
};
diff --git a/apps/web/src/features/inbox-view/inbox-view.tsx b/apps/web/src/features/inbox-view/inbox-view.tsx
index 43d8203fbc..b45d055622 100644
--- a/apps/web/src/features/inbox-view/inbox-view.tsx
+++ b/apps/web/src/features/inbox-view/inbox-view.tsx
@@ -5,8 +5,10 @@ import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
import { SplitPanel } from '@components/app/split-panel';
import { StaticMarkdownContext } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
+import EmptyStatePreviewIcon from '@design/empty-state-doc.svg';
import { type EntityData, ListEntityMetadataQueryProvider } from '@entity';
import SpinnerIcon from '@phosphor/spinner.svg';
+import { EmptyStatePanel } from '@ui';
import { createEffect, createSignal, onMount, Show, Suspense } from 'solid-js';
import { InboxHeader } from './components/InboxHeader';
import { InboxList } from './components/InboxList';
@@ -103,17 +105,12 @@ function InboxViewRoot() {
<Show
when={previewEntity()}
fallback={
- <div class="flex size-full items-center justify-center px-6 text-center">
- <div class="flex max-w-sm flex-col gap-2">
- <h2 class="text-base font-semibold text-ink">
- Select a notification
- </h2>
- <p class="text-sm leading-5 text-ink-muted">
- Choose an item from the sidebar to preview it
- here.
- </p>
- </div>
- </div>
+ <EmptyStatePanel
+ graphic={EmptyStatePreviewIcon}
+ title="No content selected"
+ description="Select an item from the connected list to preview it here"
+ centered
+ />
}
>
{(entity) => (
diff --git a/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsx b/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsx
index 1d461ac19e..cef6da3d72 100644
--- a/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsx
+++ b/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsx
@@ -7,8 +7,7 @@ import { EntityIcon, getEntityIconType } from '@core/component/EntityIcon';
import { ItemPreview } from '@core/component/ItemPreview';
import { StaticMarkdown } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
import {
- createTheme,
- twoLineClampMarkdownTheme,
+ inlineWrappingMarkdownTheme,
unifiedListMarkdownTheme,
} from '@core/component/LexicalMarkdown/theme';
import { UserIcon } from '@core/component/UserIcon';
@@ -610,14 +609,6 @@ function CardMarkdownLine(props: { text?: string; class?: string }) {
);
}
-const inlineWrappingMarkdownTheme = createTheme(
- {
- root: 'md inline pr-[2px] cursor-default',
- paragraph: 'md-p text-[1em] inline',
- },
- twoLineClampMarkdownTheme
-);
-
/**
* The two-line clamped markdown body (the channel-style message preview),
* reserving its height so short previews keep the row rhythm.
diff --git a/apps/web/src/features/tasks-view/components/TasksSidebar.tsx b/apps/web/src/features/tasks-view/components/TasksSidebar.tsx
index 0ebb600d41..df39e66bd3 100644
--- a/apps/web/src/features/tasks-view/components/TasksSidebar.tsx
+++ b/apps/web/src/features/tasks-view/components/TasksSidebar.tsx
@@ -3,6 +3,7 @@ import {
useViewTabHotkeys,
ViewSidebar,
} from '@app/components/view-shell';
+import { FavoriteContextMenu } from '@app/features/favorites/FavoriteContextMenu';
import { FavoriteIcon } from '@app/features/favorites/FavoriteIcon';
import {
favoriteSplitContent,
@@ -60,21 +61,23 @@ export function TasksNavigation(props: { onNavigate?: () => void }) {
function FavoriteRow(props: {
favorite: Favorite;
- onOpen: (favorite: Favorite) => void;
+ onOpen: (favorite: Favorite, event: MouseEvent) => void;
}) {
const name = useFavoriteDisplayName(props.favorite);
return (
- <ViewSidebar.Item
- class="font-normal"
- title={name()}
- onClick={() => props.onOpen(props.favorite)}
- >
- <span class="flex size-4 shrink-0 items-center justify-center">
- <FavoriteIcon favorite={props.favorite} class="size-4" />
- </span>
- <span class="truncate">{name()}</span>
- </ViewSidebar.Item>
+ <FavoriteContextMenu favorite={props.favorite} triggerClass="block">
+ <ViewSidebar.Item
+ class="font-normal"
+ title={name()}
+ onClick={(event) => props.onOpen(props.favorite, event)}
+ >
+ <span class="flex size-4 shrink-0 items-center justify-center">
+ <FavoriteIcon favorite={props.favorite} class="size-4" />
+ </span>
+ <span class="truncate">{name()}</span>
+ </ViewSidebar.Item>
+ </FavoriteContextMenu>
);
}
@@ -93,10 +96,10 @@ function TaskFavorites(props: {
)
.sort((left, right) => left.sortOrder - right.sortOrder)
);
-
- const openFavorite = (favorite: Favorite) => {
+ const openFavorite = (favorite: Favorite, event: MouseEvent) => {
layout.openWithSplit(favoriteSplitContent(favorite), {
referredFrom: 'sidebar',
+ preferNewSplit: event.shiftKey,
});
};
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/theme.ts b/apps/web/src/lib/core/component/LexicalMarkdown/theme.ts
index 34c6a12cfc..1630a520d7 100644
--- a/apps/web/src/lib/core/component/LexicalMarkdown/theme.ts
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/theme.ts
@@ -250,3 +250,11 @@ export const twoLineClampMarkdownTheme = createTheme({
// span participates in normal inline text flow and clamping is counted correctly.
searchMatch: 'search-match inline!',
});
+
+export const inlineWrappingMarkdownTheme = createTheme(
+ {
+ root: 'md inline pr-[2px] cursor-default',
+ paragraph: 'md-p text-[1em] inline',
+ },
+ twoLineClampMarkdownTheme
+);