Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
24 changes: 24 additions & 0 deletions Documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Como Rodar o Projeto

Abra o terminal na pasta do projeto e rode os comandos "npm run project-install" e depois "npm run project". é nescessario que as portas 3000 e 5000 estejam livres, acesse por http://localhost:3000/.

## O que foi feito

Utilizei um server node para ler o xlsx através de uma biblioteca (node-xlsx) e disponibilize para o front com express.

No Utilizando React foi criado um sistema simples de navegação onde através dos dados resgatados do excel se informações sobre os Pokemons.

## Funcionalidades

Listagem de Pokemons
Filtro pelos Campos numero(pokedexNumber), nome, tipo ou clima.
Paginação com opção de alterar numero de itens por Pagina.
Mostrar Detalhes do Pokemon.
Listar Habilidades de Cada Pokemon(Buscadas através da PokeAPI).

## Stack

Nodejs
React
react-bootstrap
Bootstraap
23 changes: 23 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -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*
16,255 changes: 16,255 additions & 0 deletions client/package-lock.json

Large diffs are not rendered by default.

44 changes: 44 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "client",
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:5000",
"dependencies": {
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"@types/jest": "^26.0.24",
"@types/node": "^12.20.17",
"@types/react": "^17.0.15",
"@types/react-dom": "^17.0.9",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"typescript": "^4.3.5",
"web-vitals": "^1.1.2"
},
"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 client/public/favicon.ico
Binary file not shown.
43 changes: 43 additions & 0 deletions client/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!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" />
<!--
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`.
-->
<title>Pokedex</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 client/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "Pokedex",
"name": "Pokedex - Dimas",
"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 client/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:
42 changes: 42 additions & 0 deletions client/src/components/FiltersContainer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from "react";
import { Col, Row, Form, Dropdown } from "react-bootstrap";

interface IProps {
handleFilterChange: (event:React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) => void;
nameFilter: string;
getFiltredPokemons: () => void;
rowsPerPage: number;
handeRowsPerPage: (number: number) => void;
}

export default class FiltersContainer extends React.Component<IProps> {
render() {
return (
<Row className="mb-3">
<Col sm={8}>
<Form.Control
type="text"
placeholder="Busque por numero, nome, tipo ou clima..."
onChange={(event) => this.props.handleFilterChange(event)}
value={this.props.nameFilter}
onKeyPress={(event: React.KeyboardEvent) => (event.key === "Enter") && this.props.getFiltredPokemons()}
/>
</Col>
<Col sm={4}>
<Dropdown>
<Dropdown.Toggle variant="secondary" id="dropdown-basic" >
Pokemons Por Pagina
</Dropdown.Toggle>

<Dropdown.Menu>
<Dropdown.Item active={this.props.rowsPerPage === 10} onClick={() => this.props.handeRowsPerPage(10)}>10</Dropdown.Item>
<Dropdown.Item active={this.props.rowsPerPage === 20} onClick={() => this.props.handeRowsPerPage(20)}>20</Dropdown.Item>
<Dropdown.Item active={this.props.rowsPerPage === 50} onClick={() => this.props.handeRowsPerPage(50)}>50</Dropdown.Item>
<Dropdown.Item active={this.props.rowsPerPage === 100} onClick={() => this.props.handeRowsPerPage(100)}>100</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>
</Col>
</Row>
);
}
}
96 changes: 96 additions & 0 deletions client/src/components/PokemonDetailsModal/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import React from "react";

import * as types from "../../../../server/types";
import { Modal, ListGroup, Card, Row, Col } from "react-bootstrap";
import { getAbilities } from "../../services/pokemons";
import "./style.css"

interface IProps {
pokemon: types.Pokemon;
modalIsOpen: boolean;
closeModal: () => void;
}

interface IState {
abilities: types.PokemonAbility[];
}

export default class PokemonDetailsModal extends React.Component<IProps, IState> {
constructor(props: IProps) {
super(props);

this.state = {
abilities: [],
}
}

componentDidMount = async () => {
const abilities = await getAbilities(this.props.pokemon.PokedexNumber);

this.setState({ abilities: abilities });
}
render() {
return (
<Modal show={this.props.modalIsOpen} onHide={() => this.props.closeModal()} size="lg">
<Modal.Header closeButton closeLabel="">

<Modal.Title>{this.props.pokemon.Name}</Modal.Title>
</Modal.Header>
<Modal.Body>
<Row>
<Col sm={6}>
<ListGroup >
<ListGroup.Item><strong>Name:</strong> {this.props.pokemon.Name}</ListGroup.Item>
<ListGroup.Item><strong>PokedexNumber:</strong> {this.props.pokemon.PokedexNumber}</ListGroup.Item>
<ListGroup.Item><strong>Type1:</strong> {this.props.pokemon.Type1}</ListGroup.Item>
<ListGroup.Item><strong>Type2:</strong> {this.props.pokemon.Type2}</ListGroup.Item>
<ListGroup.Item><strong>Weather1:</strong> {this.props.pokemon.Weather1}</ListGroup.Item>
<ListGroup.Item><strong>Weather2:</strong> {this.props.pokemon.Weather2}</ListGroup.Item>
<ListGroup.Item><strong>ImgName:</strong> {this.props.pokemon.ImgName}</ListGroup.Item>
<ListGroup.Item variant="success"><strong>ATK:</strong> {this.props.pokemon.ATK}</ListGroup.Item>
<ListGroup.Item variant="primary"><strong>DEF:</strong> {this.props.pokemon.DEF}</ListGroup.Item>
<ListGroup.Item variant="danger"><strong>STA:</strong> {this.props.pokemon.STA}</ListGroup.Item>
<ListGroup.Item><strong>Generation:</strong> {this.props.pokemon.Generation}</ListGroup.Item>
<ListGroup.Item><strong>EvolutionStage:</strong> {this.props.pokemon.EvolutionStage}</ListGroup.Item>
<ListGroup.Item><strong>Evolved:</strong> {this.props.pokemon.Evolved}</ListGroup.Item>
<ListGroup.Item><strong>FamilyID:</strong> {this.props.pokemon.FamilyID}</ListGroup.Item>
<ListGroup.Item><strong>CrossGen:</strong> {this.props.pokemon.CrossGen}</ListGroup.Item>
<ListGroup.Item><strong>StatTotal:</strong> {this.props.pokemon.StatTotal}</ListGroup.Item>
<ListGroup.Item><strong>Legendary:</strong> {this.props.pokemon.Legendary}</ListGroup.Item>
<ListGroup.Item><strong>Aquireable:</strong> {this.props.pokemon.Aquireable}</ListGroup.Item>
<ListGroup.Item><strong>Spawns:</strong> {this.props.pokemon.Spawns}</ListGroup.Item>
<ListGroup.Item><strong>Regional:</strong> {this.props.pokemon.Regional}</ListGroup.Item>
<ListGroup.Item><strong>Raidable:</strong> {this.props.pokemon.Raidable}</ListGroup.Item>
<ListGroup.Item><strong>Hatchable:</strong> {this.props.pokemon.Hatchable}</ListGroup.Item>
<ListGroup.Item><strong>Shiny:</strong> {this.props.pokemon.Shiny}</ListGroup.Item>
<ListGroup.Item><strong>Nest:</strong> {this.props.pokemon.Nest}</ListGroup.Item>
<ListGroup.Item><strong>New:</strong> {this.props.pokemon.New}</ListGroup.Item>
<ListGroup.Item><strong>NotGettable:</strong> {this.props.pokemon.NotGettable}</ListGroup.Item>
<ListGroup.Item><strong>FutureEvolve:</strong> {this.props.pokemon.FutureEvolve}</ListGroup.Item>
<ListGroup.Item><strong>CP40:</strong> {this.props.pokemon.CP40}</ListGroup.Item>
<ListGroup.Item><strong>CP39:</strong> {this.props.pokemon.CP39}</ListGroup.Item>
</ListGroup>
</Col>
<Col sm={6}>
<Card>
<Card.Header><strong>Abilities</strong></Card.Header>
<Card.Body>
{this.state.abilities.map((ability) => {
return (
<>
<Card.Title>{ability.Name}</Card.Title>
<Card.Text>
{ability.Effect}
</Card.Text>
</>
);
})}
</Card.Body>
</Card>
</Col>
</Row>
</Modal.Body>
</Modal>
);
}
}
Empty file.
Loading