Add after option to setting plugin (#7056)

This commit is contained in:
Tom Moor
2024-06-16 12:43:32 -04:00
committed by GitHub
parent 05c1bee412
commit 1290aecbc9
2 changed files with 7 additions and 3 deletions

View File

@@ -188,9 +188,11 @@ const useSettingsConfig = () => {
// Plugins
PluginManager.getHooks(Hook.Settings).forEach((plugin) => {
const insertIndex = items.findIndex(
(i) => i.group === t(plugin.value.group ?? "Integrations")
);
const insertIndex = plugin.value.after
? items.findIndex((i) => i.name === t(plugin.value.after!)) + 1
: items.findIndex(
(i) => i.group === t(plugin.value.group ?? "Integrations")
);
items.splice(insertIndex, 0, {
name: t(plugin.name),
path: integrationSettingsPath(plugin.id),

View File

@@ -20,6 +20,8 @@ type PluginValueMap = {
[Hook.Settings]: {
/** The group in settings sidebar this plugin belongs to. */
group: string;
/** An optional settings item to display this after. */
after?: string;
/** The displayed icon of the plugin. */
icon: React.ElementType;
/** The settings screen somponent, should be lazy loaded. */