screenScoreKeeper.tsx1 match
14}
1516export default function ScoreKeeper({
17game,
18onAddPoint,
16const ADMIN_PASSWORD = Deno.env.get("ADMIN_KEY") || "defaultkey123";
1718export default async function(req: Request): Promise<Response> {
19const url = new URL(req.url);
20272273<script type="text/javascript">
274// Form validation function to check if captcha is completed
275function validateForm(event) {
276// Get the captcha response
277var captchaResponse = grecaptcha.getResponse();
491}
492493// Helper function for common styles
494function getCommonStyles() {
495return `
496<style>
638}
639640// Helper function to create error pages
641function createErrorPage(message, details = "") {
642return new Response(
643`
676677// Admin page handler
678async function handleAdminPage(req: Request): Promise<Response> {
679if (req.method === "GET") {
680return new Response(
814}
815816// Helper function for admin styles
817function getAdminStyles() {
818return `
819<style>
986987// Admin delete handler
988async function handleAdminDelete(req: Request): Promise<Response> {
989if (req.method !== "POST") {
990return new Response("Method not allowed", { status: 405 });
10251026// Admin export handler
1027async function handleAdminExport(req: Request): Promise<Response> {
1028if (req.method !== "POST") {
1029return new Response("Method not allowed", { status: 405 });
10691070// Admin import handler
1071async function handleAdminImport(req: Request): Promise<Response> {
1072const url = new URL(req.url);
1073const password = url.searchParams.get("password");
1267}
12681269// Helper function to parse CSV line (handles quoted fields)
1270function parseCSVLine(line: string): string[] {
1271const fields = [];
1272let current = "";
screenGameBoard.tsx2 matches
15}
1617export default function GameBoard({
18sites,
19activeGames,
218}
219220function CreateGameForm({ sites, selectedSiteId, onCreateGame, onClose, loading }: CreateGameFormProps) {
221const [formData, setFormData] = useState({
222siteId: selectedSiteId || (sites[0]?.id || ''),
18}
1920export default function App({ initialData }: AppProps) {
21const [sites, setSites] = useState<Site[]>(initialData.sites || []);
22const [activeGames, setActiveGames] = useState<Game[]>(initialData.activeGames || []);
FarcasterSpacesSpace.tsx14 matches
25// client.setClientRole("host");
2627export function Space() {
28return (
29<div className="p-5 mb-8">
104}
105106function SpaceHeader({ channel }: any) {
107const navigate = useNavigate()
108134}
135136function Lobby({ channel, space, uid, setCalling, setToken }: any) {
137// console.log("Lobby", channel);
138const { data: creator } = useUser(space?.created_by)
181}
182183function Room({ channel, token, uid, calling, setCalling }: any) {
184// console.log("Room", channel, calling, setCalling);
185279}
280281function User({
282uid,
283muted,
410}
411412function Indicator({ Icon, color }: any) {
413return (
414<div
419)
420}
421function Emoji({ emoji, color }: any) {
422return (
423<div className={`flex items-center justify-center w-5 h-5 rounded-full bg-${color}-500 absolute bottom-0 left-0`}>
429//////////
430431function useUser(uid: number) {
432return useQuery({
433queryKey: ['user', uid],
437}
438439async function getUserByUid(uid?: number) {
440if (!uid) return null
441if (uid > 2_000_000) return null
443}
444445function userImageUrl(address) {
446if (!address) return null
447return 'https://cdn.stamp.fyi/avatar/' + address + '?s=140'
448}
449450function useActiveSpeakerUid({ isConnected }) {
451const [activeSpeakerUid, setActiveSpeakerUid] = useState<any>()
452useEffect(() => {
459}
460461function getActiveSpeakerUid(volumes) {
462if (!volumes || volumes.length === 0) return undefined
463const topSpeaker = volumes?.reduce((prev, current) => (prev.level > current.level ? prev : current))
467}
468469function useSpace(id: string) {
470const [space, setSpace] = useState<any>()
471513}
514515function useEmojis(id: string) {
516const [receivedEmojis, setEmojis] = useState<any[]>([])
517
FarcasterSpacesui.tsx9 matches
3import { useEffect, useState } from "https://esm.sh/react@19";
45export function Section({ children, ...props }: any) {
6const sectionClass = `p-5 rounded-3xl bg-neutral-400/15 ${props.className || ""}`;
7return <div class={sectionClass}>{children}</div>;
93};
9495// export function Input(props: any) {
96// const inputClass = "dark:bg-white dark:text-black bg-black text-white rounded-md px-3 py-1 ";
97// return <input class={inputClass} {...props} />;
98// }
99100// export function Button(props: any) {
101// const buttonClass = "dark:bg-white dark:text-black bg-black text-white rounded-md px-3 py-1 ";
102// return <button class={buttonClass} {...props} />;
103// }
104105export function MonoButton(props: any) {
106return (
107<Button {...props}>
111}
112113export function MonoButtonWithStatus(props: any) {
114const [status, setStatus] = useState<any>();
115const handleClick = async () => {
132}
133134export function formatJSON(json: any) {
135return JSON.stringify(json, null, 2);
136}
146};
147148export function BackButton({}) {
149return <ArrowLeft className="w-5 h-5 m-2 cursor-pointer opacity-50" onClick={() => window.location.href = "/"} />;
150}
151152export function ShareButton({ onClick }) {
153return <Share className="w-5 h-5 m-2 cursor-pointer opacity-50" onClick={onClick} />;
154}
155156export function Sheet({ children, showSheet, setShowSheet }: any) {
157return (
158<>
screenqueries.ts11 matches
34// Site and Court queries
5export async function getAllSites(): Promise<Site[]> {
6const sites = await sqlite.execute("SELECT * FROM sites ORDER BY name");
7const courts = await sqlite.execute("SELECT * FROM courts ORDER BY site_id, number");
21}
2223export async function getCourtById(courtId: string): Promise<Court | null> {
24const result = await sqlite.execute(
25"SELECT * FROM courts WHERE id = ?",
3940// Player queries
41export async function createOrGetPlayer(name: string): Promise<Player> {
42// Check if player exists
43const existing = await sqlite.execute(
68}
6970export async function getPlayerById(playerId: string): Promise<Player | null> {
71const result = await sqlite.execute(
72"SELECT * FROM players WHERE id = ?",
8485// Game queries
86export async function createGame(request: CreateGameRequest): Promise<Game> {
87const gameId = `game-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
88
109}
110111export async function getGameById(gameId: string): Promise<Game | null> {
112const result = await sqlite.execute(`
113SELECT g.*,
154}
155156export async function getAllActiveGames(): Promise<Game[]> {
157const result = await sqlite.execute(`
158SELECT g.*,
196}
197198export async function getGamesByCourt(courtId: string): Promise<Game[]> {
199const result = await sqlite.execute(`
200SELECT g.*,
239240// Point logging
241export async function addPoint(request: AddPointRequest): Promise<PointLog> {
242const game = await getGameById(request.gameId);
243if (!game) throw new Error("Game not found");
319}
320321export async function getPointHistory(gameId: string): Promise<PointLog[]> {
322const result = await sqlite.execute(
323"SELECT * FROM point_logs WHERE game_id = ? ORDER BY timestamp",
339}
340341export async function completeGame(gameId: string): Promise<void> {
342await sqlite.execute(`
343UPDATE games SET
screenmigrations.ts2 matches
23// Database schema for pickleball scoring app
4export async function runMigrations() {
5console.log("Running database migrations...");
687}
8889async function insertDefaultData() {
90// Check if sites already exist
91const existingSites = await sqlite.execute("SELECT COUNT(*) as count FROM sites");
2import { renderToString } from "npm:react-dom@18.2.0/server";
34export default function App() {
5return <h1>Hello, world!</h1>;
6}
we-the-undersignedREADME.md2 matches
23← `server.js`: The Node.js server script for your new site. The JavaScript defines the endpoints in the site API. The API processes requests, connects to the database using the `sqlite` script in `src`, and sends info back to the client (the web pages that make up the app user interface, built using the Handlebars templates in `src/pages`).
2425← `/src/sqlite.js`: The database script handles setting up and connecting to the SQLite database. The `server.js` API endpoints call the functions in the database script to manage the data.
2627← `/src/data.json`: The data config file includes the database manager script–`server.js` reads the `database` property to import the correct script.
45## Try this next 🏗️
4647Take a look in `TODO.md` for steps in setting up your admin key and adding to the site functionality.
4849💡 __Want to use the server script as an API without using the front-end UI? No problem! Just send a query parameter `?raw=json` with your requests to return JSON, like this (replace the first part of the URL to match your remix): `glitch-hello-sqlite.glitch.me?raw=json`__