Skip to content

Commit

Permalink
+ package_info.component; +extension icons
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimi-Dun-Morogh committed Apr 20, 2021
1 parent 6b94a9e commit 0d92d4f
Show file tree
Hide file tree
Showing 17 changed files with 143 additions and 91 deletions.
45 changes: 45 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"extends": [
"airbnb",
"prettier"
],
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"jest": true,
"node": true
},
"parser": "babel-eslint",
"rules": {
"consistent-return": "off",
"jsx-a11y/href-no-hash": ["off"],
"jsx-a11y/no-static-element-interactions": "off",
"jsx-a11y/label-has-associated-control": "off",
"jsx-a11y/click-events-have-key-events": "off",
"react/jsx-props-no-spreading": "off",
"import/prefer-default-export" : "off",
"react/button-has-type":"off",
"react/no-unused-state": "off",
"import/no-extraneous-dependencies": "off",
"react/destructuring-assignment": "off",
"react/sort-comp": "off",
"react/prop-types": "off",
"react/jsx-filename-extension": ["warn", { "extensions": [".js", ".jsx"] }],
"no-shadow":"off",
"max-len": [
"warn",
{
"code": 100,
"tabWidth": 2,
"comments": 100,
"ignoreComments": false,
"ignoreTrailingComments": true,
"ignoreUrls": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true
}
]
}
}
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all"
}
74 changes: 5 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,6 @@
# Getting Started with Create React App
#####todo:

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 the browser.

The page will reload if you make edits.\
You will 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)
- [ ] - добавить фетч детальной инфы по номеру телефона
- [ ] - сделать локализации интерфейса
- [ ] - сделать страницу истории через табсы или роутер туда автоматически добавлять информацию по
каждой найденной посылке(маршрут, адрес доставки и т.д)
Binary file modified public/img/icon-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/img/icon-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/icon-19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/icon-38.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/img/icon-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/logo512.png
Binary file not shown.
3 changes: 3 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import './App.css';
import React from 'react'
import 'bootstrap/dist/css/bootstrap.min.css';
import Header from './components/header/header.component';
import Form from './components/form/form.component';
import PackageInfo from './components/package_info/package_info.component';

function App() {
return (
<div className="App">
<Header />
<Form />
<PackageInfo />
</div>
);
}
Expand Down
14 changes: 7 additions & 7 deletions src/components/form/form.component.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState } from 'react';
import { useDispatch } from 'react-redux'
import { fetchPackageInfo } from '../../redux/packages/packages.actions';
import { useDispatch } from 'react-redux';
import { Button, InputGroup, FormControl } from 'react-bootstrap';
import { ImSearch } from 'react-icons/im';
import { fetchPackageInfo } from '../../redux/packages/packages.actions';
import './form.styles.css';

const Form = () => {
Expand All @@ -12,18 +12,18 @@ const Form = () => {
const handleSubmit = () => {
//! сделать проверку на длину
console.log(trackNumber);
dispatch(fetchPackageInfo(trackNumber))
dispatch(fetchPackageInfo(trackNumber));
};

return (
<div className='form-wrap'>
<InputGroup className='mb-3' size='sm'>
<div className="form-wrap">
<InputGroup className="mb-3" size="sm">
<FormControl
placeholder='введите номер ттн'
placeholder="введите номер ттн"
onChange={(e) => setTrackNumber(e.target.value)}
/>
<InputGroup.Prepend>
<Button variant='danger' className='test' onClick={handleSubmit}>
<Button variant="danger" className="test" onClick={handleSubmit}>
{' '}
<ImSearch style={{ display: 'block' }} />
</Button>
Expand Down
16 changes: 7 additions & 9 deletions src/components/header/header.component.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import React from 'react';
import './header.styles.css';

const Header = () => {
return (
<div className='header-wrap'>
<h3>
трек посылок <b>Nova Poshta</b>
</h3>
</div>
);
};
const Header = () => (
<div className="header-wrap">
<h3>
трек посылок <b>Nova Poshta</b>
</h3>
</div>
);

export default Header;
39 changes: 39 additions & 0 deletions src/components/package_info/package_info.component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from 'react';
import { useSelector } from 'react-redux';
import './package_info.styles.css';
// 20450332281236

const PackageInfo = () => {
const packageInfo = useSelector((state) => state.packages.packageInfo);

if (!packageInfo) return null;

const {
WarehouseRecipient,
Status,
RecipientDateTime,
CitySender,
CityRecipient,
ActualDeliveryDate,
} = packageInfo;

return (
<div className="package-info-wrap">
<span>
статус - {Status} {RecipientDateTime}
</span>
<ul>
<li>маршрут:</li>
<li>
{CitySender} - {CityRecipient}
</li>
<li>Адрес доставки:</li>
<li>{WarehouseRecipient}</li>
<li>дата доставки:</li>
<li>{ActualDeliveryDate}</li>
</ul>
</div>
);
};

export default PackageInfo;
28 changes: 28 additions & 0 deletions src/components/package_info/package_info.styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.package-info-wrap {
box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
padding: 10px;
margin-top: 10px;
background-color: #ffffffa8;
}
.package-info-wrap ul{
margin: 0;
padding: 0;
}

.package-info-wrap li {
list-style: none;
font-size: 16px;
color: #333333;
}

.package-info-wrap li:nth-child(odd) {
font-size: 12px;
color: #828282;
font-family: Arial, Helvetica, sans-serif;
margin-top: 10px;
}

.package-info-wrap li:nth-child(4) {
color:red;
font-size: 18px;
}
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import {Provider } from 'react-redux'
import App from './App';
import { store } from './redux/store';

ReactDOM.render(
Expand Down
2 changes: 1 addition & 1 deletion src/options/Options.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

import React from 'react';

function Options() {
return (
Expand Down
6 changes: 2 additions & 4 deletions src/redux/packages/packages.actions.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { PackagesActionTypes } from "./packages.types";


const fetchPackageInfoSuccess = (packageInfo) => {
return {
const fetchPackageInfoSuccess = (packageInfo) => ({
type: PackagesActionTypes.SET_PACKAGE_INFO,
payload: packageInfo
}
};
});

export const fetchPackageInfo = (id, Phone) => async dispatch => {
try {
Expand Down

0 comments on commit 0d92d4f

Please sign in to comment.