commit fad8f9be18010b0af660fcc1e580b509293aa930 Author: dangdinh Date: Fri Feb 17 14:25:44 2023 +0700 open link diff --git a/.editorconfig b/.editorconfig new file mode 100755 index 0000000..7e3649a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +# 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 + +[*.md] +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bee1cf6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/npm-debug.log* +/yarn-error.log +/yarn.lock +/package-lock.json + +# production +/dist + +# misc +.DS_Store + +# umi +/src/.umi +/src/.umi-production +/src/.umi-test +/.env.local diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..0d4222f --- /dev/null +++ b/.prettierignore @@ -0,0 +1,8 @@ +**/*.md +**/*.svg +**/*.ejs +**/*.html +package.json +.umi +.umi-production +.umi-test diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..94beb14 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,11 @@ +{ + "singleQuote": true, + "trailingComma": "all", + "printWidth": 80, + "overrides": [ + { + "files": ".prettierrc", + "options": { "parser": "json" } + } + ] +} diff --git a/.umirc.ts b/.umirc.ts new file mode 100644 index 0000000..1b5d8a5 --- /dev/null +++ b/.umirc.ts @@ -0,0 +1,12 @@ +import { defineConfig } from 'umi'; + +export default defineConfig({ + nodeModulesTransform: { + type: 'none', + }, + routes: [ + { path: '/', component: '@/pages/index' }, + { path: '/action', component: '@/pages/index' }, + ], + fastRefresh: {}, +}); diff --git a/README.md b/README.md new file mode 100644 index 0000000..07afeb7 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# umi project + +## Getting Started + +Install dependencies, + +```bash +$ yarn +``` + +Start the dev server, + +```bash +$ yarn start +``` diff --git a/mock/.gitkeep b/mock/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/package.json b/package.json new file mode 100644 index 0000000..bee820b --- /dev/null +++ b/package.json @@ -0,0 +1,40 @@ +{ + "private": true, + "scripts": { + "start": "umi dev", + "build": "umi build", + "postinstall": "umi generate tmp", + "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'", + "test": "umi-test", + "test:coverage": "umi-test --coverage" + }, + "gitHooks": { + "pre-commit": "lint-staged" + }, + "lint-staged": { + "*.{js,jsx,less,md,json}": [ + "prettier --write" + ], + "*.ts?(x)": [ + "prettier --parser=typescript --write" + ] + }, + "dependencies": { + "@ant-design/pro-layout": "^6.5.0", + "query-string": "^8.1.0", + "react": "17.x", + "react-device-detect": "^2.2.3", + "react-dom": "17.x", + "umi": "^3.5.37" + }, + "devDependencies": { + "@types/react": "^17.0.0", + "@types/react-dom": "^17.0.0", + "@umijs/preset-react": "1.x", + "@umijs/test": "^3.5.37", + "lint-staged": "^10.0.7", + "prettier": "^2.2.0", + "typescript": "^4.1.2", + "yorkie": "^2.0.0" + } +} diff --git a/src/pages/index.css b/src/pages/index.css new file mode 100644 index 0000000..0b04c1b --- /dev/null +++ b/src/pages/index.css @@ -0,0 +1,68 @@ +@import 'https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css'; +@import 'https://fonts.googleapis.com/css?family=Open+Sans'; + +* { + font-family: 'Open Sans', 'sans-serif'; +} + +html, +body { + overflow : hidden; + background-color: #c36; +} + +ul { + width : 100%; + text-align: center; + margin : 0; + padding : 0; + position : absolute; + top : 50%; + transform : translateY(-50%); +} + +li { + display: inline-block; + margin : 10px; +} + +.download { + width : 200px; + height : 75px; + background : black; + float : left; + border-radius: 5px; + position : relative; + color : #fff; + cursor : pointer; + border : 1px solid #fff; +} + +.download>.fa { + color : #fff; + position : absolute; + top : 50%; + left : 15px; + transform: translateY(-50%); +} + +.df, +.dfn { + position: absolute; + left : 70px; +} + +.df { + top : 20px; + font-size: 0.68em; +} + +.dfn { + top : 33px; + font-size: 1.08em; +} + +.download:hover { + -webkit-filter: invert(100%); + filter : invert(100%); +} diff --git a/src/pages/index.tsx b/src/pages/index.tsx new file mode 100644 index 0000000..12d5f56 --- /dev/null +++ b/src/pages/index.tsx @@ -0,0 +1,63 @@ +import { useEffect } from 'react'; +import { isAndroid, isIOS } from 'react-device-detect'; +import { useLocation } from 'umi'; +import './index.css'; + +export default function DeepLink() { + const { search, query } = useLocation() as any; + const deeplinkDomain = /(\/(deeplink|dl)\.)/g; + const isDeeplinkDomain = deeplinkDomain.test(window.location.origin); + useEffect(() => { + if (isDeeplinkDomain) { + if (isAndroid) { + window.location.replace(`selly://ACTION${search}`); + return; + } + if (isIOS) { + window.location.replace(`selly://ACTION${search}`); + setTimeout( + () => + window.location.replace( + `https://apps.apple.com/vn/app/selly-dễ-dàng-bán-hàng/id1554981586`, + ), + 3000, + ); + return; + } + return window.location.replace(query?.redirect || 'https://selly.vn'); + } + }, []); + + return ( + + ); +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..6d42f8c --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,37 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "importHelpers": true, + "jsx": "react-jsx", + "esModuleInterop": true, + "sourceMap": true, + "baseUrl": "./", + "strict": true, + "paths": { + "@/*": ["src/*"], + "@@/*": ["src/.umi/*"] + }, + "allowSyntheticDefaultImports": true + }, + "include": [ + "mock/**/*", + "src/**/*", + "config/**/*", + ".umirc.ts", + "typings.d.ts" + ], + "exclude": [ + "node_modules", + "lib", + "es", + "dist", + "typings", + "**/__test__", + "test", + "docs", + "tests" + ] +} diff --git a/typings.d.ts b/typings.d.ts new file mode 100644 index 0000000..06c8a5b --- /dev/null +++ b/typings.d.ts @@ -0,0 +1,10 @@ +declare module '*.css'; +declare module '*.less'; +declare module '*.png'; +declare module '*.svg' { + export function ReactComponent( + props: React.SVGProps, + ): React.ReactElement; + const url: string; + export default url; +}