Skip to content

Commit

Permalink
feat(approve-button): show workflow and period in confirmation modal (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikThePendric authored Aug 11, 2021
1 parent 2bccefa commit 19df5bb
Showing 1 changed file with 20 additions and 34 deletions.
54 changes: 20 additions & 34 deletions src/bottom-bar/approve-button/approve-modal/approve-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,8 @@ import React from 'react'
import { useSelectionContext } from '../../../selection-context/index.js'
import styles from './approve-modal.module.css'

// Hendrik is working on some changes that will allow to get the current
// period value from the url, until we can leverage on that,
// we don't display the period
// @TODO: Implement period display once possible
const TODO_GET_PERIOD = false

const ApproveModal = ({ onApprove, onCancel, error }) => {
const { workflow } = useSelectionContext()
const { workflow, period } = useSelectionContext()
const { dataSets } = workflow
const count = dataSets.length

Expand All @@ -34,33 +28,25 @@ const ApproveModal = ({ onApprove, onCancel, error }) => {

<ModalContent>
<div className={styles.summary}>
{!TODO_GET_PERIOD && (
<h1 className={styles.summaryTitle}>
{count > 1
? i18n.t(
'{{count}} data sets will be approved:',
{ count }
)
: i18n.t(
'{{count}} data set will be approved:',
{ count }
)}
</h1>
)}

{TODO_GET_PERIOD && (
<h1 className={styles.summaryTitle}>
{count > 1
? i18n.t(
'{{count}} data sets for {{period}} will be approved:',
{ count }
)
: i18n.t(
'{{count}} data set for {{period}} will be approved:',
{ count }
)}
</h1>
)}
<h1 className={styles.summaryTitle}>
{count > 1
? i18n.t(
'{{count}} data sets for {{- workflow}}, {{period}} will be approved:',
{
count,
workflow: workflow.displayName,
period: period.displayName,
}
)
: i18n.t(
'{{count}} data set for {{- workflow}}, {{period}} will be approved:',
{
count,
workflow: workflow.displayName,
period: period.displayName,
}
)}
</h1>

<ul className={styles.summaryList}>
{dataSets.map(({ id, displayName }) => (
Expand Down

0 comments on commit 19df5bb

Please sign in to comment.