chore: fix ContentType usage (#2353)

* chore: fix ContentType usage

* chore: fix specs
This commit is contained in:
Karol Sójko
2023-07-12 13:53:29 +02:00
committed by GitHub
parent d057cdff84
commit 325737bfbd
247 changed files with 1092 additions and 1060 deletions

View File

@@ -1,4 +1,5 @@
import { DisplayStringForContentType } from '@standardnotes/snjs'
import { ContentType } from '@standardnotes/snjs'
import Button from '@/Components/Button/Button'
import { Fragment, FunctionComponent } from 'react'
import { Title, Text, Subtitle } from '@/Components/Preferences/PreferencesComponents/Content'
@@ -9,6 +10,12 @@ const ConfirmCustomPackage: FunctionComponent<{
component: AnyPackageType
callback: (confirmed: boolean) => void
}> = ({ component, callback }) => {
let contentTypeDisplayName = null
const contentTypeOrError = ContentType.create(component.content_type)
if (!contentTypeOrError.isFailed()) {
contentTypeDisplayName = contentTypeOrError.getValue().getDisplayName()
}
const fields = [
{
label: 'Name',
@@ -32,7 +39,7 @@ const ConfirmCustomPackage: FunctionComponent<{
},
{
label: 'Extension Type',
value: DisplayStringForContentType(component.content_type),
value: contentTypeDisplayName,
},
]

View File

@@ -13,9 +13,9 @@ import PreferencesSegment from '../../../../PreferencesComponents/PreferencesSeg
const loadExtensions = (application: WebApplication) =>
application.items.getItems([
ContentType.ActionsExtension,
ContentType.Component,
ContentType.Theme,
ContentType.TYPES.ActionsExtension,
ContentType.TYPES.Component,
ContentType.TYPES.Theme,
]) as AnyPackageType[]
type Props = {

View File

@@ -104,7 +104,7 @@ const Moments: FunctionComponent<Props> = ({ application }: Props) => {
<ItemSelectionDropdown
onSelection={selectTag}
placeholder="Select tag to save Moments to..."
contentTypes={[ContentType.Tag]}
contentTypes={[ContentType.TYPES.Tag]}
/>
</div>
)}

View File

@@ -33,7 +33,7 @@ const SmartViews = ({ application, featuresController }: Props) => {
)
useEffect(() => {
const disposeItemStream = application.streamItems([ContentType.SmartView], () => {
const disposeItemStream = application.streamItems([ContentType.TYPES.SmartView], () => {
setSmartViews(application.items.getSmartViews().filter((view) => !isSystemView(view)))
})