Add after option to setting plugin (#7056)

This commit is contained in:
Tom Moor authored and GitHub committed 2024-06-16 09:43:32 -07:00
1 parent 05c1bee412
commit 1290aecbc9
2 files changed
+7 -3

No files matched your search

+5 -3
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),
+2
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. */