Merge pull request #161 from moonlight-mod/cyn/to-the-top
moonbase: Move to the top by default
@@ -13,13 +13,21 @@ "sections": {"advice": "reload","displayName": "Split into sections","description": "Show the Moonbase tabs as separate sections",- "type": "boolean"+ "type": "boolean",+ "default": false+ },+ "oldLocation": {+ "advice": "reload",+ "displayName": "Put Moonbase back at the bottom",+ "type": "boolean",+ "default": false},"saveFilter": {"advice": "none","displayName": "Persist filter","description": "Save extension filter in config",- "type": "boolean"+ "type": "boolean",+ "default": false},"updateChecking": {"advice": "none",
@@ -32,8 +32,11 @@ );}};+const oldLocation = MoonbaseSettingsStore.getExtensionConfigRaw<boolean>("moonbase", "oldLocation", false);+const position = oldLocation ? -2 : -9999;+function addSection(id: string, name: string, element: React.FunctionComponent) {- settings.addSection(`moonbase-${id}`, name, element, null, -2, notice);+ settings.addSection(`moonbase-${id}`, name, element, null, position, notice);}// FIXME: move to component types@@ -48,12 +51,17 @@ <Text variant="heading-lg/semibold" tag="h2" color={last ? "header-primary" : "header-secondary"}>{crumb.label}</Text>);+}++if (!oldLocation) {+ settings.addDivider(position);}if (MoonbaseSettingsStore.getExtensionConfigRaw<boolean>("moonbase", "sections", false)) {- settings.addHeader("Moonbase", -2);+ if (oldLocation) settings.addHeader("Moonbase", position);- for (const page of pages) {+ const _pages = oldLocation ? pages : pages.reverse();+ for (const page of _pages) {addSection(page.id, page.name, () => {const breadcrumbs = [{ id: "moonbase", label: "Moonbase" },@@ -78,8 +86,10 @@ </>);});}++ if (!oldLocation) settings.addHeader("Moonbase", position);} else {- settings.addSection("moonbase", "Moonbase", Moonbase, null, -2, notice);+ settings.addSection("moonbase", "Moonbase", Moonbase, null, position, notice);settings.addSectionMenuItems("moonbase",