From 3b41fef253ee9abde9c5905c3af45bb50a41e7c9 Mon Sep 17 00:00:00 2001 From: s3ntricall Date: Wed, 19 Aug 2026 12:14:20 +0930 Subject: [PATCH] fix: unthemed app icons in SEQTA settings page (#469) * ork ork * add appicons plugin.ork * Add files via upload --- src/plugins/built-in/appIcons/index.ts | 84 ++++++++++++++++++++++++ src/plugins/index.ts | 2 + src/resources/icons/dlappstore-dark.svg | 46 +++++++++++++ src/resources/icons/dlappstore-light.svg | 46 +++++++++++++ src/resources/icons/googleplay.svg | 55 ++++++++++++++++ 5 files changed, 233 insertions(+) create mode 100644 src/plugins/built-in/appIcons/index.ts create mode 100644 src/resources/icons/dlappstore-dark.svg create mode 100644 src/resources/icons/dlappstore-light.svg create mode 100644 src/resources/icons/googleplay.svg diff --git a/src/plugins/built-in/appIcons/index.ts b/src/plugins/built-in/appIcons/index.ts new file mode 100644 index 00000000..87da0363 --- /dev/null +++ b/src/plugins/built-in/appIcons/index.ts @@ -0,0 +1,84 @@ +import type { Plugin } from "../../core/types"; +import appstoredark from "@/resources/icons/dlappstore-dark.svg"; +import appstorelight from "@/resources/icons/dlappstore-light.svg"; +import gplayicon from "@/resources/icons/googleplay.svg"; + +const appIconPlugin: Plugin<{}, {}> = { + id: "app-icons", + name: "App Icons", + description: "Fixes the unthemed playstore and app store icons in the SEQTA download page in settings.", + version: "1.0.0", + settings: {}, + disableToggle: true, + + run: async (api) => { + const appstoreSelector = + 'a[href="https://itunes.apple.com/au/app/seqta-learn/id1143069793"]>img'; + const googleplaySelector = + 'a[href="https://play.google.com/store/apps/details?id=com.seqta.android.learn"]>img'; + + let observer: MutationObserver | null = null; + let classObserver: MutationObserver | null = null; + + const updateIcons = () => { + const appstore = + document.querySelector(appstoreSelector); + const googleplay = + document.querySelector(googleplaySelector); + + const isDark = + document.documentElement.classList.contains("dark"); + + if (appstore) { + appstore.src = isDark ? appstoredark : appstorelight; + } + + if (googleplay && appstore) { + googleplay.src = gplayicon; + googleplay.style.width = `130px`; + googleplay.style.height = `40px`; + googleplay.style.objectFit = "contain"; + googleplay.style.flexShrink = "0"; + googleplay.style.marginLeft = "8px"; + } + }; + + const ensureObserver = () => { + observer?.disconnect(); + + observer = new MutationObserver(() => { + updateIcons(); + }); + + observer.observe(document.body, { + childList: true, + subtree: true, + }); + }; + + const onHashChange = () => { + if (window.location.hash === "#?page=/settings") { + updateIcons(); + ensureObserver(); + } else { + observer?.disconnect(); + observer = null; + } + }; + + window.addEventListener("hashchange", onHashChange); + + classObserver = new MutationObserver(updateIcons); + classObserver.observe(document.documentElement, { + attributes: true, + attributeFilter: ["class"], + }); + + if (window.location.hash === "#?page=/settings") { + updateIcons(); + ensureObserver(); + } + }, +}; + +export default appIconPlugin; diff --git a/src/plugins/index.ts b/src/plugins/index.ts index 65a6afdf..039be718 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -8,6 +8,7 @@ import animatedBackgroundPlugin from "./built-in/animatedBackground"; import profilePicturePlugin from "./built-in/profilePicture"; import assessmentsOverviewPlugin from "./built-in/assessmentsOverview"; import backgroundMusicPlugin from "./built-in/backgroundMusic"; +import appIconPlugin from "./built-in/appIcons"; import assessmentsAveragePluginLazy from "./built-in/assessmentsAverage/lazy"; import timetableEditPluginLazy from "./built-in/timetableEdit/lazy"; @@ -27,6 +28,7 @@ pluginManager.registerPlugin(timetablePlugin); pluginManager.registerPlugin(profilePicturePlugin); pluginManager.registerPlugin(assessmentsOverviewPlugin); pluginManager.registerPlugin(backgroundMusicPlugin); +pluginManager.registerPlugin(appIconPlugin); pluginManager.registerPlugin(assessmentsAveragePluginLazy); pluginManager.registerPlugin(timetableEditPluginLazy); diff --git a/src/resources/icons/dlappstore-dark.svg b/src/resources/icons/dlappstore-dark.svg new file mode 100644 index 00000000..072b425a --- /dev/null +++ b/src/resources/icons/dlappstore-dark.svg @@ -0,0 +1,46 @@ + + Download_on_the_App_Store_Badge_US-UK_RGB_blk_4SVG_092917 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/resources/icons/dlappstore-light.svg b/src/resources/icons/dlappstore-light.svg new file mode 100644 index 00000000..16c0496c --- /dev/null +++ b/src/resources/icons/dlappstore-light.svg @@ -0,0 +1,46 @@ + + Download_on_the_App_Store_Badge_US-UK_RGB_wht_092917 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/resources/icons/googleplay.svg b/src/resources/icons/googleplay.svg new file mode 100644 index 00000000..cc15f9bc --- /dev/null +++ b/src/resources/icons/googleplay.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file