Skip to content

Commit

Permalink
fix borders (#3467)
Browse files Browse the repository at this point in the history
  • Loading branch information
ingawei authored Feb 7, 2025
1 parent 3921a4a commit 7a7386c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions mani/components/profile/positions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Pagination } from 'components/widgets/pagination'
import { PillButton } from 'components/buttons/pill-button'
import { User } from 'common/user'
import { groupBy } from 'lodash'
import { useColor } from 'hooks/use-color'

type BetFilter = 'open' | 'sold' | 'closed' | 'resolved' | 'all'
export function Positions(props: { user: User }) {
Expand Down Expand Up @@ -80,6 +81,8 @@ export function Positions(props: { user: User }) {
const startIndex = currentPage * PAGE_SIZE
const endIndex = startIndex + PAGE_SIZE

const color = useColor()

// Group metrics by contract before pagination
const groupedMetricsByContract = groupBy(validMetrics, 'contractId')

Expand Down Expand Up @@ -120,9 +123,14 @@ export function Positions(props: { user: User }) {
const contractMetrics = groupedMetricsByContract[contractId]
const contract = filteredContracts?.find((c) => c.id === contractId)
if (!contract) return null

return (
<Col key={contractId}>
<Col
key={contractId}
style={{
borderBottomWidth: 1,
borderBottomColor: color.border,
}}
>
{contractMetrics.map((metric) => {
if (contract.mechanism === 'cpmm-multi-1' && !metric.answerId) {
return null
Expand All @@ -146,7 +154,6 @@ export function Positions(props: { user: User }) {
metric={metric}
answer={answer}
showQuestion={showQuestion}
hasBorder={isLastMetric}
/>
)
})}
Expand Down

0 comments on commit 7a7386c

Please sign in to comment.