Skip to content

Commit

Permalink
fix: import paths
Browse files Browse the repository at this point in the history
  • Loading branch information
MailineN committed Aug 6, 2024
1 parent 46050f9 commit 394db4c
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 43 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@emotion/react": "^11.10.4",
"@emotion/styled": "^11.10.4",
"@inseefr/lunatic": "2.0.7-v2",
"@inseefrlab/lunatic-edt": "0.13.2",
"@inseefrlab/lunatic-edt": "0.13.3",
"@mui/material": "^5.10.7",
"@mui/styles": "^5.12.0",
"@react-pdf/font": "2.2.1",
Expand Down
2 changes: 1 addition & 1 deletion src/components/edt/DayCard/DayCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useTranslation } from "react-i18next";
import { isMobile } from "service/responsive";
import { getQualityScore } from "service/summary-service";
import { getActivitiesOrRoutes, getScore } from "service/survey-activity-service";
import { getStatutSurvey, isDemoMode } from "service/survey-service";
import { getStatutSurvey, isDemoMode } from "service/survey-state-service";
import { isReviewer } from "service/user-service";

interface DayCardProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,12 @@ import {
getSource,
getSurveyDate,
getSurveyRights,
isDemoMode,
lockSurvey,
refreshSurvey,
saveData,
saveDataLocally,
setValue,
surveyLocked,
} from "service/survey-service";
import { isDemoMode, isSurveyLocked, lockSurvey } from "service/survey-state-service";
import { isReviewer } from "service/user-service";
import { getClassCondition, getSurveyIdFromUrl } from "utils/utils";
import { v4 as uuidv4 } from "uuid";
Expand Down Expand Up @@ -376,7 +374,7 @@ const ActivityOrRoutePlannerPage = () => {
const [score, setScore] = React.useState<number | undefined>(undefined);

const [isAlertLockDisplayed, setIsAlertLockDisplayed] = useState<boolean>(false);
const [isLocked, setIsLocked] = useState<boolean>(surveyLocked(idSurvey));
const [isLocked, setIsLocked] = useState<boolean>(isSurveyLocked(idSurvey));
const [error, setError] = useState<ErrorCodeEnum | undefined>(undefined);
const [menuActivityPlannerDisplayed, setMenuActivityPlannerDisplayed] = React.useState(
isItDesktop && isSubChildDisplayed,
Expand Down Expand Up @@ -694,7 +692,7 @@ const ActivityOrRoutePlannerPage = () => {
>
<Box id="inner-content-scroll" className={classes.innerContentScroll}>
<FlexCenter>
<Alert
{/* <Alert
isAlertDisplayed={isAlertDisplayed}
onCompleteCallBack={closeActivity(true, idSurvey)}
onCancelCallBack={displayAlert(setIsAlertDisplayed, false)}
Expand All @@ -704,7 +702,7 @@ const ActivityOrRoutePlannerPage = () => {
aria-label={t("page.alert-when-quit.alt-alert-icon")}
/>
}
></Alert>
></Alert> */}
<Box
className={getClassCondition(
isReviewerMode() && activitiesRoutesOrGaps.length !== 0,
Expand All @@ -715,7 +713,7 @@ const ActivityOrRoutePlannerPage = () => {
{activitiesRoutesOrGaps.length !== 0 &&
(isReviewerMode() ? (
<Box className={classes.headerActivityLockBox}>
<Alert
{/* <Alert
isAlertDisplayed={isAlertLockDisplayed}
onCompleteCallBack={lock}
onCancelCallBack={displayAlert(
Expand All @@ -734,7 +732,7 @@ const ActivityOrRoutePlannerPage = () => {
)}
/>
}
></Alert>
></Alert> */}
<Box className={classes.headerActivityBox}>
<Typography className={classes.label}>
{t(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
import { isDesktop } from "service/responsive";
import { getActivitiesOrRoutes, surveyReadOnly } from "service/survey-activity-service";
import { getData, getValue, getValueOfData, saveDataLocally } from "service/survey-service";
import { isSurveyCompleted } from "service/survey-state-service";
import { getSurveyIdFromUrl } from "utils/utils";

const ActivityDurationPage = () => {
Expand Down Expand Up @@ -172,7 +173,7 @@ const ActivityDurationPage = () => {
};

const onClose = (forceQuit: boolean) => {
const isCompleted = getValue(idSurvey, FieldNameEnum.ISCOMPLETED, currentIteration);
const isCompleted = isSurveyCompleted(idSurvey);
const isCloture = getValue(idSurvey, FieldNameEnum.ISCLOSED) as boolean;
if (!openSnackbar) {
if (!isCompleted) {
Expand Down Expand Up @@ -219,7 +220,7 @@ const ActivityDurationPage = () => {
isRoute={isRoute}
>
<FlexCenter>
<Alert
{/* <Alert
isAlertDisplayed={isAlertDisplayed}
onCompleteCallBack={useCallback(
() => setIsAlertDisplayed(false),
Expand All @@ -228,7 +229,7 @@ const ActivityDurationPage = () => {
onCancelCallBack={useCallback(cancel => onClose(cancel), [])}
labels={getLabelsWhenQuit(isRoute)}
icon={<ErrorIcon aria-label={t("page.alert-when-quit.alt-alert-icon")} />}
></Alert>
></Alert> */}
<Snackbar
className={isDesktop() ? classes.snackbarDesktop : classes.snackbar}
open={openSnackbar}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@ import { OrchestratorContext } from "interface/lunatic/Lunatic";
import { useTranslation } from "react-i18next";
import { useLocation, useOutletContext, useParams } from "react-router-dom";
import {
addToSecondaryActivityReferentiel,
getActivitySecondaryActivityRef,
getAutoCompleteRef,
getNewSecondaryActivities,
getRouteSecondaryActivityRef,
} from "service/referentiel-service";
import { CreateIndexation, getIndexSuggester } from "service/suggester-service";
import { surveyReadOnly } from "service/survey-activity-service";
import {
addToSecondaryActivityReferentiel,
getNewSecondaryActivities,
getValue,
} from "service/survey-service";
import { getValue } from "service/survey-service";
import { getSurveyIdFromUrl } from "utils/utils";

const SecondaryActivitySelectionPage = () => {
Expand Down
14 changes: 6 additions & 8 deletions src/pages/activity/activity-summary/ActivitySummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,11 @@ import {
getSurveyRights,
getValue,
isDemoMode,
lockSurvey,
refreshSurvey,
saveData,
setValue,
surveyLocked,
validateSurvey,
} from "service/survey-service";
import { isSurveyLocked, lockSurvey, validateSurvey } from "service/survey-state-service";
import { getUserRights } from "service/user-service";
import ActivitiesSummaryExportTemplate from "template/summary-export/ActivitiesSummaryExportTemplate";
import { getClassCondition, getSurveyIdFromUrl } from "utils/utils";
Expand Down Expand Up @@ -423,7 +421,7 @@ const ActivitySummaryPage = () => {

const [isAlertLockDisplayed, setIsAlertLockDisplayed] = useState<boolean>(false);
const [isAlertValidateDisplayed, setIsAlertValidateDisplayed] = useState<boolean>(false);
const [isLocked, setIsLocked] = useState<boolean>(surveyLocked(idSurvey));
const [isLocked, setIsLocked] = useState<boolean>(isSurveyLocked(idSurvey));

const variableEdited = existVariableEdited(idSurvey);

Expand Down Expand Up @@ -524,7 +522,7 @@ const ActivitySummaryPage = () => {
{activitiesRoutesOrGaps.length !== 0 &&
(isReviewerMode ? (
<Box className={classes.headerActivityLockBox}>
<Alert
{/* <Alert
isAlertDisplayed={isAlertLockDisplayed}
onCompleteCallBack={lock}
onCancelCallBack={displayAlert(setIsAlertLockDisplayed, false)}
Expand All @@ -534,7 +532,7 @@ const ActivitySummaryPage = () => {
aria-label={t("page.alert-when-quit.alt-alert-icon")}
/>
}
></Alert>
></Alert> */}
<Box className={classes.headerActivityBox}>
<Typography className={classes.label}>
{t("page.activity-planner.activity-for-day")}
Expand Down Expand Up @@ -639,15 +637,15 @@ const ActivitySummaryPage = () => {
<FlexCenter className={classes.download}>
{isReviewerMode ? (
<>
<Alert
{/* <Alert
isAlertDisplayed={isAlertValidateDisplayed}
onCompleteCallBack={validate}
onCancelCallBack={displayAlert(setIsAlertValidateDisplayed, false)}
labels={alertValidateLabels}
icon={
<ErrorIcon aria-label={t("page.alert-when-quit.alt-alert-icon")} />
}
></Alert>
></Alert> */}
<Button variant="outlined" onClick={back} className={classes.buttonNav}>
{t("common.navigation.back")}
</Button>
Expand Down
8 changes: 3 additions & 5 deletions src/pages/home-surveyed/HomeSurveyed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,12 @@ import {
initializeHomeSurveys,
initializeSurveysDatasCache,
initializeSurveysIdsDemo,
isDemoMode,
lockAllSurveys,
nameSurveyGroupMap,
saveData,
surveysIds,
userDatasMap,
validateAllEmptySurveys,
} from "service/survey-service";
import { isDemoMode, lockAllSurveys, validateAllEmptySurveys } from "service/survey-state-service";
import { getUserRights } from "service/user-service";
import { groupBy } from "utils/utils";

Expand Down Expand Up @@ -374,9 +372,9 @@ const HomeSurveyedPage = () => {

return (
<>
<FlexCenter>
{/* <FlexCenter>
<Alert {...alertProps} />
</FlexCenter>
</FlexCenter> */}
<Box className={classes.headerBox}>
{isReviewer ? (
<Box className={classes.reviewerButtonBox}>
Expand Down
7 changes: 3 additions & 4 deletions src/service/suggester-service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { AutoCompleteActiviteOption } from "@inseefrlab/lunatic-edt";
import elasticlunr, { Index } from "elasticlunrjs";
import { Dispatch, SetStateAction } from "react";
import stopWords from "../utils/stop_words_french.json";
import pairSynonymes from "../utils/synonymes-misspellings.json";
import { stopWordsFrench, synonymesMisspellings } from "assets/surveyData";

/**
* Remove accents
Expand Down Expand Up @@ -43,7 +42,7 @@ export const skipApostrophes = (labelWithApostrophe: string) => {
export const addMisspellings = (option: AutoCompleteActiviteOption) => {
let labelWithMisspelling = "";

pairSynonymes.forEach(pairSynonyme => {
synonymesMisspellings.forEach((pairSynonyme: { termination: any[]; misspelling: any[] }) => {
const term = pairSynonyme.termination[0];
pairSynonyme.misspelling.forEach(misspelling => {
if (option.label.includes(term)) {
Expand Down Expand Up @@ -81,7 +80,7 @@ export const CreateIndexation = (optionsFiltered: AutoCompleteActiviteOption[])
const optionsFilteredMap = activitesFiltredMap(optionsFiltered);

elasticlunr.clearStopWords();
elasticlunr.addStopWords(stopWords);
elasticlunr.addStopWords(stopWordsFrench);

const temp: Index<AutoCompleteActiviteOption> = elasticlunr();
temp.addField("label");
Expand Down
10 changes: 2 additions & 8 deletions src/service/survey-activity-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,8 @@ import {
getAutoCompleteRef,
getLanguage,
} from "service/referentiel-service";
import {
getData,
getStatutSurvey,
getValue,
getValueOfData,
saveData,
surveysIds,
} from "service/survey-service";
import { getData, getValue, getValueOfData, saveData, surveysIds } from "service/survey-service";
import { getStatutSurvey } from "./survey-state-service";

const checkForMainActivity = (idSurvey: string, i: number, activityOrRoute: ActivityRouteOrGap) => {
const mainActivityId = getValue(idSurvey, FieldNameEnum.MAINACTIVITY_ID, i) as string;
Expand Down
1 change: 1 addition & 0 deletions src/service/survey-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1920,4 +1920,5 @@ export {
toIgnoreForRoute,
userDatasMap,
validateAllGroup,
isDemoMode,
};

0 comments on commit 394db4c

Please sign in to comment.