Skip to content

Commit

Permalink
add homeTable skeleton (#106)
Browse files Browse the repository at this point in the history
* add homeTable skeleton

* connect filters with table

* exclude translation files in sonar analysis (duplicate lines)

* add sort

* add commentDialog and link to SU page

* add some home table tests

* add states contactOutcome and closingCause

* rework accountNavigation

* review

* rework translation

* rename translate.ts and move file in hooks folder
  • Loading branch information
RenauxLeaInsee authored May 21, 2024
1 parent d4fd326 commit c9866d7
Show file tree
Hide file tree
Showing 32 changed files with 1,168 additions and 158 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sonor",
"private": true,
"version": "2.0.33",
"version": "2.0.34",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
3 changes: 2 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
sonar.projectKey=InseeFr_Sonor
sonar.organization=inseefr
sonar.organization=inseefr
sonar.exclusions=src/i18n-fr.js,src/i18n-en.js
1 change: 1 addition & 0 deletions src/constants/closingCauses.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const closingCausesEnum = ["NPA", "NPI", "NPX", "ROW"];
13 changes: 13 additions & 0 deletions src/constants/contactOutcome.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const contactOutcomeEnum = [
"INA",
"IMP",
"REF",
"ALA",
"UCD",
"UTR",
"DCD",
"NUH",
"DUK",
"DUU",
"NOA",
];
17 changes: 17 additions & 0 deletions src/constants/surveyUnitStates.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export const surveyUnitStatesEnum = [
"NVM",
"NNS",
"ANV",
"VIN",
"VIC",
"PRC",
"AOC",
"APS",
"INS",
"WFT",
"WFS",
"TBR",
"FIN",
"NVA",
"CLO",
];
4 changes: 2 additions & 2 deletions src/hooks/useSearchFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type Filter = {
ssech: string[];
interviewer: string[];
states: string[];
closingCause: string[];
result: string[];
priority: string[];
all: { name: string; value: string }[];
};
Expand All @@ -17,7 +17,7 @@ export const emptyFilter: Filter = {
ssech: [],
interviewer: [],
states: [],
closingCause: [],
result: [],
priority: [],
all: [],
};
Expand Down
11 changes: 11 additions & 0 deletions src/hooks/useTranslation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { useIntl } from "react-intl";

export const useTranslation = () => {
const intl = useIntl();

return {
translate: (id: string) => {
return intl.formatMessage({ id });
},
};
};
62 changes: 59 additions & 3 deletions src/i18n-en.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ export const messagesEn = {
goToNotifyPage: 'Notify' ,
goToCollectOrganization: 'Organization of collections',
goToReassignment: 'Reassignment',
goToHelp: 'HELP',
goToHelp: 'help',
logout: 'Logout',
selectFavoriteSurveys: 'Select my favorite surveys',
selectFavoriteSurveys: 'my favorite surveys',
resetFilters: 'Reset filters',
searchLabel: 'Search',
searchInterviewerPlaceholder: 'lastname, firstname',
Expand All @@ -19,6 +19,62 @@ export const messagesEn = {
subSampleFilterLabel: 'Sub-sample...',
interviewerFilterLabel: 'Interviewer...',
statesFilterLabel: 'States...',
closingCauseFilterLabel: 'Closing cause...',
resultFilterLabel: 'Result...',
priorityFilterLabel: 'Priority...',
id: 'Identifier',
survey: 'Survey',
subSample: 'Sub-sample',
interviewer: 'Interviewer',
state: 'State',
closingCause: 'Closing cause',
result: 'Result',
contactOutcome: 'Contact outcome',
priority: 'Priority',
actions: 'Actions',
yes: 'Yes',
no: 'No',
readQuestionnaire: 'Read questionnaire',
close: 'Close',
comment: 'Comment',
surveyUnitNumber: 'SU n.',
commentPlaceholder: 'Write a comment',
commentDialogHelpText: 'Edit the text directly in the input field and click “validate” to validate your changes.',
delete:'delete',
cancel: 'cancel',
closeButtonLabel: 'close',
validate: 'validate',
labelRowsPerPage: 'Rows per page:',
labelDisplayedRows: 'entities displayed',
on: 'on',
NVM: 'Not visible to management',
NNS: 'Not Assigned, not started',
ANV: 'Assigned Not Visible to the interviewer',
VIN: 'Visible to the interviewer and not clickable',
VIC: 'Visible to the interviewer and clickable',
PRC: 'Preparing contact',
AOC: 'At least one contact made',
APS: 'Appointment scheduled',
INS: 'Interview started',
WFT: 'Waiting for transmission',
WFS: 'Waiting for synchronization',
TBR: 'To be reviewed',
FIN: 'Finalized',
NVA: 'Not available to all',
CLO: 'Closed',
NPA: 'Not processed : interviewer absence',
NPI: 'Not processed : interviewer presence',
NPX: 'Not processed for exceptional reason',
ROW: 'Right of withdrawal',
INA: 'Interview accepted',
IMP: 'Impossible to reach',
REF: 'Refusal',
ALA: 'Already answered (other mode)',
UCD: 'Unusable Contact Data',
UTR: 'Unable To Respond',
DCD: 'Deceased',
NUH: 'No longer Used for Habitation',
DUK: 'Definitely unavailable for a known reason',
DUU: 'Definitely unavailable for an unknown reason',
NOA: 'Not applicable',
myProfile: 'My profile'
}
62 changes: 59 additions & 3 deletions src/i18n-fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ export const messagesFr = {
goToNotifyPage: 'Notifier',
goToCollectOrganization: 'Organisation des collectes',
goToReassignment: 'Réaffectation',
goToHelp: 'AIDE',
goToHelp: 'aide',
logout: 'Se déconnecter',
selectFavoriteSurveys: 'Sélectionner mes enquêtes favorites',
selectFavoriteSurveys: 'mes enquêtes favorites',
resetFilters: 'Réinitialiser les filtres',
searchLabel: 'Recherche',
searchInterviewerPlaceholder: 'nom, prénom',
Expand All @@ -19,6 +19,62 @@ export const messagesFr = {
subSampleFilterLabel: 'Sous-échantillon...',
interviewerFilterLabel: 'Enquêteur...',
statesFilterLabel: 'Etat...',
closingCauseFilterLabel: 'Bilan agrégé...',
resultFilterLabel: 'Résultat...',
priorityFilterLabel: 'Prioritaire...',
id: 'Identifiant',
survey: 'Enquête',
subSample: 'Sous-éch.',
interviewer: 'Enquêteur',
state: 'Etat',
closingCause: 'Motif de clotûre',
result: 'Résultat',
contactOutcome: 'Bilan des contacts',
priority: 'Prioritaire',
actions: 'Actions',
yes: 'Oui',
no: 'Non',
readQuestionnaire: 'Relire le questionnaire',
close: 'Clôturer',
comment: 'Commentaire',
surveyUnitNumber: 'UE n°',
commentPlaceholder: 'Rédiger un commentaire',
commentDialogHelpText: 'Modifiez le texte directement dans le champ de saisie et cliquez sur “valider” pour valider vos changements.',
delete:'supprimer',
cancel: 'annuler',
closeButtonLabel: 'fermer',
validate: 'valider',
labelRowsPerPage: 'Lignes par page :',
labelDisplayedRows: 'entités affichées',
on: 'sur',
NVM: 'UE non visible gestionnaire',
NNS: 'Non affecté, non commencé',
ANV: 'Affectée, non visible enquêteur',
VIN: 'Visible enquêteur et non cliquable',
VIC: 'Visible enquêteur et cliquable',
PRC: 'Prise de contact en préparation',
AOC: 'Au moins un contact',
APS: 'Rendez-vous pris',
INS: 'Questionnaire démarré',
WFT: 'UE en attente de transmission',
WFS: 'UE en attente de synchronisation',
TBR: 'UE à relire DEM',
FIN: 'UE finalisée',
NVA: 'UE non visible gestionnaire',
CLO: 'Clôturée',
NPA: 'Non traité enquêteur absent',
NPI: 'Non traité enquêteur présent',
NPX: 'Non traité pour cause exceptionnelle',
ROW: 'Droit de retrait',
INA: 'Enquête acceptée',
IMP: 'Impossible à joindre',
REF: 'Refus',
ALA: 'Déjà répondu (autre mode)',
UCD: 'Données de contact inutilisables (tél, mail)',
UTR: 'Incapacité à répondre',
DCD: 'Enquêté décédé',
NUH: 'Logement ayant perdu son usage d\'habitation',
DUK: 'Indisponibilité définitive pour motif connu',
DUU: 'Indisponibilité définitive pour motif inconnu',
NOA: 'Sans objet',
myProfile: 'Mon profil'
}
8 changes: 5 additions & 3 deletions src/pages/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography";
import { FiltersCard } from "../ui/FiltersCard";
import { useIntl } from "react-intl";
import { HomeTableCard } from "../ui/HomeTableCard";
import { useTranslation } from "../hooks/useTranslation";

export const Home = () => {
const intl = useIntl();
const { translate } = useTranslation();

return (
<Stack px={4} py={2} gap={2}>
<Typography variant="headlineLarge" fontWeight={"400"} pb={2} pt={1} alignSelf={"center"}>
{intl.formatMessage({ id: "homepageTitle" })}
{translate("homepageTitle")}
</Typography>
<FiltersCard />
<HomeTableCard />
</Stack>
);
};
7 changes: 7 additions & 0 deletions src/pages/SurveyUnitPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Stack } from "@mui/material";
import { useParams } from "react-router-dom";

export const SurveyUnitPage = () => {
const { id } = useParams();
return <Stack>UE {id}</Stack>;
};
2 changes: 2 additions & 0 deletions src/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ClosePage } from "./pages/ClosePage";
import { NotifyPage } from "./pages/NotifyPage";
import { CollectOrganizationPage } from "./pages/CollectOrganizationPage";
import { ReassignmentPage } from "./pages/ReassignmentPage";
import { SurveyUnitPage } from "./pages/SurveyUnitPage";

export const routes: RouteObject[] = [
{
Expand All @@ -26,6 +27,7 @@ export const routes: RouteObject[] = [
{ path: "notify", element: <NotifyPage /> },
{ path: "collectOrganization", element: <CollectOrganizationPage /> },
{ path: "reassignment", element: <ReassignmentPage /> },
{ path: "survey-unit/:id", element: <SurveyUnitPage /> },
],
},
];
Loading

0 comments on commit c9866d7

Please sign in to comment.