import { animate, motion, useMotionValue, useTransform } from "motion/react"; import { useEffect } from "react"; import { useWSQuery } from "../../hooks"; import { Tag } from "../../components/Tag"; import RegisterButton from "../../components/Auth/RegisterButton"; import { Button } from "../../components/Button"; import defusing from "../../assets/illustrations/defusing.png?aspect=4:3&w=100;200;300;400&format=webp&quality=100&as=metadata"; import lootbox1 from "../../assets/illustrations/lootbox1.png?aspect=1:1&w=100;200;300;400&format=webp&quality=100&as=metadata"; import mine from "../../assets/illustrations/mine.png?aspect=1:1&w=100;200;300;400&format=webp&quality=100&as=metadata"; import Section from "./Section"; import Hr from "../../components/Hr"; import { Link } from "wouter"; const taglines = [ "is the greatest experience", "will blow your mind (literally)", "99% luck, 1% skill, 100% rage", "where clicking randomly is a strategy", "sponsored by your cardiologist", "teaching probability since 1990", "the original trust issues simulator", "50/50 has never felt so wrong", "making grown adults say 'one more game'", "it's not gambling, it's math", "click responsibly", "where every square is a life decision", "the reason you have trust issues", "now with 100% more explosions", "technically a puzzle game", "stress testing your mouse since 1990", "flag it and pray", "corner clicks are self-care", "because therapy is expensive", "sweeping mines, not floors", "your daily dose of anxiety", "where 1 means run", "perfecting the art of guessing", "the game that never forgives", ]; const randomTagline = taglines[Math.floor(Math.random() * taglines.length)]; const Home = () => { const { data: userCount } = useWSQuery("user.getUserCount", null); const { data: gameCount } = useWSQuery("game.getTotalGamesPlayed", {}); const { data: username } = useWSQuery("user.getSelf", null); const usersFrom = (userCount ?? 0) / 2; const usersTo = userCount ?? 0; const gamesFrom = (gameCount ?? 0) / 2; const gamesTo = gameCount ?? 0; const usersCount = useMotionValue(usersFrom); const roundedUsers = useTransform(usersCount, (latest) => Math.round(latest)); const gamesCount = useMotionValue(gamesFrom); const roundedGames = useTransform(gamesCount, (latest) => Math.round(latest)); useEffect(() => { const controls = animate(usersCount, usersTo, { duration: 1.5 }); return controls.stop; }, [usersCount, usersTo]); useEffect(() => { const controls = animate(gamesCount, gamesTo, { duration: 1.5 }); return controls.stop; }, [gamesCount, gamesTo]); return (