Skip to content

Commit

Permalink
Add an action type for updating editing card similarity.
Browse files Browse the repository at this point in the history
Part of #646.
  • Loading branch information
jkomoros committed Nov 16, 2023
1 parent 7617d66 commit 342ce39
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export const EDITING_OPEN_IMAGE_BROWSER_DIALOG = 'EDITING_OPEN_IMAGE_BROWSER_DIA
export const EDITING_CLOSE_IMAGE_BROWSER_DIALOG = 'EDITING_CLOSE_IMAGE_BROWSER_DIALOG';
export const EDITING_UPDATE_UNDERLYING_CARD = 'EDITING_UPDATE_UNDERLYING_CARD';
export const EDITING_MERGE_OVERSHADOWED_CHANGES = 'EDITING_MERGE_OVERSHADOWED_CHANGES';
export const EDITING_UPDATE_SIMILAR_CARDS = 'EDITING_UPDATE_SIMILAR_CARDS';
//Find
export const FIND_DIALOG_OPEN = OPEN;
export const FIND_DIALOG_CLOSE ='FIND_DIALOG_CLOSE';
Expand Down Expand Up @@ -658,6 +659,11 @@ type ActionEditingMergeOvershadowedChanges = {
diff: CardDiff
};

type ActionEditingUpdateSimilarCards = {
type: typeof EDITING_UPDATE_SIMILAR_CARDS,
similarity: SortExtra
};

type ActionFindDialogOpen = {
type: typeof FIND_DIALOG_OPEN,
query: string,
Expand Down Expand Up @@ -923,6 +929,7 @@ export type SomeAction = ActionAIRequestStarted
| ActionEditingCloseImageBrowserDialog
| ActionEditingUpdateUnderlyingCard
| ActionEditingMergeOvershadowedChanges
| ActionEditingUpdateSimilarCards
| ActionFindDialogOpen
| ActionFindDialogClose
| ActionFindUpdateQuery
Expand Down
6 changes: 6 additions & 0 deletions src/reducers/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
EDITING_CLOSE_IMAGE_BROWSER_DIALOG,
EDITING_UPDATE_UNDERLYING_CARD,
EDITING_MERGE_OVERSHADOWED_CHANGES,
EDITING_UPDATE_SIMILAR_CARDS,
SomeAction,
} from '../actions.js';

Expand Down Expand Up @@ -410,6 +411,11 @@ const app = (state : EditorState = INITIAL_STATE, action : SomeAction) : EditorS
//The state could have changed e.g. references or body.
cardExtractionVersion: state.cardExtractionVersion + 1,
};
case EDITING_UPDATE_SIMILAR_CARDS:
return {
...state,
editingCardSimilarity: action.similarity
};
default:
return state;
}
Expand Down

0 comments on commit 342ce39

Please sign in to comment.