mirror of https://github.com/msgbyte/tailchat
feat: 增加topic插件的收件箱通知项
parent
206b90d026
commit
6dcc18a7e0
@ -0,0 +1,50 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useNavigate } from 'react-router';
|
||||||
|
import { t } from 'tailchat-shared';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
link: string;
|
||||||
|
text: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 跳转到会话面板
|
||||||
|
*/
|
||||||
|
export const JumpToButton: React.FC<Props> = React.memo((props) => {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="absolute bottom-4 left-0 right-0 text-center">
|
||||||
|
<div
|
||||||
|
className="shadow-lg px-6 py-2 rounded-full inline-block bg-indigo-600 hover:bg-indigo-700 text-white cursor-pointer"
|
||||||
|
onClick={() => {
|
||||||
|
navigate(props.link);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{props.text}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
JumpToButton.displayName = 'JumpToButton';
|
||||||
|
|
||||||
|
export const JumpToGroupPanelButton: React.FC<{
|
||||||
|
groupId: string;
|
||||||
|
panelId: string;
|
||||||
|
}> = React.memo((props) => {
|
||||||
|
const link = `/main/group/${props.groupId}/${props.panelId}`;
|
||||||
|
|
||||||
|
return <JumpToButton link={link} text={t('跳转到面板')} />;
|
||||||
|
});
|
||||||
|
JumpToGroupPanelButton.displayName = 'JumpToGroupPanelButton';
|
||||||
|
|
||||||
|
export const JumpToConverseButton: React.FC<{
|
||||||
|
groupId?: string;
|
||||||
|
converseId: string;
|
||||||
|
}> = React.memo((props) => {
|
||||||
|
const link = props.groupId
|
||||||
|
? `/main/group/${props.groupId}/${props.converseId}`
|
||||||
|
: `/main/personal/converse/${props.converseId}`;
|
||||||
|
|
||||||
|
return <JumpToButton link={link} text={t('跳转到会话')} />;
|
||||||
|
});
|
||||||
|
JumpToConverseButton.displayName = 'JumpToConverseButton';
|
@ -0,0 +1,27 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { TopicCard } from '../components/TopicCard';
|
||||||
|
import { Problem, JumpToGroupPanelButton } from '@capital/component';
|
||||||
|
import { Translate } from '../translate';
|
||||||
|
|
||||||
|
export const TopicInboxItem: React.FC<{ inboxItem: any }> = React.memo(
|
||||||
|
(props) => {
|
||||||
|
const payload = props.inboxItem.payload;
|
||||||
|
if (!payload) {
|
||||||
|
return <Problem text={Translate.topicDataError} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ width: '100%' }}>
|
||||||
|
<div style={{ height: '100%', overflow: 'auto', paddingBottom: 50 }}>
|
||||||
|
<TopicCard topic={payload} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<JumpToGroupPanelButton
|
||||||
|
groupId={payload.groupId}
|
||||||
|
panelId={payload.panelId}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
TopicInboxItem.displayName = 'TopicInboxItem';
|
Loading…
Reference in New Issue