From d79c24df596150c2d4ddc32d15b661c3de1aa8ce Mon Sep 17 00:00:00 2001 From: domi-btnr Date: Sun, 3 Nov 2024 14:50:16 +0100 Subject: [PATCH] Fix PI for latest Canary Changes Co-Authored-By: Kaan <90235641+zrodevkaan@users.noreply.github.com> --- .gitignore | 1 + PlatformIndicators/changelog.scss | 55 +++++++++++++++++++ PlatformIndicators/components/indicators.scss | 3 +- PlatformIndicators/index.jsx | 45 ++++++++++++++- PlatformIndicators/modules/shared.js | 2 +- PlatformIndicators/modules/utils.js | 2 +- PlatformIndicators/package.json | 15 ++++- 7 files changed, 116 insertions(+), 7 deletions(-) create mode 100644 PlatformIndicators/changelog.scss diff --git a/.gitignore b/.gitignore index ef655d4..d7db535 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Misc .idea .vscode +.DS_Store node_modules ./**/node_modules diff --git a/PlatformIndicators/changelog.scss b/PlatformIndicators/changelog.scss new file mode 100644 index 0000000..c773504 --- /dev/null +++ b/PlatformIndicators/changelog.scss @@ -0,0 +1,55 @@ +.Changelog-Title-Wrapper { + font-size: 20px; + font-weight: 600; + font-family: var(--font-display); + color: var(--header-primary); + line-height: 1.2; + + div { + font-size: 12px; + font-weight: 400; + font-family: var(--font-primary); + color: var(--primary-300); + line-height: 1.3333333333333333; + } +} + +.Changelog-Banner { + width: 405px; + border-radius: 8px; + margin-bottom: 20px; +} + +.Changelog-Item { + color: #c4c9ce; + + .Changelog-Header { + display: flex; + text-transform: uppercase; + font-weight: 700; + align-items: center; + margin-bottom: 10px; + + &.added { color: #45BA6A; } + &.fixed { color: #EC4245; } + &.improved { color: #5865F2; } + + &::after { + content: ""; + flex-grow: 1; + height: 1px; + margin-left: 7px; + background: currentColor; + } + } + + span { + display: list-item; + list-style: inside; + margin-left: 5px; + + &::marker { + color: var(--background-accent); + } + } +} \ No newline at end of file diff --git a/PlatformIndicators/components/indicators.scss b/PlatformIndicators/components/indicators.scss index dbe7a9c..821f1d8 100644 --- a/PlatformIndicators/components/indicators.scss +++ b/PlatformIndicators/components/indicators.scss @@ -13,6 +13,7 @@ &.type_Chat { margin-right: -6px; + margin-top: 2px; vertical-align: top; } } @@ -26,7 +27,7 @@ margin-right: 2px; padding-right: 2px; border-right: thin solid var(--background-modifier-hover); - height: 22px; + height: 14px; } div[id*=message-reply] .indicatorContainer.type_Chat { diff --git a/PlatformIndicators/index.jsx b/PlatformIndicators/index.jsx index 42572e0..1301070 100644 --- a/PlatformIndicators/index.jsx +++ b/PlatformIndicators/index.jsx @@ -1,4 +1,5 @@ -import {DOM, Patcher, ReactUtils, Webpack, Utils} from "@api"; +import {DOM, Patcher, ReactUtils, Webpack, UI, Utils} from "@api"; +import manifest from "@manifest"; import Styles from "@styles"; import React from "react"; import Settings from "./modules/settings"; @@ -12,6 +13,7 @@ export default class PlatformIndicators { } start() { + this.showChangelog(); this.patchDMs(); this.patchMemberList(); this.patchChat(); @@ -20,6 +22,44 @@ export default class PlatformIndicators { Styles.load(); } + showChangelog() { + if ( + !manifest?.changelog?.length || + Settings.get("lastVersion") === manifest.version + ) return; + + const i18n = Webpack.getByKeys("getLocale"); + const formatter = new Intl.DateTimeFormat(i18n.getLocale(), { + month: "long", + day: "numeric", + year: "numeric" + }); + + const title = ( +
+

What's New - {manifest.name}

+
{formatter.format(new Date(manifest.changelogDate))} - v{manifest.version}
+
+ ) + + const items = manifest?.changelog?.map(item => ( +
+

{item.title}

+ {item.items.map(item => ( + {item} + ))} +
+ )); + + "changelogImage" in manifest && items.unshift( + + ); + + Settings.set("lastVersion", manifest.version); + + UI.alert(title, items); + } + patchDMs() { const UserContext = React.createContext(null); const [ChannelWrapper, Key_CW] = Webpack.getWithKey(Webpack.Filters.byStrings("isGDMFacepileEnabled")); @@ -108,7 +148,7 @@ export default class PlatformIndicators { patchBadges() { const UserContext = React.createContext(null); const [ProfileInfoRow, KEY_PIR] = Webpack.getWithKey(Webpack.Filters.byStrings("user", "profileType")); - const [BadgeList, Key_BL] = Webpack.getWithKey(Webpack.Filters.byStrings(".PROFILE_USER_BADGES")); + const [BadgeList, Key_BL] = Webpack.getWithKey(Webpack.Filters.byStrings("badges", "badgeClassName")); Patcher.after(ProfileInfoRow, KEY_PIR, (_, [props], res) => { if (!Settings.get("showInBadges", true)) return; @@ -127,6 +167,7 @@ export default class PlatformIndicators { ); }); diff --git a/PlatformIndicators/modules/shared.js b/PlatformIndicators/modules/shared.js index d14745a..d42c4e9 100644 --- a/PlatformIndicators/modules/shared.js +++ b/PlatformIndicators/modules/shared.js @@ -15,7 +15,7 @@ export const Flux = Webpack.getByKeys("Store"); export const ModulesLibrary = Webpack.getByKeys("Anchor"); export const Colors = Webpack.getByKeys("RED_400"); -export const {Messages} = Webpack.getModule(m => m?.Messages?.STATUS_DND); +export const Messages = {"STATUS_DND": "Do Not Disturb", "STATUS_OFFLINE": "Offline", "STATUS_ONLINE": "Online", "STATUS_STEAMING": "Streaming", "STATUS_IDLE": "IDLE", "STATUS_MOBILE": "Mobile"}; export const buildClassName = (...args) => { // yeah, yk... I couldnt find a working string for this so I just remade it ;-; return args.reduce((classNames, arg) => { if (!arg) return classNames; diff --git a/PlatformIndicators/modules/utils.js b/PlatformIndicators/modules/utils.js index 5dd3bd4..c5c3fae 100644 --- a/PlatformIndicators/modules/utils.js +++ b/PlatformIndicators/modules/utils.js @@ -1,6 +1,6 @@ import {Utils} from "@api"; import {Messages} from "./shared"; -import {Colors, ModulesLibrary, buildClassName} from "./shared"; +import {Colors, ModulesLibrary} from "./shared"; export const findInReactTree = (tree, filter) => Utils.findInTree(tree, filter, {walkable: ["props", "children", "type"]}); diff --git a/PlatformIndicators/package.json b/PlatformIndicators/package.json index 6160550..589b99d 100644 --- a/PlatformIndicators/package.json +++ b/PlatformIndicators/package.json @@ -1,9 +1,20 @@ { "name": "APlatformIndicators", - "version": "1.5.9", + "version": "1.5.10", "author": "Strencher", "authorId": "415849376598982656", "description": "Adds indicators for every platform that the user is using.", "source": "https://github.com/Strencher/BetterDiscordStuff/blob/master/PlatformIndicators/APlatformIndicators.plugin.js", - "invite": "gvA2ree" + "invite": "gvA2ree", + "changelog": [ + { + "title": "Fixed", + "type": "fixed", + "items": [ + "Fixed Tooltip Messages", + "Fixed Badges not showing up" + ] + } + ], + "changelogDate": "2024-11-03" }