refactor: component manager usecases (#2354)

This commit is contained in:
Mo
2023-07-13 05:46:52 -05:00
committed by GitHub
parent ecc5b5e503
commit 2c68ea1d76
52 changed files with 1454 additions and 1078 deletions

View File

@@ -1,12 +1,9 @@
import { ComponentOrNativeFeature, FeatureIdentifier, ThemeFeatureDescription } from '@standardnotes/snjs'
import { UIFeature, FeatureIdentifier, ThemeFeatureDescription } from '@standardnotes/snjs'
const isDarkModeTheme = (theme: ComponentOrNativeFeature<ThemeFeatureDescription>) =>
const isDarkModeTheme = (theme: UIFeature<ThemeFeatureDescription>) =>
theme.featureIdentifier === FeatureIdentifier.DarkTheme
export const sortThemes = (
a: ComponentOrNativeFeature<ThemeFeatureDescription>,
b: ComponentOrNativeFeature<ThemeFeatureDescription>,
) => {
export const sortThemes = (a: UIFeature<ThemeFeatureDescription>, b: UIFeature<ThemeFeatureDescription>) => {
const aIsLayerable = a.layerable
const bIsLayerable = b.layerable

View File

@@ -5,7 +5,7 @@ import {
GetIframeAndNativeEditors,
ComponentArea,
GetSuperNoteFeature,
ComponentOrNativeFeature,
UIFeature,
IframeComponentFeatureDescription,
} from '@standardnotes/snjs'
import { EditorMenuGroup } from '@/Components/NotesOptions/EditorMenuGroup'
@@ -30,7 +30,7 @@ const insertNativeEditorsInMap = (map: NoteTypeToEditorRowsMap, application: Web
const noteType = editorFeature.note_type
map[noteType].push({
isEntitled: application.features.getFeatureStatus(editorFeature.identifier) === FeatureStatus.Entitled,
uiFeature: new ComponentOrNativeFeature(editorFeature),
uiFeature: new UIFeature(editorFeature),
})
}
}
@@ -51,7 +51,7 @@ const insertInstalledComponentsInMap = (map: NoteTypeToEditorRowsMap, applicatio
const noteType = editor.noteType
const editorItem: EditorMenuItem = {
uiFeature: new ComponentOrNativeFeature<IframeComponentFeatureDescription>(editor),
uiFeature: new UIFeature<IframeComponentFeatureDescription>(editor),
isEntitled: application.features.getFeatureStatus(editor.identifier) === FeatureStatus.Entitled,
}