Skip to content

Commit

Permalink
Entregable 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignacio Peluaga committed Mar 7, 2021
1 parent 33ca965 commit 6400edf
Show file tree
Hide file tree
Showing 14 changed files with 594 additions and 34 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Entregable 3

Entregable 3 de DGEU, opción A

![Alt text](entregable3.png)
Binary file added entregable3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions public/css/wrapper.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.wrapper {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 40px;
grid-auto-rows: minmax(100px, auto);
}

4 changes: 4 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<link rel="stylesheet" id="university-hub-google-fonts-css" href="%PUBLIC_URL%/css/css" type="text/css" media="all">
<link rel="stylesheet" id="jquery-sidr-css" href="%PUBLIC_URL%/css/jquery.sidr.dark.min.css" type="text/css" media="all">
<link rel="stylesheet" id="university-hub-style-css" href="%PUBLIC_URL%/css/style.css" type="text/css" media="all">
<!--<link rel="stylesheet" href="%PUBLIC_URL%/css/wrapper.css" type="text/css" media="all"> -->

<!-- JS -->
<script type="text/javascript" async="" src="%PUBLIC_URL%/js/analytics.js"></script>
Expand All @@ -39,7 +40,10 @@
<script type="text/javascript" src="%PUBLIC_URL%/js/jquery.easy-ticker.min.js" id="jquery-easy-ticker-js"></script>
<script type="text/javascript" src="%PUBLIC_URL%/js/custom.min.js" id="university-hub-custom-js"></script>
<script type="text/javascript" src="%PUBLIC_URL%/js/wp-embed.min.js" id="wp-embed-js"></script>

<!-- IMGs -->


<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand Down
53 changes: 22 additions & 31 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import olavideLogo from './assets/img/olavide.jpg'
import ualLogo from './assets/img/ual.jpg'
import ucoLogo from './assets/img/uco.jpg'
import ucaLogo from './assets/img/uca-233x300.jpeg'
import ugrLogo from './assets/img/ugr.jpg'
import uhuLogo from './assets/img/uhu.jpg'
import ujaenLogo from './assets/img/ujaen.jpg'
import umaLogo from './assets/img/uma.jpg'
import univaLogo from './assets/img/univa.jpg'
import usevillaLogo from './assets/img/usevilla.jpg'
import Footer from './components/Footer'
import Footer from './components/Footer'
import Menu from './components/Menu'
import TopHeader from './components/TopHeader'
import MainNav from './components/MainNav'
import Introduction from './components/Introduction'
import University from './components/University'
import UniversityList from './styledComponents/UniversityList'// no necesitan estado global de redux
import FilterForm from './containers/FilterForm' //utiliza store de redux
import { Action, createStore } from 'redux';
import IGlobalState, { initialState } from './states/globalState'
import { Provider } from 'react-redux'

//recibe un estado y una acción. Devuelve el resultado de aplicar al estado la acción
const reducer = (state: IGlobalState = initialState, action: Action) => {
return state;
}

// aqui se almacena el estado, a medida que la app evoluciona, se verán los cambios reflejados
const store = createStore(reducer, initialState);

function App() {
return (
<Provider store={store}>
<body className="home page-template-default page page-id-15 wp-embed-responsive global-layout-no-sidebar slider-disabled">

<div id="page" className="hfeed site">
Expand Down Expand Up @@ -61,31 +64,18 @@ function App() {

{/* REFACTORING SHOULD START HERE # TODO: use redux and jss */}

<University href={"https://www.ual.es/"} title={"Universidad de Almería"} imgSrc={ualLogo} uniText={"<strong><a title=\"Universidad de Almeria\" href=\"https://www.distritounicoandaluz.org/universidad-de-almeria/\">UNIVERSIDAD DE ALMERÍA</a>:</strong> Creada por el Parlamento Andaluz en 1993. Es una de las universidades más jóvenes de España. Su oferta académica incluye más&nbsp;de 30 titulaciones, más de 37 programas de doctorado (9 de ellos con mención de calidad), 13 másteres oficiales y 12 másteres propios."} />

<University href={"https://www.uca.es/"} title={"Universidad de Cádiz"} imgSrc={ucaLogo} uniText={"<strong><a title=\"Universidad de Cadiz\" href=\"https://www.distritounicoandaluz.org/universidad-de-cadiz/\">UNIVERSIDAD DE CADIZ</a>:</strong>&nbsp;Comenzó sus actividades en octubre de 1979.&nbsp;La oferta actual de estudios abarca un total de 41 titulaciones de Grado, 12 Programas Conjuntos de Estudios Oficiales de Grado (PCEO), 39 Másteres Universitarios y 15 Programas de Doctorado."}/>

<University href={"https://www.uco.es/"} title={"Universidad de Cordoba"} imgSrc={ucoLogo} uniText={"<strong><a title=\"Universidad de Cordoba\" href=\"https://www.distritounicoandaluz.org/universidad-de-cordoba/\">UNIVERSIDAD DE CÓRDOBA</a>:</strong>&nbsp;fundada como tal en 1972, sus raíces se remontan a la Universidad Libre que funcionó en la provincia a finales del siglo XIX y cuenta con estudios centenarios como los de Veterinaria, únicos en Andalucía.&nbsp;Los estudios de esta universidad van desde las Humanidades y las Ciencias Jurídico-Sociales a las Ciencias de la Salud y las carreras científico-técnicas."} />

<University href={"https://www.ugr.es/"} title={"Universidad de Granada"} imgSrc={ugrLogo} uniText={"<strong><a title=\"Universidad de Granada\" href=\"https://www.distritounicoandaluz.org/universidad-de-granada/\">UNIVERSIDAD DE GRANADA</a>:</strong> Fundada en 1531, es la continuadora de una larga tradición docente que enlaza con la de la Madraza del último Reino Nazarí.&nbsp;Actualmente se imparten 75&nbsp;titulaciones&nbsp;en los 28&nbsp;centros docentes&nbsp;de que dispone la Universidad. Por otro lado,&nbsp;su&nbsp;<a title=\"servicios/ep\" href=\"http://www.ugr.es/pages/servicios/ep\">Escuela Internacional de Posgrado</a>&nbsp;ofrece 68 Másteres, 116 Doctorados y 113 cursos complementarios."} />

<University href={"http://www.uma.es/"} title={"Universidad de Málaga"} imgSrc={umaLogo} uniText={"<strong><a title=\"Universidad de Malaga\" href=\"https://www.distritounicoandaluz.org/universidad-de-malaga/\">UNIVERSIDAD DE MÁLAGA</a>:</strong> Creada oficialmente en agosto de 1972. Su oferta académica comprende 62 Grados, 43 Programas de Doctorado, 55 Másteres, y 39 Títulos Propios de Postgrado (Máster y Experto)."} />
<UniversityList/>

<University href={"https://www.uhu.es/"} title={"Universidad de Huelva"} imgSrc={uhuLogo} uniText={"<strong><a title=\"Universidad de Huelva\" href=\"https://www.distritounicoandaluz.org/universidad-de-huelva/\">UNIVERSIDAD DE HUELVA</a>:&nbsp;</strong>Creada en julio de 1993. Actualmente cuenta con una oferta de 36 titulaciones de Grado, 4 Estudios de Segundo Ciclo, 28 Másteres Oficiales, y 21 Programas de Doctorados."} />

<University href={"https://www.us.es/"} title={"Universidad de Sevilla"} imgSrc={usevillaLogo} uniText={"<strong><a title=\"Universidad de Sevilla\" href=\"https://www.distritounicoandaluz.org/universidad-de-sevilla/\">UNIVERSIDAD DE SEVILLA</a>: </strong>Fundada hace más de quinientos años, es la segunda universidad española en número de estudiantes y la primera de Andalucía. Su oferta académica actual ronda las 66 titulaciones de Grado desde el Primer Curso, 86 Másteres Universitarios, 152 Programas de Doctorado, y 335 Estudios de Postgrado Universitario."} />

<University href={"https://www10.ujaen.es/"} title={"Universidad de Jaén"} imgSrc={ujaenLogo} uniText={"<strong><a title=\"Universidad de Jaen\" href=\"https://www.distritounicoandaluz.org/universidad-de-jaen/\">UNIVERSIDAD DE JAÉN</a>:&nbsp;</strong>Sus orígenes&nbsp;se remontan a la creación de la Universidad de Baeza en la Edad Moderna, con un amplio recorrido hasta llegar a 1993 en que inicia su andadura como institución autónoma.&nbsp;&nbsp;Su oferta académica, “diseñada de acuerdo con las necesidades laborales y profesionales de la sociedad”, está conformada por más de 50 titulaciones de Grado, Primer y Segundo Ciclo y 22 másteres, algunos de ellos impartidos a través de Internet."} />

<University href={"https://www.upo.es/portal/impe/web/portada"} title={"Universidad Pablo de Olavide"} imgSrc={olavideLogo} uniText={"<strong><a title=\"Universidad Pablo de Olavide\" href=\"https://www.distritounicoandaluz.org/universidad-pablo-de-olavide/\">UNIVERSIDAD PABLO DE OLAVIDE</a>:&nbsp;</strong>Ubicada en Sevilla, esta universidad fue creada en julio de 1997. Su oferta de estudios en la actualidad se distribuye en&nbsp;31 Grados y dobles Grados,&nbsp;40 Másteres Oficiales,&nbsp;9&nbsp;Programas de Doctorado, y&nbsp;147&nbsp;Títulos Propios."} />
<p>Mas info sobre el <strong>Distrito Unico Andaluz</strong>: <a href="https://www.juntadeandalucia.es/economiainnovacionyciencia/sguit/">https://www.juntadeandalucia.es/economiainnovacionyciencia/sguit/</a>#</p>

<University href={"http://www.unia.es/"} title={"UNIVERSIDAD INTERNACIONAL DE ANDALUCÍA"} imgSrc={univaLogo} uniText={"<strong>UNIVERSIDAD INTERNACIONAL DE ANDALUCÍA: </strong>Fue creada por Ley de la Comunidad Autónoma de Andalucía en 1994. Las enseñanzas que se imparten en esta universidad son especializadas y de postgrado e incluyen&nbsp;Programas Oficiales de Postgrado, Doctorados, Títulos Propios (Másteres Universitarios y Cursos de Experto Universitario), Cursos de Formación Permanente y Cursos de Verano."} />
<FilterForm />

{/* REFACTORING SHOULD END HERE */}

<p>Mas info sobre el <strong>Distrito Unico Andaluz</strong>: <a href="https://www.juntadeandalucia.es/economiainnovacionyciencia/sguit/">https://www.juntadeandalucia.es/economiainnovacionyciencia/sguit/</a>#</p>

<div style={{ fontSize: "0px", height: "0px", lineHeight: "0px", margin: "0", padding: "0", clear: "both" }}>
</div>
</div>

</div>
</div>
<footer className="entry-footer">
Expand All @@ -100,6 +90,7 @@ function App() {
</div>
<a href="https://www.distritounicoandaluz.org/#page" className="scrollup" id="btn-scrollup" style={{ display: "none" }}><i className="fa fa-angle-up"></i></a>
</body>
</Provider>
);
}
export default App;
142 changes: 142 additions & 0 deletions src/components/FilterForm.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
import * as React from 'react';

// DATOS
var data = require('./db.json');

interface IFilterFormState {
uni: string
tipo: string
area: string
results: [string, string][]
}

class FilterForm extends React.Component<{}, IFilterFormState> {

constructor(props: {}) {
super(props);
this.state = {
uni: "Universidad de Sevilla",
tipo: "Máster",
area: "Ingeniería",
results: []
};
this.queryDB = this.queryDB.bind(this); // TODO: check
}

public setUni(event: React.ChangeEvent<HTMLSelectElement>) {
let newState = {
uni: event.target.value,
tipo: this.state.tipo,
area: this.state.area,
results: this.state.results
}
this.setState(newState);
}
public setArea(event: React.ChangeEvent<HTMLSelectElement>) {
let newState = {
uni: this.state.uni,
tipo: this.state.tipo,
area: event.target.value,
results: this.state.results
}
this.setState(newState);
}
public setTipo(event: React.ChangeEvent<HTMLSelectElement>) {
let newState = {
uni: this.state.uni,
tipo: event.target.value,
area: this.state.area,
results: this.state.results
}
this.setState(newState);
}

public queryDB() {

//var res = []
const res: [string, string][] = [];
for (var i = 0; i < data.length; i++) {

var obj = data[i];
console.log(obj);

if (obj["university"] === this.state.uni) {

var uniWeb = obj["web"]

//console.log("")
//console.log(obj)
//console.log("")

var univ_degrees = obj["degrees"]
//console.log(univ_degrees)

for (var j = 0; j < univ_degrees.length; j++) {

//console.log(univ_degrees[j])

if (this.state.tipo === "Máster" && univ_degrees[j]["name"].includes("Máster") && this.state.area === univ_degrees[j]["area"]) {
res.push([univ_degrees[j]["name"], uniWeb])
}
else if (this.state.tipo === "Grado" && !univ_degrees[j]["name"].includes("Máster") && this.state.area === univ_degrees[j]["area"]) {
res.push([univ_degrees[j]["name"], uniWeb])
}
}
}
}
console.log(res);
let newState = {
uni: this.state.uni,
tipo: this.state.tipo,
area: this.state.area,
results: res
}
this.setState(newState);
}

public render() {
return (

<div>
<h3>Buscador de Titulaciones</h3>
<div><label>Universidad </label>
<select onChange={e => this.setUni(e)} >
<option value="Universidad de Sevilla">Universidad de Sevilla</option>
<option value="Universidad de Almería">Universidad de Almería</option>
<option value="Universidad de Cádiz">Universidad de Cádiz</option>
<option value="Universidad de Cordoba">Universidad de Cordoba</option>
<option value="Universidad de Granada">Universidad de Granada</option>
<option value="Universidad de Málaga">Universidad de Málaga</option>
<option value="Universidad de Huelva">Universidad de Huelva</option>
<option value="Universidad de Jaén">Universidad de Jaén</option>
<option value="Universidad Pablo de Olavide">Universidad Pablo de Olavide</option>
</select></div>

<div style={{ marginTop: "5px" }}><label>Area </label>
<select onChange={e => this.setArea(e)} >
<option value="Ingeniería">Ingenieria</option>
<option value="Ciencias">Ciencias</option>
<option value="Otros">Otras</option>
</select></div>

<div style={{ marginTop: "5px" }}><label>Tipo de Titulación</label>
<select onChange={e => this.setTipo(e)} >
<option value="Máster">Máster</option>
<option value="Grado">Grado</option>
</select></div>

<button style={{ marginTop: "15px" }} onClick={this.queryDB} type="button">Buscar</button>

<div style={{ marginTop: "15px" }}>
{this.state.results.map(degreeResult =>
<div>
<p>{degreeResult[0]} <a target="_blank" rel="noreferrer" href={degreeResult[1]}>(Más Información)</a></p>
</div>
)}
</div>

</div>
);
}
}
export default FilterForm;
53 changes: 50 additions & 3 deletions src/components/University.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
import * as React from 'react';

interface IUniversityProps {
export interface IUniversityClasses<T> {
one: T;
two: T;
three: T;
four: T;
five: T;
six: T;
seven: T;
eight: T;
nine: T;
ten: T;
}

export interface IUniversityProps {
href: string;
imgSrc: string;
title: string;
uniText: string;
wrapperItemCounter: string;
classes: IUniversityClasses<string>;
}

interface IUniversityState {
href: string;
imgSrc: string;
title: string;
uniText: string;
wrapperItemCounter: string;
}

class University extends React.Component<IUniversityProps, IUniversityState> {
Expand All @@ -23,12 +39,42 @@ class University extends React.Component<IUniversityProps, IUniversityState> {
imgSrc: this.props.imgSrc,
title: this.props.title,
uniText: this.props.uniText,
wrapperItemCounter: this.props.wrapperItemCounter,
};
}

public toIF(wpCounter: string) {
/*
Convierte string en
*/
switch (wpCounter) {
case "one":
return this.props.classes.one
case "two":
return this.props.classes.two
case "three":
return this.props.classes.three
case "four":
return this.props.classes.four
case "five":
return this.props.classes.five
case "six":
return this.props.classes.six
case "seven":
return this.props.classes.seven
case "eight":
return this.props.classes.eight
case "nine":
return this.props.classes.nine
case "ten":
return this.props.classes.ten
}
}

public render() {
let wpCount = this.toIF(this.state.wrapperItemCounter);
return (

<div className={wpCount}>
<p>
<a href={this.state.href} target="_blank" rel="noopener noreferrer">
<img loading="lazy" className="aligncenter" title={this.state.title} src={this.state.imgSrc} alt={this.state.title} width="105" height="105" />
Expand All @@ -37,8 +83,9 @@ class University extends React.Component<IUniversityProps, IUniversityState> {
__html: this.state.uniText
}}></div>
</p>
</div>

);
}
}
export default University;
export default University;
Loading

0 comments on commit 6400edf

Please sign in to comment.