1- import { Button } from "@hypr/ui/components/ui/button" ;
21import { SparklesIcon } from "lucide-react" ;
32import { useState } from "react" ;
43
5- const TEMPLATES = [
6- "1-on-1" ,
7- "Brainstorming" ,
8- "User Interview" ,
9- "Daily Standup" ,
10- "Project Plan" ,
11- "Meeting Notes" ,
12- "Action Items" ,
13- "Decision Log" ,
14- "Key Insights" ,
15- ] ;
4+ import { Button } from "@hypr/ui/components/ui/button" ;
5+ import * as persisted from "../../../../store/tinybase/persisted" ;
166
17- export function FloatingRegenerateButton ( ) {
7+ export function FloatingRegenerateButton ( { onRegenerate } : { onRegenerate : ( templateId : string | null ) => void } ) {
188 const [ showTemplates , setShowTemplates ] = useState ( false ) ;
199
10+ const templates = persisted . UI . useResultTable ( persisted . QUERIES . visibleTemplates , persisted . STORE_ID ) ;
11+
2012 return (
2113 < div className = "absolute bottom-6 left-1/2 -translate-x-1/2" >
22- { /* White card - slides up from behind */ }
2314 < div
2415 className = { `absolute left-1/2 -translate-x-1/2 bg-white rounded-lg shadow-lg border px-6 pb-14 transition-all duration-300 overflow-visible ${
2516 showTemplates
@@ -32,16 +23,16 @@ export function FloatingRegenerateButton() {
3223 >
3324 < div className = { `transition-opacity duration-200 ${ showTemplates ? "opacity-100" : "opacity-0" } ` } >
3425 < div className = "flex flex-col gap-3 max-h-64 overflow-y-auto" >
35- { TEMPLATES . map ( ( template ) => (
26+ { Object . entries ( templates ) . map ( ( [ templateId , template ] ) => (
3627 < button
37- key = { template }
28+ key = { templateId }
3829 className = "text-center py-2 hover:bg-neutral-100 rounded transition-colors text-base"
3930 onClick = { ( ) => {
40- console . log ( "Template clicked:" , template ) ;
4131 setShowTemplates ( false ) ;
32+ onRegenerate ( templateId ) ;
4233 } }
4334 >
44- { template }
35+ { template . title }
4536 </ button >
4637 ) ) }
4738 </ div >
@@ -54,14 +45,14 @@ export function FloatingRegenerateButton() {
5445 </ div >
5546 </ div >
5647
57- { /* Black button - always on top */ }
5848 < Button
5949 className = "relative bg-black hover:bg-neutral-800 text-white px-4 py-2 rounded-lg shadow-lg"
6050 style = { { zIndex : 10 } }
6151 onMouseEnter = { ( ) => setShowTemplates ( true ) }
6252 onMouseLeave = { ( ) => setShowTemplates ( false ) }
6353 onClick = { ( ) => {
64- console . log ( "regenerate clicked" ) ;
54+ setShowTemplates ( false ) ;
55+ onRegenerate ( null ) ;
6556 } }
6657 >
6758 < SparklesIcon className = "w-4 h-4 mr-2" />
0 commit comments