Skip to content

Commit

Permalink
Merge pull request #129 from ES2-UFPI/conflict
Browse files Browse the repository at this point in the history
Corrigindo conflitos
  • Loading branch information
giselesousar authored Jul 5, 2021
2 parents 38f1a12 + 48cf879 commit 4695f4e
Show file tree
Hide file tree
Showing 15 changed files with 209 additions and 115 deletions.
2 changes: 2 additions & 0 deletions frontend/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Text,
StyleSheet
} from 'react-native';
import { StatusBar } from 'expo-status-bar';
import { Provider } from 'react-redux';

import { store, persistor } from './src/store';
Expand All @@ -16,6 +17,7 @@ export default function App() {
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<StatusBar style="light" />
<Routes />
</PersistGate>
</Provider>
Expand Down
2 changes: 1 addition & 1 deletion frontend/evironment.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const IP = '192.168.18.186';
export const IP = '192.168.0.114';
2 changes: 1 addition & 1 deletion frontend/src/components/BottomNavigation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Tab = createMaterialBottomTabNavigator<RoutesList>();
const SCREEN_WIDTH = Dimensions.get("window").width;
const iconSize = SCREEN_WIDTH * 0.07;

const isClient = false;
const isClient = true;

export default function BottomNavigation() {
return (
Expand Down
17 changes: 17 additions & 0 deletions frontend/src/models/emotionalReaction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export interface EmotionalReaction {
title?: string
emotions?: string
what_did_you_do?: string
what_did_you_think?: string
when_does_tb_usually_occur?: string
where_does_tb_occur?: string
who_is_present_when_tb_occurs?: string
which_activitie_precede_tb?: string
wd_other_people_sod_before_tb?: string
do_you_engage_other_behavior_before_tb_occurs?: string
what_happens_after_tb?: string
wdyd_when_tb_occurs?: string
wd_other_people_do_when_tb_occurs?: string
what_changes_after_tb_occurs?: string
wd_you_get_after_tb?: string
}
2 changes: 1 addition & 1 deletion frontend/src/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import axios from "axios";
import { IP } from '../../evironment';

const api = axios.create({
baseURL: `http://${IP}:3333/`,
baseURL: `http://192.168.0.114:3333/`,
headers:{
'accept': 'application/json',
'Access-Control-Allow-Origin': '*',
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/store/actions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './reducers/auth/actions';
export * from './reducers/user/actions';
export * from './reducers/emotionalReaction/actions';
32 changes: 32 additions & 0 deletions frontend/src/store/reducers/emotionalReaction/actions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { EmotionalReaction } from './../../../models/emotionalReaction';

export function setValues(values: EmotionalReaction) {
return {
type: '@registration/SET_VALUES',
payload: { values },
};
}

export function clearStepOne() {
return {
type: '@registration/CLEAR_STEP_ONE'
};
}

export function clearStepTwo() {
return {
type: '@registration/CLEAR_STEP_TWO'
};
}

export function clearStepThree() {
return {
type: '@registration/CLEAR_STEP_THREE'
};
}

export function clear() {
return {
type: '@registration/CLEAR'
}
}
66 changes: 66 additions & 0 deletions frontend/src/store/reducers/emotionalReaction/reducer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { EmotionalReaction } from './../../../models/emotionalReaction';

const INITIAL_STATE: EmotionalReaction = {
title: '',
emotions: '',
what_did_you_do: '',
what_did_you_think: '',
when_does_tb_usually_occur: '',
where_does_tb_occur: '',
who_is_present_when_tb_occurs: '',
which_activitie_precede_tb: '',
wd_other_people_sod_before_tb: '',
do_you_engage_other_behavior_before_tb_occurs: '',
what_happens_after_tb: '',
wdyd_when_tb_occurs: '',
wd_other_people_do_when_tb_occurs: '',
what_changes_after_tb_occurs: '',
wd_you_get_after_tb: ''
};

const emotionalReaction = (state = INITIAL_STATE, action: any) => {
const baseAction = '@registration/';
switch (action.type) {

case `${baseAction}SET_VALUES`:
return {
...state, ...action.payload.values
}
case `${baseAction}CLEAR_STEP_ONE`:
return {
...state,
title: INITIAL_STATE.title,
emotions: INITIAL_STATE.emotions,
what_did_you_do: INITIAL_STATE.what_did_you_do,
what_did_you_think: INITIAL_STATE.what_did_you_think
}
case `${baseAction}CLEAR_STEP_TWO`:
return {
...state,
when_does_tb_usually_occur: INITIAL_STATE.when_does_tb_usually_occur,
where_does_tb_occur: INITIAL_STATE.where_does_tb_occur,
who_is_present_when_tb_occurs: INITIAL_STATE.who_is_present_when_tb_occurs,
which_activitie_precede_tb: INITIAL_STATE.which_activitie_precede_tb,
wd_other_people_sod_before_tb: INITIAL_STATE.wd_other_people_sod_before_tb,
do_you_engage_other_behavior_before_tb_occurs: INITIAL_STATE.do_you_engage_other_behavior_before_tb_occurs
}
case `${baseAction}CLEAR_STEP_THREE`:
return {
...state,
what_happens_after_tb: INITIAL_STATE.what_happens_after_tb,
wdyd_when_tb_occurs: INITIAL_STATE.wdyd_when_tb_occurs,
wd_other_people_do_when_tb_occurs: INITIAL_STATE.wd_other_people_do_when_tb_occurs,
what_changes_after_tb_occurs: INITIAL_STATE.what_changes_after_tb_occurs,
wd_you_get_after_tb: INITIAL_STATE.wd_you_get_after_tb
}
case `${baseAction}CLEAR`:
return {
...state, ...INITIAL_STATE
}
default:
return state;
}
}

export default emotionalReaction;

16 changes: 8 additions & 8 deletions frontend/src/views/ClientList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import ClientCardComponent from '../../components/ClientCard';
import { BackGroundPage, ContainerMain, Item, NothingFound, TextNothingFound } from './styles';

const ClientList = (props: any) => {
const professional_id = "0"
const professional_id = "2"
const [clients, setClients] = useState<[]>([]);
const [loading, setLoading] = useState<boolean>(true);
const [searchQuery, setSearchQuery] = useState<string>("");
Expand All @@ -22,7 +22,7 @@ const ClientList = (props: any) => {
setLoading(true);

const response = await api.get(`/professionals/clients/${professional_id}`);
setClients(response.data.clients);
setClients(staticClients);

setLoading(false);
} catch(error) {
Expand Down Expand Up @@ -91,16 +91,16 @@ const ClientList = (props: any) => {
:
clients && clients.length > 0 ?
<FlatList
data={clients}
data={staticClients}
keyExtractor={(item) => item['id']}
renderItem={({ item }) =>
<Item>
<ClientCardComponent
id={item['id']}
name={item['name']}
nickname={item['name']}
email={item['user']['email']}
phone={item['phone']}
id={item.id}
name={item.name}
nickname={item.name}
email={item.email}
phone={item.phone}
onPress={onPressClientCard}
/>
</Item>
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/views/RecordsList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface Record{

export default function RecordsList() {

const client_id = "1avb";
const client_id = "1";
const [idCurrent, setIdCurrent] = useState<string>("");
const [loading, setLoading] = useState<boolean>(true);
const [modalIsVisible, setModalIsVisible] = useState<boolean>(false);
Expand All @@ -31,14 +31,15 @@ export default function RecordsList() {

if(data.length < 1){
setRecords(undefined)
setLoading(false);
return
}

const records_from_user = data.map(record => {

const fields = Object.entries(record);

const fields_cont = fields.filter( field => field[1] != null).length;
const fields_cont = fields.filter( field => field[1] !== '').length;

const fields_completed = Math.round(fields_cont / fields.length * 100);

Expand Down
29 changes: 13 additions & 16 deletions frontend/src/views/Registration/views/StepOne/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,16 @@ import { sentimentos } from './mock';
import { useNavigation } from '@react-navigation/native';
import api from '../../../../services/api';
import { AxiosError, AxiosResponse } from 'axios';

interface Form {
title?: string
emotions?: string
what_did_you_do?: string
what_did_you_think?: string
}
import { EmotionalReaction } from '../../../../models/emotionalReaction';
import { shallowEqual, useSelector } from 'react-redux';

const RegistrationStepZero = (props: any) => {

const { id } = props.route.params;

const [formInput, setFormInput] = useState<Form>();
const [formInput, setFormInput] = useState<EmotionalReaction>();

const emotionalReactionFromRedux = useSelector((state: any) => state.emotionalReaction, shallowEqual);

const checkboxGroupRef = useRef<any>();

Expand All @@ -43,10 +40,10 @@ const RegistrationStepZero = (props: any) => {

const emotions = getEmotions();

const data = {...formInput, emotions};
const data = { ...formInput, emotions };

api.post(`reactions/update/${id}`, data)
.then((res: AxiosResponse) => {console.log(res.data.message); navigateToNextStep()})
api.post(`reactions/update/${id}`, data)
.then((res: AxiosResponse) => { console.log(res.data.message); navigateToNextStep() })
.catch((err: AxiosError) => console.log(err.message));
}

Expand All @@ -57,13 +54,13 @@ const RegistrationStepZero = (props: any) => {
const navigateToNextStep = () => {
navigation.navigate('StepTwo', { id });
}

return (
<Container>
<Header>
Novo registro
</Header>
<Flux selected={1} />
<Flux selected={1} />
<ScrollView>
<ContentContainer>
<SectionTtile>
Expand All @@ -73,7 +70,7 @@ const RegistrationStepZero = (props: any) => {
placeholder="Digite aqui seus pensamentos"
selectionColor="#91919F"
value={formInput?.title}
onChangeText={(text) => setFormInput({...formInput, title: text})}
onChangeText={(text) => setFormInput({ ...formInput, title: text })}
/>
<SectionTtile>
O que você sentiu?
Expand All @@ -88,7 +85,7 @@ const RegistrationStepZero = (props: any) => {
multiline={true}
numberOfLines={4}
value={formInput?.what_did_you_think}
onChangeText={(text) => setFormInput({...formInput, what_did_you_think: text})}
onChangeText={(text) => setFormInput({ ...formInput, what_did_you_think: text })}
/>
<SectionTtile>
O que você fez?
Expand All @@ -98,7 +95,7 @@ const RegistrationStepZero = (props: any) => {
selectionColor="#91919F"
multiline={true}
value={formInput?.what_did_you_do}
onChangeText={(text) => setFormInput({...formInput, what_did_you_do: text})}
onChangeText={(text) => setFormInput({ ...formInput, what_did_you_do: text })}
/>

<ContainerButton>
Expand Down
11 changes: 2 additions & 9 deletions frontend/src/views/Registration/views/StepThree/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,13 @@ import Input from '../../../../components/Input';
import { useNavigation } from '@react-navigation/native';
import api from '../../../../services/api';
import { AxiosResponse, AxiosError } from 'axios';

interface Form {
what_happens_after_tb?: string
wdyd_when_tb_occurs?: string
wd_other_people_do_when_tb_occurs?: string
what_changes_after_tb_occurs?: string
wd_you_get_after_tb?: string
}
import { EmotionalReaction } from '../../../../models/emotionalReaction';

const RegistrationStepThree = (props: any) => {

const { id } = props.route.params;

const [formInput, setFormInput] = useState<Form>();
const [formInput, setFormInput] = useState<EmotionalReaction>();

const handleConfirmation = () => {
api.post(`reactions/update/${id}`, formInput)
Expand Down
12 changes: 2 additions & 10 deletions frontend/src/views/Registration/views/StepTwo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,13 @@ import Input from '../../../../components/Input';
import { useNavigation } from '@react-navigation/native';
import api from '../../../../services/api';
import { AxiosResponse, AxiosError } from 'axios';

interface Form {
when_does_tb_usually_occur?: string
where_does_tb_occur?: string
who_is_present_when_tb_occurs?: string
which_activitie_precede_tb?: string
wd_other_people_sod_before_tb?: string
do_you_engage_other_behavior_before_tb_occurs?: string
}
import { EmotionalReaction } from '../../../../models/emotionalReaction';

const RegistrationStepTwo = (props: any) => {

const { id } = props.route.params;

const [formInput, setFormInput] = useState<Form>();
const [formInput, setFormInput] = useState<EmotionalReaction>();

const handleConfirmation = () => {
api.post(`reactions/update/${id}`, formInput)
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/acompanhamento/views/cliente/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const Client = (props: any) => {
<Row>
<IconContainer><FeatherIcon name="file-text" style={{color: '#FCFCFF', fontSize: 24}}/></IconContainer>
<Column>
<HeaderBaseText style={{fontSize: 14, lineHeight: 14, margin: 2}}>{params.user.email}</HeaderBaseText>
<HeaderBaseText style={{fontSize: 14, lineHeight: 14, margin: 2}}>{params.email}</HeaderBaseText>
<HeaderBaseText style={{fontSize: 12, lineHeight: 11, margin: 2}}>{params.phone}</HeaderBaseText>
</Column>
</Row>
Expand Down
Loading

0 comments on commit 4695f4e

Please sign in to comment.