1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2
3export function FeaturesPage() {
4 return (
5 <div className="primary-bg">
6}
7
8export function PageNav({ currentPage, onChangePage }: PageNavProps) {
9 return (
10 <div className="page-nav">
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2
3export function Header() {
4 return (
5 <header>
6import { PageNav } from "./PageNav.tsx";
7
8export function App() {
9 const [currentPage, setCurrentPage] = useState<'features' | 'details'>('features');
10
412 <script>
413 // Simple page navigation
414 document.getElementById('page1-btn').addEventListener('click', function() {
415 document.getElementById('page1').classList.add('active');
416 document.getElementById('page2').classList.remove('active');
417 });
418
419 document.getElementById('page2-btn').addEventListener('click', function() {
420 document.getElementById('page1').classList.remove('active');
421 document.getElementById('page2').classList.add('active');
27.string { color: #a5b4fc; } /* light indigo */
28.comment { color: #6b7280; } /* gray */
29.function { color: #d1d5db; } /* light gray */
30.variable { color: #e5e7eb; } /* lighter gray */
31.number { color: #fbbf24; } /* amber */
8
9 // Highlight keywords
10 const keywords = ['import', 'from', 'const', 'let', 'var', 'function', 'return', 'if', 'else', 'for', 'while'];
11 keywords.forEach(keyword => {
12 const regex = new RegExp(`\\b${keyword}\\b`, 'g');
41});
42
43// Toggle theme function (for future use)
44function toggleTheme() {
45 const body = document.body;
46 body.classList.toggle('light-theme');
2import { useState, useEffect } from "https://esm.sh/react@18.2.0";
3
4export function App() {
5 const [mood, setMood] = useState("✨ feeling cute ✨");
6 const [count, setCount] = useState(0);
4const endpoint = "https://serpapi.com/search.json";
5
6async function processResult(result) {
7 try {
8 // Try to fetch the actual webpage content
67
68const MAX_RESULTS = 20;
69async function googleIt(query: string) {
70 const results = (await search({ query })) ?? [];
71 const finalResults = results.slice(0, MAX_RESULTS);
85}
86
87export async function searchFinancialInfo(query: string) {
88 console.log("Doing web search =>", {
89 query,
94
95// Parse GitHub repo URL to extract owner and repo name
96function parseGitHubRepoURL(url: string): { owner: string; repo: string } {
97 try {
98 // Use the URL constructor to parse the URL
123
124// Fetch all files and their content from a GitHub repository
125async function fetchGitHubRepoContents(owner: string, repo: string, path: string = "") {
126 const files: Array<{
127 path: string;
192
193// Map GitHub file extension to Val.town file type
194function mapFileTypeForValTown(filePath: string): string | null {
195 const extension = filePath.split(".").pop()?.toLowerCase();
196
243}
244
245function transformHtmlContent(htmlContent: string): string {
246 return `export default function server(request: Request): Response {
247 return new Response(
248 \`${htmlContent}\`,
258// TODO could be doing this with a library
259// Check if file is likely binary based on extension
260function isProbablyBinaryFile(filePath: string): boolean {
261 const binaryExtensions = [
262 "png",
301
302// Create files in the Val.town project
303async function createFilesInValTown(authenticatedVT: any, files: any[], newProjectId: string) {
304 console.log(`Processing ${files.length} files`);
305
Helper function to send Discord messages
Simple functional CSS library for Val Town
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.