generated from SteamDeckHomebrew/Plugin-Template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: display uploaded profiles in settings
- Loading branch information
Showing
9 changed files
with
224 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Focusable, ModalRoot } from "decky-frontend-lib"; | ||
|
||
export function PremiumFeatureModal({ closeModal, blurb }: { closeModal?: any; blurb: string }) { | ||
return ( | ||
<ModalRoot onCancel={closeModal} onEscKeypress={closeModal}> | ||
<Focusable style={{ display: "flex", flexDirection: "column" }}> | ||
<span style={{ fontSize: "2em", fontWeight: "bold" }}>Premium Feature</span> | ||
<p>{blurb}</p> | ||
<span> | ||
To support DeckThemes and unlock premium features, visit https://patreon.com/deckthemes | ||
</span> | ||
</Focusable> | ||
</ModalRoot> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { CssLoaderContextProvider, useCssLoaderState } from "../../state"; | ||
import * as python from "../../python"; | ||
import { | ||
ButtonItem, | ||
ConfirmModal, | ||
DropdownItem, | ||
Focusable, | ||
ModalRoot, | ||
TextField, | ||
ToggleField, | ||
} from "decky-frontend-lib"; | ||
import { useMemo, useState } from "react"; | ||
import { Flags } from "../../ThemeTypes"; | ||
|
||
export function UploadProfileModalRoot({ closeModal }: { closeModal?: any }) { | ||
return ( | ||
<ModalRoot onCancel={closeModal} onEscKeypress={closeModal}> | ||
{/* @ts-ignore */} | ||
<CssLoaderContextProvider cssLoaderStateClass={python.globalState}> | ||
<UploadProfileModal /> | ||
</CssLoaderContextProvider> | ||
</ModalRoot> | ||
); | ||
} | ||
|
||
function UploadProfileModal() { | ||
const { localThemeList } = useCssLoaderState(); | ||
let [selectedProfile, setProfile] = useState( | ||
localThemeList.find((e) => e.flags.includes(Flags.isPreset))?.id | ||
); | ||
const profiles = useMemo(() => { | ||
return localThemeList.filter((e) => e.flags.includes(Flags.isPreset)); | ||
}, [localThemeList]); | ||
const eligibleProfiles = useMemo(() => { | ||
return profiles; | ||
}, [profiles]); | ||
|
||
const [isPublic, setPublic] = useState<boolean>(false); | ||
const [description, setDescription] = useState<string>(""); | ||
|
||
return ( | ||
<Focusable style={{ display: "flex", flexDirection: "column" }}> | ||
<span>Upload Profile</span> | ||
<DropdownItem | ||
selectedOption={selectedProfile} | ||
rgOptions={eligibleProfiles.map((e) => ({ data: e.id, label: e.display_name }))} | ||
onChange={(chosen) => { | ||
setProfile(chosen.data); | ||
}} | ||
label="Profile To Upload" | ||
/> | ||
<ToggleField checked={isPublic} onChange={setPublic} label="Make Profile Public" /> | ||
<TextField | ||
label="Description (optional)" | ||
value={description} | ||
onChange={(e) => setDescription(e.target.value)} | ||
/> | ||
<ButtonItem> | ||
<span>Upload</span> | ||
</ButtonItem> | ||
</Focusable> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./CreatePresetModal"; | ||
export * from "./ThemeSettingsModal"; | ||
export * from "./UploadProfileModal"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters