Skip to content

Commit

Permalink
Revert "Show twomba tooltip on all markets"
Browse files Browse the repository at this point in the history
This reverts commit e48568f.
  • Loading branch information
SirSaltyy committed Sep 25, 2024
1 parent d2ebcc4 commit 74d4db1
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 218 deletions.
19 changes: 6 additions & 13 deletions web/components/contract/twomba-header-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,21 +249,14 @@ export function TwombaHeaderActions(props: {
: []),
]

const sweepsEnabled = !!playContract.siblingContractId

const isNonBetPollOrBountiedQuestion =
playContract.mechanism === 'none' &&
(playContract.outcomeType === 'POLL' ||
playContract.outcomeType === 'BOUNTIED_QUESTION')

return (
// make tooltip children stretch
<Row className="mr-4 shrink-0 items-center [&>*]:flex">
<div className="relative z-50">
{!isNonBetPollOrBountiedQuestion && (
<TwombaToggle sweepsEnabled={sweepsEnabled} />
)}
</div>

{!!currentContract.siblingContractId && (
<div className="relative">
<TwombaToggle />
</div>
)}
{!playContract.coverImageUrl && isCreator && (
<ChangeBannerButton
contract={playContract}
Expand Down
74 changes: 27 additions & 47 deletions web/components/twomba/twomba-toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,39 @@ import clsx from 'clsx'
import { ManaFlatCoin } from 'web/public/custom-components/manaFlatCoin'
import { SweepiesFlatCoin } from 'web/public/custom-components/sweepiesFlatCoin'
import { useSweepstakes } from 'web/components/sweestakes-context'
import { SweepiesFlatCoinX } from 'web/public/custom-components/sweepiesFlatCoinX'
import { Tooltip } from 'web/components/widgets/tooltip'

export function TwombaToggle({
sweepsEnabled = false,
}: {
sweepsEnabled?: boolean
}) {
export function TwombaToggle() {
const { isPlay, setIsPlay } = useSweepstakes()
const SweepiesCoin = sweepsEnabled ? SweepiesFlatCoin : SweepiesFlatCoinX

const handleClick = () => {
if (sweepsEnabled) {
setIsPlay(!isPlay)
}
}

return (
<Tooltip
text={
sweepsEnabled
? null
: 'This question does not have sweepstakes enabled.'
}
<button
className={clsx(
'bg-ink-200 dark:bg-canvas-50 relative flex h-fit w-fit shrink-0 flex-row items-center gap-1 rounded-full border-[1.5px] p-0.5 text-2xl transition-colors',
isPlay
? 'border-violet-600 dark:border-violet-400'
: 'border-amber-500 dark:border-amber-200'
)}
onClick={() => setIsPlay(!isPlay)}
>
<button
{/* Add a moving circle behind the active coin */}
<div
className={clsx(
'dark:bg-ink-300 bg-canvas-0 absolute h-[28px] w-[28px] rounded-full drop-shadow transition-all',
isPlay ? 'left-0' : 'left-[calc(100%-28px)]'
)}
/>
<ManaFlatCoin
className={clsx(
'z-10 h-8 transition-opacity',
isPlay ? 'opacity-100' : 'opacity-20'
)}
/>
<SweepiesFlatCoin
className={clsx(
'bg-ink-200 dark:bg-canvas-50 relative flex h-fit w-fit shrink-0 flex-row items-center gap-1 rounded-full border-[1.5px] p-0.5 text-2xl transition-colors',
isPlay
? 'border-violet-600 dark:border-violet-400'
: 'border-amber-500 dark:border-amber-200'
'z-10 h-8 transition-opacity',
!isPlay ? 'opacity-100' : 'opacity-20'
)}
onClick={handleClick}
>
<div
className={clsx(
'dark:bg-ink-300 bg-canvas-0 absolute h-[28px] w-[28px] rounded-full drop-shadow transition-all',
isPlay ? 'left-0' : 'left-[calc(100%-28px)]'
)}
/>
<ManaFlatCoin
className={clsx(
'z-10 h-8 transition-opacity',
isPlay ? 'opacity-100' : 'opacity-20'
)}
/>
<SweepiesCoin
className={clsx(
'z-10 h-8 transition-opacity',
!isPlay ? 'opacity-100' : 'opacity-20'
)}
/>
</button>
</Tooltip>
/>
</button>
)
}
141 changes: 0 additions & 141 deletions web/public/SweepiesFlatX.svg

This file was deleted.

1 change: 1 addition & 0 deletions web/public/custom-components/sweepiesFlatCoin.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import clsx from 'clsx'
import { ENV_CONFIG } from 'common/envs/constants'
import Image from 'next/image'

export function SweepiesFlatCoin(props: { className?: string }) {
const { className } = props
Expand Down
17 changes: 0 additions & 17 deletions web/public/custom-components/sweepiesFlatCoinX.tsx

This file was deleted.

0 comments on commit 74d4db1

Please sign in to comment.