Skip to content

Commit

Permalink
Add state.editor.editingCardSimilarity state.
Browse files Browse the repository at this point in the history
Part of #646.
  • Loading branch information
jkomoros committed Nov 16, 2023
1 parent d785bff commit 7617d66
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/reducers/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const INITIAL_STATE : EditorState = {
imagePropertiesDialogIndex: 0,
imageBrowserDialogOpen: false,
imageBrowserDialogIndex: undefined,
editingCardSimilarity: {}
};

const app = (state : EditorState = INITIAL_STATE, action : SomeAction) : EditorState => {
Expand All @@ -117,6 +118,8 @@ const app = (state : EditorState = INITIAL_STATE, action : SomeAction) : EditorS
updatedFromContentEditable: {},
selectedTab: DEFAULT_TAB,
selectedEditorTab: DEFAULT_EDITOR_TAB,
//Throw out any editing card similarity
editingCardSimilarity: {}
};
case EDITING_FINISH:
return {
Expand All @@ -129,6 +132,7 @@ const app = (state : EditorState = INITIAL_STATE, action : SomeAction) : EditorS
cardExtractionVersion: -1,
substantive:false,
updatedFromContentEditable: {},
editingCardSimilarity: {}
};
case EDITING_EDITOR_MINIMIZED:
return {
Expand Down
1 change: 1 addition & 0 deletions src/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ export const selectPermissionsPendingPermissionType = (state : State) => state.p
const selectTweets = (state : State) => state.data ? state.data.tweets : {};
export const selectTweetsLoading = (state : State) => state.data ? state.data.tweetsLoading : false;
export const selectCardSimilarity = (state : State) => state.data ? state.data.cardSimilarity : {};
export const selectEditingCardSimilarity = (state : State) => state.editor ? state.editor.editingCardSimilarity : {};
export const selectActivePreviewCardId = (state : State) => state.app ? state.app.hoverCardId : '';
export const selectPreviewCardX = (state : State) => state.app ? state.app.hoverX : 0;
export const selectPreviewCardY = (state : State) => state.app ? state.app.hoverY : 0;
Expand Down
4 changes: 3 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@ export type DataState = {
pendingNewCardIDToNavigateTo: CardID,
//When we're doing card similarity based on embedings, we have to reach out
//to a cloud function. This is where we store that information.
cardSimilarity: CardSimilarityMap;
cardSimilarity: CardSimilarityMap
}

export type EditorState = {
Expand Down Expand Up @@ -1294,6 +1294,8 @@ export type EditorState = {
imageBrowserDialogOpen: boolean,
//Undefined communicates 'add to end'
imageBrowserDialogIndex?: number,
//The same as data.cardSimilarity, but for the editing card
editingCardSimilarity: SortExtra
}

export type FindState = {
Expand Down

0 comments on commit 7617d66

Please sign in to comment.