feat: notify user of aup when creating server (#495)

This commit is contained in:
Ed L 2022-04-05 23:38:59 +01:00 committed by GitHub
parent 5d4ef8b178
commit 3f9e6fc2e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View file

@ -104,6 +104,11 @@ const ModalContent = styled.div<
} }
} }
.description {
color: var(--tertiary-foreground);
font-size: 90%;
}
${(props) => ${(props) =>
!props.noBackground && !props.noBackground &&
css` css`
@ -174,6 +179,7 @@ export default function Modal(props: Props) {
border={props.border} border={props.border}
padding={props.padding ?? !props.dontModal}> padding={props.padding ?? !props.dontModal}>
{props.title && <h3>{props.title}</h3>} {props.title && <h3>{props.title}</h3>}
{props.description && <h5>{props.description}</h5>} {props.description && <h5>{props.description}</h5>}
{props.children} {props.children}
</ModalContent> </ModalContent>

View file

@ -17,6 +17,7 @@ interface Props {
onClose: () => void; onClose: () => void;
question: Children; question: Children;
field?: Children; field?: Children;
description?: Children;
defaultValue?: string; defaultValue?: string;
callback: (value: string) => Promise<void>; callback: (value: string) => Promise<void>;
} }
@ -25,6 +26,7 @@ export function InputModal({
onClose, onClose,
question, question,
field, field,
description,
defaultValue, defaultValue,
callback, callback,
}: Props) { }: Props) {
@ -36,6 +38,7 @@ export function InputModal({
<Modal <Modal
visible={true} visible={true}
title={question} title={question}
description={description}
disabled={processing} disabled={processing}
actions={[ actions={[
{ {
@ -113,6 +116,17 @@ export function SpecialInputModal(props: SpecialProps) {
onClose={onClose} onClose={onClose}
question={<Text id="app.main.servers.create" />} question={<Text id="app.main.servers.create" />}
field={<Text id="app.main.servers.name" />} field={<Text id="app.main.servers.name" />}
description={
<div>
By creating this server, you agree to the{" "}
<a
href="https://revolt.chat/aup"
target="_blank"
rel="noreferrer">
Acceptable Use Policy.
</a>
</div>
}
callback={async (name) => { callback={async (name) => {
const server = await client.servers.createServer({ const server = await client.servers.createServer({
name, name,