Skip to content

Commit

Permalink
Merge pull request #1290 from BLSQ/IA-2915-descriptions-of-mobile-fea…
Browse files Browse the repository at this point in the history
…ture-flags-on-hover

IA-2915: Add descriptions of mobile feature flags on hover
  • Loading branch information
quang-le authored May 7, 2024
2 parents 65037fd + be74b3e commit dffd721
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 6 deletions.
16 changes: 16 additions & 0 deletions hat/assets/js/apps/Iaso/domains/app/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,22 @@
"iaso.projects.needsAuthentication": "Requires authentication",
"iaso.projects.true": "User needs authentication",
"iaso.projects.update": "Update project",
"iaso.projets.featureflag.tooltip.check_position_for_forms": "Downloads only the geo data of the zone assigned to the user (for offline use)",
"iaso.projets.featureflag.tooltip.data_collection": "Tab enabling to propose changes to org units and their reference form(s)",
"iaso.projets.featureflag.tooltip.entity": "Track the user's position every 15 minutes over a period of time",
"iaso.projets.featureflag.tooltip.gps_tracking": "Tab enabling to see the assigned data collection points via the Planning feature",
"iaso.projets.featureflag.tooltip.limit_ou_download_to_roots": "Propose changes to org units and their related reference form(s)",
"iaso.projets.featureflag.tooltip.mobile_check_forms_update": "Notify the user when changes to the geo data (Org units) have been done on the web",
"iaso.projets.featureflag.tooltip.mobile_check_ou_update": "Forms are automatically synchronized provided the user has connectivity",
"iaso.projets.featureflag.tooltip.mobile_finalized_form_are_read": "Tab in the mobile application to show the geographic information available for the selected Org Unit",
"iaso.projets.featureflag.tooltip.mobile_force_forms_update": "Notify and force the user tp update when changes to the geo data (Org units) have been done on the web",
"iaso.projets.featureflag.tooltip.mobile_force_ou_update": "Blocks the edition of forms from the mobile app once finalized",
"iaso.projets.featureflag.tooltip.planning": "Notify and force the user to update when new form versions have been uploaded on the web",
"iaso.projets.featureflag.tooltip.reports": "Tab enabling the feature to collect data from the IASO mobile application",
"iaso.projets.featureflag.tooltip.require_authentication": "Users have to enter their login and password on the mobile application before proceeding to the data collection",
"iaso.projets.featureflag.tooltip.show_detail_map_on_mobile": "Notify the user when new form versions have been uploaded on the web",
"iaso.projets.featureflag.tooltip.take_gps_on_form": "A GPS point is automatically taken and associated to the form submission",
"iaso.projets.featureflag.tooltip.transport_tracking": "Users have to be 50m away max to the Org Unit GPS point for the form to open",
"iaso.projets.label.appIdError": "\", ?, /, %, &, - and whitespace are not allowed in app id",
"iaso.province": "Province",
"iaso.queryBuilder.supportedTypeFields": "Supported type of fields",
Expand Down
16 changes: 16 additions & 0 deletions hat/assets/js/apps/Iaso/domains/app/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,22 @@
"iaso.projects.needsAuthentication": "Nécessite une authentification",
"iaso.projects.true": "L'utilisateur a besoin d'une authentification",
"iaso.projects.update": "Modifier un projet",
"iaso.projets.featureflag.tooltip.check_position_for_forms": "Télécharge uniquement les données géographiques de la zone attribuée à l'utilisateur (pour une utilisation hors connexion)",
"iaso.projets.featureflag.tooltip.data_collection": "Onglet permettant de proposer des modifications aux unités d'organisations et à leur(s) formulaire(s) de référence",
"iaso.projets.featureflag.tooltip.entity": "Suivez la position de l'utilisateur toutes les 15 minutes sur une période donnée",
"iaso.projets.featureflag.tooltip.gps_tracking": "Onglet permettant de visualiser les points de collecte de données attribués via la fonctionnalité de planification",
"iaso.projets.featureflag.tooltip.limit_ou_download_to_roots": "Proposer des modifications aux unités d'organisations et à leur(s) formulaire(s) de référence associé(s)",
"iaso.projets.featureflag.tooltip.mobile_check_forms_update": "Avertir l'utilisateur lorsque des modifications ont été apportées aux données géographiques (unités d'organisations) sur le Web",
"iaso.projets.featureflag.tooltip.mobile_check_ou_update": "Les formulaires sont automatiquement synchronisés à condition que l'utilisateur dispose d'une connectivité",
"iaso.projets.featureflag.tooltip.mobile_finalized_form_are_read": "Onglet dans l'application mobile pour afficher les informations géographiques disponibles pour l'unité d'organisation sélectionnée",
"iaso.projets.featureflag.tooltip.mobile_force_forms_update": "Notifier et forcer l'utilisateur à se mettre à jour lorsque des modifications ont été apportées aux données géographiques (unités d'organisations) sur le Web",
"iaso.projets.featureflag.tooltip.mobile_force_ou_update": "Bloque l'édition des formulaires depuis l'application mobile une fois finalisés",
"iaso.projets.featureflag.tooltip.planning": "Avertir et forcer l'utilisateur à mettre à jour lorsque de nouvelles versions de formulaire ont été téléchargées sur le Web",
"iaso.projets.featureflag.tooltip.reports": "Onglet permettant la fonctionnalité de collecte de données depuis l'application mobile IASO",
"iaso.projets.featureflag.tooltip.require_authentication": "Les utilisateurs doivent saisir leur identifiant et leur mot de passe sur l'application mobile avant de procéder à la collecte des données.",
"iaso.projets.featureflag.tooltip.show_detail_map_on_mobile": "Avertir l'utilisateur lorsque de nouvelles versions de formulaire ont été téléchargées sur le Web",
"iaso.projets.featureflag.tooltip.take_gps_on_form": "Un point GPS est automatiquement pris et associé à la soumission du formulaire",
"iaso.projets.featureflag.tooltip.transport_tracking": "Les utilisateurs doivent se trouver à 50 m maximum du point GPS de l'unité d'organisation pour que le formulaire s'ouvre",
"iaso.projets.label.appIdError": "Les symboles \", ?, /, %, &, - et les espaces ne sont pas autorisés dans l'app id",
"iaso.province": "Province",
"iaso.queryBuilder.supportedTypeFields": "Type de champ supportés",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* eslint-disable react/jsx-props-no-spreading */
import React, { FunctionComponent } from 'react';

import { Chip, Tooltip } from '@mui/material';
import { useSafeIntl } from 'bluesquare-components';
import InputComponent from '../../../components/forms/InputComponent';
import { commaSeparatedIdsToArray } from '../../../utils/forms';
import MESSAGES from '../messages';
Expand All @@ -23,20 +25,50 @@ type Props = {
isFetchingFeatureFlag: boolean;
};

const renderOption = (props, option) => (
<Tooltip key={option.value} title={option.tooltip} disableInteractive>
<span {...props}>{option.label}</span>
</Tooltip>
);

const renderTags = (value, getTagProps) =>
value.map((option, index) => (
<Tooltip
key={option.value}
title={option.tooltip}
placement="bottom-end"
disableInteractive
>
<Chip
color="primary"
label={option.label}
{...getTagProps({ index })}
/>
</Tooltip>
));

const ProjectFeatureFlags: FunctionComponent<Props> = ({
setFieldValue,
currentProject,
featureFlags,
isFetchingFeatureFlag,
}) => {
const { formatMessage } = useSafeIntl();
const options = React.useMemo(
() =>
featureFlags?.map(fF => ({
label: fF.name,
value: fF.id,
})),
[featureFlags],
featureFlags?.map(fF => {
return {
label: fF.name,
value: fF.id,
tooltip:
formatMessage(
MESSAGES[`${fF.code.toLowerCase()}_tooltip`],
) || fF.name,
};
}),
[featureFlags, formatMessage],
);

return (
<InputComponent
multi
Expand All @@ -51,6 +83,8 @@ const ProjectFeatureFlags: FunctionComponent<Props> = ({
type="select"
options={options}
label={MESSAGES.featureFlags}
renderOption={renderOption}
renderTags={renderTags}
/>
);
};
Expand Down
80 changes: 80 additions & 0 deletions hat/assets/js/apps/Iaso/domains/projects/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,86 @@ const MESSAGES = defineMessages({
defaultMessage:
'", ?, /, %, &, - and whitespace are not allowed in app id',
},
require_authentication_tooltip: {
id: 'iaso.projets.featureflag.tooltip.require_authentication',
defaultMessage:
'Users have to enter their login and password on the mobile application before proceeding to the data collection',
},
reports_tooltip: {
id: 'iaso.projets.featureflag.tooltip.reports',
defaultMessage:
'Tab enabling the feature to collect data from the IASO mobile application',
},
take_gps_on_form_tooltip: {
id: 'iaso.projets.featureflag.tooltip.take_gps_on_form',
defaultMessage:
'A GPS point is automatically taken and associated to the form submission',
},
transport_tracking_tooltip: {
id: 'iaso.projets.featureflag.tooltip.transport_tracking',
defaultMessage:
'Users have to be 50m away max to the Org Unit GPS point for the form to open',
},
gps_tracking_tooltip: {
id: 'iaso.projets.featureflag.tooltip.gps_tracking',
defaultMessage:
'Tab enabling to see the assigned data collection points via the Planning feature',
},
check_position_for_forms_tooltip: {
id: 'iaso.projets.featureflag.tooltip.check_position_for_forms',
defaultMessage:
'Downloads only the geo data of the zone assigned to the user (for offline use)',
},
mobile_finalized_form_are_read_tooltip: {
id: 'iaso.projets.featureflag.tooltip.mobile_finalized_form_are_read',
defaultMessage:
'Tab in the mobile application to show the geographic information available for the selected Org Unit',
},
limit_ou_download_to_roots_tooltip: {
id: 'iaso.projets.featureflag.tooltip.limit_ou_download_to_roots',
defaultMessage:
'Propose changes to org units and their related reference form(s)',
},
data_collection_tooltip: {
id: 'iaso.projets.featureflag.tooltip.data_collection',
defaultMessage:
'Tab enabling to propose changes to org units and their reference form(s)',
},
entity_tooltip: {
id: 'iaso.projets.featureflag.tooltip.entity',
defaultMessage:
"Track the user's position every 15 minutes over a period of time",
},
show_detail_map_on_mobile_tooltip: {
id: 'iaso.projets.featureflag.tooltip.show_detail_map_on_mobile',
defaultMessage:
'Notify the user when new form versions have been uploaded on the web',
},
planning_tooltip: {
id: 'iaso.projets.featureflag.tooltip.planning',
defaultMessage:
'Notify and force the user to update when new form versions have been uploaded on the web',
},
mobile_check_forms_update_tooltip: {
id: 'iaso.projets.featureflag.tooltip.mobile_check_forms_update',
defaultMessage:
'Notify the user when changes to the geo data (Org units) have been done on the web',
},
mobile_force_forms_update_tooltip: {
id: 'iaso.projets.featureflag.tooltip.mobile_force_forms_update',
defaultMessage:
'Notify and force the user tp update when changes to the geo data (Org units) have been done on the web',
},
mobile_check_ou_update_tooltip: {
id: 'iaso.projets.featureflag.tooltip.mobile_check_ou_update',
defaultMessage:
'Forms are automatically synchronized provided the user has connectivity',
},
mobile_force_ou_update_tooltip: {
id: 'iaso.projets.featureflag.tooltip.mobile_force_ou_update',
defaultMessage:
'Blocks the edition of forms from the mobile app once finalized',
},
});

export default MESSAGES;

0 comments on commit dffd721

Please sign in to comment.