chore: fix ContentType usage (#2353)
* chore: fix ContentType usage * chore: fix specs
This commit is contained in:
@@ -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,
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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>
|
||||
)}
|
||||
|
||||
@@ -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)))
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user