feat: 收件箱增加SectionHeader

pull/64/head
moonrailgun 2 years ago
parent c760d44e87
commit d8ac078461

@ -9,6 +9,9 @@ import { getMessageRender } from '@/plugin/common';
import { useLocation } from 'react-router'; import { useLocation } from 'react-router';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { PillTabPane, PillTabs } from '@/components/PillTabs'; import { PillTabPane, PillTabs } from '@/components/PillTabs';
import { SectionHeader } from '@/components/SectionHeader';
const buildLink = (itemId: string) => `/main/inbox/${itemId}`;
/** /**
* *
@ -18,9 +21,7 @@ export const InboxSidebar: React.FC = React.memo(() => {
const list = useMemo(() => _orderBy(inbox, 'createdAt', 'desc'), [inbox]); const list = useMemo(() => _orderBy(inbox, 'createdAt', 'desc'), [inbox]);
const renderInbox = (item: InboxItem) => { const renderInbox = (item: InboxItem) => {
const { type } = item; if (item.type === 'message') {
if (type === 'message') {
const message: Partial<model.inbox.InboxItem['message']> = const message: Partial<model.inbox.InboxItem['message']> =
item.message ?? {}; item.message ?? {};
let title: React.ReactNode = ''; let title: React.ReactNode = '';
@ -37,7 +38,7 @@ export const InboxSidebar: React.FC = React.memo(() => {
desc={getMessageRender(message.messageSnippet ?? '')} desc={getMessageRender(message.messageSnippet ?? '')}
source={'Tailchat'} source={'Tailchat'}
readed={item.readed} readed={item.readed}
to={`/main/inbox/${item._id}`} to={buildLink(item._id)}
/> />
); );
} }
@ -50,9 +51,11 @@ export const InboxSidebar: React.FC = React.memo(() => {
return ( return (
<CommonSidebarWrapper data-tc-role="sidebar-inbox"> <CommonSidebarWrapper data-tc-role="sidebar-inbox">
<SectionHeader>{t('收件箱')}</SectionHeader>
<div> <div>
<PillTabs> <PillTabs>
<PillTabPane key="1" tab={`${t('全部')} (${fullList.length})`}> <PillTabPane key="1" tab={`${t('全部')}`}>
{fullList.map((item) => renderInbox(item))} {fullList.map((item) => renderInbox(item))}
</PillTabPane> </PillTabPane>
<PillTabPane key="2" tab={`${t('未读')} (${unreadList.length})`}> <PillTabPane key="2" tab={`${t('未读')} (${unreadList.length})`}>

Loading…
Cancel
Save