Skip to content

Commit

Permalink
chore: Sort lists in GDE.
Browse files Browse the repository at this point in the history
  • Loading branch information
mheggelund committed Oct 9, 2024
1 parent 08f58d6 commit e156440
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/components/GrossDepositionEnviroment/GdeSelect/GdeSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@ export const GdeSelect = ({
(g) => g.geologyGroup === 'ArchitecturalElement',
);

const sortList = (data: any) => {
return data.sort((a: any, b: any) =>
a.identifier.localeCompare(b.identifier),
);
};

return (
<StyledDialog.AutocompleteList>
<Autocomplete
label="Gross Depositional Environment (GDE)"
options={Gde}
options={Gde.sort((a, b) => a.identifier.localeCompare(b.identifier))}
optionLabel={(option) => option.identifier}
onOptionsChange={(e: AutocompleteChanges<GeologicalStandardDto>) => {
setGdeObject({
Expand All @@ -56,7 +62,7 @@ export const GdeSelect = ({
<Autocomplete
label="Depositional Environment"
disabled={gdeObject.grossDepEnv?.geologicalStandardId === undefined}
options={De}
options={sortList(De)}
optionLabel={(option) => option.identifier}
onOptionsChange={(e: AutocompleteChanges<GeologicalStandardDto>) => {
setGdeObject({
Expand All @@ -70,7 +76,7 @@ export const GdeSelect = ({
<Autocomplete
label="Subenvironment"
disabled={gdeObject.grossDepEnv?.geologicalStandardId === undefined}
options={SubEnvironment}
options={sortList(SubEnvironment)}
optionLabel={(option) => option.identifier}
onOptionsChange={(e: AutocompleteChanges<GeologicalStandardDto>) => {
setGdeObject({
Expand All @@ -84,7 +90,7 @@ export const GdeSelect = ({
<Autocomplete
label="Architectural Element"
multiple
options={ArchitecturalElement}
options={sortList(ArchitecturalElement)}
optionLabel={(option) => option.identifier}
onOptionsChange={(e: AutocompleteChanges<GeologicalStandardDto>) => {
setGdeObject({
Expand Down

0 comments on commit e156440

Please sign in to comment.