Skip to content

armgit / bygga

Public Imported from GitHub
0

IKEA assembly, step by step: animated, manual-style 3D guides. Scan any paper manual with Together AI.

TypeScript

Polish: print without a blank last page, 320px phones, share card art

Youssef81f0037c371c
diff --git a/src/app/guide.css b/src/app/guide.css
index 8f0996e..1a701b4 100644
--- a/src/app/guide.css
+++ b/src/app/guide.css
@@ -1973,6 +1973,10 @@ input[type="range"] {
place-items: stretch end;
padding: 12px;
}
+/* focused on open so keyboards start inside it; the sheet itself needs no ring */
+.side-sheet:focus {
+ outline: none;
+}
.side-sheet {
width: min(460px, 100%);
height: 100%;
@@ -2921,6 +2925,11 @@ input[type="range"] {
border-radius: 0;
box-shadow: none;
break-after: page;
+ overflow: hidden;
+ }
+ /* the last sheet ends the document: no empty page after it */
+ .print-page:last-child {
+ break-after: auto;
}
}
diff --git a/src/app/home.css b/src/app/home.css
index 9410b54..2baebb4 100644
--- a/src/app/home.css
+++ b/src/app/home.css
@@ -2054,7 +2054,7 @@
@media (max-width: 1080px) {
.hero {
- grid-template-columns: 1fr;
+ grid-template-columns: minmax(0, 1fr);
gap: 34px;
min-height: 0;
padding: 18px 0 36px;
@@ -2293,6 +2293,12 @@
font-size: 13.5px;
}
}
+/* the smallest phones (320 px) can't fit five: let them wrap */
+@media (max-width: 350px) {
+ .quick {
+ flex-wrap: wrap;
+ }
+}
/* ================= privacy and terms ================= */
diff --git a/src/components/guide/GuideApp.tsx b/src/components/guide/GuideApp.tsx
index 80d0f12..2636925 100644
--- a/src/components/guide/GuideApp.tsx
+++ b/src/components/guide/GuideApp.tsx
@@ -619,9 +619,11 @@ function Guide({ plan, slug, via, ai, startStep }: { plan: Plan; slug: string; v
}, [voiceOn, phase, step, steps.length, plan]);
useEffect(() => {
- const base = `${plan.spec.name} | Bygga`;
- document.title = phase === "steps" ? `Step ${step + 1} of ${steps.length}, ${base}` : phase === "done" ? `Built: ${base}` : base;
- }, [phase, step, steps.length, plan.spec.name]);
+ const s = plan.spec;
+ // the cover keeps the page's own title; steps and the end say where you are
+ document.title =
+ phase === "steps" ? `Step ${step + 1} of ${steps.length}, ${s.name} | Bygga` : phase === "done" ? `Built: ${s.name} | Bygga` : `${s.name} ${s.variant.toLowerCase()}: assembly step by step | Bygga`;
+ }, [phase, step, steps.length, plan.spec]);
const mode: StageMode = useMemo(() => {
if (phase === "cover") return introPlayed || resume ? { kind: "assembled", turntable: true, dims: true } : { kind: "intro", dims: true };
diff --git a/src/components/guide/HelpSheet.tsx b/src/components/guide/HelpSheet.tsx
index af92d77..e7b9850 100644
--- a/src/components/guide/HelpSheet.tsx
+++ b/src/components/guide/HelpSheet.tsx
@@ -76,6 +76,11 @@ export default function HelpSheet({
}) {
const kind = index >= 0 ? plan.steps[index].kind : "general";
const faqs = faqFor(kind);
+ // keyboard and screen reader users land inside the sheet, not behind it
+ const sheet = useRef<HTMLElement>(null);
+ useEffect(() => {
+ sheet.current?.focus({ preventScroll: true });
+ }, []);
const [open, setOpen] = useState<number | null>(focusMissing ? faqs.length - 2 : null);
const [msgs, setMsgs] = useState<Msg[]>([]);
const [q, setQ] = useState("");
@@ -158,8 +163,11 @@ export default function HelpSheet({
return (
<motion.div className="sheet-back" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} onClick={onClose}>
<motion.aside
+ ref={sheet}
+ tabIndex={-1}
className="side-sheet"
role="dialog"
+ aria-modal="true"
aria-label="Help"
initial={{ x: 40, opacity: 0 }}
animate={{ x: 0, opacity: 1 }}
diff --git a/src/components/guide/shareCard.ts b/src/components/guide/shareCard.ts
index e99778d..6a855be 100644
--- a/src/components/guide/shareCard.ts
+++ b/src/components/guide/shareCard.ts
@@ -83,7 +83,10 @@ export async function buildCard(plan: Plan, key: string, stat: string): Promise<
ctx.strokeStyle = "#e8e6e0";
ctx.stroke();
+ // multiply, so the drawing's own white sheet melts into the card instead of showing as a box
+ ctx.globalCompositeOperation = "multiply";
ctx.drawImage(img, 90, 96, 900, 760);
+ ctx.globalCompositeOperation = "source-over";
// the stamp: a yellow check, like a finished page in a manual
ctx.fillStyle = "#ffd21f";