Skip to content

Commit

Permalink
Add icon to Settlement items
Browse files Browse the repository at this point in the history
  • Loading branch information
XanderVertegaal committed Jan 21, 2025
1 parent 2d99fba commit 7d60bea
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { FormControl, FormGroup } from "@angular/forms";
import { formStatusSubject } from "../../shared/utils";
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
import { MutationResult } from "apollo-angular";
import { MultiselectOption } from "../../shared/multiselect/multiselect.component";

type LocationSettlementsSpaceDescription = Required<
Pick<DataEntryUpdateLocationMutationVariables["spaceData"], "settlements">
Expand Down Expand Up @@ -51,16 +52,18 @@ export class LocationSettlementsFormComponent implements OnInit, OnDestroy {
share()
);

public settlementOptions$ = this.settlementsQuery.fetch().pipe(
map((result) => result.data.settlements),
map((settlements) =>
settlements.map((settlement) => ({
value: settlement.id,
label: settlement.name,
dropdownLabel: this.formatDropdownLabel(settlement),
}))
)
);
public settlementOptions$: Observable<MultiselectOption[]> =
this.settlementsQuery.fetch().pipe(
map((result) => result.data.settlements),
map((settlements) =>
settlements.map((settlement) => ({
value: settlement.id,
label: settlement.name,
icon: "city",
dropdownLabel: this.formatDropdownLabel(settlement),
}))
)
);

public form = new FormGroup<LocationSettlementsForm>({
settlements: new FormControl<string[]>([], {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
} from "rxjs";
import { FormService } from "../../shared/form.service";
import { formStatusSubject } from "../../shared/utils";
import { MultiselectOption } from "../../shared/multiselect/multiselect.component";

type LocationStructuresSpaceDescription = Required<
Pick<DataEntryUpdateLocationMutationVariables["spaceData"], "structures">
Expand Down Expand Up @@ -60,7 +61,7 @@ export class LocationStructuresFormComponent implements OnInit, OnDestroy {
share()
);

public structureOptions$ = this.structuresQuery.fetch().pipe(
public structureOptions$: Observable<MultiselectOption[]> = this.structuresQuery.fetch().pipe(
map((result) => result.data.structures),
map((structures) =>
structures.map((structure) => ({
Expand Down
1 change: 1 addition & 0 deletions frontend/src/assets/icons/city.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7d60bea

Please sign in to comment.