parent
65150bbcfb
commit
e281f9c3d0
|
@ -22,7 +22,7 @@ function Header({account, isStatus, enableEthereum}: HeaderProps) {
|
|||
const [network, sNetwork] = useState()
|
||||
|
||||
useEffect(() => {
|
||||
setNetwork(sNetwork)
|
||||
if (account) setNetwork(sNetwork)
|
||||
}, [account])
|
||||
|
||||
return (
|
||||
|
|
|
@ -101,9 +101,9 @@ function TableCards({ polls }: ITableCard) {
|
|||
return (
|
||||
<Fragment>
|
||||
{polls.map((poll, i) => {
|
||||
const { pollInfo, messageId, formattedEndDate, sigMsg } = poll
|
||||
const { pollInfo, formattedEndDate, sigMsg } = poll
|
||||
if (!formattedEndDate || !formattedEndDate.plainText) return
|
||||
const { plainText } = formattedEndDate
|
||||
const { plainText, daysRemaining } = formattedEndDate
|
||||
if (!pollInfo) return
|
||||
const { title, description } = pollInfo
|
||||
const cellStyling = isOdd(i) ? classnames(cardText) : classnames(cardText, cellColor)
|
||||
|
@ -115,7 +115,7 @@ function TableCards({ polls }: ITableCard) {
|
|||
<Typography className={classnames(cellStyling, classes.cardSubTitle)}>{description}</Typography>
|
||||
<Typography className={lightText}>{plainText}</Typography>
|
||||
<Link to={pollUrl} className={classnames(cellStyling, classes.link)}>
|
||||
<Typography className={classnames(cellStyling, classes.voteNow)}>Vote now</Typography>
|
||||
<Typography className={classnames(cellStyling, classes.voteNow)}>{daysRemaining ? 'Vote now' : 'Vote results'}</Typography>
|
||||
</Link>
|
||||
</Fragment>
|
||||
)
|
||||
|
|
|
@ -15,7 +15,7 @@ export const timeRemaining = (date: Date | string | null): string => {
|
|||
const totalHours = hoursDiff(dateStr)
|
||||
const remainder = totalHours % 24
|
||||
const days = Math.floor(totalHours / 24)
|
||||
const str = totalHours > 0 ? `${days} days and ${remainder} hours until vote ends` : `Vote ended ${Math.abs(days)} ago`
|
||||
const str = totalHours > 0 ? `${days} days and ${remainder} hours until vote ends` : `Vote ended ${Math.abs(days)} days ago`
|
||||
return str
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue