Skip to main content

Page Presets

Overview

Page Presets allow vendors to save complete page configuration including all settings tabs (page, button, security, printer, voucher). This is a comprehensive preset that covers the entire customization panel.

Data Model

interface PagePreset {
id: string; // Generated ID (e.g., "pagepreset_xxxxx")
name: string; // User-defined name
pageSettings: PageSettings;
button: ButtonSettings;
security: SecuritySettings;
printer: PrinterSettings;
voucher: VoucherSettings;
createdAt: string; // ISO timestamp
updatedAt: string; // ISO timestamp
}

interface PageSettings {
background: string | { type: 'color'; value: string } | { type: 'gradient'; value: string };
title: { text: string; font: string; color: string };
subtitle: { text: string; font: string; color: string };
}

Storage

Presets are stored in IndexedDB (via dualStore) with key: photobooth-page-presets

API Functions

FunctionParametersReturnsDescription
listPagePresets()nonePromise<PagePreset[]>List all presets, sorted by updatedAt
savePagePreset(name, preset)name: string, preset: Omit<PagePreset, 'id'|'createdAt'|'updatedAt'>Promise<PagePreset>Create or update preset
deletePagePreset(id)id: stringPromise<void>Delete preset by ID

Usage Flow

  1. Configure: Vendor sets all desired settings in customization panel
  2. Save: Vendor enters name to save complete configuration
  3. Apply: Selecting a preset loads all settings at once
  4. Switch: Vendors can quickly switch between different event configurations

Code Reference

  • Library: apps/web/lib/page-presets.ts
  • Types: apps/web/features/customization/types.ts
  • Storage: apps/web/infra/persistence/dual-store.ts

Key Implementation Details

  • Unlike Frame Presets (single setting), Page Presets capture ALL customization tabs
  • Useful for vendors who run different types of events (weddings, corporate, birthdays)
  • Schema validation uses Zod for type safety