From 45238638fc5c44240dbaf088c67cbeec5ea75f20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=96=87=E6=B6=9B?= Date: Mon, 14 Sep 2020 21:50:27 +0800 Subject: [PATCH 01/15] refactor: eslint&stylelint&prettier (#532) * fix: create router page error * chore: router-service package version * fix: create rax-app page import error * chore: page-service version * fix: lint * fix: repeat create router * style: use ali rule * style: fix by auto * style: fix by manual * style: styleint fix by manual * feat: add pre-commit * fix: typescript build error * fix: devDeps Co-authored-by: luhc228 --- .editorconfig | 3 +- .eslintignore | 24 +- .eslintrc.js | 50 +- .github/workflows/ci.yml | 3 - .prettierrc.js | 12 +- .stylelintignore | 20 + .stylelintrc.js | 3 + commitlint.config.js | 3 + .../src/commands/executeCommand.ts | 4 +- .../iceworks-app/src/commands/stopCommand.ts | 4 +- .../src/debugConfig/getDefaultConfigs.ts | 4 +- .../iceworks-app/src/debugConfig/index.ts | 2 +- extensions/iceworks-app/src/extension.ts | 10 +- .../iceworks-app/src/getQuickEntryOptions.ts | 7 +- extensions/iceworks-app/src/openEntryFile.ts | 2 - .../iceworks-app/src/views/componentsView.ts | 15 +- .../src/views/nodeDependenciesView.ts | 45 +- .../iceworks-app/src/views/npmScriptsView.ts | 8 +- .../iceworks-app/src/views/pagesView.ts | 9 +- .../src/views/quickEntriesView.ts | 2 +- extensions/iceworks-app/web/src/app.tsx | 1 - extensions/iceworks-app/web/src/constants.ts | 2 +- .../ConfigHelper/CustomMaterialSource.tsx | 2 +- .../pages/ConfigHelper/MaterialSourceForm.tsx | 2 +- .../web/src/pages/ConfigHelper/index.tsx | 2 +- .../iceworks-config-helper/src/extension.ts | 16 +- .../iceworks-config-helper/src/services.ts | 4 +- .../web/src/pages/JsonForm/index.tsx | 16 +- .../web/src/theme/ChangeProvider.tsx | 2 +- .../web/src/theme/FieldTemplate.tsx | 2 +- .../componentQuickPicks.ts | 2 +- .../src/componentDocSupport/getHoverItem.ts | 2 +- .../iceworks-material-helper/src/extension.ts | 8 +- .../propsAutoComplete/getCurrentJsxElement.ts | 4 +- .../src/propsAutoComplete/getDefinitions.ts | 2 +- .../propsAutoComplete/getPropKeysFromCode.ts | 6 +- .../src/propsAutoComplete/index.ts | 4 +- .../src/utils/getCurrentJsxElement.ts | 2 +- .../src/utils/getJsxElements.ts | 2 +- .../iceworks-project-creator/src/extension.ts | 10 +- .../web/build.plugin.js | 2 +- .../web/src/components/Card/index.tsx | 2 +- .../web/src/components/MenuCard/index.tsx | 2 +- .../MobileScaffoldCard/index.module.scss | 3 +- .../components/MobileScaffoldCard/index.tsx | 2 +- .../web/src/components/PegasusCard/index.tsx | 2 - .../PegasusScaffoldContent/index.tsx | 2 +- .../components/CreateDEFProjectForm/index.tsx | 6 +- .../components/CreateProjectForm/index.tsx | 2 +- .../components/RaxScaffoldTypeForm/index.tsx | 4 +- .../web/src/pages/CreateProject/index.tsx | 21 +- .../src/cssClassAutoCompete/index.ts | 4 +- extensions/iceworks-style-helper/src/index.ts | 2 +- .../src/inlineStyleAutoComplete/cssData.d.ts | 2 +- .../getCompletionItem.ts | 2 +- .../src/inlineStyleAutoComplete/index.ts | 12 +- .../src/sassVariablesViewer/findVariables.ts | 2 +- .../src/sassVariablesViewer/index.ts | 10 +- .../src/styleInfoViewer/findStyle.ts | 9 +- .../styleInfoViewer/findStyleDependencies.ts | 2 +- .../src/styleInfoViewer/findStyleSelectors.ts | 2 +- .../src/styleInfoViewer/index.ts | 6 +- .../iceworks-ui-builder/src/extension.ts | 24 +- .../iceworks-ui-builder/src/services/block.ts | 3 +- .../iceworks-ui-builder/web/build.plugin.js | 2 +- .../web/src/pages/ComponentCreator/index.tsx | 8 +- .../web/src/pages/PageCreator/configForm.tsx | 12 +- .../web/src/pages/PageCreator/index.tsx | 2 +- .../components/PageSelected/index.module.scss | 2 +- .../components/PageSelected/index.tsx | 5 +- .../web/src/pages/PageGenerater/index.tsx | 4 +- .../web/src/variables.scss | 4 +- package.json | 34 +- packages/block-service/src/index.ts | 10 +- .../block-service/src/utils/scanDirectory.ts | 2 +- .../src/utils/getImportDeclarations.ts | 4 +- packages/component-service/src/index.ts | 16 +- .../src/utils/insertComponent.ts | 2 +- packages/constant/src/index.ts | 8 +- packages/doctor/src/Scanner.ts | 8 +- packages/doctor/src/Scorer.ts | 4 +- packages/doctor/src/getEslintReports.ts | 2 +- .../doctor/src/getRepeatabilityReports.ts | 2 +- .../src/rules/no-multi-nested-page.ts | 1 - .../rules/recommend-functional-component.ts | 2 +- .../generate-material/src/ejsRenderDir.ts | 8 +- packages/generate-material/src/index.ts | 2 +- packages/generate-project/src/ejsRenderDir.ts | 8 +- packages/generate-project/src/index.ts | 4 +- packages/i18n/src/index.ts | 2 +- packages/ice-npm-utils/src/__tests__/index.ts | 2 +- packages/ice-npm-utils/src/index.ts | 9 +- packages/ice-screenshot/bin/index.js | 6 +- packages/ice-screenshot/utils/getPuppeteer.js | 6 +- packages/material-service/src/index.ts | 8 +- .../src/components/scaffold.module.scss | 1 - packages/material-utils/src/methods.ts | 2 +- packages/page-service/package.json | 2 +- packages/page-service/src/index.ts | 17 +- .../src/templates/template.rax.ts | 17 + .../src/utils/renderEjsTemplates.ts | 7 +- packages/project-service/src/index.ts | 11 +- packages/router-service/package.json | 5 +- packages/router-service/src/index.ts | 48 +- packages/transform-ts-to-js/src/index.ts | 4 +- packages/transform-ts-to-js/src/ts2js.ts | 2 +- packages/vscode-webview/src/vscode.ts | 6 +- scripts/build.ts | 8 +- scripts/extension-link-package.ts | 2 +- scripts/getExtensionInfos.ts | 6 +- scripts/getPackageInfos.ts | 2 +- scripts/publish-extension.ts | 2 +- scripts/publish-package.ts | 2 +- scripts/watch.ts | 4 +- xima.config.js | 3 + yarn.lock | 1732 ++++++++--------- 116 files changed, 1243 insertions(+), 1278 deletions(-) create mode 100644 .stylelintignore create mode 100644 .stylelintrc.js create mode 100644 commitlint.config.js create mode 100644 packages/page-service/src/templates/template.rax.ts create mode 100644 xima.config.js diff --git a/.editorconfig b/.editorconfig index 5760be583..319299684 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,12 +1,13 @@ -# http://editorconfig.org root = true [*] indent_style = space indent_size = 2 +end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true +quote_type = single [*.md] trim_trailing_whitespace = false diff --git a/.eslintignore b/.eslintignore index e1184ee65..a35ef79bf 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,23 +1,19 @@ # 忽略目录 -build/ -tests/ -demo/ -.ice/ -def-login-client/ - -# node 覆盖率文件 -coverage/ +build +lib +es +dist +tests +demo node_modules -extensions/*/build/ +.ice +def-login-client +coverage/ .vscode-test -packages/*/lib/ -packages/*/es/ -packages/*/build/ -app/main_dist/ -app/build/ tmp .tmp __mocks__ +__tests__ # 忽略文件 **/*-min.js diff --git a/.eslintrc.js b/.eslintrc.js index 5d752f2f4..f04069ec2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,47 +1,7 @@ -const { eslint, tslint, deepmerge } = require('@ice/spec'); - -const commonRules = { - 'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx', '.tsx'] }], - 'react/jsx-no-target-blank': [0], - '@typescript-eslint/indent': 0, - 'prefer-object-spread': 0, - 'max-classes-per-file': 0, - 'class-methods-use-this': 0, -}; - -const jsRules = deepmerge(eslint, { - env: { - jest: true, - }, - rules: { - ...commonRules, - }, -}); - -const tsRules = deepmerge(tslint, { - env: { - jest: true, - }, - rules: { - ...commonRules, - '@typescript-eslint/no-inferrable-types': 1, - '@typescript-eslint/ban-ts-ignore': 0, - '@typescript-eslint/array-type': 0, - '@typescript-eslint/no-non-null-assertion': 0, - '@typescript-eslint/explicit-function-return-type': 0, - '@typescript-eslint/explicit-member-accessibility': 0, - '@typescript-eslint/no-parameter-properties': 0, - }, -}); - -delete tsRules.root; - module.exports = { - ...jsRules, - overrides: [ - { - ...tsRules, - files: ['**/*.ts', '**/*.tsx'], - }, - ], + extends: 'eslint-config-ali/typescript/react', + rules: { + 'no-return-await': 1, + '@typescript-eslint/no-parameter-properties': 1, + } }; diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b67b01b4..27bd1d840 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,9 +18,6 @@ jobs: node-version: ${{ matrix.node-version }} - run: | npm run setup:packages - npm run lint - npm run prettier - npm run docs:check npm run dependency:check npm run test npm run coverage diff --git a/.prettierrc.js b/.prettierrc.js index 03631c513..24c5859e6 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,5 +1,7 @@ -const { prettier, deepmerge } = require('@ice/spec'); - -module.exports = deepmerge(prettier, { - printWidth: 120, -}); +module.exports = { + printWidth: 100, + tabWidth: 2, + semi: true, + singleQuote: true, + trailingComma: 'all', +}; diff --git a/.stylelintignore b/.stylelintignore new file mode 100644 index 000000000..a35ef79bf --- /dev/null +++ b/.stylelintignore @@ -0,0 +1,20 @@ +# 忽略目录 +build +lib +es +dist +tests +demo +node_modules +.ice +def-login-client +coverage/ +.vscode-test +tmp +.tmp +__mocks__ +__tests__ + +# 忽略文件 +**/*-min.js +**/*.min.js diff --git a/.stylelintrc.js b/.stylelintrc.js new file mode 100644 index 000000000..74a5a54e3 --- /dev/null +++ b/.stylelintrc.js @@ -0,0 +1,3 @@ +module.exports = { + extends: 'stylelint-config-ali', +}; diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 000000000..52f3b754b --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,3 @@ +module.exports = { + extends: ['ali'], +}; diff --git a/extensions/iceworks-app/src/commands/executeCommand.ts b/extensions/iceworks-app/src/commands/executeCommand.ts index c980c5c71..d20fd81ba 100644 --- a/extensions/iceworks-app/src/commands/executeCommand.ts +++ b/extensions/iceworks-app/src/commands/executeCommand.ts @@ -11,9 +11,9 @@ export default function executeCommand(command: vscode.Command) { return; } - const terminals = vscode.window.terminals; + const { terminals } = vscode.window; - let terminal: Terminal | undefined = terminals.find((terminal: Terminal) => terminal.name === script); + let terminal: Terminal | undefined = terminals.find(({ name }) => name === script); if (!terminal) { const terminalOptions: TerminalOptions = { cwd, name: script }; terminal = vscode.window.createTerminal(terminalOptions); diff --git a/extensions/iceworks-app/src/commands/stopCommand.ts b/extensions/iceworks-app/src/commands/stopCommand.ts index 977dcddfb..184fda8c4 100644 --- a/extensions/iceworks-app/src/commands/stopCommand.ts +++ b/extensions/iceworks-app/src/commands/stopCommand.ts @@ -1,12 +1,12 @@ import * as vscode from 'vscode'; export default function stopCommand(command: vscode.Command) { - const terminals = vscode.window.terminals; + const { terminals } = vscode.window; const commandArgs = command.arguments; if (!commandArgs) { return; } - const [cwd, script] = commandArgs; + const [script] = commandArgs; if (!script) { return; } diff --git a/extensions/iceworks-app/src/debugConfig/getDefaultConfigs.ts b/extensions/iceworks-app/src/debugConfig/getDefaultConfigs.ts index ce3d5ac5a..144e7fcdc 100644 --- a/extensions/iceworks-app/src/debugConfig/getDefaultConfigs.ts +++ b/extensions/iceworks-app/src/debugConfig/getDefaultConfigs.ts @@ -70,7 +70,7 @@ export function getLaunchConfig(launchUrl?: string): IDebugConfig { baseUrl: BASE_URL, startLabel: CONFIG_START_LABEL, stopLabel: CONFIG_STOP_LABEL, - }) + }), ), }; } @@ -87,7 +87,7 @@ export function getTasksConfig(isPegasusProject = false, disableOpen = false): I isPegasusProject, startLabel: CONFIG_START_LABEL, stopLabel: CONFIG_STOP_LABEL, - }) + }), ), }; } diff --git a/extensions/iceworks-app/src/debugConfig/index.ts b/extensions/iceworks-app/src/debugConfig/index.ts index 113a3355d..3621e7261 100644 --- a/extensions/iceworks-app/src/debugConfig/index.ts +++ b/extensions/iceworks-app/src/debugConfig/index.ts @@ -22,7 +22,7 @@ function writeConfigFile(filePath: string, config: IDebugConfig) { filePath, '// See https://github.com/ice-lab/iceworks/blob/master/extensions/iceworks-app/docs/debug.md \n' + '// for the documentation about the Iceworks debug \n' + - `${JSON.stringify(config, null, ' ')}` + `${JSON.stringify(config, null, ' ')}`, ); } diff --git a/extensions/iceworks-app/src/extension.ts b/extensions/iceworks-app/src/extension.ts index abf63d39f..1604105ee 100644 --- a/extensions/iceworks-app/src/extension.ts +++ b/extensions/iceworks-app/src/extension.ts @@ -43,7 +43,7 @@ export async function activate(context: vscode.ExtensionContext) { recorder.recordActivate(); await showEntriesQuickPick(); - }) + }), ); // init config webview @@ -59,7 +59,7 @@ export async function activate(context: vscode.ExtensionContext) { { enableScripts: true, retainContextWhenHidden: true, - } + }, ); const extraHtml = ` `; - webviewPanel.webview.html = getHtmlForWebview(extensionPath, undefined, false, undefined, extraHtml); - webviewPanel.onDidDispose( + configWebviewPanel.webview.html = getHtmlForWebview(extensionPath, 'confighelper', true, undefined, extraHtml); + configWebviewPanel.onDidDispose( () => { - webviewPanel = undefined; + configWebviewPanel = undefined; }, null, context.subscriptions, ); - connectService(webviewPanel, context, { services, recorder }); + connectService(configWebviewPanel, context, { services, recorder }); } } subscriptions.push( @@ -82,6 +84,38 @@ export async function activate(context: vscode.ExtensionContext) { activeConfigWebview(focusField); }), ); + // init welcome webview + let welcomeWebviewPanel: vscode.WebviewPanel | undefined; + function activeWelcomeWebview() { + if (welcomeWebviewPanel) { + welcomeWebviewPanel.reveal(); + } else { + welcomeWebviewPanel = window.createWebviewPanel( + 'iceworks', + i18n.format('extension.iceworksApp.welcome.extension.webviewTitle'), + ViewColumn.One, + { + enableScripts: true, + retainContextWhenHidden: true, + }, + ); + + welcomeWebviewPanel.webview.html = getHtmlForWebview(extensionPath, 'welcome', true); + welcomeWebviewPanel.onDidDispose( + () => { + welcomeWebviewPanel = undefined; + }, + null, + context.subscriptions, + ); + connectService(welcomeWebviewPanel, context, { services, recorder }); + } + } + subscriptions.push( + registerCommand('iceworksApp.welcome.start', () => { + activeWelcomeWebview(); + }), + ); // init tree view const treeViews: any[] = []; @@ -124,4 +158,15 @@ export async function activate(context: vscode.ExtensionContext) { vscode.commands.executeCommand('setContext', 'iceworks:showScriptIconInEditorTitleMenu', true); await createEditorMenuAction(); } + + // auto start welcome page when the application is new + const isNotTargetProject = await checkIsNotTarget(); + // get showWelcomePage configuration from settings.json + const isShowWelcomePage = await getDataFromSettingJson('showWelcomePage', true); + if (projectPath && !isNotTargetProject && isShowWelcomePage) { + const curProjectExistsTime = getFolderExistsTime(projectPath); + if (projectExistsTime > curProjectExistsTime) { + vscode.commands.executeCommand('iceworksApp.welcome.start'); + } + } } diff --git a/extensions/iceworks-app/src/locales/en-US.json b/extensions/iceworks-app/src/locales/en-US.json index 0cf852fce..391a43180 100644 --- a/extensions/iceworks-app/src/locales/en-US.json +++ b/extensions/iceworks-app/src/locales/en-US.json @@ -27,6 +27,8 @@ "extension.iceworksApp.showEntriesQuickPick.reinstall.detail": "Reinstall the dependency packages for the application", "extension.iceworksApp.showEntriesQuickPick.addDepsAndDevDeps.label": "Add Dependency", "extension.iceworksApp.showEntriesQuickPick.addDepsAndDevDeps.detail": "Add a new dependency package for the application", + "extension.iceworksApp.showEntriesQuickPick.welcomePage.label": "Welcome", + "extension.iceworksApp.showEntriesQuickPick.welcomePage.detail": "Show welcome page", "extension.iceworksApp.showDepsInputBox.materialImport.placeHolder": "for example: lodash react@latest.", "extension.iceworksApp.showDepsInputBox.materialImport.prompt": "Please enter the name of the dependency to be addded to <%= depType %>. Multiple dependencies should be spilted by Spaces.", "extension.iceworksApp.showDefPublishEnvQuickPick.DEFEnvOptions.daily.label": "Daily", @@ -35,6 +37,7 @@ "extension.iceworksApp.showDefPublishEnvQuickPick.DEFEnvOptions.prod.detail": "Release to production environment.", "extension.iceworksApp.showDepsQuickPick.quickPickItem.detail": "Install <%= label %>", "extension.iceworksApp.openEntryFile.ErrorMessage": "Cannot find entry", - "extension.iceworksApp.extension.title": "Iceworks Settings", + "extension.iceworksApp.configHelper.extension.webviewTitle": "Settings - Iceworks", + "extension.iceworksApp.welcome.extension.webviewTitle": "Welcome - Iceworks", "extension.iceworksApp.extension.emptyWorkplace": "Current workspace is empty, please open or create an application." } diff --git a/extensions/iceworks-app/src/locales/zh-CN.json b/extensions/iceworks-app/src/locales/zh-CN.json index 2b15276eb..a874f9560 100644 --- a/extensions/iceworks-app/src/locales/zh-CN.json +++ b/extensions/iceworks-app/src/locales/zh-CN.json @@ -27,6 +27,8 @@ "extension.iceworksApp.showEntriesQuickPick.reinstall.detail": "重新安装应用的依赖包", "extension.iceworksApp.showEntriesQuickPick.addDepsAndDevDeps.label": "添加依赖", "extension.iceworksApp.showEntriesQuickPick.addDepsAndDevDeps.detail": "为应用添加新的依赖", + "extension.iceworksApp.showEntriesQuickPick.welcomePage.label": "欢迎使用", + "extension.iceworksApp.showEntriesQuickPick.welcomePage.detail": "启动欢迎页", "extension.iceworksApp.showDepsInputBox.materialImport.placeHolder": "例如: lodash react@latest", "extension.iceworksApp.showDepsInputBox.materialImport.prompt": "请输入需要添加到 <%= depType %> 的依赖名称, 支持通过空格添加多个依赖", "extension.iceworksApp.showDefPublishEnvQuickPick.DEFEnvOptions.daily.label": "日常环境", @@ -35,5 +37,6 @@ "extension.iceworksApp.showDefPublishEnvQuickPick.DEFEnvOptions.prod.detail": "发布到生产环境", "extension.iceworksApp.showDepsQuickPick.quickPickItem.detail": "安装 <%= label %>", "extension.iceworksApp.openEntryFile.ErrorMessage": "没有找到入口", - "extension.iceworksApp.extension.title": "设置 - Iceworks" + "extension.iceworksApp.configHelper.extension.webviewTitle": "设置 - Iceworks", + "extension.iceworksApp.welcome.extension.webviewTitle": "欢迎 - Iceworks" } diff --git a/extensions/iceworks-app/src/quickPicks/showEntriesQuickPick.ts b/extensions/iceworks-app/src/quickPicks/showEntriesQuickPick.ts index 3da9de6e0..992655296 100644 --- a/extensions/iceworks-app/src/quickPicks/showEntriesQuickPick.ts +++ b/extensions/iceworks-app/src/quickPicks/showEntriesQuickPick.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode'; -import getQuickEntryOptions from '../getQuickEntryOptions'; +import getQuickEntryOptions from '../utils/getQuickEntryOptions'; const { window, commands } = vscode; diff --git a/extensions/iceworks-app/src/autoStart.ts b/extensions/iceworks-app/src/utils/autoStart.ts similarity index 99% rename from extensions/iceworks-app/src/autoStart.ts rename to extensions/iceworks-app/src/utils/autoStart.ts index 0e14b4508..417675738 100644 --- a/extensions/iceworks-app/src/autoStart.ts +++ b/extensions/iceworks-app/src/utils/autoStart.ts @@ -3,6 +3,7 @@ import { checkIsNotTarget } from '@iceworks/project-service'; export default async function () { const isNotTargetProject = await checkIsNotTarget(); + if (isNotTargetProject) { vscode.commands.executeCommand('iceworks-project-creator.start'); } diff --git a/extensions/iceworks-app/src/createEditorMenuAction.ts b/extensions/iceworks-app/src/utils/createEditorMenuAction.ts similarity index 90% rename from extensions/iceworks-app/src/createEditorMenuAction.ts rename to extensions/iceworks-app/src/utils/createEditorMenuAction.ts index d83efaebe..514c3d4b4 100644 --- a/extensions/iceworks-app/src/createEditorMenuAction.ts +++ b/extensions/iceworks-app/src/utils/createEditorMenuAction.ts @@ -1,9 +1,9 @@ import * as vscode from 'vscode'; import { createNpmCommand, checkPathExists, checkIsAliInternal, registerCommand } from '@iceworks/common-service'; import { dependencyDir, projectPath } from '@iceworks/project-service'; -import { setDebugConfig } from './debugConfig/index'; -import showDefPublishEnvQuickPick from './quickPicks/showDefPublishEnvQuickPick'; -import executeCommand from './commands/executeCommand'; +import { setDebugConfig } from '../debugConfig/index'; +import showDefPublishEnvQuickPick from '../quickPicks/showDefPublishEnvQuickPick'; +import executeCommand from '../commands/executeCommand'; export default async function createEditorMenuAction() { const EDITOR_MENU_RUN_DEBUG = 'iceworksApp.editorMenu.runDebug'; diff --git a/extensions/iceworks-app/src/getQuickEntryOptions.ts b/extensions/iceworks-app/src/utils/getQuickEntryOptions.ts similarity index 95% rename from extensions/iceworks-app/src/getQuickEntryOptions.ts rename to extensions/iceworks-app/src/utils/getQuickEntryOptions.ts index 595b1a5e9..c910174e8 100644 --- a/extensions/iceworks-app/src/getQuickEntryOptions.ts +++ b/extensions/iceworks-app/src/utils/getQuickEntryOptions.ts @@ -1,7 +1,7 @@ import * as vscode from 'vscode'; import { getProjectType, checkIsPegasusProject, checkIsNotTarget } from '@iceworks/project-service'; import { checkIsAliInternal } from '@iceworks/common-service'; -import i18n from './i18n'; +import i18n from '../i18n'; const entries = [ { @@ -107,6 +107,11 @@ const entries = [ return !(await checkIsNotTarget()); }, }, + { + label: i18n.format('extension.iceworksApp.showEntriesQuickPick.welcomePage.label'), + detail: i18n.format('extension.iceworksApp.showEntriesQuickPick.welcomePage.detail'), + command: 'iceworksApp.welcome.start', + }, { label: i18n.format('extension.iceworksApp.showEntriesQuickPick.openSettings.label'), detail: i18n.format('extension.iceworksApp.showEntriesQuickPick.openSettings.detail'), diff --git a/extensions/iceworks-app/src/openEntryFile.ts b/extensions/iceworks-app/src/utils/openEntryFile.ts similarity index 100% rename from extensions/iceworks-app/src/openEntryFile.ts rename to extensions/iceworks-app/src/utils/openEntryFile.ts diff --git a/extensions/iceworks-app/src/views/componentsView.ts b/extensions/iceworks-app/src/views/componentsView.ts index ecd5f2363..953d8de41 100644 --- a/extensions/iceworks-app/src/views/componentsView.ts +++ b/extensions/iceworks-app/src/views/componentsView.ts @@ -3,7 +3,7 @@ import * as fse from 'fs-extra'; import * as path from 'path'; import { checkPathExists, registerCommand } from '@iceworks/common-service'; import { componentsPath, projectPath } from '@iceworks/project-service'; -import openEntryFile from '../openEntryFile'; +import openEntryFile from '../utils/openEntryFile'; import showAddComponentQuickPick from '../quickPicks/showAddComponentQuickPick'; class ComponentsProvider implements vscode.TreeDataProvider { diff --git a/extensions/iceworks-app/src/views/pagesView.ts b/extensions/iceworks-app/src/views/pagesView.ts index 82947bf41..f573eb4dd 100644 --- a/extensions/iceworks-app/src/views/pagesView.ts +++ b/extensions/iceworks-app/src/views/pagesView.ts @@ -3,7 +3,7 @@ import * as fse from 'fs-extra'; import * as path from 'path'; import { checkPathExists, registerCommand } from '@iceworks/common-service'; import { pagesPath as projectPagesPath, projectPath } from '@iceworks/project-service'; -import openEntryFile from '../openEntryFile'; +import openEntryFile from '../utils/openEntryFile'; import i18n from '../i18n'; export class PagesProvider implements vscode.TreeDataProvider { diff --git a/extensions/iceworks-app/src/views/quickEntriesView.ts b/extensions/iceworks-app/src/views/quickEntriesView.ts index f8bbf5fe4..11e823dc7 100644 --- a/extensions/iceworks-app/src/views/quickEntriesView.ts +++ b/extensions/iceworks-app/src/views/quickEntriesView.ts @@ -1,6 +1,6 @@ import * as vscode from 'vscode'; import { registerCommand, executeCommand } from '@iceworks/common-service'; -import getQuickEntryOptions from '../getQuickEntryOptions'; +import getQuickEntryOptions from '../utils/getQuickEntryOptions'; export class QuickEntriesProvider implements vscode.TreeDataProvider { private extensionContext: vscode.ExtensionContext; diff --git a/extensions/iceworks-app/web/build.json b/extensions/iceworks-app/web/build.json index 81682baa5..150871095 100644 --- a/extensions/iceworks-app/web/build.json +++ b/extensions/iceworks-app/web/build.json @@ -2,6 +2,7 @@ "devServer": { "writeToDisk": true }, + "mpa": true, "publicPath": "./", "outputDir": "../build", "plugins": [ diff --git a/extensions/iceworks-app/web/public/assets/dingtalk.svg b/extensions/iceworks-app/web/public/assets/dingtalk.svg new file mode 100644 index 000000000..f0104889e --- /dev/null +++ b/extensions/iceworks-app/web/public/assets/dingtalk.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/iceworks-app/web/public/assets/doc.svg b/extensions/iceworks-app/web/public/assets/doc.svg new file mode 100644 index 000000000..b9bf175db --- /dev/null +++ b/extensions/iceworks-app/web/public/assets/doc.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/iceworks-app/web/public/assets/updates.svg b/extensions/iceworks-app/web/public/assets/updates.svg new file mode 100644 index 000000000..611957717 --- /dev/null +++ b/extensions/iceworks-app/web/public/assets/updates.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/iceworks-app/web/public/index.html b/extensions/iceworks-app/web/public/index.html index cf4a793e6..e0e6963d9 100644 --- a/extensions/iceworks-app/web/public/index.html +++ b/extensions/iceworks-app/web/public/index.html @@ -5,11 +5,11 @@ - Iceworks Application Creator + Iceworks App
- + \ No newline at end of file diff --git a/extensions/iceworks-app/web/src/i18n.tsx b/extensions/iceworks-app/web/src/i18n.tsx index a82e9b0f7..22cc7d3e5 100644 --- a/extensions/iceworks-app/web/src/i18n.tsx +++ b/extensions/iceworks-app/web/src/i18n.tsx @@ -29,6 +29,7 @@ const getIntl = (locale: string) => { } return createIntl({ locale, messages: localeMessage.messages }); }; + export const LocaleProvider = (props) => { const [i18n, setI18n] = useState(() => getIntl(DEFAULT_LOCALE)); const [loading, setLoading] = useState(true); diff --git a/extensions/iceworks-app/web/src/locales/en-US.json b/extensions/iceworks-app/web/src/locales/en-US.json index 958a1b0a5..a10c37ec1 100644 --- a/extensions/iceworks-app/web/src/locales/en-US.json +++ b/extensions/iceworks-app/web/src/locales/en-US.json @@ -1,28 +1,46 @@ { - "web.iceworksApp.customMaterialSource.confirmDelete": "Are you sure to delete the material source?", - "web.iceworksApp.customMaterialSource.editMaterialSource": "Edit Material Source", - "web.iceworksApp.customMaterialSource.addMaterialSource": "Add Material Source", - "web.iceworksApp.customMaterialSource.customMaterialSource": "Custom Material Source", - "web.iceworksApp.customMaterialSource.add": "Add", - "web.iceworksApp.customMaterialSource.help": "See《物料开发》to know how to create a custom material", - "web.iceworksApp.customMaterialSource.loading": "Loading", - "web.iceworksApp.index.CUSTOM_NPM_REGISTRY_SELECT_KEY": "Custom NPM Registry", - "web.iceworksApp.index.addMaterialSuccess": "Added material source successfully", - "web.iceworksApp.index.editMaterialSuccess": "Modified material source successfully", - "web.iceworksApp.index.deleteMaterialSuccess": "Material source deleted successfully", - "web.iceworksApp.index.editSettingSuccess": "Setting up completed successfully ", - "web.iceworksApp.index.npmPackageManager": "Npm Packages Manager", - "web.iceworksApp.index.chooseNpmPackageManager": "Choose NPM Packages Mananger", - "web.iceworksApp.index.npmRegistry": "Npm Registry", - "web.iceworksApp.index.chooseNpmRegistry": "Choose NPM Registry", - "web.iceworksApp.index.formatUrl": "Enter A NPM Registry Url", - "web.iceworksApp.index.customNpmRegistryPlaceHolder": "Custom NPM Registry", - "web.iceworksApp.MaterialSourceForm.materialNameLabel": "Material Name:", - "web.iceworksApp.MaterialSourceForm.materialName": "Please Enter Material Name", - "web.iceworksApp.MaterialSourceForm.materiaURLLabel": "Material URL", - "web.iceworksApp.MaterialSourceForm.materiaURL": "Please Enter Material URL", - "web.iceworksApp.MaterialSourceForm.materialDescriptionLabel": "Material Description:", - "web.iceworksApp.MaterialSourceForm.materialDescription": "Please Enter Material Description", - "web.iceworksApp.MaterialSourceForm.confirm": "Confirm", - "web.iceworksApp.MaterialSourceForm.cancel": "Cancel" + "web.iceworksApp.ConfigHelper.customMaterialSource.confirmDelete": "Are you sure to delete the material source?", + "web.iceworksApp.ConfigHelper.customMaterialSource.editMaterialSource": "Edit Material Source", + "web.iceworksApp.ConfigHelper.customMaterialSource.addMaterialSource": "Add Material Source", + "web.iceworksApp.ConfigHelper.customMaterialSource.customMaterialSource": "Custom Material Source", + "web.iceworksApp.ConfigHelper.customMaterialSource.add": "Add", + "web.iceworksApp.ConfigHelper.customMaterialSource.help": "See《物料开发》to know how to create a custom material", + "web.iceworksApp.ConfigHelper.customMaterialSource.loading": "Loading", + "web.iceworksApp.ConfigHelper.index.CUSTOM_NPM_REGISTRY_SELECT_KEY": "Custom NPM Registry", + "web.iceworksApp.ConfigHelper.index.addMaterialSuccess": "Added material source successfully", + "web.iceworksApp.ConfigHelper.index.editMaterialSuccess": "Modified material source successfully", + "web.iceworksApp.ConfigHelper.index.deleteMaterialSuccess": "Material source deleted successfully", + "web.iceworksApp.ConfigHelper.index.editSettingSuccess": "Setting up completed successfully ", + "web.iceworksApp.ConfigHelper.index.npmPackageManager": "Npm Packages Manager", + "web.iceworksApp.ConfigHelper.index.chooseNpmPackageManager": "Choose NPM Packages Mananger", + "web.iceworksApp.ConfigHelper.index.npmRegistry": "Npm Registry", + "web.iceworksApp.ConfigHelper.index.chooseNpmRegistry": "Choose NPM Registry", + "web.iceworksApp.ConfigHelper.index.formatUrl": "Enter A NPM Registry Url", + "web.iceworksApp.ConfigHelper.index.customNpmRegistryPlaceHolder": "Custom NPM Registry", + "web.iceworksApp.ConfigHelper.MaterialSourceForm.materialNameLabel": "Material Name:", + "web.iceworksApp.ConfigHelper.MaterialSourceForm.materialName": "Please Enter Material Name", + "web.iceworksApp.ConfigHelper.MaterialSourceForm.materiaURLLabel": "Material URL", + "web.iceworksApp.ConfigHelper.MaterialSourceForm.materiaURL": "Please Enter Material URL", + "web.iceworksApp.ConfigHelper.MaterialSourceForm.materialDescriptionLabel": "Material Description:", + "web.iceworksApp.ConfigHelper.MaterialSourceForm.materialDescription": "Please Enter Material Description", + "web.iceworksApp.ConfigHelper.MaterialSourceForm.confirm": "Confirm", + "web.iceworksApp.ConfigHelper.MaterialSourceForm.cancel": "Cancel", + "web.iceworksApp.Welcome.Content.title": "Quick Start", + "web.iceworksApp.Welcome.Content.desc": "It only takes 30 minutes to watch, greatly improving the development efficiency.", + "web.iceworksApp.Welcome.Content.videoTitle.createApplication": "1. Create a Hello World Application", + "web.iceworksApp.Welcome.Content.videoTitle.visualDevelopment": "2. Visual Development Based on Materials", + "web.iceworksApp.Welcome.Content.videoTitle.genreateComponent": "3. Generate Component by Visualization", + "web.iceworksApp.Welcome.Content.videoTitle.customMaterial": "4. Develop and Use Custom Materials", + "web.iceworksApp.Welcome.Header.title": "Welcome to Iceworks", + "web.iceworksApp.Welcome.Header.desc": "Iceworks is a visual intelligent assistant, to help you quickly develop frontend applications.", + "web.iceworksApp.Welcome.Information.title": "More Infomation", + "web.iceworksApp.Welcome.Information.doc.title": "Learn", + "web.iceworksApp.Welcome.Information.doc.desc": "Give you more feature detailed description", + "web.iceworksApp.Welcome.Information.doc.link": "View", + "web.iceworksApp.Welcome.Information.dingtalk.title": "DingTalk", + "web.iceworksApp.Welcome.Information.dingtalk.desc": "Join us for exchange and study", + "web.iceworksApp.Welcome.Information.dingtalk.link": "Join", + "web.iceworksApp.Welcome.Information.updates.title": "Updates", + "web.iceworksApp.Welcome.Information.updates.desc": "Iceworks release details", + "web.iceworksApp.Welcome.Information.updates.link": "View" } diff --git a/extensions/iceworks-app/web/src/locales/zh-CN.json b/extensions/iceworks-app/web/src/locales/zh-CN.json index 8c7c831b7..24f38467f 100644 --- a/extensions/iceworks-app/web/src/locales/zh-CN.json +++ b/extensions/iceworks-app/web/src/locales/zh-CN.json @@ -1,28 +1,47 @@ { - "web.iceworksApp.customMaterialSource.confirmDelete": "是否确定删除该物料源?", - "web.iceworksApp.customMaterialSource.editMaterialSource": "编辑物料源", - "web.iceworksApp.customMaterialSource.addMaterialSource": "新增物料源", - "web.iceworksApp.customMaterialSource.customMaterialSource": "自定义物料源", - "web.iceworksApp.customMaterialSource.add": "添加", - "web.iceworksApp.customMaterialSource.help": "查看《物料开发》了解如何开发自定义物料源", - "web.iceworksApp.customMaterialSource.loading": "加载中...", - "web.iceworksApp.index.CUSTOM_NPM_REGISTRY_SELECT_KEY": "npm - 自定义镜像源", - "web.iceworksApp.index.addMaterialSuccess": "新增物料源成功", - "web.iceworksApp.index.editMaterialSuccess": "修改物料源成功", - "web.iceworksApp.index.deleteMaterialSuccess": "删除物料源成功", - "web.iceworksApp.index.editSettingSuccess": "设置成功", - "web.iceworksApp.index.npmPackageManager": "npm 包管理工具", - "web.iceworksApp.index.chooseNpmPackageManager": "请选择 npm 包管理工具", - "web.iceworksApp.index.npmRegistry": "npm 镜像源", - "web.iceworksApp.index.chooseNpmRegistry": "请选择 npm 镜像源", - "web.iceworksApp.index.formatUrl": "请输入正确的 url", - "web.iceworksApp.index.customNpmRegistryPlaceHolder": "请输入自定义 npm 镜像源", - "web.iceworksApp.MaterialSourceForm.materialNameLabel": "物料名称:", - "web.iceworksApp.MaterialSourceForm.materialName": "请输入物料名称", - "web.iceworksApp.MaterialSourceForm.materiaURLLabel": "物料地址:", - "web.iceworksApp.MaterialSourceForm.materiaURL": "请输入物料地址", - "web.iceworksApp.MaterialSourceForm.materialDescriptionLabel": "物料描述:", - "web.iceworksApp.MaterialSourceForm.materialDescription": "请输入物料描述", - "web.iceworksApp.MaterialSourceForm.confirm": "确定", - "web.iceworksApp.MaterialSourceForm.cancel": "取消" + "web.iceworksApp.ConfigHelper.customMaterialSource.confirmDelete": "是否确定删除该物料源?", + "web.iceworksApp.ConfigHelper.customMaterialSource.editMaterialSource": "编辑物料源", + "web.iceworksApp.ConfigHelper.customMaterialSource.addMaterialSource": "新增物料源", + "web.iceworksApp.ConfigHelper.customMaterialSource.customMaterialSource": "自定义物料源", + "web.iceworksApp.ConfigHelper.customMaterialSource.add": "添加", + "web.iceworksApp.ConfigHelper.customMaterialSource.help": "查看《物料开发》了解如何开发自定义物料源", + "web.iceworksApp.ConfigHelper.customMaterialSource.loading": "加载中...", + "web.iceworksApp.ConfigHelper.index.CUSTOM_NPM_REGISTRY_SELECT_KEY": "npm - 自定义镜像源", + "web.iceworksApp.ConfigHelper.index.addMaterialSuccess": "新增物料源成功", + "web.iceworksApp.ConfigHelper.index.editMaterialSuccess": "修改物料源成功", + "web.iceworksApp.ConfigHelper.index.deleteMaterialSuccess": "删除物料源成功", + "web.iceworksApp.ConfigHelper.index.editSettingSuccess": "设置成功", + "web.iceworksApp.ConfigHelper.index.npmPackageManager": "npm 包管理工具", + "web.iceworksApp.ConfigHelper.index.chooseNpmPackageManager": "请选择 npm 包管理工具", + "web.iceworksApp.ConfigHelper.index.npmRegistry": "npm 镜像源", + "web.iceworksApp.ConfigHelper.index.chooseNpmRegistry": "请选择 npm 镜像源", + "web.iceworksApp.ConfigHelper.index.formatUrl": "请输入正确的 url", + "web.iceworksApp.ConfigHelper.index.customNpmRegistryPlaceHolder": "请输入自定义 npm 镜像源", + "web.iceworksApp.ConfigHelper.MaterialSourceForm.materialNameLabel": "物料名称:", + "web.iceworksApp.ConfigHelper.MaterialSourceForm.materialName": "请输入物料名称", + "web.iceworksApp.ConfigHelper.MaterialSourceForm.materiaURLLabel": "物料地址:", + "web.iceworksApp.ConfigHelper.MaterialSourceForm.materiaURL": "请输入物料地址", + "web.iceworksApp.ConfigHelper.MaterialSourceForm.materialDescriptionLabel": "物料描述:", + "web.iceworksApp.ConfigHelper.MaterialSourceForm.materialDescription": "请输入物料描述", + "web.iceworksApp.ConfigHelper.MaterialSourceForm.confirm": "确定", + "web.iceworksApp.ConfigHelper.MaterialSourceForm.cancel": "取消", + "web.iceworksApp.Welcome.Content.title": "上手教程", + "web.iceworksApp.Welcome.Content.desc": "只需 30 分钟观看时间,后期大大提升开发效率", + "web.iceworksApp.Welcome.Content.videoTitle.createApplication": "1. 创建 Hello World 应用", + "web.iceworksApp.Welcome.Content.videoTitle.visualDevelopment": "2. 基于物料进行可视化开发", + "web.iceworksApp.Welcome.Content.videoTitle.genreateComponent": "3. 可视化搭建组件", + "web.iceworksApp.Welcome.Content.videoTitle.customMaterial": "4. 开发和使用自定义物料", + "web.iceworksApp.Welcome.Header.title": "欢迎来到 Iceworks", + "web.iceworksApp.Welcome.Header.desc": "Iceworks 是一个可视化智能开发助手,帮助你更快更好更轻松地开发前端应用", + "web.iceworksApp.Welcome.Information.title": "更多信息", + "web.iceworksApp.Welcome.Information.doc.title": "学习", + "web.iceworksApp.Welcome.Information.doc.desc": "为你提供体系化的能力描述", + "web.iceworksApp.Welcome.Information.doc.link": "立即查看", + "web.iceworksApp.Welcome.Information.dingtalk.title": "钉钉群", + "web.iceworksApp.Welcome.Information.dingtalk.desc": "加入官方钉钉群一起交流学习", + "web.iceworksApp.Welcome.Information.dingtalk.link": "扫码加入", + "web.iceworksApp.Welcome.Information.updates.title": "动态", + "web.iceworksApp.Welcome.Information.updates.desc": "Iceworks 版本发布详情", + "web.iceworksApp.Welcome.Information.updates.link": "立即查看", + "web.iceworksApp.Welcome.showPageOption.title": "显示欢迎页" } diff --git a/extensions/iceworks-app/web/src/app.tsx b/extensions/iceworks-app/web/src/pages/ConfigHelper/app.ts similarity index 57% rename from extensions/iceworks-app/web/src/app.tsx rename to extensions/iceworks-app/web/src/pages/ConfigHelper/app.ts index d36476161..8dc4788a6 100644 --- a/extensions/iceworks-app/web/src/app.tsx +++ b/extensions/iceworks-app/web/src/pages/ConfigHelper/app.ts @@ -1,6 +1,10 @@ import { createApp } from 'ice'; +import Home from './index'; const appConfig = { + router: { + routes: [{ path: '/', component: Home }], + }, app: { rootId: 'ice-container', }, diff --git a/extensions/iceworks-app/web/src/pages/ConfigHelper/CustomMaterialSource.module.scss b/extensions/iceworks-app/web/src/pages/ConfigHelper/components/CustomMaterialSource/index.module.scss similarity index 100% rename from extensions/iceworks-app/web/src/pages/ConfigHelper/CustomMaterialSource.module.scss rename to extensions/iceworks-app/web/src/pages/ConfigHelper/components/CustomMaterialSource/index.module.scss diff --git a/extensions/iceworks-app/web/src/pages/ConfigHelper/CustomMaterialSource.tsx b/extensions/iceworks-app/web/src/pages/ConfigHelper/components/CustomMaterialSource/index.tsx similarity index 80% rename from extensions/iceworks-app/web/src/pages/ConfigHelper/CustomMaterialSource.tsx rename to extensions/iceworks-app/web/src/pages/ConfigHelper/components/CustomMaterialSource/index.tsx index 52660db1c..62a6a6aa8 100644 --- a/extensions/iceworks-app/web/src/pages/ConfigHelper/CustomMaterialSource.tsx +++ b/extensions/iceworks-app/web/src/pages/ConfigHelper/components/CustomMaterialSource/index.tsx @@ -2,10 +2,10 @@ import React, { useState, Suspense } from 'react'; import { Icon, List, Button, Dialog, Avatar, Balloon } from '@alifd/next'; import { IMaterialSource } from '@iceworks/material-utils'; import { FormattedMessage, useIntl } from 'react-intl'; -import editIcon from '../../../public/assets/edit.svg'; -import deleteIcon from '../../../public/assets/delete.svg'; -import MaterialSourceForm from './MaterialSourceForm'; -import styles from './CustomMaterialSource.module.scss'; +import editIcon from '../../../../../public/assets/edit.svg'; +import deleteIcon from '../../../../../public/assets/delete.svg'; +import MaterialSourceForm from '../MaterialSourceForm'; +import styles from './index.module.scss'; enum Operation { Edit, @@ -62,19 +62,19 @@ const CustomMaterialSource: React.FC = ({ const onDelete = (materialSource: IMaterialSource) => { Dialog.confirm({ title: 'Confirm', - content: intl.formatMessage({ id: 'web.iceworksApp.customMaterialSource.confirmDelete' }), + content: intl.formatMessage({ id: 'web.iceworksApp.ConfigHelper.customMaterialSource.confirmDelete' }), onOk: () => onSourceDelete(materialSource), }); }; const dialogTitle = operation === Operation.Edit - ? intl.formatMessage({ id: 'web.iceworksApp.customMaterialSource.editMaterialSource' }) - : intl.formatMessage({ id: 'web.iceworksApp.customMaterialSource.addMaterialSource' }); + ? intl.formatMessage({ id: 'web.iceworksApp.ConfigHelper.customMaterialSource.editMaterialSource' }) + : intl.formatMessage({ id: 'web.iceworksApp.ConfigHelper.customMaterialSource.addMaterialSource' }); return (
- + } align="r" @@ -82,14 +82,14 @@ const CustomMaterialSource: React.FC = ({ triggerType="hover" > - +
@@ -112,7 +112,7 @@ const CustomMaterialSource: React.FC = ({ ))}
- + = ({ title, value, onSub triggerType="hover" > - + @@ -46,38 +46,38 @@ const MaterialSourceForm: React.FC = ({ title, value, onSub >
- + - + diff --git a/extensions/iceworks-app/web/src/pages/ConfigHelper/index.tsx b/extensions/iceworks-app/web/src/pages/ConfigHelper/index.tsx index 5a57778a6..26b480a55 100644 --- a/extensions/iceworks-app/web/src/pages/ConfigHelper/index.tsx +++ b/extensions/iceworks-app/web/src/pages/ConfigHelper/index.tsx @@ -5,8 +5,8 @@ import { IMaterialSource } from '@iceworks/material-utils'; import { packageManagers, npmRegistries, AliNpmRegistry, AliPackageManager, urlRegExp } from '@/constants'; import callService from '@/callService'; import { useIntl } from 'react-intl'; -import { LocaleProvider } from '../../i18n'; -import CustomMaterialSource from './CustomMaterialSource'; +import { LocaleProvider } from '@/i18n'; +import CustomMaterialSource from './components/CustomMaterialSource'; import styles from './index.module.scss'; const FormItem = Form.Item; @@ -28,7 +28,7 @@ const ConfigHelper = () => { try { const newMaterialSources = await callService('material', 'addSource', materialSource); setMaterialSources(newMaterialSources); - Notification.success({ content: intl.formatMessage({ id: 'web.iceworksApp.index.addMaterialSuccess' }) }); + Notification.success({ content: intl.formatMessage({ id: 'web.iceworksApp.ConfigHelper.index.addMaterialSuccess' }) }); } catch (e) { Notification.error({ content: e.message }); } @@ -38,7 +38,7 @@ const ConfigHelper = () => { try { const newMaterialSources = await callService('material', 'updateSource', materialSource, originMaterialSource); setMaterialSources(newMaterialSources); - Notification.success({ content: intl.formatMessage({ id: 'web.iceworksApp.index.editMaterialSuccess' }) }); + Notification.success({ content: intl.formatMessage({ id: 'web.iceworksApp.ConfigHelper.index.editMaterialSuccess' }) }); } catch (e) { Notification.error({ content: e.message }); } @@ -48,7 +48,7 @@ const ConfigHelper = () => { try { const newMaterialSources = await callService('material', 'removeSource', materialSource.source); setMaterialSources(newMaterialSources); - Notification.success({ content: intl.formatMessage({ id: 'web.iceworksApp.index.deleteMaterialSuccess' }) }); + Notification.success({ content: intl.formatMessage({ id: 'web.iceworksApp.ConfigHelper.index.deleteMaterialSuccess' }) }); } catch (e) { Notification.error({ content: e.message }); } @@ -68,7 +68,7 @@ const ConfigHelper = () => { } else { await callService('common', 'saveDataToSettingJson', name, value); } - Notification.success({ content: intl.formatMessage({ id: 'web.iceworksApp.index.editSettingSuccess' }) }); + Notification.success({ content: intl.formatMessage({ id: 'web.iceworksApp.ConfigHelper.index.editSettingSuccess' }) }); } catch (e) { Notification.error({ content: e.message }); } @@ -112,10 +112,10 @@ const ConfigHelper = () => { ) : (
- + - + {fields.npmRegistry === CUSTOM_NPM_REGISTRY_SELECT_KEY && ( - - - + + + )} { + const intl = useIntl(); + + const videosList = [ + { + title: intl.formatMessage({ id: 'web.iceworksApp.Welcome.Content.videoTitle.createApplication' }), + videoUrl: + 'https://iceworks.oss-cn-hangzhou.aliyuncs.com/iceworks-video/%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%20Hello%20World%20%E5%BA%94%E7%94%A8.mov', + }, + { + title: intl.formatMessage({ id: 'web.iceworksApp.Welcome.Content.videoTitle.visualDevelopment' }), + videoUrl: + 'https://iceworks.oss-cn-hangzhou.aliyuncs.com/iceworks-video/%E5%8F%AF%E8%A7%86%E5%8C%96%E5%BC%80%E5%8F%91.mov', + }, + { + title: intl.formatMessage({ id: 'web.iceworksApp.Welcome.Content.videoTitle.genreateComponent' }), + videoUrl: + 'https://iceworks.oss-cn-hangzhou.aliyuncs.com/iceworks-video/%E5%8F%AF%E8%A7%86%E5%8C%96%E6%90%AD%E5%BB%BA%E7%BB%84%E4%BB%B6.mov', + }, + { + title: intl.formatMessage({ id: 'web.iceworksApp.Welcome.Content.videoTitle.customMaterial' }), + videoUrl: + 'https://iceworks.oss-cn-hangzhou.aliyuncs.com/iceworks-video/%E8%87%AA%E5%AE%9A%E4%B9%89%E7%89%A9%E6%96%99%E6%BA%90.mov', + }, + ]; + + const [selectedKeyIndex, setSelectedKeyIndex] = useState(0); + + return ( +
+
+
+
+ {/*