Sort proof by timestamp (#492)

This commit is contained in:
Earle Lowe 2021-07-21 16:34:54 -07:00 committed by GitHub
parent 96b8def9da
commit bd3f816ef6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,11 +36,11 @@ const cols = [
export default function FarmLastAttemptedProof() {
const { size } = usePlots();
const lastAttemtedProof = useSelector(
const lastAttemptedProof = useSelector(
(state: RootState) => state.farming_state.farmer.last_farming_info ?? [],
);
const reducedLastAttemtedProof = lastAttemtedProof.slice(0, 5);
const isEmpty = !reducedLastAttemtedProof.length;
const reducedLastAttemptedProof = lastAttemptedProof.slice(0, 5).sort((a,b) => a.timestamp-b.timestamp);
const isEmpty = !reducedLastAttemptedProof.length;
return (
<Card
@ -61,7 +61,7 @@ export default function FarmLastAttemptedProof() {
>
<Table
cols={cols}
rows={reducedLastAttemtedProof}
rows={reducedLastAttemptedProof}
caption={
isEmpty && (
<Typography>