Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
131 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
d48c88c
Merge pull request #15 from filletournesols/responsive-h1
filletournesols Jan 4, 2023
ff33c66
nuevo pull
ferguzmanv Jan 4, 2023
24d7467
Merge branch 'responsive-h1' of https://github.com/filletournesols/So…
ferguzmanv Jan 4, 2023
ea70fd9
arreglos generales CSS, JS y HTML
filletournesols Jan 4, 2023
58fb3ac
para pull
ferguzmanv Jan 4, 2023
c478845
Merge pull request #16 from filletournesols/responsive-h1
vickymendoza Jan 4, 2023
1ac5871
arreglo datos
filletournesols Jan 4, 2023
e16b856
export PATHS
filletournesols Jan 4, 2023
384c2a3
gh pages
filletournesols Jan 5, 2023
33c925f
router funcionando pero quemado en gh pages
filletournesols Jan 5, 2023
be5f1ef
prueba router prueba
filletournesols Jan 6, 2023
61ebbb6
prueba router prueba
filletournesols Jan 6, 2023
e50775d
nuevo router
filletournesols Jan 6, 2023
654ed06
router actualizado
filletournesols Jan 9, 2023
5f8480e
Merge pull request #18 from filletournesols/ramitaPruebaRouterDomy
filletournesols Jan 9, 2023
c32d818
Se restructuró e implementó el nuevo Router, damos primeros pasos en …
vickymendoza Jan 9, 2023
a7ad9a3
nuevo main
ferguzmanv Jan 9, 2023
278b39b
Se crean nuevos componentes y se dejan funcionando los botones del co…
vickymendoza Jan 9, 2023
217c04f
creamos estilos para la vista de gmail login
vickymendoza Jan 10, 2023
aaaa1f0
Merge branch 'ramaparaHTMLHUDOS' of https://github.com/filletournesol…
ferguzmanv Jan 10, 2023
a1b9a40
css-h2
ferguzmanv Jan 10, 2023
19babed
se le dio estilos y responsive a hu2
ferguzmanv Jan 10, 2023
693fbf3
css responsive para recoverpsw.js
filletournesols Jan 11, 2023
4a1cff4
estilos recoverpsw.js
filletournesols Jan 12, 2023
140530e
Merge pull request #19 from filletournesols/ramitaPruebaRouterDomy
filletournesols Jan 12, 2023
db490a1
eliminación de router antiguo
filletournesols Jan 9, 2023
19f02ed
arreglo diseño responsive botones
filletournesols Jan 12, 2023
894ff0c
se inicia a maquetar el inicio de sesión con correo
vickymendoza Jan 12, 2023
f2270fa
signInWithEmailAndPassword Firebase
filletournesols Jan 13, 2023
059401c
Merge pull request #21 from filletournesols/ramitaPruebaRouterDomy
vickymendoza Jan 13, 2023
31ca067
se crea enmaquetado de signIn.js
vickymendoza Jan 13, 2023
d5043b8
se hace merge satisfactorio de los servicios de Firebase hasta el vie…
vickymendoza Jan 13, 2023
88b0f64
se implementa el servicio de restablecer contraseña
vickymendoza Jan 13, 2023
78bbcf5
Merge branch 'main' into ramaparaServiciosFirebaseVic
filletournesols Jan 13, 2023
f1ab2c8
Merge pull request #22 from filletournesols/ramaparaServiciosFirebaseVic
filletournesols Jan 13, 2023
144d418
Merge branch 'main' of https://github.com/filletournesols/Petblr-soci…
vickymendoza Jan 13, 2023
dc81a05
se termina la funcionalidad de recuperar la contraseña
vickymendoza Jan 13, 2023
2728e78
Merge pull request #23 from filletournesols/ramaparaServiciosFirebaseVic
filletournesols Jan 13, 2023
b53996b
hamburger menu para el feed + arreglos css
filletournesols Jan 16, 2023
3ac7636
agregar función de cerrar sesión
filletournesols Jan 16, 2023
b77f369
se inicia los test, se logra funcionalidad en algunos test
vickymendoza Jan 16, 2023
cb8da77
logo blanco feed
filletournesols Jan 16, 2023
1e4b7d8
Merge pull request #24 from filletournesols/remitaHUcuatro
filletournesols Jan 16, 2023
efccab4
función setPersistence
filletournesols Jan 16, 2023
a7094eb
logra funcionalidad en testMock
vickymendoza Jan 17, 2023
decae99
logra funcionalidad en testMock a tres test
vickymendoza Jan 17, 2023
82d7f7f
Merge pull request #25 from filletournesols/remitaHUcuatro
filletournesols Jan 17, 2023
f5baa69
Merge branch 'main' into testMock
vickymendoza Jan 17, 2023
74b37ae
se realizan pequeños ajustes en el archivo setPersistence en la promesa
vickymendoza Jan 17, 2023
21e8da4
Merge pull request #29 from filletournesols/testMock
vickymendoza Jan 17, 2023
a865ff3
arreglo espacios
filletournesols Jan 17, 2023
bee75d7
prueba setDoc
filletournesols Jan 18, 2023
1fffee1
arreglo ortografía
filletournesols Jan 18, 2023
da95bc6
Merge branch 'main' into remitaHUcuatro
filletournesols Jan 18, 2023
4e77eeb
se hacen ajustes basados en el fedback
vickymendoza Jan 18, 2023
bcf369b
btn ir a registro
filletournesols Jan 18, 2023
e7c6120
Merge branch 'main' of https://github.com/filletournesols/Petblr-soci…
filletournesols Jan 18, 2023
2d6aef4
Merge branch 'main' into remitaHUcuatro
filletournesols Jan 18, 2023
72077c3
logo cambiado
ferguzmanv Jan 18, 2023
8579f1d
Merge branch 'main' of https://github.com/filletournesols/Social-network
ferguzmanv Jan 18, 2023
788aa05
nuevas funciones
filletournesols Jan 18, 2023
67e63df
Merge pull request #30 from filletournesols/remitaHUcuatro
filletournesols Jan 18, 2023
f08ce44
nuevas funciones
filletournesols Jan 18, 2023
8e92e1c
arreglos archivos
filletournesols Jan 19, 2023
e8b0e41
se crean archivos currentUser y se revive setPersistence
vickymendoza Jan 19, 2023
c8bbcc8
Merge pull request #31 from filletournesols/RamaparaLoguear
vickymendoza Jan 19, 2023
263cb50
Merge branch 'main' into remitaHUcuatro
filletournesols Jan 19, 2023
cdaf69e
Merge pull request #32 from filletournesols/remitaHUcuatro
filletournesols Jan 19, 2023
baa8e0d
borrado de comentarios y agregado de archivos a app
filletournesols Jan 19, 2023
13d3b5b
arreglo funcion en firebase.js
filletournesols Jan 19, 2023
259e7d5
comentario
filletournesols Jan 19, 2023
8a3cebf
arreglo para deploy
filletournesols Jan 19, 2023
31527ef
prueba post
filletournesols Jan 19, 2023
39236ef
Primeras interacciones para poder publicar un post
vickymendoza Jan 19, 2023
3685834
Iniciando Readme
vickymendoza Jan 19, 2023
03b54af
Añadiendo imágenes al readme
vickymendoza Jan 20, 2023
ad452b8
getdocs
ferguzmanv Jan 20, 2023
207660a
Merge branch 'store-dos' of https://github.com/filletournesols/Petblr…
vickymendoza Jan 20, 2023
8b9a752
Se crea la funcionalidad de mostrar, los post y se inicia con el botó…
vickymendoza Jan 20, 2023
2c666d4
Se da la función de publicar y mostrar, editar los distintos posts
vickymendoza Jan 20, 2023
da78920
implementar el boton de eliminar
ferguzmanv Jan 20, 2023
82d87cc
Merge branch 'RamaReadme' of https://github.com/filletournesols/Petbl…
vickymendoza Jan 20, 2023
162694e
recuperado el trabajo perdido del viernes 20 de enero 2023, por favor…
vickymendoza Jan 21, 2023
0a2aa99
se pone el ícono del basurero, sin estilos
vickymendoza Jan 23, 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
376 changes: 29 additions & 347 deletions README.md

Large diffs are not rendered by default.

42 changes: 34 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
{
"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",
"start": "serve -s src/"
"precommit": "npm run htmlhint && npm run eslint && npm run stylelint",
"test": "jest --coverage --env=jsdom",
"start": "serve -s src/",
"deploy": "gh-pages -d src"
},
"devDependencies": {
"@babel/core": "^7.11.4",
Expand All @@ -25,10 +29,13 @@
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^25.3.0",
"gh-pages": "^4.0.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 +46,24 @@
"createdAt": "2022-11-30T16:52:37.204Z",
"version": "5.5.0",
"commit": "51e941edf1cc991930aefd7dd9c406a7c43741c1"
},
"dependencies": {
"@firebase/auth": "^0.21.0",
"deploy": "^1.0.3",
"dotenv": "^16.0.3",
"firebase": "^9.15.0"
},
"jest": {
"roots": [
"<rootDir>",
"Petblr-social-network/../"
],
"modulePaths": [
"<rootDir>",
"Petblr-social-network/../"
],
"moduleDirectories": [
"node_modules"
]
}
}
6 changes: 6 additions & 0 deletions src/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiKey= "AIzaSyCVFwSqmwf3nPLqyBd-_SrnWdKfmv8kRVc",
authDomain= "petblr-74086.firebaseapp.com",
projectId= "petblr-74086",
storageBucket= "petblr-74086.appspot.com",
messagingSenderId= "431725901053",
appId= "1:431725901053:web:0804da9ec879761fd6ba94"
Binary file added src/Assets/Altafidelidad.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/Petblr-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/Prototipobajafidelidad.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/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/basurero-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/basurero-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.
1 change: 1 addition & 0 deletions src/_redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* /index.html 200
15 changes: 15 additions & 0 deletions src/app/PswReset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { firebaseAuth, sendPasswordResetEmail } from './firebase.js';


export const pswReset = async (documentt) =>{
//e.preventDefault()
const email = document.getElementById('RecoverPswFormInput').value

try{
await sendPasswordResetEmail(firebaseAuth,email)
return Promise.resolve()
}catch(error) {
console.log({error});
return Promise.reject(error)
};
}
17 changes: 17 additions & 0 deletions src/app/currentUser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { firebaseAuth, onAuthStateChanged } from './firebase.js';

const currentUser = {};
const getCurrentUser = () => {
onAuthStateChanged(firebaseAuth, (user) => {
if (user) {
currentUser.email = user.email;
currentUser.uid = user.uid;
currentUser.displayName = user.displayName;
currentUser.petName = user.petName;
currentUser.username = user.username;
}
})
}
export {getCurrentUser}

//https://firebase.google.com/docs/auth/web/manage-users#get_the_currently_signed-in_user
12 changes: 12 additions & 0 deletions src/app/deletePost.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { deleteDoc, doc, database, firebaseAuth } from './firebase.js';

// NECESITAMOS IMPORTAR EL CURRENT USER

const deletePost = (uid) => {
deleteDoc(doc(database, 'usuarios', firebaseAuth.currentUser.uid, 'userPosts', uid))
};

export { deletePost }

// va con await
// https://firebase.google.com/docs/firestore/manage-data/delete-data
13 changes: 13 additions & 0 deletions src/app/dislikePost.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { updateDoc, doc, database, firebaseAuth, arrayRemove } from './firebase.js';

// NECESITAMOS IMPORTAR EL CURRENT USER

const dislikePost = (uid, likes, userLike) => {
updateDoc(doc(database, 'usuarios', firebaseAuth.currentUser.uid, 'userPosts', uid),
{ amountLikes: likes, arrayUsersLikes: arrayRemove(userLike) })
};

export { dislikePost }

// va con await
// https://firebase.google.com/docs/firestore/manage-data/add-data#update-data
39 changes: 39 additions & 0 deletions src/app/facebookrg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* eslint-disable no-console */
import {
providerFacebookAuth, signInWithPopup, getAuth, FacebookAuthProvider,
} from './firebase.js';

export 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}`);


})
.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}`);
});
}
71 changes: 71 additions & 0 deletions src/app/firebase.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/* eslint-disable import/no-unresolved */
import { initializeApp } from 'https://www.gstatic.com/firebasejs/9.15.0/firebase-app.js';
import {
getAuth, createUserWithEmailAndPassword, FacebookAuthProvider, signInWithPopup,
setPersistence, signInWithRedirect, inMemoryPersistence, GoogleAuthProvider,
signInWithEmailAndPassword, signOut, sendPasswordResetEmail, sendEmailVerification
} from 'https://www.gstatic.com/firebasejs/9.15.0/firebase-auth.js';
import { getFirestore, collection, getDoc, getDocs, setDoc, doc,
onSnapshot, query, where, deleteDoc, updateDoc, arrayRemove, arrayUnion,
addDoc
} from 'https://www.gstatic.com/firebasejs/9.15.0/firebase-firestore.js'
import { getStorage, ref } from 'https://www.gstatic.com/firebasejs/9.15.0/firebase-storage.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();

// NUUUUUUUUUUUEEEEEEEEEEEEEEEVOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO

const storage = getStorage(firebaseApp);
const database = getFirestore();
const storageRef = ref(storage);
const collectionUserName = collection(database, 'usernames');
const collectionUserNamesSpanish = collection(database, 'usuarios');
const collectionPost = collection(database, 'posts');
const getTask = () => getDocs(collection(database, 'posts'));



const getOnDatas = (callback) => {
const orderQuery = query(collection(database,'posts'));
onSnapshot(orderQuery,(callback))};

const getPost = (id) => getDoc(doc(database, 'posts', id));
const updatePosts = (id, newFields) =>
updateDoc(doc(database, 'posts', id), newFields);

const erasePost = (id) => deleteDoc(doc(database, 'posts', id))

// Guardar username desde el registro
// const saveDisplayName = (usernameIngresado) => {
// return updateProfile(firebaseAuth.currentUser, {displayName: usernameIngresado})
// };



export {
firebaseApp, firebaseAuth, createUserWithEmailAndPassword,
sendPasswordResetEmail, sendEmailVerification,
providerFacebookAuth, signInWithPopup, getAuth, FacebookAuthProvider,
setPersistence, signInWithRedirect, inMemoryPersistence, GoogleAuthProvider,
signInWithEmailAndPassword, signOut, getFirestore, collection, getDoc,
getDocs, setDoc, doc, onSnapshot, query, where, deleteDoc,
updateDoc, arrayRemove, arrayUnion, getStorage, ref,
storage, database, storageRef, collectionUserName, collectionUserNamesSpanish,
collectionPost, addDoc, getTask, getOnDatas,getPost, updatePosts, erasePost
};
46 changes: 46 additions & 0 deletions src/app/getDoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { database, addDoc, collection, getDocs } from './firebase.js';

const saveTask = (description) => {
return addDoc(collection(database , 'posts'), {description});

};

// const taskForm = document.getElementById("taskForm") Buscando poder organizar las vistas de los post y poderla mostrar
// const taskContainer = document.getElementById('postsContainer')

// // const getPosts = ( ) => {
// // getDocs(collection(database , 'posts'))
// // }

// document.addEventListener("DOMContentLoaded", async () => {
// const querySnapshot = await getDocs(collection(database, "posts"));
// let html =''

// querySnapshot.forEach((doc) => {
// //const posts =posts.database()
// html += `¨
// <di>
// <h3>${posts.database}</h3>
// </di>`
// // doc.data() is never undefined for query doc snapshots
// console.log(doc.id, " => ", doc.data());
// console.log(postsContainer)
// })
// // vamos a mostrar el contenido de los posts en html

// taskContainer.innerHTML= ''

// })




// // console.log(description)

// // saveTask(description.value)
// // taskForm.reset()
// // })
// // })

export { saveTask }

13 changes: 13 additions & 0 deletions src/app/likePosts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { updateDoc, doc, database, firebaseAuth, arrayUnion } from './firebase.js';

// NECESITAMOS IMPORTAR EL CURRENT USER

const likePost = (uid, likes, userLike) => {
updateDoc(doc(database, 'usuarios', firebaseAuth.currentUser.uid, 'userPosts', uid),
{ amountLikes: likes, arrayUsersLikes: arrayUnion(userLike) })
};

export { likePost }

// va con await
// https://firebase.google.com/docs/firestore/manage-data/add-data#update-data
25 changes: 25 additions & 0 deletions src/app/register.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* eslint-disable no-unused-expressions */
/* eslint-disable import/no-unresolved */
import { firebaseAuth, createUserWithEmailAndPassword, sendEmailVerification } from './firebase.js';


export const registrar = async (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);
return Promise.resolve()
} else if (psw !== repeatPsw) {
return Promise.reject("wrong password")
} else {
return Promise.reject("generic_failure")
}
} catch (error) {
return Promise.reject(error)
}
};
10 changes: 10 additions & 0 deletions src/app/setDoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { doc, setDoc, collection } from './firebase.js'

// const postCollectionRef = collection(db, 'posts')
const createPost = async ()=>{
await setDoc(doc(db, 'posts', ), {
name: "Los Angeles",
state: "CA",
country: "USA"
});
}
14 changes: 14 additions & 0 deletions src/app/setPersistence.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { firebaseAuth, setPersistence, signInWithRedirect, inMemoryPersistence, GoogleAuthProvider } from './firebase.js';
//Este será el archivo para el comportamiento de persistencia. lo que hace es que nos permite
//“saber que pasa cierra sesión o qué pasa sí sólo cierra la pestaña”
export const setPersistenceFun = async (e)=>{
e.preventDefault();
try {
await setPersistence(firebaseAuth, inMemoryPersistence)
const provider = new GoogleAuthProvider();
const signInWithRedirectFun = await signInWithRedirect(firebaseAuth, provider);
return signInWithRedirectFun
} catch (error) {
return Promise.reject(error)
}
}
13 changes: 13 additions & 0 deletions src/app/signIn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { firebaseAuth, signInWithEmailAndPassword } from './firebase.js';

export const signInAccount = async (email,password) => {
try {
const userCredential = await signInWithEmailAndPassword(firebaseAuth, email, password)
const user = userCredential.user;
console.log({user})
return Promise.resolve(userCredential)
} catch (error) {
return Promise.reject(error)
}
}
export {signInWithEmailAndPassword,firebaseAuth}
Loading