diff --git a/package.json b/package.json index 8701ab74..e1ef8a82 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,8 @@ "htmlhint": "htmlhint dist/*.html ", "eslint": "eslint --ext .js src/ test/", "stylelint": "stylelint --aei src/**/*.css", - "pretest": "npm run htmlhint && npm run eslint && npm run stylelint", - "test": "jest --coverage", + "pretestjjazjsaaj": "npm run htmlhint && npm run eslint && npm run stylelint", + "test": "jest --env=jsdom --coverage", "dev": "vite dev src", "start": "npm run dev", "build": "vite build", @@ -41,5 +41,8 @@ "createdAt": "2023-02-02T20:38:10.344Z", "version": "5.5.0", "commit": "36bf90dc273bab8ffe9546b09eece6a132f8a669" + }, + "dependencies": { + "firebase": "^9.17.2" } -} \ No newline at end of file +} diff --git a/quareFclear b/quareFclear new file mode 100644 index 00000000..6405e108 --- /dev/null +++ b/quareFclear @@ -0,0 +1,758 @@ +commit 896cd65866804937512c69343ddb79a39011d740 (HEAD -> estilosLady5, origin/estilosLady5) +Merge: e3343fe 6d15ad5 +Author: LuzAlvaca <118011555+ChuzAlvaca@users.noreply.github.com> +Date: Wed Mar 29 19:09:59 2023 -0600 + + Merge pull request #33 from katalimbu/kata7 + + feed muestra en consolelog + +commit 6d15ad59876c4aa6b17485388605debed52db307 (origin/kata7) +Author: katalimbu +Date: Wed Mar 29 21:33:28 2023 -0300 + + feed muestra en consolelog + +commit e3343fe9d353c841712b30f7e945114a17ed0242 +Author: katalimbu +Date: Tue Mar 28 22:05:41 2023 -0300 + + correccion feed firebase + +commit 6f89bbdea3f5e7bcab154799a3c1fc9da78f2f13 +Merge: bad1346 6ba229d +Author: katalimbu <122368809+katalimbu@users.noreply.github.com> +Date: Tue Mar 28 21:57:47 2023 -0300 + + Merge pull request #32 from katalimbu/prueba + + Prueba + +commit 6ba229de0281e114ebc3b7e67cfe033cdcc32abc (origin/prueba) +Merge: 6294a45 bad1346 +Author: katalimbu <122368809+katalimbu@users.noreply.github.com> +Date: Tue Mar 28 21:57:36 2023 -0300 + + Merge branch 'main' into prueba + +commit 6294a452f6612428512bcd873a1acdaf07ab1236 +Author: LuzAlvaca +Date: Tue Mar 28 18:52:23 2023 -0600 + + vista feed lista para hacer post + +commit 33cc3b910513a8906eb2cc226ec42276d57b7d01 +Author: LuzAlvaca +Date: Tue Mar 28 18:44:41 2023 -0600 + + vista feed con iconos de usuario y sin iconos de like y coment + +commit bad13461e8d2ae9744ad560ffb87db3501cbb866 +Merge: cee9bef f633f86 +Author: Lady9696 <122558772+Lady9696@users.noreply.github.com> +Date: Tue Mar 28 19:26:38 2023 -0500 + + Merge pull request #31 from katalimbu/kata7 + + Kata7 + +commit 724af10dbbe9bc37d6e9adaa1cc048320c6dd5e6 +Author: LuzAlvaca +Date: Tue Mar 28 17:50:02 2023 -0600 + + vista feed con iconos de usuario + +commit a7fc5d0b0d01614ae504c5a7fdc1f25349f65507 +Author: LuzAlvaca +Date: Tue Mar 28 17:25:42 2023 -0600 + + vista feed sin avatar + +commit f633f86e634601df0e8e44d4e02690ec881f25d0 +Author: katalimbu +Date: Tue Mar 28 14:22:40 2023 -0300 + + unimos el post con firestore + +commit 88298bec2c8c167def6c8735b59c51bf8250fada +Author: katalimbu +Date: Tue Mar 28 13:42:15 2023 -0300 + + test register error + +commit cee9bef276dc3aee85e66932b2e89099d5903835 +Merge: 71e47ce a082196 +Author: katalimbu <122368809+katalimbu@users.noreply.github.com> +Date: Tue Mar 28 13:34:43 2023 -0300 + + Merge pull request #30 from katalimbu/prueba + + Prueba + +commit a0821961670da4a8d3d572e2a79a6d3ec764d12a +Author: LuzAlvaca +Date: Tue Mar 28 10:31:58 2023 -0600 + + vista feed incompleta + +commit 71e47ce2c61e2471418845eda8c6d4f9b8ea387c +Merge: a7bca15 0a71d60 +Author: katalimbu <122368809+katalimbu@users.noreply.github.com> +Date: Mon Mar 27 22:05:53 2023 -0300 + + Merge pull request #29 from katalimbu/estilosLady3 + + Estilos lady3 + +commit a37f1c58c1df79389518f2357f002835c980afcf +Author: LuzAlvaca +Date: Mon Mar 27 18:51:54 2023 -0600 + + cambios en feed + +commit a7bca15a1bf6eb38d96b36c00f941dadfd416845 +Merge: c9f070a 6a27c35 +Author: LuzAlvaca <118011555+ChuzAlvaca@users.noreply.github.com> +Date: Mon Mar 27 18:47:19 2023 -0600 + + Merge pull request #28 from katalimbu/kata51 + + Kata51 + +commit 6a27c35b1e891c3aaa9f7865db9af9871a2a7896 (origin/kata51) +Author: katalimbu +Date: Mon Mar 27 21:39:47 2023 -0300 + + test soble login 100% y el de register sin los errores + +commit 0a71d60c5f295a53876e5e1af810ce3c81650f09 (origin/estilosLady3) +Author: Leidy Suarez Miranda +Date: Mon Mar 27 18:59:56 2023 -0500 + + Insertar datos en js, funciona + +commit 06b7c50710c49d943b5707b27a3b3669da730b72 +Author: Leidy Suarez Miranda +Date: Mon Mar 27 18:53:41 2023 -0500 + + insertar datos en firestore, no funciona + +commit c9f070aea198dd19c86aaa8473d2c63e06845373 (origin/ladyRepaso3, ladyRepaso3) +Merge: b9250ec 2c04268 +Author: LuzAlvaca <118011555+ChuzAlvaca@users.noreply.github.com> +Date: Mon Mar 27 07:49:42 2023 -0600 + + Merge pull request #27 from katalimbu/kata5 + + Kata5 + +commit 156487579c7ad478cd5d9c75dc2591a05ded3e0e +Author: katalimbu +Date: Sat Mar 25 17:50:43 2023 -0300 + + login responsivo + +commit 2c04268162ecc32a4b1bc474c07a96814e98a92b (origin/kata5) +Author: katalimbu +Date: Fri Mar 24 23:27:04 2023 -0300 + + login con errores en inner y css listo + +commit ea5692c0d9697ef0890cd08f8537c80e06be98e7 +Author: katalimbu +Date: Fri Mar 24 22:56:52 2023 -0300 + + errores activos en login y mejoras de css + +commit ae9cf7349f19659c91e66d52bda8217e6c28fd2c +Author: katalimbu +Date: Fri Mar 24 18:10:21 2023 -0300 + + css login sin terminar + +commit b9250ecf33af1628353020bb256dcc3334b72550 +Merge: f7c3968 a087329 +Author: LuzAlvaca <118011555+ChuzAlvaca@users.noreply.github.com> +Date: Fri Mar 24 13:06:16 2023 -0600 + + Merge pull request #26 from katalimbu/estilosLady2 + + Estilos lady2 + +commit a0873294a5b1eb71dcc426b4ac7a87e6555a0048 (origin/estilosLady2, estilosLady2) +Author: Leidy Suarez Miranda +Date: Fri Mar 24 13:39:53 2023 -0500 + + funciòn feed y configuracion de firestore + +commit ec78e52881f97b317784ab30710a6b95080ff34a +Author: Leidy Suarez Miranda +Date: Fri Mar 24 11:23:14 2023 -0500 + + agregamos la ruta del feed + +commit 0e21c3dd0eaed3e6ba63c6227608c829e820e7a3 +Author: Leidy Suarez Miranda +Date: Thu Mar 23 19:53:34 2023 -0500 + + agrego el archivo del feed + +commit f7c3968f253f049b6cf189d1efff8108201283cf +Merge: ee6716e 06279ee +Author: Lady9696 <122558772+Lady9696@users.noreply.github.com> +Date: Thu Mar 23 19:12:13 2023 -0500 + + Merge pull request #25 from katalimbu/estilos + + Estilos + +commit 06279eedff30e4491d035509eeef2324a1b1e481 (origin/estilos) +Merge: e35f2e2 ee6716e +Author: katalimbu +Date: Thu Mar 23 21:02:37 2023 -0300 + + Merge branch 'main' into estilos + +commit e35f2e2ff004b60281edc7d8e585f516c15d7ce7 +Author: katalimbu +Date: Thu Mar 23 15:59:56 2023 -0300 + + alertas en el login + +commit ee6716e4b289146bbe6f909e9a7b2f50a28323ba +Merge: 4e60a5a 424fb06 +Author: katalimbu <122368809+katalimbu@users.noreply.github.com> +Date: Thu Mar 23 15:05:36 2023 -0300 + + Merge pull request #24 from katalimbu/estilosLady2 + + Estilos lady2 + +commit 424fb0644014fb8dda237fb2a603ce36bfc96666 +Author: Leidy Suarez Miranda +Date: Thu Mar 23 13:02:01 2023 -0500 + + css de vista mobile register + +commit 67351d9519e8ac6cf443ce5b832b7e568c1fb751 +Author: katalimbu +Date: Thu Mar 23 15:01:49 2023 -0300 + + ordenado de los divs de login para usarlos en css + +commit 47512e2f60669f14a6f6566ee2f952d1afafacbe +Author: Leidy Suarez Miranda +Date: Thu Mar 23 12:56:17 2023 -0500 + + inciio de css vista register + +commit a55f3b3ac6b1e700950bfefd16397b880710afed +Author: Leidy Suarez Miranda +Date: Wed Mar 22 22:25:48 2023 -0500 + + vista register con css primera parte + +commit 9c5a3994c3fee9e4038e7e571cc6c8c60d7f0201 +Author: katalimbu +Date: Thu Mar 23 00:04:50 2023 -0300 + + login sin css con modal que no entendemos + +commit 4e60a5acafb089998b3034be75ef37400a50be7a +Merge: c959216 0825423 +Author: Lady9696 <122558772+Lady9696@users.noreply.github.com> +Date: Wed Mar 22 19:38:02 2023 -0500 + + Merge pull request #23 from katalimbu/innerchuz + + Innerchuz + +commit 08254237800fdc544aba1f23c511a8991eb597b8 (origin/innerchuz) +Author: LuzAlvaca +Date: Wed Mar 22 14:23:20 2023 -0600 + + inners en register listos + +commit c581bbc6d02e9c98359fd3313c47ee60710b5a93 +Author: LuzAlvaca +Date: Wed Mar 22 14:09:22 2023 -0600 + + se desplegó el primer inner, sin estilos + +commit 1e1f06860e137941fc366bf6a13744e5d50b7f8a +Author: katalimbu +Date: Wed Mar 22 15:10:03 2023 -0300 + + google + +commit e68870f8dd32a4f564c22be2167ace6006dcb9cb +Author: katalimbu +Date: Wed Mar 22 14:05:25 2023 -0300 + + logo google + +commit c959216f78afc4859ce678ca82f8d0bd957d0032 +Merge: c9661a2 f348953 +Author: katalimbu <122368809+katalimbu@users.noreply.github.com> +Date: Wed Mar 22 13:46:44 2023 -0300 + + Merge pull request #22 from katalimbu/estilosChuzHome + + Estilos chuz home + +commit f348953c813ceeba980c0424c5a9b5cbc29fd6aa (origin/estilosChuzHome) +Author: LuzAlvaca +Date: Tue Mar 21 23:43:22 2023 -0600 + + estilos vista home corrección en vista register + +commit bfce761feb9bce8add9b9a9f06915ef04b8bbb08 +Author: LuzAlvaca +Date: Tue Mar 21 23:21:35 2023 -0600 + + estilos completos vista home primera version + +commit c9661a2ab12e3319a7d7b548c48ef6257eabd18b +Merge: 7f07956 8cfb555 +Author: katalimbu <122368809+katalimbu@users.noreply.github.com> +Date: Tue Mar 21 23:36:45 2023 -0300 + + Merge pull request #20 from katalimbu/estilosLady + + estilos en vista Home + +commit 8cfb555ecd755bbe9f0db81e50876120ece8dc23 +Author: Leidy Suarez Miranda +Date: Tue Mar 21 21:34:26 2023 -0500 + + estilos en vista Home + +commit 7f0795685a678161e9c7442afeb5fbe8a66bfac0 +Merge: 953946c 19a5029 +Author: Lady9696 <122558772+Lady9696@users.noreply.github.com> +Date: Tue Mar 21 20:03:41 2023 -0500 + + Merge pull request #19 from katalimbu/estilosChuz1 + + Estilos chuz1 + +commit 19a5029a97e889180f57a16a2cdf9d508c224bc8 (origin/estilosChuz1) +Author: LuzAlvaca +Date: Tue Mar 21 19:01:27 2023 -0600 + + estilos en home sin terminar + +commit dd3d11f8cc6f8c9f251a16c401932ca97f812129 +Author: LuzAlvaca +Date: Tue Mar 21 14:25:05 2023 -0600 + + home es responsive, breakpoint de celular funcionando + +commit 953946c853c6cf7669fa89eaf9693419c849badd +Merge: fbdfc19 f817858 +Author: LuzAlvaca <118011555+ChuzAlvaca@users.noreply.github.com> +Date: Tue Mar 21 13:04:09 2023 -0600 + + Merge pull request #18 from katalimbu/estilos + + Estilos + +commit f817858987f7db7c3067b51e80c9fb2ec5ecffa5 +Author: katalimbu +Date: Tue Mar 21 16:00:04 2023 -0300 + + estilos en home + +commit 2255d8040525ee453a5b9171c2d04dce18adf416 +Merge: fe1d6bd fbdfc19 +Author: katalimbu +Date: Tue Mar 21 13:46:54 2023 -0300 + + Merge branch 'main' of github.com:katalimbu/DEV004-social-network into main + +commit fbdfc19a4622dfefc85e16f5aacf78e8afa2400b (origin/lady3, lady3) +Merge: acdeb05 d3c86bd +Author: LuzAlvaca <118011555+ChuzAlvaca@users.noreply.github.com> +Date: Tue Mar 21 10:26:52 2023 -0600 + + Merge pull request #17 from katalimbu/test + + Test + +commit fe1d6bd962854cc3d717a430009c3c571dd79463 +Author: katalimbu +Date: Tue Mar 21 13:17:59 2023 -0300 + + correciones slint register post pull lady + +commit acdeb0517c02fe753e588644a77a4dfd782832a8 +Merge: e771d53 59a0f32 +Author: LuzAlvaca <118011555+ChuzAlvaca@users.noreply.github.com> +Date: Tue Mar 21 10:10:59 2023 -0600 + + Merge pull request #16 from katalimbu/lady2 + + agrego los errores a register + +commit 59a0f326aaa44b97e68bf4289013d15d9b9220b8 (origin/lady2) +Author: Leidy Suarez Miranda +Date: Tue Mar 21 11:05:41 2023 -0500 + + agrego los errores a register + +commit e771d539d8bb403c03890c47f0c0743d0d6bad1a +Merge: b37854b f8f0085 +Author: Lady9696 <122558772+Lady9696@users.noreply.github.com> +Date: Tue Mar 21 10:33:46 2023 -0500 + + Merge pull request #15 from katalimbu/kata4 + + el login funciona junto con la autentificacion de google + +commit d3c86bd3e890cf05dd5453368bb6ab03c335c817 (origin/test) +Author: katalimbu +Date: Tue Mar 21 12:14:24 2023 -0300 + + cambios en el register por los test + +commit b68a540b38cdf554b18800c3ecc357b9b0fb5cd5 +Author: katalimbu +Date: Mon Mar 20 20:21:03 2023 -0300 + + prueba de test que pasa segun explicacion de jorge y archivo de carlos + +commit f8f0085f9f19cbacbb3f37327cf0fbc51699b590 (origin/kata4) +Author: katalimbu +Date: Mon Mar 20 19:33:56 2023 -0300 + + el login funciona junto con la autentificacion de google + +commit b37854bd0d143c22da2fb90764b05386c446e7a0 (origin/ladyRepaso1) +Merge: 2a3d378 5ba1353 +Author: katalimbu <122368809+katalimbu@users.noreply.github.com> +Date: Thu Mar 16 18:42:54 2023 -0300 + + Merge pull request #14 from katalimbu/lady2 + + inicio de test + +commit 5ba1353e6f45414ffad1d3e097195a9bcc0b18d3 +Author: Leidy Suarez Miranda +Date: Thu Mar 16 16:29:17 2023 -0500 + + inicio de test + +commit 2a3d378e71e1b37b8da1911dbdb31047dc2d9853 +Merge: 2baa834 d0694c7 +Author: LuzAlvaca <118011555+ChuzAlvaca@users.noreply.github.com> +Date: Thu Mar 16 12:49:42 2023 -0600 + + Merge pull request #13 from katalimbu/kata4 + + Kata4 + +commit d0694c75e9d4a1e83e31ddc82528d3dcf56c56b7 +Author: katalimbu +Date: Thu Mar 16 15:47:24 2023 -0300 + + inicio css home + +commit f0c106d430b4588261be6471cc4dd9f14e5697f0 +Author: katalimbu +Date: Thu Mar 16 14:47:14 2023 -0300 + + carpeta con imagen + +commit c1f863f607d2b2a859ab5718c10e85e23d193530 +Author: katalimbu +Date: Thu Mar 16 14:25:56 2023 -0300 + + logo reda + +commit 2baa834375c61464744f2691c8bac41478dd5c1d +Merge: 5e9d844 9c5b329 +Author: katalimbu <122368809+katalimbu@users.noreply.github.com> +Date: Wed Mar 15 22:42:04 2023 -0300 + + Merge pull request #12 from katalimbu/lady2 + + Lady2 + +commit 9c5b3293dc0c3acd958f15e7b6bd242ec7a460ac +Merge: 6982e42 5e9d844 +Author: Leidy Suarez Miranda +Date: Wed Mar 15 20:33:52 2023 -0500 + + Merge branch 'main' into lady2 + +commit 5e9d8448bb030ff93b2507aa1adf5de21836e4a0 +Merge: 9fb9c16 d055ffe +Author: Lady9696 <122558772+Lady9696@users.noreply.github.com> +Date: Wed Mar 15 20:30:20 2023 -0500 + + Merge pull request #11 from katalimbu/Chuz2 + + Chuz2 + +commit 6982e422aa5e41ca060c9dc357763e5e02f8ac01 +Author: Leidy Suarez Miranda +Date: Wed Mar 15 20:23:52 2023 -0500 + + agrego botones al inciio + +commit d055ffe898a8d870f394bbdadaf1dc5b486061de (origin/Chuz2) +Author: LuzAlvaca +Date: Wed Mar 15 18:54:13 2023 -0600 + + registro con inputs correctos + +commit 8fef9e55184294816dbbc1c5a6115f25a562dd15 +Merge: 9fb9c16 41fb58c +Author: Leidy Suarez Miranda +Date: Wed Mar 15 12:48:13 2023 -0500 + + Merge remote-tracking branch 'origin/Chuz2' into lady2 + +commit 41fb58c722549d9b719c24ee737de03364bc9f50 +Author: LuzAlvaca +Date: Wed Mar 15 11:17:40 2023 -0600 + + router y firebase registro con gmail funcionando + +commit 94c138b3e0a98ecdc7219ef8690984798e64342a +Author: LuzAlvaca +Date: Tue Mar 14 21:36:46 2023 -0600 + + problemas con imports en main y en firebase, pero funcionan las rutas + +commit 1580cf550eae4ac42240f3f207fed4189421758d +Author: LuzAlvaca +Date: Tue Mar 14 21:01:02 2023 -0600 + + rutas funcionando error en deploy firebase + +commit 0d6998783fa057c9bddb4225cc612737be2645c0 +Author: LuzAlvaca +Date: Tue Mar 14 20:44:16 2023 -0600 + + proyecto conectado a firebase, no funciona aun + +commit 6e0cca056c2ba68605e0b70521d173223414466d +Author: LuzAlvaca +Date: Mon Mar 13 20:10:26 2023 -0600 + + pequeña prueba + +commit 9fb9c16ebd25a0a836b1c44e7282bb9cad2a9f44 +Merge: 9bd0245 04650fb +Author: katalimbu <122368809+katalimbu@users.noreply.github.com> +Date: Mon Mar 13 23:03:16 2023 -0300 + + Merge pull request #10 from katalimbu/lady1 + + salto de línea + +commit 04650fb00a255c8efb0bc6215b66169d15016c49 (origin/lady1) +Author: Leidy Suarez Miranda +Date: Mon Mar 13 20:59:53 2023 -0500 + + salto de linea + +commit 9bd0245f52b6891d2423e368f0af97e54617b73a (origin/ChuzSN, origin/ChuzColab) +Author: katalimbu +Date: Mon Mar 13 22:06:38 2023 -0300 + + funciona las ruts ancladas al iu + +commit b776892baafa6d85946d502086d2d2577ddc04ce +Merge: 118a128 765e9d7 +Author: katalimbu <122368809+katalimbu@users.noreply.github.com> +Date: Mon Mar 13 21:53:22 2023 -0300 + + Merge pull request #9 from ChuzAlvaca/ChuzRepoKata + + Chuz repo kata + +commit 765e9d795f6607e1f0680b7c39c8a69d52637699 +Merge: 8930449 118a128 +Author: katalimbu <122368809+katalimbu@users.noreply.github.com> +Date: Mon Mar 13 21:16:29 2023 -0300 + + Merge branch 'ChuzRepoKata' into ChuzRepoKata + +commit 89304497e606fcb3804e0e7d5077ceed1f8f7a50 +Author: LuzAlvaca +Date: Mon Mar 13 12:58:30 2023 -0600 + + se despliega la interfaz de usuario con vista anclada a ruta + +commit 118a1285aacde6ea987100429de5be5742932baf +Author: katalimbu +Date: Fri Mar 10 15:26:42 2023 -0300 + + union de las rutas sin resultado aun + +commit 2f52310d18613f6cfcd6a56e466e0c7616bf9413 (origin/Chuz) +Merge: aad46f2 6c3e373 +Author: LuzAlvaca <118011555+ChuzAlvaca@users.noreply.github.com> +Date: Fri Mar 10 10:58:29 2023 -0600 + + Merge pull request #6 from Lady9696/ladysn1 + + Ladysn1 + +commit 6c3e373e299e9971f98e61a767bb8a93c1370a49 +Merge: dfdbd8c aad46f2 +Author: Lady9696 <122558772+Lady9696@users.noreply.github.com> +Date: Fri Mar 10 11:32:06 2023 -0500 + + Merge branch 'main' into ladysn1 + +commit aad46f2b4e095a0c57adeecd554450706badc059 +Merge: d40355e 3ef05b6 +Author: LuzAlvaca <118011555+ChuzAlvaca@users.noreply.github.com> +Date: Fri Mar 10 10:24:40 2023 -0600 + + Merge pull request #5 from katalimbu/kataSN1 + + primera funcion en login + +commit 3ef05b68dafa86c20f36a961b61974cb3c536f65 +Merge: 4ed2870 d40355e +Author: katalimbu <122368809+katalimbu@users.noreply.github.com> +Date: Fri Mar 10 13:23:36 2023 -0300 + + Merge branch 'main' into kataSN1 + +commit d40355e1fd17d20a71defd005e3924e8571c96a3 +Merge: af2a947 9e37377 +Author: katalimbu <122368809+katalimbu@users.noreply.github.com> +Date: Fri Mar 10 13:14:01 2023 -0300 + + Merge pull request #4 from ChuzAlvaca/ChuzSN + + Chuz sn + +commit 9e37377577b07fe5e3686c54a109b0c98c36707a +Author: LuzAlvaca +Date: Fri Mar 10 10:11:19 2023 -0600 + + primer select rol en reda, falta select anidado especialista + +commit dfdbd8c3d1560dc70be84ca0b3701ed18ae8993f +Author: Leidy Suarez Miranda +Date: Fri Mar 10 10:14:14 2023 -0500 + + vistahome + +commit 420265cb75b5ddc07440ec81144bdb6fd29a7c5e +Author: LuzAlvaca +Date: Fri Mar 10 08:06:23 2023 -0600 + + desplegable genérico en register + +commit cc13c4c9ae1ad6a95f551818f3626a1ee87eb86a +Author: LuzAlvaca +Date: Thu Mar 9 21:21:36 2023 -0600 + + todos los inputs en component register, falta option de rol + +commit f26a2d17dfb40a7c221039faff08602fd0eaf412 +Author: LuzAlvaca +Date: Thu Mar 9 20:13:33 2023 -0600 + + los inputs en el component register tienen placeholder + +commit 6ac6d1c54bf1ed2c8112b92a18a36662a315339f +Author: LuzAlvaca +Date: Thu Mar 9 19:48:29 2023 -0600 + + primera estructura del component registro + +commit 4ed2870292a031667f8bff8f4b57ffff43a87e53 +Author: katalimbu +Date: Thu Mar 9 22:39:29 2023 -0300 + + primera funcion en login + +commit f7afcf28fb7670581a4ac2ce9c0a1d36ebabf10c +Author: Leidy Suarez Miranda +Date: Wed Mar 8 19:54:36 2023 -0500 + + componentehome + +commit af2a947a5f55e03f55b82b990c96f5f0d49d2f2f +Merge: d7b336f 41e4315 +Author: katalimbu <122368809+katalimbu@users.noreply.github.com> +Date: Wed Mar 8 16:04:20 2023 -0300 + + Merge pull request #3 from Lady9696/ladysn1 + + vistahome + +commit 41e4315644c83d96bd6d96070af2e38e04820317 +Merge: 2449b65 d7b336f +Author: katalimbu <122368809+katalimbu@users.noreply.github.com> +Date: Wed Mar 8 16:04:07 2023 -0300 + + Merge branch 'main' into ladysn1 + +commit 2449b652bbd7679e948f27082ea8ed3974874582 +Author: Leidy Suarez Miranda +Date: Wed Mar 8 13:58:54 2023 -0500 + + vistahome + +commit d7b336fe44233d0211fdfbca72e9ba78ab2ba385 +Merge: 7f916e6 46e409d +Author: LuzAlvaca <118011555+ChuzAlvaca@users.noreply.github.com> +Date: Wed Mar 8 12:13:39 2023 -0600 + + Merge pull request #2 from katalimbu/kataSN1 + + pruebita + +commit 46e409d1d794dca4e89c5cfa72d73fe9d826c70d +Author: katalimbu +Date: Wed Mar 8 15:06:39 2023 -0300 + + pruebita + +commit 7f916e6d0bf5c7660642102691d12fff0f52c689 +Merge: 796b2b1 d695f58 +Author: Lady9696 <122558772+Lady9696@users.noreply.github.com> +Date: Wed Mar 8 12:45:39 2023 -0500 + + Merge pull request #1 from Lady9696/ladysn1 + + ensayo + +commit d695f588de1c06e633018ba2cb90ff1037ea40a0 +Author: Leidy Suarez Miranda +Date: Wed Mar 8 12:42:59 2023 -0500 + + ensayo + +commit 796b2b10a8787b089b6edfc1306c01c13a585ea3 +Author: Génesis Mauries <39414582+GenesisMauries@users.noreply.github.com> +Date: Thu Feb 16 09:13:46 2023 -0600 + + Update README.md + +commit 3a07193eba952fb2d969da4a06d6866f687bcfa1 +Author: Génesis Mauries <39414582+GenesisMauries@users.noreply.github.com> +Date: Tue Feb 7 08:53:23 2023 -0600 + + Update README.md + +commit 6ca1a795a2366217b49227fa57e119d3e78d6524 +Author: Génesis Mauries <39414582+GenesisMauries@users.noreply.github.com> +Date: Tue Feb 7 08:41:45 2023 -0600 + + Update README.md + +commit a36935b091424dc98b5328c70d1d84c2d490f54a +Author: genesismauries +Date: Thu Feb 2 14:38:10 2023 -0600 + + chore(init): Adds project files from curriculum diff --git a/src/componets/feed.js b/src/componets/feed.js new file mode 100644 index 00000000..73e05deb --- /dev/null +++ b/src/componets/feed.js @@ -0,0 +1,237 @@ +import { navigateTo } from '../router'; +// import { createpost, getpost, eliminatePost } from '../lib/firebase.js'; +import { + createpost, getpost, exitApp, auth, deletePost, updatePost, addLike, updatelike, + +} from '../lib/firebase.js'; + +// console.log('estamos en feed', auth); +export const feed = () => { + const squareF = document.createElement('div'); + squareF.setAttribute('class', 'squareF'); + squareF.setAttribute('id', 'squareFPerro'); + const squareHeaderF = document.createElement('header'); + squareHeaderF.setAttribute('class', 'squareHeaderF'); + const logoF = document.createElement('img'); + logoF.setAttribute('src', 'https://i.ibb.co/bWGQN64/REDA-1.png'); + logoF.setAttribute('class', 'logoF'); + const userInfoF = document.createElement('div'); + userInfoF.setAttribute('class', 'userInfoDivF'); + const userAvatar = document.createElement('img'); + userAvatar.setAttribute( + 'src', + 'https://cdn-icons-png.flaticon.com/512/4140/4140047.png', + ); + userAvatar.setAttribute('class', 'userAvatar'); + const userExpertChecked = document.createElement('img'); + userExpertChecked.setAttribute( + 'src', + 'https://cdn-icons-png.flaticon.com/512/5610/5610944.png', + ); + // aca estas llamando al setItem con getItem. + const currentUserEmail = sessionStorage.getItem('currentUser'); + const parseUser = JSON.parse(currentUserEmail); + const currentUserEmailDraw = document.createElement('p'); + currentUserEmailDraw.innerHTML = parseUser.email; + currentUserEmailDraw.setAttribute('class', 'currentUserMail'); + // console.log('esto es parseUser', parseUser); + userExpertChecked.setAttribute('class', 'userExpertChecked'); + userInfoF.setAttribute('class', 'userInfoF'); + const postContainer = document.createElement('form'); + postContainer.setAttribute('class', 'postContainer'); + const postTitle = document.createElement('textarea'); + + postTitle.setAttribute('class', 'postTitle'); + postTitle.setAttribute('rows', '2'); + postTitle.setAttribute('cols', '2'); + postTitle.setAttribute('placeholder', 'Escribe el título de tu post.'); + const post = document.createElement('textarea'); + post.setAttribute('class', 'post'); + post.setAttribute('rows', '10'); + post.setAttribute('cols', '1'); + post.setAttribute('placeholder', 'Escribe tu post.'); + postTitle.setAttribute('id', 'postTitle'); + post.setAttribute('id', 'post'); + const subsquareF = document.createElement('div'); + subsquareF.setAttribute('class', 'subsquareF'); + const btnHomeF = document.createElement('button'); + btnHomeF.setAttribute('class', 'btnHomeF'); + const btnPubF = document.createElement('button'); + btnPubF.setAttribute('class', 'btnPubF'); + btnPubF.textContent = 'publicar'; + btnHomeF.textContent = 'inicio'; + + const btnLogOut = document.createElement('button'); + btnLogOut.setAttribute('class', 'btnLogOut'); + btnLogOut.innerHTML = 'Cerrar sesión'; + + const likeIcon = document.createElement('img'); + // likeIcon.setAttribute('src', 'https://cdn-icons-png.flaticon.com/512/4140/4140047.png'); + likeIcon.setAttribute('class', 'likeIcon'); + const commentIcon = document.createElement('img'); + // commentIcon.setAttribute('src', 'https://cdn-icons-png.flaticon.com/512/4140/4140047.png'); + commentIcon.setAttribute('class', 'commentIcon'); + const squareFooterF = document.createElement('footer'); + squareFooterF.setAttribute('class', 'squareFooterF'); + squareFooterF.textContent = 'Reda©️'; + + squareF.appendChild(squareHeaderF); + squareHeaderF.appendChild(logoF); + squareF.appendChild(userInfoF); + userInfoF.appendChild(userAvatar); + userInfoF.appendChild(currentUserEmailDraw); + squareF.appendChild(postContainer); + postContainer.appendChild(postTitle); + postContainer.appendChild(post); + postContainer.appendChild(likeIcon); + postContainer.appendChild(commentIcon); + squareF.appendChild(subsquareF); + postContainer.appendChild(btnPubF); + subsquareF.appendChild(btnHomeF); + squareHeaderF.appendChild(btnLogOut); + + btnHomeF.addEventListener('click', () => { + navigateTo('/home'); + }); + + btnLogOut.addEventListener('click', () => { + exitApp() + .then(() => { + navigateTo('/home'); + }); + }); + + postContainer.addEventListener('submit', (e) => { + e.preventDefault(); + // console.log(postContainer); + const feedTitle = e.target.elements.postTitle.value; + const feedPost = e.target.elements.post.value; + // console.log(parseUser.email); + const feedUser = parseUser.email; + // console.log(feedTitle); + // console.log(feedPost); + // acá es importante el orden de los atributos, par saber como se imprimen. + createpost(feedUser, feedTitle, feedPost) + + // el dibjuar post debe estar dentro de una promesa para que dibuje + .then(() => { + dibujar(); + // document.querySelector('class', 'postContainer').reset(); + postContainer.reset(); + }); + // revisar este error para de dibujar; + }); + const dibujar = () => { + const myPromise = getpost(); + // const formularioPost = document.getElementById('squareFPerro'); + squareF.innerHTML = ''; + myPromise.then((showPost) => { + // nos aseguramos que la data provenga de feed.js y no de + // firebase. + // console.log('feed', showPost); + showPost.forEach((postD) => { + // const postForm = document.createElement('form'); + const form = document.createElement('form'); + form.classList.add('formularioEditar'); + form.setAttribute('data-id', postD.id); + form.setAttribute('id', 'form'); + + form.innerHTML = `
+ Autor: ${postD.usuario} + +
+ + +
+
+ + + + ${postD.likes.length}. + +
`; + // Oh con coni:?? significa que si el primer arreglo no existe, retorna el array vacio.(nullish) + // + // ojo con los dos signos de interrogaciòn juntos, no son un operador ternario + // + form.addEventListener('submit', (e) => { + e.preventDefault(); + // guardar en firebase + const postId = form.dataset.id; + const newTitle = e.target.elements.titulo.value; + const newDescription = e.target.elements.descripcion.value; + const newtitleEd = document.querySelector('.tituloEdit'); + const newdescripEd = document.querySelector('.descriptionEdit'); + const newPost = { + titulo: newTitle, + descripcion: newDescription, + }; + // console.log(postId); + // console.log(newPost); + updatePost(postId, newPost); + newtitleEd.setAttribute('disabled', ''); + console.log(newtitleEd); + newdescripEd.setAttribute('disabled', ''); + }); + const like = form.querySelector(`#like-${postD.id}`); + // console.log(like); + like.addEventListener('click', (e) => { + e.preventDefault(); + // console.log(e); + // console.log(auth.currentUser.email); + // este like representa un booleano + const like = (postD.likes ?? []).includes(auth.currentUser.email); + if (like === true) { + const newLikes = postD.likes.filter((email) => email !== auth.currentUser.email); + updatelike(postD.id, newLikes).then(() => { + dibujar(); + }); + } + else { + addLike(postD.id, [...postD.likes, auth.currentUser.email]).then(() => { + console.log(postD.likes, 'esto es el array de likes'); + dibujar(); + console.log(postD.likes, 'esto es el array de likes'); + }); + } + }); + squareF.appendChild(form); + }); + const btnsDeletePost = document.querySelectorAll('#btnDeletePost'); + console.log(btnsDeletePost); + btnsDeletePost.forEach((btn) => { + btn.addEventListener('click', (e) => { + e.preventDefault(); + const btnId = btn.getAttribute('data-id'); + // console.log(btnId); + const shouldDeletePost = window.confirm('¿Estás seguro de que deseas eliminar este post?'); + if (shouldDeletePost) { + const formToRemove = document.getElementById('form'); + formToRemove.remove(); + // console.log(formToRemove); + deletePost(btnId); + } + }); + }); + + const btnsEditar = document.querySelectorAll('#btnEditPost'); + btnsEditar.forEach((btn) => { + btn.addEventListener('click', (e) => { + e.preventDefault(); + console.log(e); + const postId = btn.getAttribute('data-id'); + const postTitulo = `titulo-${postId}`; + const textAreaPublication = document.getElementById(postId); + const inputPublication = document.getElementById(postTitulo); + console.log(inputPublication); + textAreaPublication.removeAttribute('disabled'); + inputPublication.removeAttribute('disabled'); + }); + }); + }); + }; + return squareF; +}; diff --git a/src/componets/home.js b/src/componets/home.js new file mode 100644 index 00000000..b8bd32dc --- /dev/null +++ b/src/componets/home.js @@ -0,0 +1,39 @@ +import { navigateTo } from '../router'; + +export const home = () => { + const headerHome = document.createElement('div'); + const square = document.createElement('div'); + const welcome = document.createElement('p'); + const reda = document.createElement('p'); + const img = document.createElement('img'); + const footerHome = document.createElement('div'); + const buttonRegister = document.createElement('button'); + const buttonLogin = document.createElement('button'); + buttonLogin.textContent = 'Iniciar Sesión'; + buttonRegister.textContent = 'Regístrate'; + reda.textContent = 'Reda©️'; + welcome.textContent = 'Únete a la red de cuidadores más grande de Latinoamérica…'; + img.setAttribute('class', 'logo'); + img.setAttribute('src', 'https://i.ibb.co/bWGQN64/REDA-1.png'); + welcome.setAttribute('class', 'welcome'); + reda.setAttribute('class', 'marca'); + square.setAttribute('class', 'square'); + headerHome.setAttribute('class', 'headerHome'); + footerHome.setAttribute('class', 'footerHome'); + buttonLogin.setAttribute('class', 'btnLogin'); + buttonRegister.setAttribute('class', 'btnRegister'); + square.appendChild(headerHome); + headerHome.appendChild(img); + square.appendChild(welcome); + square.appendChild(buttonLogin); + square.appendChild(buttonRegister); + footerHome.appendChild(reda); + square.appendChild(footerHome); + buttonRegister.addEventListener('click', () => { + navigateTo('/register'); + }); + buttonLogin.addEventListener('click', () => { + navigateTo('/login'); + }); + return square; +}; diff --git a/src/componets/img/REDA (5).png b/src/componets/img/REDA (5).png new file mode 100644 index 00000000..064e3394 Binary files /dev/null and b/src/componets/img/REDA (5).png differ diff --git a/src/componets/img/btnGoogle.png b/src/componets/img/btnGoogle.png new file mode 100644 index 00000000..e286c89a Binary files /dev/null and b/src/componets/img/btnGoogle.png differ diff --git a/src/componets/img/btn_google_signin_light_pressed_web.png b/src/componets/img/btn_google_signin_light_pressed_web.png new file mode 100644 index 00000000..e286c89a Binary files /dev/null and b/src/componets/img/btn_google_signin_light_pressed_web.png differ diff --git a/src/componets/img/monstruo.png b/src/componets/img/monstruo.png new file mode 100644 index 00000000..43aae9af Binary files /dev/null and b/src/componets/img/monstruo.png differ diff --git a/src/componets/login.js b/src/componets/login.js new file mode 100644 index 00000000..328ff1a6 --- /dev/null +++ b/src/componets/login.js @@ -0,0 +1,74 @@ +import { signInWithGoogle, signInWithPassword } from '../lib/authentication'; +import { navigateTo, showError } from '../router'; + +export const Login = () => { + // Create a div element to hold the login component + const div = document.createElement('div'); + div.innerHTML = `
+
+ +

Únete a la red de cuidadores más grande de Latinoamérica…

+
+ + + + +
+
+ +
+
+
+ + +
+
+
+
+

Reda©️

+
+
+
+
`; + + div.querySelector('.google').addEventListener('click', (e) => { + e.preventDefault(); + signInWithGoogle() + .then( + (userCredential) => { + navigateTo('/feed'); + const user = userCredential.user; + console.log('esto es .user', user); + console.log('esto es el correo del usuario', userCredential.user.email); + }, + ) + .catch( + (error) => { + showError(error.code); + }, + ); + }); + // para accionar el boton enviar + div.querySelector('.btnEnviarLogin').addEventListener('click', (e) => { + console.log('se hizo click en login'); + e.preventDefault(); + const username = div.querySelector('#username').value; + const password = div.querySelector('#psw').value; + signInWithPassword(username, password) + .then( + (userCredential) => { + console.log('esto es userCredential', userCredential); + navigateTo('/feed'); + }, + ) + .catch( + (error) => { + showError(error.code); + }, + ); + }); + // Return the div element + return div; +}; diff --git a/src/componets/register.js b/src/componets/register.js new file mode 100644 index 00000000..e96fca06 --- /dev/null +++ b/src/componets/register.js @@ -0,0 +1,80 @@ +import { saveUsers } from '../lib/firebase.js'; + +import { registerWithEmail } from '../lib/authentication.js'; +import { navigateTo, registerError } from '../router.js'; + +export const register = () => { + const div = document.createElement('div'); + + div.innerHTML = `
+ + +
+ REDA-1 +
+
+

Registro de Usuario

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
Reda©️

+ `; + // aca metí el form en una constante para que sea mas claro + const form = div.querySelector('#registerForm'); + form.addEventListener('submit', (e) => { + e.preventDefault(); + + console.log('hola', e.target); + const name = e.target.name.value; + const email = e.target.elements.email.value; + const password = e.target.elements.psw.value; + const nationality = e.target.elements.nationality.value; + const Bdate = e.target.elements.Bdate.value; + const ocupation = e.target.elements.ocupation.value; + const redaRol = e.target.elements.RedaRol.value; + registerWithEmail(email, password) + .then((useCredential) => { + console.log('esto es usercredential', useCredential.user); + saveUsers(name, email, password, nationality, Bdate, ocupation, redaRol); + console.log(saveUsers); + navigateTo('/home'); + }) + .catch((error) => { + registerError(error.code); + }); + }); + // pintar el formulario así en vez de "return div" es mas claro y funciona, + return form; +}; diff --git a/src/index.html b/src/index.html index 788db3c9..2d3b4f2d 100644 --- a/src/index.html +++ b/src/index.html @@ -4,9 +4,18 @@ - Document + Reda + + - + +
+
+
+
+ + + \ No newline at end of file diff --git a/src/lib/authentication.js b/src/lib/authentication.js new file mode 100644 index 00000000..567eee38 --- /dev/null +++ b/src/lib/authentication.js @@ -0,0 +1,26 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { + createUserWithEmailAndPassword, + signInWithPopup, + GoogleAuthProvider, + signInWithEmailAndPassword, + onAuthStateChanged, + getAuth +} from 'firebase/auth'; +import { auth } from './firebase.js'; +// para autentficar cuando el usuario se meta + +export const signInWithPassword = (email, password) => ( + signInWithEmailAndPassword(auth, email, password) +); + +export const signInWithGoogle = () => { + const provider = new GoogleAuthProvider(); + return signInWithPopup(auth, provider); +}; +export const registerWithEmail = (email, password) => ( + createUserWithEmailAndPassword(auth, email, password) +); +// export const userState = onAuthStateChanged(auth, (user) => { +// console.log('user status changed:', user); +// }); diff --git a/src/lib/firebase.js b/src/lib/firebase.js new file mode 100644 index 00000000..965eb2af --- /dev/null +++ b/src/lib/firebase.js @@ -0,0 +1,120 @@ +// importar las funciones especificas de firebase a utilizar. +import { initializeApp } from 'firebase/app'; +import { getAuth, signOut } from 'firebase/auth'; +import { + getFirestore, + collection, + addDoc, + getDocs, + deleteDoc, + doc, + onSnapshot, + serverTimestamp, + orderBy, + query, + updateDoc, +} from 'firebase/firestore'; +// import { userState } from './authentication'; + +// configuración del proyecto: +const firebaseConfig = { + apiKey: 'AIzaSyDG0CfYFCo1QM8MFTFUJdhVPZSUkmDU958', + authDomain: 'reda-d08aa.firebaseapp.com', + projectId: 'reda-d08aa', + storageBucket: 'reda-d08aa.appspot.com', + messagingSenderId: '761765204956', + appId: '1:761765204956:web:50f457c05bf2988ec17519', +}; +// se inicializa firebase utilizando la funcion oficial +// la configuración del proyecto pasa como parametro. +// conecta el front end con el back end. +export const app = initializeApp(firebaseConfig); + +// la base de datos queda representada en la const db. +export const db = getFirestore(app); + +// referencia a la colección de la db. +export const colRef = collection(db, 'post'); +// queries fecha de creacion del post +const q = query(colRef, orderBy('createdAt', 'desc')); +// llamamos a la coleccion de datos. + +// inicializamos la autenticacion de usuario +// obtener el usuario con sesion activa, revisar documetacion. +export const auth = getAuth(app); +onSnapshot(q, (snapshot) => { + const arrPostData = []; + snapshot.docs.forEach((docAuth) => { + arrPostData.push({ ...docAuth.data(), id: docAuth.id, userState: auth.currentUser }); + }); + //console.log('esto es arrPost', arrPostData); +}); +export const saveUsers = (name, email, password, nationality, Bdate, ocupation, redaRol) => addDoc(collection(db, 'users'), { + name, + email, + password, + nationality, + Bdate, + ocupation, + redaRol, + userId: auth.currentUser.uid, + like: [], +}); + +export const getpost = () => getDocs(q) + .then( + (snapshot) => { + const showPost = []; + //console.log('esto es showPost'); + snapshot.forEach((docu) => { + showPost.push({ ...docu.data(), id: docu.id }); + }); + return (showPost); + }, + ) + .catch((err) => { + console.log(err.message); + }); + +// eliminar post +export const deletePost = (id) => deleteDoc(doc(db, 'post', id)) + .then(() => { + console.log('todo ok'); + }) + .catch((error) => { + console.log(error.message); + }); +// guardar user +// const user = firebase.auth().currentUser; +// guardar el id del current user, +// si el usuario existe, me devuelve su id. +// let uid; +// if (user != null) { +// uid = user.uid; +// } +// console.log(uid); + +// obtener los post de un usuario en particular. + +export const createpost = (usuario, titulo, descripcion) => addDoc((colRef), { + usuario, + titulo, + descripcion, + createdAt: serverTimestamp(Date), + userId: auth.currentUser.uid, + likes: [], +}); + +// cerrar sesion: +export const exitApp = () => signOut(auth) + .then(() => { + console.log('the user signed out'); + }) + .catch((err) => { + console.log(err.message); + }); + +export const updatePost = (id, newPost) => updateDoc(doc(db, 'post', id), newPost); + +export const addLike = (id, emails) => updateDoc(doc(db, 'post', id), { likes: emails }); +export const updatelike = (id, emails) => updateDoc(doc(db, 'post', id), { likes: emails }); \ No newline at end of file diff --git a/src/lib/index.js b/src/lib/index.js index d1930899..77681097 100644 --- a/src/lib/index.js +++ b/src/lib/index.js @@ -2,5 +2,5 @@ export const myFunction = () => { // aqui tu codigo - console.log('Hola mundo!'); + }; diff --git a/src/main.js b/src/main.js index ac27e91a..e00babb1 100644 --- a/src/main.js +++ b/src/main.js @@ -1,5 +1,8 @@ -// Este es el punto de entrada de tu aplicacion +import { initRouter } from './router'; +import { ROUTES } from './routes'; -import { myFunction } from './lib/index.js'; - -myFunction(); +// Initialize Firebase +// initFirebase(); +// en el main se debe inicilaizar lo que se muestra en el dom +// Initialize Router +initRouter(ROUTES); diff --git a/src/router.js b/src/router.js new file mode 100644 index 00000000..3fe8f87e --- /dev/null +++ b/src/router.js @@ -0,0 +1,93 @@ +import { onAuthStateChanged, updateCurrentUser } from 'firebase/auth'; +import { auth } from './lib/firebase.js'; + +const LOCAL_ROUTES = {}; + +// Navigate to a specific path and update the history +export const navigateTo = (pathname, updateHistory = true) => { + // console.log('estoy en navigate original'); + // If the path is not found, redirect to the home page + // acá establece la ruta de default, en este caso es login. + const path = typeof LOCAL_ROUTES[pathname] !== 'function' ? pathname : '/'; + // Update the history + // va guardando en el objeto vacío ({}) las rutas que ha visitado el usuario. + // sintaxis del método pushState(título de la ventana,url+nombre de la ruta (login,home,register)) + if (updateHistory) { + window.history.pushState({}, path, window.location.origin + pathname); + } + + // Clear the root section and render the new component + // Limpiar el contenido de la pantalla y no sobreescribir el contenido. + const rootSection = document.getElementById('root'); + rootSection.innerHTML = ''; + rootSection.append(LOCAL_ROUTES[pathname]()); +}; + +// Initialize the router with the routes +export const initRouter = (routes) => { + // Add routes to LOCAL_ROUTES + // método .keys convierte un objeto a un array,entonces devuelve array [] + // método .reduce suma los valores de un array y devuelve un solo valor. + // no nos queda muy clara esta parte del codigo.*** + Object.keys(routes).reduce((currentRoutes, pathname) => { + currentRoutes[pathname] = routes[pathname]; + // console.log(currentRoutes); + // console.log(LOCAL_ROUTES); + return currentRoutes; + }, LOCAL_ROUTES); + + // Add event listener to handle back/forward button + window.addEventListener('popstate', () => { + navigateTo(window.location.pathname, false); + }); + // Add event listener to handle page load + window.addEventListener('load', () => { + navigateTo(window.location.pathname, false); + }); +}; + +// funcion de mostrar errores en el login +export const showError = (code) => { + if (code === 'auth/user-not-found') { + const wrong = document.getElementById('wrong'); + wrong.innerHTML = ('❌ 👀 Correo Invalido'); + } else if (code === 'auth/wrong-password') { + const wrong = document.getElementById('wrong'); + wrong.innerHTML = ('Contraseña Incorrecta'); + } else if (code) { + const wrong = document.getElementById('wrong'); + wrong.innerHTML = ('Ups! Algo salio mal'); + } +}; + +export const registerError = (code) => { + if (code === 'auth/invalid-email') { + const divErr = document.getElementById('divParaErrores'); + divErr.innerHTML = ('❌ 👀 el e-mail no es válido'); + } else if (code === 'auth/weak-password') { + const divErr = document.getElementById('divParaErrores'); + divErr.innerHTML = ('❌ 👀 La contraseña es muy débil'); + } else if (code === 'auth/email-already-in-use') { + const divErr = document.getElementById('divParaErrores'); + divErr.innerHTML = ('❌ 👀 el e-mail ya está en uso'); + } else if (code) { + const divErr = document.getElementById('divParaErrores'); + divErr.innerHTML = ('❌ 👀 Algo salió mal'); + } +}; +// observador de firebase, nos da el status +// del usuario, esta logueado o no. +// esta funcion esta en este archivo porque /router +// es un archivo 'principal' (siempre se esta ejecutando) + +onAuthStateChanged(auth, (user) => { + console.log('user status router', user); + if (user) { + // guarda la informacion del usuario logueado y con JSON.stringify + // convierte a los datos en un objeto que puede interactuar con el DOM + sessionStorage.setItem('currentUser', JSON.stringify(user)); + navigateTo('/feed'); + } else { + navigateTo('/home'); + } +}); diff --git a/src/routes.js b/src/routes.js new file mode 100644 index 00000000..54c54bd7 --- /dev/null +++ b/src/routes.js @@ -0,0 +1,13 @@ +import { home } from './componets/home'; +import { Login } from './componets/login'; +import { register } from './componets/register'; +import { feed } from './componets/feed'; + +export const ROUTES = { + '/': home, + '/home': home, + '/login': Login, + '/register': register, + '/feed': feed, + +}; diff --git a/src/style.css b/src/style.css new file mode 100644 index 00000000..5886b03d --- /dev/null +++ b/src/style.css @@ -0,0 +1,671 @@ +/* se corrigen los margenes que tiene HTML por default */ +* { + box-sizing: border-box; + margin: 0; + padding: 0; + font-family: 'Atkinson Hyperlegible', sans-serif; + font-size: 20px; + } + body{ + background-color: #F1FAEE; + + } + .container { + display: flex; + justify-content: center; + background-color: #F1FAEE; + justify-items: center; + margin-top: 70px; + margin-bottom: 70px; + } + .square{ + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + width: 60%; + height: 80%; + background-color: #E0EAF1; + } + .headerHome { + background-color: #B8D1E0; + width: 100% ; + height: 50%; + display: flex; + justify-content: center; + + } + .logo { + display: flex; + width: 40%; + height: 50%; + margin-top: 0%; + + } + .welcome{ + color: #1d3557; + font-size: 120%; + font-weight: 700; + display: flex; + margin: 10%; + margin-top: 5%; + margin-bottom: 5%; + text-align: center; + } +/* lo que tiene que ver con botones, tiene que estar junto, no importa que vista sea, sino, error de eslint */ +.btnLogin , .btnRegister, .btnEnviarLogin, .btnPubF, .btnHomeF, .btnLogOut { + height: 56px; + width: 50%; + align-items: center; + box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); + box-sizing: border-box; + color: white; + display: flex; + font-size: 80%; + font-weight: 700; + justify-content: center; + line-height: 24px; + overflow-wrap: break-word; + padding: 24px; + margin-top: 1%; + margin-bottom: 1%; + text-decoration: none; + border-radius: 8px; + cursor: pointer; + user-select: none; + -webkit-user-select: none; + touch-action: manipulation; +} + +.btnPubF { + width: 30%; + height:50px ; +} +.btnHomeF { + width: 20%; + height: 50px; +} +.btnLogin:hover, .btnRegister:hover,.btnEnviarLogin:hover, .btnPubF:hover, .btnHomeF:hover, .btnLogOut:hover{ + background-color: #B8D1E0; +} +.btnRegister, .btnEnviarLogin, .btnPubF { + background-color: #FFB703; +} +.btnLogin, .btnHomeF { + background-color: #1d3557; +} +.btnLogOut{ + background-color: #1d3557; + margin-top: 2%; + margin-left: 75%; + margin-right: 7%; + width: 300px; + height: 10px; + font-size: 60%; + +} +.footerHome, .footerlog{ + background-color:#B8D1E0; + width: 100%; + height: 50px; + display: flex; + justify-content: center; + align-items: center; +} +.marca{ + color: #f6f7fa; + margin-top: 0%; + font-size: 80%; +} +/*login*/ + +#loginForm { + display: flex; + width: 100%; + height: 100%; +} +.contenedorMadre{ + background-color: #E0EAF1; + display: flex; + width:30em; + height: 33em; + justify-content: center; + align-items: center ; + flex-direction: column; + +} +.contenedorlogo{ + background-color: #B8D1E0; + width: 30em ; + height: 20em; + display: flex; + justify-content: center; + align-items: center; + +} +.loginLogo{ + display: flex; + width: 40%; + + margin-top: 0%; +} +h1{ + color: #1d3557; + font-size: 1.5em; + font-weight: 600; + display: flex; + margin: 10%; + margin-top: 10%; + margin-bottom: 5%; +} +.labelogin{ + background-color: #1d3557; + color: #B8D1E0; + +} +.inputLogin{ + display: flex; + text-align: center; + width: 80%; + height: 25%; + margin: 5%; + flex-direction: column; + + +} +.btnEnviarLogin{ + width: 100%; + +} +.googleBtn{ + display: flex; +} +.close:hover, +.close:focus { + color: black; + text-decoration: none; + cursor: pointer; +} +#wrong{ + background-color: #888; + display: flex; + justify-content: center; + align-items: center ; + flex-direction: column; + +} + +/*vista register desktop*/ +body{ + background-color: #F1FAEE; + +} +.container{ + display: flex; + background-color: #F1FAEE; + margin:0; + padding: 0%; +} + +/*este serà el header*/ +#registerForm{ + background-color: #B8D1E0; + display: flex; + width: 80%; + height: 80%; + margin-top: 10%; + margin-bottom: 10%; + flex-direction: column; + + justify-content: center; + align-items: center; +} + +.tituloReg{ + margin-top: 5%; + color: red; +} + +.containerTitulo{ + background-color: #E0EAF1; + margin-top: 0%; + margin-bottom: 0%; + width: 100%; + display: flex; +} + +.containerRegister{ + background-color: #E0EAF1; + display: grid; + grid-template-columns: 1fr 1fr; + grid-template-rows: 1fr 1fr 1fr 1fr 1fr 1fr 1fr; + margin-top: 0%; + margin-bottom: 1%; + width: 100%; + justify-self: right; + align-items: start; +} + +.labelsReg{ + grid-row: 1/2; +} + +.footerReg{ + display: flex; + justify-content: left; +} + +.contLogoReg{ + background-color:#B8D1E0; +} + +.logoReg{ + display: flex; + width: 30%; + height: 30%; + margin-right: 45%; + margin-top: 0%; + margin-bottom: -5%; +} + +.labelReg{ + width: 80%; +} + +.inputReg{ + width: 80%; + height:60% ; + display: grid; +} +/*Vista desktop feed*/ +.squareF { + display: flex; + align-items: center; + align-content: center; + background-color:#E0EAF1; +width: 70%; +height: 60%; +flex-direction: column; +} +.squareHeaderF { + background-color: #B8D1E0; + width: 100%; + height: 100px; + margin-bottom: 5%; + display: flex; + align-items: stretch; + align-content: space-between; +} +.logoF { + background-color:auto; + width: 150px; + height: 150px; + margin: 0; + +} +.userInfoF{ + display: flex; + align-items: center; + align-content: center; + width:60%; + flex-direction: row; +} + /* .userInfoDivF { + display: flex; + align-items: center; + background-color: #1d3557; + width: 50%; + height: 80%; + } */ + + +.userAvatar { +width: 10%; +height: 10%; +margin: 2%; + + +} +.userExpertChecked { + width: 4%; + height: 4%; +} +.postContainer { + width: 60%; + height: 20%; + background-color: #E0EAF1; + display: flex; + align-items: center; + align-content: center; + flex-direction: column; +} +.postTitle{ + background-color:#B8D1E0; + width: 100%; + height: auto; + margin: 2%; + resize: none; + border-radius:15px; + border-color: #1d3557; + border-width: 2px; +} +.post{ + width: 100%; + height: 400%; + resize: none; + background-color:#B8D1E0; + border-radius:15px; + border-color: #1d3557; + border-width: 2px; + margin-bottom: 5%; +} +.subsquareF{ + align-items: center; + background-color: #E0EAF1; + display: flex; + width: 60%; + height: 20%; + flex-direction: column; +} + +.squareFooterF { + display: flex; + background-color:#B8D1E0; + width: 100%; + height: 50px; + flex-direction: column; + color: #F1FAEE; + text-align: center; + padding: 1%; + font-weight: 100; +} + +#form{ + /* background-color: #1d3557; */ + display: flex; + align-items: center; + align-content: center; + margin-bottom: 2%; + margin-top: 2%; +} +.contenedorPostCompleto { + display: flex; + flex-direction: column; + +} +.contenedorIconosPost{ + flex-direction: row; + display: flex; +} + +textarea, input { + background-color:#1d3557; + color: #FFB703; +} +/*Vista para movil*/ + +@media(max-width:390px){ + /*home*/ + .container{ + display:flex; + background-color: #F1FAEE; + } + + .square{ + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + width: 80%; + height: 80%; + background-color: #E0EAF1; + } + + .headerHome { + background-color: #B8D1E0; + width: 100% ; + height: 200px; + display: flex; + justify-content: center; + } + + .logo { + display: flex; + width: 95%; + height: 125%; + margin-top: 0%; + } + + .welcome{ + color: #1d3557; + font-size: 80%; + font-weight: 700; + display: flex; + margin: 10%; + margin-top: 10%; + margin-bottom: 5%; + } + + .btnLogin , .btnRegister { + height: 56px; + width: 50%; + align-items: center; + box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); + box-sizing: border-box; + color: white; + display: flex; + font-size: 80%; + font-weight: 700; + justify-content: center; + line-height: 24px; + overflow-wrap: break-word; + padding: 24px; + margin-top: 10%; + margin-bottom: 5%; + margin: 3%; + text-decoration: none; + border-radius: 8px; + cursor: pointer; + user-select: none; + -webkit-user-select: none; + touch-action: manipulation; + + } + .btnLogin:hover, .btnRegister:hover{ + background-color: #B8D1E0; + } + .btnRegister{ + background-color: #FFB703; + } + .btnLogin{ + background-color: #1d3557; + } + .footerHome{ + background-color:#B8D1E0; + width: 100%; + height: 50px; + display: flex; + justify-content: center; + } + .marca{ + color: #f6f7fa; + margin-top: 5%; + font-size: 70%; + } + /*login*/ + #loginForm { + display: flex; + width: 100%; + height: 100%; + + + } + .contenedorMadre{ + background-color: #E0EAF1; + display: flex; + width:30em; + height: 33em; + justify-content: center; + align-items: center ; + flex-direction: column; + + } + .contenedorlogo{ + background-color: #B8D1E0; + width: 30em ; + height: 20em; + display: flex; + justify-content: center; + align-items: center; + + } + .loginLogo{ + display: flex; + width: 40%; + + margin-top: 0%; + } + h1{ + color: #1d3557; + font-size: 65%; + font-weight: 600; + display: flex; + margin: 10%; + margin-top: 10%; + margin-bottom: 5%; + } + .labelogin{ + background-color: #1d3557; + color: #B8D1E0; + + } + .inputLogin{ + display: flex; + text-align: center; + width: 55%; + height: 25%; + margin: 5%; + flex-direction: column; + + + } + .btnEnviarLogin{ + width: 100%; + + } + .googleBtn{ + display: flex; + } + .close:hover, + .close:focus { + color: black; + text-decoration: none; + cursor: pointer; + } + #wrong{ + background-color: #888; + display: flex; + justify-content: center; + align-items: center ; + flex-direction: column; + + } + + +/*vista para movil reg*/ +@media(max-width:390px){ + body{ + background-color: #F1FAEE; + } +} +/*este serà el header*/ +#registerForm{ + background-color: #B8D1E0; + display: grid; + width: 80%; + height: 80%; + margin-top: 10%; + margin-bottom: 10%; + justify-content: center; + align-items: center ; +} + +.tituloReg{ + margin-top: 5%; + color: red; +} + +.containerTitulo{ + + background-color: #E0EAF1; + margin-top: 0%; + margin-bottom: 0%; + width: 100%; + display: flex; + +} +.containerRegister{ + + background-color: #E0EAF1; + display: grid; + grid-template-columns: 1fr 1fr; + grid-template-rows: 1fr 1fr 1fr 1fr 1fr 1fr 1fr; + + + margin-top: 0%; + margin-bottom: 1%; + width: 100%; + justify-self: right; + align-items: start; + + + +} +.labelsReg{ + grid-row: 1/2; + +} +.footerReg{ +display: flex; +justify-content: left; + + + +} +.contLogoReg{ + background-color:#B8D1E0; + +} +.logoReg{ + display: flex; + width: 30%; + height: 30%; + margin-right: 45%; + margin-top: 0%; + margin-bottom: -5%; + +} + +.labelReg{ + + width: 80%; + +} +.inputReg{ + width: 80%; + height:60% ; + display: grid; + +} +} + +.show{ + display: block; +} +.noShow { + display: none; +} +#corazon { + color: red; + +} \ No newline at end of file diff --git a/test/index.spec.js b/test/index.spec.js index 91f11a33..d59565b0 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -1,8 +1,86 @@ // importamos la funcion que vamos a testear -import { myFunction } from '../src/lib/index'; +import { register } from '../src/componets/register'; +import * as router from '../src/router'; +import { Login } from '../src/componets/login'; +import { signInWithPassword, registerWithEmail, signInWithGoogle } from '../src/lib/authentication'; -describe('myFunction', () => { - it('debería ser una función', () => { - expect(typeof myFunction).toBe('function'); +jest.mock('../src/lib/authentication'); + +describe('register', () => { + it('si el usuario se registrò correctamente debe direccionarse a home', () => { + router.navigateTo = jest.fn().mockImplementation(() => { + expect(router.navigateTo).toHaveBeenCalled(); + done(); + }); + registerWithEmail.mockResolvedValue(Promise.resolve()); + document.body.appendChild(register()); + document.querySelector('#name').value = 'reda'; + document.querySelector('#email').value = 'reda@gmail.com'; + document.querySelector('#psw').value = '123456'; + document.querySelector('#nationality').value = 'nacional'; + document.querySelector('#Bdate').value = '12-12-2003'; + document.querySelector('#ocupation').value = 'teacher'; + document.querySelector('#redaRol').value = 'especialista'; + document.querySelector('#btnregister').dispatchEvent(new Event('click')); + }); +}); +it('si el usuario no comepleta los datos correctamente envia error ', (done) => { + router.registerError = jest.fn().mockImplementation(() => { + expect(router.registerError).toHaveBeenCalled(); + done(); + }); + registerWithEmail.mockResolvedValue(Promise.reject({ code: 'error' })); + document.body.appendChild(register()); + document.querySelector('#btnregister').click(); +}); + + +describe('login', () => { + it('si el usuario se registrò correctamente debe direccionarse a feed', (done) => { + router.navigateTo = jest.fn().mockImplementation(() => { + expect(router.navigateTo).toHaveBeenCalled(); + done(); + }); + signInWithPassword.mockResolvedValue(Promise.resolve()); + document.body.appendChild(Login()); + document.querySelector('#username').value = 'reda@gmail.com'; + document.querySelector('#psw').value = '12345'; + document.querySelector('.btnEnviarLogin').dispatchEvent(new Event('click')); + // document.querySelector('.btnEnviarLogin').click() + }); + + it('el login falla con un error', (done) => { + router.showError = jest.fn().mockImplementation(() => { + expect(router.showError).toHaveBeenCalled(); + done(); + }); + signInWithPassword.mockResolvedValue(Promise.reject({ code: 'error' })); + document.body.appendChild(Login()); + document.querySelector('.btnEnviarLogin').click(); + console.log('wrong'); + }); +}); + +describe('login with google', () => { + it('si el usuario se registrò correctamente con google debe direccionarse a feed', (done) => { + router.navigateTo = jest.fn().mockImplementation(() => { + expect(router.navigateTo).toHaveBeenCalled(); + done(); + }); + signInWithGoogle.mockResolvedValue(Promise.resolve()); + document.body.appendChild(Login()); + document.querySelector('.google').dispatchEvent(new Event('click')); + // document.querySelector('.btnEnviarLogin').click() + }); + + it('el login falla con un error', (done) => { + router.showError = jest.fn().mockImplementation(() => { + expect(router.showError).toHaveBeenCalled(); + done(); + }); + signInWithGoogle.mockResolvedValue(Promise.reject({ code: 'error' })); + document.body.appendChild(Login()); + document.querySelector('.google').click(); + console.log('wrong'); }); });