Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions apps/web/src/features/entity/composed/list-entity/channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ export function ChannelMessageNarrowBody(props: {

export function ChannelLatestMessageNarrowBody(props: {
message: NonNullable<ChannelEntity['latestMessage']>;
senderFirstName?: string;
}) {
return (
<Entity.Slot
Expand All @@ -107,12 +106,12 @@ export function ChannelLatestMessageNarrowBody(props: {
when={props.message.content?.trim()}
fallback={<span class="italic">Attached Items</span>}
>
<span class="ph-no-capture font-medium text-ink-muted">
<DisplayName id={props.message.senderId} format="firstName" />:{' '}
</span>
<StaticMarkdown
theme={twoLineClampMarkdownTheme}
markdown={
(props.senderFirstName ? `**${props.senderFirstName}:** ` : '') +
props.message.content.trim()
}
markdown={props.message.content.trim()}
Comment on lines +109 to +114

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Keep the sender and message in one inline flow.

StaticMarkdown renders a root <div>, while this change places it after an inline sender <span>. The sender therefore consumes a separate block line, and the outer line-clamp-2 reduces the visible message preview. The previous implementation rendered **sender:** message in one markdown tree. (raw.githubusercontent.com)

Use an inline markdown theme that sets both the root and paragraph to inline, or use another layout that preserves one text flow. The repository already contains this inline-theme pattern. (raw.githubusercontent.com)

Proposed fix
 import {
+  createTheme,
   twoLineClampMarkdownTheme,
   unifiedListMarkdownTheme,
 } from '`@core/component/LexicalMarkdown/theme`';

+const inlineTwoLineClampMarkdownTheme = createTheme(
+  {
+    root: 'md inline pr-[2px] cursor-default',
+    paragraph: 'md-p text-[1em] inline',
+  },
+  twoLineClampMarkdownTheme
+);
+
...
-          theme={twoLineClampMarkdownTheme}
+          theme={inlineTwoLineClampMarkdownTheme}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<span class="ph-no-capture font-medium text-ink-muted">
<DisplayName id={props.message.senderId} format="firstName" />:{' '}
</span>
<StaticMarkdown
theme={twoLineClampMarkdownTheme}
markdown={
(props.senderFirstName ? `**${props.senderFirstName}:** ` : '') +
props.message.content.trim()
}
markdown={props.message.content.trim()}
import {
createTheme,
twoLineClampMarkdownTheme,
unifiedListMarkdownTheme,
} from '`@core/component/LexicalMarkdown/theme`';
const inlineTwoLineClampMarkdownTheme = createTheme(
{
root: 'md inline pr-[2px] cursor-default',
paragraph: 'md-p text-[1em] inline',
},
twoLineClampMarkdownTheme
);
<span class="ph-no-capture font-medium text-ink-muted">
<DisplayName id={props.message.senderId} format="firstName" />:{' '}
</span>
<StaticMarkdown
theme={inlineTwoLineClampMarkdownTheme}
markdown={props.message.content.trim()}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/features/entity/composed/list-entity/channel.tsx` around lines
109 - 114, Update the StaticMarkdown usage in the message preview so the sender
and content remain in one inline flow. Reuse the repository’s existing inline
markdown theme pattern, ensuring both the markdown root and paragraph render
inline, and apply it alongside twoLineClampMarkdownTheme without changing the
surrounding sender or content behavior.

singleLine
/>
</Show>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useMaybeSoupView } from '@app/features/next-soup/soup-view/soup-view-context';
import { tryMacroId, useDisplayNameParts } from '@core/user';
import { cn } from '@ui';
import { Match, Show, Switch } from 'solid-js';
import { MultiSelectCheckbox } from '../../components/MultiSelectCheckbox';
Expand Down Expand Up @@ -33,11 +32,6 @@ export function NarrowInboxLayout(props: LayoutProps) {
isChannelEntity(props.entity) &&
props.entity.channelType === 'direct_message';

const mostRecentMessageSenderName = () =>
isChannelEntity(props.entity) && props.entity.latestMessage?.senderId
? useDisplayNameParts(tryMacroId(props.entity.latestMessage?.senderId))
: undefined;

const firstNotification = () => {
if (!isWithNotification(props.entity)) return undefined;
return filterNotDoneNotifications(
Expand Down Expand Up @@ -142,12 +136,7 @@ export function NarrowInboxLayout(props: LayoutProps) {
<Match
when={isChannelEntity(props.entity) && props.entity.latestMessage}
>
{(msg) => (
<ChannelLatestMessageNarrowBody
message={msg()}
senderFirstName={mostRecentMessageSenderName()?.firstName()}
/>
)}
{(msg) => <ChannelLatestMessageNarrowBody message={msg()} />}
</Match>
<Match when={isEmailEntity(props.entity) && props.entity}>
{(entity) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { UserIcon } from '@core/component/UserIcon';
import { isMacroAgentId } from '@core/constant/macroAgent';
import { useUserId } from '@core/context/user';
import { tryMacroId, useDisplayName } from '@core/user';
import { getDisplayName, tryMacroId } from '@core/user';
import { plural } from '@core/util/string';
import {
DraftBadge,
Expand Down Expand Up @@ -383,7 +383,10 @@ const createSenderDisplayName = (
return id ? tryMacroId(id) : undefined;
};

const [displayName] = useDisplayName(macroId());
const displayName = () => {
const id = macroId();
return id ? getDisplayName(id) : undefined;
};

const botName = () => {
const id = senderId();
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/lib/core/user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export {
} from './combinedRecipient';
export { useContacts } from './contactService';
export {
getDisplayName,
getInitials,
getInitialsFromName,
seedMockDisplayNames,
Expand Down
Loading