mirror of
https://github.com/kennethnym/aris.git
synced 2026-03-20 00:51:20 +00:00
* feat: init waitlist website Co-authored-by: Ona <no-reply@ona.com> * feat[waitlist]: tweak copy Co-authored-by: Ona <no-reply@ona.com> * fix[waitlist]: reminify lottie json Co-authored-by: Ona <no-reply@ona.com> * feat[waitlist]: seo and preview stuff * chore[waitlist]: clean up * build[waitlist]: add fly.io config * feat(waitlist): add time-of-day greeting and duplicate email message Co-authored-by: Ona <no-reply@ona.com> * feat(waitlist): handle duplicate emails and send confirmation Co-authored-by: Ona <no-reply@ona.com> * chore: remove stray console.log Co-authored-by: Ona <no-reply@ona.com> * feat(waitlist): add privacy policy page Co-authored-by: Ona <no-reply@ona.com> * feat(waitlist): add footer with bottom progressive blur Co-authored-by: Ona <no-reply@ona.com> * feat(waitlist): add trouble message and improve error handling Co-authored-by: Ona <no-reply@ona.com> * fix(waitlist): fix timeOfDay logic, typo, and add audienceId Co-authored-by: Ona <no-reply@ona.com> * feat(waitlist): add .ico fallback favicon and style error page Co-authored-by: Ona <no-reply@ona.com> * chore(waitlist): add robots.txt, sitemap, clean dockerignore Co-authored-by: Ona <no-reply@ona.com> * feat(waitlist): add footer to privacy policy page Co-authored-by: Ona <no-reply@ona.com> * fix(waitlist): use segments instead of audienceId Co-authored-by: Ona <no-reply@ona.com> * fix[waitlist]: remove segmentId from dup check Co-authored-by: Ona <no-reply@ona.com> * fix(waitlist): reset logo animation on mouse leave Co-authored-by: Ona <no-reply@ona.com> --------- Co-authored-by: Ona <no-reply@ona.com>
24 lines
603 B
TypeScript
24 lines
603 B
TypeScript
import { useEffect, useMemo, useState } from "react"
|
|
|
|
export function useFakeStreaming(fullContent: string) {
|
|
const [currentContent, setCurrentContent] = useState("")
|
|
const [isStreaming, setIsStreaming] = useState(true)
|
|
|
|
useEffect(() => {
|
|
const words = fullContent.split(" ")
|
|
|
|
let i = 0
|
|
const id = setInterval(() => {
|
|
if (i > words.length) {
|
|
setIsStreaming(false)
|
|
clearInterval(id)
|
|
} else {
|
|
setCurrentContent(words.slice(0, i).join(" ") + " ")
|
|
i++
|
|
}
|
|
}, 20)
|
|
}, [fullContent])
|
|
|
|
return useMemo(() => ({ currentContent, isStreaming }), [currentContent, isStreaming])
|
|
}
|