import { Text } from "preact-i18n"; import styles from './Panes.module.scss'; import Button from "../../../components/ui/Button"; import { Servers } from "revolt.js/dist/api/objects"; import TextArea from "../../../components/ui/TextArea"; import InputBox from "../../../components/ui/InputBox"; import { useContext, useEffect, useState } from "preact/hooks"; import { AppContext } from "../../../context/revoltjs/RevoltClient"; import { FileUploader } from "../../../context/revoltjs/FileUploads"; interface Props { server: Servers.Server; } export function Overview({ server }: Props) { const client = useContext(AppContext); const [name, setName] = useState(server.name); const [description, setDescription] = useState(server.description ?? ''); useEffect(() => setName(server.name), [ server.name ]); useEffect(() => setDescription(server.description ?? ''), [ server.description ]); const [ changed, setChanged ] = useState(false); function save() { let changes: any = {}; if (name !== server.name) changes.name = name; if (description !== server.description) changes.description = description; client.servers.edit(server._id, changes); setChanged(false); } return (