Skip to content

Commit

Permalink
fix: show Upload Files button when there are no files
Browse files Browse the repository at this point in the history
  • Loading branch information
MellyGray committed Nov 6, 2023
1 parent 892109a commit b5ba02a
Showing 1 changed file with 30 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,36 @@ export function FileCriteriaForm({
onCriteriaChange,
filesCountInfo
}: FileCriteriaInputsProps) {
if (!filesCountInfo || filesCountInfo.total < MINIMUM_FILES_TO_SHOW_CRITERIA_INPUTS) {
return <></>
}
const showFileCriteriaInputs =
filesCountInfo && filesCountInfo.total >= MINIMUM_FILES_TO_SHOW_CRITERIA_INPUTS
return (
<Form>
<Row>
<Col md={5}>
<FileCriteriaSearchText criteria={criteria} onCriteriaChange={onCriteriaChange} />
</Col>
<Col className={styles['upload-files-container']}>
<DatasetUploadFilesButton />
</Col>
</Row>
<Row className={styles['criteria-section']}>
<Col>
<FileCriteriaFilters
criteria={criteria}
onCriteriaChange={onCriteriaChange}
filesCountInfo={filesCountInfo}
/>
</Col>
<Col className={styles['sort-container']}>
<FileCriteriaSortBy criteria={criteria} onCriteriaChange={onCriteriaChange} />
</Col>
</Row>
</Form>
<div className={styles['criteria-section']}>
<Form>
<Row>
{showFileCriteriaInputs && (
<Col md={5}>
<FileCriteriaSearchText criteria={criteria} onCriteriaChange={onCriteriaChange} />
</Col>
)}
<Col className={styles['upload-files-container']}>
<DatasetUploadFilesButton />
</Col>
</Row>
{showFileCriteriaInputs && (
<Row>
<Col>
<FileCriteriaFilters
criteria={criteria}
onCriteriaChange={onCriteriaChange}
filesCountInfo={filesCountInfo}
/>
</Col>
<Col className={styles['sort-container']}>
<FileCriteriaSortBy criteria={criteria} onCriteriaChange={onCriteriaChange} />
</Col>
</Row>
)}
</Form>
</div>
)
}

0 comments on commit b5ba02a

Please sign in to comment.