diff --git a/frontend/.babelrc b/frontend/.babelrc deleted file mode 100644 index 3c518b9..0000000 --- a/frontend/.babelrc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "presets": ["@babel/env", "@babel/react"], - "plugins": [ - "@babel/plugin-proposal-class-properties", - "@babel/plugin-proposal-object-rest-spread", - "@babel/plugin-transform-runtime" - ], - "env": { - "production": { - "plugins": [ - ["transform-react-remove-prop-types", { - "removeImport": true - }] - ] - } - } -} diff --git a/frontend/.editorconfig b/frontend/.editorconfig deleted file mode 100644 index 9d08a1a..0000000 --- a/frontend/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -root = true - -[*] -charset = utf-8 -indent_style = space -indent_size = 2 -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true diff --git a/frontend/.eslintignore b/frontend/.eslintignore deleted file mode 100644 index 9cbb3eb..0000000 --- a/frontend/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -coverage -dist -docs diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js deleted file mode 100644 index ba3e40f..0000000 --- a/frontend/.eslintrc.js +++ /dev/null @@ -1,38 +0,0 @@ -// Default config: https://github.com/dzervoudakes/dztools/blob/master/packages/formatting/eslint-config-react/index.js -const OFF = 0; -const ERROR = 2; - -module.exports = { - extends: ['@dztools/eslint-config-react'], - overrides: [ - { - files: ['scripts/*.js'], - rules: { - 'no-console': OFF, - 'jest/no-jest-import': OFF - } - } - ], - rules: { - 'import/no-extraneous-dependencies': [ - ERROR, - { - devDependencies: [ - 'webpack.config.js', - 'build/**', - 'jest/**', - 'scripts/**', - '**/*.test.*', - '**/*.spec.*' - ] - } - ] - }, - settings: { - 'import/resolver': { - webpack: { - config: 'build/webpack.base.js' - } - } - } -}; diff --git a/frontend/.gitignore b/frontend/.gitignore index 056b12e..4d29575 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -1,6 +1,23 @@ -.vscode +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc .DS_Store -node_modules -coverage -dist -docs +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/frontend/.lintstagedrc.js b/frontend/.lintstagedrc.js deleted file mode 100644 index 8797a4c..0000000 --- a/frontend/.lintstagedrc.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - '*.{js,jsx,mjs}': ['eslint --fix'], - '*.scss': ['stylelint --fix'] -}; diff --git a/frontend/.npmrc b/frontend/.npmrc deleted file mode 100644 index cffe8cd..0000000 --- a/frontend/.npmrc +++ /dev/null @@ -1 +0,0 @@ -save-exact=true diff --git a/frontend/.postcssrc.js b/frontend/.postcssrc.js deleted file mode 100644 index 7426c2c..0000000 --- a/frontend/.postcssrc.js +++ /dev/null @@ -1,7 +0,0 @@ -const postcssPresetEnv = require('postcss-preset-env'); - -module.exports = { - plugins: [ - postcssPresetEnv() - ] -} diff --git a/frontend/.prettierignore b/frontend/.prettierignore deleted file mode 100644 index 9cbb3eb..0000000 --- a/frontend/.prettierignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -coverage -dist -docs diff --git a/frontend/.prettierrc.js b/frontend/.prettierrc.js deleted file mode 100644 index 1f29ce5..0000000 --- a/frontend/.prettierrc.js +++ /dev/null @@ -1,4 +0,0 @@ -// Default config: https://github.com/dzervoudakes/dztools/blob/master/packages/formatting/prettier-config/index.js -const config = require('@dztools/prettier-config'); - -module.exports = config; diff --git a/frontend/.stylelintignore b/frontend/.stylelintignore deleted file mode 100644 index 9cbb3eb..0000000 --- a/frontend/.stylelintignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -coverage -dist -docs diff --git a/frontend/.stylelintrc.js b/frontend/.stylelintrc.js deleted file mode 100644 index 5705bbb..0000000 --- a/frontend/.stylelintrc.js +++ /dev/null @@ -1,4 +0,0 @@ -// Default config: https://github.com/dzervoudakes/dztools/blob/master/packages/formatting/stylelint-config/index.js -module.exports = { - extends: ['@dztools/stylelint-config'] -}; diff --git a/frontend/README.md b/frontend/README.md index 7d904cb..9c40dcd 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -1,83 +1,68 @@ -# JavaScript React Template -> Welcome to your new React app. +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). -[![prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io/) +## Available Scripts -## Build Scripts +In the project directory, you can run: -### Install Dependencies -``` -yarn -``` +### `yarn start` -### Start Local Server on Port 8080 -``` -yarn start -``` +Runs the app in the development mode.
+Open [http://localhost:3000](http://localhost:3000) to view it in the browser. -### Run Linting -``` -yarn lint -``` +The page will reload if you make edits.
+You will also see any lint errors in the console. -### Run Linting with Fix -``` -yarn lint:fix -``` +### `yarn test` -### Run Style Linting -``` -yarn stylelint -``` +Launches the test runner in the interactive watch mode.
+See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. -### Run Style Linting with Fix -``` -yarn stylelint:fix -``` +### `yarn build` -### Run Unit Tests -``` -yarn test -``` +Builds the app for production to the `build` folder.
+It correctly bundles React in production mode and optimizes the build for the best performance. -### Run Unit Tests with Coverage Report -``` -yarn test:coverage -``` +The build is minified and the filenames include the hashes.
+Your app is ready to be deployed! -### Run Unit Tests with Verbose Results -``` -yarn test:verbose -``` +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. -### Run Unit Tests and Watch for Changes -``` -yarn test:watch -``` +### `yarn eject` -### Build for Production -``` -yarn build -``` +**Note: this is a one-way operation. Once you `eject`, you can’t go back!** -### Build for Production with Bundle Analyzer Report -``` -yarn build:report -``` +If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. -### Generate Documentation -``` -yarn docs -``` +Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. -### Remove All Build Directories -``` -yarn clean -``` +You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. -## Technical Requirements -> The runtime environment for this application requires `node >= 14.6.0` and `yarn >= 1.22.4`. +## Learn More -## Configuration -> This application makes use of `ESLint`, `Stylelint` and `EditorConfig`. Each of these features requires -> an extension be installed in order to work properly with IDEs and text editors such as VSCode. +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). + +To learn React, check out the [React documentation](https://reactjs.org/). + +### Code Splitting + +This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting + +### Analyzing the Bundle Size + +This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size + +### Making a Progressive Web App + +This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app + +### Advanced Configuration + +This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration + +### Deployment + +This section has moved here: https://facebook.github.io/create-react-app/docs/deployment + +### `yarn build` fails to minify + +This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify diff --git a/frontend/build/webpack.base.js b/frontend/build/webpack.base.js deleted file mode 100644 index 641204d..0000000 --- a/frontend/build/webpack.base.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @fileoverview Base Webpack configuration, shared between development and production builds. - * - Default config: https://github.com/dzervoudakes/dztools/blob/master/packages/bundlers/webpack-config-react/config/webpack.base.js - * - Notes on customizing/extending: https://github.com/dzervoudakes/dztools/tree/master/packages/bundlers/webpack-config-react#readme - */ -const { webpackBaseConfig } = require('@dztools/webpack-config-react'); - -module.exports = webpackBaseConfig; diff --git a/frontend/build/webpack.dev.js b/frontend/build/webpack.dev.js deleted file mode 100644 index 7bf02fb..0000000 --- a/frontend/build/webpack.dev.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @fileoverview Webpack development configuration. - * - Default config: https://github.com/dzervoudakes/dztools/blob/master/packages/bundlers/webpack-config-react/config/webpack.dev.js - * - Notes on customizing/extending: https://github.com/dzervoudakes/dztools/tree/master/packages/bundlers/webpack-config-react#readme - */ -const { webpackDevConfig } = require('@dztools/webpack-config-react'); - -module.exports = webpackDevConfig; diff --git a/frontend/build/webpack.prod.js b/frontend/build/webpack.prod.js deleted file mode 100644 index 1639a9b..0000000 --- a/frontend/build/webpack.prod.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @fileoverview Webpack production configuration. - * - Default config: https://github.com/dzervoudakes/dztools/blob/master/packages/bundlers/webpack-config-react/config/webpack.prod.js - * - Notes on customizing/extending: https://github.com/dzervoudakes/dztools/tree/master/packages/bundlers/webpack-config-react#readme - */ -const { webpackProdConfig } = require('@dztools/webpack-config-react'); - -module.exports = webpackProdConfig; diff --git a/frontend/jest.config.js b/frontend/jest.config.js deleted file mode 100644 index 14d25a2..0000000 --- a/frontend/jest.config.js +++ /dev/null @@ -1,4 +0,0 @@ -// Default config: https://github.com/dzervoudakes/dztools/blob/master/packages/testing/jest-config-react/jest-preset.js -module.exports = { - preset: '@dztools/jest-config-react' -}; diff --git a/frontend/jsdoc.config.js b/frontend/jsdoc.config.js deleted file mode 100644 index 73f7ba0..0000000 --- a/frontend/jsdoc.config.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @fileoverview Define configuration for documentation output. - */ -module.exports = { - opts: { - destination: './docs', - encoding: 'utf8', - template: './node_modules/docdash' - }, - source: { - include: ['./README.md', './build', './scripts', './src'] - } -}; diff --git a/frontend/package.json b/frontend/package.json index 5ff484d..ca02dcb 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,87 +1,34 @@ { - "name": "frontend", + "name": "online-doctor-appointment-system", "version": "0.1.0", - "description": "frontend application, built with React.", - "main": "index.js", - "scripts": { - "build": "cross-env NODE_ENV=production node scripts/build", - "build:report": "yarn build --report", - "clean": "rimraf coverage dist docs", - "docs": "jsdoc -c ./jsdoc.config.js -r", - "lint": "node scripts/eslint", - "lint:fix": "yarn lint --fix", - "start": "cross-env NODE_ENV=development webpack-dev-server", - "stylelint": "node scripts/stylelint", - "stylelint:fix": "yarn stylelint --fix", - "test": "node scripts/test", - "test:coverage": "yarn test --coverage", - "test:verbose": "yarn test --verbose", - "test:watch": "yarn test --watchAll" - }, - "repository": {}, - "author": "", - "license": "UNLICENSED", + "private": true, "dependencies": { - "core-js": "3.6.5", - "prop-types": "15.7.2", - "react": "16.13.1", - "react-dom": "16.13.1", - "react-router-dom": "5.2.0", - "regenerator-runtime": "0.13.7" + "@testing-library/jest-dom": "^4.2.4", + "@testing-library/react": "^9.3.2", + "@testing-library/user-event": "^7.1.2", + "react": "^16.14.0", + "react-dom": "^16.14.0", + "react-scripts": "3.4.3" }, - "devDependencies": { - "@babel/core": "7.11.4", - "@babel/plugin-proposal-class-properties": "7.10.4", - "@babel/plugin-proposal-object-rest-spread": "7.11.0", - "@babel/plugin-transform-runtime": "7.11.0", - "@babel/preset-env": "7.11.0", - "@babel/preset-react": "7.10.4", - "@dztools/eslint-config-react": "1.0.2", - "@dztools/jest-config-react": "1.0.2", - "@dztools/prettier-config": "1.0.2", - "@dztools/stylelint-config": "1.1.1", - "@dztools/webpack-config-react": "1.3.0", - "@testing-library/react": "10.4.9", - "babel-eslint": "10.1.0", - "babel-plugin-transform-react-remove-prop-types": "0.4.24", - "chalk": "4.1.0", - "cross-env": "7.0.2", - "docdash": "1.2.0", - "eslint": "7.7.0", - "eslint-config-airbnb": "18.2.0", - "eslint-config-prettier": "6.11.0", - "eslint-import-resolver-webpack": "0.12.2", - "eslint-plugin-import": "2.22.0", - "eslint-plugin-jest": "23.20.0", - "eslint-plugin-jsx-a11y": "6.3.1", - "eslint-plugin-prettier": "3.1.4", - "eslint-plugin-react": "7.20.6", - "eslint-plugin-react-hooks": "4.1.0", - "husky": "4.2.5", - "jest": "26.4.2", - "jsdoc": "3.6.5", - "lint-staged": "10.2.11", - "ora": "5.0.0", - "postcss-preset-env": "6.7.0", - "prettier": "2.0.5", - "rimraf": "3.0.2", - "stylelint": "13.6.1", - "webpack": "4.44.1", - "webpack-cli": "3.3.12", - "webpack-dev-server": "3.11.0", - "webpack-merge": "5.1.2" + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject" }, - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } + "eslintConfig": { + "extends": "react-app" }, - "engines": { - "node": ">= 14.6.0", - "yarn": ">= 1.22.4" - }, - "browserslist": [ - "> 1%", - "last 2 versions" - ] + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } } diff --git a/frontend/public/favicon.ico b/frontend/public/favicon.ico index a11777c..bcd5dfd 100644 Binary files a/frontend/public/favicon.ico and b/frontend/public/favicon.ico differ diff --git a/frontend/public/index.html b/frontend/public/index.html index e6c2213..aa069f2 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -1,15 +1,43 @@ - + - frontend - - - - - + + + + + + + + + + React App - +
+ diff --git a/frontend/public/logo192.png b/frontend/public/logo192.png new file mode 100644 index 0000000..fc44b0a Binary files /dev/null and b/frontend/public/logo192.png differ diff --git a/frontend/public/logo512.png b/frontend/public/logo512.png new file mode 100644 index 0000000..a4e47a6 Binary files /dev/null and b/frontend/public/logo512.png differ diff --git a/frontend/public/manifest.json b/frontend/public/manifest.json new file mode 100644 index 0000000..080d6c7 --- /dev/null +++ b/frontend/public/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "React App", + "name": "Create React App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "logo192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "logo512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/frontend/public/robots.txt b/frontend/public/robots.txt new file mode 100644 index 0000000..e9e57dc --- /dev/null +++ b/frontend/public/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/frontend/scripts/build.js b/frontend/scripts/build.js deleted file mode 100644 index ba74057..0000000 --- a/frontend/scripts/build.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @fileoverview Build script that compiles the application for production. - */ -const webpack = require('webpack'); -const chalk = require('chalk'); -const ora = require('ora'); -const webpackConfig = require('../webpack.config'); - -const spinner = ora('Building for production...'); -spinner.start(); - -process.env.BABEL_ENV = 'production'; - -webpack(webpackConfig, (err, stats) => { - spinner.stop(); - if (err) { - throw err; - } - - process.stdout.write( - `${stats.toString({ - colors: true, - modules: false, - children: false, - chunks: false, - chunkModules: false - })}\n\n` - ); - - if (stats.hasErrors()) { - console.log(chalk.red('Build failed with errors.\n')); - process.exit(1); - } - - console.log( - chalk.cyan( - 'The application has been bundled successfully and is ready for distribution.\n' - ) - ); -}); diff --git a/frontend/scripts/eslint.js b/frontend/scripts/eslint.js deleted file mode 100644 index a75f0e4..0000000 --- a/frontend/scripts/eslint.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @fileoverview Build script that runs eslint against all application script files. - */ -const { CLIEngine } = require('eslint'); -const chalk = require('chalk'); -const ora = require('ora'); - -process.on('unhandledRejection', (err) => { - throw err; -}); - -const spinner = ora('Linting all scripts...'); -spinner.start(); - -const fix = process.argv.indexOf('--fix') !== -1; -const cli = new CLIEngine({ fix }); - -const report = cli.executeOnFiles(['**/*.js', '**/*.jsx']); -const formatter = cli.getFormatter(); - -if (fix) { - CLIEngine.outputFixes(report); -} - -spinner.stop(); -console.log(formatter(report.results)); - -const { errorCount, warningCount } = report; - -if (errorCount === 0) { - if (warningCount === 0) { - console.log(chalk.green('Linting complete: no warnings or errors found.\n')); - } else { - console.log(chalk.yellow('Linting complete: warnings found.\n')); - } -} else { - throw new Error('Lint errors found.\n'); -} diff --git a/frontend/scripts/stylelint.js b/frontend/scripts/stylelint.js deleted file mode 100644 index e98f59a..0000000 --- a/frontend/scripts/stylelint.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @fileoverview Build script that runs stylelint against all application style files. - */ -const stylelint = require('stylelint'); -const chalk = require('chalk'); -const ora = require('ora'); - -process.on('unhandledRejection', (err) => { - throw err; -}); - -const spinner = ora('Linting all styles...'); -spinner.start(); - -const fix = process.argv.indexOf('--fix') !== -1; -const opts = { files: '**/*.scss', fix, formatter: 'string' }; - -stylelint - .lint(opts) - .then((result) => { - spinner.stop(); - console.log(result.output); - - if (!result.errored) { - console.log(chalk.green('Style linting complete: no warnings or errors found.\n')); - } else { - throw new Error('Stylelint errors found.\n'); - } - }) - .catch((error) => { - console.error(error.stack); - }); diff --git a/frontend/scripts/test.js b/frontend/scripts/test.js deleted file mode 100644 index d9ac3b6..0000000 --- a/frontend/scripts/test.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * @fileoverview Build script that runs unit tests with Jest. - */ -const jest = require('jest'); - -process.env.BABEL_ENV = 'test'; -process.env.NODE_ENV = 'test'; - -process.on('unhandledRejection', (err) => { - throw err; -}); - -const argv = process.argv.slice(2); - -jest.run(argv); diff --git a/frontend/src/App.css b/frontend/src/App.css new file mode 100644 index 0000000..74b5e05 --- /dev/null +++ b/frontend/src/App.css @@ -0,0 +1,38 @@ +.App { + text-align: center; +} + +.App-logo { + height: 40vmin; + pointer-events: none; +} + +@media (prefers-reduced-motion: no-preference) { + .App-logo { + animation: App-logo-spin infinite 20s linear; + } +} + +.App-header { + background-color: #282c34; + min-height: 100vh; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: calc(10px + 2vmin); + color: white; +} + +.App-link { + color: #61dafb; +} + +@keyframes App-logo-spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} diff --git a/frontend/src/App.js b/frontend/src/App.js new file mode 100644 index 0000000..ce9cbd2 --- /dev/null +++ b/frontend/src/App.js @@ -0,0 +1,26 @@ +import React from 'react'; +import logo from './logo.svg'; +import './App.css'; + +function App() { + return ( +
+
+ logo +

+ Edit src/App.js and save to reload. +

+ + Learn React + +
+
+ ); +} + +export default App; diff --git a/frontend/src/App.test.js b/frontend/src/App.test.js new file mode 100644 index 0000000..4db7ebc --- /dev/null +++ b/frontend/src/App.test.js @@ -0,0 +1,9 @@ +import React from 'react'; +import { render } from '@testing-library/react'; +import App from './App'; + +test('renders learn react link', () => { + const { getByText } = render(); + const linkElement = getByText(/learn react/i); + expect(linkElement).toBeInTheDocument(); +}); diff --git a/frontend/src/components/App/App.jsx b/frontend/src/components/App/App.jsx deleted file mode 100644 index 98f691f..0000000 --- a/frontend/src/components/App/App.jsx +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react'; -import Routes from '@src/components/Routes'; -import Header from '@src/components/Header'; -import Footer from '@src/components/Footer'; - -const App = () => ( - <> -
- -