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

Revert 11 firestore a #10

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
290459c
SPA
atzinmartinez Sep 28, 2022
be22f0c
Merge pull request #1 from atzinmartinez/rama_a
atzinmartinez Sep 28, 2022
c984366
comentarios no valido
atzinmartinez Sep 29, 2022
d6084a6
Registro y registro con google
atzinmartinez Sep 30, 2022
c0bd4aa
Merge pull request #3 from atzinmartinez/rama_a
atzinmartinez Sep 30, 2022
292c668
funciones userObserver, password hiden, background changes
atzinmartinez Oct 3, 2022
1deac39
Merge pull request #4 from atzinmartinez/rama_a
atzinmartinez Oct 3, 2022
6670ef8
estos cambios se tenian que subir
ElsyCaro Oct 4, 2022
05db6a8
codigo erroneo
atzinmartinez Oct 4, 2022
3b34d37
Merge branch 'main' of https://github.com/ElsyCaro/CDMX013-social-net…
ElsyCaro Oct 4, 2022
c38ddd1
Cambios para tener el main correcto
ElsyCaro Oct 4, 2022
d263b05
HU1 terminada
atzinmartinez Oct 4, 2022
bdb4f20
HU1 terminada
atzinmartinez Oct 4, 2022
cf6f7ff
Merge branch 'main' into rama_a
atzinmartinez Oct 4, 2022
c0df3d9
Merge pull request #5 from atzinmartinez/rama_a
ElsyCaro Oct 4, 2022
b59d375
Log out
atzinmartinez Oct 5, 2022
0ab0da1
Merge pull request #6 from atzinmartinez/rama_a
atzinmartinez Oct 5, 2022
747b850
se creo caja de comentarios y boton
ElsyCaro Oct 7, 2022
37c0c6a
Se agrego caja de cometarios
ElsyCaro Oct 7, 2022
95981a4
Se agrego caja de cometarios
ElsyCaro Oct 7, 2022
86a070b
Merge pull request #7 from ElsyCaro/firebase
ElsyCaro Oct 7, 2022
38332ed
Al dar click en el boton se ve reflejado lo del input en firebase
atzinmartinez Oct 7, 2022
b3aece4
Merge pull request #8 from atzinmartinez/firestore_a
ElsyCaro Oct 7, 2022
061057a
se pinta en la app
atzinmartinez Oct 11, 2022
4516aac
Merge pull request #9 from atzinmartinez/firestore_a
ElsyCaro Oct 11, 2022
3595a6a
Comentarios + css
atzinmartinez Oct 12, 2022
535af70
Merge pull request #10 from atzinmartinez/firestore_a
ElsyCaro Oct 12, 2022
baa03c0
boton borrar funcional
atzinmartinez Oct 12, 2022
76a553d
Merge pull request #11 from atzinmartinez/firestore_a
ElsyCaro Oct 12, 2022
2a6f335
Revert "boton borrar funcional"
ElsyCaro Oct 12, 2022
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
12 changes: 10 additions & 2 deletions src/components/Wall.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { logOut } from '../firebase/auth.js';
import { MakePost } from './MakePost.js';
import { getPost } from '../firebase/post.js';
import { getPost, deletePost } from '../firebase/post.js';

export const Wall = () => {
const div = document.createElement('div');
Expand Down Expand Up @@ -32,9 +32,17 @@ export const Wall = () => {
const contenidoPost = document.createElement('p');
contenidoPost.textContent = post.mensaje;
contenidoPost.classList = 'contenidoPost';
containerPosts.classList = 'cajadecontenido'; // div
post.classList = 'post';
console.log(post);

containerPosts.append(contenidoPost);
const buttonDelete = document.createElement('button');
buttonDelete.textContent = 'Borrar';
buttonDelete.classList = 'buttonDelete';
buttonDelete.addEventListener('click', async () => {
await deletePost(doc.id);
});
containerPosts.append(contenidoPost, buttonDelete);
});
});

Expand Down
20 changes: 11 additions & 9 deletions src/firebase/post.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
import {
collection, onSnapshot, addDoc, getFirestore,
collection, onSnapshot, addDoc, getFirestore, deleteDoc, doc,
} from 'https://www.gstatic.com/firebasejs/9.9.4/firebase-firestore.js';
import { app } from './config.js';

import {
getAuth, onAuthStateChanged,
} from 'https://www.gstatic.com/firebasejs/9.9.4/firebase-auth.js';

const auth = getAuth(app);
import { app } from './config.js';

const auth = getAuth(app);

const db = getFirestore(app);
let uid = "";
let uid = '';

onAuthStateChanged(auth, (user) => {
if (user) {
uid = user.uid;
//console.log(uid);
uid = user.uid;
// console.log(uid);
// ...
} else {
}
});


export const savePost = async (textPost) => {
const docRef = await addDoc(collection(db, 'post'), {
mensaje: textPost,
uid,
});
//console.log('Document written with ID: ', docRef.id);
// console.log('Document written with ID: ', docRef.id);
};
// firestore es una base de datos no relacional
//
Expand All @@ -39,6 +38,9 @@ export const getPost = (callback) => {
);
};

export const deletePost = async (id) => {
await deleteDoc(doc(db, 'post', id));
};
// todo lo del CRUD aquí

//export const getPost = (callback) => onSnapshot (collection(db,'post'), callback);
// export const getPost = (callback) => onSnapshot (collection(db,'post'), callback);
20 changes: 19 additions & 1 deletion src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ border-radius: 8px;
.contenidoPost{
display: flex;
background: #151419;
margin-top: 50px;
flex-direction: column;
margin: 15px;
padding: 10px;
border-radius: 15px;
Expand All @@ -515,6 +515,24 @@ margin-top: 50px;
color: #FFFFFF;
}

.cajadecontenido{
position: absolute;
margin-top: 220px;
margin-left: 15px;
width: 100%;
height: 100%;

}

.post{
display: flex;
padding: 23px;
width: 270px;
margin-top: 20px;
margin-left: 2px;

}

.welcome{

position: absolute;
Expand Down