Redesign attendee app: venue map, achievements, ticket pass, celebrations

- Floating pill tab bar with raised Scan button; Booths tab becomes Venue map
  (tappable floor plan, filters, booth directory)
- Home: points card with tier progress, event card, mystery lead tile, badges strip
- Achievements: tier timeline (Valley Walker → Summit Pioneer) and badges
- Me: profile, stats, perforated ticket pass carousel
- Scan result: confetti, count-up points, tier progress; tier-unlock modal and
  badge toasts; welcome and merch-order toasts; leaderboard podium
- Add aidesigner agent skills (npx @aidesigner/agent-skills init)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kirukib 2026-11-17 23:34:20 +03:00
parent d7afad349f
commit 8e23a96c6b
27 changed files with 3311 additions and 361 deletions

View File

@ -0,0 +1,229 @@
---
name: "aidesigner-frontend"
description: "Use this skill when the user wants to create or redesign a frontend, landing page, dashboard, marketing page, or other UI with AIDesigner. Prefer the connected aidesigner MCP server for generate/refine, then use the local AIDesigner CLI for artifact capture, preview rendering, and repo-native adoption guidance."
---
<!-- AUTO-GENERATED from packages/aidesigner-agent-skills/templates/skill-body.md — do not edit directly.
Run `npx -y @aidesigner/agent-skills upgrade` to regenerate. -->
# AIDesigner Frontend
Use AIDesigner to establish a strong visual direction, then port that direction into the repo's real frontend stack instead of shipping raw HTML.
## Mission
1. Inspect the repo first.
2. Generate or refine an AIDesigner HTML artifact.
3. Capture that artifact into a local run.
4. Render a preview and adoption brief.
5. For clone work, run a local visual QA loop before calling it done.
6. Port the design into the repo's actual primitives, routes, tokens, and components.
## Scope Defaults
- Spend AIDesigner credits only when the user explicitly asked to use AIDesigner or clearly opted into that workflow.
- Prefer the connected `aidesigner` MCP server for `whoami`, `get_credit_status`, `generate_design`, and `refine_design`.
- Treat returned HTML as a design artifact first and implementation input second.
- Prefer one coherent direction over multiple weak variants.
## Auth And Execution Surface
- In Claude Code or Codex, prefer the connected `aidesigner` MCP server. That uses OAuth-backed account credits instead of API keys.
- For local helper usage outside a host-managed MCP connection, `AIDESIGNER_MCP_ACCESS_TOKEN` is the preferred bearer token.
- `AIDESIGNER_API_KEY` remains an explicit fallback for CI or manual usage.
- `AIDESIGNER_MCP_URL` and `AIDESIGNER_BASE_URL` are optional.
- For local file operations, always use the canonical AIDesigner CLI. Do not hand-roll `curl` calls.
```bash
npx -y @aidesigner/agent-skills <verb> ...
```
Supported verbs:
- `init`
- `doctor`
- `capture`
- `preview`
- `adopt`
## Pre-Flight
1. Before generating anything, look for repo design context in this order:
- `DESIGN.md`, `.aidesigner/DESIGN.md`, or `docs/design.md` if present
- theme files, token files, Tailwind config, CSS variables, font setup, and shared UI primitives
- the target route or page plus nearby components to understand real layout and interaction patterns
2. If no design brief file exists, inspect the repo directly and infer the existing design system from code before spending credits.
3. Write a compact internal design brief that covers:
- platform and target surface
- product goal and primary user action
- existing visual language to preserve or intentionally move away from
- important repo patterns, constraints, and content types
- typography, tokens, surfaces, spacing, and motion only when the repo already defines them or the user explicitly wants the current aesthetic preserved
- any explicit must-haves or do-not-break constraints from the repo or user
4. Decide whether the request is:
- prompt-only generation
- `clone` for a faithful recreation of a specific URL
- `enhance` for a redesign that preserves a specific URL's content or intent
- `inspire` for a new direction based on a specific URL's visual style
5. If the request is `clone`, verify screenshot-capable browser tooling before spending credits.
- Check whether Puppeteer or equivalent local browser automation is already available.
- If it is missing, install `puppeteer` in the repo using the repo package manager before generation so visual QA can happen after the run.
- Do not start clone generation when you already know screenshot QA cannot run.
## Workflow
### 1. Build The Visual Prompt
- Split the work into two layers:
- visual reference prompt for AIDesigner
- implementation spec you keep local for the real build
- Convert the user's ask plus that design brief into a broad visual reference prompt.
- Give AIDesigner room to invent structure, composition, visual rhythm, and stylistic details.
- Focus the prompt on product type, audience, UX priorities, desired feel, and non-negotiable constraints.
- Do not prescribe exact section order, card counts, copy, button labels, or detailed per-element placement unless the user explicitly asked for those specifics.
- Do not forward full content inventories, exhaustive section lists, parameter tables, example responses, CLI command matrices, or other documentation detail dumps into the AIDesigner prompt.
- If the user provided a highly detailed product or content spec, compress it into a smaller set of visual requirements for AIDesigner, then keep the detailed spec for local implementation after the design artifact comes back.
- The AIDesigner prompt should usually stay short and art-directed rather than reading like a PRD or sitemap.
- If the repo already has an established design system or the user wants the same aesthetic, bias the prompt toward consistency with that system and it is fine to mention concrete colors, fonts, or tokens from the repo.
- If the repo is new or the user wants a visual reset, keep the prompt relatively general on visual styling. Describe the desired vibe and product feel, but do not lock the design into exact colors, gradients, or overly specific palette instructions unless the user explicitly asked for them.
### 2. Generate Or Refine
- If you are connected to the `aidesigner` MCP server, call its `generate_design` or `refine_design` tool with a compact repo summary as `repo_context`.
- If you are using the helper directly, it performs the repo scan for you.
- Keep MCP calls prompt-driven unless the user explicitly asked for a reference-URL workflow.
- Only use `clone` when the user explicitly wants a near-1:1 recreation, copy, match, or faithful clone of a specific URL.
- Only use `enhance` when the user explicitly wants to improve, redesign, modernize, or upgrade a specific URL while preserving its content or intent.
- Only use `inspire` when the user explicitly wants a new design inspired by a specific URL or its visual style.
- Before a `clone` generation or refinement, confirm screenshot tooling is available. If Puppeteer or equivalent browser automation is missing, install it first in the repo rather than discovering that blocker after spending credits.
- If the user only mentions a URL as background context, do not pass `mode` or `url`.
- If the user wants `clone`, `enhance`, or `inspire` but no reference URL is available yet, stop and ask for the URL before spending credits.
- If continuing a previous reference-mode run, prefer `refine_design` and keep the existing `mode` and `url` as long as the user still wants that same reference workflow.
- If the user explicitly wants to stop matching the reference and branch into a fresh direction, drop `mode` and `url` and continue prompt-only. If needed, refine from the latest HTML artifact instead of reusing a prior run id so the new iteration does not inherit the old reference.
- If repeated AIDesigner work is likely and no design brief file exists, you may suggest creating a human-reviewable `DESIGN.md` or `.aidesigner/DESIGN.md` after the first pass. Do not silently invent one during setup.
If MCP succeeds, immediately persist the returned HTML into a local run:
```bash
npx -y @aidesigner/agent-skills capture --html-file .aidesigner/mcp-latest.html \
--prompt "<final prompt>" \
--transport mcp \
--remote-run-id "<run-id>"
```
If MCP is unavailable or the server says auth is expired:
- If `AIDESIGNER_API_KEY` is already configured, use `npx -y @aidesigner/agent-skills generate` or `npx -y @aidesigner/agent-skills refine` as the explicit fallback path.
- Otherwise stop and explain exactly how to connect AIDesigner:
1. Run `npx -y @aidesigner/agent-skills init` in this repo, or `npx -y @aidesigner/agent-skills init --scope user` for all repos
2. Open the host client
3. Open its MCP panel or login flow
4. Connect the `aidesigner` server and finish browser sign-in
5. Retry the request
- Mention the fallback alternative: set `AIDESIGNER_API_KEY` and retry.
### 3. Preview And Adopt
- After every successful run, ensure the user gets visuals.
- Use the preview created by `capture` or run:
```bash
npx -y @aidesigner/agent-skills preview --id <run-id>
```
- Run adoption analysis before porting:
```bash
npx -y @aidesigner/agent-skills adopt --id <run-id>
```
### 3A. Clone QA Loop
- If the request used `clone`, do not stop at the first generation.
- Clone QA must be visual, not just text-based. DOM inspection or structural reasoning can help, but they do NOT replace screenshot comparison.
- Capture screenshots of the generated result with browser automation. Prefer the preview created by `npx -y @aidesigner/agent-skills preview`, host-provided browser tools, or local automation such as Playwright or Puppeteer.
- If the clone has been ported into the repo, capture screenshots of the integrated page itself, not only the raw HTML artifact, whenever possible.
- Compare the generated screenshots against the reference URL and any available reference screenshots.
- Check for hard fidelity issues:
- section order and section count
- major layout geometry and container widths
- spacing rhythm and alignment
- typography scale, weight, and line-height
- image role, crop, and placement
- backgrounds, gradients, borders, shadows, and overlays
- repeated block counts such as logos, cards, testimonials, FAQs, and footer columns
- If no screenshot-capable browser tooling is available, stop and surface that blocker. Ask to install or enable a browser automation tool such as Playwright or Puppeteer before claiming clone QA is complete.
- If meaningful mismatches remain, fix them locally yourself in the HTML artifact or repo code. Do not spend another AIDesigner credit for small or medium visual corrections the agent can make directly.
- After local edits, render a fresh preview and compare again. Repeat until the remaining differences are minor or a real blocker remains.
- Use `refine_design` only when the clone is fundamentally off and a local correction pass would be slower or less reliable than another model iteration.
- When the clone has already been ported into the repo, prefer QA on the integrated implementation instead of only the raw artifact whenever local browser tooling is available.
### 4. Port Into The Repo
- Use the AIDesigner output as a strong design reference or inspiration board when building the real page or component locally.
- Do not paste raw standalone HTML into framework code when the repo has real frontend primitives.
- The design artifact defines two distinct layers - port them differently:
- **Design system layer (match precisely):** Extract and faithfully reproduce every visual decision from the artifact - color palette, gradients, shadows, border radii, border styles, spacing values, font sizes, font weights, letter-spacing, line-height, background effects, opacity values, hover and transition states, and layout structure. Convert these into the repo's native token system rather than approximating with "close enough" utility classes. When the artifact defines specific values, those are the spec.
- **Content layer (adapt freely):** Copy, section count, placeholder data, button labels, testimonial quotes, and other content should be filled in from the user's actual product context and request. The artifact's content is illustrative, not prescriptive.
- Clone exception: when the reference or artifact includes explicit media assets that are necessary for fidelity - product screenshots, brand logos, hero images, photography, illustrations, icon sprites, or videos - preserve them. Do not replace real asset URLs with homemade mocks, inline SVG approximations, placeholder art, or reconstructed fake UI unless the originals are unavailable or the user explicitly asked for substitution.
- For clone ports, run an asset audit before sign-off:
- compare key image or media references from the artifact/reference against the repo implementation
- make sure major screenshots, logos, hero visuals, and repeated brand assets still exist after the port
- if the artifact used real external assets, do not declare the clone complete when the integrated implementation has silently dropped them
- When porting the design system layer, work methodically:
1. First extract theme tokens from the artifact config or styles and define them in the repo's token system.
2. Then port each component's visual structure, preserving exact class values for spacing, sizing, and effects.
3. Do not substitute approximate values such as `pt-48` for `pt-32`, `min-h-screen` for `min-h-[90vh]`, or `text-6xl` for `text-[64px]`.
- Reuse the repo's existing routes, components, and token system where possible.
- Preserve accessibility basics and responsiveness while porting the design.
### 5. Parallelize Large Ports With Subagents
- If the artifact is large enough that one agent would be juggling multiple distinct sections, component families, or screens at once, split the implementation into focused subagent tasks.
- Keep the foundation work in the main agent:
- token extraction
- shared primitives
- route shell and page composition
- final integration decisions
- Use subagents for leaf-level porting work that can be done independently, such as:
- hero section
- feature section
- pricing grid
- testimonial rail
- FAQ block
- footer
- dashboard panel group
- repeated card family
- Split by coherent section or component family, not by arbitrary DOM slices.
- Give each subagent a tight scope:
- the exact section or component family to port
- the target files it may touch
- the relevant artifact fragment, screenshot, or HTML slice
- the non-negotiable tokens, spacing values, and visual constraints it must preserve
- Do not let multiple subagents edit the same component or file family unless the main agent is intentionally coordinating a merge.
- After subagents finish, the main agent must normalize shared primitives, remove duplicate token definitions, and make the final composition feel consistent.
- Use subagents to reduce cognitive load, not to avoid design judgment. The main agent remains responsible for fidelity and final integration quality.
## Required Outputs
After a successful run, provide or record all of the following:
- the final visual prompt or a concise prompt summary
- the remote run id if MCP returned one
- the local run id under `.aidesigner/runs/<run-id>/`
- the preview image path
- the adoption brief path, or explicit confirmation that adoption analysis was run
- the intended route, component, or surface targets for repo integration
- any unresolved blockers or risks if the design could not be fully adopted
## References
- For the API contract and helper behavior: [references/api.md](references/api.md)
- For the frontend adoption quality bar: [references/frontend-rubric.md](references/frontend-rubric.md)
## Operating Rules
- If neither MCP nor `AIDESIGNER_API_KEY` is available, stop and explain how to run `npx -y @aidesigner/agent-skills init` and reconnect through the host's MCP flow.
- Do not present raw HTML as the final integrated implementation for framework repos.
- Apply the original detailed requirements during implementation, not by forcing them all into the AIDesigner prompt.
- If repo context and user intent conflict, preserve the repo's design system unless the user explicitly wants a new visual direction.

View File

@ -0,0 +1,89 @@
# AIDesigner Frontend API Reference
This skill prefers the AIDesigner OAuth-backed remote MCP server for interactive Claude, Codex, Cursor, and Copilot usage and keeps the generate-design API as a fallback.
## Preferred MCP Surface
- MCP endpoint: `POST /api/v1/mcp`
- OAuth discovery:
- `GET /.well-known/oauth-protected-resource`
- `GET /.well-known/oauth-authorization-server`
- OAuth endpoints:
- `GET /api/v1/mcp/oauth/authorize`
- `POST /api/v1/mcp/oauth/token`
- `POST /api/v1/mcp/oauth/register`
- `POST /api/v1/mcp/oauth/revoke`
- MCP tools:
- `generate_design`
- `refine_design`
- `get_credit_status`
- `whoami`
When a host is connected to the `aidesigner` MCP server, the host manages OAuth login and token refresh. The agent should use the MCP tools directly.
## API-Key Fallback
- `POST /api/v1/generateDesign`
- Default base URL: `https://api.aidesigner.ai`
- Auth header: `Authorization: Bearer <AIDESIGNER_API_KEY>`
## Supported Request Fields
- `prompt: string`
- `messages: array`
- `streaming: boolean`
- `mode: inspire | clone | enhance`
- `url: string` when `mode` is present
The helper script uses `streaming: false` on the fallback API path so it can reliably capture a complete HTML artifact, write files, and render previews.
## Skill-Side Request Strategy
The agent or helper sends a compact repo summary plus the user request. Use this to make the output fit the destination codebase:
- framework and app shell
- route surface candidates
- token sources
- component-library clues
- design language hints
The goal is not to make AIDesigner emit final production code for the repo. The goal is to generate a strong visual artifact that the agent can then port into the repo responsibly.
## Verb Mapping
### `generate`
Creates a fresh local run and writes:
- `request.json`
- `repo-context.json`
- `design.html`
- `preview.png`
- `summary.json`
### `refine`
Loads a prior run, preserves parent context, and writes a new run with a `parentRunId`. On the MCP path, remote run ids are also persisted server-side so follow-up refinements can reference them directly.
### `preview`
Renders an HTML artifact to a PNG preview using local browser automation when available.
For clone workflows, this preview is part of the required visual QA loop. Agents should compare screenshots, not just inspect HTML or DOM structure.
### `adopt`
Reads the current run plus repo context and writes an adoption brief so the agent knows how to turn the artifact into repo-native code.
## Error Handling Expectations
Surface failures clearly:
- missing or invalid OAuth token
- missing or invalid API key fallback
- insufficient credits
- invalid reference URL
- upstream generation failure
- preview renderer unavailable
When preview rendering fails, keep the HTML artifact and explain the preview blocker. For clone workflows, the agent should request installation or enablement of browser automation such as Playwright or Puppeteer instead of silently skipping visual QA.

View File

@ -0,0 +1,82 @@
# AIDesigner Frontend Rubric
Use this rubric when turning an AIDesigner artifact into repo-native code.
## 1. Commit To A Clear Visual Direction
- Pick one strong aesthetic and carry it consistently.
- Avoid generic "AI-generated" layouts that feel interchangeable.
- Make typography, spacing, color, and imagery feel intentionally related.
## 2. Respect The Repo Before Inventing
- Reuse existing routes, shell patterns, and navigation conventions.
- Reuse component-library primitives before creating new base components.
- Preserve tokens from CSS variables, theme files, and utility conventions.
## 3. Port, Do Not Paste
- Treat generated HTML as a mockup artifact.
- Treat the AIDesigner prompt as a visual-direction tool, not the final content spec.
- Break the layout into logical sections and components.
- Map classes, spacing, and color choices into the repo's actual styling system.
- Remove dead CSS, duplicated wrappers, and one-off resets that fight the host app.
## 4. Keep The Implementation Production-Minded
- Maintain responsiveness across mobile and desktop.
- Preserve accessibility basics: headings, landmarks, labels, contrast, focus states.
- Keep animations purposeful and light.
- Avoid image-heavy hero sections that hide weak layout thinking.
## 5. Push Quality Upward
- If the repo already has a design system, make the new work feel like its strongest expression.
- If the repo is visually weak, still integrate cleanly but move the design forward with confidence.
- Prefer one polished direction over a bag of trends.
## 6. Adoption Heuristics
### Clone Fidelity
- For clone work, the acceptance bar is visual fidelity, not just thematic similarity.
- Compare screenshots of the generated preview or integrated implementation against the reference and look for concrete mismatches before declaring success.
- Text-only checks, DOM inspection, or structural summaries are insufficient on their own.
- Use browser automation when needed to capture screenshots. If the environment cannot take screenshots yet, surface that blocker and request installation or enablement of a tool such as Playwright or Puppeteer.
- Preserve section order, section count, repeated block count, image roles, and the overall page rhythm unless the user explicitly asked for a deviation.
- Preserve fidelity-critical media assets when they are part of the reference. Product screenshots, logos, photography, illustrations, and other explicit reference media are not interchangeable placeholder content.
- Run an asset-presence audit before sign-off. If the artifact/reference contains key media assets and the integrated implementation replaced them with mocks or dropped them entirely, the clone is not done.
- Fix visual gaps locally when they are specific and actionable. Do not default to another generation pass for spacing, typography, color, crop, or alignment issues the agent can correct directly.
### Content-Heavy Surfaces
- For docs, pricing, dashboards, and other content-dense pages, use AIDesigner to establish the visual system, rhythm, and component language.
- Keep the exact information architecture, copy fidelity, data tables, and reference details in the local implementation layer.
- Do not force every real content requirement into the generation prompt up front.
### Next.js / React
- Convert repeated sections into components.
- Prefer server and client boundaries that match existing app patterns.
- Keep business logic out of presentation-only layout components.
### Tailwind Projects
- Reuse established spacing, radius, shadow, and color tokens.
- Avoid enormous arbitrary values when existing scales can express the same design.
### Radix Or shadcn-Style Stacks
- Compose with existing primitives for dialogs, tabs, popovers, buttons, and form controls.
- Keep custom styling layered on top of those primitives instead of replacing them.
### Dashboard Surfaces
- Protect information density and navigation clarity.
- Do not sacrifice usability for spectacle.
### Marketing Surfaces
- Lead with hierarchy, clarity, and conversion.
- Make CTA contrast obvious.
- Ensure hero, proof, feature explanation, and CTA flow read naturally.

0
.aidesigner/.gitkeep Normal file
View File

View File

@ -0,0 +1,229 @@
---
name: "aidesigner-frontend"
description: "Use this skill when the user wants to create or redesign a frontend, landing page, dashboard, marketing page, or other UI with AIDesigner. Prefer the connected aidesigner MCP server for generate/refine, then use the local AIDesigner CLI for artifact capture, preview rendering, and repo-native adoption guidance."
---
<!-- AUTO-GENERATED from packages/aidesigner-agent-skills/templates/skill-body.md — do not edit directly.
Run `npx -y @aidesigner/agent-skills upgrade` to regenerate. -->
# AIDesigner Frontend
Use AIDesigner to establish a strong visual direction, then port that direction into the repo's real frontend stack instead of shipping raw HTML.
## Mission
1. Inspect the repo first.
2. Generate or refine an AIDesigner HTML artifact.
3. Capture that artifact into a local run.
4. Render a preview and adoption brief.
5. For clone work, run a local visual QA loop before calling it done.
6. Port the design into the repo's actual primitives, routes, tokens, and components.
## Scope Defaults
- Spend AIDesigner credits only when the user explicitly asked to use AIDesigner or clearly opted into that workflow.
- Prefer the connected `aidesigner` MCP server for `whoami`, `get_credit_status`, `generate_design`, and `refine_design`.
- Treat returned HTML as a design artifact first and implementation input second.
- Prefer one coherent direction over multiple weak variants.
## Auth And Execution Surface
- In Claude Code or Codex, prefer the connected `aidesigner` MCP server. That uses OAuth-backed account credits instead of API keys.
- For local helper usage outside a host-managed MCP connection, `AIDESIGNER_MCP_ACCESS_TOKEN` is the preferred bearer token.
- `AIDESIGNER_API_KEY` remains an explicit fallback for CI or manual usage.
- `AIDESIGNER_MCP_URL` and `AIDESIGNER_BASE_URL` are optional.
- For local file operations, always use the canonical AIDesigner CLI. Do not hand-roll `curl` calls.
```bash
npx -y @aidesigner/agent-skills <verb> ...
```
Supported verbs:
- `init`
- `doctor`
- `capture`
- `preview`
- `adopt`
## Pre-Flight
1. Before generating anything, look for repo design context in this order:
- `DESIGN.md`, `.aidesigner/DESIGN.md`, or `docs/design.md` if present
- theme files, token files, Tailwind config, CSS variables, font setup, and shared UI primitives
- the target route or page plus nearby components to understand real layout and interaction patterns
2. If no design brief file exists, inspect the repo directly and infer the existing design system from code before spending credits.
3. Write a compact internal design brief that covers:
- platform and target surface
- product goal and primary user action
- existing visual language to preserve or intentionally move away from
- important repo patterns, constraints, and content types
- typography, tokens, surfaces, spacing, and motion only when the repo already defines them or the user explicitly wants the current aesthetic preserved
- any explicit must-haves or do-not-break constraints from the repo or user
4. Decide whether the request is:
- prompt-only generation
- `clone` for a faithful recreation of a specific URL
- `enhance` for a redesign that preserves a specific URL's content or intent
- `inspire` for a new direction based on a specific URL's visual style
5. If the request is `clone`, verify screenshot-capable browser tooling before spending credits.
- Check whether Puppeteer or equivalent local browser automation is already available.
- If it is missing, install `puppeteer` in the repo using the repo package manager before generation so visual QA can happen after the run.
- Do not start clone generation when you already know screenshot QA cannot run.
## Workflow
### 1. Build The Visual Prompt
- Split the work into two layers:
- visual reference prompt for AIDesigner
- implementation spec you keep local for the real build
- Convert the user's ask plus that design brief into a broad visual reference prompt.
- Give AIDesigner room to invent structure, composition, visual rhythm, and stylistic details.
- Focus the prompt on product type, audience, UX priorities, desired feel, and non-negotiable constraints.
- Do not prescribe exact section order, card counts, copy, button labels, or detailed per-element placement unless the user explicitly asked for those specifics.
- Do not forward full content inventories, exhaustive section lists, parameter tables, example responses, CLI command matrices, or other documentation detail dumps into the AIDesigner prompt.
- If the user provided a highly detailed product or content spec, compress it into a smaller set of visual requirements for AIDesigner, then keep the detailed spec for local implementation after the design artifact comes back.
- The AIDesigner prompt should usually stay short and art-directed rather than reading like a PRD or sitemap.
- If the repo already has an established design system or the user wants the same aesthetic, bias the prompt toward consistency with that system and it is fine to mention concrete colors, fonts, or tokens from the repo.
- If the repo is new or the user wants a visual reset, keep the prompt relatively general on visual styling. Describe the desired vibe and product feel, but do not lock the design into exact colors, gradients, or overly specific palette instructions unless the user explicitly asked for them.
### 2. Generate Or Refine
- If you are connected to the `aidesigner` MCP server, call its `generate_design` or `refine_design` tool with a compact repo summary as `repo_context`.
- If you are using the helper directly, it performs the repo scan for you.
- Keep MCP calls prompt-driven unless the user explicitly asked for a reference-URL workflow.
- Only use `clone` when the user explicitly wants a near-1:1 recreation, copy, match, or faithful clone of a specific URL.
- Only use `enhance` when the user explicitly wants to improve, redesign, modernize, or upgrade a specific URL while preserving its content or intent.
- Only use `inspire` when the user explicitly wants a new design inspired by a specific URL or its visual style.
- Before a `clone` generation or refinement, confirm screenshot tooling is available. If Puppeteer or equivalent browser automation is missing, install it first in the repo rather than discovering that blocker after spending credits.
- If the user only mentions a URL as background context, do not pass `mode` or `url`.
- If the user wants `clone`, `enhance`, or `inspire` but no reference URL is available yet, stop and ask for the URL before spending credits.
- If continuing a previous reference-mode run, prefer `refine_design` and keep the existing `mode` and `url` as long as the user still wants that same reference workflow.
- If the user explicitly wants to stop matching the reference and branch into a fresh direction, drop `mode` and `url` and continue prompt-only. If needed, refine from the latest HTML artifact instead of reusing a prior run id so the new iteration does not inherit the old reference.
- If repeated AIDesigner work is likely and no design brief file exists, you may suggest creating a human-reviewable `DESIGN.md` or `.aidesigner/DESIGN.md` after the first pass. Do not silently invent one during setup.
If MCP succeeds, immediately persist the returned HTML into a local run:
```bash
npx -y @aidesigner/agent-skills capture --html-file .aidesigner/mcp-latest.html \
--prompt "<final prompt>" \
--transport mcp \
--remote-run-id "<run-id>"
```
If MCP is unavailable or the server says auth is expired:
- If `AIDESIGNER_API_KEY` is already configured, use `npx -y @aidesigner/agent-skills generate` or `npx -y @aidesigner/agent-skills refine` as the explicit fallback path.
- Otherwise stop and explain exactly how to connect AIDesigner:
1. Run `npx -y @aidesigner/agent-skills init` in this repo, or `npx -y @aidesigner/agent-skills init --scope user` for all repos
2. Open the host client
3. Open its MCP panel or login flow
4. Connect the `aidesigner` server and finish browser sign-in
5. Retry the request
- Mention the fallback alternative: set `AIDESIGNER_API_KEY` and retry.
### 3. Preview And Adopt
- After every successful run, ensure the user gets visuals.
- Use the preview created by `capture` or run:
```bash
npx -y @aidesigner/agent-skills preview --id <run-id>
```
- Run adoption analysis before porting:
```bash
npx -y @aidesigner/agent-skills adopt --id <run-id>
```
### 3A. Clone QA Loop
- If the request used `clone`, do not stop at the first generation.
- Clone QA must be visual, not just text-based. DOM inspection or structural reasoning can help, but they do NOT replace screenshot comparison.
- Capture screenshots of the generated result with browser automation. Prefer the preview created by `npx -y @aidesigner/agent-skills preview`, host-provided browser tools, or local automation such as Playwright or Puppeteer.
- If the clone has been ported into the repo, capture screenshots of the integrated page itself, not only the raw HTML artifact, whenever possible.
- Compare the generated screenshots against the reference URL and any available reference screenshots.
- Check for hard fidelity issues:
- section order and section count
- major layout geometry and container widths
- spacing rhythm and alignment
- typography scale, weight, and line-height
- image role, crop, and placement
- backgrounds, gradients, borders, shadows, and overlays
- repeated block counts such as logos, cards, testimonials, FAQs, and footer columns
- If no screenshot-capable browser tooling is available, stop and surface that blocker. Ask to install or enable a browser automation tool such as Playwright or Puppeteer before claiming clone QA is complete.
- If meaningful mismatches remain, fix them locally yourself in the HTML artifact or repo code. Do not spend another AIDesigner credit for small or medium visual corrections the agent can make directly.
- After local edits, render a fresh preview and compare again. Repeat until the remaining differences are minor or a real blocker remains.
- Use `refine_design` only when the clone is fundamentally off and a local correction pass would be slower or less reliable than another model iteration.
- When the clone has already been ported into the repo, prefer QA on the integrated implementation instead of only the raw artifact whenever local browser tooling is available.
### 4. Port Into The Repo
- Use the AIDesigner output as a strong design reference or inspiration board when building the real page or component locally.
- Do not paste raw standalone HTML into framework code when the repo has real frontend primitives.
- The design artifact defines two distinct layers - port them differently:
- **Design system layer (match precisely):** Extract and faithfully reproduce every visual decision from the artifact - color palette, gradients, shadows, border radii, border styles, spacing values, font sizes, font weights, letter-spacing, line-height, background effects, opacity values, hover and transition states, and layout structure. Convert these into the repo's native token system rather than approximating with "close enough" utility classes. When the artifact defines specific values, those are the spec.
- **Content layer (adapt freely):** Copy, section count, placeholder data, button labels, testimonial quotes, and other content should be filled in from the user's actual product context and request. The artifact's content is illustrative, not prescriptive.
- Clone exception: when the reference or artifact includes explicit media assets that are necessary for fidelity - product screenshots, brand logos, hero images, photography, illustrations, icon sprites, or videos - preserve them. Do not replace real asset URLs with homemade mocks, inline SVG approximations, placeholder art, or reconstructed fake UI unless the originals are unavailable or the user explicitly asked for substitution.
- For clone ports, run an asset audit before sign-off:
- compare key image or media references from the artifact/reference against the repo implementation
- make sure major screenshots, logos, hero visuals, and repeated brand assets still exist after the port
- if the artifact used real external assets, do not declare the clone complete when the integrated implementation has silently dropped them
- When porting the design system layer, work methodically:
1. First extract theme tokens from the artifact config or styles and define them in the repo's token system.
2. Then port each component's visual structure, preserving exact class values for spacing, sizing, and effects.
3. Do not substitute approximate values such as `pt-48` for `pt-32`, `min-h-screen` for `min-h-[90vh]`, or `text-6xl` for `text-[64px]`.
- Reuse the repo's existing routes, components, and token system where possible.
- Preserve accessibility basics and responsiveness while porting the design.
### 5. Parallelize Large Ports With Subagents
- If the artifact is large enough that one agent would be juggling multiple distinct sections, component families, or screens at once, split the implementation into focused subagent tasks.
- Keep the foundation work in the main agent:
- token extraction
- shared primitives
- route shell and page composition
- final integration decisions
- Use subagents for leaf-level porting work that can be done independently, such as:
- hero section
- feature section
- pricing grid
- testimonial rail
- FAQ block
- footer
- dashboard panel group
- repeated card family
- Split by coherent section or component family, not by arbitrary DOM slices.
- Give each subagent a tight scope:
- the exact section or component family to port
- the target files it may touch
- the relevant artifact fragment, screenshot, or HTML slice
- the non-negotiable tokens, spacing values, and visual constraints it must preserve
- Do not let multiple subagents edit the same component or file family unless the main agent is intentionally coordinating a merge.
- After subagents finish, the main agent must normalize shared primitives, remove duplicate token definitions, and make the final composition feel consistent.
- Use subagents to reduce cognitive load, not to avoid design judgment. The main agent remains responsible for fidelity and final integration quality.
## Required Outputs
After a successful run, provide or record all of the following:
- the final visual prompt or a concise prompt summary
- the remote run id if MCP returned one
- the local run id under `.aidesigner/runs/<run-id>/`
- the preview image path
- the adoption brief path, or explicit confirmation that adoption analysis was run
- the intended route, component, or surface targets for repo integration
- any unresolved blockers or risks if the design could not be fully adopted
## References
- For the API contract and helper behavior: [references/api.md](references/api.md)
- For the frontend adoption quality bar: [references/frontend-rubric.md](references/frontend-rubric.md)
## Operating Rules
- If neither MCP nor `AIDESIGNER_API_KEY` is available, stop and explain how to run `npx -y @aidesigner/agent-skills init` and reconnect through the host's MCP flow.
- Do not present raw HTML as the final integrated implementation for framework repos.
- Apply the original detailed requirements during implementation, not by forcing them all into the AIDesigner prompt.
- If repo context and user intent conflict, preserve the repo's design system unless the user explicitly wants a new visual direction.

View File

@ -0,0 +1,111 @@
<!-- AUTO-GENERATED from packages/aidesigner-agent-skills/templates/claude-command.md — do not edit directly.
Run `npx -y @aidesigner/agent-skills upgrade` to regenerate. -->
Use AIDesigner for the request in $ARGUMENTS.
## Scope Defaults
- Spend AIDesigner credits only when the user explicitly asked to use AIDesigner or clearly opted into that workflow.
- Prefer the connected `aidesigner` MCP server for `whoami`, `get_credit_status`, `generate_design`, and `refine_design`.
- Treat HTML as a design artifact first and implementation input second.
## Pre-Flight
1. Gather design context before spending credits:
- Read `DESIGN.md`, `.aidesigner/DESIGN.md`, or `docs/design.md` if present.
- Inspect theme files, tokens, fonts, shared components, and the target route or page.
2. Write a compact internal design brief from that repo context:
- platform and surface
- product goal and main user action
- visual language to preserve, evolve, or reset
- important repo patterns, constraints, and content types
- concrete typography or tokens only if preserving the current repo aesthetic
3. Split the task into:
- a visual reference prompt for AIDesigner
- a detailed implementation spec you keep local
4. If this will use `mode: "clone"`, check for screenshot-capable browser tooling before spending credits.
- If Puppeteer or equivalent browser automation is missing, install `puppeteer` in the repo with the repo package manager first.
- Do not start clone generation when visual QA tooling is known to be unavailable.
## Workflow
### 1. Build The Visual Prompt
Rewrite `$ARGUMENTS` into a broad visual reference prompt before calling AIDesigner.
- Focus on product type, audience, UX priorities, overall feel, and non-negotiable constraints.
- Let AIDesigner choose the specific layout, supporting sections, composition, and most stylistic details.
- Avoid exact section orders, card counts, micro-copy, and detailed per-element placement unless the user explicitly requested them.
- Do not pass exhaustive content outlines, tables, command lists, API fields, or other documentation detail dumps into the prompt.
- If the user gave a very specific page spec, compress it into a smaller visual brief for AIDesigner and save the full spec for local implementation.
- If matching an existing aesthetic, it is fine to mention concrete repo colors, fonts, and tokens.
- If this is a new design or revamp, keep styling guidance broad and do not hard-code exact colors or gradients unless the user explicitly asked for them.
### 2. Generate Or Refine
- Keep MCP calls prompt-driven unless the user explicitly asked for a reference-URL workflow.
- Use `mode: "clone"` only for a near-1:1 recreation or faithful copy of a specific URL.
- Use `mode: "enhance"` only to improve or modernize a specific URL while preserving its content or intent.
- Use `mode: "inspire"` only for a new design inspired by a specific URL or its visual style.
- Before `mode: "clone"` generation or refinement, make sure Puppeteer or equivalent screenshot tooling is installed. If it is missing, install it before you spend credits.
- If the user only mentions a URL as context, do not pass `mode` or `url`.
- If the user wants one of those reference workflows but has not provided the URL yet, stop and ask for it before spending credits.
- If a prior run already used a reference mode and the user still wants that workflow, use `refine_design` and keep the same `mode` and `url`.
- If the user explicitly wants to move away from the reference, drop `mode` and `url` and continue prompt-only. Refine from the latest HTML artifact instead of a prior run id if you need to avoid inheriting the old reference mode.
After a successful MCP generation or refinement, persist the returned HTML into a local run:
```bash
npx -y @aidesigner/agent-skills capture --html-file .aidesigner/mcp-latest.html \
--prompt "<final prompt>" \
--transport mcp \
--remote-run-id "<run-id>"
```
If MCP is unavailable or needs re-auth:
- If `AIDESIGNER_API_KEY` is already set, use `npx -y @aidesigner/agent-skills generate --prompt "<final prompt>"`.
- Otherwise stop and show setup instructions:
- Recommended: `npx -y @aidesigner/agent-skills init`, then reconnect through the host's MCP flow and sign into `aidesigner`.
- Cross-repo: `npx -y @aidesigner/agent-skills init --scope user`
- Fallback: set `AIDESIGNER_API_KEY` and retry
### 3. Preview, Adopt, And Port
- After every successful run, use the preview image and run `npx -y @aidesigner/agent-skills adopt --id <run-id>`.
- For `mode: "clone"`, run a visual QA loop before calling the result done:
- screenshot the result with browser automation, using the preview output, host browser tools, or Playwright/Puppeteer
- if the page is integrated into the repo, prefer screenshots of the integrated implementation
- compare those screenshots against the reference URL and any available screenshots
- check section order, layout geometry, spacing, typography, image placement, backgrounds, and repeated block counts
- text-only or DOM-only verification is not sufficient
- if no screenshot-capable browser tooling is available, stop and ask to install or enable one before claiming QA is complete
- fix remaining fidelity issues locally yourself in the HTML artifact or repo code
- rerender the preview after edits and repeat until only minor differences remain
- use `refine_design` only if the clone is fundamentally off and local edits are a worse option
- The design artifact defines two distinct layers - port them differently:
- Design system layer (match precisely): extract and faithfully reproduce every visual decision from the artifact - palette, gradients, shadows, radii, border styles, spacing, typography values, background effects, opacity, transitions, and layout structure. Convert them into the repo's native token system rather than approximating with "close enough" utility classes. When the artifact defines exact values, those are the spec.
- Content layer (adapt freely): copy, section count, placeholder data, button labels, testimonial quotes, and other content should come from the user's actual product context and request unless they explicitly asked for a close recreation.
- In clone mode, treat reference-provided media assets as fidelity-critical. Preserve real product screenshots, logos, hero images, photos, illustrations, and videos when they exist.
- Do not replace real asset URLs with homemade mocks, inline SVG stand-ins, or fake reconstructed UI unless the originals are unavailable or the user explicitly asked for substitution.
- Before signing off a clone port, run a simple asset audit so key screenshots and logos present in the artifact/reference are still present in the integrated implementation.
- When porting the design system layer, work methodically:
- First extract theme tokens from the artifact config or styles and define them in the repo token system.
- Then port each component's visual structure, preserving exact spacing, sizing, and effects.
- Do not substitute approximate values such as `pt-48` for `pt-32`, `min-h-screen` for `min-h-[90vh]`, or `text-6xl` for `text-[64px]`.
- For very large HTML ports, split the implementation into section-level or component-family subagent tasks.
- Keep tokens, shared primitives, route shell, and final integration in the main agent.
- Use subagents only for independent leaf sections, and give each one a tight file scope plus the exact artifact fragment it must port.
- Apply the full user requirements during repo implementation using local content, behaviors, and component structure. Do not ship raw standalone HTML into app code.
## Required Outputs
At the end of a successful run, provide or record:
- the final prompt or a concise prompt summary
- the remote run id if MCP returned one
- the local run id
- the preview image path
- the adoption brief path, or confirmation that adoption analysis ran
- the intended route or component targets for integration
- any blockers or remaining risks

View File

@ -0,0 +1,229 @@
---
name: "aidesigner-frontend"
description: "Use this skill when the user wants to create or redesign a frontend, landing page, dashboard, marketing page, or other UI with AIDesigner. Prefer the connected aidesigner MCP server for generate/refine, then use the local AIDesigner CLI for artifact capture, preview rendering, and repo-native adoption guidance."
---
<!-- AUTO-GENERATED from packages/aidesigner-agent-skills/templates/skill-body.md — do not edit directly.
Run `npx -y @aidesigner/agent-skills upgrade` to regenerate. -->
# AIDesigner Frontend
Use AIDesigner to establish a strong visual direction, then port that direction into the repo's real frontend stack instead of shipping raw HTML.
## Mission
1. Inspect the repo first.
2. Generate or refine an AIDesigner HTML artifact.
3. Capture that artifact into a local run.
4. Render a preview and adoption brief.
5. For clone work, run a local visual QA loop before calling it done.
6. Port the design into the repo's actual primitives, routes, tokens, and components.
## Scope Defaults
- Spend AIDesigner credits only when the user explicitly asked to use AIDesigner or clearly opted into that workflow.
- Prefer the connected `aidesigner` MCP server for `whoami`, `get_credit_status`, `generate_design`, and `refine_design`.
- Treat returned HTML as a design artifact first and implementation input second.
- Prefer one coherent direction over multiple weak variants.
## Auth And Execution Surface
- In Claude Code or Codex, prefer the connected `aidesigner` MCP server. That uses OAuth-backed account credits instead of API keys.
- For local helper usage outside a host-managed MCP connection, `AIDESIGNER_MCP_ACCESS_TOKEN` is the preferred bearer token.
- `AIDESIGNER_API_KEY` remains an explicit fallback for CI or manual usage.
- `AIDESIGNER_MCP_URL` and `AIDESIGNER_BASE_URL` are optional.
- For local file operations, always use the canonical AIDesigner CLI. Do not hand-roll `curl` calls.
```bash
npx -y @aidesigner/agent-skills <verb> ...
```
Supported verbs:
- `init`
- `doctor`
- `capture`
- `preview`
- `adopt`
## Pre-Flight
1. Before generating anything, look for repo design context in this order:
- `DESIGN.md`, `.aidesigner/DESIGN.md`, or `docs/design.md` if present
- theme files, token files, Tailwind config, CSS variables, font setup, and shared UI primitives
- the target route or page plus nearby components to understand real layout and interaction patterns
2. If no design brief file exists, inspect the repo directly and infer the existing design system from code before spending credits.
3. Write a compact internal design brief that covers:
- platform and target surface
- product goal and primary user action
- existing visual language to preserve or intentionally move away from
- important repo patterns, constraints, and content types
- typography, tokens, surfaces, spacing, and motion only when the repo already defines them or the user explicitly wants the current aesthetic preserved
- any explicit must-haves or do-not-break constraints from the repo or user
4. Decide whether the request is:
- prompt-only generation
- `clone` for a faithful recreation of a specific URL
- `enhance` for a redesign that preserves a specific URL's content or intent
- `inspire` for a new direction based on a specific URL's visual style
5. If the request is `clone`, verify screenshot-capable browser tooling before spending credits.
- Check whether Puppeteer or equivalent local browser automation is already available.
- If it is missing, install `puppeteer` in the repo using the repo package manager before generation so visual QA can happen after the run.
- Do not start clone generation when you already know screenshot QA cannot run.
## Workflow
### 1. Build The Visual Prompt
- Split the work into two layers:
- visual reference prompt for AIDesigner
- implementation spec you keep local for the real build
- Convert the user's ask plus that design brief into a broad visual reference prompt.
- Give AIDesigner room to invent structure, composition, visual rhythm, and stylistic details.
- Focus the prompt on product type, audience, UX priorities, desired feel, and non-negotiable constraints.
- Do not prescribe exact section order, card counts, copy, button labels, or detailed per-element placement unless the user explicitly asked for those specifics.
- Do not forward full content inventories, exhaustive section lists, parameter tables, example responses, CLI command matrices, or other documentation detail dumps into the AIDesigner prompt.
- If the user provided a highly detailed product or content spec, compress it into a smaller set of visual requirements for AIDesigner, then keep the detailed spec for local implementation after the design artifact comes back.
- The AIDesigner prompt should usually stay short and art-directed rather than reading like a PRD or sitemap.
- If the repo already has an established design system or the user wants the same aesthetic, bias the prompt toward consistency with that system and it is fine to mention concrete colors, fonts, or tokens from the repo.
- If the repo is new or the user wants a visual reset, keep the prompt relatively general on visual styling. Describe the desired vibe and product feel, but do not lock the design into exact colors, gradients, or overly specific palette instructions unless the user explicitly asked for them.
### 2. Generate Or Refine
- If you are connected to the `aidesigner` MCP server, call its `generate_design` or `refine_design` tool with a compact repo summary as `repo_context`.
- If you are using the helper directly, it performs the repo scan for you.
- Keep MCP calls prompt-driven unless the user explicitly asked for a reference-URL workflow.
- Only use `clone` when the user explicitly wants a near-1:1 recreation, copy, match, or faithful clone of a specific URL.
- Only use `enhance` when the user explicitly wants to improve, redesign, modernize, or upgrade a specific URL while preserving its content or intent.
- Only use `inspire` when the user explicitly wants a new design inspired by a specific URL or its visual style.
- Before a `clone` generation or refinement, confirm screenshot tooling is available. If Puppeteer or equivalent browser automation is missing, install it first in the repo rather than discovering that blocker after spending credits.
- If the user only mentions a URL as background context, do not pass `mode` or `url`.
- If the user wants `clone`, `enhance`, or `inspire` but no reference URL is available yet, stop and ask for the URL before spending credits.
- If continuing a previous reference-mode run, prefer `refine_design` and keep the existing `mode` and `url` as long as the user still wants that same reference workflow.
- If the user explicitly wants to stop matching the reference and branch into a fresh direction, drop `mode` and `url` and continue prompt-only. If needed, refine from the latest HTML artifact instead of reusing a prior run id so the new iteration does not inherit the old reference.
- If repeated AIDesigner work is likely and no design brief file exists, you may suggest creating a human-reviewable `DESIGN.md` or `.aidesigner/DESIGN.md` after the first pass. Do not silently invent one during setup.
If MCP succeeds, immediately persist the returned HTML into a local run:
```bash
npx -y @aidesigner/agent-skills capture --html-file .aidesigner/mcp-latest.html \
--prompt "<final prompt>" \
--transport mcp \
--remote-run-id "<run-id>"
```
If MCP is unavailable or the server says auth is expired:
- If `AIDESIGNER_API_KEY` is already configured, use `npx -y @aidesigner/agent-skills generate` or `npx -y @aidesigner/agent-skills refine` as the explicit fallback path.
- Otherwise stop and explain exactly how to connect AIDesigner:
1. Run `npx -y @aidesigner/agent-skills init` in this repo, or `npx -y @aidesigner/agent-skills init --scope user` for all repos
2. Open the host client
3. Open its MCP panel or login flow
4. Connect the `aidesigner` server and finish browser sign-in
5. Retry the request
- Mention the fallback alternative: set `AIDESIGNER_API_KEY` and retry.
### 3. Preview And Adopt
- After every successful run, ensure the user gets visuals.
- Use the preview created by `capture` or run:
```bash
npx -y @aidesigner/agent-skills preview --id <run-id>
```
- Run adoption analysis before porting:
```bash
npx -y @aidesigner/agent-skills adopt --id <run-id>
```
### 3A. Clone QA Loop
- If the request used `clone`, do not stop at the first generation.
- Clone QA must be visual, not just text-based. DOM inspection or structural reasoning can help, but they do NOT replace screenshot comparison.
- Capture screenshots of the generated result with browser automation. Prefer the preview created by `npx -y @aidesigner/agent-skills preview`, host-provided browser tools, or local automation such as Playwright or Puppeteer.
- If the clone has been ported into the repo, capture screenshots of the integrated page itself, not only the raw HTML artifact, whenever possible.
- Compare the generated screenshots against the reference URL and any available reference screenshots.
- Check for hard fidelity issues:
- section order and section count
- major layout geometry and container widths
- spacing rhythm and alignment
- typography scale, weight, and line-height
- image role, crop, and placement
- backgrounds, gradients, borders, shadows, and overlays
- repeated block counts such as logos, cards, testimonials, FAQs, and footer columns
- If no screenshot-capable browser tooling is available, stop and surface that blocker. Ask to install or enable a browser automation tool such as Playwright or Puppeteer before claiming clone QA is complete.
- If meaningful mismatches remain, fix them locally yourself in the HTML artifact or repo code. Do not spend another AIDesigner credit for small or medium visual corrections the agent can make directly.
- After local edits, render a fresh preview and compare again. Repeat until the remaining differences are minor or a real blocker remains.
- Use `refine_design` only when the clone is fundamentally off and a local correction pass would be slower or less reliable than another model iteration.
- When the clone has already been ported into the repo, prefer QA on the integrated implementation instead of only the raw artifact whenever local browser tooling is available.
### 4. Port Into The Repo
- Use the AIDesigner output as a strong design reference or inspiration board when building the real page or component locally.
- Do not paste raw standalone HTML into framework code when the repo has real frontend primitives.
- The design artifact defines two distinct layers - port them differently:
- **Design system layer (match precisely):** Extract and faithfully reproduce every visual decision from the artifact - color palette, gradients, shadows, border radii, border styles, spacing values, font sizes, font weights, letter-spacing, line-height, background effects, opacity values, hover and transition states, and layout structure. Convert these into the repo's native token system rather than approximating with "close enough" utility classes. When the artifact defines specific values, those are the spec.
- **Content layer (adapt freely):** Copy, section count, placeholder data, button labels, testimonial quotes, and other content should be filled in from the user's actual product context and request. The artifact's content is illustrative, not prescriptive.
- Clone exception: when the reference or artifact includes explicit media assets that are necessary for fidelity - product screenshots, brand logos, hero images, photography, illustrations, icon sprites, or videos - preserve them. Do not replace real asset URLs with homemade mocks, inline SVG approximations, placeholder art, or reconstructed fake UI unless the originals are unavailable or the user explicitly asked for substitution.
- For clone ports, run an asset audit before sign-off:
- compare key image or media references from the artifact/reference against the repo implementation
- make sure major screenshots, logos, hero visuals, and repeated brand assets still exist after the port
- if the artifact used real external assets, do not declare the clone complete when the integrated implementation has silently dropped them
- When porting the design system layer, work methodically:
1. First extract theme tokens from the artifact config or styles and define them in the repo's token system.
2. Then port each component's visual structure, preserving exact class values for spacing, sizing, and effects.
3. Do not substitute approximate values such as `pt-48` for `pt-32`, `min-h-screen` for `min-h-[90vh]`, or `text-6xl` for `text-[64px]`.
- Reuse the repo's existing routes, components, and token system where possible.
- Preserve accessibility basics and responsiveness while porting the design.
### 5. Parallelize Large Ports With Subagents
- If the artifact is large enough that one agent would be juggling multiple distinct sections, component families, or screens at once, split the implementation into focused subagent tasks.
- Keep the foundation work in the main agent:
- token extraction
- shared primitives
- route shell and page composition
- final integration decisions
- Use subagents for leaf-level porting work that can be done independently, such as:
- hero section
- feature section
- pricing grid
- testimonial rail
- FAQ block
- footer
- dashboard panel group
- repeated card family
- Split by coherent section or component family, not by arbitrary DOM slices.
- Give each subagent a tight scope:
- the exact section or component family to port
- the target files it may touch
- the relevant artifact fragment, screenshot, or HTML slice
- the non-negotiable tokens, spacing values, and visual constraints it must preserve
- Do not let multiple subagents edit the same component or file family unless the main agent is intentionally coordinating a merge.
- After subagents finish, the main agent must normalize shared primitives, remove duplicate token definitions, and make the final composition feel consistent.
- Use subagents to reduce cognitive load, not to avoid design judgment. The main agent remains responsible for fidelity and final integration quality.
## Required Outputs
After a successful run, provide or record all of the following:
- the final visual prompt or a concise prompt summary
- the remote run id if MCP returned one
- the local run id under `.aidesigner/runs/<run-id>/`
- the preview image path
- the adoption brief path, or explicit confirmation that adoption analysis was run
- the intended route, component, or surface targets for repo integration
- any unresolved blockers or risks if the design could not be fully adopted
## References
- For the API contract and helper behavior: [references/api.md](references/api.md)
- For the frontend adoption quality bar: [references/frontend-rubric.md](references/frontend-rubric.md)
## Operating Rules
- If neither MCP nor `AIDESIGNER_API_KEY` is available, stop and explain how to run `npx -y @aidesigner/agent-skills init` and reconnect through the host's MCP flow.
- Do not present raw HTML as the final integrated implementation for framework repos.
- Apply the original detailed requirements during implementation, not by forcing them all into the AIDesigner prompt.
- If repo context and user intent conflict, preserve the repo's design system unless the user explicitly wants a new visual direction.

View File

@ -0,0 +1,89 @@
# AIDesigner Frontend API Reference
This skill prefers the AIDesigner OAuth-backed remote MCP server for interactive Claude, Codex, Cursor, and Copilot usage and keeps the generate-design API as a fallback.
## Preferred MCP Surface
- MCP endpoint: `POST /api/v1/mcp`
- OAuth discovery:
- `GET /.well-known/oauth-protected-resource`
- `GET /.well-known/oauth-authorization-server`
- OAuth endpoints:
- `GET /api/v1/mcp/oauth/authorize`
- `POST /api/v1/mcp/oauth/token`
- `POST /api/v1/mcp/oauth/register`
- `POST /api/v1/mcp/oauth/revoke`
- MCP tools:
- `generate_design`
- `refine_design`
- `get_credit_status`
- `whoami`
When a host is connected to the `aidesigner` MCP server, the host manages OAuth login and token refresh. The agent should use the MCP tools directly.
## API-Key Fallback
- `POST /api/v1/generateDesign`
- Default base URL: `https://api.aidesigner.ai`
- Auth header: `Authorization: Bearer <AIDESIGNER_API_KEY>`
## Supported Request Fields
- `prompt: string`
- `messages: array`
- `streaming: boolean`
- `mode: inspire | clone | enhance`
- `url: string` when `mode` is present
The helper script uses `streaming: false` on the fallback API path so it can reliably capture a complete HTML artifact, write files, and render previews.
## Skill-Side Request Strategy
The agent or helper sends a compact repo summary plus the user request. Use this to make the output fit the destination codebase:
- framework and app shell
- route surface candidates
- token sources
- component-library clues
- design language hints
The goal is not to make AIDesigner emit final production code for the repo. The goal is to generate a strong visual artifact that the agent can then port into the repo responsibly.
## Verb Mapping
### `generate`
Creates a fresh local run and writes:
- `request.json`
- `repo-context.json`
- `design.html`
- `preview.png`
- `summary.json`
### `refine`
Loads a prior run, preserves parent context, and writes a new run with a `parentRunId`. On the MCP path, remote run ids are also persisted server-side so follow-up refinements can reference them directly.
### `preview`
Renders an HTML artifact to a PNG preview using local browser automation when available.
For clone workflows, this preview is part of the required visual QA loop. Agents should compare screenshots, not just inspect HTML or DOM structure.
### `adopt`
Reads the current run plus repo context and writes an adoption brief so the agent knows how to turn the artifact into repo-native code.
## Error Handling Expectations
Surface failures clearly:
- missing or invalid OAuth token
- missing or invalid API key fallback
- insufficient credits
- invalid reference URL
- upstream generation failure
- preview renderer unavailable
When preview rendering fails, keep the HTML artifact and explain the preview blocker. For clone workflows, the agent should request installation or enablement of browser automation such as Playwright or Puppeteer instead of silently skipping visual QA.

View File

@ -0,0 +1,82 @@
# AIDesigner Frontend Rubric
Use this rubric when turning an AIDesigner artifact into repo-native code.
## 1. Commit To A Clear Visual Direction
- Pick one strong aesthetic and carry it consistently.
- Avoid generic "AI-generated" layouts that feel interchangeable.
- Make typography, spacing, color, and imagery feel intentionally related.
## 2. Respect The Repo Before Inventing
- Reuse existing routes, shell patterns, and navigation conventions.
- Reuse component-library primitives before creating new base components.
- Preserve tokens from CSS variables, theme files, and utility conventions.
## 3. Port, Do Not Paste
- Treat generated HTML as a mockup artifact.
- Treat the AIDesigner prompt as a visual-direction tool, not the final content spec.
- Break the layout into logical sections and components.
- Map classes, spacing, and color choices into the repo's actual styling system.
- Remove dead CSS, duplicated wrappers, and one-off resets that fight the host app.
## 4. Keep The Implementation Production-Minded
- Maintain responsiveness across mobile and desktop.
- Preserve accessibility basics: headings, landmarks, labels, contrast, focus states.
- Keep animations purposeful and light.
- Avoid image-heavy hero sections that hide weak layout thinking.
## 5. Push Quality Upward
- If the repo already has a design system, make the new work feel like its strongest expression.
- If the repo is visually weak, still integrate cleanly but move the design forward with confidence.
- Prefer one polished direction over a bag of trends.
## 6. Adoption Heuristics
### Clone Fidelity
- For clone work, the acceptance bar is visual fidelity, not just thematic similarity.
- Compare screenshots of the generated preview or integrated implementation against the reference and look for concrete mismatches before declaring success.
- Text-only checks, DOM inspection, or structural summaries are insufficient on their own.
- Use browser automation when needed to capture screenshots. If the environment cannot take screenshots yet, surface that blocker and request installation or enablement of a tool such as Playwright or Puppeteer.
- Preserve section order, section count, repeated block count, image roles, and the overall page rhythm unless the user explicitly asked for a deviation.
- Preserve fidelity-critical media assets when they are part of the reference. Product screenshots, logos, photography, illustrations, and other explicit reference media are not interchangeable placeholder content.
- Run an asset-presence audit before sign-off. If the artifact/reference contains key media assets and the integrated implementation replaced them with mocks or dropped them entirely, the clone is not done.
- Fix visual gaps locally when they are specific and actionable. Do not default to another generation pass for spacing, typography, color, crop, or alignment issues the agent can correct directly.
### Content-Heavy Surfaces
- For docs, pricing, dashboards, and other content-dense pages, use AIDesigner to establish the visual system, rhythm, and component language.
- Keep the exact information architecture, copy fidelity, data tables, and reference details in the local implementation layer.
- Do not force every real content requirement into the generation prompt up front.
### Next.js / React
- Convert repeated sections into components.
- Prefer server and client boundaries that match existing app patterns.
- Keep business logic out of presentation-only layout components.
### Tailwind Projects
- Reuse established spacing, radius, shadow, and color tokens.
- Avoid enormous arbitrary values when existing scales can express the same design.
### Radix Or shadcn-Style Stacks
- Compose with existing primitives for dialogs, tabs, popovers, buttons, and form controls.
- Keep custom styling layered on top of those primitives instead of replacing them.
### Dashboard Surfaces
- Protect information density and navigation clarity.
- Do not sacrifice usability for spectacle.
### Marketing Surfaces
- Lead with hierarchy, clarity, and conversion.
- Make CTA contrast obvious.
- Ensure hero, proof, feature explanation, and CTA flow read naturally.

2
.gitignore vendored
View File

@ -41,3 +41,5 @@ yarn-error.*
/android
.env
.aidesigner/*
!.aidesigner/.gitkeep

8
.mcp.json Normal file
View File

@ -0,0 +1,8 @@
{
"mcpServers": {
"aidesigner": {
"type": "http",
"url": "https://api.aidesigner.ai/api/v1/mcp"
}
}
}

View File

@ -62,18 +62,37 @@ Universal/app links (camera opens the app without the site page) need a domain;
## Layout
```
src/app/_layout.tsx fonts, React Query, auth gate (→ /login?next=…)
src/app/login.tsx email → code → optional name (PATCH /me)
src/app/(tabs)/ index (home), booths, scan, investees, me
src/app/q/[token].tsx scan result (success / mystery celebration / already scanned / not a GRV code)
src/app/leaderboard.tsx, raffles.tsx, merch.tsx
src/components/ui.tsx icons, text, cards, buttons, screen shells
src/components/OrderCard.tsx merch order + pickup QR (order number)
src/app/_layout.tsx fonts, React Query, auth gate (→ /login?next=…), celebration host
src/app/login.tsx email → code → optional name (PATCH /me), welcome toast
src/app/(tabs)/ index (home), map (venue map + booth list), scan, investees, me (profile + ticket pass)
src/app/q/[token].tsx scan result: confetti, count-up points, tier progress, mystery screen,
then tier-unlock modal and badge toasts
src/app/achievements.tsx tier timeline + badges
src/app/leaderboard.tsx podium + list; raffles.tsx, merch.tsx
src/components/ui.tsx icons, text, cards, buttons, Backdrop wash, DateBlock, Pill, Gem/Medal art
src/components/Celebrate.tsx toast(), celebrate(), Confetti, announceProgress()
src/lib/content.ts event info, venue zones, achievement tiers and badges
src/lib/api.ts fetch wrapper, session (secure-store), API types, queries, money format
src/lib/theme.ts colours/fonts from GRVSummit/app/globals.css
assets/ icon/splash/pattern PNGs rendered from GRVLogo.png and mainwhite.svg
```
Design: GRV greens only (primary `#30614c`, secondary `#b9d8c9`, ink `#1a4034`), soft green wash at the
top of each screen, 20–28px radius cards with hairline borders, floating ink tab bar with a raised
Scan button. Every unlock (points, tier, badge, mystery) gets haptics plus confetti, a modal or a toast.
## Replacing placeholder assets
- **Venue map**: `zones` in `src/lib/content.ts`. Each zone is a rectangle on a 100 × 128 plan with
a name, kind (colour) and details. Booth numbers map to zones by letter (`boothPrefixes`).
To use a real floor-plan image instead, render it in `FloorPlan` (`src/app/(tabs)/map.tsx`) behind
the same tap targets.
- **Achievement art**: `Gem` (tiers) and `Medal` (badges) in `src/components/ui.tsx` are drawn SVG.
Swap their bodies for `<Image source={require('../../assets/achievements/<id>.png')} />`.
- **Tiers and badges**: names, point thresholds and hints in `src/lib/content.ts`. Badges are derived
from `/me` on the device, so changing a rule needs no backend change.
- **Event info** (dates, venue, programme): `event` in `src/lib/content.ts`.
Fonts: Antebas (headings) and DM Sans (body). The Antebas files are the Fontspring **demo**
build — digits and punctuation are watermark glyphs, so headings with numbers or punctuation use
DM Sans. Swap in the licensed OTFs in `assets/fonts/` before the store release.

View File

@ -1,28 +1,92 @@
import { Tabs } from 'expo-router/js-tabs';
import { Pressable, View } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { Icon, type IconName } from '../../components/ui';
import { colors, fonts } from '../../lib/theme';
import { colors } from '../../lib/theme';
// Floating pill tab bar: icons only, active tab gets a soft green disc; Scan is the raised centre.
const tab = (title: string, icon: IconName) => ({
title,
tabBarIcon: ({ color }: { color: unknown }) => (
<Icon name={icon} color={String(color)} size={22} />
tabBarAccessibilityLabel: title,
tabBarIcon: ({ focused }: { focused: boolean }) => (
<View
style={{
width: 44,
height: 44,
borderRadius: 22,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: focused ? colors.secondary : 'transparent',
}}
>
<Icon name={icon} color={focused ? colors.ink : 'rgba(255,255,255,0.75)'} size={22} />
</View>
),
});
export default function TabsLayout() {
const insets = useSafeAreaInsets();
return (
<Tabs
screenOptions={{
headerShown: false,
tabBarActiveTintColor: colors.primary,
tabBarInactiveTintColor: colors.grey2,
tabBarLabelStyle: { fontFamily: fonts.medium, fontSize: 11 },
tabBarStyle: { backgroundColor: colors.white, borderTopColor: colors.grey3 },
tabBarShowLabel: false,
tabBarStyle: {
position: 'absolute',
left: 20,
right: 20,
bottom: Math.max(insets.bottom, 12),
height: 64,
paddingTop: 10,
paddingBottom: 10,
borderRadius: 32,
borderTopWidth: 0,
backgroundColor: colors.ink,
shadowColor: '#000',
shadowOpacity: 0.2,
shadowRadius: 20,
shadowOffset: { width: 0, height: 10 },
elevation: 10,
},
tabBarItemStyle: { height: 44 },
}}
>
<Tabs.Screen name="index" options={tab('Home', 'home')} />
<Tabs.Screen name="booths" options={tab('Booths', 'store')} />
<Tabs.Screen name="scan" options={tab('Scan', 'scan')} />
<Tabs.Screen name="map" options={tab('Venue map', 'map')} />
<Tabs.Screen
name="scan"
options={{
title: 'Scan',
tabBarButton: ({ onPress, accessibilityState }) => (
<Pressable
onPress={onPress}
accessibilityRole="button"
accessibilityLabel="Scan a QR code"
accessibilityState={accessibilityState}
style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}
>
{({ pressed }) => (
<View
style={{
width: 58,
height: 58,
marginTop: -26,
borderRadius: 29,
borderWidth: 4,
borderColor: colors.ink,
backgroundColor: pressed ? colors.secondary : colors.primary,
alignItems: 'center',
justifyContent: 'center',
transform: [{ scale: pressed ? 0.94 : 1 }],
}}
>
<Icon name="scan" color={colors.white} size={26} />
</View>
)}
</Pressable>
),
}}
/>
<Tabs.Screen name="investees" options={tab('Investees', 'rocket')} />
<Tabs.Screen name="me" options={tab('Me', 'user')} />
</Tabs>

View File

@ -1,68 +0,0 @@
import { Text, View } from 'react-native';
import { Card, CheckDot, ErrorBox, H1, Loading, P, Row, Screen, s } from '../../components/ui';
import { useCheckpoints } from '../../lib/api';
import { colors, fonts } from '../../lib/theme';
export default function Booths() {
const q = useCheckpoints('BOOTH');
const list = q.data ?? [];
const found = list.filter((c) => c.scanned).length;
return (
<Screen onRefresh={() => void q.refetch()} refreshing={q.isRefetching}>
<H1>Booths</H1>
<P muted>Visit exhibitor and partner booths and scan their QR to check them off.</P>
{q.isPending ? (
<Loading />
) : q.error ? (
<ErrorBox error={q.error} onRetry={() => void q.refetch()} />
) : (
<>
<Text style={[s.num, { fontSize: 16 }]}>
{found} of {list.length} visited
</Text>
<Card style={{ paddingVertical: 4 }}>
{list.length === 0 && (
<P muted style={{ paddingVertical: 12 }}>
Booths will appear here soon.
</P>
)}
{list.map((c, i) => (
<Row
key={c.id}
style={
i > 0 ? { borderTopWidth: 1, borderTopColor: colors.surfaceMuted } : undefined
}
>
<CheckDot done={!!c.scanned} />
<View style={{ flex: 1 }}>
<Text style={{ fontFamily: fonts.semibold, fontSize: 16, color: colors.ink }}>
{c.organisation ?? c.label}
</Text>
{(c.boothNumber || (c.organisation && c.label !== c.organisation)) && (
<P muted style={{ fontSize: 13 }}>
{[
c.boothNumber && `Booth ${c.boothNumber}`,
c.organisation && c.label !== c.organisation && c.label,
]
.filter(Boolean)
.join(' · ')}
</P>
)}
</View>
<Text
style={{
fontFamily: fonts.semibold,
color: c.scanned ? colors.primary : colors.grey2,
}}
>
+{c.points}
</Text>
</Row>
))}
</Card>
</>
)}
</Screen>
);
}

View File

@ -1,21 +1,76 @@
import { router } from 'expo-router';
import { Image, Pressable, Text, View } from 'react-native';
import { Image, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
import {
Button,
Card,
DateBlock,
ErrorBox,
Gem,
H1,
H2,
Icon,
Loading,
Medal,
P,
PatternHeader,
Screen,
s,
type IconName,
} from '../../components/ui';
import { useMe, useRaffles } from '../../lib/api';
import { useMe, useRaffles, type Me } from '../../lib/api';
import { badges, earnedBadges, event, nextTier, tierAt } from '../../lib/content';
import { colors, fonts } from '../../lib/theme';
function PointsCard({ m }: { m: Me }) {
const cur = tierAt(m.points);
const next = nextTier(m.points);
const from = cur?.points ?? 0;
const pct = next ? (m.points - from) / (next.points - from) : 1;
return (
<View style={st.points}>
<Image
source={require('../../../assets/pattern.png')}
style={st.pattern}
resizeMode="cover"
/>
<View style={{ flexDirection: 'row', alignItems: 'flex-start' }}>
<View style={{ flex: 1 }}>
<Text style={[s.label, { color: colors.secondary }]}>Your points</Text>
<Text style={[s.num, { fontSize: 56, lineHeight: 64, color: colors.white }]}>
{m.points}
</Text>
</View>
<Pressable
onPress={() => router.push('/leaderboard')}
accessibilityRole="button"
accessibilityLabel="Leaderboard"
style={({ pressed }) => [st.rank, pressed && { opacity: 0.8 }]}
>
<Icon name="trophy" color={colors.ink} size={16} />
<Text style={[s.num, { fontSize: 15 }]}>{m.rank ? `#${m.rank}` : 'Unranked'}</Text>
</Pressable>
</View>
<Pressable
onPress={() => router.push('/achievements')}
accessibilityRole="button"
accessibilityLabel="Achievements"
style={st.tierRow}
>
<Gem tone={(cur ?? next)!.tone} locked={!cur} size={30} />
<View style={{ flex: 1, gap: 6 }}>
<Text style={{ fontFamily: fonts.semibold, color: colors.white, fontSize: 14 }}>
{cur ? cur.name : 'No tier yet'}
<Text style={{ fontFamily: fonts.regular, color: colors.secondary }}>
{next ? ` · ${next.points - m.points} pts to ${next.name}` : ' · top tier'}
</Text>
</Text>
<View style={st.track}>
<View style={[st.fill, { width: `${Math.round(pct * 100)}%` }]} />
</View>
</View>
<Icon name="chevron" color={colors.secondary} size={18} />
</Pressable>
</View>
);
}
function Progress({
label,
found,
@ -31,36 +86,23 @@ function Progress({
}) {
const pct = total ? Math.min(1, found / total) : 0;
return (
<Pressable onPress={onPress} style={{ flex: 1 }}>
<Card style={{ gap: 10 }}>
<View
style={{
width: 40,
height: 40,
borderRadius: 12,
backgroundColor: colors.surfaceMuted,
alignItems: 'center',
justifyContent: 'center',
}}
>
<Icon name={icon} color={colors.primary} />
<Pressable
onPress={onPress}
style={({ pressed }) => [{ flex: 1 }, pressed && { opacity: 0.85 }]}
>
<View style={st.tile}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Text style={s.label}>{label}</Text>
<Icon name={icon} color={colors.primary} size={18} />
</View>
<Text style={s.label}>{label}</Text>
<Text style={[s.num, { fontSize: 24 }]}>
<Text style={[s.num, { fontSize: 32 }]}>
{found}
<Text style={{ color: colors.grey2, fontSize: 16 }}> / {total}</Text>
</Text>
<View style={{ height: 6, borderRadius: 3, backgroundColor: colors.surfaceMuted }}>
<View
style={{
height: 6,
borderRadius: 3,
width: `${pct * 100}%`,
backgroundColor: colors.primary,
}}
/>
<View style={[st.track, { backgroundColor: colors.surfaceMuted }]}>
<View style={[st.fill, { width: `${pct * 100}%`, backgroundColor: colors.primary }]} />
</View>
</Card>
</View>
</Pressable>
);
}
@ -70,44 +112,6 @@ export default function Home() {
const raffles = useRaffles();
const m = me.data;
const header = (
<PatternHeader>
<Image
source={require('../../../assets/logo-white.png')}
style={{ width: 150, height: 32, marginTop: 8 }}
resizeMode="contain"
/>
<P style={{ color: colors.secondary, marginTop: 20 }}>
{m?.user.name ? `Hi ${m.user.name.split(' ')[0]}` : 'Welcome to the GRV Summit'}
</P>
<View style={{ flexDirection: 'row', alignItems: 'flex-end', marginTop: 4, gap: 16 }}>
<Text style={[s.num, { fontSize: 56, color: colors.white, lineHeight: 62 }]}>
{m?.points ?? '–'}
</Text>
<Text
style={{
fontFamily: fonts.semibold,
color: colors.white,
fontSize: 16,
marginBottom: 12,
}}
>
points
</Text>
<View style={{ flex: 1 }} />
<Pressable
onPress={() => router.push('/leaderboard')}
style={{ alignItems: 'flex-end', marginBottom: 10 }}
>
<Text style={[s.label, { color: colors.secondary }]}>Rank</Text>
<Text style={[s.num, { color: colors.white, fontSize: 24 }]}>
{m?.rank ? `#${m.rank}` : '–'}
</Text>
</Pressable>
</View>
</PatternHeader>
);
const refresh = () => {
void me.refetch();
void raffles.refetch();
@ -117,9 +121,42 @@ export default function Home() {
const nextRaffle = raffles.data
?.filter((r) => !r.eligible && !r.drawnAt)
.sort((a, b) => a.minPoints - b.minPoints)[0];
const raffleLine = raffles.isPending
? 'Loading…'
: eligible
? `You're in ${eligible} draw${eligible > 1 ? 's' : ''}.`
: nextRaffle && m
? `${Math.max(0, nextRaffle.minPoints - m.points)} more points to enter.`
: 'Drawn at the end of the summit.';
const earned = m ? earnedBadges(m, raffles.data) : new Set<string>();
const first = m?.user.name?.split(' ')[0];
return (
<Screen header={header} onRefresh={refresh} refreshing={me.isRefetching}>
<Screen onRefresh={refresh} refreshing={me.isRefetching}>
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }}>
<Image
source={require('../../../assets/logo.png')}
style={{ width: 132, height: 28 }}
resizeMode="contain"
accessibilityLabel="GRV Summit"
/>
<Pressable
onPress={() => router.push('/me')}
accessibilityRole="button"
accessibilityLabel="Profile"
style={st.avatar}
>
<Text style={{ fontFamily: fonts.bold, color: colors.white, fontSize: 16 }}>
{(first ?? m?.user.email ?? '?').charAt(0).toUpperCase()}
</Text>
</Pressable>
</View>
<View style={{ marginTop: 6 }}>
<H1>{first ? `Hi ${first}` : 'Welcome'}</H1>
<P muted>Scan, explore and climb the Rift.</P>
</View>
{me.isPending ? (
<Loading />
) : me.error ? (
@ -127,14 +164,91 @@ export default function Home() {
) : (
m && (
<>
<Button title="Scan a QR code" onPress={() => router.push('/scan')} />
<View style={{ flexDirection: 'row', gap: 12 }}>
<PointsCard m={m} />
{/* Event card */}
<View style={st.tile}>
<View style={{ flexDirection: 'row', gap: 12, alignItems: 'center' }}>
<DateBlock month={event.month} day={event.days} />
<View style={{ flex: 1 }}>
<Text style={st.strong}>{event.short}</Text>
<P muted style={{ fontSize: 13 }}>
{event.dateLabel}
</P>
</View>
</View>
<Pressable
onPress={() => router.push('/map')}
style={{ flexDirection: 'row', gap: 12, alignItems: 'center' }}
>
<View style={st.iconBox}>
<Icon name="pin" size={18} color={colors.primary} />
</View>
<View style={{ flex: 1 }}>
<Text style={st.strong}>{event.venue}</Text>
<P muted style={{ fontSize: 13 }}>
{event.address}
</P>
</View>
<Text style={st.link}>Map</Text>
</Pressable>
<View style={st.divider} />
{event.program.map((p) => (
<Pressable
key={p.day}
onPress={() => router.push('/map')}
style={{ flexDirection: 'row', gap: 12, alignItems: 'center' }}
>
<Text style={[s.num, { width: 54, fontSize: 13, color: colors.primary }]}>
{p.date}
</Text>
<Text
style={{ flex: 1, fontFamily: fonts.medium, fontSize: 14, color: colors.ink }}
>
{p.title}
</Text>
<Icon name="chevron" size={16} color={colors.grey2} />
</Pressable>
))}
</View>
{/* Lead tile: the mystery investee is the game's headline. */}
<Pressable onPress={() => router.push('/investees')}>
{({ pressed }) => (
<View style={[st.tile, st.lead, pressed && { opacity: 0.9 }]}>
<Image
source={require('../../../assets/pattern.png')}
style={[st.pattern, { opacity: 0.12 }]}
resizeMode="cover"
/>
<Text style={[s.label, { color: colors.secondary }]}>
{m.progress.mysteryFound ? 'Found' : 'Mystery investee'}
</Text>
<View style={{ flexDirection: 'row', alignItems: 'flex-end', gap: 14 }}>
{m.progress.mysteryFound ? (
<View style={st.foundCheck}>
<Icon name="check" size={40} color={colors.ink} />
</View>
) : (
<Text style={st.leadBig}>×2</Text>
)}
<P style={{ flex: 1, color: colors.white, marginBottom: 8 }}>
{m.progress.mysteryFound
? 'You found our next investee and earned double points.'
: 'Our next investee is somewhere in the room with a hidden QR. Find them for double points.'}
</P>
</View>
</View>
)}
</Pressable>
<View style={st.grid}>
<Progress
label="Booths"
icon="store"
found={m.progress.booths.found}
total={m.progress.booths.total}
onPress={() => router.push('/booths')}
onPress={() => router.push('/map')}
/>
<Progress
label="Investees"
@ -145,75 +259,159 @@ export default function Home() {
/>
</View>
<Pressable onPress={() => router.push('/investees')}>
<Card
tone={m.progress.mysteryFound ? 'muted' : 'white'}
style={{ flexDirection: 'row', alignItems: 'center', gap: 14 }}
>
<View
style={{
width: 48,
height: 48,
borderRadius: 24,
backgroundColor: colors.primary,
alignItems: 'center',
justifyContent: 'center',
}}
{/* Badges strip */}
<View style={{ flexDirection: 'row', alignItems: 'center', marginTop: 4 }}>
<H2 style={{ flex: 1 }}>Badges</H2>
<Pressable onPress={() => router.push('/achievements')} hitSlop={8}>
<Text style={st.link}>See all</Text>
</Pressable>
</View>
<ScrollView
horizontal
showsHorizontalScrollIndicator={false}
style={{ marginHorizontal: -16, flexGrow: 0 }}
contentContainerStyle={{ gap: 10, paddingHorizontal: 16, alignItems: 'flex-start' }}
>
{badges.map((b) => (
<Pressable
key={b.id}
onPress={() => router.push('/achievements')}
style={[st.badge, !earned.has(b.id) && { backgroundColor: colors.whiteSoft }]}
>
{m.progress.mysteryFound ? (
<Icon name="check" color={colors.white} />
) : (
<Text style={[s.num, { color: colors.white, fontSize: 24 }]}>?</Text>
)}
</View>
<View style={{ flex: 1 }}>
<H2 style={{ fontSize: 17 }}>Mystery investee</H2>
<P muted style={{ fontSize: 14 }}>
{m.progress.mysteryFound
? 'Found! You earned double points.'
: 'One future investee is hiding in the crowd. Find them for double points.'}
</P>
</View>
</Card>
</Pressable>
<Medal tone={b.tone} icon={b.icon} locked={!earned.has(b.id)} size={52} />
<Text
style={[st.badgeName, !earned.has(b.id) && { color: colors.grey2 }]}
numberOfLines={1}
>
{b.name}
</Text>
</Pressable>
))}
</ScrollView>
<Pressable onPress={() => router.push('/raffles')}>
<Card style={{ flexDirection: 'row', alignItems: 'center', gap: 14 }}>
<Icon name="gift" color={colors.primary} size={28} />
<View style={{ flex: 1 }}>
<View style={st.grid}>
<Pressable style={{ flex: 1 }} onPress={() => router.push('/raffles')}>
<View style={[st.tile, st.muted]}>
<Icon name="gift" color={colors.primary} />
<H2 style={{ fontSize: 17 }}>Raffles</H2>
<P muted style={{ fontSize: 14 }}>
{raffles.isPending
? 'Loading…'
: eligible
? `You're in ${eligible} draw${eligible > 1 ? 's' : ''}.`
: nextRaffle
? `${Math.max(0, nextRaffle.minPoints - m.points)} more points to enter "${nextRaffle.name}".`
: 'Prizes are drawn at the end of the summit.'}
{eligible && nextRaffle
? ` ${nextRaffle.minPoints - m.points} more for "${nextRaffle.name}".`
: ''}
<P muted style={{ fontSize: 13, lineHeight: 18 }}>
{raffleLine}
</P>
</View>
<Icon name="chevron" color={colors.grey2} />
</Card>
</Pressable>
<Pressable onPress={() => router.push('/merch')}>
<Card style={{ flexDirection: 'row', alignItems: 'center', gap: 14 }}>
<Icon name="bag" color={colors.primary} size={28} />
<View style={{ flex: 1 }}>
<H2 style={{ fontSize: 17 }}>GRV merch</H2>
<P muted style={{ fontSize: 14 }}>
Order in the app, pay and collect at the GRV booth.
</Pressable>
<Pressable style={{ flex: 1 }} onPress={() => router.push('/merch')}>
<View style={[st.tile, st.muted]}>
<Icon name="bag" color={colors.primary} />
<H2 style={{ fontSize: 17 }}>Merch</H2>
<P muted style={{ fontSize: 13, lineHeight: 18 }}>
Order here, pay and collect at the GRV booth.
</P>
</View>
<Icon name="chevron" color={colors.grey2} />
</Card>
</Pressable>
</Pressable>
</View>
</>
)
)}
</Screen>
);
}
const st = StyleSheet.create({
grid: { flexDirection: 'row', gap: 12 },
tile: {
gap: 12,
padding: 16,
borderRadius: 24,
backgroundColor: colors.white,
borderWidth: 1,
borderColor: 'rgba(48,97,76,0.10)',
},
muted: { backgroundColor: colors.surfaceMuted, borderColor: 'transparent', gap: 6 },
points: {
backgroundColor: colors.primary,
borderRadius: 28,
padding: 20,
gap: 16,
overflow: 'hidden',
},
pattern: { ...StyleSheet.absoluteFill, width: '100%', height: '100%', opacity: 0.18 },
rank: {
flexDirection: 'row',
alignItems: 'center',
gap: 6,
backgroundColor: colors.secondary,
borderRadius: 999,
paddingHorizontal: 12,
paddingVertical: 8,
},
tierRow: {
flexDirection: 'row',
alignItems: 'center',
gap: 12,
backgroundColor: 'rgba(26,64,52,0.45)',
borderRadius: 18,
padding: 12,
},
track: {
height: 6,
borderRadius: 3,
backgroundColor: 'rgba(255,255,255,0.2)',
overflow: 'hidden',
},
fill: { height: 6, borderRadius: 3, backgroundColor: colors.secondary },
lead: {
backgroundColor: colors.ink,
borderColor: colors.ink,
overflow: 'hidden',
minHeight: 160,
justifyContent: 'space-between',
padding: 20,
},
leadBig: {
fontFamily: fonts.bold,
fontSize: 64,
lineHeight: 70,
color: colors.secondary,
fontVariant: ['tabular-nums'],
},
foundCheck: {
width: 64,
height: 64,
borderRadius: 32,
backgroundColor: colors.secondary,
alignItems: 'center',
justifyContent: 'center',
marginBottom: 6,
},
avatar: {
width: 40,
height: 40,
borderRadius: 20,
backgroundColor: colors.primary,
alignItems: 'center',
justifyContent: 'center',
},
iconBox: {
width: 48,
height: 48,
borderRadius: 12,
borderWidth: 1,
borderColor: 'rgba(48,97,76,0.18)',
alignItems: 'center',
justifyContent: 'center',
},
strong: { fontFamily: fonts.semibold, fontSize: 16, color: colors.ink },
link: { fontFamily: fonts.semibold, fontSize: 14, color: colors.primary },
divider: { height: 1, backgroundColor: colors.surfaceMuted },
badge: {
width: 104,
alignItems: 'center',
gap: 6,
paddingVertical: 12,
borderRadius: 20,
backgroundColor: colors.white,
borderWidth: 1,
borderColor: 'rgba(48,97,76,0.10)',
},
badgeName: { fontFamily: fonts.semibold, fontSize: 12, color: colors.ink },
});

311
src/app/(tabs)/map.tsx Normal file
View File

@ -0,0 +1,311 @@
import { useMemo, useRef, useState } from 'react';
import {
Linking,
Pressable,
ScrollView,
StyleSheet,
Text,
View,
type ScrollViewInstance,
} from 'react-native';
import Svg, { G, Rect, Text as SvgText } from 'react-native-svg';
import {
Card,
CheckDot,
ErrorBox,
H1,
H2,
Icon,
Loading,
P,
Pill,
Row,
Screen,
s,
} from '../../components/ui';
import { useCheckpoints } from '../../lib/api';
import { event, zoneForBooth, zones, type Zone, type ZoneKind } from '../../lib/content';
import { colors, fonts } from '../../lib/theme';
const FILL: Record<ZoneKind, { bg: string; fg: string }> = {
stage: { bg: colors.primary, fg: colors.white },
booths: { bg: colors.secondary, fg: colors.ink },
startups: { bg: '#d9ebe1', fg: colors.ink },
food: { bg: '#f3e6c9', fg: colors.ink },
help: { bg: colors.white, fg: colors.ink },
grv: { bg: colors.ink, fg: colors.secondary },
};
const FILTERS: { kind: ZoneKind | 'all'; label: string }[] = [
{ kind: 'all', label: 'Everything' },
{ kind: 'stage', label: 'Stages' },
{ kind: 'booths', label: 'Booths' },
{ kind: 'startups', label: 'Startups' },
{ kind: 'food', label: 'Food' },
{ kind: 'help', label: 'Help' },
{ kind: 'grv', label: 'GRV booth' },
];
/** Placeholder floor plan drawn from `zones` (src/lib/content.ts); tap targets sit on top. */
function FloorPlan({
selected,
filter,
onSelect,
}: {
selected: string | null;
filter: ZoneKind | 'all';
onSelect: (z: Zone) => void;
}) {
const dimmed = (z: Zone) =>
(selected && selected !== z.id) || (filter !== 'all' && z.kind !== filter);
return (
<View style={styles.plan}>
<View style={{ flex: 1 }}>
<Svg width="100%" height="100%" viewBox="0 0 100 128">
{zones.map((z) => {
const [x, y, w, h] = z.rect;
const f = FILL[z.kind];
const on = selected === z.id;
const words = z.name.split(' ');
const lines =
w < 32 && words.length > 1 ? [words[0]!, words.slice(1).join(' ')] : [z.name];
return (
<G key={z.id} opacity={dimmed(z) ? 0.3 : 1}>
<Rect
x={x}
y={y}
width={w}
height={h}
rx={3}
fill={f.bg}
stroke={on ? colors.ink : 'rgba(26,64,52,0.18)'}
strokeWidth={on ? 1.2 : 0.4}
/>
{lines.map((line, i) => (
<SvgText
key={line}
x={x + w / 2}
y={y + h / 2 + (i - (lines.length - 1) / 2) * 4.4 + 1.3}
fill={f.fg}
fontSize={w < 32 ? 3.4 : 3.9}
fontFamily={fonts.bold}
fontWeight="700"
textAnchor="middle"
>
{line}
</SvgText>
))}
</G>
);
})}
{/* entrance doors */}
<Rect x={58} y={121} width={18} height={2.2} rx={1} fill={colors.primary} />
<SvgText
x={67}
y={127.4}
fill={colors.primary}
fontSize={2.6}
fontFamily={fonts.bold}
textAnchor="middle"
>
DOORS
</SvgText>
</Svg>
{zones.map((z) => {
const [x, y, w, h] = z.rect;
return (
<Pressable
key={z.id}
accessibilityRole="button"
accessibilityLabel={z.name}
accessibilityState={{ selected: selected === z.id }}
onPress={() => onSelect(z)}
style={{
position: 'absolute',
left: `${x}%`,
top: `${(y / 128) * 100}%`,
width: `${w}%`,
height: `${(h / 128) * 100}%`,
borderRadius: 10,
}}
/>
);
})}
</View>
</View>
);
}
export default function VenueMap() {
const q = useCheckpoints('BOOTH');
const scroll = useRef<ScrollViewInstance>(null);
const [selected, setSelected] = useState<string | null>(null);
const [filter, setFilter] = useState<ZoneKind | 'all'>('all');
const zone = zones.find((z) => z.id === selected) ?? null;
const list = q.data ?? [];
const found = list.filter((c) => c.scanned).length;
const boothsInZone = useMemo(
() => (zone ? list.filter((c) => zoneForBooth(c.boothNumber).id === zone.id) : []),
[zone, list],
);
return (
<Screen scrollRef={scroll} onRefresh={() => void q.refetch()} refreshing={q.isRefetching}>
<H1>Venue map</H1>
<Pressable
onPress={() => void Linking.openURL(event.mapsUrl)}
style={{ flexDirection: 'row', alignItems: 'center', gap: 10 }}
>
<View style={styles.pinBox}>
<Icon name="pin" size={18} color={colors.primary} />
</View>
<View style={{ flex: 1 }}>
<Text style={styles.strong}>{event.venue}</Text>
<P muted style={{ fontSize: 13 }}>
{event.address} · Directions
</P>
</View>
</Pressable>
<ScrollView
horizontal
showsHorizontalScrollIndicator={false}
contentContainerStyle={{ gap: 8, paddingVertical: 4 }}
style={{ marginHorizontal: -16 }}
>
<View style={{ width: 8 }} />
{FILTERS.map((f) => (
<Pressable
key={f.kind}
onPress={() => {
setFilter(f.kind);
setSelected(null);
}}
style={[s.chip, filter === f.kind && s.chipOn]}
>
<Text style={{ fontFamily: fonts.semibold, fontSize: 13, color: colors.ink }}>
{f.label}
</Text>
</Pressable>
))}
<View style={{ width: 8 }} />
</ScrollView>
<FloorPlan
selected={selected}
filter={filter}
onSelect={(z) => setSelected((cur) => (cur === z.id ? null : z.id))}
/>
{zone ? (
<Card style={{ gap: 8 }}>
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 10 }}>
<View style={[styles.swatch, { backgroundColor: FILL[zone.kind].bg }]} />
<H2 style={{ flex: 1 }}>{zone.name}</H2>
<Pressable onPress={() => setSelected(null)} hitSlop={10} accessibilityLabel="Close">
<Icon name="close" size={18} color={colors.grey1} />
</Pressable>
</View>
{zone.details.map((d) => (
<View key={d} style={{ flexDirection: 'row', gap: 8 }}>
<Text style={{ color: colors.primary }}>•</Text>
<P style={{ flex: 1, fontSize: 14 }}>{d}</P>
</View>
))}
{boothsInZone.length > 0 && (
<View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 6, marginTop: 4 }}>
{boothsInZone.map((c) => (
<Pill key={c.id} tone={c.scanned ? 'green' : 'muted'}>
{`${c.boothNumber ?? ''} ${c.organisation ?? c.label}`.trim()}
</Pill>
))}
</View>
)}
</Card>
) : (
<P muted style={{ fontSize: 13, textAlign: 'center' }}>
Tap an area to see what's there.
</P>
)}
<View style={{ flexDirection: 'row', alignItems: 'baseline', marginTop: 8 }}>
<H2 style={{ flex: 1 }}>Booths</H2>
<Text style={[s.num, { fontSize: 14, color: colors.grey1 }]}>
{found} of {list.length} visited
</Text>
</View>
{q.isPending ? (
<Loading />
) : q.error ? (
<ErrorBox error={q.error} onRetry={() => void q.refetch()} />
) : (
<Card style={{ paddingVertical: 4 }}>
{list.length === 0 && (
<P muted style={{ paddingVertical: 12 }}>
Booths will appear here soon.
</P>
)}
{list.map((c, i) => (
<Row
key={c.id}
onPress={() => {
setFilter('all');
setSelected(zoneForBooth(c.boothNumber).id);
scroll.current?.scrollTo({ y: 0, animated: true });
}}
style={i > 0 ? { borderTopWidth: 1, borderTopColor: colors.surfaceMuted } : undefined}
>
<CheckDot done={!!c.scanned} />
<View style={{ flex: 1 }}>
<Text style={styles.strong}>{c.organisation ?? c.label}</Text>
<P muted style={{ fontSize: 13 }}>
{[c.boothNumber && `Booth ${c.boothNumber}`, zoneForBooth(c.boothNumber).name]
.filter(Boolean)
.join(' · ')}
</P>
</View>
<Text
style={{
fontFamily: fonts.semibold,
color: c.scanned ? colors.primary : colors.grey2,
}}
>
+{c.points}
</Text>
</Row>
))}
</Card>
)}
</Screen>
);
}
const styles = StyleSheet.create({
plan: {
aspectRatio: 100 / 128,
backgroundColor: colors.white,
borderRadius: 24,
padding: 10,
borderWidth: 1,
borderColor: 'rgba(48,97,76,0.10)',
},
pinBox: {
width: 40,
height: 40,
borderRadius: 12,
backgroundColor: colors.white,
borderWidth: 1,
borderColor: 'rgba(48,97,76,0.12)',
alignItems: 'center',
justifyContent: 'center',
},
strong: { fontFamily: fonts.semibold, fontSize: 16, color: colors.ink },
swatch: {
width: 14,
height: 14,
borderRadius: 4,
borderWidth: 1,
borderColor: 'rgba(0,0,0,0.1)',
},
});

View File

@ -1,49 +1,174 @@
import { router } from 'expo-router';
import { Text, View } from 'react-native';
import { useState } from 'react';
import {
Image,
Pressable,
ScrollView,
StyleSheet,
Text,
useWindowDimensions,
View,
} from 'react-native';
import QRCode from 'react-native-qrcode-svg';
import { OrderCard } from '../../components/OrderCard';
import {
Card,
ErrorBox,
Gem,
H1,
H2,
Icon,
Loading,
P,
Pill,
Row,
Screen,
type IconName,
} from '../../components/ui';
import { signOut, useMe } from '../../lib/api';
import { signOut, useMe, type Ticket } from '../../lib/api';
import { event, tierAt } from '../../lib/content';
import { colors, fonts } from '../../lib/theme';
function Link({
icon,
title,
to,
accent,
}: {
icon: IconName;
title: string;
to: '/leaderboard' | '/raffles' | '/merch';
to: '/leaderboard' | '/raffles' | '/merch' | '/achievements';
accent?: boolean;
}) {
return (
<Row onPress={() => router.push(to)}>
<Icon name={icon} color={colors.primary} />
<Text style={{ flex: 1, fontFamily: fonts.semibold, fontSize: 16, color: colors.ink }}>
{title}
</Text>
<View style={[styles.linkIcon, accent && { backgroundColor: colors.primary }]}>
<Icon name={icon} color={accent ? colors.white : colors.primary} size={18} />
</View>
<Text style={styles.linkText}>{title}</Text>
<Icon name="chevron" color={colors.grey2} />
</Row>
);
}
/** Perforated line with half-circle notches cut from both edges. */
function Perforation() {
return (
<View style={{ height: 24, justifyContent: 'center' }}>
<View style={[styles.notch, { left: -30 }]} />
<View style={styles.dashes} />
<View style={[styles.notch, { right: -30 }]} />
</View>
);
}
function Field({ label, value, right }: { label: string; value: string; right?: boolean }) {
return (
<View style={{ flex: 1, alignItems: right ? 'flex-end' : 'flex-start' }}>
<Text style={styles.fieldLabel}>{label}</Text>
<Text style={styles.fieldValue} numberOfLines={1}>
{value}
</Text>
</View>
);
}
function TicketPass({ t, width }: { t: Ticket; width: number }) {
return (
<View style={[styles.pass, { width }]}>
<View style={styles.passTop}>
<Image
source={require('../../../assets/pattern.png')}
style={styles.pattern}
resizeMode="cover"
/>
<Image
source={require('../../../assets/logo-white.png')}
style={{ width: 120, height: 26 }}
resizeMode="contain"
/>
<Text style={styles.passTier}>{t.tierName}</Text>
<Pill tone={t.checkedInAt ? 'light' : 'dark'}>
{t.checkedInAt ? 'Checked in' : 'Valid · show at the entrance'}
</Pill>
</View>
<View style={{ paddingHorizontal: 18 }}>
<Perforation />
<View style={{ gap: 14 }}>
<View style={{ flexDirection: 'row' }}>
<Field label="Name" value={t.holderName ?? t.holderEmail} />
<Field label="Dates" value={event.shortDates} right />
</View>
<View style={{ flexDirection: 'row' }}>
<Field label="Venue" value={event.venue} />
<Field label="Code" value={t.qrToken.slice(-8).toUpperCase()} right />
</View>
</View>
<Perforation />
<View style={{ alignItems: 'center', paddingBottom: 18, gap: 8 }}>
<View style={styles.qr}>
<QRCode value={t.qrUrl} size={176} color={colors.ink} />
</View>
<Text style={styles.fieldLabel}>Scan at check-in</Text>
</View>
</View>
</View>
);
}
function Tickets({ tickets, email }: { tickets: Ticket[]; email: string }) {
const { width } = useWindowDimensions();
const w = Math.min(width, 520) - 32;
const [i, setI] = useState(0);
if (tickets.length === 0) {
return (
<View style={styles.emptyPass}>
<Icon name="ticket" size={28} color={colors.primary} />
<Text style={styles.linkText}>No ticket on this account</Text>
<P muted style={{ textAlign: 'center', fontSize: 14 }}>
Tickets bought with {email} show up here. Bought with another email? Sign in with that
one.
</P>
</View>
);
}
return (
<View style={{ gap: 10 }}>
<ScrollView
horizontal
pagingEnabled
snapToInterval={w + 12}
decelerationRate="fast"
showsHorizontalScrollIndicator={false}
contentContainerStyle={{ gap: 12 }}
onScroll={(e) => setI(Math.round(e.nativeEvent.contentOffset.x / (w + 12)))}
scrollEventThrottle={32}
>
{tickets.map((t) => (
<TicketPass key={t.id} t={t} width={w} />
))}
</ScrollView>
{tickets.length > 1 && (
<View style={{ flexDirection: 'row', justifyContent: 'center', gap: 6 }}>
{tickets.map((t, k) => (
<View
key={t.id}
style={[styles.dot, k === i && { width: 20, backgroundColor: colors.primary }]}
/>
))}
</View>
)}
</View>
);
}
export default function MeTab() {
const me = useMe();
const m = me.data;
const tier = m ? tierAt(m.points) : null;
return (
<Screen onRefresh={() => void me.refetch()} refreshing={me.isRefetching}>
<H1>Me</H1>
{me.isPending ? (
<Loading />
) : me.error ? (
@ -51,37 +176,49 @@ export default function MeTab() {
) : (
m && (
<>
<P muted>
{m.user.name ? `${m.user.name} · ` : ''}
{m.user.email}
</P>
<View style={{ alignItems: 'center', gap: 6, paddingTop: 8 }}>
<View style={styles.avatar}>
<Text style={{ fontFamily: fonts.bold, fontSize: 30, color: colors.white }}>
{(m.user.name ?? m.user.email).charAt(0).toUpperCase()}
</Text>
</View>
<H1 style={{ fontSize: 26 }}>{m.user.name ?? 'GRV attendee'}</H1>
<P muted style={{ fontSize: 14 }}>
{m.user.email}
</P>
{tier && (
<Pressable onPress={() => router.push('/achievements')}>
<Pill tone="light">
<Gem tone={tier.tone} size={16} />
<Text
style={{ fontFamily: fonts.semibold, fontSize: 12, color: colors.primary }}
>
{tier.name}
</Text>
</Pill>
</Pressable>
)}
</View>
<H2 style={{ marginTop: 8 }}>My tickets</H2>
{m.tickets.length === 0 ? (
<Card>
<P muted>
No tickets found for {m.user.email}. Sign in with the email you bought your ticket
with.
</P>
</Card>
) : (
m.tickets.map((t) => (
<Card key={t.id} style={{ alignItems: 'center', gap: 8 }}>
<Text style={{ fontFamily: fonts.bold, fontSize: 18, color: colors.ink }}>
{t.tierName}
</Text>
<P muted style={{ fontSize: 14 }}>
{t.holderName ?? t.holderEmail}
</P>
<View style={{ padding: 12, backgroundColor: colors.white, borderRadius: 12 }}>
<QRCode value={t.qrUrl} size={200} color={colors.ink} />
<View style={{ flexDirection: 'row', gap: 12 }}>
{[
{ label: 'Points', value: String(m.points), icon: 'spark' as const },
{ label: 'Rank', value: m.rank ? `#${m.rank}` : '–', icon: 'trophy' as const },
].map((x) => (
<Card key={x.label} style={{ flex: 1, gap: 4 }}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Text style={styles.fieldLabel}>{x.label}</Text>
<Icon name={x.icon} size={16} color={colors.primary} />
</View>
<P style={{ fontSize: 13, color: t.checkedInAt ? colors.primary : colors.grey1 }}>
{t.checkedInAt ? 'Checked in' : 'Show this at the entrance'}
</P>
<Text style={{ fontFamily: fonts.bold, fontSize: 28, color: colors.ink }}>
{x.value}
</Text>
</Card>
))
)}
))}
</View>
<H2 style={{ marginTop: 8 }}>My ticket</H2>
<Tickets tickets={m.tickets} email={m.user.email} />
{m.merchOrders.length > 0 && <H2 style={{ marginTop: 8 }}>Merch orders</H2>}
{m.merchOrders.map((o) => (
@ -89,26 +226,100 @@ export default function MeTab() {
))}
<Card style={{ paddingVertical: 4, marginTop: 8 }}>
<Link icon="medal" title="Achievements" to="/achievements" accent />
<Link icon="trophy" title="Leaderboard" to="/leaderboard" />
<Link icon="gift" title="Raffles" to="/raffles" />
<Link icon="bag" title="Order merch" to="/merch" />
<Row onPress={() => void signOut()}>
<Icon name="logout" color={colors.destructive} />
<Text
style={{
flex: 1,
fontFamily: fonts.semibold,
fontSize: 16,
color: colors.destructive,
}}
>
Sign out
</Text>
</Row>
</Card>
<Pressable onPress={() => void signOut()} style={styles.signOut}>
<Icon name="logout" color={colors.destructive} size={18} />
<Text style={{ fontFamily: fonts.semibold, fontSize: 15, color: colors.destructive }}>
Sign out
</Text>
</Pressable>
</>
)
)}
</Screen>
);
}
const styles = StyleSheet.create({
avatar: {
width: 76,
height: 76,
borderRadius: 38,
backgroundColor: colors.primary,
borderWidth: 4,
borderColor: colors.white,
alignItems: 'center',
justifyContent: 'center',
},
linkIcon: {
width: 36,
height: 36,
borderRadius: 18,
backgroundColor: colors.surfaceMuted,
alignItems: 'center',
justifyContent: 'center',
},
linkText: { flex: 1, fontFamily: fonts.semibold, fontSize: 16, color: colors.ink },
pass: {
backgroundColor: colors.white,
borderRadius: 24,
overflow: 'hidden',
borderWidth: 1,
borderColor: 'rgba(48,97,76,0.10)',
},
passTop: { backgroundColor: colors.primary, padding: 18, gap: 10, overflow: 'hidden' },
pattern: { ...StyleSheet.absoluteFill, width: '100%', height: '100%', opacity: 0.2 },
passTier: { fontFamily: fonts.bold, fontSize: 24, color: colors.white },
notch: {
position: 'absolute',
width: 24,
height: 24,
borderRadius: 12,
backgroundColor: colors.whiteSoft,
borderWidth: 1,
borderColor: 'rgba(48,97,76,0.10)',
},
dashes: {
borderTopWidth: 1.5,
borderStyle: 'dashed',
borderColor: colors.grey3,
marginHorizontal: 8,
},
fieldLabel: {
fontFamily: fonts.medium,
fontSize: 11,
letterSpacing: 0.8,
textTransform: 'uppercase',
color: colors.grey2,
},
fieldValue: { fontFamily: fonts.semibold, fontSize: 15, color: colors.ink, marginTop: 2 },
qr: {
padding: 12,
backgroundColor: colors.white,
borderRadius: 16,
borderWidth: 1,
borderColor: colors.surfaceMuted,
},
dot: { width: 6, height: 6, borderRadius: 3, backgroundColor: colors.grey3 },
emptyPass: {
alignItems: 'center',
gap: 8,
padding: 24,
borderRadius: 24,
borderWidth: 1.5,
borderStyle: 'dashed',
borderColor: colors.secondary,
backgroundColor: colors.white,
},
signOut: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
gap: 8,
paddingVertical: 14,
},
});

View File

@ -15,6 +15,7 @@ import {
import { StatusBar } from 'expo-status-bar';
import { useEffect } from 'react';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { CelebrationHost } from '../components/Celebrate';
import { bootSession, queryClient, useSession } from '../lib/api';
import { colors } from '../lib/theme';
@ -75,6 +76,7 @@ export default function RootLayout() {
/>
</Stack>
<AuthGate />
<CelebrationHost />
</QueryClientProvider>
</SafeAreaProvider>
);

211
src/app/achievements.tsx Normal file
View File

@ -0,0 +1,211 @@
import { router } from 'expo-router';
import { useEffect, useRef } from 'react';
import { Animated, Pressable, StyleSheet, Text, View } from 'react-native';
import { toast } from '../components/Celebrate';
import { BackBar, ErrorBox, Gem, H2, Loading, Medal, P, Pill, Screen, s } from '../components/ui';
import { useMe, useRaffles } from '../lib/api';
import { badges, earnedBadges, nextTier, tierAt, tiers } from '../lib/content';
import { colors, fonts } from '../lib/theme';
/** Gently bobbing hero gem. */
function Float({ children }: { children: React.ReactNode }) {
const t = useRef(new Animated.Value(0)).current;
useEffect(() => {
const loop = Animated.loop(
Animated.sequence([
Animated.timing(t, { toValue: 1, duration: 1400, useNativeDriver: true }),
Animated.timing(t, { toValue: 0, duration: 1400, useNativeDriver: true }),
]),
);
loop.start();
return () => loop.stop();
}, [t]);
return (
<Animated.View
style={{
transform: [{ translateY: t.interpolate({ inputRange: [0, 1], outputRange: [0, -8] }) }],
}}
>
{children}
</Animated.View>
);
}
export default function Achievements() {
const me = useMe();
const raffles = useRaffles();
const m = me.data;
return (
<Screen
bar={<BackBar title="Achievements" onBack={() => router.back()} />}
onRefresh={() => {
void me.refetch();
void raffles.refetch();
}}
refreshing={me.isRefetching}
>
{me.isPending ? (
<Loading />
) : me.error ? (
<ErrorBox error={me.error} onRetry={() => void me.refetch()} />
) : (
m && <Body points={m.points} earned={earnedBadges(m, raffles.data)} />
)}
</Screen>
);
}
function Body({ points, earned }: { points: number; earned: Set<string> }) {
const cur = tierAt(points);
const next = nextTier(points);
return (
<>
<View style={{ alignItems: 'center', gap: 6, paddingVertical: 8 }}>
<Float>
<Gem tone={(cur ?? tiers[0]!).tone} locked={!cur} size={96} />
</Float>
<P muted style={{ marginTop: 8 }}>
{cur ? 'Your latest achievement' : 'Your first achievement'}
</P>
<Text style={styles.heroName}>{(cur ?? tiers[0]!).name}</Text>
<Pill tone="light" style={{ alignSelf: 'center' }}>
{next
? `${points} pts · ${next.points - points} to ${next.name}`
: `${points} pts · top tier`}
</Pill>
</View>
{/* Tier timeline */}
<View style={styles.timeline}>
{tiers.map((t, i) => {
const reached = points >= t.points;
const isNext = next?.id === t.id;
const last = i === tiers.length - 1;
return (
<View
key={t.id}
style={{ flexDirection: 'row', gap: 14, opacity: reached || isNext ? 1 : 0.45 }}
>
<View style={{ alignItems: 'center', width: 34 }}>
<Gem tone={t.tone} locked={!reached} size={30} />
{!last && (
<View
style={[
styles.rail,
{
backgroundColor:
points >= tiers[i + 1]!.points ? colors.primary : colors.grey3,
},
]}
/>
)}
</View>
<View style={{ flex: 1, paddingBottom: last ? 0 : 22 }}>
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<Text style={styles.tierName}>{t.name}</Text>
<Text style={styles.tierPts}>{reached ? 'Unlocked' : `${t.points} pts`}</Text>
</View>
{isNext && (
<View style={styles.track}>
<View
style={[
styles.fill,
{
width: `${Math.round(
((points - (cur?.points ?? 0)) / (t.points - (cur?.points ?? 0))) * 100,
)}%`,
},
]}
/>
</View>
)}
{t.hints.map((h) => (
<Text key={h} style={styles.hint}>
{h}
</Text>
))}
</View>
</View>
);
})}
</View>
<View style={{ flexDirection: 'row', alignItems: 'baseline', marginTop: 8 }}>
<H2 style={{ flex: 1 }}>Badges</H2>
<Text style={[s.num, { fontSize: 14, color: colors.grey1 }]}>
{earned.size} of {badges.length}
</Text>
</View>
<View style={styles.grid}>
{badges.map((b) => {
const got = earned.has(b.id);
return (
<Pressable
key={b.id}
accessibilityRole="button"
accessibilityLabel={`${b.name}, ${got ? 'earned' : 'locked'}. ${b.hint}`}
style={({ pressed }) => [
styles.badge,
!got && { backgroundColor: colors.whiteSoft },
pressed && { transform: [{ scale: 0.96 }] },
]}
onPress={() =>
toast(got ? `${b.name}: earned` : `${b.name}: locked`, {
body: b.hint,
icon: 'medal',
tone: got ? 'gold' : 'dark',
})
}
>
<Medal tone={b.tone} icon={b.icon} locked={!got} size={60} />
<Text style={[styles.badgeName, !got && { color: colors.grey2 }]}>{b.name}</Text>
<Text style={styles.badgeHint} numberOfLines={2}>
{b.hint}
</Text>
</Pressable>
);
})}
</View>
</>
);
}
const styles = StyleSheet.create({
heroName: { fontFamily: fonts.display, fontSize: 30, color: colors.ink, marginBottom: 6 },
timeline: {
backgroundColor: colors.white,
borderRadius: 24,
padding: 18,
borderWidth: 1,
borderColor: 'rgba(48,97,76,0.10)',
},
rail: { width: 2, flex: 1, marginVertical: 4, borderRadius: 1 },
tierName: { flex: 1, fontFamily: fonts.bold, fontSize: 16, color: colors.ink },
tierPts: { fontFamily: fonts.medium, fontSize: 12, color: colors.grey1 },
hint: { fontFamily: fonts.regular, fontSize: 14, color: colors.grey1, marginTop: 6 },
track: {
height: 6,
borderRadius: 3,
backgroundColor: colors.surfaceMuted,
overflow: 'hidden',
marginTop: 8,
},
fill: { height: 6, borderRadius: 3, backgroundColor: colors.primary },
grid: { flexDirection: 'row', flexWrap: 'wrap', gap: 10 },
badge: {
width: '31.5%',
flexGrow: 1,
alignItems: 'center',
gap: 4,
paddingVertical: 14,
paddingHorizontal: 8,
borderRadius: 20,
backgroundColor: colors.white,
borderWidth: 1,
borderColor: 'rgba(48,97,76,0.10)',
},
badgeName: { fontFamily: fonts.bold, fontSize: 13, color: colors.ink, textAlign: 'center' },
badgeHint: { fontFamily: fonts.regular, fontSize: 11, color: colors.grey1, textAlign: 'center' },
});

View File

@ -1,6 +1,7 @@
import { router } from 'expo-router';
import { Text, View } from 'react-native';
import { BackBar, Card, ErrorBox, Loading, P, Row, Screen, s } from '../components/ui';
import { StyleSheet, Text, View } from 'react-native';
import { BackBar, Card, ErrorBox, Gem, Loading, P, Row, Screen, s } from '../components/ui';
import type { LeaderRow } from '../lib/api';
import { useLeaderboard, useMe } from '../lib/api';
import { colors, fonts } from '../lib/theme';
@ -20,47 +21,50 @@ export default function Leaderboard() {
) : q.error ? (
<ErrorBox error={q.error} onRetry={() => void q.refetch()} />
) : (
<Card style={{ paddingVertical: 4 }}>
{q.data.length === 0 && (
<P muted style={{ paddingVertical: 12 }}>
No points yet. Be the first to scan.
</P>
)}
{q.data.map((r, i) => (
<Row
key={`${r.rank}-${r.name}-${i}`}
style={[
i > 0 && { borderTopWidth: 1, borderTopColor: colors.surfaceMuted },
r.me && {
backgroundColor: colors.surfaceMuted,
marginHorizontal: -16,
paddingHorizontal: 16,
},
]}
>
<Text
<>
{q.data.length >= 3 && <Podium rows={q.data.slice(0, 3)} />}
<Card style={{ paddingVertical: 4 }}>
{q.data.length === 0 && (
<P muted style={{ paddingVertical: 12 }}>
No points yet. Be the first to scan.
</P>
)}
{q.data.slice(q.data.length >= 3 ? 3 : 0).map((r, i) => (
<Row
key={`${r.rank}-${r.name}-${i}`}
style={[
s.num,
{ width: 36, fontSize: 16, color: r.rank <= 3 ? colors.primary : colors.grey1 },
i > 0 && { borderTopWidth: 1, borderTopColor: colors.surfaceMuted },
r.me && {
backgroundColor: colors.surfaceMuted,
marginHorizontal: -16,
paddingHorizontal: 16,
},
]}
>
#{r.rank}
</Text>
<Text
style={{
flex: 1,
fontFamily: r.me ? fonts.bold : fonts.medium,
fontSize: 16,
color: colors.ink,
}}
>
{r.name}
{r.me ? ' (you)' : ''}
</Text>
<Text style={[s.num, { fontSize: 16 }]}>{r.points}</Text>
</Row>
))}
</Card>
<Text
style={[
s.num,
{ width: 36, fontSize: 16, color: r.rank <= 3 ? colors.primary : colors.grey1 },
]}
>
#{r.rank}
</Text>
<Text
style={{
flex: 1,
fontFamily: r.me ? fonts.bold : fonts.medium,
fontSize: 16,
color: colors.ink,
}}
>
{r.name}
{r.me ? ' (you)' : ''}
</Text>
<Text style={[s.num, { fontSize: 16 }]}>{r.points}</Text>
</Row>
))}
</Card>
</>
)}
{q.data && !meInTop && me.data && (
<Card tone="muted" style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
@ -73,3 +77,51 @@ export default function Leaderboard() {
</Screen>
);
}
const MEDALS = ['gold', 'silver', 'bronze'] as const;
/** Top three on steps: 2nd, 1st, 3rd. */
function Podium({ rows }: { rows: LeaderRow[] }) {
const order = [1, 0, 2];
return (
<View style={pod.wrap}>
{order.map((i) => {
const r = rows[i]!;
return (
<View key={i} style={{ flex: 1, alignItems: 'center', gap: 6 }}>
<Gem tone={MEDALS[i]!} size={i === 0 ? 44 : 34} />
<Text style={[pod.name, r.me && { color: colors.primary }]} numberOfLines={1}>
{r.me ? 'You' : r.name}
</Text>
<Text style={[s.num, { fontSize: 13, color: colors.grey1 }]}>{r.points} pts</Text>
<View
style={[
pod.step,
{
height: [96, 72, 56][i],
backgroundColor: i === 0 ? colors.primary : colors.secondary,
},
]}
>
<Text style={[s.num, { fontSize: 22, color: i === 0 ? colors.white : colors.ink }]}>
{i + 1}
</Text>
</View>
</View>
);
})}
</View>
);
}
const pod = StyleSheet.create({
wrap: { flexDirection: 'row', alignItems: 'flex-end', gap: 8, paddingTop: 8 },
name: { fontFamily: fonts.bold, fontSize: 14, color: colors.ink, maxWidth: '100%' },
step: {
alignSelf: 'stretch',
borderTopLeftRadius: 16,
borderTopRightRadius: 16,
alignItems: 'center',
paddingTop: 10,
},
});

View File

@ -10,6 +10,7 @@ import {
View,
} from 'react-native';
import { Button, Card, H1, P, PatternHeader, s } from '../components/ui';
import { toast } from '../components/Celebrate';
import { api, ApiError, signIn, type User } from '../lib/api';
import { colors, fonts } from '../lib/theme';
@ -55,13 +56,22 @@ export default function Login() {
body: { email: email.trim().toLowerCase(), code },
});
await signIn(res.accessToken);
if (res.user.name) done();
else setStep('name');
if (res.user.name) {
toast(`Welcome back, ${res.user.name.split(' ')[0]}`, {
body: 'Ready to climb the Rift?',
icon: 'spark',
});
done();
} else setStep('name');
});
const saveName = () =>
run(async () => {
await api('/me', { method: 'PATCH', body: { name: name.trim() } });
toast(`Welcome, ${name.trim().split(' ')[0]}!`, {
body: 'Scan booth and investee QR codes to earn points.',
icon: 'spark',
});
done();
});

View File

@ -3,6 +3,7 @@ import { useState } from 'react';
import { Image, Pressable, Text, View } from 'react-native';
import { OrderCard } from '../components/OrderCard';
import { BackBar, Button, Card, ErrorBox, H1, Loading, P, Screen, s } from '../components/ui';
import { toast } from '../components/Celebrate';
import { api, formatMoney, invalidateAll, useMerch, type Order } from '../lib/api';
import { colors, fonts, radius } from '../lib/theme';
@ -37,6 +38,7 @@ export default function Merch() {
});
setOrder(o);
setPicks({});
toast(`Order ${o.number} placed`, { body: 'Pay and collect at the GRV booth.', icon: 'bag' });
void invalidateAll();
} catch (e) {
setError((e as Error).message);

View File

@ -3,8 +3,19 @@ import { router, useLocalSearchParams } from 'expo-router';
import { useEffect, useRef, useState } from 'react';
import { ActivityIndicator, Animated, Image, StyleSheet, Text, View } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { Button, Icon, P, s } from '../../components/ui';
import { api, ApiError, invalidateAll, type Checkpoint, type ScanResult } from '../../lib/api';
import { announceProgress, Confetti } from '../../components/Celebrate';
import { Backdrop, Button, Gem, Icon, P, Pill, s } from '../../components/ui';
import {
api,
ApiError,
invalidateAll,
queryClient,
type Checkpoint,
type Me,
type Raffle,
type ScanResult,
} from '../../lib/api';
import { nextTier, tierAt } from '../../lib/content';
import { colors, fonts } from '../../lib/theme';
type State =
@ -24,6 +35,55 @@ const who = (c: Checkpoint) =>
.join(' · ')
: [c.personName, c.label, c.organisation].filter(Boolean).join(' · ');
/** Counts from 0 to `to` so points feel earned. */
function CountUp({ to, style }: { to: number; style: object }) {
const [n, setN] = useState(0);
useEffect(() => {
const start = Date.now();
const id = setInterval(() => {
const k = Math.min(1, (Date.now() - start) / 700);
setN(Math.round(to * (1 - (1 - k) ** 3)));
if (k === 1) clearInterval(id);
}, 16);
return () => clearInterval(id);
}, [to]);
return <Text style={style}>+{n}</Text>;
}
/** Progress toward the next tier after this scan. */
function TierProgress({ total }: { total: number }) {
const cur = tierAt(total);
const next = nextTier(total);
const from = cur?.points ?? 0;
const pct = next ? (total - from) / (next.points - from) : 1;
const w = useRef(new Animated.Value(0)).current;
useEffect(() => {
Animated.timing(w, { toValue: pct, duration: 900, delay: 300, useNativeDriver: false }).start();
}, [pct, w]);
return (
<View style={styles.tierCard}>
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 10 }}>
<Gem tone={(next ?? cur)!.tone} size={30} locked={!!next} />
<View style={{ flex: 1 }}>
<Text style={styles.tierName}>{next ? next.name : `${cur!.name}: top tier`}</Text>
<Text style={styles.tierSub}>
{next ? `${next.points - total} points to go` : 'You reached the summit'}
</Text>
</View>
<Text style={[s.num, { fontSize: 15 }]}>{total} pts</Text>
</View>
<View style={styles.track}>
<Animated.View
style={[
styles.fillBar,
{ width: w.interpolate({ inputRange: [0, 1], outputRange: ['0%', '100%'] }) },
]}
/>
</View>
</View>
);
}
/** Reached from the Scan tab and from grvsummit://q/<token> deep links (the site's /q page opens these). */
export default function ScanResultScreen() {
const { token } = useLocalSearchParams<{ token: string }>();
@ -34,14 +94,26 @@ export default function ScanResultScreen() {
useEffect(() => {
if (sent.current || !token) return;
sent.current = true; // one QR → one request, even under StrictMode double effects
const before = queryClient.getQueryData<Me>(['me']);
api<ScanResult>('/scan', { body: { token } })
.then((result) => {
.then(async (result) => {
setState({ kind: 'ok', result });
haptic(Haptics.NotificationFeedbackType.Success);
if (result.mystery)
void Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Heavy).catch(() => undefined);
Animated.spring(pop, { toValue: 1, friction: 4, useNativeDriver: true }).start();
void invalidateAll();
// fetchQuery (not getQueryData): a cold deep link has no cached /me yet.
const [after, raffles] = await Promise.all([
queryClient.fetchQuery({ queryKey: ['me'], queryFn: () => api<Me>('/me'), staleTime: 0 }),
queryClient
.fetchQuery({ queryKey: ['raffles'], queryFn: () => api<Raffle[]>('/raffles') })
.catch(() => [] as Raffle[]),
]);
setTimeout(
() => announceProgress(result.total - result.pointsAwarded, after, raffles, before),
900,
);
})
.catch((e: unknown) => {
if (e instanceof ApiError && e.status === 409) {
@ -66,14 +138,17 @@ export default function ScanResultScreen() {
if (state.kind === 'ok' && state.result.mystery) {
const { result } = state;
return (
<SafeAreaView style={[styles.fill, { backgroundColor: colors.primary }]}>
<SafeAreaView style={[styles.fill, { backgroundColor: colors.ink }]}>
<Image
source={require('../../../assets/pattern.png')}
style={[StyleSheet.absoluteFill, { width: '100%', height: '100%', opacity: 0.25 }]}
style={[StyleSheet.absoluteFill, { width: '100%', height: '100%', opacity: 0.2 }]}
resizeMode="cover"
/>
<Confetti count={60} />
<View style={styles.center}>
<Text style={[styles.kicker, { color: colors.secondary }]}>Mystery investee</Text>
<Pill tone="light" style={{ alignSelf: 'center' }}>
Mystery investee
</Pill>
<Text style={[styles.title, { color: colors.white }]}>You found our next investee</Text>
{result.checkpoint.organisation && (
<P style={{ color: colors.secondary, textAlign: 'center', fontSize: 17 }}>
@ -81,14 +156,17 @@ export default function ScanResultScreen() {
</P>
)}
<Animated.View
style={[styles.badge, { backgroundColor: colors.white, transform: [{ scale: pop }] }]}
style={[styles.badge, styles.mysteryBadge, { transform: [{ scale: pop }] }]}
>
<Text style={[s.num, { fontSize: 56, color: colors.primary }]}>
+{result.pointsAwarded}
<CountUp
to={result.pointsAwarded}
style={[s.num, { fontSize: 64, color: colors.ink }]}
/>
<Text style={{ fontFamily: fonts.bold, color: colors.ink, letterSpacing: 1.5 }}>
DOUBLE POINTS
</Text>
<Text style={{ fontFamily: fonts.bold, color: colors.primary }}>DOUBLE POINTS</Text>
</Animated.View>
<P style={{ color: colors.white }}>New total: {result.total} points</P>
<TierProgress total={result.total} />
</View>
<View style={styles.actions}>
<Button title="Done" variant="light" onPress={close} />
@ -99,35 +177,38 @@ export default function ScanResultScreen() {
return (
<SafeAreaView style={[styles.fill, { backgroundColor: colors.whiteSoft }]}>
<Backdrop height={420} />
{state.kind === 'ok' && <Confetti />}
<View style={styles.center}>
{state.kind === 'loading' && <ActivityIndicator size="large" color={colors.primary} />}
{state.kind === 'ok' && (
<>
<View style={[styles.circle, { backgroundColor: colors.primary }]}>
<Animated.View
style={[
styles.circle,
{ backgroundColor: colors.primary, transform: [{ scale: pop }] },
]}
>
<Icon name="check" color={colors.white} size={44} />
</View>
<Text style={styles.kicker}>
</Animated.View>
<Pill style={{ alignSelf: 'center' }}>
{state.result.checkpoint.kind === 'BOOTH' ? 'Booth checked in' : 'Investee found'}
</Text>
</Pill>
<Text style={[styles.title, { fontFamily: fonts.bold }]}>
{state.result.checkpoint.organisation ?? state.result.checkpoint.label}
</Text>
<P muted style={{ textAlign: 'center' }}>
{who(state.result.checkpoint)}
</P>
<Animated.View
style={[
styles.badge,
{ backgroundColor: colors.surfaceMuted, transform: [{ scale: pop }] },
]}
>
<Text style={[s.num, { fontSize: 44, color: colors.primary }]}>
+{state.result.pointsAwarded}
</Text>
<Animated.View style={[styles.badge, { transform: [{ scale: pop }] }]}>
<CountUp
to={state.result.pointsAwarded}
style={[s.num, { fontSize: 48, color: colors.primary }]}
/>
<Text style={{ fontFamily: fonts.semibold, color: colors.primary }}>points</Text>
</Animated.View>
<P>New total: {state.result.total} points</P>
<TierProgress total={state.result.total} />
</>
)}
@ -139,8 +220,8 @@ export default function ScanResultScreen() {
<Text style={styles.title}>Already scanned</Text>
<P muted style={{ textAlign: 'center' }}>
{state.checkpoint
? `You already collected points for ${who(state.checkpoint)}.`
: 'You already collected points for this code.'}
? `You already collected points for ${who(state.checkpoint)}. Find someone new!`
: 'You already collected points for this code. Find someone new!'}
</P>
</>
)}
@ -186,21 +267,31 @@ const styles = StyleSheet.create({
borderRadius: 44,
alignItems: 'center',
justifyContent: 'center',
marginBottom: 8,
},
kicker: {
fontFamily: fonts.semibold,
fontSize: 13,
letterSpacing: 1,
textTransform: 'uppercase',
color: colors.grey1,
marginBottom: 4,
},
title: { fontFamily: fonts.display, fontSize: 30, color: colors.ink, textAlign: 'center' },
badge: {
alignItems: 'center',
borderRadius: 24,
paddingHorizontal: 32,
paddingVertical: 16,
marginVertical: 8,
borderRadius: 28,
paddingHorizontal: 36,
paddingVertical: 14,
marginVertical: 4,
backgroundColor: colors.white,
borderWidth: 1,
borderColor: 'rgba(48,97,76,0.12)',
},
mysteryBadge: { backgroundColor: colors.secondary, borderColor: colors.secondary },
tierCard: {
alignSelf: 'stretch',
backgroundColor: colors.white,
borderRadius: 20,
padding: 14,
gap: 12,
borderWidth: 1,
borderColor: 'rgba(48,97,76,0.12)',
},
tierName: { fontFamily: fonts.bold, fontSize: 15, color: colors.ink },
tierSub: { fontFamily: fonts.regular, fontSize: 13, color: colors.grey1 },
track: { height: 8, borderRadius: 4, backgroundColor: colors.surfaceMuted, overflow: 'hidden' },
fillBar: { height: 8, borderRadius: 4, backgroundColor: colors.primary },
});

View File

@ -0,0 +1,323 @@
import * as Haptics from 'expo-haptics';
import { useEffect, useMemo, useRef, useSyncExternalStore } from 'react';
import {
Animated,
Dimensions,
Easing,
Modal,
Pressable,
StyleSheet,
Text,
View,
} from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { router } from 'expo-router';
import type { Me, Raffle } from '../lib/api';
import { badges, earnedBadges, tierAt, type MedalTone } from '../lib/content';
import { colors, fonts } from '../lib/theme';
import { Button, Gem, Icon, Medal, P, type IconName } from './ui';
// One tiny global store: any screen can fire a toast or a celebration; <CelebrationHost/> renders it.
type Toast = {
id: number;
title: string;
body?: string;
icon?: IconName;
tone?: 'green' | 'dark' | 'gold';
};
type Celebration = {
title: string;
body: string;
medal: { kind: 'gem' | 'badge'; tone: MedalTone; icon?: IconName };
action?: { label: string; onPress: () => void };
};
let state: { toast: Toast | null; celebration: Celebration | null } = {
toast: null,
celebration: null,
};
const listeners = new Set<() => void>();
const set = (next: Partial<typeof state>) => {
state = { ...state, ...next };
listeners.forEach((l) => l());
};
let seq = 0;
const buzz = (kind: 'light' | 'success') =>
void (
kind === 'success'
? Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success)
: Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light)
).catch(() => undefined);
export function toast(title: string, opts: Omit<Toast, 'id' | 'title'> = {}) {
buzz('light');
set({ toast: { id: ++seq, title, ...opts } });
}
export function celebrate(c: Celebration) {
buzz('success');
set({ celebration: c });
}
// ---------- Confetti ----------
const CONFETTI = [colors.primary, colors.secondary, '#f2b632', colors.ink, '#ffffff'];
/** Burst of falling paper; `count` pieces, plays once on mount. */
export function Confetti({ count = 36 }: { count?: number }) {
const { width, height } = Dimensions.get('window');
const pieces = useMemo(
() =>
Array.from({ length: count }, (_, i) => ({
x: Math.random() * width,
drift: (Math.random() - 0.5) * 120,
delay: Math.random() * 300,
duration: 1600 + Math.random() * 1000,
spin: 360 + Math.random() * 540,
w: 6 + Math.random() * 6,
round: i % 3 === 0,
color: CONFETTI[i % CONFETTI.length]!,
t: new Animated.Value(0),
})),
[count, width],
);
useEffect(() => {
Animated.parallel(
pieces.map((p) =>
Animated.timing(p.t, {
toValue: 1,
duration: p.duration,
delay: p.delay,
easing: Easing.out(Easing.quad),
useNativeDriver: true,
}),
),
).start();
}, [pieces]);
return (
<View pointerEvents="none" style={StyleSheet.absoluteFill}>
{pieces.map((p, i) => (
<Animated.View
key={i}
style={{
position: 'absolute',
left: p.x,
top: -20,
width: p.w,
height: p.round ? p.w : p.w * 1.8,
borderRadius: p.round ? p.w : 2,
backgroundColor: p.color,
opacity: p.t.interpolate({ inputRange: [0, 0.8, 1], outputRange: [1, 1, 0] }),
transform: [
{
translateY: p.t.interpolate({ inputRange: [0, 1], outputRange: [0, height * 0.9] }),
},
{ translateX: p.t.interpolate({ inputRange: [0, 1], outputRange: [0, p.drift] }) },
{
rotate: p.t.interpolate({
inputRange: [0, 1],
outputRange: ['0deg', `${p.spin}deg`],
}),
},
],
}}
/>
))}
</View>
);
}
// ---------- Host ----------
function ToastView({ t }: { t: Toast }) {
const insets = useSafeAreaInsets();
const y = useRef(new Animated.Value(-120)).current;
useEffect(() => {
Animated.spring(y, { toValue: 0, friction: 7, useNativeDriver: true }).start();
const hide = setTimeout(
() =>
Animated.timing(y, { toValue: -120, duration: 220, useNativeDriver: true }).start(() =>
set({ toast: null }),
),
2800,
);
return () => clearTimeout(hide);
}, [t.id, y]);
const bg = t.tone === 'dark' ? colors.ink : t.tone === 'gold' ? '#f2b632' : colors.primary;
const fg = t.tone === 'gold' ? colors.ink : colors.white;
return (
<Animated.View
pointerEvents="box-none"
style={[styles.toastWrap, { top: insets.top + 8, transform: [{ translateY: y }] }]}
>
<Pressable
onPress={() => set({ toast: null })}
style={[styles.toast, { backgroundColor: bg }]}
>
<View style={styles.toastIcon}>
<Icon name={t.icon ?? 'spark'} size={18} color={fg} />
</View>
<View style={{ flex: 1 }}>
<Text style={[styles.toastTitle, { color: fg }]}>{t.title}</Text>
{t.body && <Text style={[styles.toastBody, { color: fg }]}>{t.body}</Text>}
</View>
</Pressable>
</Animated.View>
);
}
function CelebrationView({ c }: { c: Celebration }) {
const pop = useRef(new Animated.Value(0)).current;
useEffect(() => {
pop.setValue(0);
Animated.spring(pop, { toValue: 1, friction: 4, tension: 60, useNativeDriver: true }).start();
}, [c, pop]);
const close = () => set({ celebration: null });
return (
<Modal transparent animationType="fade" onRequestClose={close}>
<View style={styles.scrim}>
<Confetti />
<View style={styles.sheet}>
<Animated.View
style={{
marginTop: -72,
transform: [
{ scale: pop },
{
rotate: pop.interpolate({ inputRange: [0, 1], outputRange: ['-25deg', '0deg'] }),
},
],
}}
>
<View style={styles.medalHalo}>
{c.medal.kind === 'gem' ? (
<Gem tone={c.medal.tone} size={84} />
) : (
<Medal tone={c.medal.tone} icon={c.medal.icon ?? 'spark'} size={96} />
)}
</View>
</Animated.View>
<Text style={styles.title}>{c.title}</Text>
<P muted style={{ textAlign: 'center' }}>
{c.body}
</P>
<View style={{ flexDirection: 'row', gap: 10, alignSelf: 'stretch', marginTop: 8 }}>
{c.action && (
<Button
title={c.action.label}
style={{ flex: 1 }}
onPress={() => {
close();
c.action!.onPress();
}}
/>
)}
<Button title="Close" variant="outline" style={{ flex: 1 }} onPress={close} />
</View>
</View>
</View>
</Modal>
);
}
export function CelebrationHost() {
const snap = useSyncExternalStore(
(l) => (listeners.add(l), () => listeners.delete(l)),
() => state,
);
return (
<>
{snap.celebration && <CelebrationView c={snap.celebration} />}
{snap.toast && <ToastView key={snap.toast.id} t={snap.toast} />}
</>
);
}
const styles = StyleSheet.create({
toastWrap: { position: 'absolute', left: 12, right: 12, zIndex: 100 },
toast: {
flexDirection: 'row',
alignItems: 'center',
gap: 12,
borderRadius: 20,
paddingHorizontal: 14,
paddingVertical: 12,
shadowColor: '#000',
shadowOpacity: 0.18,
shadowRadius: 16,
shadowOffset: { width: 0, height: 8 },
elevation: 6,
},
toastIcon: {
width: 34,
height: 34,
borderRadius: 17,
backgroundColor: 'rgba(255,255,255,0.18)',
alignItems: 'center',
justifyContent: 'center',
},
toastTitle: { fontFamily: fonts.bold, fontSize: 15 },
toastBody: { fontFamily: fonts.regular, fontSize: 13, opacity: 0.9 },
scrim: {
flex: 1,
backgroundColor: 'rgba(26,64,52,0.55)',
justifyContent: 'center',
padding: 24,
},
sheet: {
backgroundColor: colors.white,
borderRadius: 28,
padding: 24,
paddingTop: 16,
alignItems: 'center',
gap: 8,
},
medalHalo: {
width: 128,
height: 128,
borderRadius: 64,
backgroundColor: colors.surfaceMuted,
borderWidth: 6,
borderColor: colors.white,
alignItems: 'center',
justifyContent: 'center',
},
title: {
fontFamily: fonts.display,
fontSize: 28,
color: colors.ink,
textAlign: 'center',
marginTop: 4,
},
});
/**
* After a scan: celebrate a new tier with the big modal, and newly earned badges with toasts.
* `beforePoints` comes from the scan result, so this works even on a cold deep link;
* `before` (cached /me) is only needed to diff the progress-based badges.
*/
export function announceProgress(beforePoints: number, after: Me, raffles: Raffle[], before?: Me) {
const tier = tierAt(after.points);
const newTier = tier && tier.id !== tierAt(beforePoints)?.id;
const had = before ? earnedBadges(before, raffles) : null;
const now = earnedBadges(after, raffles);
const fresh = badges.filter((b) =>
had ? now.has(b.id) && !had.has(b.id) : b.id === 'first' ? beforePoints === 0 : false,
);
if (newTier) {
celebrate({
title: 'Congratulations',
body: `You're a ${tier.name} now. Keep scanning to climb the Rift.`,
medal: { kind: 'gem', tone: tier.tone },
action: { label: 'Achievements', onPress: () => router.push('/achievements') },
});
}
fresh.forEach((b, i) =>
setTimeout(
() => toast(`Badge unlocked: ${b.name}`, { body: b.hint, icon: 'medal', tone: 'gold' }),
(newTier ? 3200 : 600) + i * 3200,
),
);
}

View File

@ -1,4 +1,4 @@
import type { ReactNode } from 'react';
import type { ReactNode, Ref } from 'react';
import {
ActivityIndicator,
Image,
@ -10,10 +10,12 @@ import {
View,
type StyleProp,
type TextStyle,
type ScrollViewInstance,
type ViewStyle,
} from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import Svg, { Circle, Path } from 'react-native-svg';
import Svg, { Circle, Defs, LinearGradient, Path, Polygon, Rect, Stop } from 'react-native-svg';
import type { MedalTone } from '../lib/content';
import { colors, fonts, radius } from '../lib/theme';
// ---------- Icons (Lucide paths, 24x24) ----------
@ -59,6 +61,24 @@ const ICONS = {
],
bag: ['M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z', 'M3 6h18', 'M16 10a4 4 0 0 1-8 0'],
logout: ['M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4', 'M16 17l5-5-5-5', 'M21 12H9'],
pin: ['M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0z', 'M12 7a3 3 0 1 0 0 6 3 3 0 0 0 0-6z'],
map: ['M9 3 3 6v15l6-3 6 3 6-3V3l-6 3z', 'M9 3v15', 'M15 6v15'],
ticket: [
'M3 8a2 2 0 0 0 2-2h14a2 2 0 0 0 2 2v2a2 2 0 0 0 0 4v2a2 2 0 0 0-2 2H5a2 2 0 0 0-2-2v-2a2 2 0 0 0 0-4z',
'M13 6v2',
'M13 16v2',
'M13 11v2',
],
spark: [
'M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9z',
'M19 17l.8 2.2L22 20l-2.2.8L19 23l-.8-2.2L16 20l2.2-.8z',
],
medal: [
'M7.2 2h9.6l-3 6h-3.6z',
'M12 22a6 6 0 1 0 0-12 6 6 0 0 0 0 12z',
'M12 14.5l.9 1.8 2 .3-1.5 1.4.4 2-1.8-1-1.8 1 .4-2-1.5-1.4 2-.3z',
],
close: ['M18 6 6 18', 'M6 6l12 12'],
} as const;
export type IconName = keyof typeof ICONS | 'help';
@ -121,8 +141,10 @@ export function Screen({
refreshing = false,
header,
bar,
scrollRef,
}: {
children: ReactNode;
scrollRef?: Ref<ScrollViewInstance>;
onRefresh?: () => void;
refreshing?: boolean;
/** Scrolls with content and handles its own top inset (PatternHeader). */
@ -132,9 +154,11 @@ export function Screen({
}) {
return (
<SafeAreaView style={s.screen} edges={header ? [] : ['top']}>
{!header && <Backdrop />}
{bar}
<ScrollView
contentContainerStyle={{ paddingBottom: 32 }}
ref={scrollRef}
contentContainerStyle={{ paddingBottom: 120 }}
refreshControl={
onRefresh ? (
<RefreshControl
@ -171,10 +195,135 @@ export function PatternHeader({
export function BackBar({ title, onBack }: { title: string; onBack: () => void }) {
return (
<View style={s.backBar}>
<Pressable onPress={onBack} hitSlop={12} accessibilityRole="button" accessibilityLabel="Back">
<Icon name="back" />
<Pressable
onPress={onBack}
hitSlop={12}
accessibilityRole="button"
accessibilityLabel="Back"
style={s.roundBtn}
>
<Icon name="back" size={20} />
</Pressable>
<H2 style={{ marginLeft: 8 }}>{title}</H2>
<H2 style={{ marginLeft: 12 }}>{title}</H2>
</View>
);
}
/** Soft brand wash fading into the page, like an event page tinted by its cover. */
export function Backdrop({ height = 320 }: { height?: number }) {
return (
<Svg
pointerEvents="none"
width="100%"
height={height}
style={{ position: 'absolute', top: 0, left: 0, right: 0 }}
>
<Defs>
<LinearGradient id="wash" x1="0" y1="0" x2="0" y2="1">
<Stop offset="0" stopColor={colors.secondary} stopOpacity={0.75} />
<Stop offset="0.55" stopColor={colors.surfaceMuted} stopOpacity={0.5} />
<Stop offset="1" stopColor={colors.whiteSoft} stopOpacity={0} />
</LinearGradient>
</Defs>
<Rect width="100%" height={height} fill="url(#wash)" />
</Svg>
);
}
/** Calendar block: small month over a big day. */
export function DateBlock({ month, day, dark }: { month: string; day: string; dark?: boolean }) {
const fg = dark ? colors.white : colors.ink;
return (
<View style={[s.dateBlock, dark && { borderColor: 'rgba(255,255,255,0.25)' }]}>
<Text style={[s.dateMonth, dark && { backgroundColor: 'rgba(255,255,255,0.15)', color: fg }]}>
{month}
</Text>
<Text style={[s.num, { fontSize: 15, color: fg, paddingVertical: 4 }]}>{day}</Text>
</View>
);
}
export function Pill({
children,
tone = 'muted',
style,
}: {
children: ReactNode;
tone?: 'muted' | 'green' | 'dark' | 'light';
style?: StyleProp<ViewStyle>;
}) {
const bg = {
muted: colors.surfaceMuted,
green: colors.primary,
dark: colors.ink,
light: colors.white,
}[tone];
const fg = tone === 'green' || tone === 'dark' ? colors.white : colors.primary;
return (
<View style={[s.pill, { backgroundColor: bg }, style]}>
{typeof children === 'string' ? (
<Text style={[s.pillText, { color: fg }]}>{children}</Text>
) : (
children
)}
</View>
);
}
// ---------- Medals (placeholder art: swap for real assets later) ----------
const TONES: Record<MedalTone | 'locked', [string, string, string]> = {
bronze: ['#eab284', '#c97f43', '#8f5326'],
silver: ['#f1f4f6', '#c5cdd3', '#8a979f'],
gold: ['#ffdf7e', '#f2b632', '#c3860f'],
emerald: [colors.secondary, colors.primary, colors.ink],
locked: ['#eeeeee', '#dbdbdb', '#c4c4c4'],
};
/** Isometric gem for achievement tiers. */
export function Gem({
tone,
size = 40,
locked,
}: {
tone: MedalTone;
size?: number;
locked?: boolean;
}) {
const [light, mid, dark] = TONES[locked ? 'locked' : tone];
return (
<Svg width={size} height={size} viewBox="0 0 100 100">
<Polygon points="50,6 88,28 50,50 12,28" fill={light} />
<Polygon points="12,28 50,50 50,94 12,72" fill={mid} />
<Polygon points="88,28 88,72 50,94 50,50" fill={dark} />
</Svg>
);
}
/** Ribboned medal for badges. */
export function Medal({
tone,
icon,
size = 64,
locked,
}: {
tone: MedalTone;
icon: IconName;
size?: number;
locked?: boolean;
}) {
const [light, mid, dark] = TONES[locked ? 'locked' : tone];
return (
<View style={{ width: size, height: size, alignItems: 'center', justifyContent: 'center' }}>
<Svg width={size} height={size} viewBox="0 0 100 100" style={StyleSheet.absoluteFill}>
<Polygon points="30,4 46,4 56,40 40,44" fill={locked ? '#c4c4c4' : colors.primary} />
<Polygon points="70,4 54,4 44,40 60,44" fill={locked ? '#d6d6d6' : colors.ink} />
<Circle cx={50} cy={62} r={34} fill={mid} />
<Circle cx={50} cy={62} r={26} fill={light} stroke={dark} strokeWidth={3} />
</Svg>
<View style={{ position: 'absolute', top: size * 0.62 - size * 0.14 }}>
<Icon name={icon} size={size * 0.28} color={dark} />
</View>
</View>
);
}
@ -299,15 +448,10 @@ export const s = StyleSheet.create({
},
card: {
backgroundColor: colors.white,
borderRadius: radius + 4,
borderRadius: 20,
padding: 16,
borderWidth: 1,
borderColor: 'rgba(48,97,76,0.12)',
shadowColor: '#000',
shadowOpacity: 0.05,
shadowRadius: 8,
shadowOffset: { width: 0, height: 2 },
elevation: 1,
borderColor: 'rgba(48,97,76,0.10)',
},
btn: {
minHeight: 50,
@ -331,8 +475,47 @@ export const s = StyleSheet.create({
flexDirection: 'row',
alignItems: 'center',
paddingHorizontal: 16,
paddingVertical: 12,
paddingVertical: 10,
},
roundBtn: {
width: 40,
height: 40,
borderRadius: 20,
backgroundColor: colors.white,
borderWidth: 1,
borderColor: 'rgba(48,97,76,0.12)',
alignItems: 'center',
justifyContent: 'center',
},
dateBlock: {
width: 48,
borderRadius: 10,
borderWidth: 1,
borderColor: 'rgba(48,97,76,0.18)',
overflow: 'hidden',
alignItems: 'center',
backgroundColor: 'rgba(255,255,255,0.6)',
},
dateMonth: {
alignSelf: 'stretch',
textAlign: 'center',
fontFamily: fonts.bold,
fontSize: 10,
letterSpacing: 1,
paddingVertical: 3,
color: colors.primary,
backgroundColor: colors.surfaceMuted,
},
pill: {
flexDirection: 'row',
alignItems: 'center',
gap: 6,
alignSelf: 'flex-start',
borderRadius: 999,
paddingHorizontal: 12,
paddingVertical: 6,
},
pillText: { fontFamily: fonts.semibold, fontSize: 12 },
input: {
fontFamily: fonts.regular,
fontSize: 17,

184
src/lib/content.ts Normal file
View File

@ -0,0 +1,184 @@
// Event content shown in the app. Mirrors GRVSummit/content/site.ts + program.ts.
// Placeholder layout/medals: replace the venue zones and medal art when the real floor plan and
// achievement assets arrive (see README "Replacing placeholder assets").
import type { Me, Raffle } from './api';
export const event = {
name: 'Great Rift Valley Innovation Summit',
short: 'GRV Summit',
month: 'FEB',
days: '21–22',
dateLabel: 'Sun 21 – Mon 22 Feb 2027',
shortDates: '21–22 Feb 2027',
venue: 'Skylight Hotel',
address: 'Bole, Addis Ababa',
mapsUrl: 'https://maps.google.com/?q=Skylight+Hotel+Addis+Ababa',
program: [
{ day: 'Day 1', date: '21 Feb', title: 'Workshops & panels', where: 'workshops' },
{ day: 'Day 2', date: '22 Feb', title: 'Exhibition & pitch finals', where: 'stage' },
],
} as const;
// ---------- Venue map ----------
export type ZoneKind = 'stage' | 'booths' | 'startups' | 'food' | 'help' | 'grv';
export type Zone = {
id: string;
name: string;
kind: ZoneKind;
/** What attendees find here, one line each. */
details: string[];
/** Rect on a 100 × 140 floor plan (x, y, w, h). */
rect: [number, number, number, number];
/** Booth numbers starting with one of these letters are in this zone. */
boothPrefixes?: string[];
};
export const zones: Zone[] = [
{
id: 'stage',
name: 'Grand Ballroom',
kind: 'stage',
details: ['Keynotes and opening', 'Pitch competition finals (Day 2)', 'Closing raffle draw'],
rect: [4, 4, 62, 34],
},
{
id: 'workshops',
name: 'Workshop rooms',
kind: 'stage',
details: ['Panels and sector deep-dives (Day 1)', 'Rooms 1–3, first door on the right'],
rect: [70, 4, 26, 34],
},
{
id: 'startups',
name: 'Startup alley',
kind: 'startups',
details: ['GRV investee startups', 'Team members wear a QR badge or wristband: scan them'],
rect: [4, 42, 18, 58],
},
{
id: 'hall',
name: 'Exhibition hall',
kind: 'booths',
details: ['Partner and exhibitor booths', 'Scan each booth sign for points'],
rect: [26, 42, 46, 58],
boothPrefixes: ['A', 'B', 'C'],
},
{
id: 'food',
name: 'Coffee & lunch',
kind: 'food',
details: ['Ethiopian coffee ceremony all day', 'Lunch 12:30–13:30'],
rect: [76, 42, 20, 36],
},
{
id: 'restrooms',
name: 'Restrooms',
kind: 'help',
details: ['Accessible restroom included'],
rect: [76, 82, 20, 18],
},
{
id: 'grv',
name: 'GRV booth',
kind: 'grv',
details: ['Merch pickup and payment', 'Raffle questions', 'Lost & found'],
rect: [4, 104, 30, 16],
},
{
id: 'entrance',
name: 'Entrance & registration',
kind: 'help',
details: ['Ticket check-in: show your ticket QR', 'Badges and wristbands', 'Help desk'],
rect: [38, 104, 58, 16],
},
];
export const zoneForBooth = (boothNumber: string | null) =>
zones.find((z) => z.boothPrefixes?.some((p) => boothNumber?.toUpperCase().startsWith(p))) ??
zones.find((z) => z.id === 'hall')!;
// ---------- Achievements ----------
export type MedalTone = 'bronze' | 'silver' | 'gold' | 'emerald';
export type Tier = {
id: string;
name: string;
points: number;
tone: MedalTone;
/** Hints shown under the tier on the Achievements page. */
hints: string[];
};
export const tiers: Tier[] = [
{
id: 'walker',
name: 'Valley Walker',
points: 10,
tone: 'bronze',
hints: ['Scan your first booth', 'Say hi at the GRV booth'],
},
{
id: 'explorer',
name: 'Rift Explorer',
points: 50,
tone: 'silver',
hints: ['Visit five booths', 'Find a founder in Startup alley'],
},
{
id: 'scout',
name: 'Highland Scout',
points: 120,
tone: 'gold',
hints: ['Meet every investee team', 'Hunt for the mystery investee'],
},
{
id: 'pioneer',
name: 'Summit Pioneer',
points: 250,
tone: 'emerald',
hints: ['Every booth, every investee, the mystery found'],
},
];
/** Highest tier reached at `points`, or null before the first one. */
export const tierAt = (points: number) =>
[...tiers].reverse().find((t) => points >= t.points) ?? null;
export const nextTier = (points: number) => tiers.find((t) => points < t.points) ?? null;
export type Badge = { id: string; name: string; hint: string; tone: MedalTone; icon: BadgeIcon };
export type BadgeIcon = 'spark' | 'store' | 'rocket' | 'help' | 'gift' | 'trophy';
export const badges: Badge[] = [
{ id: 'first', name: 'First steps', hint: 'Scan any GRV code', tone: 'bronze', icon: 'spark' },
{ id: 'booths', name: 'Booth hopper', hint: 'Visit every booth', tone: 'silver', icon: 'store' },
{
id: 'investees',
name: 'Investee hunter',
hint: 'Meet every investee',
tone: 'gold',
icon: 'rocket',
},
{
id: 'mystery',
name: 'Mystery solver',
hint: 'Find the mystery investee',
tone: 'emerald',
icon: 'help',
},
{ id: 'raffle', name: 'In the draw', hint: 'Qualify for a raffle', tone: 'silver', icon: 'gift' },
{ id: 'top10', name: 'Top ten', hint: 'Reach the top 10', tone: 'gold', icon: 'trophy' },
];
/** Badge ids earned, derived from /me (+ /raffles for "In the draw"). */
export function earnedBadges(me: Me, raffles: Raffle[] = []) {
const { booths, startups, mysteryFound } = me.progress;
const earned = new Set<string>();
if (me.points > 0) earned.add('first');
if (booths.total > 0 && booths.found >= booths.total) earned.add('booths');
if (startups.total > 0 && startups.found >= startups.total) earned.add('investees');
if (mysteryFound) earned.add('mystery');
if (raffles.some((r) => !r.drawnAt && me.points >= r.minPoints)) earned.add('raffle');
if (me.rank !== null && me.rank <= 10 && me.points > 0) earned.add('top10');
return earned;
}

View File

@ -5,6 +5,13 @@
"noUncheckedIndexedAccess": true,
"types": []
},
"include": ["src/**/*.ts", "src/**/*.tsx", "*.d.ts", "expo-env.d.ts"],
"exclude": ["node_modules", "dist"]
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"*.d.ts"
],
"exclude": [
"node_modules",
"dist"
]
}