diff --git a/.dockerignore b/.dockerignore
deleted file mode 100644
index 8e90ca6d5026b261dd5e7af54bbe65eddda0a94b..0000000000000000000000000000000000000000
--- a/.dockerignore
+++ /dev/null
@@ -1,35 +0,0 @@
-# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
-
-# dependencies
-**/node_modules
-/src/utils/request-temp.js
-
-# production
-/.vscode
-
-# misc
-.DS_Store
-npm-debug.log*
-yarn-error.log
-
-/coverage
-.idea
-yarn.lock
-package-lock.json
-*bak
-.vscode
-
-# visual studio code
-.history
-*.log
-
-functions/mock
-.temp/**
-
-# umi
-.umi
-.umi-production
-
-# screenshot
-screenshot
-.firebase
\ No newline at end of file
diff --git a/.firebaserc b/.firebaserc
deleted file mode 100644
index e3a9a50c8a53831595f67ab41862f94d8f050bd0..0000000000000000000000000000000000000000
--- a/.firebaserc
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "projects": {
- "default": "antd-pro"
- }
-}
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
deleted file mode 100644
index 9e41f2e9f60185335b67843d8d9b57466b9c3ee8..0000000000000000000000000000000000000000
--- a/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,46 +0,0 @@
-# Contributor Covenant Code of Conduct
-
-## Our Pledge
-
-In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
-
-## Our Standards
-
-Examples of behavior that contributes to creating a positive environment include:
-
-* Using welcoming and inclusive language
-* Being respectful of differing viewpoints and experiences
-* Gracefully accepting constructive criticism
-* Focusing on what is best for the community
-* Showing empathy towards other community members
-
-Examples of unacceptable behavior by participants include:
-
-* The use of sexualized language or imagery and unwelcome sexual attention or advances
-* Trolling, insulting/derogatory comments, and personal or political attacks
-* Public or private harassment
-* Publishing others' private information, such as a physical or electronic address, without explicit permission
-* Other conduct which could reasonably be considered inappropriate in a professional setting
-
-## Our Responsibilities
-
-Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
-
-Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
-
-## Scope
-
-This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
-
-## Enforcement
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at afc163@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
-
-Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
-
-## Attribution
-
-This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
-
-[homepage]: http://contributor-covenant.org
-[version]: http://contributor-covenant.org/version/1/4/
diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644
index 7cbc5c31cd95e3cad949c50aa02103e126ae0c83..0000000000000000000000000000000000000000
--- a/Dockerfile
+++ /dev/null
@@ -1,12 +0,0 @@
-FROM circleci/node:latest-browsers
-
-WORKDIR /usr/src/app/
-USER root
-COPY package.json ./
-RUN yarn
-
-COPY ./ ./
-
-RUN npm run test:all
-
-CMD ["npm", "run", "build"]
diff --git a/Dockerfile.dev b/Dockerfile.dev
deleted file mode 100644
index f5a50e58a0cde0d980516f3fba9cccde02afcf9a..0000000000000000000000000000000000000000
--- a/Dockerfile.dev
+++ /dev/null
@@ -1,11 +0,0 @@
-FROM node:latest
-
-WORKDIR /usr/src/app/
-
-COPY package.json ./
-RUN npm install --silent --no-cache
-
-COPY ./ ./
-
-
-CMD ["npm", "run", "start"]
diff --git a/Dockerfile.hub b/Dockerfile.hub
deleted file mode 100644
index 2e9c1ec9133f1762656e6bdc2672a1802bd24186..0000000000000000000000000000000000000000
--- a/Dockerfile.hub
+++ /dev/null
@@ -1,11 +0,0 @@
-FROM nginx
-
-WORKDIR /usr/src/app/
-
-COPY ./docker/nginx.conf /etc/nginx/conf.d/default.conf
-
-COPY ./dist /usr/share/nginx/html/
-
-EXPOSE 80
-
-CMD ["nginx", "-g", "daemon off;"]
\ No newline at end of file
diff --git a/config/config.js b/config/config.js
index 41e66ece84e24bc916a7e7ba47591fe9a33007d9..ee5ff285e18d0b5aaafd39dca8a0fc8cb111e21f 100644
--- a/config/config.js
+++ b/config/config.js
@@ -1,131 +1,74 @@
-// https://umijs.org/config/
-import os from 'os';
-import webpackPlugin from './plugin.config';
-import defaultSettings from '../src/defaultSettings';
-import slash from 'slash2';
+// ref: https://umijs.org/config/
+import { primaryColor } from '../src/defaultSettings';
-const plugins = [
- [
- 'umi-plugin-react',
- {
- antd: true,
- dva: {
- hmr: true,
- },
- locale: {
- enable: true, // default false
- default: 'zh-CN', // default zh-CN
- baseNavigator: true, // default true, when it is true, will use `navigator.language` overwrite default
- },
- dynamicImport: {
- loadingComponent: './components/PageLoading/index',
- webpackChunkName: true,
- },
- pwa: {
- workboxPluginMode: 'InjectManifest',
- workboxOptions: {
- importWorkboxFrom: 'local',
+export default {
+ plugins: [
+ [
+ 'umi-plugin-react',
+ {
+ antd: true,
+ dva: {
+ hmr: true,
+ },
+ targets: {
+ ie: 11,
+ },
+ locale: {
+ enable: true, // default false
+ default: 'zh-CN', // default zh-CN
+ baseNavigator: true, // default true, when it is true, will use `navigator.language` overwrite default
+ },
+ dynamicImport: {
+ loadingComponent: './components/PageLoading/index',
},
},
- // ...(!process.env.TEST && os.platform() === 'darwin'
- // ? {
- // dll: {
- // include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'],
- // exclude: ['@babel/runtime'],
- // },
- // hardSource: true,
- // }
- // : {}),
- },
+ ],
],
-];
+ targets: {
+ ie: 11,
+ },
-// 针对 preview.pro.ant.design 的 GA 统计代码
-// 业务上不需要这个
-if (process.env.APP_TYPE === 'site') {
- plugins.push([
- 'umi-plugin-ga',
+ /**
+ * 路由相关配置
+ */
+ routes: [
{
- code: 'UA-72788897-6',
+ path: '/user',
+ components: ['../layouts/UserLayout'],
+ routes: [],
},
- ]);
-}
+ {
+ path: '/',
+ component: '../layouts/BasicLayout',
+ routes: [
+ // dashboard
+ {
+ path: '/',
+ name: 'dashboard',
+ icon: 'dashboard',
+ component: './BasicDemo',
+ },
+ ],
+ },
+ ],
+ disableRedirectHoist: true,
-export default {
- // add for transfer to umi
- plugins,
+ /**
+ * webpack 相关配置
+ */
define: {
APP_TYPE: process.env.APP_TYPE || '',
},
- treeShaking: true,
- targets: {
- ie: 11,
- },
- // 路由配置
- routes: [{
- path: '/user',
- components: ['../layouts/UserLayout'],
- routes: [],
- }, {
- path: '/',
- component: '../layouts/BasicLayout',
- Routes: ['src/pages/Authorized'],
- authority: ['admin', 'user'],
- routes: [
- // dashboard
- {
- path: '/',
- name: 'dashboard',
- icon: 'dashboard',
- component: './BasicDemo',
- },
- ],
- }],
// Theme for antd
// https://ant.design/docs/react/customize-theme-cn
theme: {
- 'primary-color': defaultSettings.primaryColor,
+ 'primary-color': primaryColor,
},
externals: {
'@antv/data-set': 'DataSet',
},
- // proxy: {
- // '/server/api/': {
- // target: 'https://preview.pro.ant.design/',
- // changeOrigin: true,
- // pathRewrite: { '^/server': '' },
- // },
- // },
ignoreMomentLocale: true,
lessLoaderOptions: {
javascriptEnabled: true,
},
- disableRedirectHoist: true,
- cssLoaderOptions: {
- modules: true,
- getLocalIdent: (context, localIdentName, localName) => {
- if (
- context.resourcePath.includes('node_modules') ||
- context.resourcePath.includes('ant.design.pro.less') ||
- context.resourcePath.includes('global.less')
- ) {
- return localName;
- }
- const match = context.resourcePath.match(/src(.*)/);
- if (match && match[1]) {
- const antdProPath = match[1].replace('.less', '');
- const arr = slash(antdProPath)
- .split('/')
- .map(a => a.replace(/([A-Z])/g, '-$1'))
- .map(a => a.toLowerCase());
- return `antd-pro${arr.join('-')}-${localName}`.replace(/--/g, '-');
- }
- return localName;
- },
- },
- manifest: {
- basePath: '/',
- },
-
- chainWebpack: webpackPlugin,
};
diff --git a/config/plugin.config.js b/config/plugin.config.js
deleted file mode 100644
index b9e842d26a900cceb0880b75c3e5c7489cb0c81f..0000000000000000000000000000000000000000
--- a/config/plugin.config.js
+++ /dev/null
@@ -1,33 +0,0 @@
-// Change theme plugin
-
-import MergeLessPlugin from 'antd-pro-merge-less';
-import AntDesignThemePlugin from 'antd-theme-webpack-plugin';
-import path from 'path';
-
-export default config => {
- // pro 和 开发环境再添加这个插件
- if (process.env.APP_TYPE === 'site' || process.env.NODE_ENV !== 'production') {
- // 将所有 less 合并为一个供 themePlugin使用
- const outFile = path.join(__dirname, '../.temp/ant-design-pro.less');
- const stylesDir = path.join(__dirname, '../src/');
-
- config.plugin('merge-less').use(MergeLessPlugin, [
- {
- stylesDir,
- outFile,
- },
- ]);
-
- config.plugin('ant-design-theme').use(AntDesignThemePlugin, [
- {
- antDir: path.join(__dirname, '../node_modules/antd'),
- stylesDir,
- varFile: path.join(__dirname, '../node_modules/antd/lib/style/themes/default.less'),
- mainLessFile: outFile, // themeVariables: ['@primary-color'],
- indexFileName: 'index.html',
- generateOne: true,
- lessUrl: 'https://gw.alipayobjects.com/os/lib/less.js/3.8.1/less.min.js',
- },
- ]);
- }
-};
diff --git a/docker/docker-compose.dev.yml b/docker/docker-compose.dev.yml
deleted file mode 100644
index d7ab2138339a456e9c46e830b8692545c712fbc2..0000000000000000000000000000000000000000
--- a/docker/docker-compose.dev.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-version: "3.5"
-
-services:
- ant-design-pro_dev:
- ports:
- - 8000:8000
- build:
- context: ../
- dockerfile: Dockerfile.dev
- container_name: "ant-design-pro_dev"
- volumes:
- - ../src:/usr/src/app/src
- - ../config:/usr/src/app/config
- - ../mock:/usr/src/app/mock
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
deleted file mode 100644
index d055600644912e1af5010c0461808caa7b756b96..0000000000000000000000000000000000000000
--- a/docker/docker-compose.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-version: "3.5"
-
-services:
- ant-design-pro_build:
- build: ../
- container_name: "ant-design-pro_build"
- volumes:
- - dist:/usr/src/app/dist
-
- ant-design-pro_web:
- image: nginx
- ports:
- - 80:80
- container_name: "ant-design-pro_web"
- restart: unless-stopped
- volumes:
- - dist:/usr/share/nginx/html:ro
- - ./nginx.conf:/etc/nginx/conf.d/default.conf
-
-volumes:
- dist:
diff --git a/docker/nginx.conf b/docker/nginx.conf
deleted file mode 100644
index 5f86992c8fbb8accbb878e6c9c93366d1ab8eb26..0000000000000000000000000000000000000000
--- a/docker/nginx.conf
+++ /dev/null
@@ -1,22 +0,0 @@
-server {
- listen 80;
- # gzip config
- gzip on;
- gzip_min_length 1k;
- gzip_comp_level 9;
- gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml;
- gzip_vary on;
- gzip_disable "MSIE [1-6]\.";
-
- root /usr/share/nginx/html;
-
- location / {
- try_files $uri $uri/ /index.html;
- }
- location /api {
- proxy_pass https://preview.pro.ant.design;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_set_header Host $http_host;
- proxy_set_header X-Real-IP $remote_addr;
- }
-}
diff --git a/firebase.json b/firebase.json
deleted file mode 100644
index a00223d4ddce6ed47ef14af8e3b78f86294c0706..0000000000000000000000000000000000000000
--- a/firebase.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "hosting": {
- "public": "dist",
- "rewrites": [
- { "source": "/api/**", "function": "api" },
- {
- "source": "**",
- "destination": "/index.html"
- }
- ],
- "ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
- }
-}
diff --git a/netlify.toml b/netlify.toml
deleted file mode 100644
index 18b22e9d58b17ae991caaa6f96317b1aeac87f93..0000000000000000000000000000000000000000
--- a/netlify.toml
+++ /dev/null
@@ -1,13 +0,0 @@
-[[redirects]]
- from = "/api/*"
- to = "https://us-central1-antd-pro.cloudfunctions.net/api/api/:splat"
- status = 200
- force = true
- [redirects.headers]
- X-From = "Netlify"
- X-Api-Key = "some-api-key-string"
-
-[[redirects]]
- from = "/*"
- to = "/index.html"
- status = 200
\ No newline at end of file
diff --git a/scripts/generateMock.js b/scripts/generateMock.js
deleted file mode 100644
index 54c7d6d624fcefd98cec3600538284a5056910a7..0000000000000000000000000000000000000000
--- a/scripts/generateMock.js
+++ /dev/null
@@ -1,3 +0,0 @@
-const generateMock = require('merge-umi-mock-data');
-const path = require('path');
-generateMock(path.join(__dirname, '../mock'), path.join(__dirname, '../functions/mock/index.js'));
diff --git a/src/components/ActiveChart/index.js b/src/components/ActiveChart/index.js
index 4976be31f225751f6d8cfb77b861f24dbe120761..051ae4484822ffd6fa7ce308c9cdb994fbebae3d 100644
--- a/src/components/ActiveChart/index.js
+++ b/src/components/ActiveChart/index.js
@@ -3,7 +3,7 @@ import { NumberInfo, Charts } from 'ant-design-pro';
import styles from './index.less';
-const { MiniArea } = Charts;
+const { MiniArea } = Charts;
function fixedZero(val) {
return val * 1 < 10 ? `0${val}` : val;
diff --git a/src/global.js b/src/global.js
deleted file mode 100644
index 62f8ccebefe899371f39e0419cc3f82d514fafc9..0000000000000000000000000000000000000000
--- a/src/global.js
+++ /dev/null
@@ -1,54 +0,0 @@
-import React from 'react';
-import { notification, Button, message } from 'antd';
-import { formatMessage } from 'umi/locale';
-
-// Notify user if offline now
-window.addEventListener('sw.offline', () => {
- message.warning(formatMessage({ id: 'app.pwa.offline' }));
-});
-
-// Pop up a prompt on the page asking the user if they want to use the latest version
-window.addEventListener('sw.updated', e => {
- const reloadSW = async () => {
- // Check if there is sw whose state is waiting in ServiceWorkerRegistration
- // https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration
- const worker = e.detail && e.detail.waiting;
- if (!worker) {
- return Promise.resolve();
- }
- // Send skip-waiting event to waiting SW with MessageChannel
- await new Promise((resolve, reject) => {
- const channel = new MessageChannel();
- channel.port1.onmessage = event => {
- if (event.data.error) {
- reject(event.data.error);
- } else {
- resolve(event.data);
- }
- };
- worker.postMessage({ type: 'skip-waiting' }, [channel.port2]);
- });
- // Refresh current page to use the updated HTML and other assets after SW has skiped waiting
- window.location.reload(true);
- return true;
- };
- const key = `open${Date.now()}`;
- const btn = (
-
- );
- notification.open({
- message: formatMessage({ id: 'app.pwa.serviceworker.updated' }),
- description: formatMessage({ id: 'app.pwa.serviceworker.updated.hint' }),
- btn,
- key,
- onClose: async () => {},
- });
-});
diff --git a/src/locales/pt-BR.js b/src/locales/pt-BR.js
new file mode 100644
index 0000000000000000000000000000000000000000..b4c456f060a10036c484ae6282c9b1e3c7d27cdc
--- /dev/null
+++ b/src/locales/pt-BR.js
@@ -0,0 +1,18 @@
+import globalHeader from './pt-BR/globalHeader';
+import menu from './pt-BR/menu';
+import settingDrawer from './pt-BR/settingDrawer';
+import settings from './pt-BR/settings';
+import pwa from './pt-BR/pwa';
+
+export default {
+ 'navBar.lang': 'Idiomas',
+ 'layout.user.link.help': 'ajuda',
+ 'layout.user.link.privacy': 'política de privacidade',
+ 'layout.user.link.terms': 'termos de serviços',
+ 'app.home.introduce': 'introduzir',
+ ...globalHeader,
+ ...menu,
+ ...settingDrawer,
+ ...settings,
+ ...pwa,
+};
diff --git a/src/manifest.json b/src/manifest.json
deleted file mode 100644
index 839bc5b5e4a561676fca44a61674d3990b5acd48..0000000000000000000000000000000000000000
--- a/src/manifest.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "Ant Design Pro",
- "short_name": "Ant Design Pro",
- "display": "standalone",
- "start_url": "./?utm_source=homescreen",
- "theme_color": "#002140",
- "background_color": "#001529",
- "icons": [
- {
- "src": "icons/icon-192x192.png",
- "sizes": "192x192"
- },
- {
- "src": "icons/icon-128x128.png",
- "sizes": "128x128"
- },
- {
- "src": "icons/icon-512x512.png",
- "sizes": "512x512"
- }
- ]
-}
diff --git a/src/pages/Authorized.js b/src/pages/Authorized.js
deleted file mode 100644
index 5c1b819925522c4cd43bb745a2bf160d3337f475..0000000000000000000000000000000000000000
--- a/src/pages/Authorized.js
+++ /dev/null
@@ -1,13 +0,0 @@
-import React from 'react';
-import RenderAuthorized from 'ant-design-pro/lib/Authorized';
-import { getAuthority } from '@/utils/authority';
-import Redirect from 'umi/redirect';
-
-const Authority = getAuthority();
-const Authorized = RenderAuthorized(Authority);
-
-export default ({ children }) => (
- }>
- {children}
-
-);
diff --git a/src/service-worker.js b/src/service-worker.js
deleted file mode 100644
index 48d43c2545b6bd9e92ba6fce550dfbccbc3615f3..0000000000000000000000000000000000000000
--- a/src/service-worker.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/* globals workbox */
-/* eslint-disable no-restricted-globals */
-workbox.core.setCacheNameDetails({
- prefix: 'antd-pro',
- suffix: 'v1',
-});
-// Control all opened tabs ASAP
-workbox.clientsClaim();
-
-/**
- * Use precaching list generated by workbox in build process.
- * https://developers.google.com/web/tools/workbox/reference-docs/latest/workbox.precaching
- */
-/* eslint-disable no-underscore-dangle */
-workbox.precaching.precacheAndRoute(self.__precacheManifest || []);
-
-/**
- * Register a navigation route.
- * https://developers.google.com/web/tools/workbox/modules/workbox-routing#how_to_register_a_navigation_route
- */
-workbox.routing.registerNavigationRoute('/index.html');
-
-/**
- * Use runtime cache:
- * https://developers.google.com/web/tools/workbox/reference-docs/latest/workbox.routing#.registerRoute
- *
- * Workbox provides all common caching strategies including CacheFirst, NetworkFirst etc.
- * https://developers.google.com/web/tools/workbox/reference-docs/latest/workbox.strategies
- */
-
-/**
- * Handle API requests
- */
-workbox.routing.registerRoute(/\/api\//, workbox.strategies.networkFirst());
-
-/**
- * Handle third party requests
- */
-workbox.routing.registerRoute(
- /^https:\/\/gw.alipayobjects.com\//,
- workbox.strategies.networkFirst()
-);
-workbox.routing.registerRoute(
- /^https:\/\/cdnjs.cloudflare.com\//,
- workbox.strategies.networkFirst()
-);
-workbox.routing.registerRoute(/\/color.less/, workbox.strategies.networkFirst());
-
-/**
- * Response to client after skipping waiting with MessageChannel
- */
-addEventListener('message', event => {
- const replyPort = event.ports[0];
- const message = event.data;
- if (replyPort && message && message.type === 'skip-waiting') {
- event.waitUntil(
- self
- .skipWaiting()
- .then(
- () => replyPort.postMessage({ error: null }),
- error => replyPort.postMessage({ error })
- )
- );
- }
-});
diff --git a/webpack.config.js b/webpack.config.js
new file mode 100644
index 0000000000000000000000000000000000000000..4acb27a907aefe273907d906f169a33612d3a0bd
--- /dev/null
+++ b/webpack.config.js
@@ -0,0 +1,12 @@
+/**
+ * 不是真实的 webpack 配置,仅为兼容 webstorm 和 intellij idea 代码跳转
+ * ref: https://github.com/umijs/umi/issues/1109#issuecomment-423380125
+ */
+
+module.exports = {
+ resolve: {
+ alias: {
+ '@': require('path').resolve(__dirname, 'src'), // eslint-disable-line
+ },
+ },
+};