Lumen & Gesso / website / app / data / frames.ts
| 1 | // Shared frame + mount catalog. Imported by: |
| 2 | // - Builder.tsx (live preview + picker UI) |
| 3 | // - FramedPreview.tsx (reusable framed-image component) |
| 4 | // - admin/orders/[id]/page.tsx (resolves order config for the editor preview) |
| 5 | // - orders/[id]/approve/page.tsx (renders preview inside customer's chosen frame) |
| 6 | // - orders/[id]/page.tsx (label lookup) |
| 7 | // |
| 8 | // `frame` is the rich 3-stop gradient used by the live frame around the |
| 9 | // preview; `swatch` is the chip in the picker. |
| 10 | |
| 11 | export const FRAMES = { |
| 12 | black: { label: 'Matte black', swatch: 'linear-gradient(135deg, #2a2520, #0a0806)', frame: 'linear-gradient(135deg, #2a2520 0%, #16120e 50%, #2a2520 100%)' }, |
| 13 | white: { label: 'Soft white', swatch: 'linear-gradient(135deg, #f6f3ec, #d8d1be)', frame: 'linear-gradient(135deg, #f6f3ec 0%, #e8e2d0 50%, #f6f3ec 100%)' }, |
| 14 | walnut: { label: 'Walnut', swatch: 'linear-gradient(135deg, #6e4a2f, #3b2614)', frame: 'linear-gradient(135deg, #6e4a2f 0%, #4a3220 50%, #6e4a2f 100%)' }, |
| 15 | oak: { label: 'Honey oak', swatch: 'linear-gradient(135deg, #c8a274, #8a6b46)', frame: 'linear-gradient(135deg, #c8a274 0%, #a3825a 50%, #c8a274 100%)' }, |
| 16 | gold: { label: 'Warm gold', swatch: 'linear-gradient(135deg, #d8b46a, #8a6a2a)', frame: 'linear-gradient(135deg, #d8b46a 0%, #b08c44 50%, #d8b46a 100%)' }, |
| 17 | silver: { label: 'Brushed silver',swatch: 'linear-gradient(135deg, #d8d6d2, #8c8a85)', frame: 'linear-gradient(135deg, #d8d6d2 0%, #b3b1ac 50%, #d8d6d2 100%)' }, |
| 18 | // Classic-frame-only finishes (Prodigi GLOBAL-CFP 'dark grey' / 'light grey'). |
| 19 | darkgrey: { label: 'Dark grey', swatch: 'linear-gradient(135deg, #595b5e, #313336)', frame: 'linear-gradient(135deg, #595b5e 0%, #3c3e41 50%, #595b5e 100%)' }, |
| 20 | lightgrey: { label: 'Light grey', swatch: 'linear-gradient(135deg, #d3d3d0, #a9a9a4)', frame: 'linear-gradient(135deg, #d3d3d0 0%, #bcbcb6 50%, #d3d3d0 100%)' }, |
| 21 | } as const; |
| 22 | export type FrameId = keyof typeof FRAMES; |
| 23 | |
| 24 | // Mat board treatments for the box-frame matted product. The three |
| 25 | // mount colours Prodigi fulfils on the FRA-BOX-EMA-MOUNT1-ACRY line — |
| 26 | // the `label` strings MUST match Prodigi's `mountColor` attribute |
| 27 | // values EXACTLY ('Snow white' / 'Off-white' / 'Black'), because the |
| 28 | // label is what gets sent on the order item (see lib/prodigi-skus.ts). |
| 29 | // `hex` is what the preview's `--matte-bg` reads from. Canvas float |
| 30 | // frames ignore matteId and render a fixed dark recess gap instead. |
| 31 | // The three mount colours fulfil on FRA-BOX-EMA-MOUNT1-ACRY, plus a |
| 32 | // `nomat` option. "No matte" is the same box frame with no mat board — |
| 33 | // it fulfils on the No-Mount sibling SKU (FRA-BOX-EMA-NM-ACRY, same |
| 34 | // moulding) at its own (slightly lower) price. See lib/prodigi-skus.ts |
| 35 | // (SKU swap) and lib/pricing.ts (nomat pricing). `nomat` carries no real |
| 36 | // mat colour; its `hex` is an unused fallback (the preview drops the mat |
| 37 | // board to zero width). |
| 38 | export const MATTES = { |
| 39 | snowwhite: { label: 'Snow white', swatch: 'linear-gradient(135deg, #fbfaf6, #ece8de)', hex: '#f7f5ee' }, |
| 40 | offwhite: { label: 'Off-white', swatch: 'linear-gradient(135deg, #f3ecdb, #e6dcc4)', hex: '#ede4cd' }, |
| 41 | black: { label: 'Black', swatch: 'linear-gradient(135deg, #2a2520, #0a0806)', hex: '#141210' }, |
| 42 | nomat: { label: 'No matte', swatch: 'linear-gradient(135deg, #efe9dd 0 46%, #b9b3a6 46% 54%, #efe9dd 54%)', hex: '#f7f5ee' }, |
| 43 | } as const; |
| 44 | export type MatteId = keyof typeof MATTES; |
| 45 | |
| 46 | // Edge-wrap options for the frameless Stretched Canvas (Prodigi |
| 47 | // GLOBAL-CAN). These describe how the printed image continues around the |
| 48 | // 38mm canvas edges — they're not visible front-on, so the live preview |
| 49 | // renders the same for every wrap; the choice only changes the Prodigi |
| 50 | // `wrap` attribute (see prodigi-skus.ts). `label` is shown in the |
| 51 | // Builder; `prodigi` is the exact catalogue value. |
| 52 | export const WRAPS = { |
| 53 | imagewrap: { label: 'Image wrap', sub: 'Image continues around the edges', prodigi: 'ImageWrap', swatch: 'linear-gradient(135deg, #b9a98c, #6f5f44)' }, |
| 54 | mirror: { label: 'Mirror wrap', sub: 'Edges mirror the image', prodigi: 'MirrorWrap', swatch: 'linear-gradient(135deg, #c9bda6, #8a7d63)' }, |
| 55 | white: { label: 'White edges', sub: 'Clean white border edges', prodigi: 'White', swatch: 'linear-gradient(135deg, #ffffff, #e6e2d8)' }, |
| 56 | black: { label: 'Black edges', sub: 'Solid black border edges', prodigi: 'Black', swatch: 'linear-gradient(135deg, #2a2520, #0a0806)' }, |
| 57 | } as const; |
| 58 | export type WrapId = keyof typeof WRAPS; |
| 59 | |
| 60 | export function normalizeWrapId(id: string | null | undefined): WrapId { |
| 61 | return id && id in WRAPS ? (id as WrapId) : 'imagewrap'; |
| 62 | } |
| 63 | |
| 64 | /** True when this mat selection means "no mat board at all" (routes to |
| 65 | * the Classic Frame SKU + price). */ |
| 66 | export const NO_MAT_ID = 'nomat' as const; |
| 67 | export function isNoMat(id: string | null | undefined): boolean { |
| 68 | return id === NO_MAT_ID; |
| 69 | } |
| 70 | |
| 71 | // Normalise legacy / unknown mat ids to a current key. Old drafts / |
| 72 | // orders may carry `warmwhite` (since renamed to `offwhite`), `cream`, |
| 73 | // `hayseed`, or `none` from previous UI revisions. Legacy `none` was a |
| 74 | // default-mount placeholder (NOT today's `nomat` no-mat product), so it |
| 75 | // still resolves to snow white. |
| 76 | export function normalizeMatteId(id: string | null | undefined): MatteId { |
| 77 | if (!id) return 'snowwhite'; |
| 78 | if (id === 'warmwhite' || id === 'cream' || id === 'hayseed') return 'offwhite'; |
| 79 | if (id === 'none') return 'snowwhite'; |
| 80 | return id in MATTES ? (id as MatteId) : 'snowwhite'; |
| 81 | } |