diff --git a/src/app/components/message/Reply.tsx b/src/app/components/message/Reply.tsx index 82a9d919..19a6a21e 100644 --- a/src/app/components/message/Reply.tsx +++ b/src/app/components/message/Reply.tsx @@ -48,6 +48,7 @@ export const ThreadIndicator = as<'div'>(({ ...props }, ref) => ( type ReplyProps = { mx: MatrixClient; room: Room; + mxidColor?: boolean; timelineSet?: EventTimelineSet | undefined; replyEventId: string; threadRootId?: string | undefined; @@ -55,7 +56,7 @@ type ReplyProps = { }; export const Reply = as<'div', ReplyProps>((_, ref) => { - const { mx, room, timelineSet, replyEventId, threadRootId, onClick, ...props } = _; + const { mx, room, mxidColor, timelineSet, replyEventId, threadRootId, onClick, ...props } = _; const [replyEvent, setReplyEvent] = useState( timelineSet?.findEventById(replyEventId) ); @@ -101,7 +102,7 @@ export const Reply = as<'div', ReplyProps>((_, ref) => { )} diff --git a/src/app/features/message-search/MessageSearch.tsx b/src/app/features/message-search/MessageSearch.tsx index 5793ed91..51673722 100644 --- a/src/app/features/message-search/MessageSearch.tsx +++ b/src/app/features/message-search/MessageSearch.tsx @@ -55,6 +55,7 @@ export function MessageSearch({ const allRooms = useRooms(mx, allRoomsAtom, mDirects); const [mediaAutoLoad] = useSetting(settingsAtom, 'mediaAutoLoad'); const [urlPreview] = useSetting(settingsAtom, 'urlPreview'); + const [mxidColor] = useSetting(settingsAtom, 'mxidColor'); const searchInputRef = useRef(null); const scrollTopAnchorRef = useRef(null); const [searchParams, setSearchParams] = useSearchParams(); @@ -296,6 +297,7 @@ export function MessageSearch({ items={group.items} mediaAutoLoad={mediaAutoLoad} urlPreview={urlPreview} + mxidColor={mxidColor} onOpen={navigateRoom} /> diff --git a/src/app/features/message-search/SearchResultGroup.tsx b/src/app/features/message-search/SearchResultGroup.tsx index 29fce7bf..e70e7022 100644 --- a/src/app/features/message-search/SearchResultGroup.tsx +++ b/src/app/features/message-search/SearchResultGroup.tsx @@ -46,6 +46,7 @@ type SearchResultGroupProps = { items: ResultItem[]; mediaAutoLoad?: boolean; urlPreview?: boolean; + mxidColor?: boolean; onOpen: (roomId: string, eventId: string) => void; }; export function SearchResultGroup({ @@ -54,6 +55,7 @@ export function SearchResultGroup({ items, mediaAutoLoad, urlPreview, + mxidColor, onOpen, }: SearchResultGroupProps) { const mx = useMatrixClient(); @@ -81,7 +83,15 @@ export function SearchResultGroup({ handleSpoilerClick: spoilerClickHandler, handleMentionClick: mentionClickHandler, }), - [mx, room, linkifyOpts, highlightRegex, mentionClickHandler, spoilerClickHandler, useAuthentication] + [ + mx, + room, + linkifyOpts, + highlightRegex, + mentionClickHandler, + spoilerClickHandler, + useAuthentication, + ] ); const renderMatrixEvent = useMatrixEventRenderer<[IEventWithRoomId, string, GetContentCallback]>( @@ -212,7 +222,14 @@ export function SearchResultGroup({ userId={event.sender} src={ senderAvatarMxc - ? mxcUrlToHttp(mx, senderAvatarMxc, useAuthentication, 48, 48, 'crop') ?? undefined + ? mxcUrlToHttp( + mx, + senderAvatarMxc, + useAuthentication, + 48, + 48, + 'crop' + ) ?? undefined : undefined } alt={displayName} @@ -224,7 +241,7 @@ export function SearchResultGroup({ > - + {displayName} @@ -246,6 +263,7 @@ export function SearchResultGroup({ ( ({ editor, fileDropContainerRef, roomId, room }, ref) => { const mx = useMatrixClient(); const useAuthentication = useMediaAuthentication(); + const [mxidColor] = useSetting(settingsAtom, 'mxidColor'); const [enterForNewline] = useSetting(settingsAtom, 'enterForNewline'); const [isMarkdown] = useSetting(settingsAtom, 'isMarkdown'); const commands = useCommands(mx, room); @@ -499,7 +506,7 @@ export const RoomInput = forwardRef( {replyDraft.relation?.rel_type === RelationType.Thread && } diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx index a2738fcb..d18510c1 100644 --- a/src/app/features/room/RoomTimeline.tsx +++ b/src/app/features/room/RoomTimeline.tsx @@ -424,6 +424,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli const encryptedRoom = mx.isRoomEncrypted(room.roomId); const [messageLayout] = useSetting(settingsAtom, 'messageLayout'); const [messageSpacing] = useSetting(settingsAtom, 'messageSpacing'); + const [mxidColor] = useSetting(settingsAtom, 'mxidColor'); const [hideMembershipEvents] = useSetting(settingsAtom, 'hideMembershipEvents'); const [hideNickAvatarEvents] = useSetting(settingsAtom, 'hideNickAvatarEvents'); const [mediaAutoLoad] = useSetting(settingsAtom, 'mediaAutoLoad'); @@ -978,6 +979,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli mEvent={mEvent} messageSpacing={messageSpacing} messageLayout={messageLayout} + mxidColor={mxidColor} collapse={collapse} highlight={highlighted} edit={editId === mEventId} @@ -995,6 +997,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli evt.isEncrypted() ? { - [`<== DECRYPTED_EVENT ==>`]: evt.getEffectiveEvent(), - [`<== ORIGINAL_EVENT ==>`]: evt.event, - } + [`<== DECRYPTED_EVENT ==>`]: evt.getEffectiveEvent(), + [`<== ORIGINAL_EVENT ==>`]: evt.event, + } : evt.event; const getText = (): string => { @@ -615,6 +620,7 @@ export type MessageProps = { relations?: Relations; messageLayout: MessageLayout; messageSpacing: MessageSpacing; + mxidColor?: boolean; onUserClick: MouseEventHandler; onUsernameClick: MouseEventHandler; onReplyClick: MouseEventHandler; @@ -638,6 +644,7 @@ export const Message = as<'div', MessageProps>( relations, messageLayout, messageSpacing, + mxidColor, onUserClick, onUsernameClick, onReplyClick, @@ -673,7 +680,7 @@ export const Message = as<'div', MessageProps>( > ( {((!mEvent.isRedacted() && canDelete) || mEvent.getSender() !== mx.getUserId()) && ( - <> - - - {!mEvent.isRedacted() && canDelete && ( - - )} - {mEvent.getSender() !== mx.getUserId() && ( - - )} - - - )} + <> + + + {!mEvent.isRedacted() && canDelete && ( + + )} + {mEvent.getSender() !== mx.getUserId() && ( + + )} + + + )} } @@ -1095,26 +1102,26 @@ export const Event = as<'div', EventProps>( {((!mEvent.isRedacted() && canDelete && !stateEvent) || (mEvent.getSender() !== mx.getUserId() && !stateEvent)) && ( - <> - - - {!mEvent.isRedacted() && canDelete && ( - - )} - {mEvent.getSender() !== mx.getUserId() && ( - - )} - - - )} + <> + + + {!mEvent.isRedacted() && canDelete && ( + + )} + {mEvent.getSender() !== mx.getUserId() && ( + + )} + + + )} } diff --git a/src/app/organisms/settings/Settings.jsx b/src/app/organisms/settings/Settings.jsx index 6329a57f..6ed214a3 100644 --- a/src/app/organisms/settings/Settings.jsx +++ b/src/app/organisms/settings/Settings.jsx @@ -54,6 +54,7 @@ function AppearanceSection() { const [enterForNewline, setEnterForNewline] = useSetting(settingsAtom, 'enterForNewline'); const [messageLayout, setMessageLayout] = useSetting(settingsAtom, 'messageLayout'); const [messageSpacing, setMessageSpacing] = useSetting(settingsAtom, 'messageSpacing'); + const [mxidColor, setMXIDColor] = useSetting(settingsAtom, 'mxidColor'); const [twitterEmoji, setTwitterEmoji] = useSetting(settingsAtom, 'twitterEmoji'); const [pageZoom, setPageZoom] = useSetting(settingsAtom, 'pageZoom'); const [isMarkdown, setIsMarkdown] = useSetting(settingsAtom, 'isMarkdown'); @@ -189,6 +190,11 @@ function AppearanceSection() { /> } /> + setMXIDColor(!mxidColor)} />} + content={Color username with matrix userID.} + /> void; }; function RoomNotificationsGroupComp({ @@ -189,6 +190,7 @@ function RoomNotificationsGroupComp({ notifications, mediaAutoLoad, urlPreview, + mxidColor, onOpen, }: RoomNotificationsGroupProps) { const mx = useMatrixClient(); @@ -427,7 +429,14 @@ function RoomNotificationsGroupComp({ userId={event.sender} src={ senderAvatarMxc - ? mxcUrlToHttp(mx, senderAvatarMxc, useAuthentication, 48, 48, 'crop') ?? undefined + ? mxcUrlToHttp( + mx, + senderAvatarMxc, + useAuthentication, + 48, + 48, + 'crop' + ) ?? undefined : undefined } alt={displayName} @@ -439,7 +448,7 @@ function RoomNotificationsGroupComp({ > - + {displayName} @@ -461,6 +470,7 @@ function RoomNotificationsGroupComp({