Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
49144c7
Add DashLabs: portfolio and made-to-order shop site
claude Nov 9, 2026
7ff376a
DashLabs: add Learn guides, price estimator, Launch lab and lab statu…
claude Nov 9, 2026
c330209
DashLabs: restyle as a REF·DB sister site
claude Nov 9, 2026
068d12d
DashLabs: own identity — the print chamber, with real 3D
claude Nov 9, 2026
0b7e4da
DashLabs: instant STL quote, slicer preview, fly-to-cart, 3D spools
claude Nov 10, 2026
807a173
DashLabs: live 3D personalisation, console search, SEO and share image
claude Nov 11, 2026
c0e334a
DashLabs: gift wrap, personalised cart thumbnails, Stripe checkout ready
claude Nov 11, 2026
4754a43
DashLabs: scroll print story, layer scrubber, pick-the-next-print, a11y
claude Nov 11, 2026
a1e568f
DashLabs: real-size view, save for later, Day shift theme
claude Nov 11, 2026
6f55199
DashLabs: launch setup, reviews and gallery, smoother buying flow
claude Nov 11, 2026
2e3ba68
DashLabs: three more guides, gift finder, policies, about, shop sorting
claude Nov 11, 2026
75914b6
DashLabs: performance pass
claude Nov 11, 2026
e4bdfe7
DashLabs: visual review fixes
claude Nov 11, 2026
3b703d0
DashLabs: ships-by dates, good-to-know, quick add, multi-colour preview
claude Nov 12, 2026
1d64ef3
DashLabs: phone polish, price guide, smoke tests, email templates
claude Nov 12, 2026
8b5592d
DashLabs: 3D dog for pet portraits, product photo gallery
claude Nov 12, 2026
000786a
DashLabs: smoke test ignores cancelled page cross-fades
claude Nov 12, 2026
772da4d
DashLabs: shareable choices, remembered details, print styles, headers
claude Nov 12, 2026
ebaf4a3
DashLabs: launch checker and an instant still of the hero printer
claude Nov 13, 2026
4130115
DashLabs: README rewritten as an owner's handbook
claude Nov 13, 2026
e273415
DashLabs: 'I've sent it' step closes the order loop
claude Nov 13, 2026
36f995f
DashLabs: keyboard access for the menus
claude Nov 13, 2026
b60f238
DashLabs: compact 3D viewer controls on small phones
claude Nov 13, 2026
e15129e
DashLabs: Learn index as illustrated cards, a 404 that helps
claude Nov 13, 2026
7a8414a
DashLabs: home-page 3D steps aside on devices that can't keep up
claude Nov 13, 2026
9d3faf5
DashLabs: viewer rests on slow devices; better search snippets
claude Nov 13, 2026
11a960a
DashLabs: Learn drawings readable in both themes
claude Nov 13, 2026
d6a75df
DashLabs: tidy the product page on small phones
claude Nov 13, 2026
285b527
DashLabs: per-product share cards for link previews
claude Nov 13, 2026
6c606d8
DashLabs: never lose an add-to-cart; clearer cart summary
claude Nov 13, 2026
24a6199
DashLabs: home page rhythm and guide-card numbers
claude Nov 13, 2026
ed59b25
DashLabs: product page order and fuller suggestions
claude Nov 13, 2026
5fe7cbc
DashLabs: HTML validation fixes
claude Nov 14, 2026
80d5abe
DashLabs: validate built HTML in CI (npm run validate)
claude Nov 14, 2026
efcdedc
DashLabs: share cards for the Learn guides
claude Nov 14, 2026
cc901e0
DashLabs: search that understands shoppers
claude Nov 14, 2026
57256e2
DashLabs: optional direct delivery of requests via Netlify Forms
claude Nov 14, 2026
bbafaa8
DashLabs: email the owner every paid order (Stripe mode)
claude Nov 14, 2026
5cd04d6
DashLabs: thank-you page says what happens next
claude Nov 14, 2026
6abfd70
DashLabs: fix pinned sections; pitch-an-idea tile on the lab
claude Nov 14, 2026
4f7615f
DashLabs: smoke journey guards pinned sections
claude Nov 14, 2026
1707e46
DashLabs: smoke: reset scroll after the pinned-section check
claude Nov 14, 2026
f836c78
DashLabs: worked calculations that fit on a phone
claude Nov 14, 2026
c30fb10
DashLabs: drop-in product photos, optimised at build time
claude Nov 14, 2026
e754054
DashLabs: full-screen product photos
claude Nov 14, 2026
7a35817
DashLabs: phone-width accessibility fixes
claude Nov 14, 2026
ed1a8d8
DashLabs: quote requests land on the form with the choices shown
claude Nov 14, 2026
4ef9fff
DashLabs: estimator and STL quotes show their summary on the request …
claude Nov 14, 2026
66ffbc2
DashLabs: custom-request drafts survive leaving the page
claude Nov 14, 2026
a6e2920
DashLabs: draft note outside the label (valid HTML), label style kept
claude Nov 14, 2026
4f350d4
DashLabs: npm run check (tests, types, build, HTML) in one go
claude Nov 15, 2026
df46419
DashLabs: [hidden] always hides; empty Saved suggests products
claude Nov 15, 2026
e80ff58
DashLabs: Content-Security-Policy on every page; cache rules
claude Nov 15, 2026
adbe0f5
DashLabs: README: security note in its own paragraph
claude Nov 15, 2026
0862f2c
DashLabs: empty cart no longer downloads the 3D engine
claude Nov 15, 2026
c08f4db
DashLabs: 3D viewers start only when near the screen
claude Nov 15, 2026
9e4d2fd
DashLabs: dependency audit: safe fixes, html-validate 11
claude Nov 15, 2026
1407906
DashLabs: product structured data carries the real price range
claude Nov 15, 2026
aca455d
DashLabs: lab status stops claiming to be live when it goes stale
claude Nov 15, 2026
969405f
DashLabs: maker's note and build log written in Markdown
claude Nov 15, 2026
13eb852
DashLabs: customer photos optimised; one full-screen viewer; images k…
claude Nov 15, 2026
5b0a548
DashLabs: order desk for packing slips and gift note cards
claude Nov 15, 2026
3e722a3
DashLabs: phone menu focus: no late focus after close; recover lost f…
claude Nov 15, 2026
74f4c48
DashLabs: order desk drafts customer replies; npm run verify
claude Nov 16, 2026
d5c3bd8
DashLabs: launch-week checklist; physics guide computes its worked ex…
claude Nov 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/dashlabs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Checks the DashLabs site (dashlabs/) whenever it changes: tests, type check, build.
# Separate from the REF·DB deploy workflow; it never deploys anything.
name: DashLabs checks

on:
push:
paths: ['dashlabs/**', '.github/workflows/dashlabs.yml']
pull_request:
paths: ['dashlabs/**', '.github/workflows/dashlabs.yml']

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
defaults:
run:
working-directory: dashlabs
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: dashlabs/package-lock.json
- run: npm ci
- run: npm test
- run: npx tsc --noEmit -p .
- run: npm run build
- run: npm run validate
2 changes: 2 additions & 0 deletions dashlabs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.netlify/
dist-thumbs/
19 changes: 19 additions & 0 deletions dashlabs/.htmlvalidate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": ["html-validate:recommended"],
"rules": {
"no-inline-style": "off",
"void-style": "off",
"no-trailing-whitespace": "off",
"attribute-boolean-style": "off",
"attribute-empty-style": "off",
"long-title": "off",
"prefer-native-element": "off",
"no-redundant-role": "off",
"valid-id": "off",
"doctype-style": "off",
"require-sri": "off",
"svg-focusable": "off",
"no-implicit-button-type": "off",
"wcag/h32": "off"
}
}
150 changes: 150 additions & 0 deletions dashlabs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# DashLabs

The website for DashLabs 3D printing: custom figurines of people and pets, printed business cards, DashLabs
originals like the Pen Launcher, and licensed made-to-order prints. It's a portfolio, a shop and a set of
interactive guides, built with [Astro](https://astro.build) and [Three.js](https://threejs.org).

Orders currently arrive by email (you confirm and invoice). Online card payments with automatic invoices are built
and switched off; turning them on needs no code, see [docs/DEPLOY.md](docs/DEPLOY.md).

**Contents:** [Quick start](#quick-start) · [Everyday jobs](#everyday-jobs) · [Before you launch](#before-you-launch)
· [What's on the site](#whats-on-the-site) · [How it's built](#how-its-built) · [Commands](#commands)

---

## Quick start

Needs Node.js 22 or later.

```bash
cd dashlabs
npm install
npm run dev # open http://localhost:4321
npm run launch-check # what's still a placeholder?
```

## Everyday jobs

Almost everything you'll change lives in **`src/data/`** (settings and the catalog), **`src/writing/`** (your own words,
in Markdown) and **`src/photos/`**. Edit, save, and the dev server updates.

| I want to… | Edit | Notes |
| ---------------------------------- | -------------------------------------- | ----- |
| Change a price | `src/data/catalog.ts` | Prices are in **cents**: `2400` is $24.00. |
| Add a product | `src/data/catalog.ts` | See [Adding a product](#adding-a-product). |
| Add product photos | `src/photos/products/<slug>/` (see the README there) | Drop in phone photos as they are: resized and compressed automatically. The page opens on the photos; a "3D" button switches to the model. |
| Write the maker's note (About) | `src/writing/maker-note.md` | Plain text under the `---` lines; set `draft: false` when done. Optional photo in `src/photos/about/`. |
| Add a build-log entry (Lab) | `src/writing/build-log/` (see the README there) | One Markdown file per project: date, title, a few lines, optional photos in `src/photos/build-log/`. |
| Update the queue / printers | `src/data/lab.ts` | Drives the header pill, home board and "ships by" dates. Change `updated` too: after 3 weeks without an update the site stops showing the queue as live. |
| Add a customer review | `src/data/reviews.ts` | Real reviews only, with permission. Example inside. |
| Add a customer-print photo | `src/photos/gallery/` + `src/data/reviews.ts` | The gallery on /lab/ appears once there's one. |
| Change contact email, gift wrap, shipping countries | `src/data/site.ts` | |
| Change your print rates | `src/lib/estimate.ts` (`RATES`), `src/data/materials.ts` (spool prices) | Feeds the price estimator and STL quote. |
| Pack an order / print a gift note | Open **`/desk/`** on your site | Paste the order email: prints a packing slip (never any prices) and the gift note card (A6), and drafts your reply (order total with shipping, shipped, review request) ready to send. Not linked anywhere; hidden from search. |
| Reply to a customer | `docs/EMAIL-TEMPLATES.md` | Order total, quote, preview, shipped, review request, licence refusal. |

After adding a product or changing a category colour, run **`npm run thumbs`** then **`npm run og`** to re-render the product images and link-preview cards
(it needs Playwright: `npx playwright install chromium`). If you forget, the site draws them live instead, so
nothing breaks.

### Adding a product

Copy an existing entry in `PRODUCTS` (`src/data/catalog.ts`) and change it:

- `id`: new and **permanent**; it ends up on orders and invoices.
- `slug`: the web address, `/shop/<slug>/`.
- `price` in cents, and `options` with optional `priceDelta`s (also cents).
- `purchase: 'quote'` for work that needs a quote first; `'cart'` for fixed-price items.
- `size` (real millimetres) for the Real size view; `personalise` for typed-in text (see the Name keychain).
- `art.shape` picks the 3D model; reuse one of the existing shapes.
- A community design? `source: { kind: 'licensed', designer, url, licence }`. Only list designs whose licence lets
you sell prints. **Many MakerWorld models are personal-use only.**
- Add a line for it in `GIFT_TAGS` (`src/lib/gifts.ts`) so the gift finder knows who it suits.

Then `npm test`: it checks ids, slugs, prices, sizes, licences and gift tags.

## Before you launch

**Start here next week: [docs/LAUNCH-WEEK.md](docs/LAUNCH-WEEK.md)**, a step-by-step checklist from placeholders to live.

`npm run launch-check` lists what's left, from the site's own data. Today it reports:

- **Must fix:** contact email; the example MakerWorld listings (dragon, vase) and the cable dock's placeholder text;
the example build log on /lab/; the maker's note on /about/; the "Draft" notice on /policies/ (review them
first: they're commitments); the example printer names.
- **Check by hand:** every price, the estimator rates and spool prices, the gift-wrap price, the Pen Launcher spring
numbers, and three approximate sizes (Pen Launcher, cable dock, keychain).
- **Nice to have:** product photos, social links, and (later) real reviews and customer photos.

Then follow [docs/DEPLOY.md](docs/DEPLOY.md) to go live on Netlify and, when ready, switch on Stripe payments.

## What's on the site

**Shop.** Catalog with category filters, sorting and quick add · product pages with an interactive 3D model
(drag to spin, recolours to the filament you pick, layer scrubber, "Watch it print", Real size ruler and bank card)
· live 3D text for personalised items · "ships by" dates from the real queue · "Good to know" (made to order,
materials, care, returns, licence) · shareable links that keep the chosen options · save for later · gift finder.

**Ordering.** Cart with gift wrap and a gift note, remove/undo, "ships" date · order requests and custom requests
open a "ready to send" dialog (email app, copy message, copy address) · custom orders page with a price guide,
instant **STL quote** (drop a 3D file, priced from its real volume; the file never leaves the device) · Stripe
Checkout with automatic invoices, ready to switch on.

**Learn.** Six guides, each with a tool and a worked example: materials, pricing (estimator with slicer preview),
Pen Launcher physics (launch lab), photos for figurines (checklist), designing for printing (printability check),
where prints can live (place picker).

**Brand.** The "print chamber" look: dark build chamber, hot amber and UV violet, extruded type and cards, sections
that print in as you scroll, a live 3D printer on the home page you can pick jobs for, a scroll story on /lab/, and
a light "Day shift" theme.

**Quality.** Accessibility audit (axe) clean in both themes, on desktop and phone · Lighthouse 100 for accessibility, best practices and
SEO · search-engine data for products, breadcrumbs and the FAQ · sitemap · share images · prints cleanly · respects
"reduce motion" and has a pause button · works without WebGL (drawn artwork instead) · tells you if JavaScript is off.

**Security.** A strict Content-Security-Policy on every page: only the site's own scripts run (set in
`astro.config.mjs`). Security headers and caching are in `netlify.toml`.

## How it's built

```
src/data/ the content: catalog, site settings, lab status, materials, guides, reviews
src/lib/ pure logic (tested): pricing, orders, checkout, Stripe, STL maths, ship dates, gifts, design rules
src/lib/three/ Three.js: printed-plastic material, models, hero printer, viewer, scale props, 3D text, STL
src/components/ header and menus, footer, product card, viewer, tools, search
src/pages/ every page; /learn/ holds the guides
src/server-routes/ Stripe checkout and webhook (added automatically on Netlify builds only)
public/ images, thumbnails (thumbs/), the hero still, fonts, icons
scripts/ thumbnail renderer, launch check, smoke test
tests/ unit tests
docs/ LAUNCH-WEEK (your checklist), DEPLOY (go live), SHOP-ROADMAP (payments plan), EMAIL-TEMPLATES
```

Principles that keep it maintainable:

- **One source of truth.** Menus, search, sitemap, gift finder, price guide and thumbnails are all generated from
the catalog, so a new product shows up everywhere.
- **Prices are never trusted from the browser.** Orders are re-priced from the catalog on the server (`buildOrder`).
- **Maths lives in `src/lib/` as pure functions with tests.** Each guide's worked example is its tool's default and
is asserted in the tests.
- **Honest by default.** No invented reviews or photos; placeholders are marked and listed by the launch check;
every estimate says where it stops.
- **Colours are tokens** in `src/styles/global.css` (dark by default, `[data-theme='light']` for Day shift).

## Commands

| Command | What it does |
| ----------------------- | ------------ |
| `npm run dev` | Local site at http://localhost:4321 with live reload. |
| `npm test` | Unit tests (catalog rules, pricing, cart, Stripe, STL, tools). |
| `npm run build` | Build the static site into `dist/`. |
| `npm run smoke` | Drive the built site like a customer: 14 journeys, every link, phone widths. Needs Playwright. |
| `npm run check` | Everything before publishing: tests, type check, build and HTML validation. Stops at the first problem. |
| `npm run verify` | `check` plus the customer journeys (needs Playwright). The full pre-publish run. |
| `npm run validate` | Check every built page's HTML (run after `npm run build`; CI runs it too). |
| `npm run launch-check` | List remaining placeholders. `-- --strict` fails while any must-fix item remains. |
| `npm run thumbs` | Re-render product thumbnails and the home-page printer still. Needs Playwright. |
| `npm run og` | Re-render each product's share card (the picture in iMessage/WhatsApp/Discord link previews). Run after `thumbs`, or after changing a name, summary, price or photo. |
| `npm run preview` | Serve the built `dist/` locally. |

GitHub runs the tests, type check and build on every change to `dashlabs/` (`.github/workflows/dashlabs.yml`).
49 changes: 49 additions & 0 deletions dashlabs/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// @ts-check
import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify';

// Two ways to build:
// - Locally and on any static host: a plain static site (checkout sends order requests by email).
// - On Netlify (it sets NETLIFY=true): the same static pages plus two server
// routes, /api/checkout and /api/stripe-webhook, for Stripe payments.
// Nothing needs editing to go live: see docs/DEPLOY.md.
const onNetlify = !!process.env.NETLIFY;

/** Adds the payment routes only where there is a server to run them. */
const paymentRoutes = {
name: 'dashlabs-payment-routes',
hooks: {
/** @param {{ injectRoute: (r: { pattern: string, entrypoint: string, prerender?: boolean }) => void }} o */
'astro:config:setup': ({ injectRoute }) => {
injectRoute({ pattern: '/api/checkout', entrypoint: './src/server-routes/api/checkout.ts', prerender: false });
injectRoute({ pattern: '/api/stripe-webhook', entrypoint: './src/server-routes/api/stripe-webhook.ts', prerender: false });
},
},
};

export default defineConfig({
// Netlify provides URL (the site's main address) at build time.
site: process.env.SITE_URL || process.env.URL || 'http://localhost:4321',
...(onNetlify ? { adapter: netlify(), integrations: [paymentRoutes] } : {}),
// Pin Vite to this project's tsconfig so it never walks up into the parent
// repository's tsconfig while DashLabs lives in a subfolder of another project.
vite: { tsconfig: './tsconfig.json' },
// Content-Security-Policy on every page: only this site's own scripts and
// styles run (inline ones are allowed by exact hash, added by Astro at build).
// Inline style="" attributes are allowed for the per-item colour variables.
security: {
csp: {
directives: [
"default-src 'self'",
"img-src 'self' data: blob:",
"font-src 'self'",
"connect-src 'self'",
"object-src 'none'",
"base-uri 'self'",
"form-action 'self'",
],
scriptDirective: { resources: ["'self'"] },
styleDirective: { resources: ["'self'", { resource: "'unsafe-inline'", kind: 'attribute' }] },
},
},
});
80 changes: 80 additions & 0 deletions dashlabs/docs/DEPLOY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Going live: Netlify + Stripe

No code changes are needed. Everything is switched on from Netlify's settings.

## 1. Put the site online (about 10 minutes, free)

1. Create an account at [netlify.com](https://www.netlify.com) and choose **Add new site → Import an existing
project**, then pick this GitHub repository.
2. Set **Base directory** to `dashlabs`. Leave the rest: the build command and publish folder come from
`dashlabs/netlify.toml`.
3. Deploy. You get an address like `something.netlify.app`. The shop works straight away in **order request** mode
(orders arrive by email, you invoice by hand).
4. Your own domain: **Domain management → Add a domain** and follow the DNS steps. Netlify adds HTTPS for free.

At this point, finish the launch checklist in the README (real email, prices, photos, sizes, licences).

## 1b. Receive requests without the customer's email app (recommended, free)

By default a customer sends their order or custom request from their own email (the site writes the message for
them). Some people close that window without pressing send. To have requests come straight from the site instead:

1. In Netlify: **Site configuration → Environment variables → Add a variable**: `PUBLIC_ORDER_DELIVERY` =
`netlify-form`. Redeploy (**Deploys → Trigger deploy**).
2. **Forms** in the Netlify menu: enable form detection if asked. After the deploy you'll see two forms, `order`
and `custom`.
3. **Forms → Form notifications → Add notification → Email notification**: your shop inbox, for **Any form**.
Each request then arrives as an email; reply to the customer at the address in it.
4. Test it: place an order request on the live site and check it arrives (and isn't in spam).

Every request is also kept in Netlify's **Forms** page, so nothing depends on one email arriving. Customers send
photos or files by replying to your email. If a direct send ever fails, the customer sees the email option
instead, so no order is lost. The free plan covers 100 submissions a month; spam is filtered (a hidden honeypot
field plus Netlify's own filter).

To switch back, delete the variable and redeploy.

## 2. Take payments (Stripe test mode first)

1. Create a [Stripe](https://stripe.com) account. Stay in **test mode**.
2. In Stripe: **Developers → API keys**, copy the **Secret key** (`sk_test_…`).
3. In Netlify: **Site configuration → Environment variables**, add:
- `STRIPE_SECRET_KEY` = the secret key (never put it in the repository)
- `PUBLIC_CHECKOUT_MODE` = `stripe`
4. **Deploys → Trigger deploy**. The cart button now says "Checkout securely".
5. Buy something with the test card `4242 4242 4242 4242` (any future date, any CVC). Check that:
- you land on "Your print is queued",
- the payment shows in Stripe,
- the receipt and invoice email arrive (in test mode Stripe only emails your own account address).
6. In Stripe: **Settings → Branding** (logo and colours appear on checkout and invoices) and **Settings → Emails**
(turn on "Successful payments" so you hear about every order).

## 3. Get an email for every paid order (recommended)

Stripe emails the customer their receipt and invoice. To get the making details yourself (items, colours,
personalised text, gift note, shipping address) in one email per paid order:

1. In Stripe: **Developers → Webhooks → Add endpoint**, URL `https://YOUR-DOMAIN/api/stripe-webhook`, event
`checkout.session.completed`. Copy the signing secret (`whsec_…`) into Netlify as `STRIPE_WEBHOOK_SECRET` and
redeploy.
2. In Netlify: **Forms → Form notifications → Add notification → Email notification**, your shop inbox, for the
`paid-order` form (or **Any form**, which also covers step 1b).
3. Test it with a test-mode payment (card `4242 4242 4242 4242`, any future date, any CVC). An email titled
**PAID: DashLabs order DL-… — $…** should arrive within a minute.

Every paid order is also kept on Netlify's **Forms** page and in the function log (**Logs → Functions**), and of
course in Stripe itself. You can also turn on Stripe's own payment emails (Stripe → **Settings → Email
notifications → Successful payments**); they show the amount but not the making details.

## 4. Go live

Complete Stripe's account activation, switch Stripe to **live mode**, replace `STRIPE_SECRET_KEY` (and the webhook
secret) with the live ones, redeploy, and place one small real order to be sure.

## To pause online payments

Delete `PUBLIC_CHECKOUT_MODE` (or set it to `request`) and redeploy. The shop goes back to order requests.

## Settings you may want to change first

In `src/data/site.ts`: `SHIP_TO` (countries Stripe may ship to, default US only), `GIFT_WRAP_PRICE`, currency.
Loading
Loading