diff --git a/web/components/client-table.tsx b/web/components/client-table.tsx index fa7060fd0..f042da439 100644 --- a/web/components/client-table.tsx +++ b/web/components/client-table.tsx @@ -30,8 +30,10 @@ export default function ClientTable({ data }: ClientTableProps) { dataIndex: 'messageCount', key: 'messageCount', className: 'number-col', + width: '12%', sorter: (a: any, b: any) => a.messageCount - b.messageCount, sortDirections: ['descend', 'ascend'] as SortOrder[], + render: (count: number) =>
{count}
, }, { title: 'Connected Time', diff --git a/web/components/compose-federated-post.tsx b/web/components/compose-federated-post.tsx new file mode 100644 index 000000000..901fbfae2 --- /dev/null +++ b/web/components/compose-federated-post.tsx @@ -0,0 +1,76 @@ +import React, { useState } from 'react'; + +import { Button, Space, Input, Modal } from 'antd'; +import { STATUS_ERROR, STATUS_SUCCESS } from '../utils/input-statuses'; +import { fetchData, FEDERATION_MESSAGE_SEND } from '../utils/apis'; + +const { TextArea } = Input; + +interface ComposeFederatedPostProps { + visible: boolean; + handleClose: () => void; +} + +export default function ComposeFederatedPost({ visible, handleClose }: ComposeFederatedPostProps) { + const [content, setContent] = useState(''); + const [postPending, setPostPending] = useState(false); + const [postSuccessState, setPostSuccessState] = useState(null); + + function handleEditorChange(e) { + setContent(e.target.value); + } + + async function sendButtonClicked() { + setPostPending(true); + + const data = { + value: content, + }; + try { + await fetchData(FEDERATION_MESSAGE_SEND, { + data, + method: 'POST', + auth: true, + }); + setPostSuccessState(STATUS_SUCCESS); + setTimeout(handleClose, 1000); + } catch (e) { + // eslint-disable-next-line no-console + console.error(e); + setPostSuccessState(STATUS_ERROR); + } + setPostPending(false); + } + + return ( + handleClose()}>Cancel, + , + ]} + > + +