Skip to content

Commit

Permalink
Merge branch 'master' into enhanchement/app-loader
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Sep 29, 2023
2 parents 4bc1188 + 3780f36 commit b8f3abf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 30 deletions.
36 changes: 9 additions & 27 deletions webapp/views/App/views/Home/Dashboard/Helper/Helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,13 @@ const HelperFirstTimeSurvey = () => {
values={{ surveyName: Survey.getName(surveyInfo).toUpperCase() }}
components={{
title: <h2 />,
linkWithIcon: (
<LinkWithIcon
to={appModuleUri(homeModules.surveyInfo)}
className="btn-s btn-transparent"
iconLeft={<span className="icon icon-pencil icon-14px" />}
/>
),
linkWithIcon: <LinkWithIcon to={appModuleUri(homeModules.surveyInfo)} iconLeft="icon-pencil" />,
basicLink: <Link to={appModuleUri(homeModules.surveyInfo)} className="btn-s btn-transparent" />,
}}
></Trans>
/>

<div className="helper__first_time_help-survey-info">
<SurveyInfo />
<SurveyInfo firstTime />
</div>
</div>

Expand All @@ -42,15 +36,9 @@ const HelperFirstTimeSurvey = () => {
i18nKey="homeView.dashboard.surveyPropUpdate.secondary"
values={{ surveyName: Survey.getName(surveyInfo).toUpperCase() }}
components={{
linkWithIcon: (
<LinkWithIcon
to={appModuleUri(designerModules.formDesigner)}
className="btn-s btn-transparent"
iconLeft={<span className="icon icon-quill icon-14px" />}
/>
),
linkWithIcon: <LinkWithIcon to={appModuleUri(designerModules.formDesigner)} iconLeft="icon-quill" />,
}}
></Trans>
/>
</div>
</div>
)
Expand All @@ -71,15 +59,9 @@ const HelperWithoutAttributes = () => {
values={{ surveyName: Survey.getName(surveyInfo).toUpperCase() }}
components={{
title: <h2 />,
linkWithIcon: (
<LinkWithIcon
to={appModuleUri(designerModules.formDesigner)}
className="btn-s btn-transparent"
iconLeft={<span className="icon icon-pencil icon-14px" />}
/>
),
linkWithIcon: <LinkWithIcon to={appModuleUri(designerModules.formDesigner)} iconLeft="icon-pencil" />,
}}
></Trans>
/>
</div>
</div>
</>
Expand All @@ -98,9 +80,9 @@ const HelpersByType = {

const LinkWithIcon = ({ to, iconLeft, iconRight, children }) => (
<Link to={to} className="btn-s btn-transparent">
{iconLeft}
{iconLeft && <span className={`icon ${iconLeft} icon-14px`} />}
{children}
{iconRight}
{iconRight && <span className={`icon ${iconRight} icon-14px`} />}
</Link>
)

Expand Down
19 changes: 16 additions & 3 deletions webapp/views/App/views/Home/Dashboard/SurveyInfo/SurveyInfo.js
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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()
Expand Down Expand Up @@ -84,9 +87,11 @@ const SurveyInfo = () => {
{i18n.t(canEditSurvey ? 'homeView.surveyInfo.editInfo' : 'homeView.surveyInfo.viewInfo')}
</Link>

{canEditSurvey && <ButtonPublishSurvey className="btn-transparent" disabled={!Survey.isDraft(surveyInfo)} />}
{!firstTime && canEditSurvey && (
<ButtonPublishSurvey className="btn-transparent" disabled={!Survey.isDraft(surveyInfo)} />
)}

{canExportSurvey && (
{!firstTime && canExportSurvey && (
<ButtonMenu
className="btn-s btn-transparent btn-menu-export"
iconClassName="icon-download2 icon-14px"
Expand Down Expand Up @@ -176,4 +181,12 @@ const SurveyInfo = () => {
)
}

SurveyInfo.propTypes = {
firstTime: PropTypes.bool,
}

SurveyInfo.defaultProps = {
firstTime: false,
}

export default SurveyInfo

0 comments on commit b8f3abf

Please sign in to comment.