Skip to content

Commit

Permalink
Rewrite settings patch and add to api
Browse files Browse the repository at this point in the history
  • Loading branch information
pylixonly committed Mar 7, 2024
1 parent 9124636 commit 218d09a
Show file tree
Hide file tree
Showing 14 changed files with 255 additions and 312 deletions.
1 change: 1 addition & 0 deletions packages/bunny-types/def.tt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
color
toasts
styles
settings
}
utils {
constants
Expand Down
Binary file added src/assets/icons/pyon64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
155 changes: 0 additions & 155 deletions src/core/ui/settings/data.tsx

This file was deleted.

53 changes: 44 additions & 9 deletions src/core/ui/settings/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,47 @@
// TODO: make settings patches part of the api
import patchPanels from "@core/ui/settings/patches/panels";
import patchYou from "@core/ui/settings/patches/you";
import { Strings } from "@core/i18n";
import { getAssetIDByName } from "@lib/api/assets";
import { isThemeSupported } from "@lib/api/native/loader";
import { useProxy } from "@lib/api/storage";
import { settings } from "@lib/settings";
import { registerSection } from "@lib/ui/settings";
import { version } from "bunny-build";

export default function initSettings() {
const patches = [
patchPanels(),
patchYou(),
];
// @ts-ignore
import PyoncordIcon from "../../../assets/icons/pyon64.png";

return () => patches.forEach(p => p?.());
export default function initSettings() {
registerSection({
name: "Bunny",
items: [
{
key: "BUNNY",
title: () => Strings.BUNNY,
icon: { uri: PyoncordIcon },
render: () => import("@core/ui/settings/pages/General"),
rawTabsConfig: {
useTrailing: () => `(${version})`
}
},
{
key: "BUNNY_PLUGINS",
title: () => Strings.PLUGINS,
icon: getAssetIDByName("ActivitiesIcon"),
render: () => import("@core/ui/settings/pages/Plugins")
},
{
key: "BUNNY_THEMES",
title: () => Strings.THEMES,
icon: getAssetIDByName("PaintPaletteIcon"),
render: () => import("@core/ui/settings/pages/Themes"),
usePredicate: () => isThemeSupported()
},
{
key: "BUNNY_DEVELOPER",
title: () => Strings.DEVELOPER,
icon: getAssetIDByName("WrenchIcon"),
render: () => import("@core/ui/settings/pages/Developer"),
usePredicate: () => useProxy(settings).developerSettings ?? false
}
]
});
}
2 changes: 1 addition & 1 deletion src/core/ui/settings/pages/General.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Strings } from "@core/i18n";
import Version from "@core/ui/components/Version";
import { getAssetIDByName } from "@lib/api/assets";
import { useProxy } from "@lib/api/storage";
import { getDebugInfo, _toggleSafeMode } from "@lib/debug";
import { _toggleSafeMode, getDebugInfo } from "@lib/debug";
import { settings } from "@lib/settings";
import { Stack, TableRow, TableRowGroup, TableSwitchRow } from "@lib/ui/components/discord/Redesign";
import { DISCORD_SERVER, GITHUB } from "@lib/utils/constants";
Expand Down
39 changes: 0 additions & 39 deletions src/core/ui/settings/patches/panels.tsx

This file was deleted.

106 changes: 0 additions & 106 deletions src/core/ui/settings/patches/you.tsx

This file was deleted.

Loading

0 comments on commit 218d09a

Please sign in to comment.