From 8d97b921241db30903a06bd419d53629f3d4393a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20T=C3=B3th?= Date: Fri, 17 Nov 2023 11:23:23 +0100 Subject: [PATCH] Feature flag for Categories field. (#1583) --- .../components/content-list/contenttype-list.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/sensenet/src/components/content-list/contenttype-list.tsx b/apps/sensenet/src/components/content-list/contenttype-list.tsx index f440e0c16..3f5594daf 100644 --- a/apps/sensenet/src/components/content-list/contenttype-list.tsx +++ b/apps/sensenet/src/components/content-list/contenttype-list.tsx @@ -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 (