From 9dae22e3359abfff891f3f4ed96a76b7b944df30 Mon Sep 17 00:00:00 2001 From: Joe Heffernan Date: Fri, 8 Nov 2024 15:03:04 -0800 Subject: [PATCH] rename ColorSetting from plural --- .../compoundSelectors/compoundSelectors.test.ts | 10 +++++----- src/state/compoundSelectors/index.ts | 16 ++++++---------- src/state/selection/reducer.ts | 4 ++-- src/state/selection/selectors/basic.ts | 4 ++-- src/state/selection/types.ts | 2 +- 5 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/state/compoundSelectors/compoundSelectors.test.ts b/src/state/compoundSelectors/compoundSelectors.test.ts index 0457d62e..448790d6 100644 --- a/src/state/compoundSelectors/compoundSelectors.test.ts +++ b/src/state/compoundSelectors/compoundSelectors.test.ts @@ -1,12 +1,12 @@ import { getCurrentUIData } from "."; import { initialState } from ".."; -import { ColorSettings } from "../selection/types"; +import { ColorSetting } from "../selection/types"; describe("getCurrentUIData", () => { it("returns empty array if default UI data has not been entered yet", () => { expect(getCurrentUIData(initialState)).toEqual([]); }); - it("returns selectedUIDisplayData if colorSetting is equal to ColorSettings.UserSelected", () => { + it("returns selectedUIDisplayData if colorSetting is equal to ColorSetting.UserSelected", () => { expect( getCurrentUIData({ ...initialState, @@ -22,7 +22,7 @@ describe("getCurrentUIData", () => { }, selection: { ...initialState.selection, - currentColorSettings: ColorSettings.UserSelected, + current: ColorSetting.UserSelected, selectedUIDisplayData: [ { name: "agent1", @@ -41,7 +41,7 @@ describe("getCurrentUIData", () => { ]); }); - it("returns defaultUIData if colorSetting is euqal to ColorSettings.Default", () => { + it("returns defaultUIData if colorSetting is euqal to ColorSetting.Default", () => { expect( getCurrentUIData({ ...initialState, @@ -57,7 +57,7 @@ describe("getCurrentUIData", () => { }, selection: { ...initialState.selection, - currentColorSettings: ColorSettings.Default, + currentColorSetting: ColorSetting.Default, selectedUIDisplayData: [ { name: "agent1", diff --git a/src/state/compoundSelectors/index.ts b/src/state/compoundSelectors/index.ts index e584ac52..ff632934 100644 --- a/src/state/compoundSelectors/index.ts +++ b/src/state/compoundSelectors/index.ts @@ -1,21 +1,17 @@ import { createSelector } from "reselect"; +import { UIDisplayData } from "@aics/simularium-viewer"; import { getDefaultUIDisplayData } from "../trajectory/selectors"; import { - getCurrentColorSettings, + getCurrentColorSetting, getSelectedUIDisplayData, } from "../selection/selectors"; -import { ColorSettings } from "../selection/types"; -import { UIDisplayData } from "@aics/simularium-viewer"; +import { ColorSetting } from "../selection/types"; export const getCurrentUIData = createSelector( - [ - getCurrentColorSettings, - getSelectedUIDisplayData, - getDefaultUIDisplayData, - ], + [getCurrentColorSetting, getSelectedUIDisplayData, getDefaultUIDisplayData], ( - colorSetting: ColorSettings, + colorSetting: ColorSetting, sessionData: UIDisplayData, defaultData: UIDisplayData ) => { @@ -23,7 +19,7 @@ export const getCurrentUIData = createSelector( if (!fileHasBeenParsed) { return []; } - if (colorSetting === ColorSettings.UserSelected) { + if (colorSetting === ColorSetting.UserSelected) { return sessionData; } return defaultData; diff --git a/src/state/selection/reducer.ts b/src/state/selection/reducer.ts index 7f6ce328..8b502b07 100644 --- a/src/state/selection/reducer.ts +++ b/src/state/selection/reducer.ts @@ -26,7 +26,7 @@ import { SetRecentColorsAction, SetSelectedAgentMetadataAction, SetSelectedUIDisplayDataAction, - ColorSettings, + ColorSetting, } from "./types"; export const initialState = { @@ -37,7 +37,7 @@ export const initialState = { recentColors: [], selectedAgentMetadata: {}, selectedUIDisplayData: [], - currentColorSettings: ColorSettings.Default, + currentColorSetting: ColorSetting.Default, }; const actionToConfigMap: TypeToDescriptionMap = { diff --git a/src/state/selection/selectors/basic.ts b/src/state/selection/selectors/basic.ts index 59382b57..671aab37 100644 --- a/src/state/selection/selectors/basic.ts +++ b/src/state/selection/selectors/basic.ts @@ -13,5 +13,5 @@ export const getSelectedAgentMetadata = (state: State) => state.selection.selectedAgentMetadata; export const getSelectedUIDisplayData = (state: State) => state.selection.selectedUIDisplayData; -export const getCurrentColorSettings = (state: State) => - state.selection.currentColorSettings; +export const getCurrentColorSetting = (state: State) => + state.selection.currentColorSetting; diff --git a/src/state/selection/types.ts b/src/state/selection/types.ts index 9bb0637f..dc1239bc 100644 --- a/src/state/selection/types.ts +++ b/src/state/selection/types.ts @@ -88,7 +88,7 @@ export interface SetSelectedUIDisplayDataAction { type: string; } -export enum ColorSettings { +export enum ColorSetting { UserSelected = "userSelected", Default = "default", }