Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
b2d126e
new css file
filletournesols Dec 14, 2022
825176a
html con secciones y css con base
filletournesols Dec 14, 2022
3046f03
new styles
filletournesols Dec 15, 2022
3c8fc9d
iconitos
filletournesols Dec 15, 2022
5ea2caf
ramitaFirebase con estilos y html para poder implementar firebase
filletournesols Dec 18, 2022
b4efe13
html y css arreglados para HU1
filletournesols Dec 19, 2022
27fa529
cambio de gmail a google y cambio en % de margin top a rem
filletournesols Dec 19, 2022
68f6fc4
Merge pull request #4 from filletournesols/ramitaFirebase
vickymendoza Dec 19, 2022
eb41535
firebase auth psw/email
filletournesols Dec 21, 2022
0f06631
Merge pull request #5 from filletournesols/ramitaFirebase
vickymendoza Dec 21, 2022
da0f37c
agregado crear cuenta con: con estilos
filletournesols Dec 21, 2022
242e6e8
Merge pull request #6 from filletournesols/ramitaFirebase
vickymendoza Dec 21, 2022
c0da522
cambio js
filletournesols Dec 22, 2022
59a9042
Estilos de letras en el input
vickymendoza Dec 22, 2022
fdd613c
Merge pull request #7 from filletournesols/ramitaFirebase
filletournesols Dec 22, 2022
910a2e8
Merge branch 'main' into ramaVic
ferguzmanv Dec 22, 2022
8ce1c56
Merge pull request #8 from filletournesols/ramaVic
ferguzmanv Dec 22, 2022
6889b36
arreglo html separaciones
filletournesols Dec 22, 2022
6b479c1
no me funciono
vickymendoza Dec 22, 2022
01d25a4
Merge branch 'main' of https://github.com/filletournesols/Social-netw…
vickymendoza Dec 22, 2022
ba0bcb0
para prueba
filletournesols Dec 22, 2022
d329c4d
validación de contraseñas + agregados css
filletournesols Dec 23, 2022
cd9e5f8
validación de contraseñas + agregados css
filletournesols Dec 23, 2022
f91d03b
Merge pull request #9 from filletournesols/ramitaFirebase
vickymendoza Dec 23, 2022
35719fd
aun no toma cambios
vickymendoza Dec 23, 2022
b36d3ac
Merge branch 'main' of https://github.com/filletournesols/Social-netw…
vickymendoza Dec 23, 2022
a6fa8db
validación de correo
filletournesols Dec 23, 2022
5af81b6
Merge pull request #10 from filletournesols/ramitaFirebase
filletournesols Dec 23, 2022
b6ecdff
subiendo Facebook
vickymendoza Dec 27, 2022
8a881cc
Merge branch 'main' into ramaVic
filletournesols Dec 27, 2022
81b5d52
Merge pull request #11 from filletournesols/ramaVic
filletournesols Dec 27, 2022
4b0b850
css-alta-uno
ferguzmanv Dec 28, 2022
496169b
responsive-uno
ferguzmanv Dec 28, 2022
c947db2
responsive-dos
ferguzmanv Dec 28, 2022
53bf6a9
Merge branch 'main' of https://github.com/filletournesols/Social-netw…
ferguzmanv Dec 28, 2022
650e418
Merge pull request #12 from filletournesols/css-login
filletournesols Dec 28, 2022
3f60928
router funcionando en el formato de registro
vickymendoza Dec 30, 2022
9b50506
se le hace el cambio de /register por /signup y no pinta, a diferenci…
vickymendoza Dec 30, 2022
ce62276
Merge branch 'main' into ramaParaRouter
filletournesols Dec 30, 2022
0c824fb
Merge pull request #13 from filletournesols/ramaParaRouter
filletournesols Dec 30, 2022
e82472f
arreglo estilos y router con su respectivo template
filletournesols Dec 30, 2022
445fb0f
le dimos funcionalidad (router) al botón iniciar sesión
vickymendoza Dec 30, 2022
23c972e
test DOM router home a signup
filletournesols Dec 31, 2022
c3bea08
agregado html a test index
filletournesols Jan 3, 2023
af087a7
Merge pull request #14 from filletournesols/ramitaTest
ferguzmanv Jan 3, 2023
cd669da
responsive h1
ferguzmanv Jan 3, 2023
e1691b1
Merge branch 'main' into responsive-h1
filletournesols Jan 3, 2023
ff33c66
nuevo pull
ferguzmanv Jan 4, 2023
24d7467
Merge branch 'responsive-h1' of https://github.com/filletournesols/So…
ferguzmanv Jan 4, 2023
58fb3ac
para pull
ferguzmanv Jan 4, 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
25 changes: 17 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
{
"name": "social-network",
"name": "petblr",
"version": "1.0.0",
"description": "Social Network @ Laboratoria",
"description": "Tumblr para mascotas",
"main": "src/index.html",
"keywords": [
"javascript",
"firebase",
"jest"
"jest",
"Petblr",
"petblr"
],
"license": "MIT",
"scripts": {
"htmlhint": "htmlhint dist/*.html ",
"eslint": "eslint --ext .js src/ test/",
"eslintFix": "eslint --ext .js src/ test/ --fix",
"stylelint": "stylelint --aei src/**/*.css",
"pretest": "npm run htmlhint && npm run eslint && npm run stylelint",
"test": "jest --coverage",
"precommit": "npm run htmlhint && npm run eslint && npm run stylelint",
"test": "jest --coverage --env=jsdom",
"start": "serve -s src/"
},
"devDependencies": {
Expand All @@ -26,9 +29,11 @@
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^25.3.0",
"htmlhint": "^1.0.0",
"jest": "^27.0.1",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"jsdom": "^20.0.3",
"regenerator-runtime": "^0.13.1",
"serve": "^13.0.2",
"serve": "^14.1.2",
"stylelint": "^14.1.0",
"stylelint-config-recommended": "^6.0.0"
},
Expand All @@ -39,5 +44,9 @@
"createdAt": "2022-11-30T16:52:37.204Z",
"version": "5.5.0",
"commit": "51e941edf1cc991930aefd7dd9c406a7c43741c1"
},
"dependencies": {
"@firebase/auth": "^0.21.0",
"firebase": "^9.15.0"
}
}
}
Binary file added src/Assets/add-image-blanco.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/Assets/add-image-negro.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/Assets/chat-blanco.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/Assets/chat-negro.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/Assets/logo.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/Assets/mas-blanco.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/Assets/mas-negro.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/Assets/pata-blanca.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/Assets/pata-negra.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions src/addEventListener.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// const homeSignInBtn = document.getElementById("navLinkCreateAccount");
// const facebookBtn = document.getElementById("facebookBtn");

// homeSignInBtn.addEventListener("click", () => {
// document.getElementById("home").hidden = true;
// document.getElementById("emailFacebookPage").classList.remove("hidden");
// });

// emailBtn.addEventListener("click", () => {
// document.getElementById("emailFacebookPage").hidden = true;
// document.getElementById("register").classList.remove("hidden");
// })
54 changes: 54 additions & 0 deletions src/app/facebookrg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/* eslint-disable no-console */
import {
providerFacebookAuth, signInWithPopup, getAuth, FacebookAuthProvider,
} from './firebase.js';

const facebookBtn = document.getElementById('facebookBtn');

function AuthAccountFacebook() {
const auth = getAuth();
signInWithPopup(auth, providerFacebookAuth)
.then((result) => {
// The signed-in user info.
const user = result.user;
console.log(`user${user}`);

// This gives you a Facebook Access Token. You can use it to access the Facebook API.
const credential = FacebookAuthProvider.credentialFromResult(result);
console.log(`credential${credential}`);

const accessToken = credential.accessToken;
console.log(`accessToken${accessToken}`);

// PLANTEAMINETO ORIGINAL, CAMBIAR CUANDO TENGA LA FUNCIONALIDAD QUE NECESITAN
document.getElementById('emailFacebookPage').hidden = true;
document.getElementById('register').classList.remove('hidden');
document.getElementById('registerFormRepeatPsw').classList.add('hidden');
document.getElementById('registerFormRepeatPasswordInput').classList.remove('wrongAlert');
document.getElementById('authFunciona').classList.remove('hidden');
})
.catch((error) => {
// Handle Errors here.
const errorCode = error.code;
console.log(`errorCode${errorCode}`);

const errorMessage = error.message;
console.log(`errorMessage${errorMessage}`);

// The email of the user's account used.
const email = error.customData.email;
console.log(`email${email}`);

// The AuthCredential type that was used.
const credential = FacebookAuthProvider.credentialFromError(error);
console.log(`credential${credential}`);

// PLANTEAMINETO ORIGINAL, CAMBIAR CUANDO TENGA LA FUNCIONALIDAD QUE NECESITAN
document.getElementById('emailFacebookPage').hidden = true;
document.getElementById('register').classList.remove('hidden');
document.getElementById('authError').classList.remove('hidden');
console.log(error);
});
}

export const registerFormFace = facebookBtn.addEventListener('click', AuthAccountFacebook);
33 changes: 33 additions & 0 deletions src/app/firebase.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* eslint-disable import/no-unresolved */
// como utilizamos CDN, en lugar de utilizar "from "firebase/auth"" se utiliza el link
// https://firebase.google.com/docs/web/learn-more#available-libraries
// link que lleva al link anterior
// https://firebase.google.com/docs/web/setup#available-libraries

import { initializeApp } from 'https://www.gstatic.com/firebasejs/9.15.0/firebase-app.js';
import {
getAuth, createUserWithEmailAndPassword, FacebookAuthProvider, signInWithPopup,
} from 'https://www.gstatic.com/firebasejs/9.15.0/firebase-auth.js';

// configuración de la app de firebase
const firebaseConfig = {
apiKey: 'AIzaSyCVFwSqmwf3nPLqyBd-_SrnWdKfmv8kRVc',
authDomain: 'petblr-74086.firebaseapp.com',
projectId: 'petblr-74086',
storageBucket: 'petblr-74086.appspot.com',
messagingSenderId: '431725901053',
appId: '1:431725901053:web:0804da9ec879761fd6ba94',
};

// inicialización de firebase
const firebaseApp = initializeApp(firebaseConfig);

// uso de firebase auth
const firebaseAuth = getAuth(firebaseApp);

const providerFacebookAuth = new FacebookAuthProvider();

export {
firebaseApp, firebaseAuth, createUserWithEmailAndPassword,
providerFacebookAuth, signInWithPopup, getAuth, FacebookAuthProvider,
};
27 changes: 27 additions & 0 deletions src/app/register.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* eslint-disable no-unused-expressions */
/* eslint-disable import/no-unresolved */
import { createUserWithEmailAndPassword, sendEmailVerification } from 'https://www.gstatic.com/firebasejs/9.15.0/firebase-auth.js';
import { firebaseAuth } from './firebase.js';

export const registrar = async (e) => {
e.preventDefault();
const registerForm = document.getElementById('registerForm');
const email = registerForm.registerFormPetEmailInput.value;
const psw = registerForm.registerFormPasswordInput.value;
const repeatPsw = registerForm.registerFormRepeatPasswordInput.value;
try {
if (psw.length > 6 && psw === repeatPsw) {
/[A-Z]/.test(psw) && /[a-z]/.test(psw) && /[0-9]/.test(psw);
await createUserWithEmailAndPassword(firebaseAuth, email, psw);
await sendEmailVerification(firebaseAuth.currentUser);
document.getElementById('registerFormRepeatPsw').classList.add('hidden');
document.getElementById('registerFormRepeatPasswordInput').classList.remove('wrongAlert');
document.getElementById('authFunciona').classList.remove('hidden');
} else if (psw !== repeatPsw) {
document.getElementById('registerFormRepeatPsw').classList.remove('hidden');
document.getElementById('registerFormRepeatPasswordInput').classList.add('wrongAlert');
}
} catch (error) {
document.getElementById('authError').classList.remove('hidden');
}
};
109 changes: 100 additions & 9 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,103 @@

<!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>
<body>
<script type="module" src="main.js"></script>
</body>
<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>PETBLR</title>
<link rel="stylesheet" href="style.css"/>
<script type="module" src="main.js"></script>
<script src="./js/router.js"></script>
<script src="./js/routes.js"></script>
<script type="module" src="./lib/index.js"></script>
</head>
<body>
<main>

<!--main logo-->
<section class="main-logo" id="mainLogo">
<div class="main-logo-div">
<img src="./Assets/logo.png" alt="logo" class="main-logo-img" id="mainLogoImg" >
</div>
</section>

<!--email/Facebook LogIn-->
<section class="email-facebook-page hidden" id="emailFacebookPage">
<div class="email-facebook-div" id="emailFacebookDiv">
<button class="email-btn" id="emailBtn">CORREO </button>
<button class="facebook-btn" id="facebookBtn">FACEBOoOK</button>
</div>
</section>

<!--log in form-->
<section class="login-section hidden" id="loginSection">
<form class="login-form" id="loginForm">
<label for="email" class="login-form-email" > Correo:</label>
<input type="email" class="login-form-email-input" placeholder="Correo" required>
<label for="password" class="login-form-password">Contraseña:</label>
<input type="password" class="login-form-password-input" placeholder="********" required>
<button>INGRESAR</button>
</form>
</section>

<!--Register section-->
<!-- <section class="register hidden" id="register">
<form class="register-form" id="registerForm">
<div class="register-form-background">
<input type="name" class="register-form-pet-name-input" id="registerFormPetNameInput" placeholder="Nombre de la mascota" required>
<input type="email" class="register-form-pet-email-input" id="registerFormPetEmailInput" placeholder="Correo electronico" required>
<input type="name" class="register-form-user-name-input" id="registerFormUserNameInput" placeholder="Nombre del usuario" required>
<input type="password" class="register-form-password-input" id="registerFormPasswordInput" placeholder="Contraseña" required>
<label class="register-form-psw-recomendation" id="registerFormPswRecomendation"> DEBE TENER MÍNIMO 6 CARÁTERES, UNA MAYÚSCULA Y UN NÚMERO</label>
<input type="password" class="register-form-repeat-password-input" id="registerFormRepeatPasswordInput" placeholder="Repetir contraseña" required>
<label class="register-form-repeat-psw hidden" id="registerFormRepeatPsw">
LAS CONTRASEÑAS DEBEN COINCIDIR
</label><br>
<button class="register-div-btn" id="registerDivBtn">REGISTRARSE</button>
</div>
</form>
</section> -->

<!--auth error-->
<!-- <section class="auth-error hidden" id="authError">
<div class="auth-error-div">
<h1 class="auth-error-text">Lo sentimos, correo en uso.</h1>
</div>
</section> -->

<!--auth funciona-->
<section class="auth-funciona hidden" id="authFunciona">
<div class="auth-error-div">
<h1 class="auth-funciona-text">Funciona!</h1>
</div>
</section>

<!--Log In/Sign Up-->
<section class="log-in-sign-up hidden" id="logInSignUp">
<div class="log-in-sign-up-div" id="logInSignUpDiv">
<button class="nav-link-log-in" id="navLinkLogIn">INGRESAR</button>
<button class="nav-link-sign-up" id="navLinkSignUp">REGISTRARSE</button>
</div>
</section>

<!--Otra pag-->
<section>
</section>

<!--Otra pag-->
<section>
</section>

<!--Otra pag-->
<section>
</section>

<!--Otra pag-->
<section>
</section>

<div id="content"></div>
</main>
</body>
</html>
42 changes: 42 additions & 0 deletions src/js/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* eslint-disable no-unused-vars */
class Router {
/**
* Metodo inicial.
*
* @return {void}.
*/
constructor(paths) {
// console.log(`entro a constructor con ${paths}`);
this.paths = paths;
// console.log(`ahora va con ${this.paths}`);
this.initRouter();
}

/**
* Permite inicializar el router
*
* @return {void}.
*/
initRouter() {
const {
location: {
pathname = '/',
},
} = window;
const URI = pathname === '/' ? 'home' : pathname.replace('/', '');
this.load(URI);
}

/**
* Permite iniciar la carga de paginas.
*
* @return {void}.
*/
load(page = 'home') {
const { paths } = this;
const { path, template } = paths[page] || paths.error;
const $CONTAINER = document.querySelector('#content');
$CONTAINER.innerHTML = template;
window.history.pushState({}, 'Genial', path);
}
}
Loading