- X Members
+ { members?.length ?? 0 } Members
{ members && members.length > 0 && users?.map(x => x &&
diff --git a/src/pages/settings/server/Overview.tsx b/src/pages/settings/server/Overview.tsx
index fe530276..19c8fed3 100644
--- a/src/pages/settings/server/Overview.tsx
+++ b/src/pages/settings/server/Overview.tsx
@@ -1,10 +1,13 @@
import { Text } from "preact-i18n";
+import isEqual from "lodash.isequal";
import styles from './Panes.module.scss';
import Button from "../../../components/ui/Button";
-import { Servers } from "revolt.js/dist/api/objects";
import InputBox from "../../../components/ui/InputBox";
+import ComboBox from "../../../components/ui/ComboBox";
+import { Servers, Server } from "revolt.js/dist/api/objects";
import TextAreaAutoSize from "../../../lib/TextAreaAutoSize";
import { useContext, useEffect, useState } from "preact/hooks";
+import { getChannelName } from "../../../context/revoltjs/util";
import { AppContext } from "../../../context/revoltjs/RevoltClient";
import { FileUploader } from "../../../context/revoltjs/FileUploads";
@@ -17,16 +20,18 @@ export function Overview({ server }: Props) {
const [name, setName] = useState(server.name);
const [description, setDescription] = useState(server.description ?? '');
+ const [systemMessages, setSystemMessages] = useState(server.system_messages);
useEffect(() => setName(server.name), [ server.name ]);
useEffect(() => setDescription(server.description ?? ''), [ server.description ]);
+ useEffect(() => setSystemMessages(server.system_messages), [ server.system_messages ]);
const [ changed, setChanged ] = useState(false);
function save() {
- let changes: any = {};
+ let changes: Partial
> = {};
if (name !== server.name) changes.name = name;
- if (description !== server.description)
- changes.description = description;
+ if (description !== server.description) changes.description = description;
+ if (!isEqual(systemMessages, server.system_messages)) changes.system_messages = systemMessages;
client.servers.edit(server._id, changes);
setChanged(false);
@@ -76,6 +81,43 @@ export function Overview({ server }: Props) {
if (!changed) setChanged(true)
}}
/>
+
+
+
+
+ {[
+ [ 'User Joined', 'user_joined' ],
+ [ 'User Left', 'user_left' ],
+ [ 'User Kicked', 'user_kicked' ],
+ [ 'User Banned', 'user_banned' ]
+ ].map(([ i18n, key ]) =>
+ // ! FIXME: temporary code just so we can expose the options
+
+ {i18n}
+ {
+ if (!changed) setChanged(true)
+ const v = e.currentTarget.value;
+ if (v === 'disabled') {
+ const { [key as keyof typeof systemMessages]: _, ...other } = systemMessages;
+ setSystemMessages(other);
+ } else {
+ setSystemMessages({
+ ...systemMessages,
+ [key]: v
+ });
+ }
+ }}>
+
+ { server.channels.map(id => {
+ const channel = client.channels.get(id);
+ if (!channel) return null;
+ return ;
+ }) }
+
+
+ )}
+