All files / app/codeCharta/ui/colorPickerForMapColor colorPickerForMapColor.component.ts

94.44% Statements 17/18
100% Branches 0/0
50% Functions 1/2
94.11% Lines 16/17

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 386x 6x     6x 6x 6x 6x 6x 6x 6x 6x               6x     103x 103x 103x 103x   103x                    
import { Component, Input } from "@angular/core"
import { Store } from "@ngrx/store"
 
import { CcState, MapColors } from "../../codeCharta.model"
import { selectedColorMetricDataSelector } from "../../state/selectors/accumulatedData/metricData/selectedColorMetricData.selector"
import { setMapColors } from "../../state/store/appSettings/mapColors/mapColors.actions"
import { mapColorsSelector } from "../../state/store/appSettings/mapColors/mapColors.selector"
import { colorRangeSelector } from "../../state/store/dynamicSettings/colorRange/colorRange.selector"
import { colorMetricSelector } from "../../state/store/dynamicSettings/colorMetric/colorMetric.selector"
import { LabelledColorPickerComponent } from "../labelledColorPicker/labelledColorPicker.component"
import { AsyncPipe } from "@angular/common"
import { MapColorLabelPipe } from "./mapColorLabel.pipe"
 
@Component({
    selector: "cc-color-picker-for-map-color",
    templateUrl: "./colorPickerForMapColor.component.html",
    standalone: true,
    imports: [LabelledColorPickerComponent, AsyncPipe, MapColorLabelPipe]
})
export class ColorPickerForMapColorComponent {
    @Input() mapColorFor: keyof Omit<MapColors, "labelColorAndAlpha" | "markingColors">
 
    colorMetric$ = this.store.select(colorMetricSelector)
    mapColors$ = this.store.select(mapColorsSelector)
    colorRange$ = this.store.select(colorRangeSelector)
    nodeMetricRange$ = this.store.select(selectedColorMetricDataSelector)
 
    constructor(private store: Store<CcState>) {}
 
    handleColorChange(newHexColor: string) {
        this.store.dispatch(
            setMapColors({
                value: { [this.mapColorFor]: newHexColor }
            })
        )
    }
}