Show the number of open markets on each groups page
This commit is contained in:
parent
00ba3b0c48
commit
51fe44f877
|
@ -84,9 +84,12 @@ export async function getStaticPropz(props: { params: { slugs: string[] } }) {
|
||||||
[]
|
[]
|
||||||
|
|
||||||
const creator = await creatorPromise
|
const creator = await creatorPromise
|
||||||
|
// Only count unresolved markets
|
||||||
|
const contractsCount = contracts.filter((c) => !c.isResolved).length
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
|
contractsCount,
|
||||||
group,
|
group,
|
||||||
members,
|
members,
|
||||||
creator,
|
creator,
|
||||||
|
@ -127,6 +130,7 @@ const groupSubpages = [
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
export default function GroupPage(props: {
|
export default function GroupPage(props: {
|
||||||
|
contractsCount: number
|
||||||
group: Group | null
|
group: Group | null
|
||||||
members: User[]
|
members: User[]
|
||||||
creator: User
|
creator: User
|
||||||
|
@ -139,6 +143,7 @@ export default function GroupPage(props: {
|
||||||
suggestedFilter: 'open' | 'all'
|
suggestedFilter: 'open' | 'all'
|
||||||
}) {
|
}) {
|
||||||
props = usePropz(props, getStaticPropz) ?? {
|
props = usePropz(props, getStaticPropz) ?? {
|
||||||
|
contractsCount: 0,
|
||||||
group: null,
|
group: null,
|
||||||
members: [],
|
members: [],
|
||||||
creator: null,
|
creator: null,
|
||||||
|
@ -150,6 +155,7 @@ export default function GroupPage(props: {
|
||||||
suggestedFilter: 'open',
|
suggestedFilter: 'open',
|
||||||
}
|
}
|
||||||
const {
|
const {
|
||||||
|
contractsCount,
|
||||||
creator,
|
creator,
|
||||||
members,
|
members,
|
||||||
traderScores,
|
traderScores,
|
||||||
|
@ -225,6 +231,7 @@ export default function GroupPage(props: {
|
||||||
|
|
||||||
const tabs = [
|
const tabs = [
|
||||||
{
|
{
|
||||||
|
badge: `${contractsCount}`,
|
||||||
title: 'Markets',
|
title: 'Markets',
|
||||||
content: questionsTab,
|
content: questionsTab,
|
||||||
href: groupPath(group.slug, 'markets'),
|
href: groupPath(group.slug, 'markets'),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user