Skip to content

Commit

Permalink
Project Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
benfiratkaya committed Sep 21, 2021
0 parents commit 9da0b90
Show file tree
Hide file tree
Showing 16 changed files with 11,918 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
/.idea
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<p align="center">
<img width="175" src="https://i.hizliresim.com/tb60ara.png" alt="Trendyol logo">
</p>
<p align="center">
React.js ile yapılmış Trendyol Express klonu
</p>

---

# Proje Kurulumu

Proje React.js kullanılarak yapılmıştır. Paket yöneticisi olarak yarn kullanılmaktadır.

### Kurulum:

```bash
yarn
```

### Geliştirme:

```bash
yarn start
```

### Build:

```bash
yarn build
```

# Yapılacaklar

- [ ] Components
- [ ] Logo
- [ ] TAB
- [ ] Delivery Progress
- [ ] Delivery Details
- [ ] Details
- [ ] Table
- [ ] Delivery Query
- [ ] Footer
- [ ] Scroll Up

# Bilgi

Hazırlanıyor...
46 changes: 46 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "trendyol-express-clone",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"axios": "^0.21.4",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "^7.2.5",
"react-scripts": "4.0.3",
"redux": "^4.1.1",
"redux-devtools-extension": "^2.13.9",
"redux-logger": "^3.0.6",
"redux-promise-middleware": "^6.1.2",
"redux-thunk": "^2.3.0",
"sass": "^1.42.0",
"web-vitals": "^1.0.1"
},
"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"
]
}
}
Binary file added public/favicon.ico
Binary file not shown.
48 changes: 48 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="tr">

<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="Trendyol Express Web Clone with React.js" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700;900&display=swap" rel="stylesheet">

<title>Gönderi Takip</title>
</head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>

</html>
15 changes: 15 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "Trendyol Express",
"name": "Gönderi Takip",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
3 changes: 3 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
5 changes: 5 additions & 0 deletions src/components/App/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const App = () => {
return (<div>hey!</div>);
};

export default App;
20 changes: 20 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from "react";
import ReactDOM from "react-dom";
import {Provider} from "react-redux";

import store from "./redux/store";
import reportWebVitals from "./utils/reportWebVitals";

import App from "./components/App";

ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
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();
12 changes: 12 additions & 0 deletions src/redux/actions/delivery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import axios from "axios";

import * as t from "../types/delivery";

export const fetchDelivery = (type, key) => {
return {
type: t.FETCH_DELIVERY,
payload: axios.get(`https://api-logistics.trendyol.com/u/track/${type}=${key}`)
.then((response) => response.data.json())
.catch((response) => response.json()),
};
};
41 changes: 41 additions & 0 deletions src/redux/reducers/delivery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import * as t from "../types/delivery";

const initialState = {
fetching: false,
fetched: false,
data: {},
error: {},
};

const deliveryReducer = (state = initialState, action) => {
switch (action.type) {
case t.FETCH_DELIVERY_PENDING:
return {
...state,
fetching: true,
fetched: false,
data: {},
error: {},
};
case t.FETCH_DELIVERY_REJECTED:
return {
...state,
fetching: false,
fetched: false,
data: {},
error: action.payload,
};
case t.FETCH_DELIVERY_FULFILLED:
return {
...state,
fetching: false,
fetched: true,
data: action.payload,
error: {},
};
default:
return state;
}
};

export default deliveryReducer;
24 changes: 24 additions & 0 deletions src/redux/store.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { createStore, applyMiddleware, combineReducers } from "redux";
import thunkMiddleware from "redux-thunk";
import promiseMiddleware from "redux-promise-middleware";
import delivery from "./reducers/delivery";

const bindMiddleware = (middleware) => {
if (process.env.NODE_ENV !== "production") {
const { composeWithDevTools } = require("redux-devtools-extension");
const { logger } = require("redux-logger");
return composeWithDevTools(applyMiddleware(...middleware, logger));
}
return applyMiddleware(...middleware);
};

const combinedReducer = combineReducers({
delivery,
});

const store = createStore(
combinedReducer,
bindMiddleware([thunkMiddleware, promiseMiddleware])
);

export default store;
4 changes: 4 additions & 0 deletions src/redux/types/delivery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const FETCH_DELIVERY = "FETCH_DELIVERY";
export const FETCH_DELIVERY_PENDING = "FETCH_DELIVERY_PENDING";
export const FETCH_DELIVERY_REJECTED = "FETCH_DELIVERY_REJECTED";
export const FETCH_DELIVERY_FULFILLED = "FETCH_DELIVERY_FULFILLED";
13 changes: 13 additions & 0 deletions src/utils/reportWebVitals.js
Original file line number Diff line number Diff line change
@@ -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;
5 changes: 5 additions & 0 deletions src/utils/setupTests.js
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9da0b90

Please sign in to comment.