/// /** * Email Pattern Dreamer * * A simplified dashboard that shows all email-based patterns with their previews. * Unlike the launcher, this doesn't do email matching - it just renders all patterns. * * Usage: * 1. Deploy a google-auth piece and complete OAuth * 2. Deploy this pattern * 3. Link: ct piece link google-auth/auth email-pattern-dreamer/overrideAuth */ import { NAME, pattern, UI } from "commontools"; import GmailImporter, { type Auth } from "../core/gmail-importer.tsx"; import USPSInformedDeliveryPattern from "./usps-informed-delivery.tsx"; import BerkeleyLibraryPattern from "./berkeley-library.tsx"; import ChaseBillPattern from "./chase-bill-tracker.tsx"; import BAMSchoolDashboardPattern from "./bam-school-dashboard.tsx"; import BofABillTrackerPattern from "./bofa-bill-tracker.tsx"; import EmailTicketFinderPattern from "./email-ticket-finder.tsx"; import CalendarChangeDetectorPattern from "./calendar-change-detector.tsx"; import EmailNotesPattern from "./email-notes.tsx"; import UnitedFlightTrackerPattern from "./united-flight-tracker.tsx"; interface PatternInput { overrideAuth?: Auth; } export default pattern(({ overrideAuth }) => { // Gmail auth for the auth UI only (no email fetching needed) const gmailAuth = GmailImporter({ settings: { gmailFilterQuery: "", limit: 0, debugMode: false, autoFetchOnAuth: false, resolveInlineImages: false, }, overrideAuth, }); // Instantiate all patterns directly const usps = USPSInformedDeliveryPattern({ overrideAuth }); const library = BerkeleyLibraryPattern({ overrideAuth }); const chase = ChaseBillPattern({ overrideAuth }); const bam = BAMSchoolDashboardPattern({ overrideAuth }); const bofa = BofABillTrackerPattern({ overrideAuth }); const tickets = EmailTicketFinderPattern({ overrideAuth }); const calendar = CalendarChangeDetectorPattern({ overrideAuth }); const notes = EmailNotesPattern({ overrideAuth }); const united = UnitedFlightTrackerPattern({ overrideAuth }); const previewUI = ( 9 Email Pattern Dreamer 9 patterns available ); const cardStyle = { padding: "16px", backgroundColor: "#ffffff", borderRadius: "12px", border: "1px solid #e5e7eb", boxShadow: "0 1px 3px rgba(0,0,0,0.1)", }; const headerStyle = { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "12px", }; const previewBoxStyle = { padding: "12px", backgroundColor: "#f9fafb", borderRadius: "8px", }; return { [NAME]: "Email Pattern Dreamer", usps, library, chase, bam, bofa, tickets, calendar, notes, united, previewUI, [UI]: ( Email Pattern Dreamer {gmailAuth.authUI} Patterns launched based on your emails {/* USPS */} USPS Informed Delivery Open {usps.previewUI as any} {/* Berkeley Library */} Berkeley Library Open {library.previewUI as any} {/* Chase */} Chase Bill Tracker Open {chase.previewUI as any} {/* BAM School */} BAM School Dashboard Open {bam.previewUI as any} {/* BofA */} Bank of America Bills Open {bofa.previewUI as any} {/* Tickets */} Email Ticket Finder Open {tickets.previewUI as any} {/* Calendar */} Calendar Change Detector Open {calendar.previewUI as any} {/* Notes */} Email Notes Open {notes.previewUI as any} {/* United */} United Flight Tracker Open {united.previewUI as any} ), }; });