This repository was archived by the owner on Jul 11, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
Lifestyle app with advances in javascript. #22
Open
EdithOrt
wants to merge
18
commits into
Laboratoria:master
Choose a base branch
from
Lourdesdiaz11:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
c562fd8
initialized project with firebase
EdithOrt ce29744
Html skeleton and graphic resources
EdithOrt a387b1e
Merge pull request #3 from Lourdesdiaz11/Edith
EdithOrt 729dead
Screen to upload images to the store with functionality
EdithOrt 1f39443
Merge pull request #6 from Lourdesdiaz11/Edith
EdithOrt a983b0d
Download database changes and local storage for new publications and …
EdithOrt 7f2a413
Merge pull request #7 from Lourdesdiaz11/Edith
EdithOrt 7090d98
The user who logs in can already see his profile and other users' posts.
EdithOrt b6166ce
Merge pull request #8 from Lourdesdiaz11/Edith
EdithOrt 6230545
You can edit and delete publications in the welcome window
EdithOrt 4b11c22
Profile window shows modal window that allows editing and deleting
EdithOrt e539027
Merge pull request #9 from Lourdesdiaz11/Edith
EdithOrt 6fea3db
Modal window works correctly in profile
EdithOrt ffc5328
Merge pull request #10 from Lourdesdiaz11/Edith
EdithOrt 2d25540
It has some functions for test and with test attempt with jest
EdithOrt 5038221
Visual adjustments
EdithOrt 2be28bb
fix error in readme images
EdithOrt d53704f
Create ne account
EdithOrt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| const firestoreMock = () => { | ||
| return { | ||
| collection: (nameCollection) =>{ | ||
| return { | ||
| add: (objData) => { | ||
| return new Promise((resolve) => { | ||
| resolve('Hola!') | ||
| }) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| const firebase = { | ||
| firestore: firestoreMock | ||
| } | ||
|
|
||
| export default jest.fn(() => { | ||
| return firebase; | ||
| }) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,37 @@ | ||
| import { example } from './example.js'; | ||
| import singIn from './login.js'; | ||
| import profile from './profile.js'; | ||
| import welcomeView from './welcome.js'; | ||
| import showOupladWindow from './uopladContent.js'; | ||
| let btns= document.querySelectorAll('.btnNav'); | ||
|
|
||
| example(); | ||
| function router(root) { | ||
| singIn(); | ||
| switch(root){ | ||
| case 'profile': | ||
| profile(); | ||
| break; | ||
| case 'welcome': | ||
| welcomeView(); | ||
| break; | ||
| case 'oupladContent': | ||
| showOupladWindow(); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| // btns.forEach(btn => btn.onclick= e => router(e.target.id)) | ||
| // Your web app's Firebase configuration | ||
| const firebaseConfig = { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bien el cambio de var a const |
||
| apiKey: 'AIzaSyBuxP-xlUpYjWc5KNNt6q0hKbsxc8L4cE4', | ||
| authDomain: 'cdmx009-f4cac.firebaseapp.com', | ||
| databaseURL: 'https://cdmx009-f4cac.firebaseio.com', | ||
| projectId: 'cdmx009-f4cac', | ||
| storageBucket: 'cdmx009-f4cac.appspot.com', | ||
| messagingSenderId: '206411662308', | ||
| appId: '1:206411662308:web:8c3266d5640e307ca57df1', | ||
| measurementId: 'G-L6NB5984DB', | ||
| }; | ||
| // Initialize Firebase | ||
| firebase.initializeApp(firebaseConfig); | ||
| firebase.firestore(); | ||
| window.addEventListener('load', router); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| import showOupladWindow from './uopladContent.js' | ||
| import welcomeView from './welcome.js' | ||
| import profile from './profile.js' | ||
| import { showRegisterWindow } from './register.js' | ||
| let content= document.querySelector(".root"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreguemos poquita más semantica a los nodos |
||
| let staticMenu= document.querySelector("#staticMenu"); | ||
| let btnOut= document.querySelector("#out"); | ||
|
|
||
| function singIn (){ | ||
| btnOut.style.display="none"; | ||
| staticMenu.style.display= "none"; | ||
| content.innerHTML=''; | ||
| let profileView= ` | ||
| <section class="container"> | ||
| <div> | ||
| <img id="logotype" src="images/logo.png"> | ||
| </div> | ||
| <input class="inputUser" id="mail" placeholder="Ingresa tu correo electrónico"> | ||
| <br> | ||
| <input class="inputUser" id="password" placeholder="Ingresa tu contraseña"> | ||
| <br> | ||
| <button id="loginBtn" class="buttons">INGRESAR</button> | ||
| <br> | ||
| <p>O inicia sesión con:</p> | ||
| <div id="containerBtns"> | ||
| <button id="loginFacebook" class="btnFbGmail"> | ||
| <img class="authSocial" src="images/facebook.png"> | ||
| </button> | ||
| <button id="loginGmail" class="btnFbGmail"> | ||
| <img class="authSocial" src="images/gmail.png"> | ||
| </button> | ||
| </div> | ||
| <button id="btnRegister">Registrate si eres nuevo</button> | ||
| </section>` | ||
| content.innerHTML= profileView; | ||
| // staticMenu.remove(); | ||
| document.querySelector("#btnRegister").addEventListener('click', showRegisterWindow); | ||
| document.querySelector("#profile").addEventListener('click', profile); | ||
| let btnFacebook= document.querySelector("#loginFacebook"); | ||
| btnFacebook.onclick= authFacebook; | ||
| function authFacebook () { | ||
| let provider= new firebase.auth.FacebookAuthProvider(); | ||
| firebase.auth().signInWithPopup(provider).then(function(result){ | ||
| alert("Éxito"); | ||
| welcomeView(); | ||
| console.log(result); | ||
| }) | ||
| .catch(function(error){ | ||
| alert("Error"); | ||
| console.log(error); | ||
| }) | ||
| } | ||
| let btnGmail= document.querySelector("#loginGmail"); | ||
| btnGmail.onclick= authGmail; | ||
| function authGmail () { | ||
| let provider = new firebase.auth.GoogleAuthProvider(); | ||
| firebase.auth().signInWithPopup(provider).then(function(result) { | ||
| let token = result.credential.accessToken; | ||
| console.log(token); | ||
| let user = result.user; | ||
| console.log(user); | ||
| welcomeView(); | ||
| }).catch(function(error) { | ||
| let errorCode = error.code; | ||
| console.log(errorCode); | ||
| let errorMessage = error.message; | ||
| console.log(errorMessage); | ||
| let email = error.email; | ||
| console.log(email); | ||
| let credential = error.credential; | ||
| console.log(credential); | ||
| }); | ||
| } | ||
| let user = firebase.auth().currentUser; | ||
| if (user != null){ | ||
| console.log(user);} | ||
| } | ||
|
|
||
| export default singIn; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import {modal} from './welcome.js' | ||
| let content= document.querySelector(".root"); | ||
|
|
||
|
|
||
| function profile () { | ||
| content.innerHTML=''; | ||
| let user = firebase.auth().currentUser; | ||
| let dataBase= firebase.firestore(); | ||
| if (user != null) { | ||
| let infoUser= ` | ||
| <div>${user.displayName}</div> | ||
| <div id="flexImg"> | ||
| <img id="imgUserProfile" src=${user.photoURL}> | ||
| </div>` | ||
| content.innerHTML=infoUser; | ||
| dataBase.collection("posts").where("id", "==", user.uid).orderBy("date","desc") | ||
| .onSnapshot(function(snapshot){ | ||
| let changes= snapshot.docChanges(); | ||
| console.log(changes); | ||
| changes.forEach(change =>{ | ||
| let section= document.createElement("section"); | ||
| section.classList.add("containerProfile"); | ||
| let button= document.createElement("button"); | ||
| button.classList.add("btnsPosts"); | ||
| let link= change.doc.data().img; | ||
| let img= document.createElement("img"); | ||
| img.src= link; | ||
| img.id = change.doc.id; | ||
| img.setAttribute('data-title',change.doc.data().title); | ||
| img.setAttribute('data-description', change.doc.data().description); | ||
| img.setAttribute('data-user', change.doc.data().user); | ||
| button.appendChild(img); | ||
| section.appendChild(button); | ||
| content.appendChild(section); | ||
| content.removeChild(section); | ||
| }); | ||
| let modalRoot= document.querySelector("#modalRoot"); | ||
| let btnsPosts= document.querySelectorAll(".btnsPosts"); | ||
| btnsPosts.forEach(btn=> btn.onclick = e => { | ||
| modalRoot.style.display= "block"; | ||
| let value= e.target.id; | ||
| // console.log(value); | ||
| let link = e.target.getAttribute('src'); | ||
| let title= e.target.getAttribute('data-title'); | ||
| let description= e.target.getAttribute('data-description'); | ||
| let user= e.target.getAttribute('data-user'); | ||
| modal(value, link, title, description, user); | ||
| }); | ||
| }) | ||
| // .catch(function(error) { | ||
| // console.log("Error getting documents: ", error); | ||
| // }); | ||
|
|
||
| } | ||
| } | ||
|
|
||
| export default profile; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| const content = document.querySelector(".root"); | ||
| const footer= document.querySelector("footer"); | ||
|
|
||
|
|
||
| export function showRegisterWindow (){ | ||
| content.innerHTML=''; | ||
| const render= ` | ||
| <section> | ||
| <div> Registrate </div> | ||
| <form class= "form"> | ||
| <input class= "input" id= "signUpUser" type ="text" placeholder = "Nombre de usuario" required><br> | ||
| <input class= "input" id= "signUpEmail" type= "email" placeholder = "Correo electrónico" required> <br> | ||
| <input class= "input" id= "signUpPassword" type= "password" placeholder = "Nueva contraseña" required> <br> | ||
| <input class= "btn" id= "signup" type= "submit" placeholder="ENVIAR"> | ||
| </form> | ||
| <button id="btnReturn">Regresar</button> | ||
| </section> | ||
| `; | ||
| content.innerHTML= render; | ||
| const renderFooter= ` | ||
| <div> | ||
| <img src="images/logoLifestyle.png"> | ||
| </div>` | ||
| footer.innerHTML= renderFooter; | ||
| const data= document.querySelector(".form"); | ||
| getData(data); | ||
| } | ||
|
|
||
| function getData (form){ | ||
| form.addEventListener('submit', (e) => { | ||
| e.preventDefault(); | ||
| const userName= form['signUpUser'].value; | ||
| const email= form['signUpEmail'].value; | ||
| const password= form['signUpPassword'].value; | ||
| console.log(userName, email, password); | ||
| createNewUser(email, password, userName); | ||
| }) | ||
| } | ||
|
|
||
| function createNewUser(email, password, userName){ | ||
| const dataBase= firebase.firestore(); | ||
| firebase.auth().createUserWithEmailAndPassword(email, password).then ((function(result){ | ||
| console.log(result); | ||
| let user = firebase.auth().currentUser; | ||
| console.log(user); | ||
| dataBase.collection("users").add({ | ||
| user: userName, | ||
| id: user.uid, | ||
| email: email, | ||
| }) | ||
| .then(function(docRef) { | ||
| console.log("Document written with ID: ", docRef.id); | ||
| }) | ||
| .catch(function(error) { | ||
| console.error("Error adding document: ", error); | ||
| }); | ||
| })) | ||
| .catch(function(error) { | ||
| // Handle Errors here. | ||
| var errorCode = error.code; | ||
| var errorMessage = error.message; | ||
| console.log(errorCode); | ||
| console.log(errorMessage); | ||
| // ... | ||
| }); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Con este script no necesitamos el de analitycs ya lo incluye