Skip to content

Commit

Permalink
fix(journal): ajout du contexte de la journée dans le journal
Browse files Browse the repository at this point in the history
  • Loading branch information
tangimds committed Jan 20, 2022
1 parent 793f5a3 commit a1e6b50
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 4 deletions.
51 changes: 51 additions & 0 deletions src/scenes/status/context.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React from 'react';
import {StyleSheet, View} from 'react-native';
import Text from '../../components/MyText';

const Context = ({data}) => {
if (!data || !data.userComment) return null;

const Detail = ({title, text}) => {
if (!text) return null;
return (
<Text>
<Text style={styles.boldText}>{title} : </Text>
<Text style={styles.italic}>{text}</Text>
</Text>
);
};

return (
<>
<View style={styles.divider} />
<View style={styles.container}>
<View style={styles.textContainer}>
<Detail title="Contexte" text={data.userComment || 'Oui'} />
</View>
</View>
</>
);
};

const styles = StyleSheet.create({
container: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
paddingHorizontal: 20,
paddingVertical: 10,
},
textContainer: {width: '100%'},
boldText: {fontWeight: 'bold'},
italic: {fontStyle: 'italic'},
divider: {
height: 1,
backgroundColor: 'rgba(38, 56, 124, 0.08)',
marginVertical: 10,
width: '60%',
alignSelf: 'center',
},
});

export default Context;
4 changes: 2 additions & 2 deletions src/scenes/status/posology.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {colors} from '../../utils/colors';
import {canEdit} from './utils/index.js';

const Posology = ({data, date, onPress}) => {
if (!data || data.length === 0) {
if (!data || data.length === 0 || data.every((e) => !e.value)) {
return null;
}

Expand Down Expand Up @@ -104,7 +104,7 @@ const styles = StyleSheet.create({
},
divider: {
height: 1,
backgroundColor: '#6BD1F3',
backgroundColor: 'rgba(38, 56, 124, 0.08)',
marginVertical: 10,
width: '60%',
alignSelf: 'center',
Expand Down
2 changes: 2 additions & 0 deletions src/scenes/status/status-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Posology from './posology';
import {canEdit} from './utils/index.js';
import Button from '../../components/RoundButtonIcon';
import Toxic from './toxic';
import Context from './context';
import logEvents from '../../services/logEvents';

export default ({navigation, patientState, date}) => {
Expand Down Expand Up @@ -74,6 +75,7 @@ export default ({navigation, patientState, date}) => {
/>
);
})}
<Context data={patientState?.CONTEXT} />
<Toxic data={patientState?.TOXIC} />
<Posology
data={patientState?.POSOLOGY}
Expand Down
2 changes: 1 addition & 1 deletion src/scenes/status/toxic.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const styles = StyleSheet.create({
italic: {fontStyle: 'italic'},
divider: {
height: 1,
backgroundColor: '#6BD1F3',
backgroundColor: 'rgba(38, 56, 124, 0.08)',
marginVertical: 10,
width: '60%',
alignSelf: 'center',
Expand Down
3 changes: 2 additions & 1 deletion src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ export const translateCategories = {
SENSATIONS: 'Sensations étranges',
DAILYACTIVITIES: 'Faire mes activités quotidiennes',
COMMUNICATION: 'Communication avec mon entourage',
TOXIC: 'Substance ',
TOXIC: 'Substance',
CONTEXT: 'Contexte',
};

export const surveyDate = {
Expand Down

0 comments on commit a1e6b50

Please sign in to comment.