Move template management to settings (#5811)

This commit is contained in:
Tom Moor
2023-09-10 15:46:12 -04:00
committed by GitHub
parent ac068c0c07
commit 0856f5f6ae
32 changed files with 432 additions and 267 deletions

View File

@@ -14,7 +14,7 @@ import useCurrentTeam from "~/hooks/useCurrentTeam";
import usePolicy from "~/hooks/usePolicy";
import useStores from "~/hooks/useStores";
import { MenuItem } from "~/types";
import { newDocumentPath } from "~/utils/routeHelpers";
import { newTemplatePath } from "~/utils/routeHelpers";
function NewTemplateMenu() {
const menu = useMenuState({
@@ -24,6 +24,11 @@ function NewTemplateMenu() {
const team = useCurrentTeam();
const { collections, policies } = useStores();
const can = usePolicy(team);
React.useEffect(() => {
void collections.fetchPage({
limit: 100,
});
}, [collections]);
const items = React.useMemo(
() =>
@@ -33,9 +38,7 @@ function NewTemplateMenu() {
if (can.update) {
filtered.push({
type: "route",
to: newDocumentPath(collection.id, {
template: true,
}),
to: newTemplatePath(collection.id),
title: <CollectionName>{collection.name}</CollectionName>,
icon: <CollectionIcon collection={collection} />,
});