remove avatar from threads selector

This commit is contained in:
Ajay Bura 2025-10-22 16:21:33 +05:30
parent 174b315278
commit e44ca92422
2 changed files with 10 additions and 37 deletions

View file

@ -1,13 +1,10 @@
import { Avatar, Box, Icon, Icons, Line, Text } from 'folds'; import { Box, Icon, Icons, Line, Text } from 'folds';
import React, { ReactNode } from 'react'; import React, { ReactNode } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { IThreadBundledRelationship, Room } from 'matrix-js-sdk'; import { IThreadBundledRelationship, Room } from 'matrix-js-sdk';
import * as css from './styles.css'; import * as css from './styles.css';
import { UserAvatar } from '../../../../components/user-avatar'; import { getMemberDisplayName } from '../../../../utils/room';
import { getMemberAvatarMxc, getMemberDisplayName } from '../../../../utils/room'; import { getMxIdLocalPart } from '../../../../utils/matrix';
import { useMatrixClient } from '../../../../hooks/useMatrixClient';
import { useMediaAuthentication } from '../../../../hooks/useMediaAuthentication';
import { getMxIdLocalPart, mxcUrlToHttp } from '../../../../utils/matrix';
import { Time } from '../../../../components/message'; import { Time } from '../../../../components/message';
export function ThreadSelectorContainer({ children }: { children: ReactNode }) { export function ThreadSelectorContainer({ children }: { children: ReactNode }) {
@ -29,13 +26,9 @@ export function ThreadSelector({
hour24Clock, hour24Clock,
dateFormatString, dateFormatString,
}: ThreadSelectorProps) { }: ThreadSelectorProps) {
const mx = useMatrixClient();
const useAuthentication = useMediaAuthentication();
const latestEvent = threadDetail.latest_event; const latestEvent = threadDetail.latest_event;
const latestSenderId = latestEvent.sender; const latestSenderId = latestEvent.sender;
const latestSenderAvatarMxc = getMemberAvatarMxc(room, latestSenderId);
const latestDisplayName = const latestDisplayName =
getMemberDisplayName(room, latestSenderId) ?? getMemberDisplayName(room, latestSenderId) ??
getMxIdLocalPart(latestSenderId) ?? getMxIdLocalPart(latestSenderId) ??
@ -51,10 +44,10 @@ export function ThreadSelector({
alignItems="Center" alignItems="Center"
gap="300" gap="300"
> >
<Box className={css.ThreadRepliesCount} shrink="No" alignItems="Center" gap="100"> <Box className={css.ThreadRepliesCount} shrink="No" alignItems="Center" gap="200">
<Icon size="100" src={Icons.Thread} filled /> <Icon size="100" src={Icons.Thread} filled />
<Text size="L400"> <Text size="L400">
{threadDetail.count} {threadDetail.count === 1 ? 'Thread Reply' : 'Thread Replies'} {threadDetail.count} {threadDetail.count === 1 ? 'Reply' : 'Replies'}
</Text> </Text>
</Box> </Box>
{latestSenderId && ( {latestSenderId && (
@ -65,35 +58,15 @@ export function ThreadSelector({
variant="SurfaceVariant" variant="SurfaceVariant"
/> />
<Box gap="200" alignItems="Inherit"> <Box gap="200" alignItems="Inherit">
<Box gap="100" alignItems="Inherit">
<Avatar size="200" radii="400">
<UserAvatar
userId={latestSenderId}
src={
latestSenderAvatarMxc
? mxcUrlToHttp(
mx,
latestSenderAvatarMxc,
useAuthentication,
48,
48,
'crop'
) ?? undefined
: undefined
}
alt={latestSenderId}
renderFallback={() => <Icon size="200" src={Icons.User} filled />}
/>
</Avatar>
</Box>
<Text size="T200" truncate> <Text size="T200" truncate>
<span> <span>Last reply by </span>
Latest by <strong>{latestDisplayName}</strong> at{' '} <b>{latestDisplayName}</b>
</span> <span> </span>
<Time <Time
hour24Clock={hour24Clock} hour24Clock={hour24Clock}
dateFormatString={dateFormatString} dateFormatString={dateFormatString}
ts={latestEventTs} ts={latestEventTs}
inheritPriority
/> />
</Text> </Text>
<Icon size="100" src={Icons.ChevronRight} /> <Icon size="100" src={Icons.ChevronRight} />

View file

@ -9,7 +9,7 @@ export const ThreadSelectorContainer = style({
export const ThreadSelector = style([ export const ThreadSelector = style([
ContainerColor({ variant: 'SurfaceVariant' }), ContainerColor({ variant: 'SurfaceVariant' }),
{ {
padding: `${config.space.S200} ${config.space.S300}`, padding: config.space.S200,
borderRadius: config.radii.R400, borderRadius: config.radii.R400,
cursor: 'pointer', cursor: 'pointer',