predikt/oracle/web/components/buttons/share-qr-button.tsx
caelum0x 2b68bde5d5 Predikt: full Polymarket-style prediction market — web + mobile + on-chain + bots
Working tree is now the canonical repo. Off-chain play-money + trustless on-chain
(FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution,
mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 23:29:50 +03:00

42 lines
1.0 KiB
TypeScript

import clsx from 'clsx'
import { Contract } from 'common/contract'
import { getShareUrl } from 'common/util/share'
import { useState } from 'react'
import { Modal } from '../layout/modal'
import { QRCode } from '../widgets/qr-code'
import { Button } from './button'
import { useUser } from 'web/hooks/use-user'
export function ShareQRButton(props: {
contract: Contract
className?: string
}) {
const { contract, className } = props
const user = useUser()
const shareUrl = getShareUrl(contract, user?.username)
const [open, setOpen] = useState(false)
return (
<>
<Button
color="gray-outline"
size="xs"
className={clsx('gap-1', className)}
onClick={() => setOpen(true)}
>
QR
</Button>
<Modal size="sm" open={open} setOpen={setOpen}>
<div className="flex flex-col items-center">
<QRCode
url={shareUrl}
width={250}
height={250}
className="self-center"
/>
</div>
</Modal>
</>
)
}