Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
e3af932
prueba1
KimRv000 Jul 4, 2023
3aa6e6b
Merge pull request #3 from KimRv000/main
GenovevaCastro Jul 4, 2023
94eaac6
SPA con home, register, login
KimRv000 Jul 10, 2023
f3867a7
Merge pull request #4 from KimRv000/main
GenovevaCastro Jul 10, 2023
0cdec72
Se resolvió el ciclo de Vite
KimRv000 Jul 11, 2023
47c2680
Merge pull request #5 from KimRv000/main
GenovevaCastro Jul 11, 2023
288eb75
Se crearon los elementos de la pantalla login
KimRv000 Jul 11, 2023
238e51e
Se creó hoja de estilo css y se ligó en htmal
KimRv000 Jul 12, 2023
bde801d
Merge pull request #6 from KimRv000/main
GenovevaCastro Jul 12, 2023
58f5e4e
Agregué estilo css a pantalla login
KimRv000 Jul 13, 2023
16e729c
Merge pull request #7 from KimRv000/main
GenovevaCastro Jul 13, 2023
a099bac
agregue elementos a home
GenovevaCastro Jul 13, 2023
4024a39
Integracion home
GenovevaCastro Jul 13, 2023
f5a3fe2
css
Mitzymora Jul 13, 2023
aae3142
merge register
Mitzymora Jul 13, 2023
fb81ba9
css registro
Mitzymora Jul 14, 2023
66d5682
Merge pull request #8 from Mitzymora/main
Mitzymora Jul 14, 2023
91c3519
pantalla home
GenovevaCastro Jul 19, 2023
ab93263
home
GenovevaCastro Jul 19, 2023
44f9066
se cambió estilo css de pantalla login
KimRv000 Jul 20, 2023
6396d6e
Merge pull request #9 from KimRv000/main
GenovevaCastro Jul 20, 2023
72a2588
se unificó estilo de las pantallas de inicio
KimRv000 Jul 20, 2023
f30948f
Merge pull request #10 from KimRv000/main
GenovevaCastro Jul 20, 2023
66d22ec
css prueba
Mitzymora Jul 20, 2023
ac1bcff
Merge branch 'main' of https://github.com/Mitzymora/DEV008-social-net…
Mitzymora Jul 20, 2023
af485a3
configuracion firebase
GenovevaCastro Jul 20, 2023
8ba0540
configuracion firebase
GenovevaCastro Jul 20, 2023
0b92114
instalacion firebase
GenovevaCastro Jul 21, 2023
bbb923e
alert
Mitzymora Jul 21, 2023
cd89227
Merge branch 'main' of https://github.com/Mitzymora/DEV008-social-net…
Mitzymora Jul 21, 2023
908f458
pantallas css
Mitzymora Jul 24, 2023
a9954b8
Merge pull request #11 from Mitzymora/main
GenovevaCastro Jul 24, 2023
b3af392
camnio de botones
GenovevaCastro Jul 24, 2023
8dad104
botones inicio
GenovevaCastro Jul 24, 2023
87504d5
creacion de usuarios firebase
KimRv000 Jul 24, 2023
bff8fc3
Merge pull request #12 from KimRv000/main
GenovevaCastro Jul 24, 2023
9772c5b
usuarios a firebase
GenovevaCastro Jul 25, 2023
814838b
Merge branch 'Laboratoria:main' into main
Mitzymora Jul 25, 2023
d433a25
pruebas
Mitzymora Jul 25, 2023
9f21b90
Merge branch 'main' of https://github.com/Mitzymora/DEV008-social-net…
Mitzymora Jul 25, 2023
897a235
registro de usuarios firebase
KimRv000 Jul 25, 2023
7c223e0
correción en register
Mitzymora Jul 25, 2023
c71fb86
Merge pull request #13 from Mitzymora/main
Mitzymora Jul 25, 2023
9da595c
iniciar sesion en pantalla login
KimRv000 Jul 25, 2023
78844d3
Merge pull request #14 from KimRv000/main
KimRv000 Jul 25, 2023
53eb331
acceder con google
KimRv000 Jul 26, 2023
eb68744
Merge pull request #15 from KimRv000/main
GenovevaCastro Jul 26, 2023
962e95c
acceder con google correcciones
KimRv000 Jul 26, 2023
8008607
Merge pull request #16 from KimRv000/main
GenovevaCastro Jul 26, 2023
0b13af0
media query
Mitzymora Jul 27, 2023
8e48940
Merge branch 'mitzy' of https://github.com/Mitzymora/DEV008-social-ne…
Mitzymora Jul 27, 2023
0bf8f1c
media query
Mitzymora Jul 27, 2023
a29c76f
avances en feed
KimRv000 Jul 28, 2023
2581a31
Merge pull request #17 from Mitzymora/main
GenovevaCastro Jul 28, 2023
994457b
elementos feed
GenovevaCastro Jul 28, 2023
fc70bf2
avances en feed
KimRv000 Jul 28, 2023
5736c27
Merge pull request #18 from KimRv000/main
GenovevaCastro Jul 28, 2023
4ad55f1
elementos feed
GenovevaCastro Jul 28, 2023
6d9ffd4
borre cambios feed
GenovevaCastro Jul 28, 2023
1bb61cd
Feed
Mitzymora Jul 28, 2023
96a7876
css feed
Mitzymora Jul 28, 2023
a2208fb
Merge pull request #19 from Mitzymora/main
GenovevaCastro Jul 28, 2023
278d849
feed
GenovevaCastro Jul 28, 2023
7b39944
ajuste de contenedores de posts
KimRv000 Jul 29, 2023
bcf5ab4
Merge pull request #20 from KimRv000/main
GenovevaCastro Jul 31, 2023
47b5fac
cambios feed
GenovevaCastro Jul 31, 2023
26307a3
cambios feed css
GenovevaCastro Jul 31, 2023
f82cdf4
cambios feed
GenovevaCastro Jul 31, 2023
c1ce081
configuracion firestore
GenovevaCastro Jul 31, 2023
435b740
configuracion firestore
GenovevaCastro Jul 31, 2023
ec4fb41
prueba1 para crear post
KimRv000 Aug 1, 2023
b69b452
crear post funcion
KimRv000 Aug 1, 2023
5737e4d
Merge pull request #21 from KimRv000/main
GenovevaCastro Aug 1, 2023
2890213
descartar
Mitzymora Aug 1, 2023
d0a7e88
firestore
Mitzymora Aug 1, 2023
3bf1f89
pruebas
Mitzymora Aug 2, 2023
8443c8f
function mostrar post
GenovevaCastro Aug 2, 2023
1231830
Merge branch 'main' of https://github.com/Mitzymora/DEV008-social-net…
Mitzymora Aug 2, 2023
9c711e3
post consola
Mitzymora Aug 2, 2023
dad716b
function mostrar post
GenovevaCastro Aug 3, 2023
601f8ee
se crea contenedor por cada post
GenovevaCastro Aug 3, 2023
49008cc
se crea contenedor por post
GenovevaCastro Aug 3, 2023
105e720
se crea contenedor por cada post publicado
GenovevaCastro Aug 3, 2023
abb2d42
Merge branch 'main' of https://github.com/Mitzymora/DEV008-social-net…
Mitzymora Aug 3, 2023
5d6c4f3
aparece contenido en post y en consola el nombre de usuario
KimRv000 Aug 3, 2023
00d94d4
Merge pull request #22 from KimRv000/main
GenovevaCastro Aug 3, 2023
17a6ff7
prueba
Mitzymora Aug 3, 2023
b865ea4
Merge branch 'main' of https://github.com/Mitzymora/DEV008-social-net…
Mitzymora Aug 3, 2023
f117bea
se puede borrar post pero necesita recargarse la pagina
KimRv000 Aug 3, 2023
6a8c073
se puede borrar post pero necesita recargarse la pagina
KimRv000 Aug 3, 2023
e2c21fd
acomodo de feed en scroll
GenovevaCastro Aug 4, 2023
7fd01b8
se agrego usuario a header, aun no sale el usuario logeado correctamente
KimRv000 Aug 4, 2023
d83a700
sonido like
GenovevaCastro Aug 4, 2023
e8de38c
se modificaron los contenedores de feed y css
KimRv000 Aug 4, 2023
6f34dcf
se modificaron los contenedores de feed y css
KimRv000 Aug 7, 2023
bba611e
se modificaron los contenedores de feed y css y se agrega funcion bor…
KimRv000 Aug 7, 2023
cde6b6f
Merge pull request #23 from KimRv000/main
GenovevaCastro Aug 7, 2023
b58f5bf
editar post nf
Mitzymora Aug 7, 2023
88ee3df
pc
Mitzymora Aug 7, 2023
1b972c4
borrarpost
Mitzymora Aug 7, 2023
d673f8e
sonido like
GenovevaCastro Aug 7, 2023
4fccacf
boton like
GenovevaCastro Aug 8, 2023
c16fc64
pruebas de usuario
KimRv000 Aug 8, 2023
0897bb7
pruebas de usuario
KimRv000 Aug 8, 2023
846dbf8
Merge pull request #24 from KimRv000/main
GenovevaCastro Aug 8, 2023
6b42b39
prueba function likes
GenovevaCastro Aug 8, 2023
59576db
editar
Mitzymora Aug 8, 2023
523dee2
Merge branch 'main' of https://github.com/Mitzymora/DEV008-social-net…
Mitzymora Aug 8, 2023
3b43052
lik y dislike
GenovevaCastro Aug 8, 2023
d793f85
n
Mitzymora Aug 8, 2023
2556e7a
Merge branch 'main' of https://github.com/Mitzymora/DEV008-social-net…
Mitzymora Aug 8, 2023
69d557c
editor listo
Mitzymora Aug 8, 2023
020c58a
Merge pull request #25 from Mitzymora/main
GenovevaCastro Aug 8, 2023
7cbb384
cambios css feed
GenovevaCastro Aug 8, 2023
bf07025
cambios feed css
GenovevaCastro Aug 8, 2023
902d483
cambios en css feed
GenovevaCastro Aug 9, 2023
9756290
feed css responsivo
GenovevaCastro Aug 9, 2023
ffa3a16
cambios css feed responsivo
GenovevaCastro Aug 9, 2023
bda6a8b
feed responsivo
GenovevaCastro Aug 9, 2023
a7f7195
readme
Mitzymora Aug 9, 2023
06459e7
readme primer cambio
Mitzymora Aug 9, 2023
a82f2c5
prueba img
Mitzymora Aug 9, 2023
533e00a
img prueba
Mitzymora Aug 9, 2023
09405b0
Merge pull request #26 from Mitzymora/main
GenovevaCastro Aug 15, 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
414 changes: 90 additions & 324 deletions README.md

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions firebase-debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[debug] [2023-07-19T23:17:44.653Z] ----------------------------------------------------------------------
[debug] [2023-07-19T23:17:44.655Z] Command: /Users/bva/.nvm/versions/node/v18.16.0/bin/node /Users/bva/.nvm/versions/node/v18.16.0/bin/firebase init
[debug] [2023-07-19T23:17:44.655Z] CLI Version: 12.4.5
[debug] [2023-07-19T23:17:44.656Z] Platform: darwin
[debug] [2023-07-19T23:17:44.656Z] Node Version: v18.16.0
[debug] [2023-07-19T23:17:44.663Z] Time: Wed Jul 19 2023 17:17:44 GMT-0600 (hora estándar central)
[debug] [2023-07-19T23:17:44.663Z] ----------------------------------------------------------------------
[debug]
[debug] [2023-07-19T23:17:44.668Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2023-07-19T23:17:44.669Z] > authorizing via signed-in user (impresionesveva@gmail.com)
[info]
######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########

You're about to initialize a Firebase project in this directory:

/Users/bva/Desktop/DEV008-social-network

13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"pretest": "npm run htmlhint && npm run eslint && npm run stylelint",
"test": "jest --coverage",
"dev": "vite dev src",
"start": "npm run dev",
"start": "npm run dev ",
"build": "vite build",
"preview": "vite preview"
},
Expand All @@ -41,5 +41,12 @@
"createdAt": "2023-06-06T21:37:46.504Z",
"version": "6.3.0",
"commit": "a942adeb868f1fe54b86e34cc4fc4ddb0601700d"
}
}
},
"dependencies": {
"firebase": "^10.0.0"
},
"directories": {
"test": "test"
},
"author": ""
}
Binary file added readme imagenes/HU.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 readme imagenes/HomeImg.jpeg
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 readme imagenes/Login.jpeg
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 readme imagenes/feed.jpeg
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 readme imagenes/formulario.jpeg
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 readme imagenes/prototipo baja.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 readme imagenes/prototipo2alta.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 readme imagenes/prototipoalta.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 readme imagenes/prototipobaja.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 readme imagenes/register.jpeg
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 readme imagenes/trello.jpeg
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/Another America.ttf
Binary file not shown.
Binary file added src/CaviarDreams.ttf
Binary file not shown.
Binary file added src/EDITAR.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/borrar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
283 changes: 283 additions & 0 deletions src/components/feed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,283 @@
import { crearPost, mostrarpost, borrarPost, incrementarLike , obtenerDocumento, decrementarLike, editPost} from '../firestore/baseDeDatosFirestore.js';
//import { usuarioActual } from '../lib/firebase/configuracionFirabase.js';
import { obtenerUsuarioActual } from '../lib/localStorage.js';

export const feed = (onNavigate) => {
const usuarioActual = obtenerUsuarioActual();
console.log(usuarioActual);

const homeDiv = document.createElement('div');
homeDiv.classList.add('homeDiv');

const headerFeed = document.createElement('header');
headerFeed.classList.add('headerFeed');
homeDiv.appendChild(headerFeed);

const containerLogo = document.createElement('div');
containerLogo.classList.add('containerLogo');
headerFeed.appendChild(containerLogo);

const headerLogo = document.createElement('img');
headerLogo.src = '../logo.png';
headerLogo.classList.add('headerLogoFeed');
containerLogo.appendChild(headerLogo);

const usuarioInfoHeader = document.createElement('div');
usuarioInfoHeader.classList.add('usuarioInfoHeader');
headerFeed.appendChild(usuarioInfoHeader);

const imagenUsuarioHeader = document.createElement('img');
imagenUsuarioHeader.className = 'imagenUsuarioHeader';
usuarioInfoHeader.appendChild(imagenUsuarioHeader);
imagenUsuarioHeader.src = 'gatogif.gif';

const nombreUsuarioHeader = document.createElement('h2');
nombreUsuarioHeader.className = 'nombreUsuarioHeader';
nombreUsuarioHeader.innerText = usuarioActual.email;
usuarioInfoHeader.appendChild(nombreUsuarioHeader);

const buttonCerrarSesion = document.createElement('button');
buttonCerrarSesion.classList.add('buttonCerrarSesion');
buttonCerrarSesion.textContent = 'Salir';
usuarioInfoHeader.appendChild(buttonCerrarSesion);

const feedDiv = document.createElement('div');
feedDiv.classList.add('feedContainer');
homeDiv.appendChild(feedDiv);

const crearPostContainer = document.createElement('div');
crearPostContainer.classList.add('crearPostContainer');
feedDiv.appendChild(crearPostContainer);

const textContainer = document.createElement('div');
textContainer.classList.add('textContainer');
crearPostContainer.appendChild(textContainer);

const usuarioInfo = document.createElement('section');
usuarioInfo.className = 'usuarioInfo';
textContainer.appendChild(usuarioInfo);

const imagenUsuario = document.createElement('img');
imagenUsuario.className = 'imagenUsuario';
imagenUsuario.src = 'giphy (1).gif';
usuarioInfo.appendChild(imagenUsuario);

const nombreUsuario = document.createElement('p');
nombreUsuario.className = 'nombreUsuario';
nombreUsuario.innerText = usuarioActual.email;
usuarioInfo.appendChild(nombreUsuario);

const publicar = document.createElement('textarea');
publicar.classList.add('publicarInput');
publicar.id = 'crearPost';
publicar.placeholder = 'Crear post';
textContainer.appendChild(publicar);

const buttonPublicar = document.createElement('button');
buttonPublicar.className = 'buttonPublicar';
buttonPublicar.id = 'botonPublicar';
buttonPublicar.textContent = 'Publicar';
textContainer.appendChild(buttonPublicar);
//se da una evento onclick al buttonPublicar para que mande a llamar la funcion postPublicado---------------
buttonPublicar.onclick = function () {
postPublicado(post);
//imprime en consola los post publicados----------------
console.log(postPublicado)
};

// funcion que crea el contenedor de cada post----------------------------
function contenedorPost(post) {

const postFeedContainer = document.createElement('div');
postFeedContainer.classList.add('postFeedContainer');
feedDiv.appendChild(postFeedContainer);

const textContainerpost = document.createElement('div');
textContainerpost.classList.add('textContainerpost');
postFeedContainer.appendChild(textContainerpost);
textContainerpost.id = 'textContainerpost';

const usuarioInfoPost = document.createElement('section');
usuarioInfoPost.className = 'usuarioInfo';
textContainerpost.appendChild(usuarioInfoPost);

const imagenUsuariopost = document.createElement('img');
imagenUsuariopost.className = 'imagenUsuario';
imagenUsuariopost.src = 'giphy.gif';
usuarioInfoPost.appendChild(imagenUsuariopost);

const nombreUsuariopost = document.createElement('p');
nombreUsuariopost.className = 'nombreUsuario';
nombreUsuariopost.innerText = post.data().autor;
nombreUsuariopost.id = 'nombreDeUsuario';
usuarioInfoPost.appendChild(nombreUsuariopost);

const publicacion = document.createElement('textarea');
publicacion.classList.add('publicarInput');
publicacion.innerText = post.data().contenido;
publicacion.disabled = true;
publicacion.id = 'post';
publicacion.placeholder = 'Post';
textContainerpost.appendChild(publicacion);

const opcionesPostContenedor = document.createElement('div');
opcionesPostContenedor.className = 'opcionesPostContenedor';
textContainerpost.appendChild(opcionesPostContenedor);

const containerLike = document.createElement('button');
containerLike.classList.add('containerLike');
containerLike.id = ' containerLike';
opcionesPostContenedor.appendChild(containerLike);


containerLike.addEventListener("click", function () {
obtenerDocumento(post.id)
.then( (documento)=> {
const yaDioLike = documento.data().likes.includes(usuarioActual.uid)
if (yaDioLike){
decrementarLike(usuarioActual.uid, post.id).then(()=>{
window.location.reload()
})
}
else{
play(),
incrementarLike(post.id, usuarioActual.uid).then(()=>{
window.location.reload();
})
}
})
.catch((error)=>{
console.log(error)
})
/* incrementarLike(post.id, usuarioActual.uid).then((respuesta) => {
console.log(respuesta);
console.log('Diste un like');
console.log(post.uid);
alert("funciona el boton")
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
console.log(errorCode);
console.log(errorMessage);
alert(error.message);
window.location.reload(); // Para recargar la pantalla//
});*/
});


const likeFuego = document.createElement('img');
likeFuego.src = 'https://images.emojiterra.com/google/noto-emoji/unicode-15/animated/1f525.gif';
likeFuego.classList.add('likeFuego');
containerLike.appendChild(likeFuego);

const contadorLikes = document.createElement('number');
contadorLikes.className = 'contadorLikes';
contadorLikes.id = 'contadorLikes';
contadorLikes.textContent = post.data().likes.length;
console.log(post);
containerLike.appendChild(contadorLikes);

if (usuarioActual.email === post.data().autor){
const containerPostMenu = document.createElement('div');
containerPostMenu.classList = ('containerPostMenu');
opcionesPostContenedor.appendChild(containerPostMenu);

const editarPost = document.createElement('img');
editarPost.src = 'EDITAR.png';
editarPost.classList.add('editarPost');
containerPostMenu.appendChild(editarPost);
editarPost.addEventListener("click", () => {
alert('Edita tu post');
publicacion.disabled = false;

});

const guardarPost = document.createElement('img');
guardarPost.src = 'guardar.png';
guardarPost.classList.add('guardarPost');
containerPostMenu.appendChild(guardarPost);
guardarPost.addEventListener("click", () => {
alert('Editaste tu post');
const nuevoContenido = publicacion.value;
console.log(nuevoContenido);
editPost(post.id, nuevoContenido)
.then((respuesta) => {
publicacion.disabled= true;
console.log(respuesta);
})
.catch((error)=>{
console.log(error)})
});

const eliminarPost = document.createElement('img');
eliminarPost.src = 'borrar.png';
eliminarPost.classList.add('eliminarPost');
containerPostMenu.appendChild(eliminarPost);
eliminarPost.addEventListener('click', () => {
const alertConfimar = confirm('¿Eliminar post?'); // Confirmación para eliminar post// NO FUNCIONA / LO BORRA DE TODOS MODOS//
if (alertConfimar === true) {
borrarPost(post.id)
.then((respuesta) => {
console.log(respuesta);
console.log('Borraste un post');
window.location.reload();
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
console.log(errorCode);
console.log(errorMessage);
alert(error.message);
window.location.reload();
});
}
});
//console.log(post.id);
};
};

//funcion mostrarPost hace un recorrido de cada post y en cada uno se manda a llamar la funcion contenedorPost----------
mostrarpost().then((respuesta) => {
respuesta.forEach((post) => {
contenedorPost(post);
//console.log(post.data().contenido);
//para acceder a la info de post es con post.data.contenido o fecha o autor----------------
});
});

buttonCerrarSesion.addEventListener('click', () => onNavigate('/'));


buttonPublicar.addEventListener('click', (e) => {
e.preventDefault();

const userPost = usuarioActual.email;
console.log(userPost);
const contenidoPost = document.getElementById('crearPost').value;
console.log(contenidoPost);
const fecha = new Date();
const fechaPost = fecha.toLocaleDateString();
console.log(fechaPost);

crearPost(userPost, contenidoPost, fechaPost)
.then((respuesta) => {
// Signed in
const postCreado = respuesta;
console.log(postCreado);
// ...
console.log('Haz creado un post');
window.location.reload(); // Para recargar la pantalla//
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
console.log(errorCode);
console.log(errorMessage);
alert(error.message);
window.location.reload(); // Para recargar la pantalla//
});
});

return homeDiv;
};
51 changes: 51 additions & 0 deletions src/components/home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
export const home = (onNavigate) => {
const homeDiv = document.createElement('div');

const contenedorHome = document.createElement('div');
contenedorHome.className = 'contenedorHome';
homeDiv.appendChild(contenedorHome);

const logoPrincipal = document.createElement('img');
logoPrincipal.className = 'logoPrincipal';
contenedorHome.appendChild(logoPrincipal);
logoPrincipal.src = 'logo.png';

const sinopsis = document.createElement('p');
sinopsis.className = 'sinopsis';
sinopsis.textContent = 'Se trata de una app en la que es posible compartir canciones y álbumes con los contactos, que podrán escuchar usando cualquier servicio de streaming que tengan contratado, desde Spotify a Apple Music, pasando por Deezer y otros.Jamselect permite descubrir nuevos ritmos y hablar sobre ellos, crear un hilo de comentarios sobre cada canción compartida, siendo este su principal punto de ventaja con respecto a otras soluciones semejantes (como compartir una lista a través de un enlace, por ejemplo).';
contenedorHome.appendChild(sinopsis);

const contenedorBotones = document.createElement('div');
contenedorBotones.className = 'contenedorBotonesHome';
contenedorHome.appendChild(contenedorBotones);

const buttonRegister = document.createElement('button');
buttonRegister.innerText = 'Registrarse';
buttonRegister.classList = 'button';
contenedorBotones.appendChild(buttonRegister);

const buttonLogin = document.createElement('button');
buttonLogin.innerText = 'Entrar';
buttonLogin.classList = 'button';
contenedorBotones.appendChild(buttonLogin);

const contenedorImagenesH = document.createElement('div');
contenedorImagenesH.className = 'contenedorImagenesH';
contenedorHome.appendChild(contenedorImagenesH);

const imagenAbajoH = document.createElement('img');
imagenAbajoH.className = 'imagenAbajo';
contenedorImagenesH.appendChild(imagenAbajoH);
imagenAbajoH.src = 'imageninicio.png';

const footer = document.createElement('footer');
footer.className = 'footer';
homeDiv.appendChild(footer);

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

homeDiv.appendChild(contenedorHome);

return homeDiv;
};
Loading