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

Login #16

Open
wants to merge 104 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
6c396a4
primer intento código
Jun 2, 2023
73843c9
empieza vista home2
carolinaposadl Jun 6, 2023
8950973
empieza la vista home y visualiza botones e imagen
carolinaposadl Jun 7, 2023
92e6673
Merge pull request #1 from raquelBurgosAcho/home
AnaVargasP Jun 7, 2023
a8b898d
es el primer intento
AnaVargasP Jun 7, 2023
9f987bd
agrega css a la vista home
carolinaposadl Jun 7, 2023
583156b
login
AnaVargasP Jun 8, 2023
ee973cf
login
AnaVargasP Jun 8, 2023
9cf2b50
avanza la funcionalidad del boton register
AnaVargasP Jun 8, 2023
56d4367
Merge pull request #2 from raquelBurgosAcho/home1
carolinaposadl Jun 8, 2023
ff3ed43
avance css
carolinaposadl Jun 8, 2023
e34ae47
avanza funcionalidad de register y timeline y firebase
carolinaposadl Jun 9, 2023
8452506
Merge pull request #3 from raquelBurgosAcho/home
raquelBurgosAcho Jun 9, 2023
23a5cbe
Delete Home.js
carolinaposadl Jun 12, 2023
b96fbfe
Delete Login.js
carolinaposadl Jun 12, 2023
0e3439d
visualización corregida y ruta timeline lista
carolinaposadl Jun 12, 2023
6209b0d
Merge pull request #4 from raquelBurgosAcho/home_view
AnaVargasP Jun 12, 2023
3f15070
avanza css de todas las vistas y adelanta funcionalidad
carolinaposadl Jun 12, 2023
310e00e
Merge pull request #5 from raquelBurgosAcho/home_view
raquelBurgosAcho Jun 12, 2023
0cb4021
hace cambios para bajar la ultima version de home
AnaVargasP Jun 12, 2023
e65543b
cambios
raquelBurgosAcho Jun 12, 2023
bb08ecc
Merge branch 'main' of https://github.com/raquelBurgosAcho/DEV007-soc…
raquelBurgosAcho Jun 12, 2023
ad8a796
avanza el agrchivo login
AnaVargasP Jun 13, 2023
68967b6
Merge pull request #6 from raquelBurgosAcho/login
carolinaposadl Jun 13, 2023
97b831a
errores mensajes
raquelBurgosAcho Jun 13, 2023
ffb435d
cambios css
carolinaposadl Jun 13, 2023
fa85a94
Merge branch 'main' of https://github.com/raquelBurgosAcho/DEV007-soc…
carolinaposadl Jun 13, 2023
3a7238b
Merge pull request #7 from raquelBurgosAcho/register
raquelBurgosAcho Jun 13, 2023
2796a00
Merge branch 'main' of https://github.com/raquelBurgosAcho/DEV007-soc…
carolinaposadl Jun 13, 2023
04ec884
avanza validaciones de register e inicio de sesión con google
carolinaposadl Jun 13, 2023
9e587d4
Merge pull request #8 from raquelBurgosAcho/home_view
carolinaposadl Jun 13, 2023
d7ef0d3
avanza las validaciones de google y correo electronico
AnaVargasP Jun 14, 2023
c27f67c
Merge pull request #9 from raquelBurgosAcho/login
AnaVargasP Jun 14, 2023
854ef5e
hace un ensayo
carolinaposadl Jun 15, 2023
2a320d0
corrige las validaciones y sus funciones del index.js
carolinaposadl Jun 15, 2023
6b4aad3
Merge pull request #10 from raquelBurgosAcho/home_view
carolinaposadl Jun 15, 2023
9cc73a3
cambios en register
raquelBurgosAcho Jun 15, 2023
a142ea8
avanza funcionalidad del timeline
carolinaposadl Jun 15, 2023
d986dd2
Merge pull request #11 from raquelBurgosAcho/home_view
carolinaposadl Jun 15, 2023
60c9ae9
prepara para bajar cambios de timeline
AnaVargasP Jun 15, 2023
abd5024
Merge branch 'main' of https://github.com/raquelBurgosAcho/DEV007-soc…
AnaVargasP Jun 15, 2023
308e165
funcion del timeline
AnaVargasP Jun 16, 2023
3b71ffc
Merge pull request #12 from raquelBurgosAcho/login
carolinaposadl Jun 16, 2023
8bfcce6
agrega un condicional al boton de publicar
AnaVargasP Jun 16, 2023
ce480aa
Merge pull request #13 from raquelBurgosAcho/login
AnaVargasP Jun 16, 2023
b408601
prueba 1
carolinaposadl Jun 16, 2023
38be770
Merge branch 'main' of https://github.com/raquelBurgosAcho/DEV007-soc…
carolinaposadl Jun 16, 2023
59e47ca
organiza código
carolinaposadl Jun 16, 2023
e815eaa
muestra las publicaciones en timeline
AnaVargasP Jun 17, 2023
09912de
muestra publicaciones en timeline
AnaVargasP Jun 17, 2023
0462d8f
Merge pull request #14 from raquelBurgosAcho/login
AnaVargasP Jun 17, 2023
34082ab
Merge branch 'main' of https://github.com/raquelBurgosAcho/DEV007-soc…
raquelBurgosAcho Jun 18, 2023
b5f6f55
Merge branch 'main' of https://github.com/raquelBurgosAcho/DEV007-soc…
carolinaposadl Jun 20, 2023
122082c
ajustes de los id
carolinaposadl Jun 20, 2023
f592461
avance de funcion like y eliminación de post
raquelBurgosAcho Jun 20, 2023
cfef292
avance de funcion de eliminacion de post y de like
raquelBurgosAcho Jun 20, 2023
ede25dd
unificación del código con avances en la función de like y eliminar p…
carolinaposadl Jun 20, 2023
42fad5d
Merge pull request #15 from raquelBurgosAcho/home_view
carolinaposadl Jun 20, 2023
8025be7
pequeños cambios
carolinaposadl Jun 20, 2023
fb19b73
Merge branch 'main' of https://github.com/raquelBurgosAcho/DEV007-soc…
raquelBurgosAcho Jun 20, 2023
06da370
hace pqueños cambios
carolinaposadl Jun 21, 2023
415bd56
hace ajustes a la función like, funciona
carolinaposadl Jun 22, 2023
a5c1cb7
Merge pull request #16 from raquelBurgosAcho/home_view
carolinaposadl Jun 22, 2023
6274c20
Merge branch 'main' of https://github.com/raquelBurgosAcho/DEV007-soc…
raquelBurgosAcho Jun 23, 2023
c5afe51
cambios de mi rama
raquelBurgosAcho Jun 25, 2023
c228c29
tratando de resolver
raquelBurgosAcho Jun 27, 2023
88431d2
recupera el codigo despues del error del css
AnaVargasP Jun 27, 2023
ea90bb3
arregla problemas de función like, ya corre
carolinaposadl Jun 27, 2023
40f2d33
Merge pull request #17 from raquelBurgosAcho/home_view
carolinaposadl Jun 27, 2023
dc79c78
guardado
raquelBurgosAcho Jun 28, 2023
c7fd924
esto es de la pagina original
raquelBurgosAcho Jun 28, 2023
c8641e6
editar post, like
raquelBurgosAcho Jun 28, 2023
ec8a399
Merge pull request #18 from raquelBurgosAcho/register
carolinaposadl Jun 28, 2023
7cde647
nada
carolinaposadl Jun 28, 2023
79d519d
Merge branch 'main' of https://github.com/raquelBurgosAcho/DEV007-soc…
carolinaposadl Jun 28, 2023
3dee593
unifica el código y hace funcionar el like y el edit
carolinaposadl Jun 28, 2023
da28a1f
Merge pull request #19 from raquelBurgosAcho/home_view
carolinaposadl Jun 28, 2023
d3cb7e1
prepara para unificar cambios en register
AnaVargasP Jun 28, 2023
b5172ab
Merge branch 'main' of https://github.com/raquelBurgosAcho/DEV007-soc…
AnaVargasP Jun 28, 2023
fccdfed
agrega cambios en la funcion de editar y borrar
AnaVargasP Jun 28, 2023
bdbb05e
Merge pull request #20 from raquelBurgosAcho/login
AnaVargasP Jun 28, 2023
951c112
intenta crear un forEach para el evento de dislike y like
carolinaposadl Jun 30, 2023
a2e11b7
falta la imagen ususarii
AnaVargasP Jun 30, 2023
7234c48
cambios en timeline respecto a la funcion dar like
AnaVargasP Jun 30, 2023
6497f97
agrega incremento al contador de dar like
AnaVargasP Jun 30, 2023
86ca208
Merge pull request #21 from raquelBurgosAcho/login
AnaVargasP Jun 30, 2023
1ce79ec
Merge branch 'main' of https://github.com/raquelBurgosAcho/DEV007-soc…
carolinaposadl Jun 30, 2023
54fb299
intenta recorrer el array de likes
carolinaposadl Jun 30, 2023
4bd670c
toDislike
AnaVargasP Jun 30, 2023
b2855a9
cambio de imagen al dar like
AnaVargasP Jun 30, 2023
d6592a0
Fix like button bugs.
ChristianRL23 Jun 30, 2023
8999bb6
Merge pull request #22 from ChristianRL23/login
AnaVargasP Jun 30, 2023
d0bd540
Merge branch 'login' of https://github.com/raquelBurgosAcho/DEV007-so…
carolinaposadl Jun 30, 2023
4b10090
funcion like y dislike listas. Agrega foto usuario
AnaVargasP Jun 30, 2023
dae0280
Merge pull request #23 from raquelBurgosAcho/login
AnaVargasP Jun 30, 2023
75b35f8
Merge branch 'main' of https://github.com/raquelBurgosAcho/DEV007-soc…
carolinaposadl Jun 30, 2023
51f8da7
codigo unificado
carolinaposadl Jun 30, 2023
fc823bc
css
carolinaposadl Jun 30, 2023
e5adfb6
avanza los tests
carolinaposadl Jul 3, 2023
ec02edd
Merge pull request #24 from raquelBurgosAcho/home_view
carolinaposadl Jul 3, 2023
1dbc772
bajar cambios de test1
AnaVargasP Jul 3, 2023
3a1619a
Merge branch 'main' of https://github.com/raquelBurgosAcho/DEV007-soc…
AnaVargasP Jul 3, 2023
a6f321f
guarda cambios en css y baja test
AnaVargasP Jul 4, 2023
22999f1
test like
AnaVargasP Jul 6, 2023
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
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,9 @@
"createdAt": "2023-05-12T17:41:08.657Z",
"version": "6.2.0",
"commit": "a5360f78b634be4f14eaea996ee4c7afc85a2f48"
},
"dependencies": {
"@types/jest": "^29.5.2",
"firebase": "^9.22.2"
}
}
}
33 changes: 33 additions & 0 deletions src/components/home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
export const Home = (onNavigate) => {
const titleFlora = document.createElement('h1');
const logoFlora = document.createElement('p');
const imgFlora = document.createElement('img');
imgFlora.src = './img/Floralogo.png';
// imgFlora.id = 'containerImgHome';
const HomeDiv = document.createElement('div');
const buttonRegister = document.createElement('button');
const buttonLogin = document.createElement('button');

titleFlora.textContent = 'Flora';
logoFlora.textContent = 'Aprende. Cultiva. Publica.';
buttonRegister.textContent = 'Registrarse';
buttonLogin.textContent = 'Iniciar sesión';

HomeDiv.setAttribute('class', 'home-div');
titleFlora.setAttribute('class', 'title-flora');
logoFlora.setAttribute('class', 'logo-flora');
imgFlora.setAttribute('class', 'container-img-home');
buttonRegister.setAttribute('class', 'button');
buttonLogin.setAttribute('class', 'button');

buttonRegister.addEventListener('click', () => onNavigate('/register'));
buttonLogin.addEventListener('click', () => onNavigate('/login'));

HomeDiv.appendChild(titleFlora);
HomeDiv.appendChild(logoFlora);
HomeDiv.appendChild(imgFlora);
HomeDiv.appendChild(buttonRegister);
HomeDiv.appendChild(buttonLogin);

return HomeDiv;
};
98 changes: 98 additions & 0 deletions src/components/login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/* eslint-disable max-len */
import { iniciarSesionConUsuarioYContraseña, iniciarSesionConGoogle } from '../lib';

export const Login = (onNavigate) => {
const loginDiv = document.createElement('div');
loginDiv.setAttribute('class', 'login-register-div');

const titleIS = document.createElement('h2');
titleIS.textContent = ' Iniciar sesión ';
titleIS.setAttribute('class', 'titles');

const inputEmail = document.createElement('input');
inputEmail.placeholder = 'Ingresa tu Email';
inputEmail.setAttribute('class', 'input-data');
inputEmail.setAttribute('id', 'input-email');

const inputPassword = document.createElement('input');
inputPassword.placeholder = 'Ingresa tu contraseña';
inputPassword.type = 'password';
inputPassword.setAttribute('class', 'input-data');
inputPassword.setAttribute('id', 'input-password');

const buttonLogin = document.createElement('button');
buttonLogin.textContent = 'Iniciar sesión';
buttonLogin.setAttribute('class', 'button');

const buttongoogle = document.createElement('button');
buttongoogle.textContent = 'Continuar con Google';
buttongoogle.setAttribute('class', 'button-google');

const buttonHome = document.createElement('button');
buttonHome.textContent = 'Volver a Home';
buttonHome.setAttribute('class', 'button');

const errorLogIn = document.createElement('h4');
errorLogIn.textContent = '';
errorLogIn.setAttribute('class', 'error-message');

const welcomeMessage = document.createElement('h4');
welcomeMessage.setAttribute('class', 'error-message');

// boton para volver a home--------------------------------------------------------------------
buttonHome.addEventListener('click', () => onNavigate('/'));

// boton para iniciar sesion--------------------------------------------------------------------
buttonLogin.addEventListener('click', async (e) => {
e.preventDefault();

const inputCorreo = loginDiv.querySelector('#input-email');
const inputContraseña = loginDiv.querySelector('#input-password');

try {
if (inputCorreo.value === '' || inputContraseña.value === '') {
errorLogIn.textContent = ('Por favor ingresa tu correo y contraseña.');
errorLogIn.style.display = 'block';
} else {
await iniciarSesionConUsuarioYContraseña(inputCorreo.value, inputContraseña.value);
onNavigate('/timeline');
alert(`¡ Hola ${inputCorreo.value} has iniciado sesión con éxito!`);
}
} catch (error) {
if (error.code === 'auth/wrong-password') {
errorLogIn.textContent = ('Contraseña incorrecta. Verifica tu contraseña e intenta nuevamente.');
errorLogIn.style.display = 'block';
} else if (error.code === 'auth/invalid-email') {
errorLogIn.textContent = ('El correo electrónico proporcionado no es válido.');
errorLogIn.style.display = 'block';
} else if (error.code === 'auth/user-not-found') {
errorLogIn.textContent = ('El usuario no fue encontrado. Verifica tu correo y contraseña.');
errorLogIn.style.display = 'block';
} else {
errorLogIn.textContent = ('Ha ocurrido un error en el inicio de sesión. Por favor, intenta nuevamente.');
errorLogIn.style.display = 'block';
}
}
});
// boton para iniciar sesion con GOOGLE---------------------------------------------------------
buttongoogle.addEventListener('click', async (e) => {
e.preventDefault();
try {
await iniciarSesionConGoogle();
onNavigate('/timeline');
} catch (error) {
// Manejar errores
console.error(error);
}
});

loginDiv.appendChild(titleIS);
loginDiv.appendChild(errorLogIn);
loginDiv.appendChild(inputEmail);
loginDiv.appendChild(inputPassword);
loginDiv.appendChild(buttonLogin);
loginDiv.appendChild(buttongoogle);
loginDiv.appendChild(buttonHome);

return loginDiv;
};
111 changes: 111 additions & 0 deletions src/components/register.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import { crearUsuarioConCorreoYContraseña, iniciarSesionConGoogle } from '../lib';

export const Register = (onNavigate) => {
const registerDiv = document.createElement('div');
registerDiv.className = 'login-register-div';

const buttonHome = document.createElement('button');
buttonHome.className = 'button';
buttonHome.textContent = 'Regresar al Home';

const titleR = document.createElement('h2');
titleR.textContent = 'Registrarse';
titleR.className = 'titles';

const errorRegister = document.createElement('h4');
errorRegister.className = 'error-message';
errorRegister.style.display = 'none';
errorRegister.id = 'errorRegister';
// crea formulario de registro
const formRegister = document.createElement('form');
formRegister.id = 'formRegister';
formRegister.className = 'login-register-div';

const nameRegister = document.createElement('input');
nameRegister.type = 'text';
nameRegister.placeholder = 'Nombre de Usuario';
nameRegister.id = 'name';
nameRegister.className = 'input-data';

const emailRegister = document.createElement('input');
emailRegister.type = 'email';
emailRegister.placeholder = 'Email';
emailRegister.id = 'email';
emailRegister.className = 'input-data';

const claveRegister = document.createElement('input');
claveRegister.type = 'password';
claveRegister.placeholder = 'Contraseña';
claveRegister.id = 'password';
claveRegister.className = 'input-data';

const buttonRegister = document.createElement('button');
buttonRegister.type = 'submit';
buttonRegister.textContent = 'Registrar';
buttonRegister.className = 'button';

const buttonGoogle = document.createElement('button');
buttonGoogle.textContent = 'Continuar con Google';
buttonGoogle.className = 'button-google';

// const registerName = HomeDiv.querySelector('#name');

registerDiv.appendChild(titleR);
registerDiv.appendChild(errorRegister);
registerDiv.appendChild(formRegister);
registerDiv.appendChild(buttonHome);
formRegister.appendChild(nameRegister);
formRegister.appendChild(emailRegister);
formRegister.appendChild(claveRegister);
formRegister.appendChild(buttonRegister);
formRegister.appendChild(buttonGoogle);

buttonHome.addEventListener('click', () => {
onNavigate('/');
});

formRegister.addEventListener('submit', (e) => {
e.preventDefault();
crearUsuarioConCorreoYContraseña(emailRegister.value, claveRegister.value, nameRegister.value)
.then(() => {
onNavigate('/timeline');
alert(`¡ Hola ${emailRegister.value} te has registrado con éxito!`);
})
.catch((error) => {
const errorCode = error.code;
if (errorCode === 'auth/weak-password') {
errorRegister.style.display = 'block';
errorRegister.textContent = 'La contraseña debe ser de al menos 6 caracteres.';
} else if (errorCode === 'auth/network-request-failed.') {
errorRegister.style.display = 'block';
errorRegister.textContent = 'Los campos no deben estar vacíos.';
} else if (errorCode === 'auth/invalid-email') {
errorRegister.style.display = 'block';
errorRegister.textContent = 'Correo inválido.';
} else if (errorCode === 'auth/missing-email') {
errorRegister.style.display = 'block';
errorRegister.textContent = 'Ingresa tu correo electrónico.';
} else if (errorCode === 'auth/email-already-in-use') {
errorRegister.style.display = 'block';
errorRegister.textContent = 'Correo en uso.';
} else if (errorCode === 'auth/invalid-argument') {
errorRegister.style.display = 'block';
errorRegister.textContent = 'Ingresa tu contraseña.';
}
return error;
});
});

buttonGoogle.addEventListener('click', async (e) => {
e.preventDefault();
try {
await iniciarSesionConGoogle();
onNavigate('/timeline');
} catch (error) {
// Manejar errores
console.error(error);
}
});

return registerDiv;
};
Loading