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..3c0e82daf8 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 && ( { ) } +SurveyInfo.propTypes = { + firstTime: PropTypes.bool, +} + +SurveyInfo.defaultProps = { + firstTime: false, +} + export default SurveyInfo diff --git a/webapp/views/App/views/Home/SurveyInfo/CyclesEditor/CycleEditor/DateContainer/DateContainer.js b/webapp/views/App/views/Home/SurveyInfo/CyclesEditor/CycleEditor/DateContainer/DateContainer.js index 48d91a7ef2..a3bd8e497b 100644 --- a/webapp/views/App/views/Home/SurveyInfo/CyclesEditor/CycleEditor/DateContainer/DateContainer.js +++ b/webapp/views/App/views/Home/SurveyInfo/CyclesEditor/CycleEditor/DateContainer/DateContainer.js @@ -1,45 +1,32 @@ -import React, { useRef } from 'react' +import React, { useCallback } from 'react' import PropTypes from 'prop-types' -import * as R from 'ramda' import { useI18n } from '@webapp/store/system' +import { DateInput } from '@webapp/components/form/DateTimeInput' +import { DateFormats, Dates } from '@openforis/arena-core' -const DateEditor = ({ date, onChange }) => { - const [year, month, day] = R.pipe(R.defaultTo('--'), R.split('-'))(date) - - const yearRef = useRef(null) - const monthRef = useRef(null) - const dayRef = useRef(null) - - const onChangeDate = () => onChange(`${yearRef.current.value}-${monthRef.current.value}-${dayRef.current.value}`) - - return ( - - - - - - - - - - ) -} - -DateEditor.propTypes = { - date: PropTypes.string, - onChange: PropTypes.func.isRequired, -} - -DateEditor.defaultProps = { - date: null, -} - -const DateContainer = ({ date, keyLabel, readOnly, onChange }) => { +const DateContainer = ({ date, keyLabel, readOnly, onChange: onChangeProp }) => { const i18n = useI18n() + const dateFormatted = Dates.convertDate({ dateStr: date, formatTo: DateFormats.dateDisplay }) + + const onChange = useCallback( + (newDate) => { + const newDateFormatted = newDate + ? Dates.convertDate({ + dateStr: newDate, + formatFrom: DateFormats.dateDisplay, + formatTo: DateFormats.dateStorage, + }) + : null + onChangeProp(newDateFormatted) + }, + [onChangeProp] + ) return (
{i18n.t(keyLabel)} - {readOnly ? {date} : } + {readOnly ? {date} : }
) } diff --git a/webapp/views/App/views/Home/SurveyInfo/CyclesEditor/CyclesEditor.scss b/webapp/views/App/views/Home/SurveyInfo/CyclesEditor/CyclesEditor.scss index 7895336459..661414149a 100644 --- a/webapp/views/App/views/Home/SurveyInfo/CyclesEditor/CyclesEditor.scss +++ b/webapp/views/App/views/Home/SurveyInfo/CyclesEditor/CyclesEditor.scss @@ -27,7 +27,10 @@ } .date-container { - margin-left: 10px; + margin-left: 1rem; + display: flex; + align-items: center; + gap: 0.5rem; } .date-label { @@ -37,14 +40,6 @@ font-weight: 600; } - .date { - margin-left: 5px; - - input { - padding: 0.25rem 0.1rem; - } - } - .btn-delete { padding: 0.1rem; }