Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yaelvc #21

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c9f150f
Actualizando README
MarielaTorresB Jun 28, 2019
f631c33
Modificando readme, agregando enlace a la encuesta
MarielaTorresB Jun 28, 2019
504d1d8
Merge pull request #1 from MarielaTorresB/Mariela
Daynizyvc Jun 28, 2019
fbe1b3c
Agregando enlace al primer prototipo en Marvel
MarielaTorresB Jun 28, 2019
433a6a4
Merge pull request #2 from MarielaTorresB/Mariela
Daynizyvc Jun 28, 2019
143af96
Se muestra la API en la app Web y se registra nuestra primer historia…
Daynizyvc Jul 2, 2019
4057744
Merge pull request #3 from Daynizyvc/daynizyvc
Daynizyvc Jul 2, 2019
9d0963c
Probando estilos de CSS diferentes
MarielaTorresB Jul 2, 2019
1b67ddd
Añadiendo estilos CSS
MarielaTorresB Jul 3, 2019
c2069dd
Añadimos la barra menú, que ya es responsive
Daynizyvc Jul 5, 2019
f8ceec2
Merge pull request #4 from Daynizyvc/yaelvc
Daynizyvc Jul 5, 2019
4ca4997
Implementando visualización en tarjetas que giran, queda pendiente ev…
MarielaTorresB Jul 6, 2019
f150d29
Agregando gif transparente y menú
MarielaTorresB Jul 6, 2019
7d9aa7e
Versión que ya filtra por tipo de pokémon, sigue sin mostrar la infor…
MarielaTorresB Jul 7, 2019
f125a32
Merge pull request #5 from MarielaTorresB/Mariela
Daynizyvc Jul 8, 2019
a3f459c
acpetando cambios
Daynizyvc Jul 8, 2019
0d7ab38
fusionandp cambios
Daynizyvc Jul 8, 2019
e4189bb
funcion de pintar agregada
Daynizyvc Jul 10, 2019
bcc43c2
Se agregó la funcion de ordenar
Daynizyvc Jul 10, 2019
aec8230
Se ha agregado la gráfica y ya esta todo revisado por las dos
Daynizyvc Jul 13, 2019
3877595
Se agrego la grafica y detalles del css (responsive)
Daynizyvc Jul 15, 2019
8a1d735
Se agregaron cambios en las listas desplegables
Daynizyvc Jul 15, 2019
0cf470a
Se actualizo readme
Daynizyvc Jul 15, 2019
5e81508
Se arreglo lo de los test
Daynizyvc Jul 15, 2019
566ca50
Readme modificado
Daynizyvc Aug 1, 2019
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
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"extends": "eslint:recommended",
"globals": {
"example": false
"google": false
},
"rules": {
"no-console": 0,
Expand Down
427 changes: 41 additions & 386 deletions README.md

Large diffs are not rendered by default.

416 changes: 416 additions & 0 deletions RETO.md

Large diffs are not rendered by default.

Binary file added images/Edad.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 images/FINAL.gif
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 images/Fam.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 images/Filtrar.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 images/Género.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 images/Irrelevantes.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 images/Ocupación.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 images/Ordenar.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 images/Pokmon.jpg
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 images/Rafael.jpg
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 images/Relevantes.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 images/allPokemones.jpg
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 images/elbueno.gif
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 images/ezgif.com-gif-maker(3).gif
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 images/ezgif.com-gif-maker(4).gif
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 images/goku.jpg
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 images/graph.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 images/icon.jpg
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 images/iconColor.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 images/iconGraph.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 images/icono.jpg
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 images/iconoInicio
Binary file not shown.
Binary file added images/imagesOne.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 images/logoOne.gif
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 images/pikachu.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 images/pokebola.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 images/pokegif.gif
Binary file added images/pokegiff.gif
Binary file added images/pokegiftransparente (copia).gif
Binary file added images/pokegiftransparente.gif
Binary file added images/pokemon-12.jpg
Binary file added images/pokemones.jpg
Binary file added images/tenor.gif
Binary file added images/titulo.gif
Binary file added images/titulotransp.gif
Binary file added images/titulotransparente.gif
Binary file added images/tpte.gif
5,572 changes: 5,572 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
"htmlhint": "htmlhint src/*.html test/*.html",
"eslint": "eslint --ext .js src/ test/",
"pretest": "npm run eslint --silent && npm run htmlhint --silent",
"test": "jest"
"test": "jest --coverage"
},
"dependencies": {
"chart.js": "^2.8.0",
"eslint": "^5.9.0",
"eslint-plugin-jest": "^22.1.2",
"htmlhint": "^0.10.1",
Expand Down
42 changes: 37 additions & 5 deletions src/data.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,40 @@
// esta es una función de ejemplo
// puedes ver como agregamos la función a nuestro objeto global window
let filterData = (data, condition) => {
let filtered;
if (condition == "allP") {
filtered = data;
} else {
filtered = data.filter(element => element.type.indexOf(condition) > -1);
}
return filtered;
};
window.filterData= filterData;

const example = () => {
return 'example';
let sortData = (data, sortOrder) => {
let organized;
if (sortOrder === "A-to-Z"){
organized= data.sort((a,b) => a.name.localeCompare(b.name));
}
if (sortOrder === "Z-to-A"){
organized= data.sort((a,b) => b.name.localeCompare(a.name));
}
if (sortOrder === "0-to-9"){
organized = data.sort((a,b) => {
return(a.id - b.id);
});
}
if (sortOrder ==="9-to-0"){
organized = data.sort((a,b) => {
return(b.id - a.id);
});
}
return organized;
};

window.sortData= sortData;

window.example = example;
let stadistics = (element, data) =>{
let porcentage;
porcentage = Math.round((element/data.length)*100);
return porcentage;
};
window.stadistics = stadistics;
2 changes: 2 additions & 0 deletions src/data/pokemon/pokemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -4085,3 +4085,5 @@ var POKEMON = {
}]
}
;;

window.POKEMON = POKEMON;
132 changes: 121 additions & 11 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,128 @@
<!DOCTYPE html>
<html>
<html lang="esp">

<head>
<meta charset="utf-8">
<title>Data Lovers</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
<title>Pokemon Start</title>

<link rel="icon" type="image/jpeg" href="../images/icon.jpg"/>
<link rel="stylesheet" href="style.css" />

<link href="https://fonts.googleapis.com/css?family=Indie+Flower|Rajdhani|Shadows+Into+Light&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Mountains+of+Christmas|Poiret+One|Rum+Raisin&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Poiret+One&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Economica|Neucha&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Orbitron&display=swap" rel="stylesheet">
</head>
<body>
<div id="root"></div>
<!-- <script src="./data/injuries/injuries.js"></script> -->
<!-- <script src="./data/pokemon/pokemon.js"></script> -->
<!-- <script src="./data/steam/steam.js"></script> -->
<!-- <script src="./data/worldbank/worldbank.js"></script> -->
<!-- <script src="./data/lol/lol.js"></script> -->

<body>

<script src="./data/pokemon/pokemon.js"></script>

<header class = "header">
<figure class ="titulo">
<img class="img-header" src="../images/pokegiftransparente.gif">
</figure>
</header>

<nav class = "options">
<div class = "options-container">

<div class="option-one">
<div class = "image-home">
<input type = "image" id ="home-page" src = "../images/iconoInicio">
</div>
<div class = "color-one">
</div>
</div>

<div class = "option-two">
<div class = "option-pokedex">
<input type = "image" id = "pokedex" src = "../images/pikachu.png">
</div>
<div class = "color-two">
</div>
</div>

<div class = "option-three">
<div class = "option-graph">
<input type = "image" id = "graph" src = "../images/graph.png">
</div>
<div class = "color-three">
</div>
</div>
</div>
</nav>

<section id= "section-one" class ="introduction-video">
<div class = "page-home">
<div class = "video-responsive">
<iframe class = "video" src="https://www.youtube.com/embed/Kwpp4mCCSa0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>
</iframe>
</div>
<div class = "information-text">
<h1>¿Sabías qué...?</h1>
<div class = "pharagraph">
<p class = "pharagraph-inf">
Ash es un niño del pueblo Paleta, tiene 10 años y por fin podrá sacar su licencia Pokemón.
A los 10 años se puede obtener un pokemón principiante del profesor Oak, el experto en pokemones
de la ciudad. Ash viajará para obtener la sabiduría del entrenamiento pokemón.
Y tú, ¿estás listo para ser ¡<b>El MEJOR MAESTRO POKEMON</b>! del mundo?
</p>
</div>
</div> <b></b>
</div>
</section>

<section id = "section-pokemon" class = "hidden">
<div class="manipulation">
<div class="filtrar">
<p class = "filtrar-pokemon">TIPO DE POKEMON:</p>
<select name="tipo" id="type" class="filter-type">
<option value="allP" selected= "True">Todos</option>
<option value="Water">Water</option>
<option value="Fire">Fire</option>
<option value="Grass">Grass</option>
<option value="Ground">Ground</option>
<option value="Ice">Ice</option>
<option value="Electric">Electric</option>
<option value="Rock">Rock</option>
<option value="Flying">Flying</option>
<option value="Poison">Poison</option>
<option value="Bug">Bug</option>
<option value="Psychic">Psychic</option>
<option value="Normal">Normal</option>
<option value="Fighting">Fighting</option>
<option value="Dragon">Dragon</option>
</select>
</div>
<div class="ordenar">
<p class = "orden-pokemon">ORDENAR: </p>
<select name= "ordenando" id="order" class = "order-pokemon">
<option value="nothing" selected = "True" disabled = "disabled">Ordenar por ...</option>
<option value="A-to-Z"> Alfabético (A a Z) </option>
<option value="Z-to-A"> Alfabético (Z a A) </option>
<option value="0-to-9"> Número (Ascendente) </option>
<option value="9-to-0">Número (Descendente)</option>
</select>
</div>
</div>
<div class = "all-Pokemon" id="all-Pokemon">
</div>
</section>

<section id="show-graph" class = "hidden">
<div class = "box-porcentage" id = "estadistics">
</div>
<div class = "box-graph" id = "div-show-graph">
</div>
</section>

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script src="data.js"></script>
<script src="main.js"></script>
<script src="main.js"></script>

</body>
</html>
136 changes: 136 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
const allPokemon = document.getElementById("all-Pokemon"); //Esta es la sección donde se van a pintar las tarjetas
let type = document.getElementById("type"); //Esta es la lista deplegable con los tipos de pokémon
let order = document.getElementById("order"); // Lista despeglable para ordenar los pokemones
const dataPokemon = window.POKEMON.pokemon; //Data

let pokearray = [];
let pokearrayOrganized = [];

const inicio = document.getElementById("section-one");
const introduction = document.getElementById("home-page");
const pokedex = document.getElementById("pokedex");
const pokeGraph = document.getElementById("graph");
const pokemones = document.getElementById("section-pokemon");
const sectionGraph = document.getElementById("show-graph");

const mostrarData = (data) => {
let str = '';
data.forEach(element => {
str +=
`<div class="box-Pokemon">
<div class= "flip-card-inner">
<div class = "flip-card-front">
<div>
<p class="poke-Number">${element.id}</p>
</div>
<div>
<img class="poke-img" src="${element.img}"/>
</div>
<div>
<p class = "poke-Name">${element.name}</p>
</div>
</div>
<div class= "flip-card-back">
<div class= "datos">
<p> Type: ${element.type}</p>
<br>
<p> Candy: ${element.candy}</p>
<br>
<p> Weaknesses: </p>
<p>${element.weaknesses}</p>
</div>
</div>
</div>
</div>` ;
});
allPokemon.innerHTML = str;
};
mostrarData(dataPokemon);

//Función "showType"
const showType = event => {
const condition = event.target.value; //Guardando el tipo de Pokémon que elige el usuario
pokearray = window.filterData(dataPokemon,condition); //Se guarda como nuevo arreglo, el resultado de la función filterData
mostrarData(pokearray);
};

//Funcion "orderPokemon"
const orderPokemon = event => {
if (pokearray.length == "0"){
pokearray= dataPokemon;
}
const ordenDatos = event.target.value; //Guardando el orden que elige el usuario
pokearrayOrganized = window.sortData(pokearray,ordenDatos); //Se guarda como nuevo arreglo, el resultado de la función filterData
mostrarData(pokearrayOrganized);
};


//estadisticas
const typeP = ["Water", "Fire", "Grass", "Ground", "Ice", "Electric", "Rock", "Flying", "Poison", "Bug", "Psychic", "Normal", "Fighting", "Dragon"];
let numType = [];
typeP.forEach(element =>{
numType.push((window.filterData(dataPokemon,element).length));
});

let porcentageTypePokemon = [];

numType.forEach(element => {
porcentageTypePokemon.push(window.stadistics(element, dataPokemon));
});

const show = () =>{
pokemones.classList.remove("hidden");
inicio.classList.add("hidden");
sectionGraph.classList.add("hidden");
};

const showHome = () =>{
inicio.classList.remove("hidden");
pokemones.classList.add("hidden");
sectionGraph.classList.add("hidden");
};

const showGraph = () =>{
sectionGraph.classList.remove("hidden");
pokemones.classList.add("hidden");
inicio.classList.add("hidden");

google.charts.load("current", {packages:["corechart"]});
google.charts.setOnLoadCallback(graphType);

function graphType (){
let data = google.visualization.arrayToDataTable([
['Tipo', '%'],
['Agua', 32],
['Fuego', 12],
['Planta', 14],
['Tierra', 14],
['Hielo', 5],
['Eléctrico', 9],
['Roca', 11],
['Volador', 19],
['Venenoso', 33],
['Insecto', 12],
['Psíquico', 14],
['Normal', 24],
['Volador', 8],
['Dragón', 3]
]);

const options ={
title: 'Tipos de Pokemones',
is3D: true,
'width':1000,
'height':1000,
};

let chart = new google.visualization.PieChart(document.getElementById('div-show-graph'));
chart.draw(data,options);
}
};

type.addEventListener("change", showType); //La lista desplegable responderá a un cambio y ejecuta la función "showtype"
order.addEventListener("change",orderPokemon);
pokedex.addEventListener("click",show);
introduction.addEventListener("click", showHome);
pokeGraph.addEventListener("click", showGraph);
Loading