mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-10 01:03:36 -05:00
fix(settings): more work on server settings pages
This commit is contained in:
parent
9b4619cbd1
commit
245c7a46ed
5 changed files with 23 additions and 25 deletions
2
external/lang
vendored
2
external/lang
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 2f0326b892174985809ec1b82a0f3a658df0f792
|
Subproject commit cfe757a806f038ce68b50d907c43f9f1742756a6
|
|
@ -49,12 +49,7 @@ export default function ChannelSettings() {
|
||||||
<GenericSettings
|
<GenericSettings
|
||||||
pages={[
|
pages={[
|
||||||
{
|
{
|
||||||
category: (
|
category: <div>{getChannelName(channel, true)}</div>,
|
||||||
<Category
|
|
||||||
variant="uniform"
|
|
||||||
text={getChannelName(channel, true)}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
id: "overview",
|
id: "overview",
|
||||||
icon: <InfoCircle size={20} />,
|
icon: <InfoCircle size={20} />,
|
||||||
title: (
|
title: (
|
||||||
|
|
|
@ -72,7 +72,9 @@ export default observer(() => {
|
||||||
hideTitle: true,
|
hideTitle: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
category: "User Management",
|
category: (
|
||||||
|
<Text id="app.settings.server_pages.management.title" />
|
||||||
|
),
|
||||||
id: "members",
|
id: "members",
|
||||||
icon: <Group size={20} />,
|
icon: <Group size={20} />,
|
||||||
title: (
|
title: (
|
||||||
|
|
|
@ -10,8 +10,8 @@ import TextAreaAutoSize from "../../../lib/TextAreaAutoSize";
|
||||||
import { FileUploader } from "../../../context/revoltjs/FileUploads";
|
import { FileUploader } from "../../../context/revoltjs/FileUploads";
|
||||||
|
|
||||||
import Button from "../../../components/ui/Button";
|
import Button from "../../../components/ui/Button";
|
||||||
import InputBox from "../../../components/ui/InputBox";
|
|
||||||
import Checkbox from "../../../components/ui/Checkbox";
|
import Checkbox from "../../../components/ui/Checkbox";
|
||||||
|
import InputBox from "../../../components/ui/InputBox";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
channel: Channel;
|
channel: Channel;
|
||||||
|
@ -40,10 +40,7 @@ export default observer(({ channel }: Props) => {
|
||||||
() => setDescription(channel.description ?? ""),
|
() => setDescription(channel.description ?? ""),
|
||||||
[channel.description],
|
[channel.description],
|
||||||
);
|
);
|
||||||
useEffect(
|
useEffect(() => setNSFW(channel.nsfw ?? false), [channel.nsfw]);
|
||||||
() => setNSFW(channel.nsfw ?? false),
|
|
||||||
[channel.nsfw],
|
|
||||||
);
|
|
||||||
|
|
||||||
const [changed, setChanged] = useState(false);
|
const [changed, setChanged] = useState(false);
|
||||||
function save() {
|
function save() {
|
||||||
|
@ -51,8 +48,7 @@ export default observer(({ channel }: Props) => {
|
||||||
if (name !== channel.name) changes.name = name;
|
if (name !== channel.name) changes.name = name;
|
||||||
if (description !== channel.description)
|
if (description !== channel.description)
|
||||||
changes.description = description;
|
changes.description = description;
|
||||||
if (nsfw !== channel.nsfw)
|
if (nsfw !== channel.nsfw) changes.nsfw = nsfw;
|
||||||
changes.nsfw = nsfw;
|
|
||||||
|
|
||||||
channel.edit(changes);
|
channel.edit(changes);
|
||||||
setChanged(false);
|
setChanged(false);
|
||||||
|
@ -118,15 +114,16 @@ export default observer(({ channel }: Props) => {
|
||||||
if (!changed) setChanged(true);
|
if (!changed) setChanged(true);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{channel.channel_type === "VoiceChannel" ? '' : (
|
<hr />
|
||||||
|
{channel.channel_type === "VoiceChannel" ? (
|
||||||
|
""
|
||||||
|
) : (
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={nsfw ?? false}
|
checked={nsfw ?? false}
|
||||||
onChange={
|
onChange={(nsfwchange) => {
|
||||||
(nsfwchange) => {
|
|
||||||
setNSFW(nsfwchange);
|
setNSFW(nsfwchange);
|
||||||
if (!changed) setChanged(true);
|
if (!changed) setChanged(true);
|
||||||
}
|
}}
|
||||||
}
|
|
||||||
description="Set this channel to NSFW.">
|
description="Set this channel to NSFW.">
|
||||||
NSFW
|
NSFW
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
|
|
|
@ -93,7 +93,7 @@ export const Overview = observer(({ server }: Props) => {
|
||||||
if (!changed) setChanged(true);
|
if (!changed) setChanged(true);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<hr />
|
||||||
<h3>
|
<h3>
|
||||||
<Text id="app.main.servers.custom_banner" />
|
<Text id="app.main.servers.custom_banner" />
|
||||||
</h3>
|
</h3>
|
||||||
|
@ -107,7 +107,7 @@ export const Overview = observer(({ server }: Props) => {
|
||||||
previewURL={server.generateBannerURL({ width: 1000 }, true)}
|
previewURL={server.generateBannerURL({ width: 1000 }, true)}
|
||||||
remove={() => server.edit({ remove: "Banner" })}
|
remove={() => server.edit({ remove: "Banner" })}
|
||||||
/>
|
/>
|
||||||
|
<hr />
|
||||||
<h3>
|
<h3>
|
||||||
<Text id="app.settings.server_pages.overview.system_messages" />
|
<Text id="app.settings.server_pages.overview.system_messages" />
|
||||||
</h3>
|
</h3>
|
||||||
|
@ -152,7 +152,11 @@ export const Overview = observer(({ server }: Props) => {
|
||||||
<Text id="general.disabled" />
|
<Text id="general.disabled" />
|
||||||
</option>
|
</option>
|
||||||
{server.channels
|
{server.channels
|
||||||
.filter((x) => (typeof x !== "undefined" && x.channel_type === "TextChannel"))
|
.filter(
|
||||||
|
(x) =>
|
||||||
|
typeof x !== "undefined" &&
|
||||||
|
x.channel_type === "TextChannel",
|
||||||
|
)
|
||||||
.map((channel) => (
|
.map((channel) => (
|
||||||
<option key={channel!._id} value={channel!._id}>
|
<option key={channel!._id} value={channel!._id}>
|
||||||
{getChannelName(channel!, true)}
|
{getChannelName(channel!, true)}
|
||||||
|
|
Loading…
Reference in a new issue