diff --git a/src/components/card-editor.ts b/src/components/card-editor.ts index d8458b73..e8349de2 100644 --- a/src/components/card-editor.ts +++ b/src/components/card-editor.ts @@ -117,8 +117,6 @@ import { TEXT_FIELD_TITLE, REFERENCE_TYPE_ACK, REFERENCE_TYPE_CONCEPT, - TAB_CONTENT, - TAB_CONFIG, TEXT_FIELD_TYPES_EDITABLE } from '../type_constants.js'; @@ -148,7 +146,8 @@ import { State, ReferenceType, CardFieldTypeEditable, - editorContentTab + editorContentTab, + editorTab } from '../types.js'; import { @@ -163,7 +162,10 @@ import { ARROW_UP_ICON, ARROW_RIGHT_ICON } from './my-icons'; -import { titleForEditingCardWithAI } from '../actions/ai.js'; + +import { + titleForEditingCardWithAI +} from '../actions/ai.js'; @customElement('card-editor') class CardEditor extends connect(store)(LitElement) { @@ -449,7 +451,7 @@ class CardEditor extends connect(store)(LitElement) {
-
+
@@ -471,7 +473,7 @@ class CardEditor extends connect(store)(LitElement) {
-
+
@@ -754,8 +756,8 @@ class CardEditor extends connect(store)(LitElement) {
` : html`
- - + +
`}
diff --git a/src/reducers/editor.ts b/src/reducers/editor.ts index 0fb4e330..e4ac3898 100644 --- a/src/reducers/editor.ts +++ b/src/reducers/editor.ts @@ -41,10 +41,6 @@ import { SomeAction, } from '../actions.js'; -import { - TAB_CONFIG -} from '../type_constants.js'; - import { SET_PENDING_SLUG } from '../actions.js'; @@ -83,10 +79,11 @@ import { import { EditorContentTab, EditorState, + EditorTab, ImageInfoStringProperty } from '../types.js'; -const DEFAULT_TAB = TAB_CONFIG; +const DEFAULT_TAB : EditorTab = 'config'; const DEFAULT_EDITOR_TAB : EditorContentTab = 'content'; const INITIAL_STATE : EditorState = { diff --git a/src/type_constants.ts b/src/type_constants.ts index 96695ec8..f58826be 100644 --- a/src/type_constants.ts +++ b/src/type_constants.ts @@ -97,15 +97,6 @@ export const REFERENCE_TYPE_TYPES = { [REFERENCE_TYPE_CITATION_PERSON]: true }; -export const TAB_CONTENT = 'content'; -export const TAB_CONFIG = 'config'; - -//Drives EditorTab type -export const EDITOR_TAB_TYPES = { - [TAB_CONTENT]: true, - [TAB_CONFIG]: true -}; - export const CARDS_COLLECTION = 'cards'; export const CARD_UPDATES_COLLECTION = 'updates'; export const SECTION_UPDATES_COLLECTION = 'updates'; diff --git a/src/types.ts b/src/types.ts index b48161b1..eac41e00 100644 --- a/src/types.ts +++ b/src/types.ts @@ -11,7 +11,6 @@ import { TEXT_FIELD_TYPES, REFERENCE_TYPE_TYPES, TEXT_FIELD_TYPES_EDITABLE, - EDITOR_TAB_TYPES, FIND_CARD_TO_LINK, FIND_CARD_TO_PERMISSION, FIND_CARD_TO_REFERENCE, @@ -395,7 +394,13 @@ export type ConfigurableFilterConfigurationMap = { }; //TODO: this name is confusing, in the state this is just called tab -export type EditorTab = keyof(typeof EDITOR_TAB_TYPES); + +const editorTabSchema = z.enum([ + 'content', + 'config' +]); + +export type EditorTab = z.infer; const editorContentTabSchema = z.enum([ 'content', @@ -1330,4 +1335,5 @@ export type State = { //will be used in a generic string context and want type-checking to verify it //is part of the enum. export const setName = (input : SetName) => input; +export const editorTab = (input : EditorTab) => input; export const editorContentTab = (input : EditorContentTab) => input; \ No newline at end of file