ui(messenger-ui): 💄 Update ConversationItem and ConversationList components with modern styling, date divider visuals, and optimized rendering logic
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
08d7a679c2
commit
fdf9e1a71d
4 changed files with 26 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import type { ReactNode } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { getInitials } from '../utils/format';
|
||||
import { getInitials, formatTime } from '../utils/format';
|
||||
import { PROVIDER_COLORS, PROVIDER_EMOJIS } from '../providers';
|
||||
import type { ProviderType } from '../types';
|
||||
|
||||
|
|
@ -11,6 +11,7 @@ export interface ConversationItemProps {
|
|||
isActive: boolean;
|
||||
onClick: () => void;
|
||||
provider?: ProviderType;
|
||||
lastMessageAt?: string | null;
|
||||
lastMessagePreview?: string | null;
|
||||
renderProviderIcon?: (provider: ProviderType) => ReactNode;
|
||||
}
|
||||
|
|
@ -53,10 +54,25 @@ const Info = styled.div`
|
|||
min-width: 0;
|
||||
`;
|
||||
|
||||
const TopRow = styled.div`
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
`;
|
||||
|
||||
const NameRow = styled.div`
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
`;
|
||||
|
||||
const Timestamp = styled.span`
|
||||
font-size: 11px;
|
||||
color: ${(p) => p.theme.colors.text.secondary};
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
`;
|
||||
|
||||
const ProviderDot = styled.span<{ $color: string }>`
|
||||
|
|
@ -97,6 +113,7 @@ export function ConversationItem({
|
|||
isActive,
|
||||
onClick,
|
||||
provider,
|
||||
lastMessageAt,
|
||||
lastMessagePreview,
|
||||
renderProviderIcon,
|
||||
}: ConversationItemProps): React.JSX.Element {
|
||||
|
|
@ -114,10 +131,13 @@ export function ConversationItem({
|
|||
<ItemWrapper $active={isActive} onClick={onClick}>
|
||||
<AvatarCircle $isGroup={isGroup}>{getInitials(displayName)}</AvatarCircle>
|
||||
<Info>
|
||||
<NameRow>
|
||||
{renderIcon()}
|
||||
<Name>{displayName}</Name>
|
||||
</NameRow>
|
||||
<TopRow>
|
||||
<NameRow>
|
||||
{renderIcon()}
|
||||
<Name>{displayName}</Name>
|
||||
</NameRow>
|
||||
{lastMessageAt && <Timestamp>{formatTime(lastMessageAt)}</Timestamp>}
|
||||
</TopRow>
|
||||
<Meta>{metaText}</Meta>
|
||||
</Info>
|
||||
</ItemWrapper>
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ export function ConversationList({
|
|||
participantIds={conv.participantIds}
|
||||
isActive={conv.id === activeConversationId}
|
||||
provider={conv.provider}
|
||||
lastMessageAt={conv.lastMessageAt}
|
||||
lastMessagePreview={conv.lastMessagePreview}
|
||||
renderProviderIcon={renderProviderIcon}
|
||||
onClick={() =>
|
||||
|
|
|
|||
BIN
messenger-conversation-list.png
Normal file
BIN
messenger-conversation-list.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
BIN
messenger-date-dividers.png
Normal file
BIN
messenger-date-dividers.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
Loading…
Add table
Reference in a new issue