81`;
82
83function Instructions() {
84 return (
85 <div className="mb-4">
95}
96
97function TipList({ tips, selectedDate, sortOrder, setSortOrder }) {
98 const filteredTips = tips.filter((tip) => {
99 const tipDate = new Date(tip.timestamp);
145}
146
147function DateSelector({ selectedDate, setSelectedDate }) {
148 const [isCalendarOpen, setIsCalendarOpen] = useState(false);
149 const today = new Date();
232}
233
234function App({ initialTips }) {
235 const [amount, setAmount] = useState(20);
236 const [name, setName] = useState("");
350}
351
352function Confetti() {
353 useEffect(() => {
354 confetti({
362}
363
364function SuccessPage({ payments }) {
365 return (
366 <div className="min-h-screen bg-white text-black flex flex-col items-center justify-center p-4">
387}
388
389function client() {
390 const root = document.getElementById("root");
391 if (root.dataset.page === "success") {
402}
403
404export default async function server(req: Request): Promise<Response> {
405 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
406 const SCHEMA_VERSION = 2;
1export async function falProxyRequest(req: Request) {
2 const method = req.method;
3 const body = method === "GET" || method === "HEAD" ? undefined : await req.text();
6import { tomorrow } from "https://esm.sh/react-syntax-highlighter/dist/esm/styles/prism";
7
8function App() {
9 const [prompt, setPrompt] = useState("hello llamapalooza");
10 const [code, setCode] = useState("");
18 >(null);
19
20 async function handleSubmit(e: React.FormEvent) {
21 e.preventDefault();
22 setLoading(true);
92}
93
94function client() {
95 createRoot(document.getElementById("root")!).render(<App />);
96}
100}
101
102function extractCodeFromFence(text: string): string {
103 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
104 return htmlMatch ? htmlMatch[1].trim() : text;
105}
106
107export default async function server(req: Request): Promise<Response> {
108 if (req.method === "POST") {
109 const client = new Cerebras();
1import net, { AddressInfo } from "node:net";
2
3export default async function(req: Request): Promise<Response> {
4 return serveRequest(
5 req,
6 `data:text/tsx,${
7 encodeURIComponent(`
8export default async function(req: Request): Promise<Response> {
9 return Response.json("I am within a worker!")
10}
14}
15
16export async function serveRequest(req: Request, importUrl: string): Promise<Response> {
17 let port = await getFreePort();
18 const worker = new Worker(`https://esm.town/v/maxm/evaltownWorker?cachebust=${crypto.randomUUID()}`, {
55 });
56
57export async function isPortListening(port: number): Promise<boolean> {
58 let isListening = false;
59 const maxWaitTime = 2000; // ms
48await contentStore.init();
49
50function Town() {
51 return (
52 <div
69}
70
71function HomePage() {
72 return (
73 <html>
82 <form method="POST" action="/submit">
83 <textarea name="handler" rows={10} cols={50} autoFocus>
84 {`export default async function(req: Request) {
85 return Response.json("Hello, world!");
86}`}
95}
96
97function ContentPage({ handler, id }: { handler: string; id: string }) {
98 return (
99 <html>
122 let originalContent = textarea.value;
123
124 textarea.addEventListener('input', function() {
125 if (textarea.value !== originalContent) {
126 submitButton.style.display = 'inline-block';
5import safeJsonValue from "npm:safe-json-value";
6
7export default async function(req: Request): Promise<Response> {
8 if (req.method === "GET") {
9 return new Response(indexHTML, {
1import safeJsonValue from "npm:safe-json-value";
2
3export async function evalCode(
4 code: string,
5): Promise<{ error: { message: string; name: string; stack: string } } | any> {
43}
44
45function getMainExport(
46 mod: any,
47): { ok: true; value: any } | { ok: false; error: Error } {
5import confetti from "https://esm.sh/canvas-confetti";
6
7function Instructions() {
8 return (
9 <div className="bg-gray-100 p-4 rounded-xl mb-6">
31}
32
33function TippingForm({ onPaymentSuccess }) {
34 const [amount, setAmount] = useState(20);
35 const [name, setName] = useState("");
148}
149
150function Leaderboard({ payments }) {
151 return (
152 <div className="bg-white p-8 rounded-3xl shadow-md w-full">
165}
166
167function Confetti() {
168 useEffect(() => {
169 const duration = 15 * 1000;
171 const defaults = { startVelocity: 30, spread: 360, ticks: 60, zIndex: 0 };
172
173 function randomInRange(min, max) {
174 return Math.random() * (max - min) + min;
175 }
176
177 const interval = setInterval(function() {
178 const timeLeft = animationEnd - Date.now();
179
200}
201
202function App() {
203 const [payments, setPayments] = useState([]);
204 const [showConfetti, setShowConfetti] = useState(false);
233}
234
235function client() {
236 createRoot(document.getElementById("root")).render(<App />);
237}
241}
242
243export default async function server(req: Request): Promise<Response> {
244 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
245 const SCHEMA_VERSION = 1;
1import { email } from "https://esm.town/v/std/email";
2export default async function(interval: Interval) {
3 await email({ subject: "Daily Motivation", text: "You can do it!" });
4}
5import { falProxyRequest } from "https://esm.town/v/stevekrouse/falProxyRequest";
6
7function App() {
8 const [prompt, setPrompt] = useState("");
9 const [imageUrl, setImageUrl] = useState("");
103}
104
105function client() {
106 createRoot(document.getElementById("root")).render(<App />);
107}
108if (typeof document !== "undefined") { client(); }
109
110export default async function server(req: Request): Promise<Response> {
111 const url = new URL(req.url);
112 if (url.pathname === "/") {