From 34fce013d97874f71b61471fc5755ec80ff78025 Mon Sep 17 00:00:00 2001 From: Zerebos Date: Thu, 5 Dec 2024 16:57:27 -0500 Subject: [PATCH] Fix changelog and move group to category --- renderer/src/data/changelog.js | 5 +++++ renderer/src/modules/api/ui.js | 18 +++++++++--------- renderer/src/modules/core.js | 8 +------- renderer/src/ui/modals/changelog.jsx | 10 +++++++--- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/renderer/src/data/changelog.js b/renderer/src/data/changelog.js index ecada1aa..cba3b092 100644 --- a/renderer/src/data/changelog.js +++ b/renderer/src/data/changelog.js @@ -1,6 +1,11 @@ +import config from "./config"; + // fixed, improved, added, progress export default { + title: "BetterDiscord", + subtitle: `v${config.version}`, video: "https://www.youtube.com/embed/evyvq9eQTqA?si=opmzjGjUArT4VLrj&vq=hd720p&hd=1&rel=0&showinfo=0&mute=1&loop=1&autohide=1", + banner: "https://i.imgur.com/wuh5yMK.png", blurb: "A hotfix to get things going again. Plugins and Themes will take time to update.", changes: [ { diff --git a/renderer/src/modules/api/ui.js b/renderer/src/modules/api/ui.js index 9b24b190..60175075 100644 --- a/renderer/src/modules/api/ui.js +++ b/renderer/src/modules/api/ui.js @@ -163,16 +163,16 @@ const UI = { * Creates a settings panel (react element) based on json-like data. * * The `settings` array here is an array of the same settings types described in `buildSetting` above. - * However, this API allows one additional setting "type" called `group`. This has the same properties - * as the React Component found under the `Components` API. + * However, this API allows one additional setting "type" called `category`. This has the same properties + * as the Group React Component found under the `Components` API. * - * `onChange` will always be given 3 arguments: group id, setting id, and setting value. In the case - * that you have settings on the "root" of the panel, the group id is `null`. + * `onChange` will always be given 3 arguments: category id, setting id, and setting value. In the case + * that you have settings on the "root" of the panel, the category id is `null`. * - * `onDrawerToggle` is given 2 arguments: group id, and the current shown state. You can use this to + * `onDrawerToggle` is given 2 arguments: category id, and the current shown state. You can use this to * save drawer states. * - * `getDrawerState` is given 2 arguments: group id, and the default shown state. You can use this to + * `getDrawerState` is given 2 arguments: category id, and the default shown state. You can use this to * recall a saved drawer state. * * @param {object} props @@ -186,14 +186,14 @@ const UI = { if (!settings?.length) throw new Error("No settings provided!"); if (typeof(onChange) !== "function") throw new Error("No change listener provided!"); return React.createElement(React.Fragment, null, settings.map(setting => { - if (setting.type === "group") { + if (setting.type === "category") { const shownByDefault = setting.hasOwnProperty("shown") ? setting.shown : true; - const groupProps = Object.assign({}, setting, { + const categoryProps = Object.assign({}, setting, { onChange, onDrawerToggle: state => onDrawerToggle?.(setting.id, state), shown: getDrawerState?.(setting.id, shownByDefault) ?? shownByDefault }); - return React.createElement(Group, groupProps); + return React.createElement(Group, categoryProps); } return buildSetting(Object.assign({}, setting, {onChange: value => onChange(null, setting.id, value)})); })); diff --git a/renderer/src/modules/core.js b/renderer/src/modules/core.js index 99cd951d..59a8400d 100644 --- a/renderer/src/modules/core.js +++ b/renderer/src/modules/core.js @@ -86,13 +86,7 @@ export default new class Core { const previousVersion = DataStore.getBDData("version"); if (Config.version !== previousVersion) { - Modals.showChangelogModal(Object.assign({ - banner: "https://i.imgur.com/wuh5yMK.png", - blurb: "", - changes: [], - title: "BetterDiscord", - subtitle: `v${Config.version}` - }, Changelog)); + Modals.showChangelogModal(Changelog); DataStore.setBDData("version", Config.version); } } diff --git a/renderer/src/ui/modals/changelog.jsx b/renderer/src/ui/modals/changelog.jsx index fa403a0f..5e532426 100644 --- a/renderer/src/ui/modals/changelog.jsx +++ b/renderer/src/ui/modals/changelog.jsx @@ -78,9 +78,13 @@ export default function ChangelogModal({transitionState, footer, title, subtitle , [footer]); const changelogItems = useMemo(() => { - const items = [video ?