mirror of
https://github.com/Equicord/Equicord.git
synced 2025-01-18 21:33:35 -05:00
feat: plugin information in plugins tab (#19)
This commit is contained in:
parent
7c8e14f3ec
commit
cff018122a
1 changed files with 19 additions and 1 deletions
|
@ -36,7 +36,7 @@ import { Plugin } from "@utils/types";
|
|||
import { findByPropsLazy } from "@webpack";
|
||||
import { Alerts, Button, Card, Forms, lodash, Parser, React, Select, Text, TextInput, Toasts, Tooltip, useMemo } from "@webpack/common";
|
||||
|
||||
import Plugins, { ExcludedPlugins } from "~plugins";
|
||||
import Plugins, { ExcludedPlugins, PluginMeta } from "~plugins";
|
||||
|
||||
// Avoid circular dependency
|
||||
const { startDependenciesRecursive, startPlugin, stopPlugin } = proxyLazy(() => require("../../plugins"));
|
||||
|
@ -327,10 +327,28 @@ export default function PluginSettings() {
|
|||
}
|
||||
}
|
||||
|
||||
// Code directly taken from supportHelper.tsx
|
||||
const isApiPlugin = (plugin: string) => plugin.endsWith("API") || Plugins[plugin].required;
|
||||
|
||||
const totalPlugins = Object.keys(Plugins).filter(p => !isApiPlugin(p));
|
||||
const enabledPlugins = Object.keys(Plugins).filter(p => Vencord.Plugins.isPluginEnabled(p) && !isApiPlugin(p));
|
||||
|
||||
const totalStockPlugins = totalPlugins.filter(p => !PluginMeta[p].userPlugin).length;
|
||||
const totalUserPlugins = totalPlugins.filter(p => PluginMeta[p].userPlugin).length;
|
||||
const enabledStockPlugins = enabledPlugins.filter(p => !PluginMeta[p].userPlugin).length;
|
||||
const enabledUserPlugins = enabledPlugins.filter(p => PluginMeta[p].userPlugin).length;
|
||||
|
||||
return (
|
||||
<SettingsTab title="Plugins">
|
||||
|
||||
<ReloadRequiredCard required={changes.hasChanges} />
|
||||
|
||||
<Card className={cl("info-card")} style={{ marginTop: "12px" }}>
|
||||
<Forms.FormTitle tag="h5">Plugins Information</Forms.FormTitle>
|
||||
<Forms.FormText>Total Plugins: {totalStockPlugins}, Total User Plugins: {totalUserPlugins}</Forms.FormText>
|
||||
<Forms.FormText>Enabled Plugins: {enabledStockPlugins}, Enabled User Plugins: {enabledUserPlugins}</Forms.FormText>
|
||||
</Card>
|
||||
|
||||
<Forms.FormTitle tag="h5" className={classes(Margins.top20, Margins.bottom8)}>
|
||||
Filters
|
||||
</Forms.FormTitle>
|
||||
|
|
Loading…
Reference in a new issue