Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
12944qwerty committed Oct 12, 2023
1 parent a6dd2d8 commit a768045
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
1 change: 0 additions & 1 deletion bin/index.mts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { logBuildPlugin } from "../src/util.mjs";
import { sassPlugin } from "esbuild-sass-plugin";
import { fileURLToPath } from "url";
import { AddonType, getAddonFolder, isMonoRepo, selectAddon } from "./mono.mjs";
import { ThemeManifest } from "src/types";

interface BaseArgs {
watch?: boolean;
Expand Down
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"notif",
"notrack",
"outfile",
"outdir",
"popout",
"postpublish",
"Promisable",
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/coremods/settings/pages/Addons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ export const Addons = (type: AddonType): React.ReactElement => {
</Text>
) : null
) : (
(SettingsElement = getSettingsElement(section.slice(`rp_${type}_`.length+1), type)) && (
(SettingsElement = getSettingsElement(section.slice(`rp_${type}_`.length + 1), type)) && (
<ErrorBoundary>
<SettingsElement />
</ErrorBoundary>
Expand Down
4 changes: 1 addition & 3 deletions src/renderer/managers/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,15 @@ export function load(id: string): void {
const theme = themes.get(id)!;
let themeSettings = settings.get(theme.manifest.id);
if (!themeSettings) themeSettings = {};
console.log(themeSettings);
if (!themeSettings.chosenPreset) {
themeSettings.chosenPreset = theme.manifest.presets?.find((x) => x.default)?.path;
console.log(themeSettings);
settings.set(theme.manifest.id, themeSettings);
}

let el;
if (theme.manifest.main) {
el = loadStyleSheet(`replugged://theme/${theme.path}/${theme.manifest.main}`);
} else if (themeSettings?.chosenPreset) {
} else if (themeSettings.chosenPreset) {
el = loadStyleSheet(`replugged://theme/${theme.path}/${themeSettings.chosenPreset}`);
} else {
throw new Error(`Theme ${id} does not have a main variant.`);
Expand Down
17 changes: 10 additions & 7 deletions src/types/addon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@ export const theme = common.extend({
type: z.literal("replugged-theme"),
main: z.string().optional(),
splash: z.string().optional(),
presets: z.object({
label: z.string(),
path: z.string(),
default: z.boolean().optional(),
}).array().optional(),
presets: z
.object({
label: z.string(),
path: z.string(),
default: z.boolean().optional(),
})
.array()
.optional(),
});

export type ThemeManifest = z.infer<typeof theme>;
Expand Down Expand Up @@ -94,6 +97,6 @@ export type AddonSettings = {

export type ThemeSettings = AddonSettings & {
[x: string]: {
"chosenPreset"?: string;
chosenPreset?: string;
};
}
};

0 comments on commit a768045

Please sign in to comment.