Hide streak if you turned off that notification
This commit is contained in:
parent
9ed3fdc697
commit
7c4944b825
|
@ -18,7 +18,7 @@ import { useSaveReferral } from 'web/hooks/use-save-referral'
|
||||||
import { Sort } from 'web/components/contract-search'
|
import { Sort } from 'web/components/contract-search'
|
||||||
import { Group } from 'common/group'
|
import { Group } from 'common/group'
|
||||||
import { SiteLink } from 'web/components/site-link'
|
import { SiteLink } from 'web/components/site-link'
|
||||||
import { useUser } from 'web/hooks/use-user'
|
import { usePrivateUser, useUser } from 'web/hooks/use-user'
|
||||||
import {
|
import {
|
||||||
useMemberGroupIds,
|
useMemberGroupIds,
|
||||||
useMemberGroups,
|
useMemberGroups,
|
||||||
|
@ -65,7 +65,7 @@ export default function Home() {
|
||||||
|
|
||||||
<Row className={'mb-2 w-full items-center gap-8'}>
|
<Row className={'mb-2 w-full items-center gap-8'}>
|
||||||
<SearchRow />
|
<SearchRow />
|
||||||
<DailyProfitAndBalance className="" user={user} />
|
<DailyStats className="" user={user} />
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
{sections.map((item) => {
|
{sections.map((item) => {
|
||||||
|
@ -221,14 +221,19 @@ function SearchRow() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function DailyProfitAndBalance(props: {
|
function DailyStats(props: {
|
||||||
user: User | null | undefined
|
user: User | null | undefined
|
||||||
className?: string
|
className?: string
|
||||||
}) {
|
}) {
|
||||||
const { user, className } = props
|
const { user, className } = props
|
||||||
|
|
||||||
const metrics = usePortfolioHistory(user?.id ?? '', 'daily') ?? []
|
const metrics = usePortfolioHistory(user?.id ?? '', 'daily') ?? []
|
||||||
const [first, last] = [metrics[0], metrics[metrics.length - 1]]
|
const [first, last] = [metrics[0], metrics[metrics.length - 1]]
|
||||||
|
|
||||||
|
const privateUser = usePrivateUser()
|
||||||
|
const streaksHidden =
|
||||||
|
privateUser?.notificationPreferences.betting_streaks.length === 0
|
||||||
|
|
||||||
let profit = 0
|
let profit = 0
|
||||||
let profitPercent = 0
|
let profitPercent = 0
|
||||||
if (first && last) {
|
if (first && last) {
|
||||||
|
@ -245,18 +250,20 @@ function DailyProfitAndBalance(props: {
|
||||||
<ProfitBadge profitPercent={profitPercent * 100} />
|
<ProfitBadge profitPercent={profitPercent * 100} />
|
||||||
</Row>
|
</Row>
|
||||||
</Col>
|
</Col>
|
||||||
<Col>
|
{!streaksHidden && (
|
||||||
<div className="text-gray-500">Streak</div>
|
<Col>
|
||||||
<Row
|
<div className="text-gray-500">Streak</div>
|
||||||
className={clsx(
|
<Row
|
||||||
className,
|
className={clsx(
|
||||||
'items-center text-lg',
|
className,
|
||||||
user && !hasCompletedStreakToday(user) && 'grayscale'
|
'items-center text-lg',
|
||||||
)}
|
user && !hasCompletedStreakToday(user) && 'grayscale'
|
||||||
>
|
)}
|
||||||
<span>🔥 {user?.currentBettingStreak ?? 0}</span>
|
>
|
||||||
</Row>
|
<span>🔥 {user?.currentBettingStreak ?? 0}</span>
|
||||||
</Col>
|
</Row>
|
||||||
|
</Col>
|
||||||
|
)}
|
||||||
</Row>
|
</Row>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user