Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
suchmememanyskill committed Sep 16, 2022
2 parents 5599bc7 + 6140286 commit a4b8430
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 24 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SDH-CssLoader",
"version": "1.2.0",
"version": "1.2.1",
"description": "A css loader",
"scripts": {
"build": "shx rm -rf dist && rollup -c",
Expand Down Expand Up @@ -40,7 +40,7 @@
"typescript": "^4.6.4"
},
"dependencies": {
"decky-frontend-lib": "^1.7.5",
"decky-frontend-lib": "3.0.0",
"react-icons": "^4.3.1"
},
"pnpm": {
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/components/ColorPickerModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ModalRoot, SliderField } from "decky-frontend-lib";
import { ConfirmModal, SliderField } from "decky-frontend-lib";
import { CSSProperties, useState, VFC } from "react";

interface ColorPickerModalProps {
Expand Down Expand Up @@ -79,7 +79,7 @@ export const ColorPickerModal: VFC<ColorPickerModalProps> = ({
}
`}
</style>
<ModalRoot
<ConfirmModal
bAllowFullSize
onCancel={closeModal}
onOK={() => {
Expand Down Expand Up @@ -158,7 +158,7 @@ export const ColorPickerModal: VFC<ColorPickerModalProps> = ({
/>
</div>
</div>
</ModalRoot>
</ConfirmModal>
</>
);
};
4 changes: 2 additions & 2 deletions src/components/ThemePatch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ export const ThemePatch: VFC<{
selectedOption={data.index}
onChange={(index) => {
data.index = index.data;
data.value = index.label;
setLabel(index.label);
data.value = index.label as string;
setLabel(data.value);
python.execute(
python.setPatchOfTheme(data.theme.name, data.name, data.value)
);
Expand Down
9 changes: 4 additions & 5 deletions src/components/ThemeToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export const ThemeToggle: VFC<{ data: Theme; setThemeList: any }> = ({
label={data.name}
description={data.description}
onChange={(switchValue: boolean) => {
// Actually enabling the theme
python.resolve(python.setThemeState(data.name, switchValue), () => {
python.resolve(python.getThemes(), setThemeList);
});
// Dependency Toast
if (switchValue === true && data.dependencies.length > 0) {
python.toast(
Expand All @@ -30,11 +34,6 @@ export const ThemeToggle: VFC<{ data: Theme; setThemeList: any }> = ({
} required for this theme`
);
}

// Actually enabling the theme
python.resolve(python.setThemeState(data.name, switchValue), () => {
python.resolve(python.getThemes(), setThemeList);
});
}}
/>
</PanelSectionRow>
Expand Down
17 changes: 12 additions & 5 deletions src/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,18 @@ export function setComponentOfThemePatch(
}

export function toast(title: string, message: string) {
return server?.toaster.toast({
title: title,
body: message,
duration: 8000,
});
// This is a weirdo self-invoking function, but it works.
return (() => {
try {
return server?.toaster.toast({
title: title,
body: message,
duration: 8000,
});
} catch (e) {
console.log("CSSLoader Toaster Error", e);
}
})();
}

export function downloadTheme(uuid: string): Promise<any> {
Expand Down
4 changes: 2 additions & 2 deletions src/theme-manager/ThemeBrowserPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const ThemeBrowserPage: VFC = () => {
// const [selectedTarget, setTarget] = useState<SingleDropdownOption>({ data: 1, label: "All", });
// const [selectedSort, setSort] = useState<number>(3);

const [backendVersion, setBackendVer] = useState<number>(2);
const [backendVersion, setBackendVer] = useState<number>(3);
function reloadBackendVer() {
python.resolve(python.getBackendVersion(), setBackendVer);
}
Expand Down Expand Up @@ -161,7 +161,7 @@ export const ThemeBrowserPage: VFC = () => {
.filter(searchFilter)
.filter((e: browseThemeEntry) => {
if (selectedTarget.label === "All") {
return e.target !== "Background"
return e.target !== "Background";
} else if (selectedTarget.label === "Installed") {
const strValue = checkIfThemeInstalled(e);
return strValue === "installed" || strValue === "outdated";
Expand Down

0 comments on commit a4b8430

Please sign in to comment.