forked from abner/for-legacy-web
feat: add ServerInfo, port ChannelInfo
This commit is contained in:
29
src/controllers/modals/components/ChannelInfo.tsx
Normal file
29
src/controllers/modals/components/ChannelInfo.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import { X } from "@styled-icons/boxicons-regular";
|
||||
|
||||
import { Column, H1, IconButton, Modal, Row } from "@revoltchat/ui";
|
||||
|
||||
import Markdown from "../../../components/markdown/Markdown";
|
||||
import { modalController } from "../ModalController";
|
||||
import { ModalProps } from "../types";
|
||||
|
||||
export default function ChannelInfo({
|
||||
channel,
|
||||
...props
|
||||
}: ModalProps<"channel_info">) {
|
||||
return (
|
||||
<Modal
|
||||
{...props}
|
||||
title={
|
||||
<Row centred>
|
||||
<Column grow>
|
||||
<H1>{`#${channel.name}`}</H1>
|
||||
</Column>
|
||||
<IconButton onClick={modalController.close}>
|
||||
<X size={36} />
|
||||
</IconButton>
|
||||
</Row>
|
||||
}>
|
||||
<Markdown content={channel.description!} />
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
48
src/controllers/modals/components/ServerInfo.tsx
Normal file
48
src/controllers/modals/components/ServerInfo.tsx
Normal file
@@ -0,0 +1,48 @@
|
||||
import { X } from "@styled-icons/boxicons-regular";
|
||||
|
||||
import { Text } from "preact-i18n";
|
||||
|
||||
import { Column, H1, IconButton, Modal, Row } from "@revoltchat/ui";
|
||||
|
||||
import Markdown from "../../../components/markdown/Markdown";
|
||||
import { report } from "../../safety";
|
||||
import { modalController } from "../ModalController";
|
||||
import { ModalProps } from "../types";
|
||||
|
||||
export default function ServerInfo({
|
||||
server,
|
||||
...props
|
||||
}: ModalProps<"server_info">) {
|
||||
return (
|
||||
<Modal
|
||||
{...props}
|
||||
title={
|
||||
<Row centred>
|
||||
<Column grow>
|
||||
<H1>{server.name}</H1>
|
||||
</Column>
|
||||
<IconButton onClick={modalController.close}>
|
||||
<X size={36} />
|
||||
</IconButton>
|
||||
</Row>
|
||||
}
|
||||
actions={[
|
||||
{
|
||||
onClick: () =>
|
||||
modalController.push({
|
||||
type: "server_identity",
|
||||
member: server.member!,
|
||||
}),
|
||||
children: "Edit Identity",
|
||||
palette: "primary",
|
||||
},
|
||||
{
|
||||
onClick: () => report(server),
|
||||
children: <Text id="app.special.modals.actions.report" />,
|
||||
palette: "error",
|
||||
},
|
||||
]}>
|
||||
<Markdown content={server.description!} />
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user