diff --git a/astro.config.mjs b/astro.config.mjs index c6e133a..72811fa 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -8,4 +8,9 @@ export default defineConfig({ solidJs(), UnoCSS({ injectReset: true }), ], + vite: { + resolve: { + noExternal: ["solid-icons"], + }, + }, }); diff --git a/data/tools.toml b/data/tools.toml index d71453b..7af37f3 100644 --- a/data/tools.toml +++ b/data/tools.toml @@ -1,62 +1,89 @@ [[category]] -key = "team" -label = "Team" +key = "ref" +label = "Referee" [[category]] -key = "referee" -label = "Referee" +key = "hr" +label = "Head Referee" [[category]] -key = "event-coordinator" +key = "ec" label = "Event Coordinator" +[[category]] +key = "vc" +label = "Volunteer Coordinator" + +[[category]] +key = "fta" +label = "FIRST Technical Advisor" + +[[category]] +key = "csa" +label = "Control Systems Advisor" + + # --- Official FIRST resources --- [[tool]] -name = "FTC Scoring Software" +name = "FTC Cloud Scoring Software" url = "https://ftc-scoring.firstinspires.org" -description = "Official scoring and results management software for FTC events." -categories = ["event-coordinator", "referee"] +description = "Cloud interface for managing FTC event listings & cloud integrations." +categories = ["ec", "fta", "hr"] official = true [[tool]] -name = "FIRST Inspires Dashboard" -url = "https://my.firstinspires.org" -description = "Official portal for team registration, event sign-up, and compliance." -categories = ["team", "event-coordinator"] +name = "FTC Local Scoring Software" +url = "https://github.com/FIRST-Tech-Challenge/scorekeeper" +description = "Official scoring and results management software for FTC events." +categories = ["ec", "fta"] official = true [[tool]] -name = "Game Manual Online" +name = "FTC Docs" url = "https://ftc-docs.firstinspires.org" -description = "Official FTC game manuals, rules, and technical documentation." -categories = ["team", "referee", "event-coordinator"] +description = "Official FTC technical documentation." +categories = ["fta", "csa"] +official = true + +[[tool]] +name = "FTC Resources" +url = "https://ftc-resources.firstinspires.org/ftc" +description = "Official landing page for team and volunteer resources." +categories = ["ref", "hr", "ec", "vc", "fta", "csa"] official = true # --- Community tools --- [[tool]] -name = "FTC Dashboard" -url = "https://ftcdashboard.github.io/ftcdashboard" -description = "Real-time telemetry dashboard for FTC robot debugging over Wi-Fi." -categories = ["team"] -author = "Acme Robotics" -source = "https://github.com/ftcdashboard/ftcdashboard" +name = "FTC Nexus" +url = "https://ftc.nexus/en/" +description = "Cloud-enabled queueing notifications and more." +categories = ["fta", "ec"] +official = false + +[[tool]] +name = "Cycle Time Analysis" +url = "https://cycles.zharel.me/" +description = "Cycle time lookups and analysis." +author = "Zachary Harel" +categories = ["fta", "hr"] official = false [[tool]] -name = "Road Runner" -url = "https://learnroadrunner.com" -description = "Motion planning library for FTC autonomous programming with spline paths." -categories = ["team"] -source = "https://github.com/acmerobotics/road-runner" +name = "VC Tools" +url = "https://volunteer.systems/" +description = "Badge generator and other analysis tools for Volunteer Coordinators" +author = "Jared Hasen-Klein" +source = "https://github.com/jaredhasenklein/vctools" +categories = ["vc", "ec"] official = false [[tool]] -name = "FTC Scout" -url = "https://ftcscout.org" -description = "Community statistics, team lookup, and event scouting for FTC competitions." -categories = ["team", "event-coordinator"] +name = "Drive Team Button Generator" +url = "https://pmrobotics.org/ftc-event-tools/printables" +description = "Genreator for student badges for drive team, pit crew, and more" +categories = ["hr", "ec"] official = false diff --git a/docs/superpowers/plans/2026-07-02-firsttech-tools.md b/docs/superpowers/plans/2026-07-02-firsttech-tools.md deleted file mode 100644 index 22b727e..0000000 --- a/docs/superpowers/plans/2026-07-02-firsttech-tools.md +++ /dev/null @@ -1,1079 +0,0 @@ -# firsttech.tools Implementation Plan - -> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. - -**Goal:** Build a statically-deployed landing page for FIRST Tech Challenge volunteers and teams to discover tools and resources, filterable by role/category, driven by a TOML data file. - -**Architecture:** Astro (static output) provides the page shell and reads `data/tools.toml` at build time, passing typed data as props to a single SolidJS island (`ToolDirectory`) that owns all interactive filter state. SolidUI components (vendored copy-paste) provide the card/badge/button UI; UnoCSS with `presetWind4` + `unocss-preset-shadcn` handles styling. - -**Tech Stack:** Astro, SolidJS, SolidUI (Kobalte-based, vendored), UnoCSS (`presetWind4` + `unocss-preset-shadcn` + `unocss-preset-animations`), `smol-toml`, `tsx` (dev dep for standalone validation), `wrangler` (deploy), `just` (task runner). - -## Global Constraints - -- Astro `output: "static"` — no SSR, no server endpoints. -- All interactive UI is one SolidJS island hydrated with `client:load`. -- UnoCSS dark selector: `[data-kb-theme="dark"]` (matches SolidUI/Kobalte convention). -- Build fails hard on any TOML data validation error with a clear message. -- Category `key` values must be unique; unknown category keys in tools are a build error. -- Required tool fields: `name`, `url`, `description`, `categories` (non-empty array). -- Optional tool fields: `author`, `source`, `official` (default `false`). -- Filter logic: no selection = show all; multi-select chips = OR/union; text search AND'd with chip filter. -- Node.js ≥ 18 (for `smol-toml` and Astro). - ---- - -### Task 1: Project scaffold — package.json, tsconfig, Astro + integrations config - -**Files:** -- Create: `package.json` -- Create: `tsconfig.json` -- Create: `astro.config.mjs` -- Create: `uno.config.ts` -- Create: `src/styles/global.css` -- Create: `justfile` -- Create: `wrangler.toml` -- Create: `.gitignore` - -**Interfaces:** -- Produces: working `just dev` and `just build` pipeline; Astro resolves SolidJS and UnoCSS. - -- [ ] **Step 1: Initialize package.json** - -```json -{ - "name": "firsttech-tools", - "version": "0.0.1", - "private": true, - "type": "module", - "scripts": { - "dev": "astro dev", - "build": "astro build", - "preview": "astro preview", - "check": "astro check" - }, - "dependencies": { - "@astrojs/solid-js": "^4.0.0", - "@unocss/preset-wind4": "^66.0.0", - "@unocss/reset": "^66.0.0", - "astro": "^5.0.0", - "class-variance-authority": "^0.7.0", - "clsx": "^2.0.0", - "smol-toml": "^1.3.0", - "solid-js": "^1.9.0", - "tailwind-merge": "^2.0.0", - "unocss": "^66.0.0", - "unocss-preset-animations": "^1.2.0", - "unocss-preset-shadcn": "^1.0.0" - }, - "devDependencies": { - "@unocss/astro": "^66.0.0", - "tsx": "^4.0.0", - "typescript": "^5.0.0", - "wrangler": "^3.0.0" - } -} -``` - -- [ ] **Step 2: Create tsconfig.json** - -```json -{ - "extends": "astro/tsconfigs/strict", - "compilerOptions": { - "baseUrl": ".", - "paths": { - "@/*": ["src/*"] - }, - "jsx": "preserve", - "jsxImportSource": "solid-js" - } -} -``` - -- [ ] **Step 3: Create astro.config.mjs** - -```js -import { defineConfig } from "astro/config"; -import solidJs from "@astrojs/solid-js"; -import UnoCSS from "@unocss/astro"; - -export default defineConfig({ - output: "static", - integrations: [ - solidJs(), - UnoCSS({ injectReset: true }), - ], -}); -``` - -- [ ] **Step 4: Create uno.config.ts** - -```ts -import { defineConfig } from "unocss"; -import { presetWind4 } from "@unocss/preset-wind4"; -import presetAnimations from "unocss-preset-animations"; -import { presetShadcn } from "unocss-preset-shadcn"; - -export default defineConfig({ - presets: [ - presetWind4(), - presetAnimations(), - presetShadcn({ - darkSelector: '[data-kb-theme="dark"]', - }), - ], - content: { - pipeline: { - include: [ - /\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html)($|\?)/, - "(src|components)/**/*.{js,ts}", - ], - }, - }, -}); -``` - -- [ ] **Step 5: Create src/styles/global.css** - -```css -@import "@unocss/reset/tailwind.css"; -``` - -- [ ] **Step 6: Create justfile** - -```just -# firsttech.tools task runner - -install: - npm install - -dev: - npm run dev - -build: - npm run build - -preview: - npm run preview - -check: - node --import tsx/esm scripts/validate.ts - npm run check - -deploy: build - wrangler pages deploy dist -``` - -- [ ] **Step 7: Create wrangler.toml** - -```toml -name = "firsttech-tools" -pages_build_output_dir = "dist" -compatibility_date = "2026-07-02" -``` - -- [ ] **Step 8: Create .gitignore** - -``` -node_modules/ -dist/ -.astro/ -.wrangler/ -``` - -- [ ] **Step 9: Install dependencies** - -Run: `just install` - -Expected: `node_modules/` created, no errors. Verify with: -``` -ls node_modules/astro node_modules/solid-js node_modules/unocss node_modules/smol-toml -``` - -- [ ] **Step 10: Verify Astro resolves (empty build check)** - -Create a minimal `src/pages/index.astro` temporarily: -```astro ---- ---- -

hello

-``` - -Run: `just build` - -Expected: exits 0, `dist/index.html` exists containing "hello". - -Remove the temp content (leave the file empty for now — Task 5 will write it properly). - -- [ ] **Step 11: Commit** - -```bash -git init -git add . -git commit -m "chore: scaffold Astro + SolidJS + UnoCSS project" -``` - ---- - -### Task 2: Data schema types and validation logic - -**Files:** -- Create: `src/lib/schema.ts` -- Create: `scripts/validate.ts` - -**Interfaces:** -- Produces: - - `Category` type: `{ key: string; label: string }` - - `Tool` type: `{ name: string; url: string; description: string; categories: string[]; author?: string; source?: string; official: boolean }` - - `SiteData` type: `{ categories: Category[]; tools: Tool[] }` - - `validate(raw: unknown): SiteData` — throws `Error` with descriptive message on any violation -- Consumes: nothing (no file I/O in this module) - -- [ ] **Step 1: Write `src/lib/schema.ts`** - -```ts -export interface Category { - key: string; - label: string; -} - -export interface Tool { - name: string; - url: string; - description: string; - categories: string[]; - author?: string; - source?: string; - official: boolean; -} - -export interface SiteData { - categories: Category[]; - tools: Tool[]; -} - -function isValidUrl(value: string): boolean { - try { - new URL(value); - return true; - } catch { - return false; - } -} - -export function validate(raw: unknown): SiteData { - if (typeof raw !== "object" || raw === null || Array.isArray(raw)) { - throw new Error("TOML root must be an object."); - } - - const obj = raw as Record; - - // --- Validate categories --- - if (!Array.isArray(obj.category)) { - throw new Error("data/tools.toml: missing [[category]] array."); - } - - const categoryKeys = new Set(); - const categories: Category[] = []; - - for (let i = 0; i < obj.category.length; i++) { - const cat = obj.category[i] as Record; - if (typeof cat.key !== "string" || cat.key.trim() === "") { - throw new Error(`category[${i}]: "key" is required and must be a non-empty string.`); - } - if (typeof cat.label !== "string" || cat.label.trim() === "") { - throw new Error(`category[${i}] (key="${cat.key}"): "label" is required and must be a non-empty string.`); - } - if (categoryKeys.has(cat.key)) { - throw new Error(`Duplicate category key: "${cat.key}". Category keys must be unique.`); - } - categoryKeys.add(cat.key); - categories.push({ key: cat.key, label: cat.label }); - } - - // --- Validate tools --- - if (!Array.isArray(obj.tool)) { - throw new Error("data/tools.toml: missing [[tool]] array."); - } - - const tools: Tool[] = []; - - for (let i = 0; i < obj.tool.length; i++) { - const t = obj.tool[i] as Record; - const id = `tool[${i}]${typeof t.name === "string" ? ` ("${t.name}")` : ""}`; - - if (typeof t.name !== "string" || t.name.trim() === "") { - throw new Error(`${id}: "name" is required and must be a non-empty string.`); - } - if (typeof t.url !== "string" || t.url.trim() === "") { - throw new Error(`${id}: "url" is required and must be a non-empty string.`); - } - if (!isValidUrl(t.url)) { - throw new Error(`${id}: "url" is not a valid URL: "${t.url}".`); - } - if (typeof t.description !== "string" || t.description.trim() === "") { - throw new Error(`${id}: "description" is required and must be a non-empty string.`); - } - if (!Array.isArray(t.categories) || t.categories.length === 0) { - throw new Error(`${id}: "categories" is required and must be a non-empty array.`); - } - for (const catKey of t.categories) { - if (typeof catKey !== "string") { - throw new Error(`${id}: each entry in "categories" must be a string.`); - } - if (!categoryKeys.has(catKey)) { - throw new Error( - `${id}: unknown category key "${catKey}". ` + - `Valid keys: ${[...categoryKeys].map((k) => `"${k}"`).join(", ")}.` - ); - } - } - - if (t.source !== undefined) { - if (typeof t.source !== "string" || !isValidUrl(t.source)) { - throw new Error(`${id}: "source" must be a valid URL when provided, got: "${t.source}".`); - } - } - - tools.push({ - name: t.name, - url: t.url, - description: t.description, - categories: t.categories as string[], - author: typeof t.author === "string" ? t.author : undefined, - source: typeof t.source === "string" ? t.source : undefined, - official: t.official === true, - }); - } - - return { categories, tools }; -} -``` - -- [ ] **Step 2: Create `scripts/validate.ts` (standalone runner)** - -```ts -import { readFileSync } from "node:fs"; -import { parse } from "smol-toml"; -import { validate } from "../src/lib/schema.ts"; - -const raw = readFileSync("data/tools.toml", "utf-8"); -const parsed = parse(raw); - -try { - const data = validate(parsed); - console.log( - `✓ data/tools.toml is valid: ${data.categories.length} categories, ${data.tools.length} tools.` - ); -} catch (err) { - console.error("✗ Validation failed:", (err as Error).message); - process.exit(1); -} -``` - -- [ ] **Step 3: Create `data/tools.toml` with sample data to test against** - -```toml -[[category]] -key = "team" -label = "Team" - -[[category]] -key = "referee" -label = "Referee" - -[[category]] -key = "event-coordinator" -label = "Event Coordinator" - -[[tool]] -name = "FTC Scoring Software" -url = "https://ftc-scoring.firstinspires.org" -description = "Official scoring and results management software for FTC events." -categories = ["event-coordinator", "referee"] -official = true - -[[tool]] -name = "FTC Dashboard" -url = "https://ftcdashboard.github.io/ftcdashboard" -description = "Real-time telemetry dashboard for FTC robot debugging." -categories = ["team"] -author = "Acme Robotics" -source = "https://github.com/ftcdashboard/ftcdashboard" -official = false -``` - -- [ ] **Step 4: Run standalone validation** - -Run: `node --import tsx/esm scripts/validate.ts` - -Expected output: -``` -✓ data/tools.toml is valid: 3 categories, 2 tools. -``` - -- [ ] **Step 5: Verify validation catches errors** - -Temporarily add a tool with an unknown category key to `data/tools.toml`: -```toml -[[tool]] -name = "Bad Tool" -url = "https://example.com" -description = "test" -categories = ["nonexistent"] -``` - -Run: `node --import tsx/esm scripts/validate.ts` - -Expected: exits 1, prints message containing `unknown category key "nonexistent"`. - -Revert the temporary entry. - -- [ ] **Step 6: Commit** - -```bash -git add src/lib/schema.ts scripts/validate.ts data/tools.toml -git commit -m "feat: data schema types and build-time TOML validation" -``` - ---- - -### Task 3: Data loading module (`src/lib/data.ts`) - -**Files:** -- Create: `src/lib/data.ts` - -**Interfaces:** -- Consumes: `validate(raw): SiteData` from `src/lib/schema.ts`; `parse` from `smol-toml`; `data/tools.toml` (file read at build time) -- Produces: `siteData: SiteData` exported from `src/lib/data.ts` — consumed by `index.astro` - -- [ ] **Step 1: Write `src/lib/data.ts`** - -```ts -import { readFileSync } from "node:fs"; -import { parse } from "smol-toml"; -import { validate, type SiteData } from "./schema.ts"; - -const raw = readFileSync( - new URL("../../data/tools.toml", import.meta.url), - "utf-8" -); - -const parsed = parse(raw); -export const siteData: SiteData = validate(parsed); -``` - -Note: using `import.meta.url` so the path resolves correctly regardless of where Astro invokes the module. - -- [ ] **Step 2: Verify it resolves in an Astro context** - -In `src/pages/index.astro` (the placeholder from Task 1), add a build-time import to check it loads without error: - -```astro ---- -import { siteData } from "../lib/data.ts"; ---- - - -

Categories: {siteData.categories.length}

-

Tools: {siteData.tools.length}

- - -``` - -Run: `just build` - -Expected: exits 0, `dist/index.html` contains "Categories: 3" and "Tools: 2". - -- [ ] **Step 3: Commit** - -```bash -git add src/lib/data.ts src/pages/index.astro -git commit -m "feat: build-time TOML data loader" -``` - ---- - -### Task 4: Base layout with theme support - -**Files:** -- Create: `src/layouts/Base.astro` -- Create: `src/components/ThemeToggle.tsx` - -**Interfaces:** -- Consumes: `global.css` for UnoCSS reset -- Produces: - - `Base.astro` layout: accepts `{ title?: string }` prop, renders ``, header with ``, footer, and `` - - `ThemeToggle` Solid component: no props, toggles `data-kb-theme` on ``, persists to `localStorage` - -- [ ] **Step 1: Write `src/components/ThemeToggle.tsx`** - -```tsx -import { createSignal, onMount } from "solid-js"; - -export default function ThemeToggle() { - const [dark, setDark] = createSignal(false); - - onMount(() => { - const stored = localStorage.getItem("theme"); - const prefersDark = - stored === "dark" || - (!stored && window.matchMedia("(prefers-color-scheme: dark)").matches); - setDark(prefersDark); - document.documentElement.setAttribute( - "data-kb-theme", - prefersDark ? "dark" : "light" - ); - }); - - function toggle() { - const next = !dark(); - setDark(next); - const value = next ? "dark" : "light"; - document.documentElement.setAttribute("data-kb-theme", value); - localStorage.setItem("theme", value); - } - - return ( - - ); -} -``` - -- [ ] **Step 2: Write `src/layouts/Base.astro`** - -```astro ---- -import ThemeToggle from "../components/ThemeToggle.tsx"; -import "../styles/global.css"; - -interface Props { - title?: string; -} - -const { title = "FTC Tools & Resources" } = Astro.props; ---- - - - - - - - {title} - - - -
-
-

FTC Tools & Resources

-

- Community tools, resources, and systems for FIRST Tech Challenge. -

-
- -
- -
- -
- -
- Not an official FIRST program resource. Maintained by the FTC community. -
- - -``` - -- [ ] **Step 3: Verify the layout builds** - -Update `src/pages/index.astro` temporarily: - -```astro ---- -import Base from "../layouts/Base.astro"; ---- - -

Hello from the layout.

- -``` - -Run: `just build` - -Expected: exits 0, `dist/index.html` contains `data-kb-theme` script in ``, header text "FTC Tools", footer text "Not an official". - -- [ ] **Step 4: Commit** - -```bash -git add src/layouts/Base.astro src/components/ThemeToggle.tsx -git commit -m "feat: base layout with no-flash dark mode toggle" -``` - ---- - -### Task 5: ToolCard component - -**Files:** -- Create: `src/components/ToolCard.tsx` - -**Interfaces:** -- Consumes: `Tool` from `src/lib/schema.ts` -- Produces: `ToolCard` Solid component, props: `{ tool: Tool }` - -Note: This task uses hand-written card/badge HTML with UnoCSS utility classes rather than vendoring full SolidUI Card/Badge components, which avoids complex setup while achieving the same visual result. The `unocss-preset-shadcn` provides the design tokens (colors, radii, shadows) these classes reference. - -- [ ] **Step 1: Write `src/components/ToolCard.tsx`** - -```tsx -import type { Tool } from "../lib/schema.ts"; - -interface Props { - tool: Tool; -} - -export default function ToolCard(props: Props) { - const { tool } = props; - - return ( -
-
-

{tool.name}

- {tool.official && ( - - FIRST Official - - )} -
- -

{tool.description}

- - {tool.author && ( -

By {tool.author}

- )} - -
- - Visit - - {tool.source && ( - - Source - - )} -
-
- ); -} -``` - -- [ ] **Step 2: Verify it compiles** - -Add a quick smoke-test import in `src/pages/index.astro`: - -```astro ---- -import Base from "../layouts/Base.astro"; -import ToolCard from "../components/ToolCard.tsx"; -import { siteData } from "../lib/data.ts"; ---- - - - -``` - -Run: `just build` - -Expected: exits 0. Open `dist/index.html` and confirm it contains the tool name from `data/tools.toml` (e.g. "FTC Scoring Software") and "FIRST Official". - -- [ ] **Step 3: Commit** - -```bash -git add src/components/ToolCard.tsx src/pages/index.astro -git commit -m "feat: ToolCard presentational component" -``` - ---- - -### Task 6: ToolDirectory island (filter state + card grid) - -**Files:** -- Create: `src/components/ToolDirectory.tsx` - -**Interfaces:** -- Consumes: - - `Category` and `Tool` from `src/lib/schema.ts` - - `ToolCard` from `src/components/ToolCard.tsx` -- Produces: `ToolDirectory` Solid component - - Props: `{ categories: Category[]; tools: Tool[] }` - - Renders: search input, category chips, filtered card grid or empty state - -- [ ] **Step 1: Write `src/components/ToolDirectory.tsx`** - -```tsx -import { createSignal, createMemo, For, Show } from "solid-js"; -import type { Category, Tool } from "../lib/schema.ts"; -import ToolCard from "./ToolCard.tsx"; - -interface Props { - categories: Category[]; - tools: Tool[]; -} - -export default function ToolDirectory(props: Props) { - const [selectedKeys, setSelectedKeys] = createSignal>(new Set()); - const [query, setQuery] = createSignal(""); - - function toggleCategory(key: string) { - setSelectedKeys((prev) => { - const next = new Set(prev); - if (next.has(key)) { - next.delete(key); - } else { - next.add(key); - } - return next; - }); - } - - function clearFilters() { - setSelectedKeys(new Set()); - setQuery(""); - } - - const visibleTools = createMemo(() => { - const keys = selectedKeys(); - const q = query().toLowerCase().trim(); - - return props.tools.filter((tool) => { - // Category filter: if no keys selected, pass all; else OR/union - const categoryMatch = - keys.size === 0 || - tool.categories.some((k) => keys.has(k)); - - // Text search: case-insensitive substring on name, description, author - const textMatch = - q === "" || - tool.name.toLowerCase().includes(q) || - tool.description.toLowerCase().includes(q) || - (tool.author?.toLowerCase().includes(q) ?? false); - - return categoryMatch && textMatch; - }); - }); - - return ( -
- {/* Search + chips */} -
- setQuery(e.currentTarget.value)} - class="w-full max-w-md rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring" - /> - -
- - {(cat) => { - const active = () => selectedKeys().has(cat.key); - return ( - - ); - }} - -
-
- - {/* Card grid or empty state */} - 0} - fallback={ -
-

No tools match your filters.

- -
- } - > -
- - {(tool) => } - -
-
-
- ); -} -``` - -- [ ] **Step 2: Update `src/pages/index.astro` to use `ToolDirectory`** - -```astro ---- -import Base from "../layouts/Base.astro"; -import ToolDirectory from "../components/ToolDirectory.tsx"; -import { siteData } from "../lib/data.ts"; - -const { categories, tools } = siteData; ---- - - - - -``` - -- [ ] **Step 3: Build and inspect** - -Run: `just build` - -Expected: exits 0, `dist/index.html` contains the category labels ("Team", "Referee", "Event Coordinator"), tool names, and hydration script chunks for the Solid island. - -- [ ] **Step 4: Preview locally** - -Run: `just preview` - -Open `http://localhost:4321` (or the port shown). Verify: -- Both tools are visible on load. -- Clicking "Team" chip hides the Scoring Software tool (which has `event-coordinator` + `referee`) and shows only FTC Dashboard. -- Clicking "Team" again shows all. -- Typing "scoring" in search narrows to FTC Scoring Software. -- Selecting "Referee" chip AND typing "dashboard" shows empty state with "No tools match" and a "Clear filters" button; clicking it resets. -- Dark mode toggle switches theme; refreshing preserves the choice. -- "FIRST Official" badge appears on FTC Scoring Software only. -- "Source" link appears on FTC Dashboard (which has `source`) but not on FTC Scoring Software. - -- [ ] **Step 5: Commit** - -```bash -git add src/components/ToolDirectory.tsx src/pages/index.astro -git commit -m "feat: ToolDirectory island with filter chips, search, and card grid" -``` - ---- - -### Task 7: `just check` validation recipe and final wiring - -**Files:** -- Modify: `justfile` (update check recipe — it was pre-written in Task 1 but `scripts/validate.ts` now exists) -- No other changes needed - -**Interfaces:** -- Consumes: `scripts/validate.ts` (Task 2), `src/lib/data.ts` (Task 3) -- Produces: `just check` exits 0 on valid data, exits 1 with clear error on bad data - -- [ ] **Step 1: Verify `just check` runs end-to-end** - -Run: `just check` - -Expected: -``` -✓ data/tools.toml is valid: 3 categories, 2 tools. -``` -Then `astro check` runs with 0 errors. - -- [ ] **Step 2: Verify `just check` catches a bad TOML** - -Temporarily corrupt `data/tools.toml` — remove the `url` field from the first tool. - -Run: `just check` - -Expected: exits 1, message contains `"url" is required`. - -Restore the file. - -- [ ] **Step 3: Verify `just build` also fails on bad data (Astro imports data.ts at build time)** - -Same corruption as Step 2. - -Run: `just build` - -Expected: exits 1, Astro error output includes the validation message. - -Restore the file. - -- [ ] **Step 4: Verify `just deploy` dry-run (without actually deploying)** - -Confirm `wrangler` is available: - -Run: `npx wrangler --version` - -Expected: prints a version number. - -- [ ] **Step 5: Commit** - -```bash -git add justfile -git commit -m "chore: verify just check and build-time validation are wired correctly" -``` - ---- - -### Task 8: Polish and seed data - -**Files:** -- Modify: `data/tools.toml` — expand sample data to be representative -- Modify: `src/layouts/Base.astro` — minor copy/meta polish - -**Interfaces:** -- No interface changes; this task is polish only. - -- [ ] **Step 1: Expand `data/tools.toml` with representative seed data** - -Replace `data/tools.toml` with a richer set of entries covering all three categories, mix of official/unofficial, some with author + source, some without: - -```toml -[[category]] -key = "team" -label = "Team" - -[[category]] -key = "referee" -label = "Referee" - -[[category]] -key = "event-coordinator" -label = "Event Coordinator" - - -# --- Official FIRST resources --- - -[[tool]] -name = "FTC Scoring Software" -url = "https://ftc-scoring.firstinspires.org" -description = "Official scoring and results management software for FTC events." -categories = ["event-coordinator", "referee"] -official = true - -[[tool]] -name = "FIRST Inspires Dashboard" -url = "https://my.firstinspires.org" -description = "Official portal for team registration, event sign-up, and compliance." -categories = ["team", "event-coordinator"] -official = true - -[[tool]] -name = "Game Manual Online" -url = "https://ftc-docs.firstinspires.org" -description = "Official FTC game manuals, rules, and technical documentation." -categories = ["team", "referee", "event-coordinator"] -official = true - - -# --- Community tools --- - -[[tool]] -name = "FTC Dashboard" -url = "https://ftcdashboard.github.io/ftcdashboard" -description = "Real-time telemetry dashboard for FTC robot debugging over Wi-Fi." -categories = ["team"] -author = "Acme Robotics" -source = "https://github.com/ftcdashboard/ftcdashboard" -official = false - -[[tool]] -name = "Road Runner" -url = "https://learnroadrunner.com" -description = "Motion planning library for FTC autonomous programming with spline paths." -categories = ["team"] -source = "https://github.com/acmerobotics/road-runner" -official = false - -[[tool]] -name = "FTC Scout" -url = "https://ftcscout.org" -description = "Community statistics, team lookup, and event scouting for FTC competitions." -categories = ["team", "event-coordinator"] -official = false -``` - -- [ ] **Step 2: Add Open Graph meta tags to `src/layouts/Base.astro`** - -Inside ``, after ``: - -```astro -<meta name="description" content="Community tools, resources, and systems for FIRST Tech Challenge volunteers and teams." /> -<meta property="og:title" content={title} /> -<meta property="og:description" content="Community tools, resources, and systems for FIRST Tech Challenge volunteers and teams." /> -<meta property="og:type" content="website" /> -``` - -- [ ] **Step 3: Build and preview with full seed data** - -Run: `just build && just preview` - -Open `http://localhost:4321`. Verify: -- 6 tools render in the grid. -- "FIRST Official" badge shows on 3 tools. -- Filtering by "Team" shows 5 tools; "Referee" shows 2; "Event Coordinator" shows 4. -- Selecting "Team" + "Referee" together (OR) shows 5 unique tools (union). -- Searching "road" narrows to Road Runner. -- Dark mode toggle works. - -- [ ] **Step 4: Run `just check`** - -Run: `just check` - -Expected: `✓ data/tools.toml is valid: 3 categories, 6 tools.` and `astro check` 0 errors. - -- [ ] **Step 5: Commit** - -```bash -git add data/tools.toml src/layouts/Base.astro -git commit -m "chore: expand seed data and add OG meta tags" -``` - ---- - -## Plan Self-Review Notes - -- **Spec coverage:** All sections covered: schema/validation (Tasks 2–3), build pipeline (Tasks 1, 7), layout + theming (Task 4), ToolCard (Task 5), ToolDirectory island (Task 6), filter logic (Task 6), deploy (Tasks 1, 7), seed data (Task 8). -- **Placeholder scan:** All steps include concrete code or commands. No TBDs. -- **Type consistency:** `Category`, `Tool`, `SiteData`, `validate()` defined in Task 2 schema.ts; consumed by same names in Tasks 3, 5, 6. `siteData` exported from `data.ts` in Task 3; destructured as `{ categories, tools }` in Task 6 index.astro. -- **`tsx` dependency:** included in `devDependencies` in Task 1 package.json; used by `scripts/validate.ts` in Task 2 via `node --import tsx/esm`. -- **SolidUI vendoring:** The plan uses hand-written UnoCSS utility classes referencing shadcn design tokens (bg-card, border-border, etc.) instead of vendoring full SolidUI components, which is simpler and still achieves the visual goal. The `unocss-preset-shadcn` provides all necessary CSS custom properties. diff --git a/docs/superpowers/specs/2026-07-02-firsttech-tools-design.md b/docs/superpowers/specs/2026-07-02-firsttech-tools-design.md deleted file mode 100644 index 81912e1..0000000 --- a/docs/superpowers/specs/2026-07-02-firsttech-tools-design.md +++ /dev/null @@ -1,232 +0,0 @@ -# firsttech.tools — Design Spec - -**Date:** 2026-07-02 -**Status:** Approved - -## Overview - -A single-page static landing site for FIRST Tech Challenge volunteers and teams to discover useful tools and resources, filterable by role/category. Driven by a TOML data file; built by Astro and deployed to Cloudflare Pages. - ---- - -## Goals - -- Provide a centralized, low-maintenance directory of FTC tools and resources. -- Filter by category (role) and free-text search, with zero page reloads. -- Surface "FIRST Official" resources with a badge. -- Keep the entire deployment artifact as static HTML + minimal hydrated JS. -- All build operations driven by a `justfile`; deploy via `wrangler`. - ---- - -## Stack - -| Layer | Technology | -|---|---| -| Build / page shell | Astro (static output, `output: "static"`) | -| Interactive island | SolidJS (`client:load`) | -| UI components | SolidUI (shadcn-style, copy-paste vendored into `src/components/ui/`) | -| CSS engine | UnoCSS — `presetWind4` + `unocss-preset-shadcn` + `unocss-preset-animations` | -| TOML parsing | `smol-toml` (build-time only) | -| Task runner | `just` | -| Deploy | Cloudflare Pages via `wrangler pages deploy` | - ---- - -## Data Schema (`data/tools.toml`) - -### Categories (predefined, ordered) - -```toml -[[category]] -key = "team" # unique identifier, referenced by tools -label = "Team" # display label on chip -``` - -- `key`: required, string, unique across all categories. -- `label`: required, string, displayed on filter chip. -- No description field. -- Order in the file controls chip display order. - -### Tools - -```toml -[[tool]] -name = "Example Tool" # REQUIRED -url = "https://example.com" # REQUIRED — the tool link -description = "Short description." # REQUIRED -categories = ["team", "referee"] # REQUIRED — array, >=1 entry - -author = "Jane Doe" # optional -source = "https://github.com/..." # optional — source code link -official = true # optional, default false -``` - -**Required fields:** `name`, `url`, `description`, `categories` (non-empty array). -**Optional fields:** `author`, `source`, `official` (defaults `false`). - ---- - -## Validation Rules (build-time, hard failure) - -1. Every tool has `name`, `url`, `description`, and `categories` (non-empty). -2. Every category key referenced by a tool exists in the `[[category]]` list. -3. Category `key` values are unique across all categories. -4. `url` and `source` (when present) are well-formed URLs. -5. Build fails with a clear, actionable error message for any violation. - ---- - -## Project Structure - -``` -firsttech.tools/ -├── data/ -│ └── tools.toml # all categories and tools -├── src/ -│ ├── lib/ -│ │ ├── schema.ts # TS types + validate() function -│ │ └── data.ts # parse TOML, call validate, export typed data -│ ├── components/ -│ │ ├── ui/ # vendored SolidUI components -│ │ ├── ToolDirectory.tsx # Solid island: filter state, chip row, search, grid -│ │ ├── ToolCard.tsx # presentational: one tool card -│ │ └── ThemeToggle.tsx # light/dark toggle button -│ ├── layouts/ -│ │ └── Base.astro # <head>, header (title + toggle), footer -│ ├── pages/ -│ │ └── index.astro # imports data, passes to <ToolDirectory client:load> -│ └── styles/ -│ └── global.css # UnoCSS reset + shadcn base CSS vars -├── uno.config.ts -├── astro.config.mjs # solid + unocss integrations, output: "static" -├── justfile -├── package.json -├── tsconfig.json -├── wrangler.toml # Cloudflare Pages project config -└── scripts/ - └── validate.ts # standalone data validation script (used by just check) -``` - ---- - -## Module Responsibilities - -### `src/lib/schema.ts` -- Exports types: `Category`, `Tool`, `SiteData`. -- Exports `validate(raw: unknown): SiteData` — throws a descriptive `Error` on any rule violation (see Validation Rules above). Does not read files. - -### `src/lib/data.ts` -- Reads `data/tools.toml` using `smol-toml`. -- Calls `validate()`. -- Exports `siteData: SiteData` — consumed only at build time in `index.astro`. - -### `src/pages/index.astro` -- Imports `siteData` from `data.ts` at build time. -- Renders `Base.astro` shell. -- Renders `<ToolDirectory client:load categories={...} tools={...} />`. - -### `src/components/ToolDirectory.tsx` -- Solid island. Owns reactive state: `selectedCategories` (Set signal), `searchQuery` (string signal). -- Derives `visibleTools` via: - 1. If no categories selected → include all; else include tools matching ANY selected category (OR/union). - 2. AND: text search on name + description + author (case-insensitive substring). -- Renders: search `TextField`, category chip row, tool card grid (or "No tools match" when empty). - -### `src/components/ToolCard.tsx` -- Presentational Solid component. -- Props: `tool: Tool`. -- Renders `Card` with: name, "FIRST Official" `Badge` (when `official === true`), description, author (when present), "Visit" link (always), "Source" link (when `source` present). - -### `src/components/ThemeToggle.tsx` -- Solid component. -- Toggles `data-kb-theme` attribute on `<html>` between `"light"` and `"dark"`. -- Persists selection to `localStorage`. - -### `src/layouts/Base.astro` -- Inline `<script>` in `<head>` reads `localStorage`/system preference before first paint (no flash). -- Header: site name, tagline, `<ThemeToggle client:load />`. -- Footer: minimal (attribution or empty). - ---- - -## Frontend Behavior - -### Filter Logic -- Default state: all chips unselected, search empty → all tools visible. -- Category chips: toggle on/off; multiple selected = OR (union match). -- Text search: case-insensitive substring across `name`, `description`, `author`. -- Both filters apply together (chip filter AND text filter). - -### Empty State -- Display a friendly "No tools match your filters" message with a reset/clear button when `visibleTools` is empty. - ---- - -## Theming - -- Two themes: light and dark. -- `[data-kb-theme="dark"]` is the dark selector used by UnoCSS's `presetShadcn`. -- `ThemeToggle` cycles between light and dark, writing to `localStorage`. -- Inline `<script>` in `Base.astro` sets `data-kb-theme` before paint to avoid flash. -- `uno.config.ts` wires: `presetWind4()`, `presetAnimations()`, `presetShadcn({ darkSelector: '[data-kb-theme="dark"]' })`. - ---- - -## Build, Tasks & Deploy - -### `justfile` recipes - -| Recipe | Command | -|---|---| -| `just install` | `npm install` | -| `just dev` | `astro dev` | -| `just build` | `astro build` | -| `just preview` | `astro preview` | -| `just check` | `node --import tsx/esm scripts/validate.ts` (validates data standalone) + `astro check` | -| `just deploy` | `just build && wrangler pages deploy dist` | - -### Cloudflare Pages -- Static output in `dist/`. -- Git integration build command: `npm run build` (or `just build` if just is available). -- Output directory: `dist`. -- `wrangler.toml` contains Pages project name. - ---- - -## TypeScript Types - -```typescript -// src/lib/schema.ts - -export interface Category { - key: string; - label: string; -} - -export interface Tool { - name: string; - url: string; - description: string; - categories: string[]; // category keys - author?: string; - source?: string; - official: boolean; // default false -} - -export interface SiteData { - categories: Category[]; - tools: Tool[]; -} -``` - ---- - -## Out of Scope - -- Server-side rendering or API routes. -- Authentication or user accounts. -- CMS or database backend. -- Submitting new tools via the UI. -- Per-tool detail pages (single-page directory only). -- Pagination (all tools rendered in one grid; no lazy loading). diff --git a/justfile b/justfile index 24eb1ab..0126c7c 100644 --- a/justfile +++ b/justfile @@ -17,4 +17,4 @@ check: npm run check deploy: build - wrangler pages deploy dist + npm run deploy diff --git a/package-lock.json b/package-lock.json index dc070fd..2ecdc44 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "smol-toml": "^1.3.0", + "solid-icons": "^1.2.0", "solid-js": "^1.9.0", "tailwind-merge": "^3.6.0", "unocss": "^66.7.4", @@ -6133,6 +6134,15 @@ "url": "https://github.com/sponsors/cyyynthia" } }, + "node_modules/solid-icons": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/solid-icons/-/solid-icons-1.2.0.tgz", + "integrity": "sha512-yjQxWQMi9l19P5Af9vjsvalTMDFPDL4XD6etrUdNxNVhFp1bMYF0SFwUa5VYDfJ7u0SF3Qkz/F7BZxqcLUwklw==", + "license": "MIT", + "peerDependencies": { + "solid-js": "*" + } + }, "node_modules/solid-js": { "version": "1.9.14", "resolved": "https://registry.npmjs.org/solid-js/-/solid-js-1.9.14.tgz", diff --git a/package.json b/package.json index dfd98e9..fb7e255 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "type": "module", "scripts": { "dev": "astro dev", + "deploy": "wrangler deploy", "build": "astro build", "preview": "astro preview", "check": "astro check" @@ -17,6 +18,7 @@ "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "smol-toml": "^1.3.0", + "solid-icons": "^1.2.0", "solid-js": "^1.9.0", "tailwind-merge": "^3.6.0", "unocss": "^66.7.4", diff --git a/src/components/ThemeToggle.tsx b/src/components/ThemeToggle.tsx index 3c90959..8a23eaf 100644 --- a/src/components/ThemeToggle.tsx +++ b/src/components/ThemeToggle.tsx @@ -1,4 +1,5 @@ import { createSignal, onMount } from "solid-js"; +import { FaSolidSun, FaSolidMoon } from 'solid-icons/fa' export default function ThemeToggle() { const [dark, setDark] = createSignal(false); @@ -29,7 +30,7 @@ export default function ThemeToggle() { aria-label="Toggle dark mode" class="rounded-md p-2 text-sm border border-border hover:bg-accent transition-colors" > - {dark() ? "Light" : "Dark"} + {dark() ? <FaSolidSun /> : <FaSolidMoon />} </button> ); } diff --git a/src/components/ToolCard.tsx b/src/components/ToolCard.tsx index 95f01d2..ff4b5ef 100644 --- a/src/components/ToolCard.tsx +++ b/src/components/ToolCard.tsx @@ -1,4 +1,5 @@ import type { Tool } from "../lib/schema.ts"; +import { FaSolidExternalLink } from 'solid-icons/fa' interface Props { tool: Tool; @@ -18,12 +19,13 @@ export default function ToolCard(props: Props) { )} </div> - <p class="text-xs text-muted-foreground flex-1 leading-relaxed">{tool.description}</p> - {tool.author && ( <p class="text-[11px] text-muted-foreground">By {tool.author}</p> )} + <p class="text-xs text-muted-foreground flex-1 leading-relaxed">{tool.description}</p> + + <div class="flex gap-1.5 flex-wrap mt-auto pt-0.5"> <a href={tool.url} @@ -31,6 +33,7 @@ export default function ToolCard(props: Props) { rel="noopener noreferrer" class="inline-flex items-center rounded bg-primary text-primary-foreground text-xs font-medium px-2.5 py-1 hover:bg-primary/90 transition-colors" > + <FaSolidExternalLink class="mx-1"/> Visit </a> {tool.source && ( diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro index 2ee1a9c..1bf2ffb 100644 --- a/src/layouts/Base.astro +++ b/src/layouts/Base.astro @@ -49,8 +49,14 @@ const { title = "FTC Tools & Resources" } = Astro.props; <slot /> </main> - <footer class="border-t border-border px-6 py-4 text-center text-sm text-muted-foreground"> - Not an official FIRST program resource. Maintained by the FTC community. + <footer class="border-t border-border px-6 py-4 flex flex-col sm:flex-row items-center justify-between gap-3 text-sm text-muted-foreground"> + <span>Not an official FIRST resource. Maintained by the <a href="https://tangled.org/devyntk.me/firsttech.tools" class="underline hover:text-foreground transition-colors">FTC community</a>.</span> + <a + href="https://tangled.org/devyntk.me/firsttech.tools/issues/new" + class="inline-flex items-center gap-1.5 rounded-md border border-border bg-background px-3 py-1.5 text-sm font-medium text-foreground hover:bg-accent hover:text-accent-foreground transition-colors" + > + + Request an addition + </a> </footer> </body> </html> diff --git a/wrangler.toml b/wrangler.toml index 00b3ec6..29a52bd 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -1,3 +1,9 @@ name = "firsttech-tools" -pages_build_output_dir = "dist" -compatibility_date = "2026-07-02" +compatibility_date = "2026-07-03" + +[assets] +directory = "dist" + +[[routes]] +pattern = "firsttech.tools" +custom_domain = true