17}
18
19export function BranchControl({
20 projectId,
21 projectName,
6import { Projects } from "./Projects.tsx";
7
8function safeParse(s: string) {
9 try {
10 return JSON.parse(s);
14}
15
16export function App() {
17 const [bearerToken, setBearerToken] = useLocalStorage("bearer", "");
18 const [anthropicApiKey, setAnthropicApiKey] = useLocalStorage("anthropic_api_key", "");
20 const [project, setProject_] = useState(safeParse(projectJSON));
21
22 function setProject(p: any) {
23 setProject_(p);
24 setProjectJSON(JSON.stringify(p));
25 }
26
27 function handleLogout() {
28 setBearerToken("");
29 // Keep the anthropic API key in case the user wants to reuse it
1// Fetch project files from the backend
2export async function fetchProjectFiles(
3 { bearerToken, projectId, branchId }: { bearerToken: string; projectId: string; branchId?: string },
4) {
6}
7
8export function ApiKeyWarning({ show }: ApiKeyWarningProps) {
9 if (!show) return null;
10
8}
9
10export function PlayerList({ players, onDeletePlayer }: PlayerListProps) {
11 const [deletingId, setDeletingId] = useState<string | null>(null);
12
3import React, { useCallback, useEffect, useRef, useState } from "https://esm.sh/react@18.2.0";
4
5function ShaderRenderer({ vertexShader, fragmentShader, animated = false, width = "100%", height = "200px" }) {
6 const canvasRef = useRef(null);
7 const [error, setError] = useState(null);
240
241// Rest of the code remains the same as in the previous implementation
242function App() {
243 const [shaders, setShaders] = useState([]);
244 const [username, setUsername] = useState("");
324}
325
326function client() {
327 createRoot(document.getElementById("root")).render(<App />);
328}
329if (typeof document !== "undefined") { client(); }
330
331export default async function server(request: Request): Promise<Response> {
332 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
333 const KEY = new URL(import.meta.url).pathname.split("/").at(-1);
2import React, { useState } from "https://esm.sh/react@18.2.0?dev";
3
4export function DebugInfo() {
5 const [isOpen, setIsOpen] = useState(false);
6 const [logs, setLogs] = useState<string[]>([]);
2import { render, React } from "https://esm.town/v/jxnblk/reactstream/index.tsx";
3
4function App() {
5 const [count, setCount] = React.useState(0);
6
2import React from "https://esm.sh/react@18.2.0?dev";
3
4export function Header() {
5 return (
6 <header className="mb-8">
9}
10
11export function HomePage({ onNavigateToGame }: HomePageProps) {
12 const [games, setGames] = useState<Game[]>([]);
13 const [loading, setLoading] = useState(true);
Simple functional CSS library for Val Town
A helper function to build a file's email
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.