Browse Source

React App commit

master
Satyendra Hari 3 years ago
parent
commit
267cfcf921
67 changed files with 85133 additions and 1 deletions
  1. +1
    -1
      API/POCDistance/Service/LocationService.cs
  2. +23
    -0
      ReactApp/.gitignore
  3. +70
    -0
      ReactApp/README.md
  4. +25773
    -0
      ReactApp/package-lock.json
  5. +40
    -0
      ReactApp/package.json
  6. +5002
    -0
      ReactApp/public/bootstrap/css/bootstrap-grid.css
  7. +1
    -0
      ReactApp/public/bootstrap/css/bootstrap-grid.css.map
  8. +7
    -0
      ReactApp/public/bootstrap/css/bootstrap-grid.min.css
  9. +1
    -0
      ReactApp/public/bootstrap/css/bootstrap-grid.min.css.map
  10. +5001
    -0
      ReactApp/public/bootstrap/css/bootstrap-grid.rtl.css
  11. +1
    -0
      ReactApp/public/bootstrap/css/bootstrap-grid.rtl.css.map
  12. +7
    -0
      ReactApp/public/bootstrap/css/bootstrap-grid.rtl.min.css
  13. +1
    -0
      ReactApp/public/bootstrap/css/bootstrap-grid.rtl.min.css.map
  14. +426
    -0
      ReactApp/public/bootstrap/css/bootstrap-reboot.css
  15. +1
    -0
      ReactApp/public/bootstrap/css/bootstrap-reboot.css.map
  16. +8
    -0
      ReactApp/public/bootstrap/css/bootstrap-reboot.min.css
  17. +1
    -0
      ReactApp/public/bootstrap/css/bootstrap-reboot.min.css.map
  18. +423
    -0
      ReactApp/public/bootstrap/css/bootstrap-reboot.rtl.css
  19. +1
    -0
      ReactApp/public/bootstrap/css/bootstrap-reboot.rtl.css.map
  20. +8
    -0
      ReactApp/public/bootstrap/css/bootstrap-reboot.rtl.min.css
  21. +1
    -0
      ReactApp/public/bootstrap/css/bootstrap-reboot.rtl.min.css.map
  22. +4752
    -0
      ReactApp/public/bootstrap/css/bootstrap-utilities.css
  23. +1
    -0
      ReactApp/public/bootstrap/css/bootstrap-utilities.css.map
  24. +7
    -0
      ReactApp/public/bootstrap/css/bootstrap-utilities.min.css
  25. +1
    -0
      ReactApp/public/bootstrap/css/bootstrap-utilities.min.css.map
  26. +4743
    -0
      ReactApp/public/bootstrap/css/bootstrap-utilities.rtl.css
  27. +1
    -0
      ReactApp/public/bootstrap/css/bootstrap-utilities.rtl.css.map
  28. +7
    -0
      ReactApp/public/bootstrap/css/bootstrap-utilities.rtl.min.css
  29. +1
    -0
      ReactApp/public/bootstrap/css/bootstrap-utilities.rtl.min.css.map
  30. +10837
    -0
      ReactApp/public/bootstrap/css/bootstrap.css
  31. +1
    -0
      ReactApp/public/bootstrap/css/bootstrap.css.map
  32. +7
    -0
      ReactApp/public/bootstrap/css/bootstrap.min.css
  33. +1
    -0
      ReactApp/public/bootstrap/css/bootstrap.min.css.map
  34. +10813
    -0
      ReactApp/public/bootstrap/css/bootstrap.rtl.css
  35. +1
    -0
      ReactApp/public/bootstrap/css/bootstrap.rtl.css.map
  36. +7
    -0
      ReactApp/public/bootstrap/css/bootstrap.rtl.min.css
  37. +1
    -0
      ReactApp/public/bootstrap/css/bootstrap.rtl.min.css.map
  38. +6748
    -0
      ReactApp/public/bootstrap/js/bootstrap.bundle.js
  39. +1
    -0
      ReactApp/public/bootstrap/js/bootstrap.bundle.js.map
  40. +7
    -0
      ReactApp/public/bootstrap/js/bootstrap.bundle.min.js
  41. +1
    -0
      ReactApp/public/bootstrap/js/bootstrap.bundle.min.js.map
  42. +4967
    -0
      ReactApp/public/bootstrap/js/bootstrap.esm.js
  43. +1
    -0
      ReactApp/public/bootstrap/js/bootstrap.esm.js.map
  44. +7
    -0
      ReactApp/public/bootstrap/js/bootstrap.esm.min.js
  45. +1
    -0
      ReactApp/public/bootstrap/js/bootstrap.esm.min.js.map
  46. +5016
    -0
      ReactApp/public/bootstrap/js/bootstrap.js
  47. +1
    -0
      ReactApp/public/bootstrap/js/bootstrap.js.map
  48. +7
    -0
      ReactApp/public/bootstrap/js/bootstrap.min.js
  49. +1
    -0
      ReactApp/public/bootstrap/js/bootstrap.min.js.map
  50. BIN
      ReactApp/public/favicon.ico
  51. +25
    -0
      ReactApp/public/index.html
  52. BIN
      ReactApp/public/logo192.png
  53. BIN
      ReactApp/public/logo512.png
  54. +25
    -0
      ReactApp/public/manifest.json
  55. +3
    -0
      ReactApp/public/robots.txt
  56. +10
    -0
      ReactApp/src/App.js
  57. +33
    -0
      ReactApp/src/assets/css/home.css
  58. +23
    -0
      ReactApp/src/component/distanceDetails.js
  59. +187
    -0
      ReactApp/src/component/home.js
  60. +3
    -0
      ReactApp/src/config.js
  61. +4
    -0
      ReactApp/src/constant.js
  62. +11
    -0
      ReactApp/src/constraints/validation.js
  63. +19
    -0
      ReactApp/src/index.js
  64. +13
    -0
      ReactApp/src/reportWebVitals.js
  65. +13
    -0
      ReactApp/src/router.js
  66. +23
    -0
      ReactApp/src/services/homeService.js
  67. +5
    -0
      ReactApp/src/setupTests.js

+ 1
- 1
API/POCDistance/Service/LocationService.cs View File

@ -39,7 +39,7 @@ namespace POCDistance.Service
if (!string.IsNullOrWhiteSpace(zipCode) && zipCode.Length > 1)
{
var locations = GetAll();
var query = locations.Where(l => l.ZipCode.Contains(zipCode));
var query = locations.Where(l => l.ZipCode.StartsWith(zipCode));
return query.ToList();
}
return new List<LocationModel>();


+ 23
- 0
ReactApp/.gitignore View File

@ -0,0 +1,23 @@
# 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
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

+ 70
- 0
ReactApp/README.md View File

@ -0,0 +1,70 @@
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
The page will reload when you make changes.\
You may also see any lint errors in the console.
### `npm test`
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.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
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.
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.
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.
## Learn More
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](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](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](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](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](https://facebook.github.io/create-react-app/docs/deployment)
### `npm run build` fails to minify
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

+ 25773
- 0
ReactApp/package-lock.json
File diff suppressed because it is too large
View File


+ 40
- 0
ReactApp/package.json View File

@ -0,0 +1,40 @@
{
"name": "distance-identifier",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"axios": "^0.25.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^6.2.1",
"react-scripts": "5.0.0",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

+ 5002
- 0
ReactApp/public/bootstrap/css/bootstrap-grid.css
File diff suppressed because it is too large
View File


+ 1
- 0
ReactApp/public/bootstrap/css/bootstrap-grid.css.map
File diff suppressed because it is too large
View File


+ 7
- 0
ReactApp/public/bootstrap/css/bootstrap-grid.min.css
File diff suppressed because it is too large
View File


+ 1
- 0
ReactApp/public/bootstrap/css/bootstrap-grid.min.css.map
File diff suppressed because it is too large
View File


+ 5001
- 0
ReactApp/public/bootstrap/css/bootstrap-grid.rtl.css
File diff suppressed because it is too large
View File


+ 1
- 0
ReactApp/public/bootstrap/css/bootstrap-grid.rtl.css.map
File diff suppressed because it is too large
View File


+ 7
- 0
ReactApp/public/bootstrap/css/bootstrap-grid.rtl.min.css
File diff suppressed because it is too large
View File


+ 1
- 0
ReactApp/public/bootstrap/css/bootstrap-grid.rtl.min.css.map
File diff suppressed because it is too large
View File


+ 426
- 0
ReactApp/public/bootstrap/css/bootstrap-reboot.css View File

@ -0,0 +1,426 @@
/*!
* Bootstrap Reboot v5.0.2 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
body {
margin: 0;
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #212529;
background-color: #fff;
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
hr {
margin: 1rem 0;
color: inherit;
background-color: currentColor;
border: 0;
opacity: 0.25;
}
hr:not([size]) {
height: 1px;
}
h6, h5, h4, h3, h2, h1 {
margin-top: 0;
margin-bottom: 0.5rem;
font-weight: 500;
line-height: 1.2;
}
h1 {
font-size: calc(1.375rem + 1.5vw);
}
@media (min-width: 1200px) {
h1 {
font-size: 2.5rem;
}
}
h2 {
font-size: calc(1.325rem + 0.9vw);
}
@media (min-width: 1200px) {
h2 {
font-size: 2rem;
}
}
h3 {
font-size: calc(1.3rem + 0.6vw);
}
@media (min-width: 1200px) {
h3 {
font-size: 1.75rem;
}
}
h4 {
font-size: calc(1.275rem + 0.3vw);
}
@media (min-width: 1200px) {
h4 {
font-size: 1.5rem;
}
}
h5 {
font-size: 1.25rem;
}
h6 {
font-size: 1rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-bs-original-title] {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul {
padding-left: 2rem;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: 0.5rem;
margin-left: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 0.875em;
}
mark {
padding: 0.2em;
background-color: #fcf8e3;
}
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
a {
color: #0d6efd;
text-decoration: underline;
}
a:hover {
color: #0a58ca;
}
a:not([href]):not([class]), a:not([href]):not([class]):hover {
color: inherit;
text-decoration: none;
}
pre,
code,
kbd,
samp {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em;
direction: ltr /* rtl:ignore */;
unicode-bidi: bidi-override;
}
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
font-size: 0.875em;
}
pre code {
font-size: inherit;
color: inherit;
word-break: normal;
}
code {
font-size: 0.875em;
color: #d63384;
word-wrap: break-word;
}
a > code {
color: inherit;
}
kbd {
padding: 0.2rem 0.4rem;
font-size: 0.875em;
color: #fff;
background-color: #212529;
border-radius: 0.2rem;
}
kbd kbd {
padding: 0;
font-size: 1em;
font-weight: 700;
}
figure {
margin: 0 0 1rem;
}
img,
svg {
vertical-align: middle;
}
table {
caption-side: bottom;
border-collapse: collapse;
}
caption {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
color: #6c757d;
text-align: left;
}
th {
text-align: inherit;
text-align: -webkit-match-parent;
}
thead,
tbody,
tfoot,
tr,
td,
th {
border-color: inherit;
border-style: solid;
border-width: 0;
}
label {
display: inline-block;
}
button {
border-radius: 0;
}
button:focus:not(:focus-visible) {
outline: 0;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
select {
text-transform: none;
}
[role=button] {
cursor: pointer;
}
select {
word-wrap: normal;
}
select:disabled {
opacity: 1;
}
[list]::-webkit-calendar-picker-indicator {
display: none;
}
button,
[type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button;
}
button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled) {
cursor: pointer;
}
::-moz-focus-inner {
padding: 0;
border-style: none;
}
textarea {
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
float: left;
width: 100%;
padding: 0;
margin-bottom: 0.5rem;
font-size: calc(1.275rem + 0.3vw);
line-height: inherit;
}
@media (min-width: 1200px) {
legend {
font-size: 1.5rem;
}
}
legend + * {
clear: left;
}
::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-minute,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-year-field {
padding: 0;
}
::-webkit-inner-spin-button {
height: auto;
}
[type=search] {
outline-offset: -2px;
-webkit-appearance: textfield;
}
/* rtl:raw:
[type="tel"],
[type="url"],
[type="email"],
[type="number"] {
direction: ltr;
}
*/
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-color-swatch-wrapper {
padding: 0;
}
::file-selector-button {
font: inherit;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
iframe {
border: 0;
}
summary {
display: list-item;
cursor: pointer;
}
progress {
vertical-align: baseline;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.css.map */

+ 1
- 0
ReactApp/public/bootstrap/css/bootstrap-reboot.css.map
File diff suppressed because it is too large
View File


+ 8
- 0
ReactApp/public/bootstrap/css/bootstrap-reboot.min.css View File

@ -0,0 +1,8 @@
/*!
* Bootstrap Reboot v5.0.2 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.min.css.map */

+ 1
- 0
ReactApp/public/bootstrap/css/bootstrap-reboot.min.css.map
File diff suppressed because it is too large
View File


+ 423
- 0
ReactApp/public/bootstrap/css/bootstrap-reboot.rtl.css View File

@ -0,0 +1,423 @@
/*!
* Bootstrap Reboot v5.0.2 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
body {
margin: 0;
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #212529;
background-color: #fff;
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
hr {
margin: 1rem 0;
color: inherit;
background-color: currentColor;
border: 0;
opacity: 0.25;
}
hr:not([size]) {
height: 1px;
}
h6, h5, h4, h3, h2, h1 {
margin-top: 0;
margin-bottom: 0.5rem;
font-weight: 500;
line-height: 1.2;
}
h1 {
font-size: calc(1.375rem + 1.5vw);
}
@media (min-width: 1200px) {
h1 {
font-size: 2.5rem;
}
}
h2 {
font-size: calc(1.325rem + 0.9vw);
}
@media (min-width: 1200px) {
h2 {
font-size: 2rem;
}
}
h3 {
font-size: calc(1.3rem + 0.6vw);
}
@media (min-width: 1200px) {
h3 {
font-size: 1.75rem;
}
}
h4 {
font-size: calc(1.275rem + 0.3vw);
}
@media (min-width: 1200px) {
h4 {
font-size: 1.5rem;
}
}
h5 {
font-size: 1.25rem;
}
h6 {
font-size: 1rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-bs-original-title] {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul {
padding-right: 2rem;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: 0.5rem;
margin-right: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 0.875em;
}
mark {
padding: 0.2em;
background-color: #fcf8e3;
}
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
a {
color: #0d6efd;
text-decoration: underline;
}
a:hover {
color: #0a58ca;
}
a:not([href]):not([class]), a:not([href]):not([class]):hover {
color: inherit;
text-decoration: none;
}
pre,
code,
kbd,
samp {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em;
direction: ltr ;
unicode-bidi: bidi-override;
}
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
font-size: 0.875em;
}
pre code {
font-size: inherit;
color: inherit;
word-break: normal;
}
code {
font-size: 0.875em;
color: #d63384;
word-wrap: break-word;
}
a > code {
color: inherit;
}
kbd {
padding: 0.2rem 0.4rem;
font-size: 0.875em;
color: #fff;
background-color: #212529;
border-radius: 0.2rem;
}
kbd kbd {
padding: 0;
font-size: 1em;
font-weight: 700;
}
figure {
margin: 0 0 1rem;
}
img,
svg {
vertical-align: middle;
}
table {
caption-side: bottom;
border-collapse: collapse;
}
caption {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
color: #6c757d;
text-align: right;
}
th {
text-align: inherit;
text-align: -webkit-match-parent;
}
thead,
tbody,
tfoot,
tr,
td,
th {
border-color: inherit;
border-style: solid;
border-width: 0;
}
label {
display: inline-block;
}
button {
border-radius: 0;
}
button:focus:not(:focus-visible) {
outline: 0;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
select {
text-transform: none;
}
[role=button] {
cursor: pointer;
}
select {
word-wrap: normal;
}
select:disabled {
opacity: 1;
}
[list]::-webkit-calendar-picker-indicator {
display: none;
}
button,
[type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button;
}
button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled) {
cursor: pointer;
}
::-moz-focus-inner {
padding: 0;
border-style: none;
}
textarea {
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
float: right;
width: 100%;
padding: 0;
margin-bottom: 0.5rem;
font-size: calc(1.275rem + 0.3vw);
line-height: inherit;
}
@media (min-width: 1200px) {
legend {
font-size: 1.5rem;
}
}
legend + * {
clear: right;
}
::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-minute,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-year-field {
padding: 0;
}
::-webkit-inner-spin-button {
height: auto;
}
[type=search] {
outline-offset: -2px;
-webkit-appearance: textfield;
}
[type="tel"],
[type="url"],
[type="email"],
[type="number"] {
direction: ltr;
}
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-color-swatch-wrapper {
padding: 0;
}
::file-selector-button {
font: inherit;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
iframe {
border: 0;
}
summary {
display: list-item;
cursor: pointer;
}
progress {
vertical-align: baseline;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.rtl.css.map */

+ 1
- 0
ReactApp/public/bootstrap/css/bootstrap-reboot.rtl.css.map
File diff suppressed because it is too large
View File


+ 8
- 0
ReactApp/public/bootstrap/css/bootstrap-reboot.rtl.min.css View File

@ -0,0 +1,8 @@
/*!
* Bootstrap Reboot v5.0.2 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-right:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-right:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:right}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:right;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:right}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}[type=email],[type=number],[type=tel],[type=url]{direction:ltr}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.rtl.min.css.map */

+ 1
- 0
ReactApp/public/bootstrap/css/bootstrap-reboot.rtl.min.css.map
File diff suppressed because it is too large
View File


+ 4752
- 0
ReactApp/public/bootstrap/css/bootstrap-utilities.css
File diff suppressed because it is too large
View File


+ 1
- 0
ReactApp/public/bootstrap/css/bootstrap-utilities.css.map
File diff suppressed because it is too large
View File


+ 7
- 0
ReactApp/public/bootstrap/css/bootstrap-utilities.min.css
File diff suppressed because it is too large
View File


+ 1
- 0
ReactApp/public/bootstrap/css/bootstrap-utilities.min.css.map
File diff suppressed because it is too large
View File


+ 4743
- 0
ReactApp/public/bootstrap/css/bootstrap-utilities.rtl.css
File diff suppressed because it is too large
View File


+ 1
- 0
ReactApp/public/bootstrap/css/bootstrap-utilities.rtl.css.map
File diff suppressed because it is too large
View File


+ 7
- 0
ReactApp/public/bootstrap/css/bootstrap-utilities.rtl.min.css
File diff suppressed because it is too large
View File


+ 1
- 0
ReactApp/public/bootstrap/css/bootstrap-utilities.rtl.min.css.map
File diff suppressed because it is too large
View File


+ 10837
- 0
ReactApp/public/bootstrap/css/bootstrap.css
File diff suppressed because it is too large
View File


+ 1
- 0
ReactApp/public/bootstrap/css/bootstrap.css.map
File diff suppressed because it is too large
View File


+ 7
- 0
ReactApp/public/bootstrap/css/bootstrap.min.css
File diff suppressed because it is too large
View File


+ 1
- 0
ReactApp/public/bootstrap/css/bootstrap.min.css.map
File diff suppressed because it is too large
View File


+ 10813
- 0
ReactApp/public/bootstrap/css/bootstrap.rtl.css
File diff suppressed because it is too large
View File


+ 1
- 0
ReactApp/public/bootstrap/css/bootstrap.rtl.css.map
File diff suppressed because it is too large
View File


+ 7
- 0
ReactApp/public/bootstrap/css/bootstrap.rtl.min.css
File diff suppressed because it is too large
View File


+ 1
- 0
ReactApp/public/bootstrap/css/bootstrap.rtl.min.css.map
File diff suppressed because it is too large
View File


+ 6748
- 0
ReactApp/public/bootstrap/js/bootstrap.bundle.js
File diff suppressed because it is too large
View File


+ 1
- 0
ReactApp/public/bootstrap/js/bootstrap.bundle.js.map
File diff suppressed because it is too large
View File


+ 7
- 0
ReactApp/public/bootstrap/js/bootstrap.bundle.min.js
File diff suppressed because it is too large
View File


+ 1
- 0
ReactApp/public/bootstrap/js/bootstrap.bundle.min.js.map
File diff suppressed because it is too large
View File


+ 4967
- 0
ReactApp/public/bootstrap/js/bootstrap.esm.js
File diff suppressed because it is too large
View File


+ 1
- 0
ReactApp/public/bootstrap/js/bootstrap.esm.js.map
File diff suppressed because it is too large
View File


+ 7
- 0
ReactApp/public/bootstrap/js/bootstrap.esm.min.js
File diff suppressed because it is too large
View File


+ 1
- 0
ReactApp/public/bootstrap/js/bootstrap.esm.min.js.map
File diff suppressed because it is too large
View File


+ 5016
- 0
ReactApp/public/bootstrap/js/bootstrap.js
File diff suppressed because it is too large
View File


+ 1
- 0
ReactApp/public/bootstrap/js/bootstrap.js.map
File diff suppressed because it is too large
View File


+ 7
- 0
ReactApp/public/bootstrap/js/bootstrap.min.js
File diff suppressed because it is too large
View File


+ 1
- 0
ReactApp/public/bootstrap/js/bootstrap.min.js.map
File diff suppressed because it is too large
View File


BIN
ReactApp/public/favicon.ico View File

Before After

+ 25
- 0
ReactApp/public/index.html View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<!-- <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> -->
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<!-- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> -->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="stylesheet" href="%PUBLIC_URL%/bootstrap/css/bootstrap.min.css">
<script src="%PUBLIC_URL%/bootstrap/js/bootstrap.min.js"></script>
<title>Distance Identifire</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>

BIN
ReactApp/public/logo192.png View File

Before After
Width: 192  |  Height: 192  |  Size: 5.2 KiB

BIN
ReactApp/public/logo512.png View File

Before After
Width: 512  |  Height: 512  |  Size: 9.4 KiB

+ 25
- 0
ReactApp/public/manifest.json View File

@ -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"
}

+ 3
- 0
ReactApp/public/robots.txt View File

@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

+ 10
- 0
ReactApp/src/App.js View File

@ -0,0 +1,10 @@
import Router from "./router";
function App() {
return (
<>
<Router />
</>
);
}
export default App;

+ 33
- 0
ReactApp/src/assets/css/home.css View File

@ -0,0 +1,33 @@
#formPin:focus, #toPin:focus, [type='submit'].btn-success{
box-shadow: none !important;
}
.errMsg{
color: #dc3545;
font-size: 13px;
}
.inputBox{
position: relative;
}
.autoList{
background-color: #fff;
max-height: 250px;
width: 93%;
border: 1px solid #ced4da;
border-radius: 5px;
position: absolute;
overflow-y: auto;
}
.autoList p{
margin-bottom: 0;
padding: 3px 0 3px 5px;
}
.autoList p:hover{
background-color: #ced4da;
}
.errorMsg{
color: #dc3545;
text-align: center;
}
.fromcontainer{
border: 1px solid #ced4da;
}

+ 23
- 0
ReactApp/src/component/distanceDetails.js View File

@ -0,0 +1,23 @@
const DistanceDetails = (props)=>{
return(
<table className="table table-bordered">
<tbody>
<tr>
<th>Distance between two cities: </th>
<td>{props.data.distance} {props.data.unit}</td>
</tr>
<tr>
<th>Associated city for zip code: {props.from}</th>
<td>{props.data.fromCity}</td>
</tr>
<tr>
<th>Associated city for zip code: {props.to}</th>
<td>{props.data.toCity}</td>
</tr>
</tbody>
</table>
)
}
export default DistanceDetails;

+ 187
- 0
ReactApp/src/component/home.js View File

@ -0,0 +1,187 @@
import { useState } from "react";
import axios from "axios";
import {API} from "../config";
import "../assets/css/home.css";
import {validZip} from "../constraints/validation";
import {colorCode} from "../constant";
import DistanceDetails from "./distanceDetails";
import { getDistance, getZipCode } from "../services/homeService";
const Home = ()=>{
const [fromValidPin, setFromValidpin] = useState(undefined);
const [toValidPin, setToValidpin] = useState(undefined);
const [tabData,settabData] = useState();
const [isError,setIsError] = useState();
const [autoCompleteFrom,setAutoCompleteFrom] = useState();
const [valueFrom,setValueFrom] = useState();
const [autoCompleteTo,setAutoCompleteTo] = useState();
const [valueTo,setValueTo] = useState();
const checkValidationFrom = async (value)=>{
settabData("");
setIsError("");
let result = validZip(value && value!==null && value.trim());
setFromValidpin(result);
let val = value && value!==null && value.trim();
setValueFrom(val);
if(result === undefined && val.length>1){
await getZipCode(val)
.then(response=>{
if(response.status === 0){
setAutoCompleteFrom("");
setIsError(response.message+" for source")
}
setAutoCompleteFrom(response.data);
})
.catch(error=>{
setIsError(error.response.data.message)
})
}
else{
setAutoCompleteFrom("");
}
}
const valueSet = (zip,loc)=>{
if(loc==="from"){
setValueFrom(zip);
setAutoCompleteFrom("");
}
else{
setValueTo(zip);
setAutoCompleteTo("");
}
}
const checkValidationTo = async (value)=>{
settabData("");
setIsError("");
let result = validZip(value && value!==null && value.trim());
setToValidpin(result);
let val = value && value!==null && value.trim();
setValueTo(val);
if(result === undefined && val.length>1){
await getZipCode(val)
.then(response=>{
if(response.status === 0){
setAutoCompleteTo("");
setIsError(response.message+" for destination")
}
setAutoCompleteTo(response.data);
})
.catch(error=>{
setIsError(error.response.data.message)
})
}
else{
setAutoCompleteTo("");
}
}
const onSubmit = async (e) => {
e.preventDefault();
setAutoCompleteTo("");
setAutoCompleteFrom("");
setIsError("");
if(fromValidPin === undefined && toValidPin === undefined){
let data = {
from: e.target[0] && e.target[0].value && e.target[0].value!==null && e.target[0].value.trim(),
to: e.target[1] && e.target[1].value && e.target[1].value!==null && e.target[1].value.trim()
}
await getDistance(data)
.then(response=>{
if(response.status === 0){
setIsError(response.message)
}
settabData(response.data);
})
.catch(error=>{
setIsError(error.response.data.message)
})
}
};
return(
<>
<div className="container mt-3">
<form className="row fromcontainer p-4" onSubmit={onSubmit}>
<div className="col-md-5 inputBox">
<label htmlFor="formPin" className="form-label">Source</label>
<input type="text"
style={{borderColor: fromValidPin ? colorCode.inValidColor : colorCode.validColor}}
className="form-control"
autoComplete="off"
id="formPin"
value={valueFrom}
placeholder="Enter Zip Code"
name="formPin"
onChange={(e)=>checkValidationFrom(e.target.value)}
/>
{
autoCompleteFrom && autoCompleteFrom!==null && autoCompleteFrom.length>0 &&
<div className="autoList">
{
autoCompleteFrom.map((item,i)=>{
return(
<p key={i} onClick={()=>{valueSet(item.zipCode,"from")}}>{item.zipCode}</p>
)
})
}
</div>
}
{fromValidPin && <p className="errMsg">{fromValidPin}</p>}
</div>
<div className="col-md-5 inputBox">
<label htmlFor="toPin" className="form-label">Destination</label>
<input type="text"
style={{borderColor: toValidPin ? colorCode.inValidColor : colorCode.validColor}}
className="form-control"
id="toPin"
autoComplete="off"
value={valueTo}
placeholder="Enter Zip Code"
name="toPin"
onChange={(e)=>checkValidationTo(e.target.value)}
/>
{
autoCompleteTo && autoCompleteTo!==null && autoCompleteTo.length>0 &&
<div className="autoList">
{
autoCompleteTo.map((item,i)=>{
return(
<p key={i} onClick={()=>{valueSet(item.zipCode,"to")}}>{item.zipCode}</p>
)
})
}
</div>
}
{setToValidpin && <p className="errMsg">{toValidPin}</p>}
</div>
<div className="col-md-2 mt-4 pt-2">
<button type="submit" className="btn btn-success w-100">Get Distance</button>
</div>
</form>
</div>
{
isError &&
<div className="container">
<div className="row">
<div className="col-md-12 mt-3">
<div className="errorMsg">
<strong>{isError}</strong>
</div>
</div>
</div>
</div>
}
{
tabData &&
<div className="container mt-3">
<div className="row d-flex justify-content-center">
<div className="col-md-12">
<DistanceDetails data={tabData} from={valueFrom} to={valueTo}/>
</div>
</div>
</div>
}
</>
)
}
export default Home;

+ 3
- 0
ReactApp/src/config.js View File

@ -0,0 +1,3 @@
export const API = {
getDistance: "https://localhost:49159/api/Distance"
}

+ 4
- 0
ReactApp/src/constant.js View File

@ -0,0 +1,4 @@
export const colorCode = {
validColor: "#ced4da",
inValidColor: "#dc3545"
}

+ 11
- 0
ReactApp/src/constraints/validation.js View File

@ -0,0 +1,11 @@
export const validZip = (value)=>{
if(value && value !== null){
if(value.match(/^[0-9]+$/)){
return undefined;
}
else
return 'Enter Valid Zip Code';
}
else
return undefined;
}

+ 19
- 0
ReactApp/src/index.js View File

@ -0,0 +1,19 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import reportWebVitals from './reportWebVitals';
import { BrowserRouter } from "react-router-dom";
ReactDOM.render(
<React.StrictMode>
<BrowserRouter>
<App />
</BrowserRouter>
</React.StrictMode>,
document.getElementById('root')
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

+ 13
- 0
ReactApp/src/reportWebVitals.js View File

@ -0,0 +1,13 @@
const reportWebVitals = onPerfEntry => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;

+ 13
- 0
ReactApp/src/router.js View File

@ -0,0 +1,13 @@
import { Routes, Route } from "react-router-dom";
import Home from "./component/home";
const Router = ()=>{
return(
<Routes>
<Route exact path="/" element={<Home />} />
{/* <Route path="about" element={<About />} /> */}
</Routes>
)
}
export default Router;

+ 23
- 0
ReactApp/src/services/homeService.js View File

@ -0,0 +1,23 @@
import axios from "axios";
import {API} from "../config";
export const getDistance = (values)=>{
return axios.get(`${API.getDistance}/GetDistance?travelFrom=${values.from}&travelTo=${values.to}`)
.then((response)=>{
return response;
})
.catch((error)=>{
return error.response.data;
})
}
export const getZipCode = (value)=>{
return axios.get(`${API.getDistance}/GetZipCode?zipCode=${value}`)
.then((response)=>{
return response;
})
.catch((error)=>{
return error.response.data;
})
}

+ 5
- 0
ReactApp/src/setupTests.js View File

@ -0,0 +1,5 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';

Loading…
Cancel
Save