From dcfba2bcafe68f341029fe618bf48e55b4ecb145 Mon Sep 17 00:00:00 2001
From: Larbi Gharib <larbi.gharib@savoirfairelinux.com>
Date: Tue, 9 Feb 2021 15:48:38 +0100
Subject: [PATCH] Add tool tips permissions

Change-Id: I2b7d29c987af73ce4521f36e002fe87303a51161
---
 .../public/locales/en/translation.json        | 12 +++-
 .../public/locales/fr/translation.json        | 12 +++-
 .../CustomPopupState/CustomPopupState.js      |  2 +-
 .../Blueprint/EditBlueprintPermissions.js     | 59 +++++++++++++------
 .../src/views/Blueprints/Blueprints.js        | 14 ++---
 5 files changed, 68 insertions(+), 31 deletions(-)

diff --git a/jams-react-client/public/locales/en/translation.json b/jams-react-client/public/locales/en/translation.json
index 8f30c98f..b76faa86 100644
--- a/jams-react-client/public/locales/en/translation.json
+++ b/jams-react-client/public/locales/en/translation.json
@@ -147,8 +147,6 @@
     "search_blueprints": "Search blueprints",
     "no_blueprints_found": "No blueprints found",
     "no_blueprint_name": "No blueprint name",
-    "no_description": "No description",
-    "no_users_count": "No users count",
     "add_contact": "Add contact…",
     "remove_contact": "Remove contact",
     "are_you_sure_you_want_to_remove": "Are you sure you want to remove",
@@ -239,5 +237,13 @@
     "select_blueprint": "Select a blueprint",
     "add_moderator_to_blueprint": "Add moderator to blueprint ...",
     "add_moderator_to": "Add moderator to",
-    "remove_moderator": "Remove moderator"
+    "remove_moderator": "Remove moderator",
+    "rendezvous": "Rendezvous",
+    "standalone": "Standalone",
+    "allow_incoming_calls_from_unknown_allow_video_calls_info": "If this option is disabled, only audio calls will be allowed.",
+    "allow_incoming_calls_from_unknown_contacts_info": "If this option is disabled, only contacts from your list will be allowed to contact you.",
+    "auto_answer_calls_info": "If this option is enabled, incomming calls will be automaticly answered. This option can be usefull if you want for example to monitor your house or a particular room when you are away from home.",
+    "local_lan_info": "If this option is enabled, you will be able to communicate with connected contacts on you local lan, even if your lan is disconnected from internet.",
+    "rendezvous_info": "If this option is enabled, incomming calls will automaticly be added to a conference room.",
+    "rendezvous_moderators_info": "Moderators are people allowed to manage rendezvous points and conferences even if they are not hosted on their devices."
 }
diff --git a/jams-react-client/public/locales/fr/translation.json b/jams-react-client/public/locales/fr/translation.json
index e1a21ea1..b9c02a76 100644
--- a/jams-react-client/public/locales/fr/translation.json
+++ b/jams-react-client/public/locales/fr/translation.json
@@ -147,8 +147,6 @@
     "search_blueprints": "Rechercher un gabarit",
     "no_blueprints_found": "Aucun gabarit trouvé",
     "no_blueprint_name": "Aucun nom disponible",
-    "no_description": "Aucune description disponible",
-    "no_users_count": "Aucun utilisateur",
     "add_contact": "Ajouter un contact...",
     "remove_contact": "Supprimer le contact",
     "are_you_sure_you_want_to_remove": "Êtes-vous certain de vouloir supprimer",
@@ -239,5 +237,13 @@
     "select_blueprint": "Select a blueprint",
     "add_moderator_to_blueprint": "Add moderator to blueprint ...",
     "add_moderator_to": "Add moderator to",
-    "remove_moderator": "Remove moderator"
+    "remove_moderator": "Remove moderator",
+    "rendezvous": "Rendezvous",
+    "standalone": "Standalone",
+    "allow_incoming_calls_from_unknown_allow_video_calls_info": "If this option is disabled, only audio calls will be allowed.",
+    "allow_incoming_calls_from_unknown_contacts_info": "If this option is disabled, only contacts from your list will be allowed to contact you.",
+    "auto_answer_calls_info": "If this option is enabled, incomming calls will be automaticly answered. This option can be usefull if you want for example to monitor your house or a particular room when you are away from home.",
+    "local_lan_info": "If this option is enabled, you will be able to communicate with connected contacts on you local lan, even if your lan is disconnected from internet.",
+    "rendezvous_info": "If this option is enabled, incomming calls will automaticly be added to a conference room.",
+    "rendezvous_moderators_info": "Moderators are people allowed to manage rendezvous points and conferences even if they are not hosted on their devices."
 }
diff --git a/jams-react-client/src/components/CustomPopupState/CustomPopupState.js b/jams-react-client/src/components/CustomPopupState/CustomPopupState.js
index b58a3814..9e1c44ea 100644
--- a/jams-react-client/src/components/CustomPopupState/CustomPopupState.js
+++ b/jams-react-client/src/components/CustomPopupState/CustomPopupState.js
@@ -15,7 +15,7 @@ export default function CustomPopupState(props) {
 <PopupState variant="popover" popupId="demo-popup-popover">
     {(popupState) => (
         <div>
-        <InfoIcon color="primary" fontSize="small" {...bindTrigger(popupState)} />
+        <InfoIcon color="disabled" fontSize="small" {...bindTrigger(popupState)} />
         <Popover
             {...bindPopover(popupState)}
             anchorOrigin={{
diff --git a/jams-react-client/src/views/Blueprint/EditBlueprintPermissions.js b/jams-react-client/src/views/Blueprint/EditBlueprintPermissions.js
index 3cc936ce..5beaa8f4 100644
--- a/jams-react-client/src/views/Blueprint/EditBlueprintPermissions.js
+++ b/jams-react-client/src/views/Blueprint/EditBlueprintPermissions.js
@@ -15,6 +15,7 @@ import CardIcon from "components/Card/CardIcon.js";
 import CardBody from "components/Card/CardBody.js";
 import FormGroup from "@material-ui/core/FormGroup";
 import FormControlLabel from "@material-ui/core/FormControlLabel";
+import FormLabel from "@material-ui/core/FormLabel";
 import Button from "components/CustomButtons/Button.js";
 
 import AddCircleOutlineIcon from '@material-ui/icons/AddCircleOutline';
@@ -54,6 +55,10 @@ import i18next from "i18next";
 
 import auth from "auth.js";
 
+import CustomPopupState from "../../components/CustomPopupState/CustomPopupState";
+
+import Switch from "@material-ui/core/Switch";
+
 const styles = (theme) => ({
   ...dashboardStyle,
   root: {
@@ -353,6 +358,9 @@ export default function EditBlueprintPermissions(props) {
               <div className={classes.root}>
                 <Grid container spacing={5}>
                   <Grid item xs={12} sm={12} md={12}>
+                  <Grid container spacing={2}>
+                  <Grid item xs={12} sm={12} md={12}>
+                    <FormLabel component="legend">Call parameters</FormLabel>
                     <FormGroup row>
                       <FormControlLabel
                         control={
@@ -371,6 +379,7 @@ export default function EditBlueprintPermissions(props) {
                         }
                         label={i18next.t("allow_video_calls", "Allow video calls")}
                       />
+                      <CustomPopupState message={i18next.t("allow_incoming_calls_from_unknown_allow_video_calls_info", "If this option is disabled, only audio calls will be allowed.")} />
                     </FormGroup>
                     <FormGroup row>
                       <FormControlLabel
@@ -390,6 +399,7 @@ export default function EditBlueprintPermissions(props) {
                         }
                         label={i18next.t("allow_incoming_calls_from_unknown_contacts", "Allow incoming calls from unknown contacts")}
                       />
+                      <CustomPopupState message={i18next.t("allow_incoming_calls_from_unknown_contacts_info", "If this option is disabled, only contacts from your list will be allowed to contact you.")} />
                     </FormGroup>
                     <FormGroup row>
                       <FormControlLabel
@@ -409,7 +419,11 @@ export default function EditBlueprintPermissions(props) {
                         }
                         label={i18next.t("auto_answer_calss", "Auto answer calls")}
                       />
+                      <CustomPopupState message={i18next.t("auto_answer_calls_info", "If this option is enabled, incomming calls will be automaticly answered. This option can be usefull if you want for example to monitor your house or a particular room when you are away from home.")} />
                     </FormGroup>
+                    </Grid>
+                    <Grid item xs={12} sm={12} md={12}>
+                    <FormLabel component="legend">Local LAN</FormLabel>
                     <FormGroup row>
                       <FormControlLabel
                         control={
@@ -428,11 +442,26 @@ export default function EditBlueprintPermissions(props) {
                         }
                         label={i18next.t("allow_use_of_jami_in_local_lan", "Allow Jami usage on the local LAN")}
                       />
+                      <CustomPopupState message={i18next.t("local_lan_info", "If this option is enabled, you will be able to communicate with connected contacts on you local lan, even if your lan is disconnected from internet.")} />
                     </FormGroup>
-                    <FormGroup row>
-                      <FormControlLabel
-                        control={
-                          <Checkbox
+                    </Grid>
+                    <Grid item xs={12} sm={12} md={12}>
+
+                  </Grid>
+                </Grid>
+                </Grid>
+                </Grid>
+              </div>
+            </CardBody>
+          </Card>
+        </GridItem>
+        <GridItem xs={12} sm={12} md={12}>
+                    <h3>Rendezvous mode</h3>
+
+                      <FormGroup row>
+                        <FormControlLabel
+                          control={
+                            <Switch
                             checked={rendezVous}
                             color="primary"
                             onChange={(e) => {
@@ -443,19 +472,15 @@ export default function EditBlueprintPermissions(props) {
                               );
                             }}
                             name="rendezVous"
+                            inputProps={{ "aria-label": "secondary checkbox" }}
                           />
-                        }
-                        label={i18next.t("convert_your_account_into_a_rendezvous_point", "Activate this account into rendezvous mode")}
-                      />
-                    </FormGroup>
-                  </Grid>
-                </Grid>
-              </div>
-            </CardBody>
-          </Card>
-        </GridItem>
-        <GridItem xs={12} sm={12} md={12}>
-                    <Button color="primary" onClick={() => {setOpenDrawer(true)}}><AddCircleOutlineIcon /> {i18next.t("add_moderator_to", "Add moderator to")} {props.blueprintName}</Button>
+                          }
+                          label={i18next.t("convert_your_account_into_a_rendezvous_point", "Activate this account into rendezvous mode")}
+                        />
+                        <CustomPopupState message={i18next.t("rendezvous_info", "If this option is enabled, incomming calls will automaticly be added to a conference room.")}/>
+                        <Button disabled={!rendezVous} color="primary" onClick={() => {setOpenDrawer(true)}}><AddCircleOutlineIcon /> {i18next.t("add_moderator_to", "Add moderator to")} {props.blueprintName}</Button>
+                        <CustomPopupState message={i18next.t("rendezvous_moderators_info", "Moderators are people allowed to manage rendezvous points and conferences even if they are not hosted on their devices.")} />
+                        </FormGroup>
                     <Table className={classes.table}>
                         <TableHead>
                             <TableRow>
@@ -492,7 +517,7 @@ export default function EditBlueprintPermissions(props) {
                                         <Link to={`/user/${user.username}`}>{user.lastName}</Link>
                                     </TableCell>
                                     <TableCell align="right" className={classes.tableActions}>
-                                        <Button color="primary" onClick={() => removeModeratorFromBlueprint(user)}>{i18next.t("remove_moderator", "Remove moderator")}</Button>
+                                        <Button disabled={!rendezVous} color="primary" onClick={() => removeModeratorFromBlueprint(user)}>{i18next.t("remove_moderator", "Remove moderator")}</Button>
                                     </TableCell>
                                 </TableRow>
                             )}
diff --git a/jams-react-client/src/views/Blueprints/Blueprints.js b/jams-react-client/src/views/Blueprints/Blueprints.js
index 9dc6c21e..8aebb3b9 100644
--- a/jams-react-client/src/views/Blueprints/Blueprints.js
+++ b/jams-react-client/src/views/Blueprints/Blueprints.js
@@ -18,6 +18,7 @@ import Input from "@material-ui/core/Input";
 import InputAdornment from "@material-ui/core/InputAdornment";
 
 import GroupIcon from "@material-ui/icons/Group";
+import PersonIcon from '@material-ui/icons/Person';
 import Search from "@material-ui/icons/Search";
 import DeleteOutlineIcon from "@material-ui/icons/DeleteOutline";
 import InfoIcon from "@material-ui/icons/Info";
@@ -379,17 +380,16 @@ export default function Blueprints() {
                         ? blueprint.name
                         : i18next.t("no_blueprint_name", "No blueprint name")}
                     </h3>
-                    <strong>Description:</strong>
-                    <p>{i18next.t("no_description", "No description")}</p>
                     <ul>
                       <li>
-                        <GroupIcon
+                        {JSON.parse(blueprint.policyData).rendezVous == true ? (<p><GroupIcon
                           fontSize="small"
                           style={{ marginRight: "10px" }}
-                        />{" "}
-                        {blueprint.usersCount
-                          ? blueprint.usersCount + " user(s)"
-                          : i18next.t("no_users_count", "No users count")}
+                        />{i18next.t("rendezvous", "Rendezvous")}</p>) : <p><PersonIcon
+                        fontSize="small"
+                        style={{ marginRight: "10px" }}
+                      />{i18next.t("standalone", "Standalone")}</p>
+                        }
                       </li>
                     </ul>
                     </CardBody>
-- 
GitLab