/* * 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 { classNameFactory } from "@api/Styles"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { findByProps } from "@webpack"; import { ComponentDispatch, FocusLock, i18n, Menu, useEffect, useRef } from "@webpack/common"; import type { HTMLAttributes, ReactElement } from "react"; type SettingsEntry = { section: string, label: string; }; const cl = classNameFactory(""); const Classes = findByProps("animating", "baseLayer", "bg", "layer", "layers"); const settings = definePluginSettings({ disableFade: { description: "Disable the crossfade animation", type: OptionType.BOOLEAN, default: true, restartNeeded: true }, organizeMenu: { description: "Organizes the settings cog context menu into categories", type: OptionType.BOOLEAN, default: true }, eagerLoad: { description: "Removes the loading delay when opening the menu for the first time", type: OptionType.BOOLEAN, default: true, restartNeeded: true } }); interface LayerProps extends HTMLAttributes { mode: "SHOWN" | "HIDDEN"; baseLayer?: boolean; } function Layer({ mode, baseLayer = false, ...props }: LayerProps) { const hidden = mode === "HIDDEN"; const containerRef = useRef(null); useEffect(() => () => { ComponentDispatch.dispatch("LAYER_POP_START"); ComponentDispatch.dispatch("LAYER_POP_COMPLETE"); }, []); const node = (