-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
933 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
# ******** NOTE ******** | ||
# We have attempted to detect the languages in your repository. Please check | ||
# the `language` matrix defined below to confirm you have the correct set of | ||
# supported CodeQL languages. | ||
# ******** NOTE ******** | ||
|
||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ master ] | ||
schedule: | ||
- cron: '37 20 * * 6' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'java', 'javascript' ] | ||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] | ||
# Learn more: | ||
# https://docs.github.com/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v1 | ||
with: | ||
languages: ${{ matrix.language }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
# queries: ./path/to/local/query, your-org/your-repo/queries@main | ||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v1 | ||
|
||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 https://git.io/JvXDl | ||
|
||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines | ||
# and modify them (or add more) to build your code if your project | ||
# uses a compiled language | ||
|
||
#- run: | | ||
# make bootstrap | ||
# make release | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
import React, { useState } from 'react'; | ||
import { Text, Image, TouchableOpacity, Alert } from 'react-native'; | ||
|
||
import addPfpIcon from '../../assets/add_pfp.png'; | ||
|
||
import ImagePicker from 'react-native-image-picker'; | ||
|
||
import { Container } from './styles'; | ||
import Button from '../Button'; | ||
import Input from '../Input'; | ||
|
||
import {Form, Row, Column, ImagePreview} from './styles'; | ||
|
||
export default function Register({navigation, createUser}) { | ||
const [nome, setNome] = useState(''); | ||
const [dataNasc, setDataNasc] = useState(''); | ||
const [email, setEmail] = useState(''); | ||
const [telefone, setTelefone] = useState(''); | ||
const [cpf, setCpf] = useState(''); | ||
const [senha, setSenha] = useState(''); | ||
const [confirmSenha, setConfirmSenha] = useState(''); | ||
const [cidade, setCidade] = useState(''); | ||
const [estado, setEstado] = useState(''); | ||
const [pfp, setPfp] = useState({ uri: '', name: '', type: '' }); | ||
|
||
const handleRegisterClick = async () => { | ||
if(senha !== confirmSenha) { | ||
Alert.alert('Erro', 'As senhas não coincidem', [ | ||
{ text: "OK" } | ||
]); | ||
}else { | ||
createUser(nome, dataNasc, email, telefone, cpf, senha, cidade, estado, pfp).then(() => { | ||
Alert.alert('Conta criada com sucesso', 'Sua conta foi criada, basta fazer o login', [ | ||
{ text: "OK", onPress: () => navigation.navigate('Login') } | ||
], | ||
{ cancelable: true }); | ||
}).catch((err) => { | ||
console.log(err); | ||
}); | ||
} | ||
}; | ||
|
||
const addPfP = () => { | ||
const options = { | ||
title: 'Selecionar foto de perfil', | ||
takePhotoButtonTitle: 'Tirar foto...', | ||
mediaType: 'photo', | ||
allowsEditing: true, | ||
chooseFromLibraryButtonTitle: 'Escolher da galeria...', | ||
storageOptions: { | ||
skipBackup: true, | ||
path: 'images', | ||
}, | ||
}; | ||
ImagePicker.showImagePicker(options, response => { | ||
if(!response.didCancel) { | ||
setPfp({ | ||
uri: response.uri, | ||
name: response.fileName, | ||
type: response.type, | ||
}); | ||
} | ||
}); | ||
}; | ||
|
||
return ( | ||
<Container> | ||
<Form> | ||
|
||
<TouchableOpacity onPress={addPfP}> | ||
<Image source={pfp.uri ? { uri: pfp.uri} : addPfpIcon} style={{width: 150, height: 150, borderRadius: 150}} resizeMode="cover"/> | ||
</TouchableOpacity> | ||
|
||
<Text style={{ color: 'white', marginBottom: 10 }}>Adicionar foto</Text> | ||
|
||
<Input | ||
icon="account" | ||
iconColor="#fff" | ||
placeholder="Nome de Usuario" | ||
placeholderTextColor="white" | ||
onChangeText={(text) => setNome(text)} | ||
value={nome} | ||
/> | ||
<Input | ||
icon="email" | ||
iconColor="#fff" | ||
placeholder="E-mail" | ||
placeholderTextColor="white" | ||
onChangeText={(text) => setEmail(text)} | ||
value={email} | ||
/> | ||
<Input | ||
icon="lock" | ||
iconColor="#fff" | ||
placeholder="Senha" | ||
secureTextEntry={true} | ||
placeholderTextColor="white" | ||
onChangeText={(text) => setSenha(text)} | ||
value={senha} | ||
/> | ||
<Input | ||
icon="lock-alert" | ||
iconColor="#fff" | ||
placeholder="Confirmar Senha" | ||
secureTextEntry={true} | ||
placeholderTextColor="white" | ||
onChangeText={(text) => setConfirmSenha(text)} | ||
value={confirmSenha} | ||
/> | ||
<Input | ||
icon="account-card-details" | ||
iconColor="#fff" | ||
placeholder="CPF" | ||
placeholderTextColor="white" | ||
onChangeText={(text) => setCpf(text)} | ||
value={cpf} | ||
/> | ||
<Input | ||
icon="calendar" | ||
iconColor="#fff" | ||
placeholder="Data de Nascimento" | ||
placeholderTextColor="white" | ||
onChangeText={(text) => setDataNasc(text)} | ||
value={dataNasc} | ||
/> | ||
<Input | ||
icon="cellphone" | ||
iconColor="#fff" | ||
placeholder="Telefone" | ||
placeholderTextColor="white" | ||
onChangeText={(text) => setTelefone(text)} | ||
value={telefone} | ||
/> | ||
|
||
<Row> | ||
<Column> | ||
<Input | ||
icon="home" | ||
iconColor="#fff" | ||
placeholder="Cidade" | ||
placeholderTextColor="white" | ||
onChangeText={(text) => setCidade(text)} | ||
/> | ||
</Column> | ||
<Column fill=".6"> | ||
<Input | ||
icon="city-variant" | ||
iconColor="#fff" | ||
placeholder="Estado" | ||
placeholderTextColor="white" | ||
maxLength={2} | ||
onChangeText={(text) => setEstado(text)} | ||
/> | ||
</Column> | ||
</Row> | ||
|
||
<Button | ||
marginY={20} | ||
color="blue" | ||
width={200} | ||
height={40} | ||
onPress={handleRegisterClick}> | ||
Registrar | ||
</Button> | ||
</Form> | ||
</Container> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import {useNavigation, useRoute} from '@react-navigation/native'; | ||
import React, {useCallback, useEffect, useState} from 'react'; | ||
import {Linking} from 'react-native'; | ||
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'; | ||
|
||
import { | ||
Container, | ||
Header, | ||
User, | ||
UserImage, | ||
UserName, | ||
UserAge, | ||
UserAddress, | ||
BookAvailability, | ||
BookImage, | ||
Body, | ||
BookInfo, | ||
BookAuthor, | ||
BookCondition, | ||
BookSynopsis, | ||
BookSynopsisTitle, | ||
BookSynopsisContent, | ||
WhatsappFAB, | ||
} from './styles'; | ||
|
||
const BookDetails = () => { | ||
const {params} = useRoute(); | ||
const {setOptions} = useNavigation(); | ||
|
||
const [book, setBook] = useState(); | ||
|
||
useEffect(() => { | ||
async function loadBookData() { | ||
// const response = await api.get(`/getbook/${params.bookId}`); | ||
// setBook(response.data); | ||
|
||
setBook({ | ||
id: 1, | ||
autor: 'Roberto Carlos', | ||
titulo: 'O milagre da cela 8', | ||
sinopse: | ||
'Gandalf envolve Bilbo em uma festa para Thorin e seu grupo de anões, que cantam sobre recuperar a Montanha Solitária e seu vasto tesouro do dragão Smaug.[11] Quando a música termina, Gandalf revela um mapa que mostra uma porta secreta na montanha e propõe que um estupefato Bilbo sirva como "ladrão" daexpedição.[12] Os anões ridicularizam tal ideia, mas o hobbit, indignado, junta-se a eles mesmo sem querer.[13] O grupo viaja rumo às terras selvagens,[14] onde Bilbo e Gandalf salvam a companhia de um grupo de trolls[15]. Este último os leva à Rivendell,[16] onde Elrond revela os segredos do mapa que Thorin possui para a entrada secreta de Erebor.[17] Passando por cima das Montanhas Sombrias, eles são capturados por goblins e conduzidos ao subterrâneo profundo.[18] Embora Gandalf consiga resgatá-los, Bilbo acaba separado dos demais no momento da fuga.', | ||
foto: | ||
'https://images-na.ssl-images-amazon.com/images/I/61VxEKq8B1L._SX365_BO1,204,203,200_.jpg', | ||
}); | ||
} | ||
|
||
loadBookData(); | ||
}, [params]); | ||
|
||
useEffect(() => { | ||
setOptions({ | ||
title: book?.titulo ? book.titulo : 'Detalhes do livro', | ||
}); | ||
}, [book, setOptions]); | ||
|
||
const handleSendMessage = useCallback(() => { | ||
Linking.openURL('whatsapp://send?phone=5519998487686'); | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<Container> | ||
<Header> | ||
<User> | ||
<UserImage | ||
source={{ | ||
uri: | ||
'https://upload.wikimedia.org/wikipedia/commons/0/01/Jos%C3%A9_Mayer_Foto_final.jpg', | ||
}} | ||
/> | ||
|
||
<UserName>José Meyer</UserName> | ||
|
||
<UserAge>70 anos</UserAge> | ||
|
||
<UserAddress>Rio de Janeiro, RJ</UserAddress> | ||
|
||
<BookAvailability>Disponível</BookAvailability> | ||
</User> | ||
|
||
{book?.foto && ( | ||
<BookImage | ||
source={{ | ||
uri: book.foto, | ||
}} | ||
/> | ||
)} | ||
</Header> | ||
|
||
<Body> | ||
<BookInfo> | ||
{book?.autor && <BookAuthor>Autor: {book.autor}</BookAuthor>} | ||
|
||
<BookCondition>Condição: Pouco usado</BookCondition> | ||
|
||
{book?.sinopse && ( | ||
<BookSynopsis> | ||
<BookSynopsisTitle>Sinopse:</BookSynopsisTitle> | ||
|
||
<BookSynopsisContent>{book.sinopse}</BookSynopsisContent> | ||
</BookSynopsis> | ||
)} | ||
</BookInfo> | ||
</Body> | ||
</Container> | ||
|
||
<WhatsappFAB onPress={handleSendMessage}> | ||
<MaterialCommunityIcon name="whatsapp" color="#fff" size={25} /> | ||
</WhatsappFAB> | ||
</> | ||
); | ||
}; | ||
|
||
export default BookDetails; |
Oops, something went wrong.