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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | 8x 8x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 3x 1x 4x | import { CustomConfigItemGroup } from "../customConfigs.component" import { CustomConfigHelper } from "../../../util/customConfigHelper" import { VisibleFilesBySelectionMode } from "../visibleFilesBySelectionMode.selector" export interface CustomConfigGroups { applicableItems: Map<string, CustomConfigItemGroup> nonApplicableItems: Map<string, CustomConfigItemGroup> } export function getCustomConfigItemGroups({ assignedMaps }: VisibleFilesBySelectionMode): CustomConfigGroups { const customConfigGroups: CustomConfigGroups = { applicableItems: new Map(), nonApplicableItems: new Map() } const customConfigItemGroups = new Map<string, CustomConfigItemGroup>() for (const customConfig of CustomConfigHelper.loadCustomConfigsFromLocalStorage().values()) { const mapNames = [...customConfig.assignedMaps.values()] const groupKey = `${mapNames.join("_")}_${customConfig.mapSelectionMode}` const isCustomConfigItemApplicable = [...customConfig.assignedMaps.keys()].some(configChecksum => assignedMaps.has(configChecksum)) if (!customConfigItemGroups.has(groupKey)) { customConfigItemGroups.set(groupKey, { mapNames: mapNames.join(" "), mapSelectionMode: customConfig.mapSelectionMode, hasApplicableItems: isCustomConfigItemApplicable, customConfigItems: [] }) } const { positive, neutral, negative, selected, positiveDelta, negativeDelta } = customConfig.stateSettings.appSettings.mapColors const { areaMetric, heightMetric, colorMetric, edgeMetric } = customConfig.stateSettings.dynamicSettings customConfigItemGroups.get(groupKey).customConfigItems.push({ id: customConfig.id, name: customConfig.name, assignedMaps: customConfig.assignedMaps, mapSelectionMode: customConfig.mapSelectionMode, metrics: { areaMetric, heightMetric, colorMetric, edgeMetric }, mapColors: { positive, neutral, negative, selected, positiveDelta, negativeDelta }, isApplicable: isCustomConfigItemApplicable, ...(customConfig.note && { note: customConfig.note }) }) if (customConfigItemGroups.get(groupKey).hasApplicableItems) { customConfigGroups.applicableItems.set(groupKey, customConfigItemGroups.get(groupKey)) } else { customConfigGroups.nonApplicableItems.set(groupKey, customConfigItemGroups.get(groupKey)) } } return customConfigGroups } |