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

Agregando vista perfil HTML CSS #5

Open
wants to merge 59 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
0a1f1ea
Empezando redacción del readme
Constanza-Oreste May 28, 2020
1d23822
estrura HTML y CSS hoja principal
YarimarDiaz Jun 4, 2020
3fca79a
Merge pull request #1 from yarimar-labo/master
Constanza-Oreste Jun 4, 2020
697a646
solucion conflicto
Constanza-Oreste Jun 4, 2020
c253354
resolviendo conflictos en style
Constanza-Oreste Jun 4, 2020
9ca6af7
resolviendo carpeta imagenes
Constanza-Oreste Jun 4, 2020
ea93e82
comfiguración de firebase y login de google
AnlianaAguilar Jun 4, 2020
38a3498
Merge pull request #2 from AnlianaAguilar/master
Constanza-Oreste Jun 5, 2020
feb3efd
Se crea pagina de registro y modificaciones de vista
AnlianaAguilar Jun 8, 2020
0b77b64
Merge pull request #3 from AnlianaAguilar/master
Constanza-Oreste Jun 8, 2020
033bfca
Vista perfil html y css
Constanza-Oreste Jun 8, 2020
6a7e122
Se crea Pagina de conocenos
YarimarDiaz Jun 8, 2020
eb87a06
Merge pull request #4 from yarimar-labo/master
Constanza-Oreste Jun 8, 2020
1e51b4b
Se crea funcion de registro de usuario
YarimarDiaz Jun 9, 2020
35d6962
Merge pull request #5 from yarimar-labo/master
Constanza-Oreste Jun 9, 2020
dce5d0b
prueba
Constanza-Oreste Jun 9, 2020
7d4debb
Agregando primera imagen al readme
Constanza-Oreste Jun 9, 2020
0032e2c
guardando comentarios en base de datos
Constanza-Oreste Jun 10, 2020
cf56c3a
Cambios de vistas y configuración de usuario registrado
AnlianaAguilar Jun 10, 2020
85d5080
Merge pull request #6 from AnlianaAguilar/master
Constanza-Oreste Jun 10, 2020
b024512
Configuracion de cerrar sesion, modificacion de errores y css
AnlianaAguilar Jun 11, 2020
6fca6f4
Merge pull request #7 from AnlianaAguilar/master
Constanza-Oreste Jun 11, 2020
feb72b5
Cambios en mensaje de error, foto y usuario de google
AnlianaAguilar Jun 15, 2020
c29b5cf
Merge pull request #8 from AnlianaAguilar/master
Constanza-Oreste Jun 15, 2020
4d209c3
imagenes readme
Constanza-Oreste Jun 15, 2020
0a58fd9
Redactando readme
Constanza-Oreste Jun 15, 2020
fd89d8c
Redactando readme
Constanza-Oreste Jun 15, 2020
288776f
Redactando readme
Constanza-Oreste Jun 15, 2020
6c558e4
Redactando readme
Constanza-Oreste Jun 15, 2020
4bbf812
Agregando imagenes prototipo alta fidelidad
Constanza-Oreste Jun 15, 2020
0590e73
Agregando imagenes prototipo alta fidelidad
Constanza-Oreste Jun 15, 2020
e6542e5
Ordenando readme
Constanza-Oreste Jun 15, 2020
6ac9871
agregando vista de celular
Constanza-Oreste Jun 16, 2020
baec260
Cambios del btn google
YarimarDiaz Jun 16, 2020
8275794
Merge pull request #9 from yarimar-labo/master
Constanza-Oreste Jun 16, 2020
f4a723d
Mostrar comentario y baner
AnlianaAguilar Jun 16, 2020
0f80e23
Merge pull request #10 from AnlianaAguilar/master
Constanza-Oreste Jun 17, 2020
2e31d67
pruebas de cambios
YarimarDiaz Jun 17, 2020
a8297fb
Merge pull request #11 from yarimar-labo/master
Constanza-Oreste Jun 17, 2020
6dbcd40
Eliminar Comentario
AnlianaAguilar Jun 17, 2020
55174fe
Merge pull request #12 from AnlianaAguilar/master
Constanza-Oreste Jun 17, 2020
104a626
Se crea configuracion del conteo de like y modificacion de redireccio…
YarimarDiaz Jun 18, 2020
57f399d
Merge pull request #13 from yarimar-labo/master
Constanza-Oreste Jun 18, 2020
0bba182
Errores en profile
AnlianaAguilar Jun 18, 2020
617e679
Merge pull request #14 from AnlianaAguilar/master
Constanza-Oreste Jun 18, 2020
184089c
corrigiendo errores en index.js
Constanza-Oreste Jun 18, 2020
abbce12
Modificando eslint en main.js
YarimarDiaz Jun 18, 2020
9be5e87
Merge pull request #15 from yarimar-labo/master
Constanza-Oreste Jun 18, 2020
da1cf06
Función editar, confirmación de eliminar y editar post
AnlianaAguilar Jun 19, 2020
2f50307
Merge pull request #16 from AnlianaAguilar/master
Constanza-Oreste Jun 19, 2020
58cc281
Corrección de errores y test
AnlianaAguilar Jun 20, 2020
1ecb797
Merge pull request #17 from AnlianaAguilar/master
Constanza-Oreste Jun 20, 2020
8df3e78
HTML Y CSS de Profile
YarimarDiaz Jun 21, 2020
4399be6
Merge pull request #18 from yarimar-labo/master
Constanza-Oreste Jun 21, 2020
c6158b4
Complementacion del readme metodologia UX
YarimarDiaz Jun 21, 2020
1d4a1e5
Merge pull request #19 from yarimar-labo/master
Constanza-Oreste Jun 21, 2020
c1645d2
Update README.md
Constanza-Oreste Jun 22, 2020
eb0bf0f
Correcion de boton editar, y otros detalles
YarimarDiaz Jun 22, 2020
9704658
Merge pull request #20 from yarimar-labo/master
Constanza-Oreste Jun 22, 2020
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
379 changes: 118 additions & 261 deletions README.md

Large diffs are not rendered by default.

Binary file added src/img/En-que-consiste-el-trueque-2.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 src/img/Trueque-CriptoTendencia.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 src/img/cancel.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 src/img/comentar.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 src/img/delete.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 src/img/google.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 src/img/like.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 src/img/logo3.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 src/img/nofoto.jpeg
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 src/img/readme/Reportemazzemission1.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 src/img/readme/Reportemazzemission2.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 src/img/readme/Reportemazzemission3.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 src/img/readme/Reportemazzemission4.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 src/img/readme/Reportemazzemission5.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 src/img/readme/Reportemazzemission6.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 src/img/readme/alta1.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 src/img/readme/alta2.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 src/img/readme/alta3.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 src/img/readme/alta4.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 src/img/readme/alta5.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 src/img/readme/altacel1.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 src/img/readme/altacel2.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 src/img/readme/altacel3.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 src/img/readme/altacel4.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 src/img/readme/altacel5.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 src/img/readme/altatablet1.PNG
Binary file added src/img/readme/altatablet2.PNG
Binary file added src/img/readme/home 2.png
Binary file added src/img/readme/home 3.png
Binary file added src/img/readme/home 4.png
Binary file added src/img/readme/home 5.png
Binary file added src/img/readme/home 6.png
Binary file added src/img/readme/home 7.png
Binary file added src/img/readme/home1.png
Binary file added src/img/trueke 4.jpg
Binary file added src/img/trueque.jpg
Binary file added src/img/valores.jpg
30 changes: 26 additions & 4 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
<!DOCTYPE html>
<html lang="en">

<head>
<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>Document</title>
</head>
<link rel="stylesheet" href="style.css" />
<title>El Trueke</title>
</head>

<body>
<script type="module" src="main.js"></script>
<div id="root"></div>
<script type="module" src="main.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.14.6/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.14.6/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.14.6/firebase-firestore.js"></script>

<script>
var firebaseConfig = {
apiKey: "AIzaSyB6PF4N0aAzpfXvVSq36sxn-Tus351zmDI",
authDomain: "el-trueke.firebaseapp.com",
databaseURL: "https://el-trueke.firebaseio.com",
projectId: "el-trueke",
storageBucket: "el-trueke.appspot.com",
messagingSenderId: "71095432017",
appId: "1:71095432017:web:673702cd565f52bb689970"
};
firebase.initializeApp(firebaseConfig);

</script>
</body>
</html>
</html>

227 changes: 223 additions & 4 deletions src/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,225 @@
// aqui exportaras las funciones que necesites
/* eslint-disable no-alert */
/* eslint-disable no-restricted-globals */
/* eslint-disable no-console */
/* eslint-disable no-use-before-define */
/* eslint-disable object-shorthand */
/* eslint-disable no-shadow */
/* eslint-disable vars-on-top */
/* eslint-disable no-var */
/* eslint-disable no-undef */
/* eslint-disable no-unused-vars */
// Configuración de google
// eslint-disable-next-line no-alert
export const login = () => {
const provider = new firebase.auth.GoogleAuthProvider();
firebase.auth().signInWithPopup(provider)
.then(() => {
window.location.hash = '#/profile';
// const token = result.credential.accessToken;
const user = result.user;
}).catch((error) => {
// eslint-disable-next-line no-var
var errorCode = error.code;
var errorMessage = error.message;
var email = error.email;
var credential = error.credential;
// console.log('errorMessage',errorMessage);
});
};

// Mostrar nombre de usuario registrado en google
export const dataUser = () => firebase.auth().currentUser;

// Configuración de nuevo usuario
export const createUser = () => {
const name = document.getElementById('name').value;
const lastname = document.getElementById('lastname').value;
const email = document.getElementById('emailSingIn').value;
const passwordSingIn = document.getElementById('passwordSingIn').value;

firebase.auth().createUserWithEmailAndPassword(email, passwordSingIn)
.then(() => {
const mensageSing = document.querySelector('#mensageSing');
mensageSing.innerHTML = '';
window.location.hash = '#/profile';
// alert ("Se registro Correctamente")
}).catch((error) => {
const errorCode = error.code;
if (errorCode === 'auth/invalid-email') {
mensageSing.innerHTML = 'Su email es invalido';
} if (errorCode === 'auth/weak-password') {
mensageSing.innerHTML = 'La contraseña debe tener 6 caracteres';
} if (errorCode === 'auth/email-already-in-use') {
mensageSing.innerHTML = 'La cuenta ya esta registrada';
}
});
};

// Configuracion de usuario registrado
export const userLogin = (email, pass) => {
firebase.auth().signInWithEmailAndPassword(email, pass)
.then(() => {
const mensajes = document.querySelector('#mensajes');
mensajes.innerHTML = '';
window.location.hash = '#/profile';
})
.catch((error) => {
// Handle Errors here.
const errorCode = error.code;
// let errorMessage = error.message;
if (errorCode === 'auth/invalid-email') {
mensajes.innerHTML = 'Su email es invalido';
} if (errorCode === 'auth/user-not-found') {
mensajes.innerHTML = 'Usuario no esta registrado';
} if (errorCode === 'auth/wrong-password') {
mensajes.innerHTML = 'La contraseña es invalida';
}
});
};


// acceso a usuario que ya estan logeados, configurar observador firebase
export const accesoUserLogin = (email, pass) => {
firebase.auth().onAuthStateChanged((user) => {
if (user) {
var displayName = user.displayName;
var email = user.email;
var emailVerified = user.emailVerified;
var photoURL = user.photoURL;
var isAnonymous = user.isAnonymous;
var uid = user.uid;
var providerData = user.providerData;
}
});
};

// Configuración de base de datos "Creando Post"
export const createComment = () => {
// Funcion para guardar los comentarios
const comment = document.getElementById('txtcomment').value;
const user = firebase.auth().currentUser;
// console.log('llama la funcion');
let userName = user.displayName;
if (user.displayName == null) {
userName = user.email;
}

let userPhoto = user.photoURL;
if (user.photoURL == null) {
userPhoto = './img/nofoto.jpeg';
}
// Agregar comentarios
firebase.firestore().collection('comentarios').add({
nombre: userName,
user: user.uid,
photouser: userPhoto,
comment: comment,
fecha: new Date(),
likes: 0,
})
.then((docRef) => {
document.getElementById('txtcomment').value = '';
// console.log('Document written with ID: ', docRef.id);
postComments();
})
.catch((error) => {
console.error('Error adding document: ', error);
});
};

// leer datos desde base correcta
export const postComments = (divProfile) => {
const publicar = divProfile.querySelector('#post');
firebase.firestore().collection('comentarios').orderBy('fecha', 'desc')
.onSnapshot((querySnapshot) => {
publicar.innerHTML = '';
querySnapshot.forEach((doc) => {
const span = document.createElement('span');
span.innerHTML = `
<div class="encabezadoPost">
<div class="fotoSpan">
<img class='perfilFoto' src="${doc.data().photouser}">
</div>
<div class="nombreSpan">
<p id='nombreUsuario'>${doc.data().nombre}</p>
<p id='fechaPublicado'>${new Date().toLocaleString()}</p>
</div>
</div>
<p class="cuadroEscribir">${doc.data().comment}</p>
<div class="botones">
<button id="btnsum"><img id="btnLike" src="./img/like.png"><span id="icon_${doc.id}">${doc.data().likes}</span></button>
<button id="btnDeletePost" data-id="${doc.id}"><img id="btnDelete" src="./img/delete.png"></button></td>
<button id="btnEditar" data-id="${doc.id}" data-comment="${doc.data().comment}">editar</button></td>
</div>
`;

const btnlike = span.querySelector('#btnsum');
btnlike.addEventListener('click', () => {
sumLike(doc.id, doc.data().likes);
});
const btnDelete = span.querySelector('#btnDeletePost');
btnDelete.addEventListener('click', () => {
const confirmar = confirm('¿Desea eliminar el Post?');
if (confirmar === true) {
deleteData(doc.id);
}
});

const btnEdit = span.querySelector('#btnEditar');
btnEdit.addEventListener('click', (event) => {
const confirmarEdi = confirm('¿Desea editar el Post?');
if (confirmarEdi === true) {
editComment(event);
}
});
publicar.appendChild(span);
});
});
};
export const sumLike = (idComment, likes) => {
firebase.firestore().collection('comentarios').doc(idComment).update({
likes: likes + 1,
});
document.getElementById(`icon_${idComment}`).innerHTML = likes + 1;
};

// borrar datos de cloud firestore
export const deleteData = (id) => {
firebase.firestore().collection('comentarios').doc(id).delete()
.then(() => {
console.log('Document successfully deleted!');
})
.catch(() => {
console.error('Error removing document: ', error);
});
};

// Editar Comentario
export const editComment = (event) => {
document.querySelector('#txtcomment').value = event.target.dataset.comment;
const btnEditComment = document.querySelector('#btnEditComment');
btnEditComment.addEventListener('click', () => {
const editFirebase = firebase.firestore().collection('comentarios').doc(event.target.dataset.id);
const postEdit = document.querySelector('#txtcomment').value;
return editFirebase.update({
comment: postEdit,
})
.then(() => {
document.getElementById('txtcomment').value = '';
})
.catch(() => {
});
});
};

export const myFunction = () => {
// aqui tu codigo
console.log('Hola mundo!');
// cerrar Sesion.
export const signOut = () => {
firebase.auth().signOut()
.then(() => {
window.location.hash = '#/';
// console.log ('correoLogin');
// Sign-out successful.
}).catch(() => {
// An error happened.
});
};
39 changes: 39 additions & 0 deletions src/lib/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* eslint-disable quotes */
import { home } from '../view/home.js';
import { singIn } from '../view/singIn.js';
import { profile } from '../view/profile.js';
import { knowUs } from '../view/knowUs.js';


export const showPages = (hash) => {
const containerRoot = document.getElementById('root');
containerRoot.innerHTML = '';

switch (hash) {
case '': containerRoot.appendChild(home());
break;
case '#/': containerRoot.appendChild(home());
break;
case '#/singIn': containerRoot.appendChild(singIn());
break;
case '#/profile': containerRoot.appendChild(profile());
break;
case '#/knowUs': containerRoot.appendChild(knowUs());
break;
default:
containerRoot.innerHTML = `<h2>'No existe'</h2>`;
}
};

export const changeRoute = (hash) => {
if (hash === '#/') {
return showPages(hash);
} if (hash === '#/singIn') {
return showPages(hash);
} if (hash === '#/profile') {
return showPages(hash);
} if (hash === '#/knowUs') {
return showPages(hash);
}
return showPages(hash);
};
13 changes: 13 additions & 0 deletions src/lib/validation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const validationLogin = (email, pass) => {
if (email === '' || pass === '') {
return false;
}
return true;
};

export const validationPassLength = (pass) => {
if (pass.length < 6) {
return false;
}
return true;
};
15 changes: 12 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
// Este es el punto de entrada de tu aplicacion
import { menu } from './view/menu.js';
import { changeRoute } from './lib/router.js';

import { myFunction } from './lib/index.js';
const init = () => {
document.getElementById('root').innerHTML = menu();

myFunction();
window.addEventListener('hashchange', () => {
changeRoute(window.location.hash);
});
firebase.auth().onAuthStateChanged(() => {
changeRoute(window.location.hash);
});
};
window.addEventListener('load', init);
Loading