display active contracts first

This commit is contained in:
mantikoros 2021-12-16 15:20:49 -06:00
parent 01bb4e4156
commit 4503a5e04a

View File

@ -1,7 +1,9 @@
import _ from 'lodash'
import Link from 'next/link' import Link from 'next/link'
import clsx from 'clsx' import clsx from 'clsx'
import { Row } from '../components/layout/row'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { Row } from '../components/layout/row'
import { import {
compute, compute,
Contract, Contract,
@ -78,7 +80,12 @@ function ContractCard(props: { contract: Contract }) {
} }
function ContractsGrid(props: { contracts: Contract[] }) { function ContractsGrid(props: { contracts: Contract[] }) {
const { contracts } = props const [resolvedContracts, activeContracts] = _.partition(
props.contracts,
(c) => c.isResolved
)
const contracts = [...activeContracts, ...resolvedContracts]
return ( return (
<ul role="list" className="grid grid-cols-1 gap-6 lg:grid-cols-2"> <ul role="list" className="grid grid-cols-1 gap-6 lg:grid-cols-2">
{contracts.map((contract) => ( {contracts.map((contract) => (