import React, { useMemo } from "react"; import { Button } from "react-bootstrap"; import { FormattedMessage, useIntl } from "react-intl"; import * as GQL from "src/core/generated-graphql"; import { mutateReloadPlugins, usePlugins } from "src/core/StashService"; import { useToast } from "src/hooks"; import { TextUtils } from "src/utils"; import { CollapseButton, Icon, LoadingIndicator } from "src/components/Shared"; import { SettingSection } from "./SettingSection"; import { Setting, SettingGroup } from "./Inputs"; import { faLink, faSyncAlt } from "@fortawesome/free-solid-svg-icons"; export const SettingsPluginsPanel: React.FC = () => { const Toast = useToast(); const intl = useIntl(); const { data, loading } = usePlugins(); async function onReloadPlugins() { await mutateReloadPlugins().catch((e) => Toast.error(e)); } const pluginElements = useMemo(() => { function renderLink(url?: string) { if (url) { return ( ); } } function renderPlugins() { const elements = (data?.plugins ?? []).map((plugin) => ( {renderPluginHooks(plugin.hooks ?? undefined)} )); return
{elements}
; } function renderPluginHooks( hooks?: Pick[] ) { if (!hooks || hooks.length === 0) { return; } return (
{hooks.map((h) => (
{h.name}
    {h.hooks?.map((hh) => (
  • {hh}
  • ))}
{h.description}
))}
); } return renderPlugins(); }, [data?.plugins, intl]); if (loading) return ; return ( <> {pluginElements} ); };