Skip to content

Commit

Permalink
chore(app): fix le detail des comptes-rendus qui affiche de mauvaises…
Browse files Browse the repository at this point in the history
… données... comme quoi pas grand monde s'en sert peut-être
  • Loading branch information
Arnaud AMBROSELLI committed Feb 1, 2024
1 parent 13380dd commit d67923d
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 17 deletions.
4 changes: 4 additions & 0 deletions app/src/components/ListEmptyContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ export const ListEmptyActions = () => <ListEmptyContainer text="Il n'y a pas d'a
export const ListEmptyPersons = () => <ListEmptyContainer text="Il n'y a pas de personne à afficher" />;
export const ListEmptyStructures = () => <ListEmptyContainer text="Il n'y a pas de structure à afficher" />;
export const ListEmptyTerritories = () => <ListEmptyContainer text="Il n'y a pas de territoire à afficher" />;
export const ListEmptyObservations = () => <ListEmptyContainer text="Il n'y a pas d'observation à afficher" />;
export const ListEmptyStructureWithName = (name) => () => <ListEmptyContainer text={`Il n'y a pas de structure incluant ${name}`} />;
export const ListEmptyPlaceWithName = (name) => () => <ListEmptyContainer text={`Il n'y a pas de lieu incluant ${name}`} />;
export const ListEmptyComments = () => <ListEmptyContainer opaque text="Il n'y a pas de commentaire à afficher" />;
export const ListEmptyRencontres = () => <ListEmptyContainer opaque text="Il n'y a pas de rencontre à afficher" />;
export const ListEmptyCollaboration = (collaboration) => () => <ListEmptyContainer text={`Vous n'avez pas encore collaboré avec ${collaboration}`} />;
export const ListEmptyUrgent = () => <ListEmptyContainer opaque text="Il n'y a pas d'élément prioritaire à afficher" />;
export const ListEmptyUrgentAction = () => <ListEmptyContainer opaque text="Il n'y a pas d'action urgente à afficher" />;
export const ListEmptyUrgentComment = () => <ListEmptyContainer opaque text="Il n'y a pas de commentaire urgent à afficher" />;

export const ListNoMoreActions = () => <ListEmptyContainer opaque text="Il n'y a pas d'autre action à afficher" />;
export const ListNoMoreComments = () => <ListEmptyContainer opaque text="Il n'y a pas d'autre commentaire à afficher" />;
export const ListNoMoreRencontres = () => <ListEmptyContainer opaque text="Il n'y a pas d'autre rencontre à afficher" />;
export const ListNoMoreObservations = () => <ListEmptyContainer opaque text="Il n'y a pas d'autre observation de territoire à afficher" />;
export const ListNoMorePersons = () => <ListEmptyContainer opaque text="Il n'y a pas d'autre personne à afficher" />;
export const ListNoMoreStructures = () => <ListEmptyContainer opaque text="Il n'y a pas d'autre structure à afficher" />;
Expand Down
4 changes: 2 additions & 2 deletions app/src/scenes/Reports/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const Actions = ({ route, navigation }) => {
};

return (
<SceneContainer testID="actions-list-for-report">
<SceneContainer testID="actions-list-for-report" backgroundColor="#fff">
<ScreenTitle
title={`Actions ${status === DONE ? 'faites' : status === CANCEL ? 'annulées' : 'créées'}\n${getPeriodTitle(
date,
Expand All @@ -84,7 +84,7 @@ const Actions = ({ route, navigation }) => {
keyExtractor={keyExtractor}
ListEmptyComponent={ListEmptyComponent}
onEndReachedThreshold={0.3}
ListFooterComponent={ListNoMoreActions}
ListFooterComponent={actionsToShow.length > 0 ? ListNoMoreActions : null}
/>
<FloatAddButton onPress={onCreateAction} />
</SceneContainer>
Expand Down
7 changes: 4 additions & 3 deletions app/src/scenes/Reports/CommentsForReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ScreenTitle from '../../components/ScreenTitle';
import { refreshTriggerState } from '../../components/Loader';
import { FlashListStyled } from '../../components/Lists';
import CommentRow from '../Comments/CommentRow';
import { ListNoMoreComments } from '../../components/ListEmptyContainer';
import { ListEmptyComments, ListNoMoreComments } from '../../components/ListEmptyContainer';
import { commentsForReport } from './selectors';
import { getPeriodTitle } from './utils';
import { currentTeamState, organisationState } from '../../recoil/auth';
Expand Down Expand Up @@ -105,7 +105,7 @@ const CommentsForReport = ({ navigation, route }) => {
};

return (
<SceneContainer>
<SceneContainer backgroundColor="#fff">
<ScreenTitle title={`Commentaires \n${getPeriodTitle(date, currentTeam?.nightSession)}`} onBack={navigation.goBack} />
<FlashListStyled
refreshing={refreshTrigger.status}
Expand All @@ -116,7 +116,8 @@ const CommentsForReport = ({ navigation, route }) => {
renderItem={renderItem}
keyExtractor={keyExtractor}
onEndReachedThreshold={0.3}
ListFooterComponent={ListNoMoreComments}
ListEmptyComponent={ListEmptyComments}
ListFooterComponent={comments.length ? ListNoMoreComments : null}
/>
</SceneContainer>
);
Expand Down
7 changes: 4 additions & 3 deletions app/src/scenes/Reports/Observations.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SceneContainer from '../../components/SceneContainer';
import ScreenTitle from '../../components/ScreenTitle';
import { refreshTriggerState } from '../../components/Loader';
import { FlashListStyled } from '../../components/Lists';
import { ListNoMoreObservations } from '../../components/ListEmptyContainer';
import { ListEmptyObservations, ListNoMoreObservations } from '../../components/ListEmptyContainer';
import { observationsForReport } from './selectors';
import { getPeriodTitle } from './utils';
import { currentTeamState } from '../../recoil/auth';
Expand Down Expand Up @@ -45,7 +45,7 @@ const Observations = ({ navigation, route }) => {
};

return (
<SceneContainer>
<SceneContainer backgroundColor="#fff">
<ScreenTitle title={`Observations\n${getPeriodTitle(date, currentTeam?.nightSession)}`} onBack={navigation.goBack} />
<FlashListStyled
refreshing={refreshTrigger.status}
Expand All @@ -56,7 +56,8 @@ const Observations = ({ navigation, route }) => {
estimatedItemSize={545}
keyExtractor={keyExtractor}
onEndReachedThreshold={0.3}
ListFooterComponent={ListNoMoreObservations}
ListEmptyComponent={ListEmptyObservations}
ListFooterComponent={observations.length > 0 ? ListNoMoreObservations : null}
/>
</SceneContainer>
);
Expand Down
9 changes: 6 additions & 3 deletions app/src/scenes/Reports/RencontresForReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SceneContainer from '../../components/SceneContainer';
import ScreenTitle from '../../components/ScreenTitle';
import { refreshTriggerState } from '../../components/Loader';
import { FlashListStyled } from '../../components/Lists';
import { ListNoMoreComments } from '../../components/ListEmptyContainer';
import { ListEmptyRencontres, ListNoMoreRencontres } from '../../components/ListEmptyContainer';
import { rencontresForReport } from './selectors';
import { getPeriodTitle } from './utils';
import { currentTeamState } from '../../recoil/auth';
Expand All @@ -14,6 +14,8 @@ const keyExtractor = (item) => item._id;
const RencontresForReport = ({ navigation, route }) => {
const date = route?.params?.date;
const rencontres = useRecoilValue(rencontresForReport({ date }));
console.log('date', date);
console.log('rencontres', rencontres);
const [refreshTrigger, setRefreshTrigger] = useRecoilState(refreshTriggerState);
const currentTeam = useRecoilValue(currentTeamState);

Expand All @@ -32,7 +34,7 @@ const RencontresForReport = ({ navigation, route }) => {
};

return (
<SceneContainer>
<SceneContainer backgroundColor="#fff">
<ScreenTitle title={`Rencontres \n${getPeriodTitle(date, currentTeam?.nightSession)}`} onBack={navigation.goBack} />
<FlashListStyled
refreshing={refreshTrigger.status}
Expand All @@ -43,7 +45,8 @@ const RencontresForReport = ({ navigation, route }) => {
renderItem={renderItem}
keyExtractor={keyExtractor}
onEndReachedThreshold={0.3}
ListFooterComponent={ListNoMoreComments}
ListEmptyComponent={ListEmptyRencontres}
ListFooterComponent={rencontres.length > 0 ? ListNoMoreRencontres : null}
/>
</SceneContainer>
);
Expand Down
14 changes: 8 additions & 6 deletions app/src/scenes/Reports/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ const Report = ({ navigation, route }) => {
[currentTeam?.name, currentTeam?.nightSession, day]
);

console.log(day, { rencontres });

return (
<SceneContainer>
<ScreenTitle
Expand Down Expand Up @@ -242,33 +244,33 @@ const Report = ({ navigation, route }) => {
<Row
withNextButton
caption={`Actions complétées (${actionsCompleted.length})`}
onPress={() => navigation.navigate('Actions', { date: reportDB?.date, status: DONE })}
onPress={() => navigation.navigate('Actions', { date: day, status: DONE })}
disabled={!actionsCompleted.length}
/>
<Row
withNextButton
caption={`Actions créées (${actionsCreated.length})`}
onPress={() => navigation.navigate('Actions', { date: reportDB?.date, status: null })}
onPress={() => navigation.navigate('Actions', { date: day, status: null })}
disabled={!actionsCreated.length}
/>
<Row
withNextButton
caption={`Actions annulées (${actionsCanceled.length})`}
onPress={() => navigation.navigate('Actions', { date: reportDB?.date, status: CANCEL })}
onPress={() => navigation.navigate('Actions', { date: day, status: CANCEL })}
disabled={!actionsCanceled.length}
/>
<Spacer height={30} />
<Row
withNextButton
caption={`Commentaires (${comments.length})`}
onPress={() => navigation.navigate('CommentsForReport', { date: reportDB?.date })}
onPress={() => navigation.navigate('CommentsForReport', { date: day })}
disabled={!comments.length}
/>
<Spacer height={30} />
<Row
withNextButton
caption={`Rencontres (${rencontres.length})`}
onPress={() => navigation.navigate('RencontresForReport', { date: reportDB?.date })}
onPress={() => navigation.navigate('RencontresForReport', { date: day })}
disabled={!rencontres.length}
/>
{!!organisation.territoriesEnabled && (
Expand All @@ -277,7 +279,7 @@ const Report = ({ navigation, route }) => {
<Row
withNextButton
caption={`Observations (${observations.length})`}
onPress={() => navigation.navigate('Observations', { date: reportDB?.date })}
onPress={() => navigation.navigate('Observations', { date: day })}
disabled={!observations.length}
/>
</>
Expand Down

0 comments on commit d67923d

Please sign in to comment.