mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-21 22:50:59 -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
|
||||
pages={[
|
||||
{
|
||||
category: (
|
||||
<Category
|
||||
variant="uniform"
|
||||
text={getChannelName(channel, true)}
|
||||
/>
|
||||
),
|
||||
category: <div>{getChannelName(channel, true)}</div>,
|
||||
id: "overview",
|
||||
icon: <InfoCircle size={20} />,
|
||||
title: (
|
||||
|
|
|
@ -72,7 +72,9 @@ export default observer(() => {
|
|||
hideTitle: true,
|
||||
},
|
||||
{
|
||||
category: "User Management",
|
||||
category: (
|
||||
<Text id="app.settings.server_pages.management.title" />
|
||||
),
|
||||
id: "members",
|
||||
icon: <Group size={20} />,
|
||||
title: (
|
||||
|
|
|
@ -10,8 +10,8 @@ import TextAreaAutoSize from "../../../lib/TextAreaAutoSize";
|
|||
import { FileUploader } from "../../../context/revoltjs/FileUploads";
|
||||
|
||||
import Button from "../../../components/ui/Button";
|
||||
import InputBox from "../../../components/ui/InputBox";
|
||||
import Checkbox from "../../../components/ui/Checkbox";
|
||||
import InputBox from "../../../components/ui/InputBox";
|
||||
|
||||
interface Props {
|
||||
channel: Channel;
|
||||
|
@ -40,10 +40,7 @@ export default observer(({ channel }: Props) => {
|
|||
() => setDescription(channel.description ?? ""),
|
||||
[channel.description],
|
||||
);
|
||||
useEffect(
|
||||
() => setNSFW(channel.nsfw ?? false),
|
||||
[channel.nsfw],
|
||||
);
|
||||
useEffect(() => setNSFW(channel.nsfw ?? false), [channel.nsfw]);
|
||||
|
||||
const [changed, setChanged] = useState(false);
|
||||
function save() {
|
||||
|
@ -51,8 +48,7 @@ export default observer(({ channel }: Props) => {
|
|||
if (name !== channel.name) changes.name = name;
|
||||
if (description !== channel.description)
|
||||
changes.description = description;
|
||||
if (nsfw !== channel.nsfw)
|
||||
changes.nsfw = nsfw;
|
||||
if (nsfw !== channel.nsfw) changes.nsfw = nsfw;
|
||||
|
||||
channel.edit(changes);
|
||||
setChanged(false);
|
||||
|
@ -118,15 +114,16 @@ export default observer(({ channel }: Props) => {
|
|||
if (!changed) setChanged(true);
|
||||
}}
|
||||
/>
|
||||
{channel.channel_type === "VoiceChannel" ? '' : (
|
||||
<hr />
|
||||
{channel.channel_type === "VoiceChannel" ? (
|
||||
""
|
||||
) : (
|
||||
<Checkbox
|
||||
checked={nsfw ?? false}
|
||||
onChange={
|
||||
(nsfwchange) => {
|
||||
setNSFW(nsfwchange);
|
||||
if (!changed) setChanged(true);
|
||||
}
|
||||
}
|
||||
onChange={(nsfwchange) => {
|
||||
setNSFW(nsfwchange);
|
||||
if (!changed) setChanged(true);
|
||||
}}
|
||||
description="Set this channel to NSFW.">
|
||||
NSFW
|
||||
</Checkbox>
|
||||
|
|
|
@ -93,7 +93,7 @@ export const Overview = observer(({ server }: Props) => {
|
|||
if (!changed) setChanged(true);
|
||||
}}
|
||||
/>
|
||||
|
||||
<hr />
|
||||
<h3>
|
||||
<Text id="app.main.servers.custom_banner" />
|
||||
</h3>
|
||||
|
@ -107,7 +107,7 @@ export const Overview = observer(({ server }: Props) => {
|
|||
previewURL={server.generateBannerURL({ width: 1000 }, true)}
|
||||
remove={() => server.edit({ remove: "Banner" })}
|
||||
/>
|
||||
|
||||
<hr />
|
||||
<h3>
|
||||
<Text id="app.settings.server_pages.overview.system_messages" />
|
||||
</h3>
|
||||
|
@ -152,7 +152,11 @@ export const Overview = observer(({ server }: Props) => {
|
|||
<Text id="general.disabled" />
|
||||
</option>
|
||||
{server.channels
|
||||
.filter((x) => (typeof x !== "undefined" && x.channel_type === "TextChannel"))
|
||||
.filter(
|
||||
(x) =>
|
||||
typeof x !== "undefined" &&
|
||||
x.channel_type === "TextChannel",
|
||||
)
|
||||
.map((channel) => (
|
||||
<option key={channel!._id} value={channel!._id}>
|
||||
{getChannelName(channel!, true)}
|
||||
|
|
Loading…
Reference in a new issue