fix Settings crash

This commit is contained in:
Vendicated 2026-03-10 23:27:46 +01:00 committed by End
parent 46d41059b8
commit 189c00f014
No known key found for this signature in database

View file

@ -32,9 +32,10 @@ let LayoutTypes = {
SECTION: 1,
SIDEBAR_ITEM: 2,
PANEL: 3,
PANE: 4
CATEGORY: 5,
CUSTOM: 19,
};
waitFor(["SECTION", "SIDEBAR_ITEM", "PANEL"], v => LayoutTypes = v);
waitFor(["SECTION", "SIDEBAR_ITEM", "PANEL", "CUSTOM"], v => LayoutTypes = v);
const FallbackSectionTypes = {
HEADER: "HEADER",
@ -157,36 +158,21 @@ export default definePlugin({
key: key + "_panel",
type: LayoutTypes.PANEL,
useTitle: () => panelTitle,
buildLayout: () => [{
type: LayoutTypes.CATEGORY,
key: key + "_category",
buildLayout: () => [{
type: LayoutTypes.CUSTOM,
key: key + "_custom",
Component: Component,
useSearchTerms: () => [title]
}]
}]
};
const render = {
// FIXME
StronglyDiscouragedCustomComponent: () => <Component />,
render: () => <Component />,
};
// FIXME
if (LayoutTypes.PANE) {
panel.buildLayout = () => [
{
key: key + "_pane",
type: LayoutTypes.PANE,
useTitle: () => panelTitle,
buildLayout: () => [],
...render
}
];
} else {
Object.assign(panel, render);
panel.buildLayout = () => [];
}
return ({
key,
type: LayoutTypes.SIDEBAR_ITEM,
// FIXME
legacySearchKey: title.toUpperCase(),
getLegacySearchKey: () => title.toUpperCase(),
useTitle: () => title,
icon: () => <Icon width={20} height={20} />,
buildLayout: () => [panel]