From dd6a16b0e664dc97338248d27904ddb4ca4e3d0b Mon Sep 17 00:00:00 2001 From: Marcel Gerber Date: Fri, 12 Apr 2024 09:35:00 +0200 Subject: [PATCH] refactor(selection): remove unused SelectionArray methods --- .../grapher/src/selection/SelectionArray.ts | 39 +------------------ 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/packages/@ourworldindata/grapher/src/selection/SelectionArray.ts b/packages/@ourworldindata/grapher/src/selection/SelectionArray.ts index b6f3dd4360e..31c633ef639 100644 --- a/packages/@ourworldindata/grapher/src/selection/SelectionArray.ts +++ b/packages/@ourworldindata/grapher/src/selection/SelectionArray.ts @@ -1,5 +1,5 @@ import { EntityCode, EntityId, EntityName } from "@ourworldindata/types" -import { difference, mapBy } from "@ourworldindata/utils" +import { difference } from "@ourworldindata/utils" import { action, computed, observable } from "mobx" export interface Entity { @@ -28,30 +28,6 @@ export class SelectionArray { return new Set(this.availableEntityNames) } - @computed get entityNameToIdMap(): Map { - return mapBy( - this.availableEntities, - (e) => e.entityName, - (e) => e.entityId - ) - } - - @computed get entityCodeToNameMap(): Map { - return mapBy( - this.availableEntities, - (e) => e.entityCode, - (e) => e.entityName - ) - } - - @computed get entityIdToNameMap(): Map { - return mapBy( - this.availableEntities, - (e) => e.entityId, - (e) => e.entityName - ) - } - @computed get hasSelection(): boolean { return this.selectedEntityNames.length > 0 } @@ -84,19 +60,6 @@ export class SelectionArray { return this } - @action.bound setSelectedEntitiesByCode(entityCodes: EntityCode[]): this { - const map = this.entityCodeToNameMap - const codesInData = entityCodes.filter((code) => map.has(code)) - return this.setSelectedEntities( - codesInData.map((code) => map.get(code)!) - ) - } - - @action.bound setSelectedEntitiesByEntityId(entityIds: EntityId[]): this { - const map = this.entityIdToNameMap - return this.setSelectedEntities(entityIds.map((id) => map.get(id)!)) - } - @action.bound selectAll(): this { return this.addToSelection(this.unselectedEntityNames) }