import { escape } from "../../../deps/std.ts";
import { getPath } from "../../utils/path.ts";
import { prepareField } from "../../utils/data.ts";
import breadcrumb from "../breadcrumb.ts";
import type Collection from "../../collection.ts";
import type { CMSContent, Version } from "../../../types.ts";
interface Props {
options: CMSContent;
collection: Collection;
version?: Version;
}
export default async function template(
{ options, collection, version }: Props,
) {
const { basePath } = options;
const fields = await Promise.all(collection.fields.map(async (field) => `
<${field.tag}
data-nameprefix="changes"
data-field="${escape(JSON.stringify(await prepareField(field)))}"
>
${field.tag}>
`));
return `
${
breadcrumb(options, version, [
collection.name,
getPath(basePath, "collection", collection.name),
], "New file")
}
Creating new file