Assign Brand Template, Algolia Search, Sales Rep & 2D Ruler

Brand Template panel fetches live data via Algolia search and Game One API, sales rep assignment with email form, inline Auth panel in builder, and Photoshop-style ruler with guidelines for the 2D canvas.

Overview

This release delivers four builder enhancements: Assign Brand Template with live Algolia-backed customer search and full customer detail fetch; Sales Rep assignment and email from the canvas; an inline Auth panel in the builder for sign-in/sign-up without leaving the flow; and a 2D ruler with draggable guidelines for precise layout.

Assign Brand Template — Algolia Data Fetch

Search Endpoint

The Brand Template panel searches for customers via a Next.js API route that proxies to Algolia. This keeps the Algolia API key server-side and supports facet filters.

ComponentPurpose
/api/customers/searchServer-side proxy to Algolia REST API
brand-template.service.tssearchCustomers(query) — calls the API; getCustomerWithAssets(custNumber) — fetches full details from Game One
AlgoliaCustomerHitType for search results (name, cust_number, location, colors, sales_rep)
GameOneCustomerResponseFull customer payload with assets, logos, colors

Flow

  1. User types 5+ characters in the Brand Template search field
  2. Debounced request hits /api/customers/search with query
  3. Algolia returns hits; panel displays BrandResultCard list (name, location, color swatches)
  4. User clicks a result → getCustomerWithAssets() fetches full customer details + assets from Game One
  5. User confirms → colors and logos are applied to the builder session; sales_rep is stored in brand template context

Environment

  • ALGOLIA_APP_ID and ALGOLIA_API_KEY required for customer search
  • NEXT_PUBLIC_GAME_ONE_API_URL for full customer + asset fetch

Sales Rep Assignment and Email

Assignment Flow

When a brand template is applied, the selected customer's sales rep (name, ID, email) is stored and displayed in the canvas area.

Sales Rep Badge

ComponentPurpose
SalesRepBadgeFloating badge at bottom-right of canvas; shows rep name and avatar
SalesRepEmailPopoverPopover with subject + message form; sends email to the rep
sendRepEmailActionServer action that dispatches the email via configured transport

User States

StateBehavior
Authenticated + template appliedBadge shows rep info; "Email" button opens popover to compose and send
Authenticated, no templateBadge prompts "Assign your sales rep" (apply a brand template)
GuestBadge prompts "Sign up to assign your sales rep" — opens Auth panel

Technical Details

  • template.sales_rep, template.sales_rep_id, template.sales_rep_email from BrandTemplateContext
  • Schema: repEmail, subject, message with Zod validation
  • Translations: builder:salesRep.*

Auth Container in Builder

Inline Auth Panel

An Auth panel renders in the same 1/3-width slot used by Builder Steps, Brand Template, and Quotes. It allows guests to sign in or sign up without leaving the builder.

ComponentPurpose
AuthPanelRenders SignInMethodsContainer or SignUpMethodsContainer with tab switcher
AuthPanelProviderContext: isAuthPanelOpen, authMode, openAuthPanel, closeAuthPanel
useAuthPanelSafeReturns context or null (safe for optional use)

Panel Priority

Only one overlay panel can be open at a time. Priority order:

  1. AuthPanel — when auth panel is open (highest priority)
  2. QuotesPanel — My Quotes
  3. BrandTemplatePanel — Assign Brand Template
  4. BuilderStepsPanel — Default step content

Triggers

  • Sidebar — "Sign In" / "Sign Up" buttons in Quick Actions
  • Sales Rep Badge — When guest, "Sign up to assign your sales rep" opens auth in sign-up mode
  • Quote WizardQuoteAuthGate handles auth within the quote flow (separate from AuthPanel)

Behavior

  • Listens for Supabase SIGNED_IN event → closes panel and calls router.refresh()
  • Return path after auth is the current page URL (user stays in builder)

Ruler for 2D Canvas

Canvas Ruler Component

Photoshop/Illustrator-style rulers on the top (horizontal) and left (vertical) edges of the 2D canvas, with draggable guidelines.

FeatureDetail
Rulers24px bars with tick marks (minor 10px, medium 50px, major 100px with labels)
GuidelinesCyan lines; drag to reposition; drag back to ruler or double-click to remove
CornerDouble-click corner square to clear all guidelines
VisibilityOnly shown in 2D mode (visible prop)
Mouse indicatorPosition indicator on ruler edges when hovering over content

Interaction

  • Drag from horizontal ruler → create horizontal guideline
  • Drag from vertical ruler → create vertical guideline
  • Drag existing guideline → reposition
  • Drag guideline back onto ruler → remove
  • Double-click guideline → remove
  • Double-click corner → clear all

Guidelines are purely visual — they do not snap or constrain canvas objects.

Integration

FileRole
canvas-ruler.tsxCanvasRuler component; drawHorizontalRuler, drawVerticalRuler helpers
use-guidelines.tsHook for guideline state (add, update, remove, clear)
builder-canvas-panel.tsxWraps fabric canvas with CanvasRuler; ruler toolbar toggle in canvas-toolbar.tsx

Integration Summary

AreaKey Files
Algolia / Brand Templateapi/customers/search/route.ts, brand-template.service.ts, brand-template-panel.tsx
Sales Repsales-rep-badge.tsx, sales-rep-email-popover.tsx, send-rep-email.action.ts
Authauth-panel.tsx, auth-panel-provider.tsx, builder-layout.tsx
Rulercanvas-ruler.tsx, use-guidelines.ts, builder-canvas-panel.tsx