Skip to content

Commit

Permalink
desenvolvendo issue #63
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelssan28ic committed Jun 19, 2021
1 parent 40048bc commit 6e8e36e
Show file tree
Hide file tree
Showing 9 changed files with 274 additions and 1,695 deletions.
1,688 changes: 0 additions & 1,688 deletions backend/package-lock.json

This file was deleted.

2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
"@react-native-community/checkbox": "^0.5.8",
"@react-navigation/material-bottom-tabs": "^5.3.15",
"@react-navigation/native": "^5.9.4",
"@react-navigation/stack": "^5.14.5",
"axios": "^0.21.1",
"expo": "~41.0.1",
"expo-clipboard": "^1.0.2",
"expo-status-bar": "~1.0.4",
"react": "16.13.1",
"react-dom": "16.13.1",
Expand Down
16 changes: 12 additions & 4 deletions frontend/src/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import React from 'react';
import { Dimensions } from 'react-native'

import { createMaterialBottomTabNavigator } from '@react-navigation/material-bottom-tabs';
import { createStackNavigator, } from '@react-navigation/stack';
import { NavigationContainer } from '@react-navigation/native';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';

import RecordsList from './views/RecordsList';
import Home from './views/home'
import Profile from './views/profile';
import { NavigationContainer } from '@react-navigation/native';
import { Dimensions } from 'react-native'
import RecordsList from './views/RecordsList';
import ProfessionalAssociationCode from './views/ProfessionalAssociationCode';

const Tab = createMaterialBottomTabNavigator<RoutesList>();
const SCREEN_WIDTH = Dimensions.get("window").width;
Expand Down Expand Up @@ -35,18 +39,22 @@ export default function Routes() {
<MaterialCommunityIcons name="home-outline" color={color} size={iconSize} />
),
}} />
<Tab.Screen name="History" component={RecordsList} options={{

<Tab.Screen name="History" component={ProfessionalAssociationCode} options={{
tabBarLabel: 'Histórico',
tabBarIcon: ({ color }) => (
<MaterialCommunityIcons name="file-document-outline" color={color} size={iconSize} />
),
}} />

<Tab.Screen name="Profile" component={Profile} options={{
tabBarLabel: 'Perfil',
tabBarIcon: ({ color }) => (
<MaterialCommunityIcons name="account-outline" color={color} size={iconSize} />
),
}} />


</Tab.Navigator >
</NavigationContainer>
);
Expand Down
116 changes: 116 additions & 0 deletions frontend/src/views/ProfessionalAssociationCode/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import React, { useEffect, useState } from 'react';
import {
Container,
GoBackContainer,
GoBackText,
GoBackButton,
TextWarning,
CodeContainer,
GenerateButtonText,
GenerateButton,
CodeText,
CodeNumbersContainer,
CodeNumber,
ContainerAll
} from './styles';
import { Dimensions,ActivityIndicator } from 'react-native';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
import Clipboard from 'expo-clipboard';

import api from '../../services/api'


export default function ProfessionalAssociationCode() {
const iconColor = '#91919F';
const SCREEN_WIDTH = Dimensions.get("window").width;
const iconSize = SCREEN_WIDTH * 0.075;
const [code, setCode] = useState<string[]|[]>([])
const [loading, setLoading] = useState<boolean>(false)

function copyCOodeToClipboard() {

Clipboard.setString("Este é o meu código de profissional no e-motion: "+code.join("") + "." + "\n\nUse ele para se associar a mim e permitir que lhe acompanhe pelo app.");

}

function genereteNewCode(){
setLoading(true);
const code_chars = [] as string[];
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
const charactersLength = characters.length;

while(code_chars.length < 5) {
const newChar = characters.charAt(Math.floor(Math.random() * charactersLength)).toUpperCase();

if(code_chars.indexOf(newChar) == -1 ){
code_chars.push(newChar) ;
}

}

//fazer req para atualizar o codigo no back
setCode(code_chars);
setLoading(false);
}


return (
<ContainerAll>
<Container>
<GoBackContainer>

<GoBackButton>

<MaterialCommunityIcons name="chevron-left" color={iconColor} size={iconSize} />
<GoBackText> Voltar </GoBackText>

</GoBackButton>

</GoBackContainer>

<TextWarning>
Este código deve ser usado pelo seu paciente para que ele se vincule a sua conta e para que você tenha acesso aos registros
</TextWarning>

{(code.length > 0 || loading ) &&

<CodeContainer>

{loading ?
<ActivityIndicator size="large" color="#fad2d2"/>
:
<CodeNumbersContainer>
{code.map((number) => {
return (
<CodeNumber key={number}>
<CodeText>
{number}
</CodeText>
</CodeNumber>
)
})}

<GoBackButton onPress={copyCOodeToClipboard}>
<MaterialCommunityIcons
name="content-copy"
color={iconColor}
size={iconSize}
style={{marginLeft:10,marginBottom:5}}/>

</GoBackButton>

</CodeNumbersContainer>
}

</CodeContainer>}

<GenerateButton onPress={genereteNewCode}>
<GenerateButtonText>
{code.length > 0 ? "Gerar novo código": "Gerar código"}
</GenerateButtonText>
</GenerateButton>

</Container>
</ContainerAll>
);
}
94 changes: 94 additions & 0 deletions frontend/src/views/ProfessionalAssociationCode/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import styled from 'styled-components/native';
import { Dimensions } from 'react-native';
import Constants from 'expo-constants';

const { width, height } = Dimensions.get('window');


export const ContainerAll = styled.View`
height: 100%;
background: #E1948B;
flex: 1;
`

export const Container = styled.View`
flex: 1;
backgroundColor: #FCFCFF;
alignItems: center;
justifyContent: flex-start;
paddingTop:15px;
paddingHorizontal:10px;
border-radius:35px;
margin-top: ${Constants.statusBarHeight +9}px;
`

export const GoBackContainer = styled.View`
width:100%;
`

export const GoBackButton = styled.TouchableOpacity`
flex-direction:row;
alignItems: center;
`

export const GoBackText = styled.Text`
color: #212325;
margin-left:5px;
font-size: ${width/26}px;
`

export const TextWarning = styled.Text`
color:#292B2D;
font-size: ${width/18}px;
text-align:center;
margin:10px;
margin-top:20px;
font-weight: 600;
`

export const CodeContainer = styled.View`
width:100%;
margin:20px;
alignItems: center;
`


export const CodeTexttWarning = styled.Text`
color:#292B2D;
font-size: ${width/25}px;
text-align:center;
`

export const CodeText = styled.Text`
color:#292B2D;
font-size: ${width/25}px;
text-align:center;
font-weight: bold;
`

export const CodeNumbersContainer = styled.View`
flex-direction:row;
alignItems: center;
`

export const CodeNumber = styled.View`
backgroundColor: #FFE9E9;
padding:15px;
margin-left:11px;
margin-bottom:8px;
`

export const GenerateButton = styled.TouchableOpacity`
backgroundColor: #E1948B;
height:${height/15}px;
width:${width/1.4}px;
alignItems: center;
justifyContent: center;
border-radius: 10px;
`
export const GenerateButtonText = styled.Text`
color: #FCFCFF;
font-weight: bold;
font-size: ${width/22}px;
`
15 changes: 15 additions & 0 deletions frontend/src/views/Template/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React, { useEffect, useState } from 'react';
import { Container } from './styles';
import api from '../../services/api'


export default function Template() {


return (
<Container >


</Container>
);
}
14 changes: 14 additions & 0 deletions frontend/src/views/Template/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import styled from 'styled-components/native';
import { Dimensions } from 'react-native';

const { width, height } = Dimensions.get('window');

export const Container = styled.View`
flex: 1;
backgroundColor: #FCFCFF;
alignItems: center;
justifyContent: space-between;
paddingTop:60px;
paddingHorizontal:10px;
`
2 changes: 1 addition & 1 deletion frontend/src/views/profile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function Profile() {
const [isEnabled, setIsEnabled] = useState(false);
const toggleSwitch = () => setIsEnabled(previousState => !previousState);

const isProfissional = true;
const isProfissional = false;
const name = 'Lulu';
const email = 'julia_silva@mail.com';
const profilePicture = require('../../assets/profile.png');
Expand Down
22 changes: 20 additions & 2 deletions frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
dependencies:
deep-assign "^3.0.0"

"@react-native-community/checkbox@^0.5.8":
version "0.5.8"
resolved "https://registry.yarnpkg.com/@react-native-community/checkbox/-/checkbox-0.5.8.tgz#a1b50635fd76a07fb53eb4a98120347cb6e75da4"
integrity sha512-2ppw40sSqBKSPz75l8rDCvpcvQb/78MtvB5BDtovsJE1kXoUJP4eVLuyLo+LfYdSK9qLD4Llt4bIulr1SI9UIQ==

"@react-native-community/cli-debugger-ui@^4.13.1":
version "4.13.1"
resolved "https://registry.yarnpkg.com/@react-native-community/cli-debugger-ui/-/cli-debugger-ui-4.13.1.tgz#07de6d4dab80ec49231de1f1fbf658b4ad39b32c"
Expand Down Expand Up @@ -1984,6 +1989,14 @@
dependencies:
nanoid "^3.1.15"

"@react-navigation/stack@^5.14.5":
version "5.14.5"
resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.14.5.tgz#dc615cd7d270ba79e3330dcb50c2819d0e1f3850"
integrity sha512-hpdn1SS0tc3/3atkV2Q2y++n5B4e0rUcCj4W43PODMu72yX2m0LkKAAcpkPDCWAvwnLLIoLAEl5BEifZigl/6A==
dependencies:
color "^3.1.3"
react-native-iphone-x-helper "^1.3.0"

"@types/hoist-non-react-statics@*", "@types/hoist-non-react-statics@^3.3.0":
version "3.3.1"
resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz#1124aafe5118cb591977aeb1ceaaed1070eb039f"
Expand Down Expand Up @@ -2832,7 +2845,7 @@ color-support@^1.1.3:
resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2"
integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==

color@^3.1.2:
color@^3.1.2, color@^3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/color/-/color-3.1.3.tgz#ca67fb4e7b97d611dcde39eceed422067d91596e"
integrity sha512-xgXAcTHa2HeFCGLE9Xs/R82hujGtu9Jd9x4NW3T34+OMs7VoPsjwzRczKHvTAHeJwWFwX5j15+MgAppE8ztObQ==
Expand Down Expand Up @@ -3295,6 +3308,11 @@ expo-asset@~8.3.1:
path-browserify "^1.0.0"
url-parse "^1.4.4"

expo-clipboard@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/expo-clipboard/-/expo-clipboard-1.0.2.tgz#7b759aef61616ce700c4077f0ab1589c974887f8"
integrity sha512-0uarcOHQKPW658eMhW2KBnTxtiS7yFQZ95j+Dz71Kn50X9V7HGXsexEETQ0lL05ArDAgpVRTPHz0YKkaq8Kn/Q==

expo-constants@~10.1.3:
version "10.1.3"
resolved "https://registry.yarnpkg.com/expo-constants/-/expo-constants-10.1.3.tgz#dfbe30362d27d6f500318eb528621424034b72d5"
Expand Down Expand Up @@ -5387,7 +5405,7 @@ react-is@^17.0.1:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==

react-native-iphone-x-helper@^1.3.1:
react-native-iphone-x-helper@^1.3.0, react-native-iphone-x-helper@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.3.1.tgz#20c603e9a0e765fd6f97396638bdeb0e5a60b010"
integrity sha512-HOf0jzRnq2/aFUcdCJ9w9JGzN3gdEg0zFE4FyYlp4jtidqU03D5X7ZegGKfT1EWteR0gPBGp9ye5T5FvSWi9Yg==
Expand Down

0 comments on commit 6e8e36e

Please sign in to comment.