From aff1b68d6b480ecf25d03ee11ee7ca2fb04d945c Mon Sep 17 00:00:00 2001 From: Nickyux <30734036+nmsturcke@users.noreply.github.com> Date: Fri, 23 Dec 2022 03:17:19 +0100 Subject: Add a "NEW" Badge for New Plugins (V2)! (#234) Co-authored-by: Ven Co-authored-by: Justice Almanzar Co-authored-by: ArjixWasTaken <53124886+ArjixWasTaken@users.noreply.github.com> --- src/components/PluginSettings/index.tsx | 43 +++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 8 deletions(-) (limited to 'src/components/PluginSettings/index.tsx') diff --git a/src/components/PluginSettings/index.tsx b/src/components/PluginSettings/index.tsx index 5ee9cc9..93bb489 100644 --- a/src/components/PluginSettings/index.tsx +++ b/src/components/PluginSettings/index.tsx @@ -16,26 +16,27 @@ * along with this program. If not, see . */ +import * as DataStore from "@api/DataStore"; import { showNotice } from "@api/Notices"; import { Settings, useSettings } from "@api/settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { ErrorCard } from "@components/ErrorCard"; import { Flex } from "@components/Flex"; import { handleComponentFailed } from "@components/handleComponentFailed"; +import { Badge } from "@components/PluginSettings/components"; +import PluginModal from "@components/PluginSettings/PluginModal"; +import * as styles from "@components/PluginSettings/styles"; import { ChangeList } from "@utils/ChangeList"; import Logger from "@utils/Logger"; -import { classes, LazyComponent } from "@utils/misc"; +import { classes, LazyComponent, useAwaiter } from "@utils/misc"; import { openModalLazy } from "@utils/modal"; import { Plugin } from "@utils/types"; import { findByCode, findByPropsLazy } from "@webpack"; import { Alerts, Button, Forms, Margins, Parser, React, Select, Switch, Text, TextInput, Toasts, Tooltip } from "@webpack/common"; +import { startDependenciesRecursive, startPlugin, stopPlugin } from "plugins"; import Plugins from "~plugins"; -import { startDependenciesRecursive, startPlugin, stopPlugin } from "../../plugins"; -import PluginModal from "./PluginModal"; -import * as styles from "./styles"; - const logger = new Logger("PluginSettings", "#a6d189"); const InputStyles = findByPropsLazy("inputDefault", "inputWrapper"); @@ -78,9 +79,10 @@ interface PluginCardProps extends React.HTMLProps { plugin: Plugin; disabled: boolean; onRestartNeeded(name: string): void; + isNew?: boolean; } -function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, onMouseLeave }: PluginCardProps) { +function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, onMouseLeave, isNew }: PluginCardProps) { const settings = useSettings(); const pluginSettings = settings.plugins[plugin.name]; @@ -162,8 +164,15 @@ function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, onMouseLe } hideBorder={true} > - - {plugin.name} + + + {plugin.name}{(isNew) && } +