mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-24 13:57:02 -04:00
* Add HideServers * HideServers: Add a count indicator and a modal to manage hidden servers * Dont include servers youve left in the indicator count * fix(hideServers) for webpack change * fix(hideServers): update regex * fix(hideServers): rewrite to use stores * move hideServers to equicordplugins * add serverhider to readme * put myself in equicorddevs * formatting nit
51 lines
1.6 KiB
TypeScript
51 lines
1.6 KiB
TypeScript
/*
|
|
* Vencord, a Discord client mod
|
|
* Copyright (c) 2024 Vendicated and contributors
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*/
|
|
|
|
import { definePluginSettings } from "@api/Settings";
|
|
import { OptionType } from "@utils/types";
|
|
import { Button, useStateFromStores } from "@webpack/common";
|
|
|
|
import { addIndicator, removeIndicator } from ".";
|
|
import { HiddenServersMenu } from "./components/HiddenServersMenu";
|
|
import { HiddenServersStore } from "./HiddenServersStore";
|
|
|
|
export default definePluginSettings({
|
|
showIndicator: {
|
|
type: OptionType.BOOLEAN,
|
|
description: "Show menu to unhide servers at the bottom of the list",
|
|
default: true,
|
|
onChange: val => {
|
|
if (val) {
|
|
addIndicator();
|
|
} else {
|
|
removeIndicator();
|
|
}
|
|
}
|
|
},
|
|
guildsList: {
|
|
type: OptionType.COMPONENT,
|
|
description: "Remove hidden servers",
|
|
component: () => {
|
|
const detail = useStateFromStores([HiddenServersStore], () => HiddenServersStore.hiddenGuildsDetail());
|
|
return <HiddenServersMenu servers={detail} />;
|
|
}
|
|
},
|
|
resetHidden: {
|
|
type: OptionType.COMPONENT,
|
|
description: "Remove all hidden guilds from the list",
|
|
component: () => (
|
|
<div>
|
|
<Button
|
|
size={Button.Sizes.SMALL}
|
|
color={Button.Colors.RED}
|
|
onClick={() => HiddenServersStore.clearHidden()}
|
|
>
|
|
Reset Hidden Servers
|
|
</Button>
|
|
</div>
|
|
),
|
|
},
|
|
});
|