Merge pull request #169 from snowball-tools/eric/snow-314-dashboarduicreate-template-app-page-auto-select-first-git

fix: auto select first git account
This commit is contained in:
Eric Lewis 2024-04-12 12:20:41 -04:00 committed by GitHub
commit b17e9df1e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 16 deletions

View File

@ -219,6 +219,7 @@ export const Select = ({
getItemProps, getItemProps,
openMenu, openMenu,
} = useCombobox({ } = useCombobox({
defaultInputValue: (options[0] as unknown as SelectOption)?.value,
items: filteredItems, items: filteredItems,
selectedItem: multiple ? null : (value as SelectOption) || null, selectedItem: multiple ? null : (value as SelectOption) || null,
// @ts-expect-error there are two params but we don't need the second one // @ts-expect-error there are two params but we don't need the second one

View File

@ -151,24 +151,29 @@ const CreateRepo = () => {
The project will be cloned into this repository The project will be cloned into this repository
</Heading> </Heading>
</div> </div>
<div className="flex flex-col justify-start gap-3"> <div className="flex flex-col justify-start gap-3">
<span className="text-sm text-elements-high-em">Git account</span> <span className="text-sm text-elements-high-em">Git account</span>
<Controller {gitAccounts.length > 0 ? (
name="account" <Controller
control={control} name="account"
render={({ field: { value, onChange } }) => ( control={control}
<Select render={({ field: { value, onChange } }) => (
value={{ value } as SelectOption} <Select
onChange={(value) => onChange((value as SelectOption).value)} value={{ value } as SelectOption}
options={ onChange={(value) => onChange((value as SelectOption).value)}
gitAccounts.map((account) => ({ options={
value: account, gitAccounts.map((account) => ({
label: account, value: account,
})) ?? [] label: account,
} })) ?? []
/> }
)} />
/> )}
/>
) : (
<Select options={[]} disabled />
)}
</div> </div>
<div className="flex flex-col justify-start gap-3"> <div className="flex flex-col justify-start gap-3">
<span className="text-sm text-elements-high-em">Name the repo</span> <span className="text-sm text-elements-high-em">Name the repo</span>