forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmoon.tsx
More file actions
84 lines (78 loc) · 2.78 KB
/
Copy pathmoon.tsx
File metadata and controls
84 lines (78 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { useState } from "react";
export interface MoonCardProps {
themeColor: string;
status: "inProgress" | "executing" | "complete";
respond?: (response: string) => void;
}
export function MoonCard({ themeColor, status, respond }: MoonCardProps) {
const [decision, setDecision] = useState<"launched" | "aborted" | null>(null);
const handleLaunch = () => {
setDecision("launched");
respond?.("You have permission to go to the moon.");
};
const handleAbort = () => {
setDecision("aborted");
respond?.(
"You do not have permission to go to the moon. The user you're talking to rejected the request.",
);
};
return (
<div
style={{ backgroundColor: themeColor }}
className="rounded-2xl shadow-xl max-w-md w-full mt-6"
>
<div className="bg-white/20 backdrop-blur-md p-8 w-full rounded-2xl">
{/* Show decision or prompt */}
{decision === "launched" ? (
<div className="text-center">
<div className="text-7xl mb-4">🌕</div>
<h2 className="text-2xl font-bold text-white mb-2">
Mission Launched
</h2>
<p className="text-white/90">We made it to the moon!</p>
</div>
) : decision === "aborted" ? (
<div className="text-center">
<div className="text-7xl mb-4">✋</div>
<h2 className="text-2xl font-bold text-white mb-2">
Mission Aborted
</h2>
<p className="text-white/90">Staying on Earth 🌍</p>
</div>
) : (
<>
<div className="text-center mb-6">
<div className="text-7xl mb-4">🚀</div>
<h2 className="text-2xl font-bold text-white mb-2">
Ready for Launch?
</h2>
<p className="text-white/90">Mission to the Moon 🌕</p>
</div>
{/* Launch Buttons */}
{status === "executing" && (
<div className="flex gap-3">
<button
onClick={handleLaunch}
className="flex-1 px-6 py-4 rounded-xl bg-white text-black font-bold
shadow-lg hover:shadow-xl transition-all
hover:scale-105 active:scale-95"
>
🚀 Launch!
</button>
<button
onClick={handleAbort}
className="flex-1 px-6 py-4 rounded-xl bg-black/20 text-white font-bold
border-2 border-white/30 shadow-lg
transition-all hover:scale-105 active:scale-95
hover:bg-black/30"
>
✋ Abort
</button>
</div>
)}
</>
)}
</div>
</div>
);
}