From d1b714b301d2a9f6917e4113ff38bdfe36ae4e49 Mon Sep 17 00:00:00 2001 From: Phil Date: Fri, 16 Sep 2022 12:46:38 +0100 Subject: [PATCH] Fixed secondary Get Started button. Copy overlay and dock link now functional. --- web/pages/twitch.tsx | 192 ++++++++++++++++++++++--------------------- 1 file changed, 99 insertions(+), 93 deletions(-) diff --git a/web/pages/twitch.tsx b/web/pages/twitch.tsx index a21c1105..6aa47821 100644 --- a/web/pages/twitch.tsx +++ b/web/pages/twitch.tsx @@ -1,6 +1,8 @@ +import { LinkIcon } from '@heroicons/react/solid' +import clsx from 'clsx' import { PrivateUser, User } from 'common/user' import Link from 'next/link' -import { useState } from 'react' +import { MouseEventHandler, ReactNode, useState } from 'react' import toast from 'react-hot-toast' import { Button } from 'web/components/button' @@ -18,14 +20,15 @@ import { usePrivateUser, useUser } from 'web/hooks/use-user' import { firebaseLogin, getUserAndPrivateUser } from 'web/lib/firebase/users' import { track } from 'web/lib/service/analytics' import { linkTwitchAccountRedirect } from 'web/lib/twitch/link-twitch-account' +import { copyToClipboard } from 'web/lib/util/copy' -function TwitchPlaysManifoldMarkets(props: { +function ButtonGetStarted(props: { user?: User | null privateUser?: PrivateUser | null + buttonClass?: string + spinnerClass?: string }) { - const { user, privateUser } = props - - const twitchUser = privateUser?.twitchInfo?.twitchName + const { user, privateUser, buttonClass, spinnerClass } = props const [isLoading, setLoading] = useState(false) @@ -55,6 +58,29 @@ function TwitchPlaysManifoldMarkets(props: { setLoading(false) } } + return isLoading ? ( + + ) : ( + + ) +} + +function TwitchPlaysManifoldMarkets(props: { + user?: User | null + privateUser?: PrivateUser | null +}) { + const { user, privateUser } = props + + const twitchUser = privateUser?.twitchInfo?.twitchName return (
@@ -83,26 +109,21 @@ function TwitchPlaysManifoldMarkets(props: {
Start playing now by logging in with Google and typing commands in chat! {twitchUser ? ( - - ) : isLoading ? ( - - ) : ( + ) : ( + )}
- Instead of Twitch channel points we use our play money, mana (m$). All + Instead of Twitch channel points we use our play money, Mana (M$). All viewers start with M$1000 and more can be earned for free and then{' '} - - donated to a charity + + donated to a charity {' '} of their choice at no cost!
@@ -167,28 +188,55 @@ function TwitchChatCommands() { function BotSetupStep(props: { stepNum: number buttonName?: string - text: string + buttonOnClick?: MouseEventHandler + children: ReactNode }) { - const { stepNum, buttonName, text } = props + const { stepNum, buttonName, buttonOnClick, children } = props return ( {buttonName && ( <> - + )}

Step {stepNum}.

- {text} + {children}
) } -function SetUpBot(props: { privateUser?: PrivateUser | null }) { - const { privateUser } = props +function SetUpBot(props: { + user?: User | null + privateUser?: PrivateUser | null +}) { + const { user, privateUser } = props const twitchLinked = privateUser?.twitchInfo?.twitchName + const controlToken = privateUser?.twitchInfo?.controlToken + + const linkIcon =