Skip to content

Commit

Permalink
Merge branch 'develop' into feat/1573-6430-search-more-types
Browse files Browse the repository at this point in the history
  • Loading branch information
kavics committed Nov 20, 2023
2 parents 39348ad + 8d97b92 commit b49f54e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion apps/sensenet/src/components/content-list/contenttype-list.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import React, { lazy, useState } from 'react'
import { PATHS } from '../../application-paths'
import { Switch } from '@sensenet/controls-react'
import { useRepository } from '@sensenet/hooks-react'

const ContentComponent = lazy(() => import(/* webpackChunkName: "content" */ '../content'))

const ContentTypeList: React.FC = () => {
const repository = useRepository()
const [showHiddenTypes, setShowHiddenTypes] = useState(false)
const categoryField = repository.schemas.getFieldTypeByName('Categories')
const isCategoryFieldAvailable = categoryField !== undefined

const renderBeforeGrid = () => {
if (!isCategoryFieldAvailable) {
return <></>
}

return (
<div style={{ marginTop: '20px', marginBottom: '20px' }}>
<label htmlFor="showHiddenTypes" style={{ marginRight: '10px' }}>
Expand All @@ -23,7 +32,9 @@ const ContentTypeList: React.FC = () => {
}

const contentTypeQuery =
"+TypeIs:'ContentType'" + (!showHiddenTypes ? ' -Categories:*HideByDefault*' : '') + ' .AUTOFILTERS:OFF'
"+TypeIs:'ContentType'" +
(isCategoryFieldAvailable && !showHiddenTypes ? ' -Categories:*HideByDefault*' : '') +
' .AUTOFILTERS:OFF'

return (
<ContentComponent
Expand Down

0 comments on commit b49f54e

Please sign in to comment.