Show sign in button instead of submit answer if logged out.

This commit is contained in:
James Grugett 2022-02-19 11:42:27 -06:00
parent 26bbb75ccd
commit 0641db1f2d

View File

@ -350,6 +350,7 @@ function AnswerBetPanel(props: {
function CreateAnswerInput(props: { contract: Contract }) { function CreateAnswerInput(props: { contract: Contract }) {
const { contract } = props const { contract } = props
const user = useUser()
const [text, setText] = useState('') const [text, setText] = useState('')
const [betAmount, setBetAmount] = useState<number | undefined>(10) const [betAmount, setBetAmount] = useState<number | undefined>(10)
const [amountError, setAmountError] = useState<string | undefined>() const [amountError, setAmountError] = useState<string | undefined>()
@ -451,6 +452,7 @@ function CreateAnswerInput(props: { contract: Contract }) {
</Col> </Col>
</> </>
)} )}
{user ? (
<button <button
className={clsx( className={clsx(
'btn self-end mt-2', 'btn self-end mt-2',
@ -462,6 +464,16 @@ function CreateAnswerInput(props: { contract: Contract }) {
> >
Submit answer & bet Submit answer & bet
</button> </button>
) : (
text && (
<button
className="btn self-end whitespace-nowrap border-none bg-gradient-to-r from-teal-500 to-green-500 px-10 text-lg font-medium normal-case hover:from-teal-600 hover:to-green-600"
onClick={firebaseLogin}
>
Sign in
</button>
)
)}
</Col> </Col>
</Col> </Col>
</Col> </Col>