diff --git a/.changeset/kind-islands-repeat.md b/.changeset/kind-islands-repeat.md new file mode 100644 index 00000000000..bdf1b619982 --- /dev/null +++ b/.changeset/kind-islands-repeat.md @@ -0,0 +1,5 @@ +--- +'@keystone-next/keystone': patch +--- + +Fixed the home page of the Admin UI not respecting `ui.hideCreate` diff --git a/packages/keystone/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/HomePage/index.tsx b/packages/keystone/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/HomePage/index.tsx index dcec66cd964..9fc65cf4b2c 100644 --- a/packages/keystone/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/HomePage/index.tsx +++ b/packages/keystone/src/___internal-do-not-use-will-break-in-patch/admin-ui/pages/HomePage/index.tsx @@ -17,6 +17,7 @@ import { useRouter, Link } from '../../../../admin-ui/router'; type ListCardProps = { listKey: string; + hideCreate: boolean; count: | { type: 'success'; count: number } | { type: 'no-access' } @@ -24,7 +25,7 @@ type ListCardProps = { | { type: 'loading' }; }; -const ListCard = ({ listKey, count }: ListCardProps) => { +const ListCard = ({ listKey, count, hideCreate }: ListCardProps) => { const { colors, palette, radii, spacing } = useTheme(); const list = useList(listKey); const [isCreateModalOpen, setIsCreateModalOpen] = useState(false); @@ -65,16 +66,18 @@ const ListCard = ({ listKey, count }: ListCardProps) => { 'No access' )} - { - setIsCreateModalOpen(true); - }} - > - - Create {list.singular} - + {hideCreate === false && ( + { + setIsCreateModalOpen(true); + }} + > + + Create {list.singular} + + )} { adminMeta { lists { key - fields { - path - createView { - fieldMode - } - } + hideCreate } } } @@ -191,6 +189,10 @@ export const HomePage = () => { : { type: 'success', count: data[key] } : { type: 'loading' } } + hideCreate={ + data?.keystone.adminMeta.lists.find((list: any) => list.key === key) + ?.hideCreate ?? false + } key={key} listKey={key} />