tactfulCoffeeOctopusREADME.md2 matches
46- Key: `mentionsDiscord`
47- Value: Your Discord webhook URL.
48Notifications will be sent using this function:
4950```ts
6364- **Proxies via Val Town's [SocialDataProxy](https://www.val.town/v/stevekrouse/socialDataProxy)**: Limited to 10 cents per day for [**Val Town Pro users**](https://www.val.town/pricing). This API is *only* for Pro users.
65- **Need more calls?** Sign up for your own [SocialData API token](https://socialdata.tools) and configure the [`socialDataSearch`](https://www.val.town/v/stevekrouse/socialDataSearch) function.
tactfulCoffeeOctopusmain.tsx1 match
12const isProd = false;
1314export async function twitterAlert({ lastRunAt }: Interval) {
15// If isProd, search for tweets since that last time this interval ran
16// if not, search for tweets since 48 hours ago for testing
32{ name: "Heroku", icon: "🚀", explanation: "A cloud platform that lets companies build, deliver, monitor and scale apps", complexity: 2 },
33{ name: "Netlify", icon: "🎛️", explanation: "An all-in-one platform for automating modern web projects", complexity: 1 },
34{ name: "Vercel", icon: "🏁", explanation: "A cloud platform for static sites and Serverless Functions", complexity: 2 },
35],
36};
3738function client() {
39const root = document.getElementById("root");
40if (root && typeof React !== 'undefined' && React.useState) {
41const { useState, useEffect, useRef } = React;
4243function App() {
44const [step, setStep] = useState(0);
45const [conversation, setConversation] = useState([]);
273}
274275async function server(request: Request): Promise<Response> {
276const html = `
277<!DOCTYPE html>
ReactStaticmain.tsx3 matches
22}
2324export function render<T>(
25/** Root-level React component that renders an entire <html> element
26* including the head and body tags.
37// }
3839return async function handler(request: Request): Promise<Response> {
40const main = reactRender(Component);
41const middleware: Middleware[] = [
66Component: React.ComponentType<ReactStreamProps>,
67): Middleware =>
68async function(req: DataRequest, res: Response): Promise<Response> {
69const { renderToStaticMarkup } = await import("https://esm.sh/react-dom@18.3.1/server");
70
ReactStaticREADME.md4 matches
7import { render, React } from "https://esm.town/v/jxnblk/ReactStatic";
89function App() {
10return (
11<html>
55```tsx
56// example middleware
57async function api (req: Request, res: Response, next): Promise<Response> {
58if (req.pathname !== "/api") return next();
59if (req.method === "POST") {
71```tsx
72// example middleware
73async function getInitialProps (req: Request, res: Response, next) {
74// fetch data or do async work to pass as props to the component
75req.data = {
88import { render } from "https://esm.town/v/jxnblk/ReactStatic";
8990function App () {
91return (
92<html>
ReactStream_migratedmain.tsx3 matches
22}
2324export function render<T>(
25/** Root-level React component that renders an entire <html> element
26* including the head and body tags.
41}
4243return async function handler(request: Request): Promise<Response> {
44const main = reactStream(Component, module);
45const middleware: Middleware[] = [
76module: string | false,
77): Middleware =>
78async function(req: DataRequest, res: Response): Promise<Response> {
79const { renderToReadableStream } = await import("https://esm.sh/react-dom@18.3.1/server");
80
myBookmarkManagermain.tsx19 matches
4import React, { useEffect, useRef, useState } from "https://esm.sh/react@18.2.0";
56function MyBookmarkManager() {
7const [allSavedBookmarks, setAllSavedBookmarks] = useState([]);
8const [darkModeEnabled, setDarkModeEnabled] = useState(true);
7071// ----------------- Helpers -----------------
72function getSiteIconURL(bookmark) {
73const explicitFavicon = bookmark.faviconURL?.trim();
74if (explicitFavicon) return explicitFavicon;
180181// ----------------- Data Loading -----------------
182async function fetchSavedBookmarks() {
183const response = await fetch("/api/bookmarks");
184const data = await response.json();
189190// ----------------- Overlays -----------------
191function showAddNewBookmarkOverlay() {
192setBookmarkFormData({
193bookmarkCategory: "",
204}
205206function handleRightClickOnBookmark(e, bookmark) {
207e.preventDefault();
208setBookmarkFormData({
220}
221222function closeAddBookmarkOverlay() {
223setShowAddBookmarkOverlay(false);
224}
225226function closeSettingsOverlay() {
227setShowSettingsOverlay(false);
228}
229230// ----------------- CRUD -----------------
231async function handleBookmarkFormSubmit(e) {
232e.preventDefault();
233if (editBookmarkId === null) {
273274// ----------------- Export / Import -----------------
275async function saveAllBookmarks() {
276const response = await fetch("/api/bookmarks/export");
277const bookmarkData = await response.text(); // Get as text instead of blob
289}
290291function importBookmarksFromFile(event) {
292const uploadedFile = event.target.files[0];
293if (uploadedFile) {
316}
317318function triggerFileUpload() {
319fileInputRef.current.click();
320}
321322// ----------------- Category Filtering -----------------
323function toggleSelectedCategory(category) {
324setSelectedBookmarkCategories((prev) =>
325prev.includes(category)
329}
330331function resetAllCategories() {
332setSelectedBookmarkCategories([]);
333}
334335// ----------------- Field Visibility Toggles -----------------
336function toggleBookmarkFieldVisibility(fieldName) {
337setBookmarkVisibility((prev) => ({
338...prev,
342343// ----------------- Opening Bookmarks -----------------
344function openBookmarkInSameTab(url) {
345const actualURL = url.startsWith("http") ? url : `https://${url}`;
346window.location.href = actualURL;
347}
348349function openBookmarkInNewTab(url) {
350const actualURL = url.startsWith("http") ? url : `https://${url}`;
351window.open(actualURL, "_blank", "noopener,noreferrer");
376// Clipboard Paste Helpers
377// ------------------------------------------------------------------------
378async function handlePasteToField(fieldName) {
379try {
380const text = await navigator.clipboard.readText();
1270}
12711272function startApp() {
1273createRoot(document.getElementById("app-root")).render(<MyBookmarkManager />);
1274}
1512});
15131514export default async function handleRequest(request) {
1515return app.fetch(request);
1516}
ampleCopperMagpiemain.tsx3 matches
4import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
56function CreativeDeveloperPortfolio() {
7const [activeSection, setActiveSection] = useState("home");
8299}
300301function client() {
302createRoot(document.getElementById("root")).render(<CreativeDeveloperPortfolio />);
303}
305if (typeof document !== "undefined") { client(); }
306307export default async function server(request: Request): Promise<Response> {
308return new Response(
309`
falDemoAppmain.tsx3 matches
5import { falProxyRequest } from "https://esm.town/v/stevekrouse/falProxyRequest";
67function App() {
8const [prompt, setPrompt] = useState("");
9const [imageUrl, setImageUrl] = useState("");
103}
104105function client() {
106createRoot(document.getElementById("root")).render(<App />);
107}
108if (typeof document !== "undefined") { client(); }
109110export default async function server(req: Request): Promise<Response> {
111const url = new URL(req.url);
112if (url.pathname === "/") {
5import { renderToString } from "npm:react-dom/server";
67function StatusRow({ rows }) {
8return (
9<div className="w-full flex flex-col space-y-2">
28}
2930function StatusSection({ url, rows }) {
31const sectionRows = rows.filter(row => row[0] === url);
32const percentUp = Math.round((sectionRows.filter(row => row[1]).length / sectionRows.length) * 100);
44}
4546export default async function(req: Request): Promise<Response> {
47const { rows } = await sqlite.execute(
48"select url, ok, duration, timestamp from uptime order by timestamp desc limit 200",