mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-23 05:17:02 -04:00
feat(equicordCSS): remove if hell and simplify
This commit is contained in:
parent
4928a804aa
commit
1bd61730c7
2 changed files with 43 additions and 46 deletions
|
@ -25,96 +25,93 @@ import definePlugin, { OptionType } from "@utils/types";
|
||||||
// Importing the style managed fixes on and off switch
|
// Importing the style managed fixes on and off switch
|
||||||
import betterauthapps from "./css/betterauthapps.css?managed";
|
import betterauthapps from "./css/betterauthapps.css?managed";
|
||||||
import betterstatuspicker from "./css/betterstatuspicker.css?managed";
|
import betterstatuspicker from "./css/betterstatuspicker.css?managed";
|
||||||
import graidentbuttons from "./css/graidentbuttons.css?managed";
|
import gradientbuttons from "./css/gradientbuttons.css?managed";
|
||||||
import nitrothemesfix from "./css/nitrothemesfix.css?managed";
|
import nitrothemesfix from "./css/nitrothemesfix.css?managed";
|
||||||
import settingsicons from "./css/settingsicons.css?managed";
|
import settingsicons from "./css/settingsicons.css?managed";
|
||||||
import userreimagined from "./css/userreimagined.css?managed";
|
import userreimagined from "./css/userreimagined.css?managed";
|
||||||
|
|
||||||
|
// Forcing restartNeeded: true to not overcomplicate the live update of the settings using FluxDispatcher and making it complex
|
||||||
const settings = definePluginSettings({
|
const settings = definePluginSettings({
|
||||||
betterAuthApps: {
|
betterAuthApps: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
description: "Enable Better Auth Apps CSS",
|
description: "Enable Better Auth Apps CSS",
|
||||||
restartNeeded: false,
|
restartNeeded: true,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
betterStatusPicker: {
|
betterStatusPicker: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
description: "Enable Better Status Picker CSS",
|
description: "Enable Better Status Picker CSS",
|
||||||
restartNeeded: false,
|
restartNeeded: true,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
graidentButtons: {
|
gradientButtons: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
description: "Enable Graident Buttons CSS",
|
description: "Enable Gradient Buttons CSS",
|
||||||
restartNeeded: false,
|
restartNeeded: true,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
nitroThemesFix: {
|
nitroThemesFix: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
description: "Enable Fix Nitro Themes CSS",
|
description: "Enable Fix Nitro Themes CSS",
|
||||||
restartNeeded: false,
|
restartNeeded: true,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
settingsIcons: {
|
settingsIcons: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
description: "Enable Settings Icons CSS",
|
description: "Enable Settings Icons CSS",
|
||||||
restartNeeded: false,
|
restartNeeded: true,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
userReimagined: {
|
userReimagined: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
description: "Enable User Reimagined CSS",
|
description: "Enable User Reimagined CSS",
|
||||||
restartNeeded: false,
|
restartNeeded: true,
|
||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let settingsArray: Array<any> = [];
|
||||||
|
let cssArray: Array<any> = [];
|
||||||
|
|
||||||
// Define the Vencord plugin
|
// Define the Vencord plugin
|
||||||
migratePluginSettings("EquicordCSS", "EquicordBuiltIn");
|
migratePluginSettings("EquicordCSS", "EquicordBuiltIn");
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "EquicordCSS",
|
name: "EquicordCSS",
|
||||||
description: "CSS for Equicord users. You will need to look at the settings.",
|
description: "CSS for Equicord users. You will need to look at the settings.",
|
||||||
authors: [EquicordDevs.thororen],
|
authors: [EquicordDevs.thororen, EquicordDevs.Panniku],
|
||||||
dependencies: ["ThemeAttributes"],
|
dependencies: ["ThemeAttributes"],
|
||||||
settings,
|
settings,
|
||||||
start() {
|
start() {
|
||||||
if (settings.store.betterAuthApps) {
|
|
||||||
enableStyle(betterauthapps);
|
// Push variables to array to iterate on start() and stop()
|
||||||
}
|
settingsArray.push(
|
||||||
if (settings.store.betterStatusPicker) {
|
settings.store.betterAuthApps,
|
||||||
enableStyle(betterstatuspicker);
|
settings.store.betterStatusPicker,
|
||||||
}
|
settings.store.gradientButtons,
|
||||||
if (settings.store.graidentButtons) {
|
settings.store.nitroThemesFix,
|
||||||
enableStyle(graidentbuttons);
|
settings.store.settingsIcons,
|
||||||
}
|
settings.store.userReimagined
|
||||||
if (settings.store.nitroThemesFix) {
|
);
|
||||||
enableStyle(nitrothemesfix);
|
cssArray.push(
|
||||||
}
|
betterauthapps,
|
||||||
if (settings.store.settingsIcons) {
|
betterstatuspicker,
|
||||||
enableStyle(settingsicons);
|
gradientbuttons,
|
||||||
}
|
nitrothemesfix,
|
||||||
if (settings.store.userReimagined) {
|
settingsicons,
|
||||||
enableStyle(userreimagined);
|
userreimagined
|
||||||
}
|
);
|
||||||
|
|
||||||
|
settingsArray.forEach((s, i) => {
|
||||||
|
if (s) enableStyle(cssArray[i]);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
stop() {
|
stop() {
|
||||||
if (settings.store.betterAuthApps) {
|
|
||||||
disableStyle(betterauthapps);
|
settingsArray.forEach((s, i) => {
|
||||||
}
|
if (s) disableStyle(cssArray[i]);
|
||||||
if (settings.store.betterStatusPicker) {
|
});
|
||||||
disableStyle(betterstatuspicker);
|
|
||||||
}
|
settingsArray = [];
|
||||||
if (settings.store.graidentButtons) {
|
cssArray = [];
|
||||||
disableStyle(graidentbuttons);
|
|
||||||
}
|
|
||||||
if (settings.store.nitroThemesFix) {
|
|
||||||
disableStyle(nitrothemesfix);
|
|
||||||
}
|
|
||||||
if (settings.store.settingsIcons) {
|
|
||||||
disableStyle(settingsicons);
|
|
||||||
}
|
|
||||||
if (settings.store.userReimagined) {
|
|
||||||
disableStyle(userreimagined);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue