Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit df7abf2

Browse files
#653 - minor improvements
1 parent 6770f53 commit df7abf2

File tree

2 files changed

+39
-18
lines changed

2 files changed

+39
-18
lines changed

client/src/components/Upload/Table/index.jsx

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ export default function Table({ state, data }) {
2222
year: "numeric",
2323
month: "short",
2424
day: "2-digit",
25+
hour: "2-digit",
26+
minute: "2-digit",
2527
}).format(new Date(date)),
2628
},
2729
status: { name: "Status" },
@@ -34,39 +36,59 @@ export default function Table({ state, data }) {
3436
Download
3537
</a>
3638
) : (
37-
"N/A"
39+
"-"
3840
),
3941
},
4042
};
4143

4244
return state === TABLE_STATES.LOADING_LAST_UPLOADS ? (
4345
<div className={style.content}>
44-
<h1 className={style.title}>Loading last uploads...</h1>
46+
<h1 className={style.title}>Gathering status of older uploads...</h1>
4547
</div>
46-
) : (
47-
data.length > 0 && (
48-
<div className={style.content}>
49-
<h1 className={style.title}>Past 24 Hours Upload Status</h1>
50-
<table className={style.tableContent}>
48+
) : data.length > 0 ? (
49+
<div className={style.content}>
50+
<h1 className={style.title}>Past 24 Hours Upload Status</h1>
51+
<table className={style.tableContent}>
52+
<thead>
5153
<tr>
52-
{_.map(_.values(columns), ({ name }) => (
53-
<th>{name}</th>
54+
{_.map(_.values(columns), ({ name }, i) => (
55+
<th key={i}>{name}</th>
5456
))}
5557
</tr>
56-
{_.map(data, (item) => (
57-
<tr>
58-
{_.map(_.keys(columns), (colKey) => (
59-
<td>
58+
</thead>
59+
<tbody>
60+
{_.map(data, (item, i) => (
61+
<tr key={i}>
62+
{_.map(_.keys(columns), (colKey, j) => (
63+
<td key={j}>
6064
{columns[colKey].formatter
6165
? columns[colKey].formatter(item[colKey])
62-
: item[colKey] || "N/A"}
66+
: item[colKey] || "-"}
6367
</td>
6468
))}
6569
</tr>
6670
))}
67-
</table>
68-
</div>
69-
)
71+
</tbody>
72+
</table>
73+
</div>
74+
) : (
75+
<div className={style.content}>
76+
<h1 className={style.title}>Past 24 Hours Upload Status</h1>
77+
<table className={style.tableContent}>
78+
<thead>
79+
<tr>
80+
{_.map(_.values(columns), ({ name }, i) => (
81+
<th key={i}>{name}</th>
82+
))}
83+
</tr>
84+
</thead>
85+
<tbody>
86+
<tr>
87+
<td colSpan="4">No records uploaded in the past 24 hours</td>
88+
</tr>
89+
</tbody>
90+
</table>
91+
</div>
7092
);
7193
}
7294

client/src/components/Upload/index.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ export default function Upload({ templateId }) {
9494
const { data } = await apiClient.get(url);
9595

9696
setTableState(TABLE_STATES.RESULT);
97-
console.log("response", data);
9897
setLastUploads(data);
9998
} catch (error) {
10099
setTableState(TABLE_STATES.RESULT);

0 commit comments

Comments
 (0)