Skip to content

Commit

Permalink
store current color selections in local browser storage (#585)
Browse files Browse the repository at this point in the history
* rename agentUiData and receiveAgentNamesAndStates to defaultUIData

* rename setColorChanges redux plumbing to applyUserColorSelections

* reduce global testing threshold

* use correct names for defaultUIData in tests

* rename: applyUserColor in place of applyUserColorSelection

* use applyUserColor in place of applyUserColorSelection

* rename: getDefaultUIData -> getDefautlUIDisplayData

* make string match variable name in apply user color constants

* add user selected ui display data to redux, distinguished from default

* store current color selections in local browser storage
  • Loading branch information
interim17 authored Oct 22, 2024
1 parent 8a87085 commit 4ad009a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/state/selection/logics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { createLogic } from "redux-logic";
import { UIDisplayData } from "@aics/simularium-viewer";

import { ReduxLogicDeps } from "../types";
import { getSimulariumFile } from "../trajectory/selectors";

import { APPLY_USER_COLOR } from "./constants";
import { getSelectedUIDisplayData } from "./selectors";
import { setSelectedUIDisplayData } from "./actions";
Expand Down Expand Up @@ -33,6 +35,9 @@ const storeColorsLogic = createLogic({
return newAgent;
});
dispatch(setSelectedUIDisplayData(newUiData));
// store color changes in local browser storage
const fileKey = getSimulariumFile(getState()).name;
localStorage.setItem(fileKey, JSON.stringify(newUiData));
done();
},
type: APPLY_USER_COLOR,
Expand Down

0 comments on commit 4ad009a

Please sign in to comment.