mirror of
https://github.com/supabase/supabase.git
synced 2026-06-22 19:15:17 +08:00
* Start * Refactor code and remove unused imports * Refactor SchemaFlowHandler and UserChat components * Refactor code and remove unused files * Refactor Thread component and remove CurrentThreadName import * Remove oldest_messages view from supabase.ts * Refactor supabase.ts file * Hook up loading state ChatInput component and remove old route handlers * Add updated prompt * Refactor chat form component and remove unused code * Make the suspense work when fetching messages. * Small refactor in the chat assistant form component. * Experimenting with streaming responses. WIP. * Move all components to thread_id/message_id folder. * Massive refactor but uses Nextjs app router properly. * Add a conditional submit which is used if the user haven't been logged in. * Add a typecheck command to db-new app. * Minor fixes. * Bunch of minor fixes. * Clean up more code. * Refactor the AssistantChatForm to use the new React forms features. * Run fitView after 50 milliseconds because it didn't run in some cases. * Style and flow nudges * Prettier * Delete old file --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
38 lines
926 B
TypeScript
38 lines
926 B
TypeScript
import { useState, useEffect } from 'react'
|
|
|
|
// something a little funny here maybe?
|
|
const textArray = [
|
|
"We're working hard to compute your results",
|
|
'Installing a new flux capacitor',
|
|
'Reconfiguring the warp drive',
|
|
'Analyzing the space modulator',
|
|
'etc....',
|
|
]
|
|
|
|
// this is just an idea.
|
|
// maybe a bad one
|
|
// needs better animation if we're keeping it
|
|
const ChatLoadingAnimation = () => {
|
|
const [currentTextIndex, setCurrentTextIndex] = useState(0)
|
|
const [currentText, setCurrentText] = useState(textArray[0])
|
|
|
|
useEffect(() => {
|
|
const interval = setInterval(() => {
|
|
setCurrentTextIndex((prevIndex) => (prevIndex + 1) % textArray.length)
|
|
setCurrentText(textArray[currentTextIndex])
|
|
}, 2000)
|
|
|
|
return () => {
|
|
clearInterval(interval)
|
|
}
|
|
}, [currentTextIndex, textArray])
|
|
|
|
return (
|
|
<div>
|
|
<h1>{currentText}</h1>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default ChatLoadingAnimation
|