Skip to content

Commit

Permalink
Merge pull request #2256 from cfpb/2254-panel-note-removal
Browse files Browse the repository at this point in the history
[Panel] Removes note from UI
  • Loading branch information
Michaeldremy authored Aug 12, 2024
2 parents 7600ea6 + d86fab2 commit 5eace74
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/data-publication/reports/snapshot/SnapshotDataset.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const SnapshotDataset = ({ label, match, config, dataKey }) => {
<div className='grid'>
<div className='item'>
<Heading type={4} headingText={year + ' Datasets'} />
{renderDatasets(dataForYear, year, dataKey)}
{renderDatasets(dataForYear)}
</div>
<div className='item'>{renderDocumentation(dataForYear, year)}</div>
</div>
Expand Down
47 changes: 12 additions & 35 deletions src/data-publication/reports/snapshot/snapshotHelpers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,57 +47,34 @@ export function linkToSpecs(year = '2018') {
/**
* Renders a formatted list of Datasets
*/
export function renderDatasets(
{ datasets, exception },
selectedYear,
datasetType,
) {
export function renderDatasets({ datasets, exception }) {
if (!datasets) return <p>{exception}</p>

// One Year 2022 and Three Year 2020 Reporter Panel files are not going to be ready for 2023 Data Publication
// Adding extra logic to target these years and the files to display a message to users that the files are missing
// Remove the logic once the data team has generated these files and is made available
const displayMessage = `Files for ${selectedYear} are not available at this time`

const shouldDisplayMessage =
(selectedYear === '2022' && datasetType === 'oneYear') ||
(selectedYear === '2020' && datasetType === 'threeYear')

return (
<ul id='datasetList'>
{datasets.map((dataset, i) => {
const isReporterPanel = dataset.dataKey === 'panel'

return (
<li key={i}>
<LabelWithTooltip {...dataset} />

<ul className='dataset-items'>
{isReporterPanel && shouldDisplayMessage ? (
<li>
<p>{displayMessage}</p>
</li>
) : (
<>
<S3DatasetLink
url={dataset.csv}
label='CSV'
showLastUpdated={true}
/>
<S3DatasetLink
url={dataset.txt}
label='Pipe Delimited'
showLastUpdated={true}
/>
</>
)}
<S3DatasetLink
url={dataset.csv}
label='CSV'
showLastUpdated={true}
/>
<S3DatasetLink
url={dataset.txt}
label='Pipe Delimited'
showLastUpdated={true}
/>
</ul>
</li>
)
})}
</ul>
)
}

/**
* Render documentation links
*/
Expand Down

0 comments on commit 5eace74

Please sign in to comment.