Skip to content

Commit 99e6241

Browse files
committed
492: Only render latest files heading if files exist
1 parent ab886e2 commit 99e6241

File tree

1 file changed

+34
-31
lines changed

1 file changed

+34
-31
lines changed

src/client/src/pages/Admin.js

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -154,38 +154,41 @@ export default function Admin(props) {
154154

155155
<Grid container item spacing={5} direction="row" style={{padding: 20}}>
156156
<Grid container item direction="column" spacing={3} sm={6}>
157-
<Grid item>
158-
<Typography variant="h5">Latest Files</Typography>
159-
</Grid>
160-
<Grid item>
161-
{_.isEmpty(fileListHtml) !== true &&
162-
<TableContainer component={Paper}>
163-
<Table aria-label="simple table">
164-
<TableHead>
165-
<TableRow>
166-
<TableCell><b>File Type</b></TableCell>
167-
<TableCell><b>Last Updated</b></TableCell>
168-
</TableRow>
169-
</TableHead>
170-
<TableBody>
171-
{_.map(fileListHtml, (file, index) => {
172-
const fileName = file.split("-")[0];
173-
let fileDate = file.split("-").slice(1).join().split(".")[0];
174-
let fileDateOnlyNumbers = fileDate.replaceAll(",", "");
175-
let fileDateFormatted = moment(fileDateOnlyNumbers, "YYYYMMDDhmmss").local().format("MMMM Do YYYY, h:mm:ss a");
176-
177-
return (
178-
<TableRow key={index}>
179-
<TableCell>{fileName}</TableCell>
180-
<TableCell>{fileDateFormatted}</TableCell>
157+
{_.isEmpty(fileListHtml) !== true &&
158+
<>
159+
<Grid item>
160+
<Typography variant="h5">Latest Files</Typography>
161+
</Grid>
162+
<Grid item>
163+
<TableContainer component={Paper}>
164+
<Table aria-label="simple table">
165+
<TableHead>
166+
<TableRow>
167+
<TableCell><b>File Type</b></TableCell>
168+
<TableCell><b>Last Updated</b></TableCell>
181169
</TableRow>
182-
)
183-
})
184-
}
185-
</TableBody>
186-
</Table>
187-
</TableContainer>}
188-
</Grid>
170+
</TableHead>
171+
<TableBody>
172+
{_.map(fileListHtml, (file, index) => {
173+
const fileName = file.split("-")[0];
174+
let fileDate = file.split("-").slice(1).join().split(".")[0];
175+
let fileDateOnlyNumbers = fileDate.replaceAll(",", "");
176+
let fileDateFormatted = moment(fileDateOnlyNumbers, "YYYYMMDDhmmss").local().format("MMMM Do YYYY, h:mm:ss a");
177+
178+
return (
179+
<TableRow key={index}>
180+
<TableCell>{fileName}</TableCell>
181+
<TableCell>{fileDateFormatted}</TableCell>
182+
</TableRow>
183+
)
184+
})
185+
}
186+
</TableBody>
187+
</Table>
188+
</TableContainer>
189+
</Grid>
190+
</>
191+
}
189192
<Grid item>
190193
<Paper>
191194
<CardContent>

0 commit comments

Comments
 (0)