Skip to content

Commit

Permalink
Fix case when there are no datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
kreafox committed Mar 14, 2023
1 parent cf7e18a commit 20c58dc
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 27 deletions.
20 changes: 8 additions & 12 deletions src/components/ItemView/Datasets/DatasetsTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,14 @@ const DatasetsTab = (props) => {
}));

return (
<>
{items && items.length > 0 ? (
<Tab
className="datasets-tab"
menu={{ vertical: true, secondary: true, pointing: true }}
panes={panes}
onTabChange={() => {
setActiveAccordionIndex(0);
}}
/>
) : null}
</>
<Tab
className="datasets-tab"
menu={{ vertical: true, secondary: true, pointing: true }}
panes={panes}
onTabChange={() => {
setActiveAccordionIndex(0);
}}
/>
);
};

Expand Down
39 changes: 24 additions & 15 deletions src/components/ItemView/Datasets/DatasetsView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,31 @@ const DatasetsView = (props) => {

return (
<>
<div className="dataset-container">
<h2>Datasets</h2>
</div>
<DatasetsTab
appConfig={appConfig}
items={groupedByTemporalCoverage}
defaultAccordionOpenIndex={0}
/>
{groupedByTemporalCoverage && groupedByTemporalCoverage.length > 0 && (
<>
<div className="dataset-container">
<h2>Datasets</h2>
</div>
<DatasetsTab
appConfig={appConfig}
items={groupedByTemporalCoverage}
defaultAccordionOpenIndex={0}
/>
</>
)}

<div className="dataset-container">
<h2>Archived or restricted datasets</h2>
</div>
<DatasetsTab
appConfig={appConfig}
items={groupedByArchivedOrRestricted}
/>
{groupedByArchivedOrRestricted &&
groupedByArchivedOrRestricted.length > 0 && (
<>
<div className="dataset-container">
<h2>Archived or restricted datasets</h2>
</div>
<DatasetsTab
appConfig={appConfig}
items={groupedByArchivedOrRestricted}
/>
</>
)}
</>
);
};
Expand Down

0 comments on commit 20c58dc

Please sign in to comment.