From 5ea12b6adbf11c31c2d063aac0454fa062f56a88 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 11 May 2026 15:04:14 +0300 Subject: [PATCH] update header on desktop+mobile --- .../icons/inbox_stroke2_corner2_rounded.svg | 1 + src/components/icons/Inbox.tsx | 5 ++ src/screens/Messages/ChatList.tsx | 79 +++++++++++-------- .../Messages/components/InboxRequests.tsx | 71 ++++++++++++++--- 4 files changed, 108 insertions(+), 48 deletions(-) create mode 100644 assets/icons/inbox_stroke2_corner2_rounded.svg create mode 100644 src/components/icons/Inbox.tsx diff --git a/assets/icons/inbox_stroke2_corner2_rounded.svg b/assets/icons/inbox_stroke2_corner2_rounded.svg new file mode 100644 index 0000000000..a2cbed7ce7 --- /dev/null +++ b/assets/icons/inbox_stroke2_corner2_rounded.svg @@ -0,0 +1 @@ + diff --git a/src/components/icons/Inbox.tsx b/src/components/icons/Inbox.tsx new file mode 100644 index 0000000000..fad9fdbb9d --- /dev/null +++ b/src/components/icons/Inbox.tsx @@ -0,0 +1,5 @@ +import {createSinglePathSVG} from './TEMPLATE' + +export const Inbox_Stroke2_Corner2_Rounded = createSinglePathSVG({ + path: 'M19 14h-2.417a5 5 0 0 1-9.166 0H5v4a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-4Zm0-8a1 1 0 0 0-.898-.995L18 5H6a1 1 0 0 0-1 1v6h3.126a1 1 0 0 1 .969.751 3.001 3.001 0 0 0 5.81 0l.056-.16a1 1 0 0 1 .913-.591H19V6Zm2 12a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h12l.154.004A3 3 0 0 1 21 6v12Z', +}) diff --git a/src/screens/Messages/ChatList.tsx b/src/screens/Messages/ChatList.tsx index 03a641de86..9d87db6360 100644 --- a/src/screens/Messages/ChatList.tsx +++ b/src/screens/Messages/ChatList.tsx @@ -29,8 +29,10 @@ import {NewChat} from '#/components/dms/dialogs/NewChatDialog' import {useRefreshOnFocus} from '#/components/hooks/useRefreshOnFocus' import {ArrowRotateCounterClockwise_Stroke2_Corner0_Rounded as RetryIcon} from '#/components/icons/ArrowRotate' import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfoIcon} from '#/components/icons/CircleInfo' -import {Message_Stroke2_Corner0_Rounded as MessageIcon} from '#/components/icons/Message' -import {PlusLarge_Stroke2_Corner0_Rounded as PlusIcon} from '#/components/icons/Plus' +import { + Message_Stroke2_Corner0_Rounded as MessageIcon, + MessagePlus_Stroke2_Corner0_Rounded as NewChatIcon, +} from '#/components/icons/Message' import {SettingsGear2_Stroke2_Corner0_Rounded as SettingsIcon} from '#/components/icons/SettingsGear2' import * as Layout from '#/components/Layout' import {Link} from '#/components/Link' @@ -346,12 +348,14 @@ export function Header({newChatControl}: {newChatControl: DialogControlProps}) { const requireEmailVerification = useRequireEmailVerification() const leftConvos = useLeftConvos() - const {data: inboxData, hasNextPage: hasMoreRequests} = useListConvosQuery({ - status: 'request', - }) + const {data: unreadInboxData, hasNextPage: hasMoreRequests} = + useListConvosQuery({ + status: 'request', + readState: 'unread', + }) const inboxAllConvos = - inboxData?.pages + unreadInboxData?.pages .flatMap(page => page.convos) .filter( convo => @@ -371,48 +375,38 @@ export function Header({newChatControl}: {newChatControl: DialogControlProps}) { ], }) - const requestsLink = ( - - ) - - const settingsLink = ( - - - - ) - return ( {gtMobile ? ( <> - + Chats - {requestsLink} - {settingsLink} + + + + @@ -424,8 +418,23 @@ export function Header({newChatControl}: {newChatControl: DialogControlProps}) { Chats - {requestsLink} - {settingsLink} + + + + + + )} diff --git a/src/screens/Messages/components/InboxRequests.tsx b/src/screens/Messages/components/InboxRequests.tsx index aeec64a924..fcb67601c1 100644 --- a/src/screens/Messages/components/InboxRequests.tsx +++ b/src/screens/Messages/components/InboxRequests.tsx @@ -3,15 +3,29 @@ import {useLingui} from '@lingui/react/macro' import {UNREAD_LIMIT} from '#/state/queries/messages/list-conversations' import {atoms as a} from '#/alf' -import {InlineLinkText} from '#/components/Link' +import {ButtonIcon, ButtonText} from '#/components/Button' +import {Inbox_Stroke2_Corner2_Rounded as InboxIcon} from '#/components/icons/Inbox' +import {Link} from '#/components/Link' -export function InboxRequests({count, more}: {count: number; more: boolean}) { +export function InboxRequests({ + count, + more, + variant, +}: { + count: number + more: boolean + variant?: 'ghost' | 'solid' +}) { const {t: l} = useLingui() - if (count < 1) return null + const unread = count > 0 - const label = - count >= UNREAD_LIMIT && more + const label = !unread + ? l({ + message: `Requests`, + comment: 'Incoming message requests', + }) + : count >= UNREAD_LIMIT && more ? l({ message: `${count}+ requests`, comment: 'Displayed when the number of requests is greater than 20', @@ -21,12 +35,43 @@ export function InboxRequests({count, more}: {count: number; more: boolean}) { other: '# requests', }) - return ( - - {label} - - ) + switch (variant) { + case 'ghost': { + return ( + + + {unread && ( + + {count >= UNREAD_LIMIT && more + ? l({ + message: `${count}+`, + comment: + 'Displayed when the number of requests is greater than 20', + }) + : count} + + )} + + ) + } + case 'solid': { + return ( + + + {label} + + ) + } + } }