32 |
33 | ## :information_source: What's Next Level Week?
34 |
35 | NLW is a practical week with lots of code, challenges, networking and a single objective: to take you to the next level.
36 | Through our method you will learn new tools, learn about new technologies and discover hacks that will boost your career.
37 | An online and completely free event that will help you take the next step in your evolution as a dev.
38 |
39 | ## 💻 Project
40 |
41 | Ecoleta is a project developed based on international environment week.
42 | That aims to connect people to companies that collect specific waste such as light bulbs, batteries, cooking oil, etc.
43 |
44 |
Example
45 |
46 | ## :rocket: Technologies
47 |
48 | This project was developed with the following technologies:
49 |
50 | - [Node.js][nodejs]
51 | - [TypeScript][typescript]
52 | - [React][reactjs]
53 | - [React Native][rn]
54 | - [Expo][expo]
55 |
56 | ## 🔖 Layout
57 |
58 | To access the layout use [Figma](https://www.figma.com/file/1SxgOMojOB2zYT0Mdk28lB/).
59 |
60 | ## :information_source: How To Use
61 |
62 | To clone and run this application, you'll need [Git](https://git-scm.com), [Node.js][nodejs] + [Yarn][yarn] installed on your computer.
63 |
64 | From your command line:
65 |
66 | ### Install API In progress.. :construction:
67 | ```bash
68 | # Clone this repository
69 | $ git clone https://github.com/reisdev/next-level-week
70 |
71 | # Go into the repository
72 | $ cd next-level-week/backend
73 |
74 | # Install dependencies
75 | $ yarn install
76 | ```
77 |
78 | ## 🤔 How to contribute
79 |
80 | - Make a fork;
81 | - Create a branck with your feature: `git checkout -b my-feature`;
82 | - Commit changes: `git commit -m 'feat: My new feature'`;
83 | - Make a push to your branch: `git push origin my-feature`.
84 |
85 | After merging your receipt request to done, you can delete a branch from yours.
86 |
87 | ## :memo: License
88 |
89 | This project is under the MIT license. See the [LICENSE](LICENSE.md) for details.
90 |
91 | Made with ♥ by Matheus Reis :wave: [Get in touch!](https://www.linkedin.com/in/matheus-dos-reis-de-jesus-40a59570/)
92 |
93 | [nodejs]: https://nodejs.org/
94 | [typescript]: https://www.typescriptlang.org/
95 | [expo]: https://expo.io/
96 | [reactjs]: https://reactjs.org
97 | [rn]: https://facebook.github.io/react-native/
98 | [yarn]: https://yarnpkg.com/
99 | [vs]: https://code.visualstudio.com/
100 | [vceditconfig]: https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig
101 | [vceslint]: https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
102 | [prettier]: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
103 |
104 | ## Credits
105 |
106 | Credits for the README template goes to [DanielObara](https://github.com/DanielObara)
--------------------------------------------------------------------------------
/backend/config/multer.ts:
--------------------------------------------------------------------------------
1 | import multer from "multer";
2 | import path from "path";
3 | import crypto from "crypto";
4 |
5 | export default {
6 | storage: multer.diskStorage({
7 | destination: path.resolve(__dirname, "..", "uploads"),
8 | filename: (request, file, callback) => {
9 | const hash = crypto.randomBytes(6).toString('hex');
10 | const filename = `${hash}-${file.originalname}`
11 | callback(null, filename);
12 | }
13 | })
14 | }
--------------------------------------------------------------------------------
/backend/index.d.ts:
--------------------------------------------------------------------------------
1 | class Item {
2 | id: number;
3 | title: string;
4 | image: string;
5 | }
6 |
7 | class Point {
8 | id: number;
9 | name: string;
10 | image: string;
11 | email: string;
12 | latitude: number;
13 | longitude: number;
14 | uf: string;
15 | city: string;
16 | }
17 |
18 | class PointItems {
19 | point_id: number;
20 | item_id: number;
21 | }
22 |
--------------------------------------------------------------------------------
/backend/knexfile.ts:
--------------------------------------------------------------------------------
1 | import path from "path";
2 |
3 | module.exports = {
4 | client: "sqlite3",
5 | useNullAsDefault: true,
6 | connection: {
7 | filename: path.resolve(__dirname, "src", "database", "database.sqlite")
8 | },
9 | migrations: {
10 | directory: path.resolve(__dirname, "src", "database", "migrations")
11 | },
12 | seeds: {
13 | directory: path.resolve(__dirname, "src", "database", "seeds")
14 | }
15 | }
--------------------------------------------------------------------------------
/backend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nlw",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "ts-node-dev --transpileOnly --ignore-watch node_modules src/server.ts",
8 | "knex:migrate": "knex migrate:latest --knexfile knexfile.ts",
9 | "knex:seed": "knex seed:run --knexfile knexfile.ts",
10 | "test": "echo \"Error: no test specified\" && exit 1",
11 | "postinstall": "mkdir uploads"
12 | },
13 | "keywords": [],
14 | "author": "",
15 | "license": "ISC",
16 | "dependencies": {
17 | "@types/hapi__joi": "^17.1.2",
18 | "celebrate": "^12.1.1",
19 | "cors": "^2.8.5",
20 | "express": "^4.17.1",
21 | "knex": "^0.21.1",
22 | "morgan": "^1.10.0",
23 | "mouter": "^0.0.0-reserved",
24 | "multer": "^1.4.2",
25 | "sqlite3": "^4.2.0"
26 | },
27 | "devDependencies": {
28 | "@types/cors": "^2.8.6",
29 | "@types/express": "^4.17.6",
30 | "@types/morgan": "^1.9.0",
31 | "@types/multer": "^1.4.3",
32 | "@types/node": "^14.0.9",
33 | "dotenv": "^8.2.0",
34 | "ts-node": "^8.10.2",
35 | "ts-node-dev": "^1.0.0-pre.44",
36 | "typescript": "^3.9.3"
37 | }
38 | }
--------------------------------------------------------------------------------
/backend/src/controller/ItemsController.ts:
--------------------------------------------------------------------------------
1 | import knex from "../database";
2 | import { Controller } from ".";
3 | import { Request, Response } from 'express';
4 |
5 | class ItemsControlller implements Controller {
6 | async index(req: Request, res: Response) {
7 | const items = await knex("items").select("*");
8 |
9 | const serialized = items.map((item: Item) => ({
10 | id: item.id, title: item.title, imageUrl: `${process.env.BASE_URL}:${process.env.PORT}/static/${item.image}`
11 | }))
12 | return res.json(serialized);
13 | }
14 | }
15 |
16 | export default ItemsControlller;
17 |
--------------------------------------------------------------------------------
/backend/src/controller/PointsController.ts:
--------------------------------------------------------------------------------
1 | import knex from "../database";
2 | import { Controller } from ".";
3 | import { Request, Response } from 'express';
4 | import { QueryBuilder } from "knex";
5 |
6 | class PointsControlller implements Controller {
7 | async index(req: Request, res: Response) {
8 | const { uf, city, items } = req.query;
9 | let points = [];
10 | const parsedItems = items ? String(items).split(",").map(item => Number(item.trim())) : [];
11 | points = await knex("points")
12 | .join("point_items", "points.id", "=", "point_items.point_id")
13 | .modify((qb: QueryBuilder) => {
14 | if (city)
15 | qb.where("city", String(city))
16 | if (uf)
17 | qb.where("uf", String(uf))
18 | if (parsedItems.length > 0)
19 | qb.whereIn("point_items.item_id", parsedItems)
20 | })
21 | .distinct()
22 | .select("points.*");
23 |
24 | const seriazedPoints = points.map(
25 | (point: Point) =>
26 | ({
27 | ...point, image: point.image.startsWith("http")
28 | ? point.image : `${process.env.BASE_URL}:${
29 | process.env.PORT}/uploads/${point.image}`
30 | })
31 | )
32 |
33 | return res.json(seriazedPoints);
34 | }
35 | async show(req: Request, res: Response) {
36 | const { id } = req.params;
37 | const point = await knex("points")
38 | .where("id", id).select("*").first();
39 | if (!point) return res.status(404)
40 | .json({ message: "Point not found" })
41 |
42 | const items = await knex("items")
43 | .join("point_items", "point_items.item_id", "=", "items.id")
44 | .where("point_items.point_id", "=", id)
45 | .select("items.title");
46 |
47 |
48 | return res.json(Object.assign({
49 | ...point,
50 | image: `${process.env.BASE_URL}:${
51 | process.env.PORT}/uploads/${point.image}`
52 | }, { items }));
53 | }
54 | async create(req: Request, res: Response) {
55 | const {
56 | name,
57 | image,
58 | email,
59 | whatsapp,
60 | city,
61 | uf,
62 | latitude,
63 | longitude,
64 | items
65 | } = req.body;
66 |
67 | const point = {
68 | name,
69 | image: req.file.filename || 'https://images.unsplash.com/photo-1542838132-92c53300491e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=400&q=60',
70 | email,
71 | whatsapp,
72 | city,
73 | uf,
74 | latitude,
75 | longitude
76 | }
77 |
78 | const trx = await knex.transaction();
79 | const [id] = await trx("points").insert(point)
80 |
81 | const pointItems: PointItems[] = items.split(",")
82 | .map((item_id: string) =>
83 | ({ item_id: Number(item_id.trim()), point_id: id })
84 | )
85 | await trx("point_items").insert(pointItems);
86 | await trx.commit();
87 |
88 | return res.status(201).json({
89 | sucess: true
90 | });
91 | }
92 | }
93 |
94 | export default PointsControlller;
95 |
--------------------------------------------------------------------------------
/backend/src/controller/index.ts:
--------------------------------------------------------------------------------
1 | import { Request, Response } from 'express';
2 |
3 | export interface Controller {
4 | create?(req: Request, response: Response): any;
5 | delete?(req: Request, response: Response): any;
6 | index?(req: Request, response: Response): any;
7 | }
--------------------------------------------------------------------------------
/backend/src/database/index.ts:
--------------------------------------------------------------------------------
1 | import knex from "knex";
2 | import path from "path";
3 | import dotenv from "dotenv";
4 |
5 | dotenv.config({
6 | path: path.resolve(__dirname, "../../.env")
7 | });
8 |
9 | export default knex({
10 | client: process.env.DATABASE_ENGINE,
11 | useNullAsDefault: true,
12 | connection: {
13 | filename: path.resolve(__dirname, "database.sqlite"),
14 | host: process.env.DATABASE_HOST,
15 | database: "ecoleta",
16 | user: process.env.DATABASE_USER,
17 | password: process.env.DATABASE_PASSWORD,
18 | }
19 | });
20 |
21 |
22 |
--------------------------------------------------------------------------------
/backend/src/database/migrations/00_create_points.ts:
--------------------------------------------------------------------------------
1 | import Knex from "knex";
2 |
3 | export async function up(knex: Knex) {
4 | return knex.schema.createTable("points", (table) => {
5 | table.increments("id").primary();
6 | table.string("image").notNullable();
7 | table.string("name").notNullable();
8 | table.string("email").notNullable()
9 | table.decimal("latitude").notNullable();
10 | table.decimal("longitude").notNullable();
11 | table.string("whatsapp").notNullable();
12 | table.string("city");
13 | table.string("uf", 2).notNullable();
14 | })
15 | }
16 |
17 | export async function down(knex: Knex) {
18 | return knex.schema.dropTable("points");
19 | }
--------------------------------------------------------------------------------
/backend/src/database/migrations/01_create_items.ts:
--------------------------------------------------------------------------------
1 | import Knex from "knex";
2 |
3 | export async function up(knex: Knex) {
4 | return knex.schema.createTable("items", (table) => {
5 | table.increments("id").primary();
6 | table.string("image").notNullable();
7 | table.string("title").notNullable();
8 | })
9 | }
10 |
11 | export async function down(knex: Knex) {
12 | return knex.schema.dropTable("items")
13 | }
--------------------------------------------------------------------------------
/backend/src/database/migrations/02_create_points_items.ts:
--------------------------------------------------------------------------------
1 | import Knex from "knex";
2 |
3 | export async function up(knex: Knex) {
4 | return knex.schema.createTable("point_items", (table) => {
5 | table.increments("id").primary();
6 | table.integer("point_id").references("id").inTable("points");
7 | table.integer("item_id").references("id").inTable("items");
8 | })
9 | }
10 |
11 | export async function down(knex: Knex) {
12 | return knex.schema.dropTable("point_items")
13 | }
--------------------------------------------------------------------------------
/backend/src/database/seeds/default_items.ts:
--------------------------------------------------------------------------------
1 | import Knex from "knex";
2 |
3 | export async function seed(knex: Knex) {
4 | await knex("items").insert([
5 | { title: "Lâmpadas", image: "lampadas.svg" },
6 | { title: "Resíduos Orgânicos", image: "organicos.svg" },
7 | { title: "Resíduos Eletrônicos", image: "eletronicos.svg" },
8 | { title: "Papéis e Papelão", image: "papeis-papelao.svg" },
9 | { title: "Pilhas e Baterias", image: "baterias.svg" },
10 | { title: "Óleo de Cozinha", image: "oleo.svg" }
11 | ])
12 | }
--------------------------------------------------------------------------------
/backend/src/routes.ts:
--------------------------------------------------------------------------------
1 | import express from "express";
2 | import { celebrate, Joi } from "celebrate"
3 |
4 | import multer from "multer";
5 | import multerConfig from "../config/multer";
6 |
7 | import ItemsControlller from "./controller/ItemsController";
8 | import PointsControlller from "./controller/PointsController";
9 |
10 | const router = express.Router();
11 | const upload = multer(multerConfig);
12 |
13 | router.get("/", (req, res) => res.json({ message: "Hello World" }));
14 |
15 | const pointsController = new PointsControlller()
16 | const itemsController = new ItemsControlller();
17 |
18 | router.get("/items", itemsController.index);
19 | router.post("/points",
20 | upload.single("image"),
21 | celebrate({
22 | body: Joi.object().keys({
23 | name: Joi.string().required(),
24 | email: Joi.string().required(),
25 | whatsapp: Joi.string().required(),
26 | latitude: Joi.number().required(),
27 | longitude: Joi.number().required(),
28 | city: Joi.string().required(),
29 | uf: Joi.string().max(2).required(),
30 | items: Joi.string().regex(/^([0-9],?)+$/).required()
31 | })
32 | }, { abortEarly: false }),
33 | pointsController.create
34 | );
35 | router.get("/points", pointsController.index);
36 | router.get("/points/:id", pointsController.show);
37 |
38 | export default router;
--------------------------------------------------------------------------------
/backend/src/server.ts:
--------------------------------------------------------------------------------
1 | import express from "express";
2 | import cors from "cors";
3 | import dotenv from "dotenv";
4 | import path from "path";
5 | import morgan from "morgan";
6 | import router from "./routes";
7 | import { errors } from "celebrate";
8 |
9 | dotenv.config({
10 | path: path.resolve(__dirname, "../.env")
11 | });
12 |
13 | const app = express();
14 |
15 | app.use(express.json());
16 | app.use(morgan("combined"));
17 | app.use(cors());
18 | app.use(router);
19 |
20 | // Serve static files
21 | app.use("/static", express.static(path.resolve(__dirname, "../static")))
22 | app.use("/uploads", express.static(path.resolve(__dirname, "../uploads")))
23 |
24 | app.use(errors())
25 |
26 | app.listen(process.env.PORT || 8000, () => {
27 | console.log(`\nServer listening on PORT ${process.env.PORT}\n`)
28 | })
--------------------------------------------------------------------------------
/backend/static/baterias.svg:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/backend/static/eletronicos.svg:
--------------------------------------------------------------------------------
1 |
24 |
--------------------------------------------------------------------------------
/backend/static/lampadas.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/backend/static/oleo.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/backend/static/organicos.svg:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/backend/static/papeis-papelao.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/backend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */
4 |
5 | /* Basic Options */
6 | // "incremental": true, /* Enable incremental compilation */
7 | "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
8 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
9 | // "lib": [], /* Specify library files to be included in the compilation. */
10 | // "allowJs": true, /* Allow javascript files to be compiled. */
11 | // "checkJs": true, /* Report errors in .js files. */
12 | // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
13 | // "declaration": true, /* Generates corresponding '.d.ts' file. */
14 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
15 | // "sourceMap": true, /* Generates corresponding '.map' file. */
16 | // "outFile": "./", /* Concatenate and emit output to single file. */
17 | // "outDir": "./", /* Redirect output structure to the directory. */
18 | // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
19 | // "composite": true, /* Enable project compilation */
20 | // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
21 | // "removeComments": true, /* Do not emit comments to output. */
22 | // "noEmit": true, /* Do not emit outputs. */
23 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */
24 | // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
25 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
26 |
27 | /* Strict Type-Checking Options */
28 | "strict": true, /* Enable all strict type-checking options. */
29 | // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
30 | // "strictNullChecks": true, /* Enable strict null checks. */
31 | // "strictFunctionTypes": true, /* Enable strict checking of function types. */
32 | // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
33 | // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
34 | // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
35 | // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
36 |
37 | /* Additional Checks */
38 | // "noUnusedLocals": true, /* Report errors on unused locals. */
39 | // "noUnusedParameters": true, /* Report errors on unused parameters. */
40 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
41 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
42 |
43 | /* Module Resolution Options */
44 | // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
45 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
46 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
47 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
48 | // "typeRoots": [], /* List of folders to include type definitions from. */
49 | // "types": [], /* Type declaration files to be included in compilation. */
50 | // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
51 | "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
52 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
53 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
54 |
55 | /* Source Map Options */
56 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
57 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
58 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
59 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
60 |
61 | /* Experimental Options */
62 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
63 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
64 |
65 | /* Advanced Options */
66 | "skipLibCheck": true, /* Skip type checking of declaration files. */
67 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/frontend/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/frontend/README.md:
--------------------------------------------------------------------------------
1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2 |
3 | ## Available Scripts
4 |
5 | In the project directory, you can run:
6 |
7 | ### `yarn start`
8 |
9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
11 |
12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console.
14 |
15 | ### `yarn test`
16 |
17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
19 |
20 | ### `yarn build`
21 |
22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance.
24 |
25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed!
27 |
28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
29 |
30 | ### `yarn eject`
31 |
32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!**
33 |
34 | 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.
35 |
36 | 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.
37 |
38 | 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.
39 |
40 | ## Learn More
41 |
42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
43 |
44 | To learn React, check out the [React documentation](https://reactjs.org/).
45 |
--------------------------------------------------------------------------------
/frontend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "frontend",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^4.2.4",
7 | "@testing-library/react": "^9.3.2",
8 | "@testing-library/user-event": "^7.1.2",
9 | "@types/jest": "^24.0.0",
10 | "@types/node": "^12.0.0",
11 | "@types/react": "^16.9.0",
12 | "@types/react-dom": "^16.9.0",
13 | "@types/react-dropzone": "^5.1.0",
14 | "@types/react-leaflet": "^2.5.1",
15 | "@types/react-router-dom": "^5.1.5",
16 | "leaflet": "^1.6.0",
17 | "react": "^16.13.1",
18 | "react-dom": "^16.13.1",
19 | "react-dropzone": "^11.0.1",
20 | "react-icons": "^3.10.0",
21 | "react-leaflet": "^2.7.0",
22 | "react-router-dom": "^5.2.0",
23 | "react-scripts": "3.4.1",
24 | "typescript": "~3.7.2"
25 | },
26 | "scripts": {
27 | "start": "react-scripts start",
28 | "build": "react-scripts build",
29 | "test": "react-scripts test",
30 | "eject": "react-scripts eject"
31 | },
32 | "eslintConfig": {
33 | "extends": "react-app"
34 | },
35 | "browserslist": {
36 | "production": [
37 | ">0.2%",
38 | "not dead",
39 | "not op_mini all"
40 | ],
41 | "development": [
42 | "last 1 chrome version",
43 | "last 1 firefox version",
44 | "last 1 safari version"
45 | ]
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/frontend/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Ecoleta
8 |
12 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/frontend/src/App.css:
--------------------------------------------------------------------------------
1 | :root {
2 | --primary-color: #34CB79;
3 | --title-color: #322153;
4 | --text-color: #6C6C80;
5 | }
6 |
7 | * {
8 | margin: 0;
9 | padding: 0;
10 | box-sizing: border-box;
11 | }
12 |
13 | body {
14 | background: #F0F0F5;
15 | -webkit-font-smoothing: antialiased;
16 | color: var(--text-color);
17 | }
18 |
19 | body, input, button {
20 | font-family: Roboto, Arial, Helvetica, sans-serif;
21 | }
22 |
23 | h1, h2, h3, h4, h5, h6 {
24 | color: var(--title-color);
25 | font-family: Ubuntu;
26 | }
27 |
--------------------------------------------------------------------------------
/frontend/src/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './App.css';
3 | import Routes from './pages/routes';
4 |
5 | function App() {
6 | return (
7 |