From 0ed93977bc6f9381d1311fd719a5b4a36644c71f Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Sat, 9 Sep 2023 16:56:58 +0200 Subject: [PATCH] #650 - Use the templates repo --- package-lock.json | 68 +++ package.json | 276 ++++++------ src/constants/FrameworkTemplates.ts | 12 - src/constants/Templates.ts | 3 + src/constants/index.ts | 2 +- .../components/Steps/StepsToGetStarted.tsx | 394 +++++++++--------- src/helpers/SettingsHelper.ts | 9 +- src/listeners/dashboard/SettingsListener.ts | 66 +-- src/models/FrameworkTemplate.ts | 8 - src/models/Template.ts | 8 + src/models/index.ts | 2 +- .../.frontmatter/starlight/aside.json | 41 -- .../.frontmatter/starlight/contenttypes.json | 80 ---- .../.frontmatter/starlight/pagefolders.json | 14 - templates/astro-starlight/frontmatter.json | 14 - 15 files changed, 489 insertions(+), 508 deletions(-) delete mode 100644 src/constants/FrameworkTemplates.ts create mode 100644 src/constants/Templates.ts delete mode 100644 src/models/FrameworkTemplate.ts create mode 100644 src/models/Template.ts delete mode 100644 templates/astro-starlight/.frontmatter/starlight/aside.json delete mode 100644 templates/astro-starlight/.frontmatter/starlight/contenttypes.json delete mode 100644 templates/astro-starlight/.frontmatter/starlight/pagefolders.json delete mode 100644 templates/astro-starlight/frontmatter.json diff --git a/package-lock.json b/package-lock.json index fff5056b..340b476c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -54,6 +54,7 @@ "downshift": "6.0.6", "eslint": "^8.33.0", "fuse.js": "6.5.3", + "github-directory-downloader": "^1.3.6", "glob": "7.1.6", "gray-matter": "4.0.3", "html-loader": "1.3.2", @@ -2146,6 +2147,15 @@ "dev": true, "license": "MIT" }, + "node_modules/at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/attr-accept": { "version": "2.2.2", "dev": true, @@ -4912,6 +4922,21 @@ "dev": true, "license": "MIT" }, + "node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/fs-monkey": { "version": "1.0.3", "dev": true, @@ -5004,6 +5029,20 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/github-directory-downloader": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/github-directory-downloader/-/github-directory-downloader-1.3.6.tgz", + "integrity": "sha512-k43h2cjdE5FIpM+0aYuK4DTdTZ2FcopgbY8kvzR2hihdq/gRyINrLDpLlFrkVID6sTi0vSaBqVJm7goLcbBxQg==", + "dev": true, + "dependencies": { + "fs-extra": "^9.0.1", + "node-fetch": "^2.6.1", + "yargs-parser": "^20.2.4" + }, + "bin": { + "github-directory-downloader": "bin/cli.js" + } + }, "node_modules/github-from-package": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", @@ -14669,6 +14708,12 @@ "version": "0.4.0", "dev": true }, + "at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true + }, "attr-accept": { "version": "2.2.2", "dev": true @@ -16606,6 +16651,18 @@ "version": "1.0.0", "dev": true }, + "fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, "fs-monkey": { "version": "1.0.3", "dev": true @@ -16660,6 +16717,17 @@ "get-intrinsic": "^1.1.1" } }, + "github-directory-downloader": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/github-directory-downloader/-/github-directory-downloader-1.3.6.tgz", + "integrity": "sha512-k43h2cjdE5FIpM+0aYuK4DTdTZ2FcopgbY8kvzR2hihdq/gRyINrLDpLlFrkVID6sTi0vSaBqVJm7goLcbBxQg==", + "dev": true, + "requires": { + "fs-extra": "^9.0.1", + "node-fetch": "^2.6.1", + "yargs-parser": "^20.2.4" + } + }, "github-from-package": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", diff --git a/package.json b/package.json index 5a83e2a6..b5e24b60 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "color": "#0e131f", "theme": "dark" }, - "badges": [{ + "badges": [ + { "description": "version", "url": "https://img.shields.io/github/package-json/v/estruyf/vscode-front-matter?color=green&label=vscode-front-matter&style=flat-square", "href": "https://github.com/estruyf/vscode-front-matter" @@ -70,7 +71,8 @@ "**/.frontmatter/config/*.json": "jsonc" } }, - "keybindings": [{ + "keybindings": [ + { "command": "frontMatter.dashboard", "key": "alt+d" }, @@ -88,20 +90,24 @@ } ], "viewsContainers": { - "activitybar": [{ - "id": "frontmatter-explorer", - "title": "Front Matter", - "icon": "assets/frontmatter-short-min.svg" - }] + "activitybar": [ + { + "id": "frontmatter-explorer", + "title": "Front Matter", + "icon": "assets/frontmatter-short-min.svg" + } + ] }, "views": { - "frontmatter-explorer": [{ - "id": "frontMatter.explorer", - "name": "Front Matter", - "icon": "assets/frontmatter-short-min.svg", - "contextualTitle": "Front Matter", - "type": "webview" - }] + "frontmatter-explorer": [ + { + "id": "frontMatter.explorer", + "name": "Front Matter", + "icon": "assets/frontmatter-short-min.svg", + "contextualTitle": "Front Matter", + "type": "webview" + } + ] }, "configuration": { "title": "%settings.configuration.title%", @@ -164,7 +170,8 @@ "frontMatter.content.defaultFileType": { "type": "string", "default": "md", - "oneOf": [{ + "oneOf": [ + { "enum": [ "md", "mdx" @@ -180,7 +187,8 @@ "frontMatter.content.defaultSorting": { "type": "string", "default": "", - "oneOf": [{ + "oneOf": [ + { "enum": [ "LastModifiedAsc", "LastModifiedDesc", @@ -527,7 +535,8 @@ "command": { "$id": "#scriptCommand", "type": "string", - "anyOf": [{ + "anyOf": [ + { "enum": [ "node", "bash", @@ -727,7 +736,8 @@ "title", "file" ], - "anyOf": [{ + "anyOf": [ + { "required": [ "schema" ] @@ -781,7 +791,8 @@ "id", "path" ], - "anyOf": [{ + "anyOf": [ + { "required": [ "schema" ] @@ -1149,7 +1160,8 @@ "default": "", "description": "%setting.frontMatter.taxonomy.contentTypes.items.properties.fields.items.properties.taxonomyId.description%", "not": { - "anyOf": [{ + "anyOf": [ + { "const": "" }, { @@ -1343,7 +1355,8 @@ "type", "name" ], - "allOf": [{ + "allOf": [ + { "if": { "properties": { "type": { @@ -1529,48 +1542,51 @@ "fields" ] }, - "default": [{ - "name": "default", - "pageBundle": false, - "fields": [{ - "title": "Title", - "name": "title", - "type": "string" - }, - { - "title": "Description", - "name": "description", - "type": "string" - }, - { - "title": "Publishing date", - "name": "date", - "type": "datetime", - "default": "{{now}}", - "isPublishDate": true - }, - { - "title": "Content preview", - "name": "preview", - "type": "image" - }, - { - "title": "Is in draft", - "name": "draft", - "type": "boolean" - }, - { - "title": "Tags", - "name": "tags", - "type": "tags" - }, - { - "title": "Categories", - "name": "categories", - "type": "categories" - } - ] - }], + "default": [ + { + "name": "default", + "pageBundle": false, + "fields": [ + { + "title": "Title", + "name": "title", + "type": "string" + }, + { + "title": "Description", + "name": "description", + "type": "string" + }, + { + "title": "Publishing date", + "name": "date", + "type": "datetime", + "default": "{{now}}", + "isPublishDate": true + }, + { + "title": "Content preview", + "name": "preview", + "type": "image" + }, + { + "title": "Is in draft", + "name": "draft", + "type": "boolean" + }, + { + "title": "Tags", + "name": "tags", + "type": "tags" + }, + { + "title": "Categories", + "name": "categories", + "type": "categories" + } + ] + } + ], "scope": "Taxonomy" }, "frontMatter.taxonomy.customTaxonomy": { @@ -1583,7 +1599,8 @@ "type": "string", "description": "%setting.frontMatter.taxonomy.customTaxonomy.items.properties.id.description%", "not": { - "anyOf": [{ + "anyOf": [ + { "const": "" }, { @@ -1769,7 +1786,8 @@ } } }, - "commands": [{ + "commands": [ + { "command": "frontMatter.project.switch", "title": "%command.frontMatter.project.switch%", "category": "Front Matter", @@ -2104,12 +2122,15 @@ "category": "Front Matter" } ], - "submenus": [{ - "id": "frontmatter.submenu", - "label": "Front Matter" - }], + "submenus": [ + { + "id": "frontmatter.submenu", + "label": "Front Matter" + } + ], "menus": { - "editor/title": [{ + "editor/title": [ + { "command": "frontMatter.markup.heading", "group": "navigation@-133", "when": "frontMatter:file:isValid == true && frontMatter:markdown:wysiwyg" @@ -2190,11 +2211,14 @@ "when": "resourceFilename == 'frontmatter.json'" } ], - "explorer/context": [{ - "submenu": "frontmatter.submenu", - "group": "frontmatter@1" - }], - "frontmatter.submenu": [{ + "explorer/context": [ + { + "submenu": "frontmatter.submenu", + "group": "frontmatter@1" + } + ], + "frontmatter.submenu": [ + { "command": "frontMatter.createFromTemplate", "when": "explorerResourceIsFolder", "group": "frontmatter@1" @@ -2210,7 +2234,8 @@ "group": "frontmatter@3" } ], - "commandPalette": [{ + "commandPalette": [ + { "command": "frontMatter.init", "when": "frontMatterCanInit" }, @@ -2355,7 +2380,8 @@ "when": "frontMatter:file:isValid == true" } ], - "view/title": [{ + "view/title": [ + { "command": "frontMatter.chatbot", "group": "navigation@0", "when": "view == frontMatter.explorer" @@ -2386,52 +2412,57 @@ } ] }, - "grammars": [{ - "path": "./syntaxes/hugo.tmLanguage.json", - "scopeName": "frontmatter.markdown.hugo", - "injectTo": [ - "text.html.markdown" - ] - }], - "walkthroughs": [{ - "id": "frontmatter.welcome", - "title": "Get started with Front Matter", - "description": "Discover the features of Front Matter and learn how to use the CMS for your SSG or static site.", - "steps": [{ - "id": "frontmatter.welcome.init", - "title": "Get started", - "description": "Initial steps to get started.\n[Open dashboard](command:frontMatter.dashboard)", - "media": { - "markdown": "assets/walkthrough/get-started.md" + "grammars": [ + { + "path": "./syntaxes/hugo.tmLanguage.json", + "scopeName": "frontmatter.markdown.hugo", + "injectTo": [ + "text.html.markdown" + ] + } + ], + "walkthroughs": [ + { + "id": "frontmatter.welcome", + "title": "Get started with Front Matter", + "description": "Discover the features of Front Matter and learn how to use the CMS for your SSG or static site.", + "steps": [ + { + "id": "frontmatter.welcome.init", + "title": "Get started", + "description": "Initial steps to get started.\n[Open dashboard](command:frontMatter.dashboard)", + "media": { + "markdown": "assets/walkthrough/get-started.md" + }, + "completionEvents": [ + "onContext:frontMatterInitialized" + ] }, - "completionEvents": [ - "onContext:frontMatterInitialized" - ] - }, - { - "id": "frontmatter.welcome.documentation", - "title": "Documentation", - "description": "Check out the documentation for Front Matter.\n[View our documentation](https://frontmatter.codes/docs)", - "media": { - "markdown": "assets/walkthrough/documentation.md" + { + "id": "frontmatter.welcome.documentation", + "title": "Documentation", + "description": "Check out the documentation for Front Matter.\n[View our documentation](https://frontmatter.codes/docs)", + "media": { + "markdown": "assets/walkthrough/documentation.md" + }, + "completionEvents": [ + "onLink:https://frontmatter.codes/docs" + ] }, - "completionEvents": [ - "onLink:https://frontmatter.codes/docs" - ] - }, - { - "id": "frontmatter.welcome.supporter", - "title": "Support the project", - "description": "Become a supporter.\n[Support the project](https://github.com/sponsors/estruyf)", - "media": { - "markdown": "assets/walkthrough/support-the-project.md" - }, - "completionEvents": [ - "onLink:https://github.com/sponsors/estruyf" - ] - } - ] - }] + { + "id": "frontmatter.welcome.supporter", + "title": "Support the project", + "description": "Become a supporter.\n[Support the project](https://github.com/sponsors/estruyf)", + "media": { + "markdown": "assets/walkthrough/support-the-project.md" + }, + "completionEvents": [ + "onLink:https://github.com/sponsors/estruyf" + ] + } + ] + } + ] }, "scripts": { "dev:ext": "npm run clean && npm run localization:generate && npm-run-all --parallel watch:*", @@ -2504,6 +2535,7 @@ "downshift": "6.0.6", "eslint": "^8.33.0", "fuse.js": "6.5.3", + "github-directory-downloader": "^1.3.6", "glob": "7.1.6", "gray-matter": "4.0.3", "html-loader": "1.3.2", @@ -2565,4 +2597,4 @@ "vsce": { "dependencies": false } -} \ No newline at end of file +} diff --git a/src/constants/FrameworkTemplates.ts b/src/constants/FrameworkTemplates.ts deleted file mode 100644 index 809d28ca..00000000 --- a/src/constants/FrameworkTemplates.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { FrameworkTemplate } from '../models'; - -export const FrameworkTemplates: FrameworkTemplate[] = [ - { - id: 'astro-starlight', - framework: 'astro', - name: 'Starlight', - description: 'Adds the Astro Starlight configuration for Front Matter CMS', - template: 'astro-starlight', - showDashboardOnComplete: true - } -]; diff --git a/src/constants/Templates.ts b/src/constants/Templates.ts new file mode 100644 index 00000000..d982c645 --- /dev/null +++ b/src/constants/Templates.ts @@ -0,0 +1,3 @@ +export const Templates = { + url: 'https://frontmatter.github.io/templates/templates.json' +}; diff --git a/src/constants/index.ts b/src/constants/index.ts index 0a06d6eb..e4a8731d 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -6,7 +6,6 @@ export * from './Extension'; export * from './ExtensionState'; export * from './Features'; export * from './FrameworkDetectors'; -export * from './FrameworkTemplates'; export * from './GeneralCommands'; export * from './Links'; export * from './LocalStore'; @@ -17,6 +16,7 @@ export * from './SentryIgnore'; export * from './Snippet'; export * from './StaticFolderPlaceholder'; export * from './TelemetryEvent'; +export * from './Templates'; export * from './charCode'; export * from './charMap'; export * from './context'; diff --git a/src/dashboardWebView/components/Steps/StepsToGetStarted.tsx b/src/dashboardWebView/components/Steps/StepsToGetStarted.tsx index d667d965..681a7699 100644 --- a/src/dashboardWebView/components/Steps/StepsToGetStarted.tsx +++ b/src/dashboardWebView/components/Steps/StepsToGetStarted.tsx @@ -7,7 +7,7 @@ import { Step } from './Step'; import { useMemo, useState } from 'react'; import { Menu } from '@headlessui/react'; import { MenuItem } from '../Menu'; -import { ContentFolder, Framework, FrameworkTemplate, StaticFolder } from '../../../models'; +import { ContentFolder, Framework, StaticFolder, Template } from '../../../models'; import { ChevronDownIcon } from '@heroicons/react/outline'; import { FrameworkDetectors } from '../../../constants/FrameworkDetectors'; import { join } from 'path'; @@ -15,7 +15,7 @@ import useThemeColors from '../../hooks/useThemeColors'; import * as l10n from '@vscode/l10n'; import { LocalizationKey } from '../../../localization'; import { SelectItem } from './SelectItem'; -import { FrameworkTemplates } from '../../../constants'; +import { Templates } from '../../../constants'; export interface IStepsToGetStartedProps { settings: Settings; @@ -52,6 +52,7 @@ export const StepsToGetStarted: React.FunctionComponent }: React.PropsWithChildren) => { const [framework, setFramework] = useState(null); const [taxImported, setTaxImported] = useState(false); + const [templates, setTemplates] = useState([]); const { getColors } = useThemeColors(); const frameworks: Framework[] = FrameworkDetectors.map((detector: any) => detector.framework); @@ -69,7 +70,7 @@ export const StepsToGetStarted: React.FunctionComponent Messenger.send(DashboardMessage.addAssetsFolder, folder); } - const triggerTemplate = (template: FrameworkTemplate) => { + const triggerTemplate = (template: Template) => { messageHandler.request(DashboardMessage.triggerTemplate, template).then((result) => { if (result) { reload(); @@ -93,205 +94,207 @@ export const StepsToGetStarted: React.FunctionComponent setTaxImported(true); }; - const templates = useMemo(() => { - if (!settings.crntFramework) { + const crntTemplates = useMemo(() => { + if (!templates || templates.length === 0 || !settings.crntFramework) { return []; } - return FrameworkTemplates.filter((t) => t.framework === settings.crntFramework); - }, [settings.crntFramework]) + return templates.filter((t) => t.type === settings.crntFramework); + }, [templates, settings.crntFramework]) - const steps = [ - { - id: `welcome-init`, - name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedInitializeProjectName), - description: <>{l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedInitializeProjectDescription)}, - show: true, - status: settings.initialized ? Status.Completed : Status.NotStarted, - onClick: settings.initialized - ? undefined - : () => { - Messenger.send(DashboardMessage.initializeProject); - } - }, - { - id: `welcome-framework`, - name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedFrameworkName), - description: ( -
+ const steps = useMemo(() => ( + [ + { + id: `welcome-init`, + name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedInitializeProjectName), + description: <>{l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedInitializeProjectDescription)}, + show: true, + status: settings.initialized ? Status.Completed : Status.NotStarted, + onClick: settings.initialized + ? undefined + : () => { + Messenger.send(DashboardMessage.initializeProject); + } + }, + { + id: `welcome-framework`, + name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedFrameworkName), + description: (
- {l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedFrameworkDescription)} -
- -
- - {framework ? framework : l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedFrameworkSelect)} - + {l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedFrameworkDescription)}
- -
- setFrameworkAndSendMessage(value)} - /> + +
+ + {framework ? framework : l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedFrameworkSelect)} + +
-
- - {frameworks.map((f) => ( + +
setFrameworkAndSendMessage(value)} /> - ))} -
-
-
-
- ), - show: true, - status: settings.crntFramework ? Status.Completed : Status.NotStarted, - onClick: undefined - }, - { - id: `welcome-template`, - name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedTemplateName), - description: ( -
-
{l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedTemplateDescription)}
-
- { - templates && (templates || []).map(template => ( - triggerTemplate(template)} /> - )) - } + +
+ + {frameworks.map((f) => ( + setFrameworkAndSendMessage(value)} + /> + ))} +
+ +
- - ), - show: (templates || []).length > 0, - status: Status.Active, - }, - { - id: `welcome-assets`, - name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedAssetsFolderName), - description: ( -
-
{l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedAssetsFolderDescription)}
-
- addAssetFolder(`public`)} /> - - addAssetFolder({ - "path": "src/assets", - "relative": true - })} /> - -

- {l10n.t(LocalizationKey.commonInformation)}: {l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedAssetsFolderOtherDescription)}

-
-
- ), - show: settings.crntFramework === 'astro' || framework === 'astro', - status: settings.initialized && settings.staticFolder && settings.staticFolder !== "/" ? Status.Completed : Status.NotStarted, - }, - { - id: `welcome-content-folders`, - name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedContentFoldersName), - description: ( - <> -

- {l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedContentFoldersDescription)} -

- - {settings?.dashboardState?.welcome?.contentFolders?.length > 0 && ( -
-
{l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedContentFoldersLabel)}
-
- {settings?.dashboardState?.welcome?.contentFolders?.map((folder: string) => ( - - ))} -
+ ), + show: true, + status: settings.crntFramework ? Status.Completed : Status.NotStarted, + onClick: undefined + }, + { + id: `welcome-template`, + name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedTemplateName), + description: ( +
+
{l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedTemplateDescription)}
+
+ { + crntTemplates && (crntTemplates || []).map(template => ( + triggerTemplate(template)} /> + )) + }
- )} +
+ ), + show: (crntTemplates || []).length > 0, + status: Status.Active, + }, + { + id: `welcome-assets`, + name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedAssetsFolderName), + description: ( +
+
{l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedAssetsFolderDescription)}
+
+ addAssetFolder(`public`)} /> -

- {l10n.t(LocalizationKey.commonInformation)}: {l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedContentFoldersInformationDescription)}. -

- - ), - show: true, - status: - settings.contentFolders && settings.contentFolders.length > 0 - ? Status.Completed - : Status.NotStarted - }, - { - id: `welcome-import`, - name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedTagsName), - description: <>{l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedTagsDescription)}, - show: true, - status: taxImported ? Status.Completed : Status.NotStarted, - onClick: - settings.contentFolders && settings.contentFolders.length > 0 ? importTaxonomy : undefined - }, - { - id: `welcome-show-dashboard`, - name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedShowDashboardName), - description: <>{l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedShowDashboardDescription)}, - show: true, - status: - settings.initialized && settings.contentFolders && settings.contentFolders.length > 0 - ? Status.Active - : Status.NotStarted, - onClick: - settings.initialized && settings.contentFolders && settings.contentFolders.length > 0 - ? reload - : undefined - } - ]; + addAssetFolder({ + "path": "src/assets", + "relative": true + })} /> + +

+ {l10n.t(LocalizationKey.commonInformation)}: {l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedAssetsFolderOtherDescription)}

+
+
+ ), + show: settings.crntFramework === 'astro' || framework === 'astro', + status: settings.initialized && settings.staticFolder && settings.staticFolder !== "/" ? Status.Completed : Status.NotStarted, + }, + { + id: `welcome-content-folders`, + name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedContentFoldersName), + description: ( + <> +

+ {l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedContentFoldersDescription)} +

+ + {settings?.dashboardState?.welcome?.contentFolders?.length > 0 && ( +
+
{l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedContentFoldersLabel)}
+
+ {settings?.dashboardState?.welcome?.contentFolders?.map((folder: string) => ( + + ))} +
+
+ )} + +

+ {l10n.t(LocalizationKey.commonInformation)}: {l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedContentFoldersInformationDescription)}. +

+ + ), + show: true, + status: + settings.contentFolders && settings.contentFolders.length > 0 + ? Status.Completed + : Status.NotStarted + }, + { + id: `welcome-import`, + name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedTagsName), + description: <>{l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedTagsDescription)}, + show: true, + status: taxImported ? Status.Completed : Status.NotStarted, + onClick: + settings.contentFolders && settings.contentFolders.length > 0 ? importTaxonomy : undefined + }, + { + id: `welcome-show-dashboard`, + name: l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedShowDashboardName), + description: <>{l10n.t(LocalizationKey.dashboardStepsStepsToGetStartedShowDashboardDescription)}, + show: true, + status: + settings.initialized && settings.contentFolders && settings.contentFolders.length > 0 + ? Status.Active + : Status.NotStarted, + onClick: + settings.initialized && settings.contentFolders && settings.contentFolders.length > 0 + ? reload + : undefined + } + ] + ), [settings, framework, taxImported, templates]); React.useEffect(() => { if (settings.crntFramework || settings.framework?.name) { @@ -299,6 +302,23 @@ export const StepsToGetStarted: React.FunctionComponent } }, [settings.crntFramework, settings.framework]); + React.useEffect(() => { + const fetchTemplates = async () => { + try { + const response = await fetch(Templates.url); + + if (response.ok) { + const data = await response.json(); + setTemplates(data); + } + } catch (e) { + setTemplates([]); + } + }; + + fetchTemplates(); + }, []); + return (