Skip to content

Commit

Permalink
refactor: Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ShrimpCryptid committed Nov 22, 2024
1 parent 672c97a commit c10b915
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/state/image-dataset/actions.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ChangeImageDatasetTypeAction } from "./types";
import { ChangeImageDatasetTypeAction, LoadCsvDatasetAction } from "./types";
import { CHANGE_IMAGE_DATASET_TYPE, LOAD_CSV_DATASET } from "./constants";
import { ImageDataset } from "./types";

export function changeImageDatasetType(payload: ImageDataset): ChangeImageDatasetTypeAction {
return { payload, type: CHANGE_IMAGE_DATASET_TYPE };
}

export function loadCsvDataset(payload: string) {
export function loadCsvDataset(payload: string): LoadCsvDatasetAction {
return {
payload,
type: LOAD_CSV_DATASET,
Expand Down
7 changes: 4 additions & 3 deletions src/state/image-dataset/logics.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { createLogic } from "redux-logic";

import { ReduxLogicDeps } from "..";
import { LOAD_CSV_DATASET } from "./constants";
import CsvRequest, { DEFAULT_CSV_DATASET_KEY } from "./csv-dataset";
import { changeImageDatasetType } from "./actions";
import { receiveAvailableDatasets } from "../metadata/actions";
import { changeDataset } from "../selection/actions";
import { changeImageDatasetType } from "./actions";
import { LOAD_CSV_DATASET } from "./constants";
import CsvRequest, { DEFAULT_CSV_DATASET_KEY } from "./csv-dataset";

/**
* Parses a CSV file and opens it as a new image dataset.
Expand Down
1 change: 0 additions & 1 deletion src/state/image-dataset/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const actionToConfigMap: TypeToDescriptionMap = {
accepts: (action: AnyAction): action is ReceiveImageDatasetAction =>
action.type === CHANGE_IMAGE_DATASET_TYPE,
perform: (state: ImageDatasetStateBranch, action: ReceiveImageDatasetAction) => {
console.log("Changing dataset type", action.payload);
return {
...state,
imageDataset: action.payload,
Expand Down
4 changes: 3 additions & 1 deletion src/state/image-dataset/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ export interface ImageDataset {
getMeasuredFeatureDefs(): Promise<MeasuredFeatureDef[]>;
getFileInfoByCellId(id: string): Promise<FileInfo | undefined>;
getFileInfoByArrayOfCellIds(ids: string[]): Promise<(FileInfo | undefined)[]>;
} // ACTIONS
}

// ACTIONS

export interface ChangeImageDatasetTypeAction {
payload: ImageDataset;
Expand Down
2 changes: 2 additions & 0 deletions src/state/metadata/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ export interface DataForPlot {
labels: PerCellLabels;
}

// ACTIONS

export interface ReceiveAction {
payload: { [key: string]: any };
type: string;
Expand Down

0 comments on commit c10b915

Please sign in to comment.