Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testes firebasejs #73

Open
wants to merge 108 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
c28477e
adicionando as pastas de paginas e imagens
amandascam03 Jul 6, 2023
0668bd3
Merge pull request #1 from amandascam03/apresentaçao
Anara-carolina Jul 6, 2023
3a86fe7
adicionando imagem
Anara-carolina Jul 6, 2023
6911528
adicionando imagens
Anara-carolina Jul 6, 2023
07faa7d
Merge pull request #1 from Anara-carolina/inicio
amandascam03 Jul 6, 2023
8481645
fizemos o html e css da primeira pagina e adicionamos os botões
amandascam03 Jul 6, 2023
dc19cb1
apliquei o css nos botoes e coloquei as hashs quando for clicado
amandascam03 Jul 6, 2023
177b162
Merge pull request #2 from amandascam03/apresentaçao
Anara-carolina Jul 7, 2023
a231d44
teste
amandascam03 Jul 7, 2023
34678d7
Merge pull request #3 from amandascam03/cadastro
Anara-carolina Jul 7, 2023
5359f57
commitalteraçoes
amandascam03 Jul 7, 2023
fb13948
testandocmmit
amandascam03 Jul 7, 2023
4286fbc
testenovabranch
amandascam03 Jul 7, 2023
0aa5e8b
Merge pull request #4 from amandascam03/branchnova
Anara-carolina Jul 7, 2023
931b126
Merge branch 'branchnova' of github.com:amandascam03/SAP010-social-ne…
Anara-carolina Jul 7, 2023
c9086ba
mudança de paginas
Anara-carolina Jul 7, 2023
8a66de8
Merge branch 'main' of github.com:Anara-carolina/SAP010-social-network
Anara-carolina Jul 7, 2023
191e7e2
Merge pull request #2 from Anara-carolina/main
amandascam03 Jul 7, 2023
d88cc4a
adicionando imagem e css no inicio da pagina de cadastro
amandascam03 Jul 7, 2023
ed003d2
Merge branch 'cadastro' of https://github.com/amandascam03/SAP010-soc…
amandascam03 Jul 7, 2023
49ac345
adicionando inputs e button da segunda pagina
amandascam03 Jul 7, 2023
da3bd63
Merge pull request #5 from amandascam03/cadastro
Anara-carolina Jul 8, 2023
2702f43
adicionando icones nos inputs e css da tela finalizado
amandascam03 Jul 8, 2023
654108d
adicionando ids, construindo pagina de login e seta para voltar
amandascam03 Jul 10, 2023
c0e5a9b
adicionando seta para voltar no cadastro e alinhando inputs de login …
amandascam03 Jul 10, 2023
b1956e5
firebase instalado e configurado
amandascam03 Jul 10, 2023
e900160
Merge pull request #7 from amandascam03/login
Anara-carolina Jul 11, 2023
beb2773
pasta para firebase criada e correção ortografica no p de login
amandascam03 Jul 11, 2023
bc321bb
testando funções do firebase
amandascam03 Jul 12, 2023
0192524
criando pasta SPA para o feed
amandascam03 Jul 12, 2023
68a7638
ajustes botão on-off e spa
Anara-carolina Jul 13, 2023
0892581
Merge pull request #3 from Anara-carolina/main
amandascam03 Jul 13, 2023
689b62b
testando função de cadastrar usuario
amandascam03 Jul 13, 2023
76dd659
Merge branch 'apresentaçao' of https://github.com/amandascam03/SAP010…
amandascam03 Jul 13, 2023
24bc596
Merge branch 'cadastro' of github.com:amandascam03/SAP010-social-network
Anara-carolina Jul 13, 2023
c5858af
função de cadastrar usuario funcionando com o evento de click no botao
amandascam03 Jul 13, 2023
ee0a632
Merge pull request #6 from amandascam03/cadastro
Anara-carolina Jul 13, 2023
b906f81
ajustes
Anara-carolina Jul 13, 2023
07cd4c8
Merge branch 'main' of github.com:Anara-carolina/SAP010-social-network
Anara-carolina Jul 13, 2023
624a7d4
função de login funcionando com o evento de click no botao
amandascam03 Jul 13, 2023
f31983e
mudando then e catch para o login.js
amandascam03 Jul 13, 2023
81cd845
Merge pull request #4 from amandascam03/cadastro
amandascam03 Jul 13, 2023
2f9f16f
Merge branch 'cadastro' of github.com:amandascam03/SAP010-social-netw…
Anara-carolina Jul 13, 2023
15d8130
Merge branch 'main' of https://github.com/amandascam03/SAP010-social-…
amandascam03 Jul 13, 2023
7743d18
hash do feed criada, usuario logado com sucesso/alert em caso de erro…
amandascam03 Jul 13, 2023
6acac78
Merge pull request #5 from amandascam03/iniciando-feed
amandascam03 Jul 13, 2023
8502dc0
finalizando parte login home e cadastro
Anara-carolina Jul 13, 2023
bd45891
Merge branch 'main' into firebase
Anara-carolina Jul 13, 2023
7a6f021
Merge pull request #8 from Anara-carolina/firebase
Anara-carolina Jul 13, 2023
1de6fef
Merge pull request #9 from amandascam03/main
Anara-carolina Jul 14, 2023
31b73b0
Merge branch 'main' of github.com:amandascam03/SAP010-social-network …
Anara-carolina Jul 14, 2023
ca2b23b
direcionando cadastro para o login e avisos de erro com alert
amandascam03 Jul 14, 2023
5ca62e7
Merge pull request #6 from amandascam03/iniciando-feed
amandascam03 Jul 14, 2023
d94dd29
estruturando feed
Anara-carolina Jul 14, 2023
8500cbc
Merge branch 'feed' of github.com:Anara-carolina/SAP010-social-networ…
Anara-carolina Jul 14, 2023
acf2a4b
Merge pull request #7 from Anara-carolina/feed
Anara-carolina Jul 14, 2023
0395c3a
Merge branch 'feed' of github.com:Anara-carolina/SAP010-social-network
Anara-carolina Jul 14, 2023
21923a9
Merge pull request #10 from Anara-carolina/feed
Anara-carolina Jul 16, 2023
fc50649
Merge branch 'iniciando-feed' of https://github.com/amandascam03/SAP0…
amandascam03 Jul 17, 2023
f9141ad
mudando tag menu para nav e h1 modificado
amandascam03 Jul 17, 2023
55356d4
menu para mobile construido
amandascam03 Jul 17, 2023
6e5be2b
Merge pull request #11 from amandascam03/iniciando-feed
Anara-carolina Jul 17, 2023
909d6dd
Merge branch 'iniciando-feed' of github.com:amandascam03/SAP010-socia…
Anara-carolina Jul 17, 2023
d52b26e
adicionando tags a e hashs das paginas de perfil e suporte no menu
amandascam03 Jul 17, 2023
e56b502
Merge branch 'main' of https://github.com/amandascam03/SAP010-social-…
amandascam03 Jul 17, 2023
307046e
Merge branch 'iniciando-feed' of https://github.com/amandascam03/SAP0…
amandascam03 Jul 17, 2023
ba2e566
Merge pull request #12 from amandascam03/iniciando-feed
Anara-carolina Jul 17, 2023
fe30e30
Merge branch 'main' of github.com:Anara-carolina/SAP010-social-network
Anara-carolina Jul 17, 2023
142efd2
notificando erros com alerts de acordo com o errorCode do firebase
amandascam03 Jul 18, 2023
8f54000
Merge pull request #8 from amandascam03/notificar-erros
amandascam03 Jul 18, 2023
bdd09dd
criando função para redefinir senha com firebase e criando a pagina
amandascam03 Jul 19, 2023
b6fd2bc
pagina de redefinir senha concluida, função e escutadores de evento f…
amandascam03 Jul 19, 2023
b3e824a
Merge pull request #9 from amandascam03/redefinir-senha
amandascam03 Jul 19, 2023
4c7f1e3
Merge branch 'main' into main
amandascam03 Jul 20, 2023
af5bc1f
erros no eslint conferidos
amandascam03 Jul 20, 2023
5484ab3
Merge pull request #10 from amandascam03/erros-eslint
amandascam03 Jul 20, 2023
73c32c7
displayName ja esta sendo atualizado com o nome do usuario ao ser cad…
amandascam03 Jul 20, 2023
ad677f2
Merge pull request #11 from amandascam03/auth-com-nome
amandascam03 Jul 20, 2023
68a36ab
conteudo do feed aparecendo apenas para usuarios logados
amandascam03 Jul 24, 2023
53830a9
Merge pull request #12 from amandascam03/verificar-usuario-conectado
amandascam03 Jul 24, 2023
bdcba46
erro do getidtoken resolvido
amandascam03 Jul 25, 2023
b999659
Merge pull request #13 from amandascam03/getidtoken
amandascam03 Jul 25, 2023
63ec256
Merge pull request #13 from amandascam03/main
Anara-carolina Jul 25, 2023
a8e26b5
Merge branch 'main' of github.com:Anara-carolina/SAP010-social-network
Anara-carolina Jul 25, 2023
23e1e7b
testando se as funçoes exportadas do firebase.js sao uma function
amandascam03 Jul 25, 2023
5f51d36
Merge pull request #14 from amandascam03/testesunit
amandascam03 Jul 25, 2023
728dc28
Merge pull request #14 from amandascam03/main
Anara-carolina Jul 26, 2023
7f04edb
testanto os alert
Anara-carolina Jul 26, 2023
d0a1c1e
Merge branch 'main' of github.com:Anara-carolina/SAP010-social-network
Anara-carolina Jul 26, 2023
fb2b351
trocando alert por mensagens
Anara-carolina Jul 26, 2023
7261af6
Merge pull request #15 from Anara-carolina/main
amandascam03 Jul 26, 2023
13a8bbe
problema com mensagem de erro de nome vazio resolvido na OH
amandascam03 Jul 26, 2023
833986f
Merge pull request #16 from amandascam03/collections
amandascam03 Jul 27, 2023
682031f
adicionando funções de adicionarPost e exibirPost no feed
amandascam03 Jul 27, 2023
302deac
Merge pull request #17 from amandascam03/collections
amandascam03 Jul 27, 2023
2befb45
Merge pull request #15 from amandascam03/main
Anara-carolina Jul 28, 2023
f0583af
ajustes
Anara-carolina Jul 28, 2023
c781807
Merge branch 'main' of github.com:Anara-carolina/SAP010-social-network
Anara-carolina Jul 28, 2023
3e66e84
ajustes
Anara-carolina Jul 28, 2023
bef62a5
postagens sendo exibidas com printar post
amandascam03 Jul 28, 2023
1a745ea
Merge pull request #18 from amandascam03/exibir-posts
amandascam03 Jul 28, 2023
33016d6
Merge pull request #16 from amandascam03/main
Anara-carolina Jul 29, 2023
513953c
ajustes
Anara-carolina Jul 29, 2023
6447c67
Merge branch 'main' of github.com:Anara-carolina/SAP010-social-network
Anara-carolina Jul 29, 2023
7a07e34
post printado na tela
Anara-carolina Jul 29, 2023
7df7a19
Merge pull request #19 from Anara-carolina/main
amandascam03 Jul 29, 2023
3eaba79
adicionando css aos posts com nome, nivel e conteudo
amandascam03 Jul 31, 2023
4277e7e
realizando primeiros testes das funçoes do firebase e adicionando png…
amandascam03 Jul 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@
"createdAt": "2023-05-16T13:46:37.371Z",
"version": "6.2.0",
"commit": "6a23c58a18f96b4dc3b7b1566dcac06ca9c3ec14"
},
"dependencies": {
"firebase": "^10.0.0"
}
}
}
Binary file added src/imagens/fightback-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagens/icon _like.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagens/icon-deletar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagens/icon-editar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagens/icon-email.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagens/icon-feed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagens/icon-like.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagens/icon-lock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagens/icon-menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagens/icon-perfil.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagens/icon-sair.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagens/icon-sos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagens/icon-user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagens/icon-voltar-branco.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagens/icon-voltar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagens/menina-feed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagens/menina.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 14 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="pages/home/home.css">
<link rel="stylesheet" href="pages/cadastro/cadastro.css">
<link rel="stylesheet" href="pages/login/login.css">
<link rel="stylesheet" href="pages/feed/feed.css">
<link rel="stylesheet" href="pages/redefinicao-de-senha/senha.css">
<title>Fight Back</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300&family=Poppins&display=swap" rel="stylesheet">
</head>

<body>
<main id="principal">
</main>
<script type="module" src="main.js"></script>
</body>

</html>
26 changes: 26 additions & 0 deletions src/lib/firebase-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Import the functions you need from the SDKs you need
import { initializeApp } from 'firebase/app';
import { getAuth } from 'firebase/auth';
import { getFirestore } from 'firebase/firestore';
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries

// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: 'AIzaSyAEK-4d-9VmCDMulufoLS010Jul552nTfI',
authDomain: 'fight-back-3c119.firebaseapp.com',
projectId: 'fight-back-3c119',
storageBucket: 'fight-back-3c119.appspot.com',
messagingSenderId: '856302366263',
appId: '1:856302366263:web:353194250250ae8d3519b2',
};

// Initialize Firebase
const app = initializeApp(firebaseConfig);
// Initialize Firebase Authentication and get a reference to the service
const auth = getAuth(app);
const db = getFirestore(app);

export {
auth, db,
};
74 changes: 74 additions & 0 deletions src/lib/firebase.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// aqui exportaras las funciones que necesites

// export const myFunction = () => {
// // aqui tu codigo
// console.log('Hola mundo!');
// };
import {
createUserWithEmailAndPassword,
updateProfile,
signInWithEmailAndPassword,
signOut,
sendPasswordResetEmail,
} from 'firebase/auth';
import { collection, addDoc, getDocs } from 'firebase/firestore';
import { auth, db } from './firebase-config.js';

export function cadastrarUsuario(email, senha) {
return createUserWithEmailAndPassword(auth, email, senha);
}

export function atualizarNomeDoUsuario(nome) {
return updateProfile(auth.currentUser, {
displayName: nome,
});
}

export function loginUsuario(email, senha) {
return signInWithEmailAndPassword(auth, email, senha);
}

export function sairDaConta() {
return signOut(auth);
}

export function redefinirSenha(email) {
return sendPasswordResetEmail(auth, email);
}

export async function adicionarPost(username, conteudo, nivel) {
try {
const docRef = await addDoc(collection(db, 'posts'), {
username: auth.currentUser.displayName,
uid: auth.currentUser.uid,
conteudo,
nivel,
});
console.log('Document written with ID: ', docRef.id);
} catch (e) {
console.error('Error adding document: ', e);
}
return { username, conteudo };
}

export async function exibirPosts() {
try {
const querySnapshot = await getDocs(collection(db, 'posts'));
const feedElement = document.querySelector('.post');
feedElement.innerHTML = '';
const array = [];
querySnapshot.forEach((doc) => {
// const post = doc.data();
// const postElement = document.createElement('div');
// postElement.innerHTML = `<h2>${post.username}</h2>
// <p>${post.conteudo}</p>
// <hr>`;
// feedElement.appendChild(postElement);
array.push(doc.data());
// console.log(`${doc.id} => ${doc.data()}`);
return array;
});
} catch (error) {
console.error('erro ao obter os posts', error);
}
}
6 changes: 0 additions & 6 deletions src/lib/index.js

This file was deleted.

49 changes: 47 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
// Este es el punto de entrada de tu aplicacion

import { myFunction } from './lib/index.js';
// import { myFunction } from './lib/index.js';

myFunction();
// myFunction();
import home from './pages/home/home';
import cadastro from './pages/cadastro/cadastro';
import login from './pages/login/login';
import feed from './pages/feed/feed';
import senha from './pages/redefinicao-de-senha/senha';
// import { identificarUsuarioConectado } from './lib/firebase';
import { auth } from './lib/firebase-config';

const principal = document.querySelector('#principal');

const init = () => {
window.addEventListener('hashchange', () => {
principal.innerHTML = '';
switch (window.location.hash) {
case '':
principal.appendChild(home());
break;
case '#login':
principal.appendChild(login());
break;
case '#cadastro':
principal.appendChild(cadastro());
break;
case '#feed':
// identificarUsuarioConectado();
if (auth.currentUser) {
principal.appendChild(feed());
} else {
window.location.hash = '#login';
}
break;
case '#redefinir-senha':
principal.appendChild(senha());
break;
default:
principal.appendChild(home());
break;
}
});
};

window.addEventListener('load', () => {
principal.appendChild(home());
init();
});
174 changes: 174 additions & 0 deletions src/pages/cadastro/cadastro.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
* {
padding: 0;
margin: 0;
}

#csscadastro {
background-color: #ffff;
height: 100vh;
}

body {
font-family: 'Open Sans', sans-serif;
font-family: 'Poppins', sans-serif;
height: 100vh;
}

main {
height: 100vh;
}

#menina-cadastro {
height: 325px;
}

#picture-cadastro nav {
background-color: #1e1e1e;
position: relative;
right: 45%;
height: 30px;
}

#picture-cadastro {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
background-color: #1e1e1e;
border-radius: 0 0 32px 32px;
}

#caixaDeTexto {
position: relative;
}

#cadastrocss header {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}

header>h1 {
font-size: 15px;
font-weight: 600;
}

#formulario-cadastro {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
gap: 15px;
}

#csscadastro input {
width: 279px;
height: 50px;
font-size: 24px;
border-top: none;
border-left: none;
border-right: none;
font-family: 'Open Sans', sans-serif;
font-family: 'Poppins', sans-serif;
}

#input-name {
background: url(/imagens/icon-user.png) no-repeat left / 1em;
padding-left: 1.4em;
}

#input-email-cadastro {
background: url(/imagens/icon-email.png) no-repeat left / 1em;
padding-left: 1.4em;
}

#input-senha-cadastro {
background: url(/imagens/icon-lock.png) no-repeat left / 1em;
padding-left: 1.4em;
}

#btn-vermelho {
display: flex;
align-items: center;
justify-content: center;
width: 328px;
height: 40px;
font-size: 16px;
font-weight: 800;
border-radius: 8px;
background-color: #950909;
color: #ffff;
margin-top: 23px;
font-family: 'Open Sans', sans-serif;
font-family: 'Poppins', sans-serif;
border: currentColor;
box-shadow: 0px 4px 0px 0px #520000;
cursor: pointer;
}

#paragrafo-cadastro {
display: flex;
align-items: center;
justify-content: center;
margin-top: 12px;
font-weight: bold;
}

#paragrafo-cadastro a {
color: #950909;
}

/* botão on-off*/
.cadastro-check {
position: relative;
}

.onoff {
display: flex;
height: 0px;
width: 0px;
}

.check-btncadastro {
position: absolute;
display: inline-block;
margin-top: 20px;
width: 40px;
height: 20px;
left: 260px;
background-color: #666262;
border-radius: 17px;
cursor: pointer;
}

.check-btncadastro::after {
content: "";
position: absolute;
width: 20px;
height: 20px;
border-radius: 50%;
background-color: #fff;
top: 0px;
left: 1px;
transition: transform 0.3s;
}

#check-cadastro:checked + .check-btncadastro {
background-color: #950909;
}

#check-cadastro:checked + .check-btncadastro::after {
transform: translateX(18px);
}

#check-cadastro {
display: none;
}

#mensagemErro{
color: #950909;
font-weight: bolder;
font-size: 13px;

}
Loading