From 175eb6c741ee2f4909a70a8a657cbc342bc7baa0 Mon Sep 17 00:00:00 2001 From: Stefano Ricci Date: Mon, 25 Sep 2023 14:32:16 +0200 Subject: [PATCH] first time helper: hide unnecessary buttons --- .../App/views/Home/Dashboard/Helper/Helper.js | 36 +++++-------------- .../Home/Dashboard/SurveyInfo/SurveyInfo.js | 21 ++++++++--- 2 files changed, 26 insertions(+), 31 deletions(-) diff --git a/webapp/views/App/views/Home/Dashboard/Helper/Helper.js b/webapp/views/App/views/Home/Dashboard/Helper/Helper.js index 6d348114fb..ba276e473f 100644 --- a/webapp/views/App/views/Home/Dashboard/Helper/Helper.js +++ b/webapp/views/App/views/Home/Dashboard/Helper/Helper.js @@ -21,19 +21,13 @@ const HelperFirstTimeSurvey = () => { values={{ surveyName: Survey.getName(surveyInfo).toUpperCase() }} components={{ title:

, - linkWithIcon: ( - } - /> - ), + linkWithIcon: , basicLink: , }} - > + />
- +
@@ -42,15 +36,9 @@ const HelperFirstTimeSurvey = () => { i18nKey="homeView.dashboard.surveyPropUpdate.secondary" values={{ surveyName: Survey.getName(surveyInfo).toUpperCase() }} components={{ - linkWithIcon: ( - } - /> - ), + linkWithIcon: , }} - > + /> ) @@ -71,15 +59,9 @@ const HelperWithoutAttributes = () => { values={{ surveyName: Survey.getName(surveyInfo).toUpperCase() }} components={{ title:

, - linkWithIcon: ( - } - /> - ), + linkWithIcon: , }} - > + /> @@ -98,9 +80,9 @@ const HelpersByType = { const LinkWithIcon = ({ to, iconLeft, iconRight, children }) => ( - {iconLeft} + {iconLeft && } {children} - {iconRight} + {iconRight && } ) diff --git a/webapp/views/App/views/Home/Dashboard/SurveyInfo/SurveyInfo.js b/webapp/views/App/views/Home/Dashboard/SurveyInfo/SurveyInfo.js index c031f14a0d..d49ca31e48 100644 --- a/webapp/views/App/views/Home/Dashboard/SurveyInfo/SurveyInfo.js +++ b/webapp/views/App/views/Home/Dashboard/SurveyInfo/SurveyInfo.js @@ -1,6 +1,7 @@ import './SurveyInfo.scss' import React, { useCallback } from 'react' +import PropTypes from 'prop-types' import { useDispatch } from 'react-redux' import { Link, useNavigate } from 'react-router-dom' @@ -18,7 +19,9 @@ import Header from '@webapp/components/header' import ButtonPublishSurvey from '@webapp/components/buttonPublishSurvey' import { Button, ButtonMenu } from '@webapp/components' -const SurveyInfo = () => { +const SurveyInfo = (props) => { + const { firstTime } = props + const i18n = useI18n() const dispatch = useDispatch() const navigate = useNavigate() @@ -84,9 +87,11 @@ const SurveyInfo = () => { {i18n.t(canEditSurvey ? 'homeView.surveyInfo.editInfo' : 'homeView.surveyInfo.viewInfo')} - {canEditSurvey && } + {!firstTime && canEditSurvey && ( + + )} - {canExportSurvey && ( + {!firstTime && canExportSurvey && ( { ]} /> )} - {canEditSurvey && ( + {!firstTime && canEditSurvey && ( { ) } +SurveyInfo.propTypes = { + firstTime: PropTypes.bool, +} + +SurveyInfo.defaultProps = { + firstTime: false, +} + export default SurveyInfo