Skip to content

Commit

Permalink
Merge pull request #77 from zolplay-labs/dev
Browse files Browse the repository at this point in the history
Prod bump
  • Loading branch information
CaliCastle authored Oct 23, 2023
2 parents ad94f0c + ee3bb0f commit f806a25
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
15 changes: 10 additions & 5 deletions app/_game/scenes/Play.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { clsxm } from '@zolplay/utils'
import { AnimatePresence } from 'framer-motion'
import Image from 'next/image'
import { useEffect, useMemo, useRef, useState } from 'react'
import { useCountdown, useWindowSize } from 'usehooks-ts'
import { useCountdown, useInterval, useWindowSize } from 'usehooks-ts'

import { getGameImageUrlById } from '~/helpers/getGameImageUrlById'
import { useMount } from '~/hooks/useMount'
Expand All @@ -27,18 +27,23 @@ export function Play() {
const startTime = useRef(new Date())
const answers = useRef<Answers>([])
const handleAnswer = (AI: boolean) => {
if (answers.current.length === props.total) {
return
}
answers.current.push({ image: props.images[imageIndex] || '', AI })
setImageIndex(imageIndex + 1)
setSwipingSide('none')
}

useInterval(() => {
if (answers.current.length === props.total) {
const time = Math.floor(
(new Date().getTime() - startTime.current.getTime()) / 1000
)
setSceneProps('RESULT_WAITING', { answers: answers.current, time })
switchScene('RESULT_WAITING')
return
}
setImageIndex(imageIndex + 1)
setSwipingSide('none')
}
}, 1000)

const nextTestRemainingSeconds = dayjs(
sceneProps['MENU'].nextTestStartTime
Expand Down
18 changes: 17 additions & 1 deletion app/_game/scenes/TrialResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ const TRIAL_TIER: Map<boolean, TrialTier> = new Map([
},
],
])
const positiveFeedback = [
'Think you can tell apart nature from neural net?',
'Are you that good or are you just that lucky?',
'Not too shabby, are you up for the real tests?',
'You are humanity’s last hope!',
]
const negativeFeedback = [
'AI tricked ya real good here!',
'I guess your luck ran out?',
'How can you not tell, it was so easy!',
'AI on its way to replace you in 3, 2, 1',
]

export function TrialResult() {
const { sceneProps } = useSceneProps()
Expand All @@ -45,6 +57,10 @@ export function TrialResult() {
const { signInWithGoogle } = useUser()

const tier = TRIAL_TIER.get(props.isRight)!
// get a random feedback message
const feedback = props.isRight
? positiveFeedback[Math.floor(Math.random() * positiveFeedback.length)]
: negativeFeedback[Math.floor(Math.random() * negativeFeedback.length)]

return (
<GameLayout
Expand All @@ -67,7 +83,7 @@ export function TrialResult() {
<div>{tier.title}</div>
</div>
<div className="text-[8px] text-[#A9A9A9] sm:mb-[36px] sm:mt-[12px] sm:text-[13px]">
{tier.description}
{feedback}
</div>
<button
onClick={() => {
Expand Down

1 comment on commit f806a25

@vercel
Copy link

@vercel vercel bot commented on f806a25 Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

isthat-ai – ./

isthat.ai
isthat-ai-zolplay.vercel.app
isthat-ai-git-main-zolplay.vercel.app
www.isthat.ai

Please sign in to comment.