/* * Vencord, a Discord client mod * Copyright (c) 2025 Vendicated and contributors * SPDX-License-Identifier: GPL-3.0-or-later */ import "./styles.css"; import SettingsPlugin, { settingsSectionMap } from "@plugins/_core/settings"; import { Devs } from "@utils/constants"; import definePlugin, { StartAt } from "@utils/types"; import { SettingsRouter } from "@webpack/common"; import ComponentsTab from "./components/ComponentsTab"; function ComponentsIcon(props: React.SVGProps) { return ( ); } export default definePlugin({ name: "Components", description: "Adds a new tab to settings to browse Discord components.", authors: [Devs.prism], dependencies: ["Settings"], startAt: StartAt.WebpackReady, toolboxActions: { "Open Components Tab"() { SettingsRouter.openUserSettings("equicord_components_panel"); }, }, start() { const { customEntries, customSections } = SettingsPlugin; customEntries.push({ key: "equicord_components", title: "Components", Component: ComponentsTab, Icon: ComponentsIcon }); customSections.push(() => ({ section: "EquicordDiscordComponents", label: "Components", element: ComponentsTab, className: "vc-discord-components", id: "EquicordDiscordComponents" })); settingsSectionMap.push(["EquicordDiscordComponents", "equicord_components"]); }, stop() { const { customEntries, customSections } = SettingsPlugin; const entryIdx = customEntries.findIndex(e => e.key === "equicord_components"); if (entryIdx !== -1) customEntries.splice(entryIdx, 1); const sectionIdx = customSections.findIndex(s => s({} as any).id === "EquicordDiscordComponents"); if (sectionIdx !== -1) customSections.splice(sectionIdx, 1); const map = settingsSectionMap.findIndex(entry => entry[1] === "equicord_components"); if (map !== -1) settingsSectionMap.splice(map, 1); }, });