diff --git a/packages/pl-fe/src/features/chats/components/chat-list-item.tsx b/packages/pl-fe/src/features/chats/components/chat-list-item.tsx index 4db458bf6..215c7e02a 100644 --- a/packages/pl-fe/src/features/chats/components/chat-list-item.tsx +++ b/packages/pl-fe/src/features/chats/components/chat-list-item.tsx @@ -1,4 +1,5 @@ import { useNavigate } from '@tanstack/react-router'; +import clsx from 'clsx'; import React, { useMemo } from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; @@ -6,10 +7,7 @@ import DropdownMenu from 'pl-fe/components/dropdown-menu'; import { ParsedContent } from 'pl-fe/components/parsed-content'; import RelativeTimestamp from 'pl-fe/components/relative-timestamp'; import Avatar from 'pl-fe/components/ui/avatar'; -import HStack from 'pl-fe/components/ui/hstack'; import IconButton from 'pl-fe/components/ui/icon-button'; -import Stack from 'pl-fe/components/ui/stack'; -import Text from 'pl-fe/components/ui/text'; import VerificationBadge from 'pl-fe/components/verification-badge'; import { useChatContext } from 'pl-fe/contexts/chat-context'; import { useFeatures } from 'pl-fe/hooks/use-features'; @@ -85,58 +83,46 @@ const ChatListItem: React.FC = ({ chat, onClick }) => { data-testid='chat-list-item' tabIndex={0} > - - +
+
- -
- {chat.account?.display_name || `@${chat.account.username}`} +
+
+

{chat.account?.display_name || `@${chat.account.username}`}

{chat.account?.verified && }
- {(isBlocked || isBlocking) ? ( - - {isBlocked - ? - : } - - ) : ( - <> - {chat.last_message?.content && ( - - - - )} - - )} - - +

+ {isBlocked ? ( + + ) : isBlocking ? ( + + ) : ( + chat.last_message?.content && ( + + ) + )} +

+
+
- +
{features.chatsDelete && (
@@ -152,7 +138,7 @@ const ChatListItem: React.FC = ({ chat, onClick }) => { <> {chat.last_message.unread && (
)} @@ -166,8 +152,8 @@ const ChatListItem: React.FC = ({ chat, onClick }) => { /> )} - - +
+
); }; diff --git a/packages/pl-fe/src/features/chats/components/chat-list-shoutbox.tsx b/packages/pl-fe/src/features/chats/components/chat-list-shoutbox.tsx index 2807f0f2a..ce30aa903 100644 --- a/packages/pl-fe/src/features/chats/components/chat-list-shoutbox.tsx +++ b/packages/pl-fe/src/features/chats/components/chat-list-shoutbox.tsx @@ -4,9 +4,6 @@ import { FormattedMessage } from 'react-intl'; import { useAccount } from 'pl-fe/api/hooks/accounts/use-account'; import { ParsedContent } from 'pl-fe/components/parsed-content'; import Avatar from 'pl-fe/components/ui/avatar'; -import HStack from 'pl-fe/components/ui/hstack'; -import Stack from 'pl-fe/components/ui/stack'; -import Text from 'pl-fe/components/ui/text'; import { useInstance } from 'pl-fe/hooks/use-instance'; import { usePlFeConfig } from 'pl-fe/hooks/use-pl-fe-config'; import { useShoutboxMessages } from 'pl-fe/stores/shoutbox'; @@ -37,43 +34,34 @@ const ChatListShoutbox: React.FC = ({ onClick }) => key='shoutbox' onClick={() => onClick('shoutbox')} onKeyDown={handleKeyDown} - className='⁂-chat-list-item' + className='⁂-chat-list-item ⁂-chat-list-item--shoutbox' data-testid='chat-list-item' tabIndex={0} > - - - - -
- - - -
+
+ +
+
+

+ +

+
- {lastMessage && ( - <> - - {lastMessageAuthor && ( - - {lastMessageAuthor.display_name || `@${lastMessageAuthor.username}`}: - {' '} - - )} - - - - )} - - - + {lastMessage && ( + <> +

+ {lastMessageAuthor && ( + + {lastMessageAuthor.display_name || `@${lastMessageAuthor.username}`}: + {' '} + + )} + +

+ + )} +
+
); }; diff --git a/packages/pl-fe/src/styles/new/chats.scss b/packages/pl-fe/src/styles/new/chats.scss index caa0a66f6..41f7811a0 100644 --- a/packages/pl-fe/src/styles/new/chats.scss +++ b/packages/pl-fe/src/styles/new/chats.scss @@ -131,6 +131,55 @@ .⁂-chat-list-item { @apply flex w-full flex-col rounded-lg px-2 py-3 hover:bg-gray-100 focus:shadow-inset-ring dark:hover:bg-gray-800; + > div { + @apply flex items-center justify-between gap-2 w-full; + } + + &--shoutbox > div { + @apply justify-normal; + } + + &__info { + @apply flex items-center gap-2 overflow-hidden; + } + + &__avatar { + @apply flex-none; + } + + &__content { + @apply flex flex-col items-start overflow-hidden; + } + + &__name { + @apply flex w-full grow items-center space-x-1; + + p { + @include mixins.text($weight: bold, $size: sm, $align: left, $truncate: true); + } + } + + &__message { + @include mixins.text($theme: muted, $size: sm, $align: left, $truncate: true); + @apply truncate-child pointer-events-none h-5 w-full; + + &--unread { + @apply text-gray-900 dark:text-gray-100; + } + + &:not(&--blocking) > * { + @apply truncate; + } + + &__author { + @include mixins.text($weight: bold, $size: sm, $align: left, $theme: muted, $truncate: true); + } + } + + &__actions { + @apply flex items-center gap-2; + } + &__menu { @apply max-w-0 overflow-hidden text-gray-600 hover:text-gray-100; @@ -146,4 +195,16 @@ &:hover .⁂-chat-list-item__menu { @apply max-w-full; } + + &__unread { + @apply size-2 rounded-full bg-secondary-500; + } + + &__timestamp { + @include mixins.text($theme: muted, $size: xs, $align: right, $truncate: true); + } + + &__unread + &__timestamp { + @apply text-gray-900 dark:text-gray-100; + } } \ No newline at end of file