feat: redesign emoji uploader

This commit is contained in:
Paul Makles 2022-09-02 13:42:34 +01:00
parent 024fc6853b
commit dfbba41be4
3 changed files with 21 additions and 11 deletions

2
external/components vendored

@ -1 +1 @@
Subproject commit 5e6e4a09c45baf18dcc44925f0113bad1d732e9c Subproject commit fd7ad8b8712d24977c1c47dc5705a32487ace0ed

2
external/lang vendored

@ -1 +1 @@
Subproject commit 8ec1e5571e3d29a93500c0199f6823d16056b6f8 Subproject commit 429734c32b3584dd9c23124bd0682bba31834eb8

View file

@ -1,8 +1,9 @@
import { Server } from "revolt.js"; import { Server } from "revolt.js";
import { Text } from "preact-i18n";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Form } from "@revoltchat/ui"; import { Button, Column, Form, FormElement, Row } from "@revoltchat/ui";
import { FileUploader } from "../../../controllers/client/jsx/legacy/FileUploads"; import { FileUploader } from "../../../controllers/client/jsx/legacy/FileUploads";
@ -15,7 +16,9 @@ export function EmojiUploader({ server }: Props) {
return ( return (
<> <>
<h3>Upload Emoji</h3> <h3>
<Text id="app.settings.server_pages.emojis.upload" />
</h3>
<Form <Form
schema={{ schema={{
name: "text", name: "text",
@ -42,11 +45,6 @@ export function EmojiUploader({ server }: Props) {
), ),
}, },
}} }}
submitBtn={{
children: "Save",
palette: "secondary",
disabled: !fileId,
}}
onSubmit={async ({ name }) => { onSubmit={async ({ name }) => {
await server.client.api.put(`/custom/emoji/${fileId}`, { await server.client.api.put(`/custom/emoji/${fileId}`, {
name, name,
@ -54,8 +52,20 @@ export function EmojiUploader({ server }: Props) {
}); });
setFileId(""); setFileId("");
}} }}>
/> <Row>
<FormElement id="file" />
<Column>
<FormElement id="name" />
<Button
type="submit"
palette="secondary"
disabled={!fileId}>
<Text id="app.special.modals.actions.save" />
</Button>
</Column>
</Row>
</Form>
</> </>
); );
} }