cekdatatruckmain.tsx5 matches
16const transportTypes = ["Industri", "SPBU", "Kero"];
1718function AddVehicleForm({ company, onVehicleAdded, onCancel }) {
19const [formData, setFormData] = useState({
20plateNumber: "",
115}
116117function AllVehiclesTable({ onClose }) {
118const [vehicles, setVehicles] = useState([]);
119const [sortConfig, setSortConfig] = useState({ key: null, direction: "ascending" });
202}
203204function App() {
205const [selectedCompany, setSelectedCompany] = useState(null);
206const [showScanner, setShowScanner] = useState(false);
450}
451452function client() {
453createRoot(document.getElementById("root")).render(<App />);
454}
456if (typeof document !== "undefined") { client(); }
457458export default async function server(request: Request): Promise<Response> {
459const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
460const SCHEMA_VERSION = 2;
qualityBrownTyrannosaurusmain.tsx3 matches
5const STORAGE_KEY = "nodeJSLearningPath";
67function NodeJSLearningRoadmap() {
8const [learningPath, setLearningPath] = useState(() => {
9const savedPath = localStorage.getItem(STORAGE_KEY);
168}
169170function client() {
171createRoot(document.getElementById("root")).render(<NodeJSLearningRoadmap />);
172}
173if (typeof document !== "undefined") { client(); }
174175export default async function server(request: Request): Promise<Response> {
176return new Response(
177`
email_jokemain.tsx1 match
23// Fetches a random joke.
4async function fetchRandomJoke() {
5const response = await fetch(
6"https://official-joke-api.appspot.com/random_joke",
57### Utilities
5859Our Blob SDK also includes some utility functions to make working with blobs easier.
6061##### Copy
45/**
6* Provides functions for interacting with your account's blob storage.
7* Blobs can store any data type (text, JSON, images, etc.) and allow
8* retrieval across different vals using the same key.
80};
8182async function list(prefix?: string): Promise<{ key: string; size: number; lastModified: string }[]> {
83let querystring = prefix ? `?prefix=${encodeURIComponent(prefix)}` : "";
84const res = await fetch(`${API_URL}/v1/blob${querystring}`, {
94}
9596async function delete_(key: string) {
97const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
98method: "DELETE",
107}
108109async function get(key: string) {
110const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
111headers: {
123}
124125async function set(key: string, value: BodyInit) {
126const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
127method: "POST",
137}
138139async function copy(previous: string, next: string) {
140const res = await get(previous);
141await set(next, res.body);
142}
143144async function move(previous: string, next: string) {
145await copy(previous, next);
146await delete_(previous);
147}
148149async function getJSON<T = unknown>(key: string): Promise<T> {
150try {
151const res = await get(key);
159}
160161async function setJSON(key: string, value: any) {
162return set(key, JSON.stringify(value));
163}
sqliteExplorerAppREADME.md1 match
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query
blob_adminmain.tsx1 match
18const PASSWORD_KEY = `${"blob_admin"}_admin_password`;
1920async function getOrSetPassword() {
21try {
22const storedPassword = await blob.get(PASSWORD_KEY);
tidyRedWhalemain.tsx3 matches
3import { createRoot } from "https://esm.sh/react-dom/client";
45function AssistantChat() {
6const [messages, setMessages] = useState<{role: string, content: string}[]>([
7{ role: 'system', content: 'You are a helpful AI assistant named ValAI, capable of understanding and assisting with various tasks.' }
77}
7879function client() {
80createRoot(document.getElementById("root")).render(<AssistantChat />);
81}
82if (typeof document !== "undefined") { client(); }
8384export default async function server(request: Request): Promise<Response> {
85if (request.method === 'POST' && new URL(request.url).pathname === '/chat') {
86const { OpenAI } = await import("https://esm.town/v/std/openai");
ImageSummaryEmailmain.tsx3 matches
2import { email } from "https://esm.town/v/std/email";
34export default async function(e: Email) {
5console.log("Email received!", e.from, e.subject);
632}
3334function formatEmailContent(observations: string[]): string {
35const listItems = observations
36.map(obs => `<li style="margin-bottom: 8px;">${obs}</li>`)
46}
4748async function sendReply(to: string, subject: string, body: string) {
49await email({
50subject,
generateImageSummarymain.tsx1 match
2import { fileToDataURL } from "https://esm.town/v/stevekrouse/fileToDataURL";
34export async function generateImageSummary(image: File): Promise<string[]> {
5const openai = new OpenAI();
6const dataURL = await fileToDataURL(image);