Skip to content

Commit

Permalink
cleanup of initial prototype code
Browse files Browse the repository at this point in the history
  • Loading branch information
telamonian committed Apr 14, 2022
1 parent fd3a99e commit 39f1c44
Showing 1 changed file with 0 additions and 46 deletions.
46 changes: 0 additions & 46 deletions conda-store-ui/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,52 +123,6 @@ export function PlusIcon() {
)
}

export function PackagePicker() {
const nameOptions = specRef.map(x => x.name);

const [nameValue, setNameValue] = React.useState<string | null>(null);

const [versionDisabled, setVersionDisabled] = React.useState<boolean>(true);
const [versionOptions, setVersionOptions] = React.useState<number[]>([]);
const [versionValue, setVersionValue] = React.useState<number | null>(null);

const onNameChange = (event: any, newValue: string | null) => {
setNameValue(newValue);

if (newValue !== null) {
setVersionDisabled(false);
setVersionOptions(specMap.get(newValue)?.options ?? []);
setVersionValue(specMap.get(newValue)?.default ?? null);
} else {
setVersionDisabled(true);
setVersionOptions([]);
setVersionValue(null);
}
}

return (
<Stack direction="row">
<Autocomplete
onChange={onNameChange}
options={nameOptions}
renderInput={(params) => <TextField {...params} label="Pkg Name" />}
sx = {{minWidth: 300}}
value={nameValue}
/>
<Autocomplete
disabled={versionDisabled}
onChange={(event: any, newValue: number | null) => {
setVersionValue(newValue);
}}
options={versionOptions}
renderInput={(params) => <TextField {...params} label="Pkg Version" />}
sx = {{minWidth: 150}}
value={versionValue}
/>
</Stack>
);
}

const rootElem = document.createElement("div");
document.body.appendChild(rootElem);
const root = createRoot(rootElem);
Expand Down

0 comments on commit 39f1c44

Please sign in to comment.