diff options
| author | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-08-16 15:35:49 -0400 |
|---|---|---|
| committer | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-08-16 15:35:49 -0400 |
| commit | ca74a157ca5cc22c9b4292c895af35be96b54588 (patch) | |
| tree | c430984a6e7d997fb0edbbc7af8405c1b7241499 | |
| parent | 79cd9296e9aaf2453030b014712e95312f201514 (diff) | |
| download | decky-lsfg-vk-ca74a157ca5cc22c9b4292c895af35be96b54588.tar.gz decky-lsfg-vk-ca74a157ca5cc22c9b4292c895af35be96b54588.zip | |
move new profile into dropdown
| -rw-r--r-- | src/components/ProfileManagement.tsx | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/components/ProfileManagement.tsx b/src/components/ProfileManagement.tsx index 709a28c..ef68844 100644 --- a/src/components/ProfileManagement.tsx +++ b/src/components/ProfileManagement.tsx @@ -216,6 +216,14 @@ export function ProfileManagement({ currentProfile, onProfileChange }: ProfileMa } }; + const handleDropdownChange = (option: DropdownOption) => { + if (option.data === "__NEW_PROFILE__") { + handleCreateProfile(); + } else { + handleProfileChange(option.data); + } + }; + const handleRenameProfile = () => { if (selectedProfile === "decky-lsfg-vk") { showErrorToast("Cannot rename default profile", "The default profile cannot be renamed"); @@ -259,10 +267,16 @@ export function ProfileManagement({ currentProfile, onProfileChange }: ProfileMa } }; - const profileOptions: DropdownOption[] = profiles.map(profile => ({ - data: profile, - label: profile === "decky-lsfg-vk" ? `${profile} (default)` : profile - })); + const profileOptions: DropdownOption[] = [ + ...profiles.map((profile: string) => ({ + data: profile, + label: profile === "decky-lsfg-vk" ? "Default" : profile + })), + { + data: "__NEW_PROFILE__", + label: "New Profile" + } + ]; return ( <PanelSection title="Select Profile"> @@ -275,21 +289,11 @@ export function ProfileManagement({ currentProfile, onProfileChange }: ProfileMa <Dropdown rgOptions={profileOptions} selectedOption={selectedProfile} - onChange={(option) => handleProfileChange(option.data)} + onChange={handleDropdownChange} disabled={isLoading} /> </Field> </PanelSectionRow> - - <PanelSectionRow> - <ButtonItem - layout="below" - onClick={handleCreateProfile} - disabled={isLoading} - > - New Profile - </ButtonItem> - </PanelSectionRow> <PanelSectionRow> <ButtonItem |
