diff --git a/Readme.md b/Readme.md index ed84ec5c..70e0199c 100644 --- a/Readme.md +++ b/Readme.md @@ -1,3 +1,43 @@ +# SOCIAL NETWORK +## PROYECTO: EDU-LINE +## RESUMEN: +Red Social sobre temas de educación + +## INVESTIGACIÓN UX: +Aplicación dirigida a usuarios especialistas en el tema y padres de familia que se podrán comunicar a través de esta red social; compartir tips, técnicas y demás información que ayude mejorar la educación de sus hijos o dar pautas para que los profesionales mejoren su forma de enseñar. + +## Historias de Usuario: + +* Como usuario nuevo debo poder crear una cuenta con email y password válidos para poder iniciar sesion e ingresar a la red social. + +* Como usuario nuevo debo poder tener la opción de iniciar sesión con mi cuenta de Google o Facebook para ingresar a la red social sin necesidad de crear una cuenta de email válido. + +* Como usuario loggeado debo poder crear, guardar, modificar en el mismo lugar (in place) y eliminar una publicación (post) privada o pública, que puede ser una frase o una imagen. + +* Como usuario loggeado debo poder ver todos los posts públicos y privados que he creado hasta ese momento, desde el más reciente hasta el más antiguo, así como la opción de poder cambiar la configuración de privacidad de mis post. + +* Yo como usuario loggeado, puedo dar like y llevar un conteo de likes en mi publicación así como poder escribir, guardar, editar o eliminar un comentario en mi publicación. + +* Al final debo poder ingresar a la red social y poder visualizar los datos de mi perfil creado o editarlos. + +## FEEDBACK: SI + +## PROTOTIPO BAJA FIDELIDAD: + +![alt text](https://raw.githubusercontent.com/Zeltzin1996/CDMX009-Social-Network/master/SocialNet1.jpg) +![alt text](https://raw.githubusercontent.com/Zeltzin1996/CDMX009-Social-Network/master/SocialNet2.jpg) +![alt text](https://raw.githubusercontent.com/Zeltzin1996/CDMX009-Social-Network/master/SocialNet3.jpg) +![alt text](https://raw.githubusercontent.com/Zeltzin1996/CDMX009-Social-Network/master/SocialNet4.jpg) +![alt text](https://raw.githubusercontent.com/Zeltzin1996/CDMX009-Social-Network/master/SocialNet5.jpg) + +## PROTOTIPO ALTA FIDELIDAD (FIGMA): + +![alt text](https://raw.githubusercontent.com/Zeltzin1996/CDMX009-Social-Network/master/SocialNetFigma.jpg) + +## PROTOTIPO FINAL: + + + # Creando una Red Social Bienvenida a tu primer proyecto del track de Frontend en Laboratoria. @@ -147,43 +187,43 @@ anterior en la siguiente sección. ### HTML y CSS -* [ ] [HTML semántico](https://developer.mozilla.org/en-US/docs/Glossary/Semantics#Semantics_in_HTML) -* [ ] [CSS `flexbox`](https://css-tricks.com/snippets/css/a-guide-to-flexbox/) -* [ ] Construir tu aplicación respetando el diseño realizado (maquetación). +* [✔] [HTML semántico](https://developer.mozilla.org/en-US/docs/Glossary/Semantics#Semantics_in_HTML) +* [🤔] [CSS `flexbox`](https://css-tricks.com/snippets/css/a-guide-to-flexbox/) +* [✔] Construir tu aplicación respetando el diseño realizado (maquetación). ### DOM y Web APIs -* [ ] [Manipulación dinámica del DOM](https://developer.mozilla.org/es/docs/Referencia_DOM_de_Gecko/Introducci%C3%B3n) -* [ ] [History API](https://developer.mozilla.org/es/docs/DOM/Manipulando_el_historial_del_navegador) -* [ ] [`localStorage`] +* [✔] [Manipulación dinámica del DOM](https://developer.mozilla.org/es/docs/Referencia_DOM_de_Gecko/Introducci%C3%B3n) +* [✔] [History API](https://developer.mozilla.org/es/docs/DOM/Manipulando_el_historial_del_navegador) +* [✔] [`localStorage`] ### Javascript -* [ ] [Uso de callbacks](https://developer.mozilla.org/es/docs/Glossary/Callback_function) -* [ ] [Consumo de Promesas](https://scotch.io/tutorials/javascript-promises-for-dummies#toc-consuming-promises) -* [ ] Uso ES modules -([`import`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import) -| [`export`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export)) +* [🤔] [Uso de callbacks](https://developer.mozilla.org/es/docs/Glossary/Callback_function) +* [🤔] [Consumo de Promesas](https://scotch.io/tutorials/javascript-promises-for-dummies#toc-consuming-promises) +* [🤔] Uso ES modules +* [✔] ([`import`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import) +* [✔] `export`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export)) ### Firebase * [ ] [Firestore](https://firebase.google.com/docs/firestore) -* [ ] [Firebase Auth](https://firebase.google.com/docs/auth/web/start) -* [ ] [Firebase security rules](https://firebase.google.com/docs/rules) -* [ ] [Uso de onSnapshot](https://firebase.google.com/docs/firestore/query-data/listen) +* [✔] ] [Firebase Auth](https://firebase.google.com/docs/auth/web/start) +* [🤔] [Firebase security rules](https://firebase.google.com/docs/rules) +* [🤔] [Uso de onSnapshot](https://firebase.google.com/docs/firestore/query-data/listen) | [onAuthStateChanged](https://firebase.google.com/docs/auth/web/start#set_an_authentication_state_observer_and_get_user_data) ### Testing -* [ ] [Testeo de tus funciones](https://jestjs.io/docs/es-ES/getting-started) +* [🤔] [Testeo de tus funciones](https://jestjs.io/docs/es-ES/getting-started) * [ ] [Testeo asíncrono](https://jestjs.io/docs/es-ES/asynchronous) * [ ] [Mocking](https://jestjs.io/docs/es-ES/manual-mocks) ### Colaboración en Github -* [ ] Branches -* [ ] Pull Requests -* [ ] Tags +* [✔] Branches +* [✔] Pull Requests +* [✔] Tags ### Organización en Github @@ -194,8 +234,8 @@ anterior en la siguiente sección. ### Buenas prácticas de desarrollo -* [ ] Modularización -* [ ] Nomenclatura / Semántica +* [✔] Modularización +* [🤔 ] Nomenclatura / Semántica * [ ] Linting *** diff --git a/SocialNet1.jpg b/SocialNet1.jpg new file mode 100644 index 00000000..ffb50b42 Binary files /dev/null and b/SocialNet1.jpg differ diff --git a/SocialNet2.jpg b/SocialNet2.jpg new file mode 100644 index 00000000..00cb9279 Binary files /dev/null and b/SocialNet2.jpg differ diff --git a/SocialNet3.jpg b/SocialNet3.jpg new file mode 100644 index 00000000..c47b63a2 Binary files /dev/null and b/SocialNet3.jpg differ diff --git a/SocialNet4.jpg b/SocialNet4.jpg new file mode 100644 index 00000000..d245f69e Binary files /dev/null and b/SocialNet4.jpg differ diff --git a/SocialNet5.jpg b/SocialNet5.jpg new file mode 100644 index 00000000..7b1b1b4d Binary files /dev/null and b/SocialNet5.jpg differ diff --git a/SocialNetFigma.jpg b/SocialNetFigma.jpg new file mode 100644 index 00000000..4baacdec Binary files /dev/null and b/SocialNetFigma.jpg differ diff --git a/npm-debug.log b/npm-debug.log new file mode 100644 index 00000000..9e673a0d --- /dev/null +++ b/npm-debug.log @@ -0,0 +1,29 @@ +0 info it worked if it ends with ok +1 verbose cli [ '/usr/bin/node', +1 verbose cli '/usr/bin/npm', +1 verbose cli 'config', +1 verbose cli 'set', +1 verbose cli 'prefix', +1 verbose cli '/npm', +1 verbose cli '-g' ] +2 info using npm@3.5.2 +3 info using node@v8.10.0 +4 info config set "prefix" "/npm" +5 verbose stack Error: EACCES: permission denied, open '/etc/npmrc' +6 verbose cwd /home/laboratoria112-am/Documentos/laboratoria/CDMX009-Social-Network +7 error Linux 4.15.0-72-generic +8 error argv "/usr/bin/node" "/usr/bin/npm" "config" "set" "prefix" "/npm" "-g" +9 error node v8.10.0 +10 error npm v3.5.2 +11 error path /etc/npmrc +12 error code EACCES +13 error errno -13 +14 error syscall open +15 error Error: EACCES: permission denied, open '/etc/npmrc' +15 error { Error: EACCES: permission denied, open '/etc/npmrc' +15 error errno: -13, +15 error code: 'EACCES', +15 error syscall: 'open', +15 error path: '/etc/npmrc' } +16 error Please try running this command again as root/Administrator. +17 verbose exit [ -13, true ] diff --git a/package.json b/package.json index 9a365577..ec06a739 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,6 @@ "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", "start": "serve src/" }, @@ -26,11 +25,16 @@ "eslint-config-airbnb-base": "^13.2.0", "eslint-plugin-import": "^2.18.2", "eslint-plugin-jest": "^22.1.2", + "firebase-functions-test": "^0.2.1", "htmlhint": "^0.11.0", - "jest": "^24.8.0", + "jest": "^24.9.0", "regenerator-runtime": "^0.13.1", "serve": "^11.0.2", "stylelint": "^10.1.0", "stylelint-config-recommended": "^2.2.0" + }, + "dependencies": { + "firebase-admin": "^8.11.0", + "firebase-functions": "^3.6.1" } -} \ No newline at end of file +} diff --git a/src/.vscode/settings.json b/src/.vscode/settings.json new file mode 100644 index 00000000..279b0821 --- /dev/null +++ b/src/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5501 +} \ No newline at end of file diff --git a/src/auth.js b/src/auth.js new file mode 100644 index 00000000..fe7eb371 --- /dev/null +++ b/src/auth.js @@ -0,0 +1,62 @@ + + +// LOGIN CON EMAIL Y PWD + + function emailLogin(email, password) { + //(!email || !password) return 'No existe email o password' + //if (password.length < 6) return 'No cumple con 6 caracteres' + + firebase.auth() + .signInWithEmailAndPassword(email, password) + .catch(function(error) { + // Handle Errors here. + const errorCode = error.code; + const errorMessage = error.message; + if (errorCode === "auth/invalid-email"){ + alert("Email inválido") + } if (errorCode === "auth/user-disabled"){ + alert("Usuario deshabilitado") + } if (errorCode === "auth/user-not-found"){ + alert("Usuario no encontrado") + } if (errorCode === "auth/wrong-password"){ + alert("Contraseña incorrecta") + } + console.log(`${errorCode} ${errorMessage}`) + // ... + }); + } + + + function logout() { + firebase.auth().signOut().then(function() { + // Sign-out successful. + //return true + }).catch(function(error) { + // An error happened. + //return false + console.log(error) + }); +} + +// CREAR CUENTA MAIL Y PWD +function createAccount(mail, pwd) { + firebase.auth().createUserWithEmailAndPassword(mail, pwd) + .then(function(){ + window.socialNetwork.verification(); + }) + .catch(function(error) { + // Handle Errors here. + const errorCode = error.code; + const errorMessage = error.message; + if (errorCode === "auth/email-already-in-use"){ + alert("Correo en uso") + //return "Correo en uso" + } if (errorCode === "auth/invalid-email"){ + alert("Email inválido") + //return "Email inválido" + } if (errorCode === "auth/weak-password"){ + alert("Contraseña tiene que tener más de 6 caracteres") + } + console.log(`${errorCode} ${errorMessage}`) + }); +} \ No newline at end of file diff --git a/src/auth.test.js b/src/auth.test.js new file mode 100644 index 00000000..68b70cee --- /dev/null +++ b/src/auth.test.js @@ -0,0 +1,74 @@ +/*import * as auth from "./auth.js" + +/global.firebase = { + auth: jest.fn(() => ({ + signInWithEmailAndPassword: jest.fn(() => new Promise((resolve, reject) => { + resolve(true) + })) + })) +} + +test('Validaciones de emailLogin', () => { + let email = "antropologia@gmail.com" + let password = "123D" + + expect(auth.emailLogin(email, password)).toBe('No cumple con 6 caracteres'); + expect(auth.emailLogin('', password)).toBe('No existe email o password'); +}); + +test('emailLogin se ejecuta correctamente', () => { + let email = "antropologia@gmail.com" + let password = "123DKL" + + auth.emailLogin(email, password).then(valor => { + expect(valor).toBe(true) + }); +}); + + + +global.firebase = { + auth: jest.fn(() => ({ + createUserWithEmailAndPassword: jest.fn(() => new Promise((resolve, reject) => { + resolve(true) + })) + })) +} + +function falsaCreateAccount(email, pass){ + if(!email.includes("@")){ + return "Email inválido" + } +} + +test('Validacion incorrecta', () => { + let email = "suregmail.com" + let password = "123D" + + expect(falseCreateAccount(email, password)).toBe('Email inválido'); + expect(auth.createAccount(password)).toBe('No cumple con los 6 caracteres'); +}); + + +test('Validacion correcta', () => { + let email = "sure@gmail.com" + let password = "123DOP" + + auth.createAccount(email, password).then(valor => { + expect(valor).toBe(true) + }); +});*/ + +/*function falsesignInWithEmailAndPassword(email, password){ + if(!email.includes("@")){ + return "email invalido" +} +} + +test('Validacion incorrecta', () => { + let email = "suregmail.com" + let password = "123D" + + expect(falsesignInWithEmailAndPassword(email, password)).toBe('Email inválido'); + expect(auth.emailLogin(password)).toBe('No cumple con los 6 caracteres'); +});*/ diff --git a/src/data.js b/src/data.js new file mode 100644 index 00000000..181e7d3d --- /dev/null +++ b/src/data.js @@ -0,0 +1,175 @@ + + +window.socialNetwork = { + + createNewUserStorage: ()=> { + firebase.database().ref("users/"+firebase.auth().currentUser.uid).once("value", function(snapshot) { + if (snapshot.val() === null) { + firebase.database().ref("/users/" + firebase.auth().currentUser.uid).set({ + "profile": { + "username": firebase.auth().currentUser.displayName !== null ? firebase.auth().currentUser.displayName : firebase.auth().currentUser.email, + "especialidad": false, + "profilePic": firebase.auth().currentUser.photoURL ? firebase.auth().currentUser.photoURL : './img/userLogo.png', + "email": firebase.auth().currentUser.email + }, + "posts": false, + "comments": false + }) + // firebase.database().ref("users/"+firebase.auth().currentUser.uid).once("value", function(snapshot) { + // window.currentUser = snapshot.val(); + // }) + } + else { + // firebase.database().ref("users/"+firebase.auth().currentUser.uid).once("value", function(snapshot) { + // window.currentUser = snapshot.val(); + // }) + // console.log(snapshot.val()) + // console.log("usuario ya existia") + return snapshot //Promesa JS + } + }) + + }, + + + printPosts: (cbDOM)=> { + firebase.database().ref("/posts").on("value", cbDOM) + }, + + printPostsDOM: (snapshot)=>{ + document.getElementById("content").innerHTML = "" + let postKeys = Object.keys(snapshot.val()); + postKeys.reverse(); + for(let post of postKeys) { + // console.log(Object.values(snapshot.val()[post].comments).length) + document.getElementById("content").innerHTML += ` +
+
+ userPic

${snapshot.val()[post].author} ${snapshot.val()[post].especialidad ? "- "+snapshot.val()[post].especialidad : ""}

+ +
+
+ + +
+
+ + comment${snapshot.val()[post]["comments"] ? Object.values(snapshot.val()[post]["comments"]).length : "0"} + Editar + Eliminar + Comentar +
+
+
+ +
+
+ + ` + + document.getElementById("comments-section-"+post).style.display = "none" + + if (snapshot.val()[post].likes !== undefined && Object.keys(snapshot.val()[post].likes).indexOf(firebase.auth().currentUser.uid) !== -1) { + document.getElementById(post).innerHTML = ` + star${snapshot.val()[post].likes ? Object.values(snapshot.val()[post].likes).length : "0"} + ` + } + // console.log("creando funciones") + let likeButtons = document.getElementsByClassName("like"); + for (let i = 0; i < likeButtons.length; i++) { + likeButtons[i].addEventListener("click", setLikePost) + } + let commentsButtons = document.getElementsByClassName("comments"); + for (let i = 0; i < commentsButtons.length; i++) { + commentsButtons[i].addEventListener("click", showComments) + } + let createCommentsButtons = document.getElementsByClassName("create-comment"); + for (let i = 0; i < createCommentsButtons.length; i ++) { + createCommentsButtons[i].addEventListener("click", createComment) + } + + let deletePost = document.getElementsByClassName("remove-post"); + for (let i = 0; i < deletePost.length; i ++) { + deletePost[i].addEventListener("click", removePost) + } + + let modifyPost = document.getElementsByClassName("edit-post"); + for (let i = 0; i < modifyPost.length; i++){ + modifyPost[i].addEventListener("click", enableTextarea) + } + + let confirmEdit = document.getElementsByClassName("update-post"); + for (let i= 0; i < confirmEdit.length; i++){ + confirmEdit[i].addEventListener("click", confirm_edit) + } + + let cancelEdit = document.getElementsByClassName("cancel-post"); + for (let i= 0; i < cancelEdit.length; i++){ + cancelEdit[i].addEventListener("click", cancel_editPost) + } + + + + + + // document.getElementById(post).addEventListener("click", setLikePost) + // document.getElementById("comments"+post).addEventListener("click", showComments) + + } + + }, + + updateProfile: (username, profiency, userPic)=>{ + + firebase.database().ref(`users/${firebase.auth().currentUser.uid}`).once("value", function(snapshot){ + firebase.database().ref(`users/${firebase.auth().currentUser.uid}/profile`).update({ + username: username ? username : snapshot.val().profile.username, + especialidad: profiency ? profiency : snapshot.val().profile.especialidad, + profilePic: userPic ? userPic : snapshot.val().profile.profilePic + }) + + + }) + + }, + //TAG ARRAY + searchTag: (tag)=> { + let filteredPosts = {}; + firebase.database().ref("posts/").on("value", function(snapshot){ + // console.log(snapshot.val()) + for (let i = 0; i{ + let user = firebase.auth().currentUser; + user.sendEmailVerification().then(function() { + // Email sent- email enviado + console.log("Enviando correo.."); + }).catch(function(error) { + // An error happened. + console.log(error); + }); + } + + + + + + +} + diff --git a/src/example.js b/src/example.js deleted file mode 100644 index 52d2c7ea..00000000 --- a/src/example.js +++ /dev/null @@ -1,3 +0,0 @@ -export const example = () => { - // aquí tu código -} \ No newline at end of file diff --git a/src/images/LogoApp1.png b/src/images/LogoApp1.png new file mode 100644 index 00000000..29b0ee0b Binary files /dev/null and b/src/images/LogoApp1.png differ diff --git a/src/images/LogoApp2.png b/src/images/LogoApp2.png new file mode 100644 index 00000000..ff5fa674 Binary files /dev/null and b/src/images/LogoApp2.png differ diff --git a/src/images/LogoAppAr.png b/src/images/LogoAppAr.png new file mode 100644 index 00000000..e732c091 Binary files /dev/null and b/src/images/LogoAppAr.png differ diff --git a/src/images/LogoAppV.png b/src/images/LogoAppV.png new file mode 100644 index 00000000..6bac2850 Binary files /dev/null and b/src/images/LogoAppV.png differ diff --git a/src/images/SocialNet1.jpg b/src/images/SocialNet1.jpg new file mode 100644 index 00000000..ffb50b42 Binary files /dev/null and b/src/images/SocialNet1.jpg differ diff --git a/src/images/SocialNet2.jpg b/src/images/SocialNet2.jpg new file mode 100644 index 00000000..00cb9279 Binary files /dev/null and b/src/images/SocialNet2.jpg differ diff --git a/src/images/SocialNet3.jpg b/src/images/SocialNet3.jpg new file mode 100644 index 00000000..c47b63a2 Binary files /dev/null and b/src/images/SocialNet3.jpg differ diff --git a/src/images/SocialNet4.jpg b/src/images/SocialNet4.jpg new file mode 100644 index 00000000..d245f69e Binary files /dev/null and b/src/images/SocialNet4.jpg differ diff --git a/src/images/SocialNet5.jpg b/src/images/SocialNet5.jpg new file mode 100644 index 00000000..7b1b1b4d Binary files /dev/null and b/src/images/SocialNet5.jpg differ diff --git a/src/images/SocialNetFigma.jpg b/src/images/SocialNetFigma.jpg new file mode 100644 index 00000000..4baacdec Binary files /dev/null and b/src/images/SocialNetFigma.jpg differ diff --git a/src/images/f.png b/src/images/f.png new file mode 100644 index 00000000..4bab8bdd Binary files /dev/null and b/src/images/f.png differ diff --git a/src/images/g.png b/src/images/g.png new file mode 100644 index 00000000..465eec1a Binary files /dev/null and b/src/images/g.png differ diff --git a/src/images/logoAppBco.png b/src/images/logoAppBco.png new file mode 100644 index 00000000..cb80f507 Binary files /dev/null and b/src/images/logoAppBco.png differ diff --git a/src/index.html b/src/index.html index bb6937cc..e27ad654 100644 --- a/src/index.html +++ b/src/index.html @@ -4,9 +4,32 @@ - Document + + + + + + + + + EduLine - + +
+
+ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/index.js b/src/index.js deleted file mode 100644 index 35868bab..00000000 --- a/src/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import { example } from './example.js'; - -example(); diff --git a/src/main.js b/src/main.js new file mode 100644 index 00000000..fc6e175a --- /dev/null +++ b/src/main.js @@ -0,0 +1,375 @@ + +document.addEventListener("DOMContentLoaded", event => {' ' + + // Initialize Firebase + var firebaseConfig = { + apiKey: "AIzaSyA9o_vnAaRup2c4BwwAWyWKFsVT5DMLft8", + authDomain: "edu-line-ffdbc.firebaseapp.com", + databaseURL: "https://edu-line-ffdbc.firebaseio.com", + projectId: "edu-line-ffdbc", + storageBucket: "edu-line-ffdbc.appspot.com", + messagingSenderId: "243851799693", + appId: "1:243851799693:web:1d67b4f9ccaf7e21c506c4", + measurementId: "G-D5ZWECPYD2" + }; + // Initialize Firebase + firebase.initializeApp(firebaseConfig); + + loginPage(); + + + // Intro to the App + function startApp() { + + document.getElementById("root").innerHTML = ` +
+
+ ` + } + + // FUNCION QUE CREA PAGINA INICIAL + function loginPage() { + + document.getElementById("root").innerHTML = ` +
+
+
+ +

Bienvenidx

+

¡Encuentra la solución a tus problemas!

+ + + + +

¿No tienes cuenta? Registrate AQUÍ

+

------------------ O ------------------

+ + +
+ ` + + + //LOGIN BUTTON WITH GOOGLE + document.getElementById("google-login").addEventListener("click", googleLogin) + function googleLogin() { + const provider = new firebase.auth.GoogleAuthProvider(); + firebase.auth().signInWithRedirect(provider); + } + + // LOGIN BUTTON WITH FACEBOOK + document.getElementById("facebook-login").addEventListener("click", facebookLogin) + function facebookLogin() { + const provider = new firebase.auth.FacebookAuthProvider(); + firebase.auth().signInWithRedirect(provider); + } + + // LOGIN BUTTON WITH EMAIL AND PASSWORD + document.getElementById("login-btn").addEventListener("click", ()=> { + const email = document.getElementById("login-mail").value; + const password = document.getElementById("login-pwd").value; + emailLogin(email, password); + }) + + // BUTTON LEADING TO CREATE ACCOUNT PAGE + document.getElementById("new-account").addEventListener("click", ()=> { + document.getElementById("root").innerHTML = ` +
+
+

Ingresa un correo y una contraseña para tu cuenta

+ + + + + Volver +
+ + + ` + // BUTTON COMING BACK + document.getElementById("volver").addEventListener("click", loginPage) + + // BUTTON CREATE ACCOUNT + document.getElementById("login-btn").addEventListener("click", ()=>{ + const mail = document.getElementById("login-mail"). value; + const pwd = document.getElementById("login-pwd").value; + createAccount(mail, pwd); + }) + }) + + + } + + + + + // CREATE POST VIEW + firebase.auth().onAuthStateChanged(function(user) { + if (user) { + // User is signed in + window.socialNetwork.createNewUserStorage(); + firebase.database().ref("users/"+firebase.auth().currentUser.uid).on("value", function(snapshot){ + // console.log(snapshot.val()) + document.getElementById("root").innerHTML = ` + + + +
+ +
+
+
+
+
userPic
+
${snapshot.val().profile.username}
+ + + + +
+ + ` + + document.getElementById("btnUp").addEventListener("click", scrollWin); + + // REFERESH WITH LOGO + document.getElementById("logo").addEventListener("click", ()=> { + window.socialNetwork.printPosts(window.socialNetwork.printPostsDOM); + }) + + + function scrollWin() { + // console.log("funciona") + // document.getElementById("content").scrollTo(0, 0); + window.scrollTo(0,0); + } + + window.socialNetwork.printPosts(window.socialNetwork.printPostsDOM); + + + //SEARCH BY TAG + document.getElementById("search-tag").addEventListener("click", ()=> { + + if(document.getElementById("search").value === ""){ + // console.log("no hay tags") + return + } + + let tags = document.getElementById("search").value.split(" "); + + printTaggedPosts(window.socialNetwork.searchTag(tags)) + + }) + + // BUTTON CREATE A POST PAGE + document.getElementById("new-post").addEventListener("click", postingPage) + document.getElementById("new-post2").addEventListener("click", postingPage) + + + // NAVIGATION BAR + document.getElementById("user-profile").addEventListener("click", ()=> { + document.getElementById("user-profile-side-nav").style.display = "block"; + }) + document.getElementById("user-profile2").addEventListener("click", ()=> { + document.getElementById("user-profile-side-nav").style.display = "block"; + }) + + // SIDE NAVIGATION + document.getElementById("content").addEventListener("click", ()=> { + document.getElementById("user-profile-side-nav").style.display = "none"; + }) + document.getElementById("content2").addEventListener("click", ()=> { + document.getElementById("user-profile-side-nav").style.display = "none"; + }) + + + // EDIT USER PROFILE + document.getElementById("profile-info").addEventListener("click", ()=> { + document.getElementById("user-profile-side-nav").style.display = "none"; + firebase.database().ref("users/"+firebase.auth().currentUser.uid).once("value", function(snapshot){ + document.getElementById("content").style.display = "none"; + document.getElementById("content2").style.display = "block"; + document.getElementById("content2").innerHTML = ` +
+

Foto de Perfil

+ +

Para cambiar su imagen de perfil ingrese un link a la nueva imagen en la casilla de abajo:

+ +

Nombre de Usuario

+ +

Email

+ +

Especialidad

+ + + Cancelar + +
+ + ` + + }) + // BUTTON THAT UPDATES THE PROFILE + document.getElementById("update-profile").addEventListener("click", ()=> { + let username = document.getElementById("username").value; + let proficency = document.getElementById("proficency").value; + let userPic = document.getElementById("userpic").value; + window.socialNetwork.updateProfile(username, proficency, userPic); + }) + + // BUTTON CANCELS PROFILE UPDATE AND RETURNS TO POSTS PAGE + document.getElementById("profile-update-cancel").addEventListener("click", ()=> { + document.getElementById("content").style.display = "block"; + document.getElementById("content2").style.display = "none"; + window.scrollTo(0,0); + }) + + }) + + document.getElementById("logout").addEventListener("click", logout) + + }) + } else { + // No user is signed in. + loginPage(); + } + }); + + // TO VERIFY THAT THE AUTHENTICATION WENT WELL + firebase.auth().getRedirectResult().then(function(result) { + if (result.credential) { + // This gives you a Facebook Access Token. You can use it to access the Facebook API. + const token = result.credential.accessToken; + // ... + } + // The signed-in user info. + const user = result.user; + }).catch(function(error) { + // Handle Errors here. + var errorCode = error.code; + var errorMessage = error.message; + console.log(`${errorCode} ${errorMessage}`) + // The email of the user's account used. + var email = error.email; + // The firebase.auth.AuthCredential type that was used. + var credential = error.credential; + // ... + }); + + + }) + + function postingPage () { + + document.getElementById("content").style.display = "block"; + document.getElementById("content2").style.display = "none"; + document.getElementById("content").innerHTML = ` +
+
+
+
+ + +
+ + ` + //BUTTON THAT GENERATES POST + document.getElementById("post-it").addEventListener("click", ()=> { + const tags = document.getElementById("post-tags").value; + const privacy = document.getElementById("privacy-setting").value; + const userId = firebase.auth().currentUser.uid; + const post_text = document.getElementById("post-text").value; + + if (post_text === "" || tags === "" || privacy === "") { + alert("Por favor, ingrese todos los campos requeridos: ingrese al menos una etiqueta y especifique la privacidad de su mensaje") + return + } + submitpost(tags, privacy, userId, post_text) + } )//este es el de submit post + + //BUTTON THAT RETURNS TO THE POSTS + document.getElementById("cancel").addEventListener("click", ()=> { + window.socialNetwork.printPosts(window.socialNetwork.printPostsDOM) + window.scrollTo(0,0); + + }) + + + } + + + + + // POST ARRAY + function printTaggedPosts(posts) { + document.getElementById("content").innerHTML = ""; + for (let post in posts){ + // console.log(post) + // console.log(Object.values(snapshot.val()[post].comments).length) + document.getElementById("content").innerHTML += ` +
+
+ userPic

${posts[post].author} ${posts[post].especialidad ? "- "+posts[post].especialidad : ""}

+
+
+ ${posts[post].content} +
+ +
+
+ +
+
+ ` + + document.getElementById("comments-section-"+post).style.display = "none" + + if (posts[post].likes !== undefined && Object.keys(posts[post].likes).indexOf(firebase.auth().currentUser.uid) !== -1) { + document.getElementById(post).innerHTML = ` + star${posts[post].likes ? Object.values(posts[post].likes).length : "0"} + ` + } + // console.log("creando funciones") + let likeButtons = document.getElementsByClassName("like"); + for (let i = 0; i < likeButtons.length; i++) { + likeButtons[i].addEventListener("click", setLikePost) + } + let commentsButtons = document.getElementsByClassName("comments"); + for (let i = 0; i < commentsButtons.length; i++) { + commentsButtons[i].addEventListener("click", showComments) + } + let createCommentsButtons = document.getElementsByClassName("create-comment"); + for (let i = 0; i < createCommentsButtons.length; i ++) { + createCommentsButtons[i].addEventListener("click", createComment) + } + + let deletePost = document.getElementsByClassName("remove-post"); + for (let i = 0; i < deletePost.length; i ++) { + deletePost[i].addEventListener("click", removePost) + } + + + + // document.getElementById(post).addEventListener("click", setLikePost) + // document.getElementById("comments"+post).addEventListener("click", showComments) + + } + } \ No newline at end of file diff --git a/src/post.js b/src/post.js new file mode 100644 index 00000000..049b2829 --- /dev/null +++ b/src/post.js @@ -0,0 +1,181 @@ +function showComments() { + let areTherePosts; + let postId = this.id.slice(8) + document.getElementById("comments-section-"+postId).innerHTML = ""; + firebase.database().ref("/posts/"+postId+"/comments/").once("value", function(snapshot){ + if (snapshot.val() == null) { + areTherePosts = false + return; + } + for (let comment in snapshot.val()) { + document.getElementById("comments-section-"+postId).innerHTML += ` + +
+ userPic

${snapshot.val()[comment].author} ${snapshot.val()[comment].especialidad ? "- "+snapshot.val()[comment].especialidad : ""}

+
+
+ +
+ + Editar + Eliminar +
+
+ + ` + + let deleteComment = document.getElementsByClassName("remove-comment"); + for (let i = 0; i < deleteComment.length; i++){ + deleteComment[i].addEventListener("click", removeComment) + } + + let editComment = document.getElementsByClassName("edit-comment"); + for (let i = 0; i < editComment.length; i++){ + editComment[i].addEventListener("click", edit_comment) + } + + let confirmChangeComment= document.getElementsByClassName("change-comment") + for (let i = 0; i < confirmChangeComment.length; i++){ + confirmChangeComment[i].addEventListener("click", confirm_change_comment) + } + + let cancelChangeComment=document.getElementsByClassName("cancel_change") + for (let i= 0; i < cancelChangeComment.length; i++){ + cancelChangeComment[i].addEventListener("click", cancel_change_comment) + } + + } + }) + if(areTherePosts === false) { + return; + } + if (document.getElementById("comments-section-"+postId).style.display === "none") { + document.getElementById("comments-section-"+postId).style.display = "block"; + return + } + if (document.getElementById("comments-section-"+postId).style.display === "block") { + document.getElementById("comments-section-"+postId).style.display = "none"; + return + } +} + +function createComment() { + const postId = this.id.slice(15) + const userId = firebase.auth().currentUser.uid; + if (document.getElementById("text-"+postId) === null) { + document.getElementById("create-comments-section-"+postId).innerHTML = ` +
+ + +
+ + ` + document.getElementById(`btn${postId}`).addEventListener("click", ()=> { + const post_text = document.getElementById(`text-${postId}`).value; + submitComment(userId, post_text, postId) + }) + + } else { + document.getElementById("create-comments-section-"+postId).innerHTML = ""; + } +} + + + + + + +//Function delete post + +function removePost() { + let shortenId= this.id.slice(7) + + let commentsRef = firebase.database().ref("posts/"+shortenId); + let commentsRef2 = firebase.database().ref("users/"+firebase.auth().currentUser.uid+"/posts/"+shortenId); + let option = confirm("Confirma si quieres eliminar el post") + + if (option == true) { + commentsRef.remove(); + commentsRef2.remove(); + } else { + return + + } +} + +//Function delete comments + +function removeComment() { + let shortenId2=this.id.slice(15) + // console.log(shortenId2) + let commentRef3= firebase.database().ref("posts/"+shortenId2); + let optionConfirmRemove = confirm ("Confirma si quieres eliminar el comentario") + if (optionConfirmRemove == true){ + commentRef3.remove(); + } else { + return + } + +} + +//function to enable textarea of the post + +function enableTextarea () { + let shortenId3=this.id.slice(5) //id del boton editar + document.getElementById("post-user"+shortenId3).disabled=false + // document.getElementById("post-user"+shortenId3).contenteditable=true + document.getElementById("button-option"+shortenId3).style.display= "block"; + document.getElementById("post-user"+shortenId3).focus(); + } + + +//function to confirm post update + +function confirm_edit() { + let shortenId4=this.id.slice(10) + let routeContent= document.getElementById("post-user"+shortenId4).value; + firebase.database().ref("posts/"+shortenId4).update({ + content: routeContent + }) + +} + +//function to cancel edit post + +function cancel_editPost(){ + let cancelId=this.id.slice(12) + document.getElementById("post-user"+cancelId).disabled = true; + document.getElementById("button-option"+cancelId).style.display= "none"; +} + + +//function to enable textarea of comments + +function edit_comment() { + let editCommentUser=this.id.slice(13) + document.getElementById("comentUser"+editCommentUser).disabled=false; + document.getElementById("comentUser"+editCommentUser).focus(); + document.getElementById("buttonConfirmComment"+editCommentUser).style.display= "block"; + +} + + +// comment editing function +function confirm_change_comment() { + let confirm_change = this.id.slice(14) //id button, update + let routeContentComment = document.getElementById("comentUser"+confirm_change).value; + firebase.database().ref("posts/"+confirm_change).update({ + content: routeContentComment + }) +} + +//function to cancel edit comments + +function cancel_change_comment(){ + let cancelIdComment = this.id.slice(13) + document.getElementById("comentUser"+cancelIdComment).disabled = true; + document.getElementById("buttonConfirmComment"+cancelIdComment).style.display= "none" +} \ No newline at end of file diff --git a/src/public.js b/src/public.js new file mode 100644 index 00000000..5b624c51 --- /dev/null +++ b/src/public.js @@ -0,0 +1,61 @@ +function submitpost(tags, privacy, userId, post_text) { + + firebase.database().ref("users/"+firebase.auth().currentUser.uid).once("value", function(snapshot){ + const newPostKey = firebase.database().ref().child("users/"+userId+"/post").push().key; + + const updates = {}; + updates["users/"+userId+"/posts/post" + newPostKey] = { + "tags": tags, + "author": snapshot.val().profile.username, + "content": post_text, + "authorId": firebase.auth().currentUser.uid, + "authorPic": snapshot.val().profile.profilePic, + "especialidad": snapshot.val().profile.especialidad + + } + const updates2 = {}; + updates2["posts/post" + newPostKey] ={ + "tags": tags, + "author": snapshot.val().profile.username, + "content": post_text, + "authorId": firebase.auth().currentUser.uid, + "authorPic": snapshot.val().profile.profilePic, + "especialidad": snapshot.val().profile.especialidad + + } + + firebase.database().ref().update(updates); + if (privacy === "public") { + firebase.database().ref().update(updates2); + } + window.socialNetwork.printPosts(window.socialNetwork.printPostsDOM) + + }) +} + +function setLikePost() { + let uid = firebase.auth().currentUser.uid; + let name = firebase.auth().currentUser.displayName ? firebase.auth().currentUser.displayName: firebase.auth().currentUser.email; + let id = this.id + firebase.database().ref("/posts").once("value", function(snapshot){ + if (snapshot.val()[id].likes !== undefined) { + if (Object.keys(snapshot.val()[id].likes).indexOf(firebase.auth().currentUser.uid) !== -1) { + firebase.database().ref("/posts/" + id + "/likes").update({ + [uid]: null + }) + } else { + firebase.database().ref("/posts/" + id + "/likes").update({ + [uid]: name + }) + } + + } else { + firebase.database().ref("/posts/" + id + "/likes").update({ + [uid]: name + }) + } + + + +}) +} \ No newline at end of file diff --git a/src/style.css b/src/style.css new file mode 100644 index 00000000..2338fa37 --- /dev/null +++ b/src/style.css @@ -0,0 +1,758 @@ +/* rgb(122, 190, 212); */ + + +/*.flex-container { + display: flex; +}*/ + +html { + height: 100%; + font-family: 'Economica', sans-serif; + text-decoration-color: #0B0B3B; + } + + body { + /*background-color: #2ECCFA;*/ + background: rgba(148,228,250,1); +background: -moz-linear-gradient(-45deg, rgba(148,228,250,1) 0%, rgba(46,202,250,1) 14%, rgba(148,228,250,1) 45%, rgba(46,202,250,1) 62%, rgba(63,63,117,1) 100%); +background: -webkit-gradient(left top, right bottom, color-stop(0%, rgba(148,228,250,1)), color-stop(14%, rgba(46,202,250,1)), color-stop(45%, rgba(148,228,250,1)), color-stop(62%, rgba(46,202,250,1)), color-stop(100%, rgba(63,63,117,1))); +background: -webkit-linear-gradient(-45deg, rgba(148,228,250,1) 0%, rgba(46,202,250,1) 14%, rgba(148,228,250,1) 45%, rgba(46,202,250,1) 62%, rgba(63,63,117,1) 100%); +background: -o-linear-gradient(-45deg, rgba(148,228,250,1) 0%, rgba(46,202,250,1) 14%, rgba(148,228,250,1) 45%, rgba(46,202,250,1) 62%, rgba(63,63,117,1) 100%); +background: -ms-linear-gradient(-45deg, rgba(148,228,250,1) 0%, rgba(46,202,250,1) 14%, rgba(148,228,250,1) 45%, rgba(46,202,250,1) 62%, rgba(63,63,117,1) 100%); +background: linear-gradient(135deg, rgba(148,228,250,1) 0%, rgba(46,202,250,1) 14%, rgba(148,228,250,1) 45%, rgba(46,202,250,1) 62%, rgba(63,63,117,1) 100%); + + margin: 0; + height: 100%; + } + + .icon { + max-width: 25px; + vertical-align: middle; + padding: 5px; + display: inline-block; + } + + + + #logo-login img{ + max-width: 605px; + + display: block; + margin: auto; + max-width: 300px; + max-height: 300px; + animation-name: floating; + animation-duration: 2s; + -webkit-animation-duration: 2s; + animation-iteration-count: infinite; + -webkit-animation-iteration-count: infinite; + } + @keyframes floating { + 0% { + transform: translateY(0%); + } + + 50% { + transform: translateY(8%); + } + + 100% { + transform: translateY(0%); + } + } + + @-webkit-keyframes floating { + 0% { + -webkit-transform: translateY(0%); + } + + 50% { + -webkit-transform: translateY(8%); + } + + 100% { + -webkit-transform: translateY(0%); + } + } + + + + .login { + padding: 0 10px; + background-color: white; + display: block; + border-radius: 10px; + margin: 10px; + width: 250px; + cursor: pointer; + + } + + + #friends { + display: none; + } + + #new-account { + cursor: pointer; + text-decoration-line: underline; + + } + + + .login p { + margin: 1em; + font-family: 'Economica', sans-serif; + display: inline-block; + color: #737373; + } + + #root { + height: 100%; + display: flex; + flex-flow: column; + } + + .login.facebook p{ + margin: 1em 0.4em; + } + + #logins { + display: block; + margin: auto; + background: rgb(246, 248, 249); + height: 450px; + width: 300px; + border-radius: 10px; + + } + + #logo { + + max-width: 605px; + + display: block; + margin: auto; + max-width: 500px; + max-height: 500px; + animation-name: floating; + animation-duration: 2s; + -webkit-animation-duration: 2s; + animation-iteration-count: infinite; + -webkit-animation-iteration-count: infinite; + } + @keyframes floating { + 0% { + transform: translateY(0%); + } + + 50% { + transform: translateY(8%); + } + + 100% { + transform: translateY(0%); + } + } + + @-webkit-keyframes floating { + 0% { + -webkit-transform: translateY(0%); + } + + 50% { + -webkit-transform: translateY(8%); + } + + 100% { + -webkit-transform: translateY(0%); + } + } + + #logins { + margin-top: 10px; + + } + + #create-account { + display: block; + margin: auto; + background: rgb(246, 248, 249); + height: 200px; + width: 300px; + border-radius: 10px; + + } + + .login { + margin: 10px auto; + } + + .login-input, .post-input, select.post-input option { + width: 250px; + display: block; + margin: 10px auto; + padding: 12px; + border-radius: 10px; + font-family: 'Economica', sans-serif !important; + border: 1px solid #DF3A01; + } + + .login-input:focus, .post-input:focus, .comment-input { + outline: none; + border: 2px solid purple; + } + + .login-btn, #post-it, #cancel, .comment-btn, #update-profile { + display: block; + margin: 10px auto; + font-family: 'Economica', sans-serif; + border: 1px solid #DF3A01; + padding: 10px; + background: rgb(201, 227, 238); + border-radius: 10px; + color: rgb(78, 7, 7); + font-size: 16px; + cursor: pointer; + } + + .login-btn:hover { + color: white; + background-color: gray; + } + + .login-btn:focus, #post-it:focus, #cancel:focus, #update-profile:focus { + outline: none; + } + + nav { + + background-color: rgb(255, 255, 255); + position: fixed; + top: 0; + width: 100%; + height: 80px; + opacity: 0.9; + background-image: + url("https://i.pinimg.com/564x/e9/f0/5b/e9f05ba4769d71862b6349a19bfb8a39.jpg"); +background-color: transparent; + } + + footer { + position: fixed; + bottom: 0; + width: 100%; + height: 80px; + background-color: rgb(56, 10, 83); + /* background-color: rgb(33, 126, 156); */ + display: flex; + flex-flow: row-reverse; + } + + .icon-large, i.fas.fa-edit.fa-3x:before { + max-width: 50px; + max-height: 50px; + margin-top: 8px; + } + + #user-profile, #new-post { + display: block; + margin: auto 10px; + margin-right: 10px; + cursor: pointer; + + } + + #user-profile2, #new-post2 { + cursor: pointer; + } + + .responsive { + display: none; + } + + #user-profile-side-nav { + background-image: + url("https://i.pinimg.com/564x/e9/f0/5b/e9f05ba4769d71862b6349a19bfb8a39.jpg"); +background-color: transparent; + opacity: 0.9; + position: fixed; + display: none; + height: 100%; + width: 30%; + + z-index: 100; + margin: auto; + right: 0; + } + + .user-pic, #user-name { + max-width: 50%; + display: block; + margin: auto; + margin-top: 10%; + border-radius: 50%; + } + + #user-name { + text-align: center; + /* word-break: break-word; */ + font-size: 20px; + } + + #user-pic img{ + width:150px; + height:150px; + border-radius:150px; + box-shadow: -1px 9px 18px 2px rgba(11,11,59,0.68); + } + + #profile-item{ + width:150px; + height:150px; + border-radius:150px; + box-shadow: -1px 9px 18px 2px rgba(11,11,59,0.68); + } + + .side-option { + max-width: 90%; + height: 10%; + display: flex; + margin: 8% auto; + font-size: 20px; + cursor: pointer; + + } + + .side-option a { + display: block; + margin: auto; + } + + #content, #content2 { + width: 60%; + margin: auto; + margin-top: 80px; + } + + + .user-pic-post { + max-width: 50px; + max-height: 50px; + margin-right: 15px; + margin-left: 10px; + border-radius: 50%; + } + + .post, .comments-section { + width: 80%; + min-height: 20%; + margin: 5% auto; + padding: 2%; + border-radius: 10px; + background-image: + url("https://i.pinimg.com/564x/e9/f0/5b/e9f05ba4769d71862b6349a19bfb8a39.jpg"); +background-color: transparent; + } + + .post { + min-height: 0; + } + + .post .post-header span p, .comments-section .comment-header span p { + margin: auto 0; + display: inline-block; + } + + .post-header span, .comment-header span { + display: flex; + } + + .post-content, .comment-content { + padding: 10px; + } + + .post-content span, .comment-content span { + word-wrap: break-word; + } + + #search-nav { + display: block; + margin: auto; + margin-right: 1%; + } + #search { + border-radius: 10px; + line-height: 30px; + border: 1px solid #DF3A01; + padding: 5px; + font-size: 15px; + max-width: 70%; + height: min-content; + margin: auto; + } + + .fas.fa-search.fa-lg { + margin-left: 10px; + } + + #search:focus { + outline: none; + border: 2px solid rgb(213, 79, 184); + } + + #logo { + max-height: 80px; + display: block; + margin: auto; + + } + + + #logo-login { + max-height: 80px; + display: block; + margin: auto; + min-height: fit-content; + overflow: hidden; + margin-bottom: 0; + } + + #volver { + cursor: pointer; + display: block; + text-decoration-line: underline; + margin-top: 50px; + } + + .options{ + display: flex; + } + + .edit-post{ + margin: auto; + /* margin-right: 14px; */ + cursor: pointer; + margin-top: 5px; + size: 5px; + } + + + #div-logo { + display: block; + /* margin: auto; */ + margin-left: 5%; + max-height: 80px; + } + + .like, .comments{ + cursor: pointer; + display: inline-flex; + flex-flow: row; + } + + .like .material-icons, .comments .material-icons{ + margin: auto 5px; + display: inline-block; + } + + .like span, .comments span{ + display: inline-block; + margin: auto 5px; + } + + .post-input { + display: block; + margin: 10px auto; + width: 80%; + border-radius: 10px; + } + + select.post-input { + box-sizing: content-box; + background-color: rgb(165, 235, 230); + } + + textarea.post-input { + word-break: break-word; + resize: none; + height: 20vw; + } + + .input-div { + height: 60%; + } + + #post-it, #update-profile { + float: right; + margin-right: 7%; + color: rgb(166, 235, 226); + background-color: #0B0B3B; + } + + #cancel { + display: block; + margin: auto; + margin-left: 7%; + float: left; + } + + .post-and-cancel { + width: 100%; + overflow: auto; + display: flex; + } + + .comment-input { + width: 90%; + display: block; + margin: 10px auto; + padding: 12px; + border-radius: 10px; + font-family: 'Economica', sans-serif !important; + border: 1px solid #DF3A01; + height: 50px; + resize: none; + } + .postUser{ + width: 100%; + font-size: 16px; + color: rgb(30, 30, 235); + + } + + + .create-comments-section { + margin-right: 100px; + width: 100%; + min-height: 20%; + margin: 5% auto; + opacity: 0.8; + /* border: 1px solid rgb(33, 126, 156); */ + + border-radius: 10px; + } + .comment-btn { + color: rgb(255, 235, 235); + background-color:rgb(101, 101, 123); + margin-right: 10px; + } + + + + .remove-post{ + size: 5px; + margin-top: 5px; + margin-left: 30px; + cursor: pointer; + + } + + /* .create-comments{ + margin-right: 0px; + margin-top: 0px; + } */ + + .teachers-font { + color: rgb(0, 0, 0); + text-align: center; + margin-left: 13px; + margin-top: 4px; + cursor: pointer; + + } + + .WelcomeFont{ + color: rgb(66, 102, 147); + font-family: 'Economica', sans-serif; + font-weight: bold; + font-size: 25px; + text-align: center; + margin-left: 13px; + margin-top: 5px; + cursor: pointer; + + + } + + .change-comment, .cancel_change{ + cursor: pointer; + color: rgb(0, 0, 0); + margin-left: 3px; + margin-top: 100px; + font-size: 13px; + } + + .edit-comment, .remove-comment{ + color: rgb(141, 210, 233); + margin-left: 40px; + margin-top: 100px; + cursor: pointer; + } + + .material-icons{ + margin-right: 179px; + margin-top: 28px; + width: 17px; + } + + .arrow{ + max-width: 20; + color: steelblue; + } + + .update-post{ + margin-left: 2px !important; + font-size: 14px; + } + + .cancel-post{ + margin-right: 5px; + font-size: 14px; + } + + .optionConfirmCancel, .button_confirm_edit{ + display: none; + } + + .postUser, .coment_user{ + min-height: 20%; + margin: 5% auto; + border: rgb(129, 220, 214); + background-color: rgb(246, 248, 249); + opacity: 0.8; + border-radius: 14px; + margin: auto 0; + display: block; + /* overflow: scroll; */ + width: 102%; + resize: vertical; + word-wrap: normal; + font-size: 17px; + color: #0B0B3B; + } + + #profile-div { + display: block; + width: 80%; + height: 100%; + margin: auto; + } + + .profile-item { + max-width: 80%; + min-width: 80%; + display: block; + margin: auto; + } + + .center { + text-align: center; + } + + #update-profile { + margin: 20px auto; + float: none; + } + + #profile-update-cancel { + margin: auto; + margin-bottom: 20px; + display: block; + text-decoration-line: underline; + } + + .responsive-nav { + display: flex; + border-bottom: solid 1px #0B0B3B; + z-index: 100; + } + + .nav-bar-desktop { + margin: 10px; + } + + img.nav-bar-desktop { + max-width: 35px; + margin: auto; + } + + #search-nav { + display: flex; + } + + #search-tag { + margin: auto 10px; + } + .update-post{ + margin-left: 2px !important; + font-size: 14px; + } + + .cancel-post{ + margin-right: 5px; + font-size: 14px; + } + + .optionConfirmCancel, .button_confirm_edit{ + display: none; + } + + textarea { + font-family: 'Economica', sans-serif; + } + + + @media only screen and (max-width: 768px) { + .responsive { + display: flex; + border-top: solid 1px rgb(159, 38, 38); + } + + .div-responsive { + padding: 5%; + } + + #content, #content2 { + width: 100%; + margin-top: 80px; + margin-bottom: 80px; + } + #logo { + margin: auto; + } + .nav-bar-desktop { + display: none; + } + + + /* .textarea:focus { + background-color: blue + } */ + #search-nav { + margin-left: 5%; + display: block; + } + #search-nav a { + margin: auto; + } + #search { + height: 100%; + } + #user-profile-side-nav { + width: 70%; + } + .side-option { + margin: 15% auto; + } + textarea.post-input { + height: 80vw; + } + } + + + + /* .textarea:focus { + background-color: blue + } */ + \ No newline at end of file diff --git a/test/example.spec.js b/test/example.spec.js deleted file mode 100644 index 1aca05e9..00000000 --- a/test/example.spec.js +++ /dev/null @@ -1,7 +0,0 @@ -import { example } from '../src/example.js'; - -describe('example', () => { - it('debería ser una función', () => { - expect(typeof example).toBe('function'); - }); -}); \ No newline at end of file