|
| 1 | +import type { ComponentType, SVGProps } from 'react' |
| 2 | +import Image from 'next/image' |
| 3 | +import { Calendar, Search, Table } from '@/components/emcn/icons' |
| 4 | +import { GmailIcon } from '@/components/icons' |
| 5 | +import { MarkdownIcon } from '@/components/icons/document-icons' |
| 6 | + |
| 7 | +interface TemplatePrompt { |
| 8 | + icon: ComponentType<SVGProps<SVGSVGElement>> |
| 9 | + title: string |
| 10 | + prompt: string |
| 11 | + image: string |
| 12 | +} |
| 13 | + |
| 14 | +const TEMPLATES: TemplatePrompt[] = [ |
| 15 | + { |
| 16 | + icon: Table, |
| 17 | + title: 'Self-populating CRM', |
| 18 | + prompt: |
| 19 | + 'Create a self-healing CRM table that keeps track of all my customers by integrating with my existing data sources. Schedule a recurring job every morning to automatically pull updates from all relevant data sources and keep my CRM up to date.', |
| 20 | + image: '/templates/crm-light.png', |
| 21 | + }, |
| 22 | + { |
| 23 | + icon: GmailIcon, |
| 24 | + title: 'Auto-reply agent', |
| 25 | + prompt: 'Create a Gmail agent that drafts responses to relevant emails automatically.', |
| 26 | + image: '/templates/gmail-agent-dark.png', |
| 27 | + }, |
| 28 | + { |
| 29 | + icon: MarkdownIcon, |
| 30 | + title: 'Resolve todo list', |
| 31 | + prompt: |
| 32 | + 'Create a file of all my todos then go one by one and check off every time a todo is done. Look at my calendar and see what I have to do.', |
| 33 | + image: '/templates/todo-list-light.png', |
| 34 | + }, |
| 35 | + { |
| 36 | + icon: Search, |
| 37 | + title: 'Research assistant', |
| 38 | + prompt: |
| 39 | + 'Build an agent that takes a topic, searches the web for the latest information, summarizes key findings, and compiles them into a clean document I can review.', |
| 40 | + image: '/templates/research-assistant-dark.png', |
| 41 | + }, |
| 42 | + { |
| 43 | + icon: Calendar, |
| 44 | + title: 'Meeting prep agent', |
| 45 | + prompt: |
| 46 | + 'Create an agent that checks my calendar each morning, pulls context on every attendee and topic, and prepares a brief for each meeting so I walk in fully prepared.', |
| 47 | + image: '/templates/meeting-prep-dark.png', |
| 48 | + }, |
| 49 | + { |
| 50 | + icon: Table, |
| 51 | + title: 'Expense tracker', |
| 52 | + prompt: |
| 53 | + 'Create a table that tracks all my expenses by pulling transactions from my connected accounts. Categorize each expense automatically and generate a weekly summary report.', |
| 54 | + image: '/templates/expense-tracker-light.png', |
| 55 | + }, |
| 56 | +] |
| 57 | + |
| 58 | +interface TemplatePromptsProps { |
| 59 | + onSelect: (prompt: string) => void |
| 60 | +} |
| 61 | + |
| 62 | +export function TemplatePrompts({ onSelect }: TemplatePromptsProps) { |
| 63 | + return ( |
| 64 | + <div className='grid grid-cols-3 gap-[12px]'> |
| 65 | + {TEMPLATES.map((template) => { |
| 66 | + const Icon = template.icon |
| 67 | + return ( |
| 68 | + <button |
| 69 | + key={template.title} |
| 70 | + type='button' |
| 71 | + onClick={() => onSelect(template.prompt)} |
| 72 | + className='group flex cursor-pointer flex-col overflow-hidden rounded-[12px] border border-[var(--border-1)] bg-[var(--white)] text-left transition-colors hover:bg-[var(--surface-5)] dark:bg-[var(--surface-4)]' |
| 73 | + > |
| 74 | + <div className='relative h-[120px] overflow-hidden'> |
| 75 | + <Image |
| 76 | + src={template.image} |
| 77 | + alt={template.title} |
| 78 | + fill |
| 79 | + unoptimized |
| 80 | + className='object-cover transition-transform duration-300 group-hover:scale-105' |
| 81 | + /> |
| 82 | + </div> |
| 83 | + <div className='flex items-center gap-[8px] border-[var(--border-1)] border-t px-[12px] py-[10px]'> |
| 84 | + <Icon className='h-[14px] w-[14px] shrink-0 text-[var(--text-icon)]' /> |
| 85 | + <span className='font-medium text-[14px] text-[var(--text-body)]'> |
| 86 | + {template.title} |
| 87 | + </span> |
| 88 | + </div> |
| 89 | + </button> |
| 90 | + ) |
| 91 | + })} |
| 92 | + </div> |
| 93 | + ) |
| 94 | +} |
0 commit comments