From ce0a3b90fecf2b9b611c5acb3a8cf1d679594a92 Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Sat, 29 Aug 2026 21:44:22 +0530 Subject: [PATCH] rollback reply to old style --- src/app/components/message/Reply.css.ts | 15 -- src/app/components/message/Reply.tsx | 170 +++++------------- src/app/features/room/OutboxView.tsx | 11 +- src/app/features/room/RoomInput.tsx | 2 +- src/app/features/room/RoomTimeline.tsx | 47 +++-- src/app/features/room/message/Message.tsx | 10 +- .../room/thread-view/TimelineView.tsx | 43 ++--- 7 files changed, 94 insertions(+), 204 deletions(-) delete mode 100644 src/app/components/message/Reply.css.ts diff --git a/src/app/components/message/Reply.css.ts b/src/app/components/message/Reply.css.ts deleted file mode 100644 index 24c11682..00000000 --- a/src/app/components/message/Reply.css.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { style } from '@vanilla-extract/css'; -import { color, config, toRem } from 'folds'; - -export const ReplyBar = style({ - position: 'relative', - top: toRem(8), - marginLeft: 'auto', - - width: toRem(19), - height: `calc(100% - ${toRem(4)})`, - - borderLeft: `${config.borderWidth.B500} solid ${color.Surface.ContainerLine}`, - borderTop: `${config.borderWidth.B500} solid ${color.Surface.ContainerLine}`, - borderTopLeftRadius: config.radii.R400, -}); diff --git a/src/app/components/message/Reply.tsx b/src/app/components/message/Reply.tsx index b623d89c..fb51788a 100644 --- a/src/app/components/message/Reply.tsx +++ b/src/app/components/message/Reply.tsx @@ -1,11 +1,10 @@ -import { Box, Text, color, config, toRem } from 'folds'; +import { Box, Icon, Icons, Text, color, config, toRem } from 'folds'; import React, { MouseEventHandler, ReactNode, useCallback, useMemo } from 'react'; import { ClientEventWithoutRoomId } from 'neurone/lib/api/types'; import { HTMLReactParserOptions } from 'html-react-parser'; import { Opts } from 'linkifyjs'; import { LinePlaceholder } from './placeholder'; import { randomNumberBetween } from '../../utils/common'; -import * as css from './Reply.css'; import { MessageFailedContent } from './content'; import { useRoomEvent } from '../../hooks/useRoomEvent'; import colorMXID from '../../../util/colorMXID'; @@ -14,9 +13,6 @@ import { GetRoomMemberNameCallback } from '../../hooks/useRoomMembers'; import { rContent, rUnsigned } from '../../../client/reader'; import { TimelineView } from '../../../client/room'; import { RenderReplyContent } from '../RenderReplyContent'; -import { Time } from './Time'; -import { BubbleLayout, CompactLayout, MessageBase, ModernLayout } from './layout'; -import { MessageLayout, MessageSpacing } from '../../state/settings'; import { RedactedContent } from './MsgTypeRenderers'; import { HoverUnderline } from '../../styles/Text.css'; import { useObservableValueOptionally } from '../../hooks/useObservableValue'; @@ -26,20 +22,11 @@ import { useClient } from '../../hooks/useClient'; type ReplyMessageProps = { username?: ReactNode; - time?: ReactNode; - messageLayout: MessageLayout; + usernameColor?: string; children: ReactNode; onClick?: () => void; }; -export function ReplyMessage({ - username, - time, - messageLayout, - onClick, - children, -}: ReplyMessageProps) { - const msgBarJSX =
; - +export function ReplyMessage({ username, usernameColor, onClick, children }: ReplyMessageProps) { const handleKeyDown = (event: React.KeyboardEvent) => { if (!onClick) return; @@ -71,52 +58,14 @@ export function ReplyMessage({ } : {}; - if (messageLayout === MessageLayout.Compact) { - return ( - - - - - {username} - - - {children} - - {time} - - - - ); - } - - if (messageLayout === MessageLayout.Bubble) { - return ( - - - - {username} - - - {children} - - {time} - - - ); - } - return ( - - - - {username} - - - {children} - - {time} + + + + {username} - + {children} + ); } @@ -125,7 +74,6 @@ type ReplyProps = { eventId: string; onClick?: (replyId: string) => void; onUserClick?: MouseEventHandler; - onUsernameClick?: MouseEventHandler; getMemberPowerTag?: GetMemberPowerTag; accessibleTagColors?: Map; legacyUsernameColor?: boolean; @@ -133,10 +81,6 @@ type ReplyProps = { timeline?: TimelineView; htmlReactParserOptions: HTMLReactParserOptions; linkifyOpts: Opts; - hour24Clock: boolean; - messageLayout: MessageLayout; - dateFormatString: string; - messageSpacing: MessageSpacing; }; export function Reply({ @@ -144,7 +88,6 @@ export function Reply({ eventId, onClick, onUserClick, - onUsernameClick, getMemberPowerTag, accessibleTagColors, legacyUsernameColor, @@ -152,10 +95,6 @@ export function Reply({ timeline, htmlReactParserOptions, linkifyOpts, - hour24Clock, - dateFormatString, - messageLayout, - messageSpacing, }: ReplyProps) { const ct = useClient(); const placeholderWidth = useMemo(() => randomNumberBetween(40, 400), []); @@ -211,58 +150,47 @@ export function Reply({ ); }; + const replyClick = onClick ? () => onClick(eventId) : undefined; + return ( - - onClick(eventId) : undefined} - messageLayout={messageLayout} - username={ - sender && ( - - {getMemberName(sender)} - - ) - } - time={ - replyEvent && ( - - + ) + } + data-event-id={eventId} + > + {replyEvent && renderEventContent(replyEvent)} + {replyEvent === null && ( + + + + )} + {replyEvent === undefined && ( + + )} + ); } diff --git a/src/app/features/room/OutboxView.tsx b/src/app/features/room/OutboxView.tsx index 90398e57..848cc335 100644 --- a/src/app/features/room/OutboxView.tsx +++ b/src/app/features/room/OutboxView.tsx @@ -224,8 +224,6 @@ export function OutboxView({ onUsernameClick, mediaAutoLoad, urlPreview, - hour24Clock, - dateFormatString, onReplyClick, htmlReactParserOptions, linkifyOpts, @@ -242,8 +240,6 @@ export function OutboxView({ onUsernameClick: MouseEventHandler; mediaAutoLoad?: boolean; urlPreview?: boolean; - hour24Clock: boolean; - dateFormatString: string; onReplyClick?: () => void; htmlReactParserOptions: HTMLReactParserOptions; linkifyOpts: Opts; @@ -287,6 +283,7 @@ export function OutboxView({ roomId={roomId} eventId={replyEventId} onClick={onReplyClick} + onUserClick={onUserClick} getMemberPowerTag={getMemberPowerTag} accessibleTagColors={accessibleTagColors} legacyUsernameColor={legacyUsernameColor || direct} @@ -294,10 +291,6 @@ export function OutboxView({ timeline={timeline} htmlReactParserOptions={htmlReactParserOptions} linkifyOpts={linkifyOpts} - hour24Clock={hour24Clock} - dateFormatString={dateFormatString} - messageLayout={messageLayout} - messageSpacing={messageSpacing} /> ); @@ -306,7 +299,6 @@ export function OutboxView({ {dayDivider && ( )} - {replyJSX} + {replyJSX} ( - Quote{' '} + Reply{' '} @{memberAPI.getName(replyDraft.userId)} diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx index df0bbc70..29f5686f 100644 --- a/src/app/features/room/RoomTimeline.tsx +++ b/src/app/features/room/RoomTimeline.tsx @@ -389,6 +389,25 @@ export function RoomTimeline({ eventId, roomInputRef, editor, timeline }: RoomTi ); } + const replyEventId = getReplyId(event.content); + + const replyJSX = + !getThreadId(event) && replyEventId ? ( + + ) : null; + const threadTimeline = threads.get(event.event_id); return ( @@ -426,6 +445,7 @@ export function RoomTimeline({ eventId, roomInputRef, editor, timeline }: RoomTi hour24Clock={hour24Clock} dateFormatString={dateFormatString} > + {replyJSX} {redacted.has(event.event_id) ? ( ) : ( @@ -519,34 +539,9 @@ export function RoomTimeline({ eventId, roomInputRef, editor, timeline }: RoomTi if (newDivider && dividerJSX) clearNewDivider(); if (dayDivider && dividerJSX) clearDayDivider(); - const replyEventId = getReplyId(event.content); - - const replyJSX = - !getThreadId(event) && replyEventId ? ( - - ) : null; - return ( {dividerJSX} - {replyJSX} {eventJSX} ); @@ -612,8 +607,6 @@ export function RoomTimeline({ eventId, roomInputRef, editor, timeline }: RoomTi legacyUsernameColor={legacyUsernameColor || direct} mediaAutoLoad={mediaAutoLoad} urlPreview={showUrlPreview} - hour24Clock={hour24Clock} - dateFormatString={dateFormatString} htmlReactParserOptions={htmlReactParserOptions} linkifyOpts={linkifyOpts} /> diff --git a/src/app/features/room/message/Message.tsx b/src/app/features/room/message/Message.tsx index dc809a2c..7dd462f7 100644 --- a/src/app/features/room/message/Message.tsx +++ b/src/app/features/room/message/Message.tsx @@ -937,8 +937,6 @@ export const Message = as<'div', MessageProps>( }, 100); }; - // hide margin-top space between message and reply - const hasReply = !!getReplyId(event.content) && !fallbackReply(event.content); return ( ( })} tabIndex={0} space={messageSpacing} - collapse={collapse || hasReply} + collapse={collapse} highlight={highlight} selected={!!selected || !!menuAnchor || !!emojiBoardAnchor} {...props} @@ -1002,7 +1000,7 @@ export const Message = as<'div', MessageProps>( size="300" radii="300" > - + {canThread && ( ( )} } + after={} radii="300" data-event-id={event.event_id} data-sender-id={event.sender} @@ -1091,7 +1089,7 @@ export const Message = as<'div', MessageProps>( size="T300" truncate > - Quote + Reply {canThread && ( diff --git a/src/app/features/room/thread-view/TimelineView.tsx b/src/app/features/room/thread-view/TimelineView.tsx index aed83486..f6979bab 100644 --- a/src/app/features/room/thread-view/TimelineView.tsx +++ b/src/app/features/room/thread-view/TimelineView.tsx @@ -289,6 +289,23 @@ export function TimelineView({ threadTimeline, threadInputRef }: TimelineViewPro const editedEvent = getLatestEditEvent(event, editEvents, redacted); const highlighted = focusItem?.index === item && focusItem.highlight; + const replyEventId = fallbackReply(event.content) ? undefined : getReplyId(event.content); + const replyJSX = replyEventId ? ( + + ) : null; + const reactionJSX = reactionEvents && reactionEvents?.length > 0 && ( + {replyJSX} {redacted.has(event.event_id) ? ( ) : ( @@ -411,32 +429,9 @@ export function TimelineView({ threadTimeline, threadInputRef }: TimelineViewPro if (newDivider && dividerJSX) clearNewDivider(); if (dayDivider && dividerJSX) clearDayDivider(); - const replyEventId = fallbackReply(event.content) ? undefined : getReplyId(event.content); - const replyJSX = replyEventId ? ( - - ) : null; - return ( {dividerJSX} - {replyJSX} {eventJSX} ); @@ -522,8 +517,6 @@ export function TimelineView({ threadTimeline, threadInputRef }: TimelineViewPro legacyUsernameColor={legacyUsernameColor || direct} mediaAutoLoad={mediaAutoLoad} urlPreview={showUrlPreview} - hour24Clock={hour24Clock} - dateFormatString={dateFormatString} htmlReactParserOptions={htmlReactParserOptions} linkifyOpts={linkifyOpts} />