Skip to content

Commit 079c7ca

Browse files
committed
feat(templates): create home templates
1 parent f86e67d commit 079c7ca

File tree

10 files changed

+115
-13
lines changed

10 files changed

+115
-13
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export { MessageContent } from './message-content'
22
export { MothershipView } from './mothership-view'
3+
export { TemplatePrompts } from './template-prompts'
34
export { UserInput } from './user-input'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { TemplatePrompts } from './template-prompts'
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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+
}

apps/sim/app/workspace/[workspaceId]/home/home.tsx

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
import { persistImportedWorkflow } from '@/lib/workflows/operations/import-export'
1717
import { useChatHistory } from '@/hooks/queries/tasks'
1818
import { useSidebarStore } from '@/stores/sidebar/store'
19-
import { MessageContent, MothershipView, UserInput } from './components'
19+
import { MessageContent, MothershipView, TemplatePrompts, UserInput } from './components'
2020
import type { FileAttachmentForApi } from './components/user-input/user-input'
2121
import { useAutoScroll, useChat } from './hooks'
2222

@@ -211,18 +211,24 @@ export function Home({ chatId }: HomeProps = {}) {
211211

212212
if (!hasMessages) {
213213
return (
214-
<div className='flex h-full flex-col items-center justify-center bg-[var(--bg)] px-[24px]'>
215-
<h1 className='mb-[24px] font-[450] font-season text-[32px] text-[var(--text-primary)] tracking-[-0.02em]'>
216-
What should we get done{session?.user?.name ? `, ${session.user.name.split(' ')[0]}` : ''}
217-
?
218-
</h1>
219-
<UserInput
220-
defaultValue={initialPrompt}
221-
onSubmit={handleSubmit}
222-
isSending={isSending}
223-
onStopGeneration={stopGeneration}
224-
userId={session?.user?.id}
225-
/>
214+
<div className='h-full overflow-y-auto bg-[var(--bg)]'>
215+
<div className='flex min-h-full flex-col items-center px-[24px]'>
216+
<div className='min-h-[30vh] flex-1' />
217+
<h1 className='mb-[24px] max-w-[42rem] font-[440] font-season text-[32px] text-[var(--text-primary)] tracking-[-0.02em]'>
218+
What should we get done
219+
{session?.user?.name ? `, ${session.user.name.split(' ')[0]}` : ''}?
220+
</h1>
221+
<UserInput
222+
defaultValue={initialPrompt}
223+
onSubmit={handleSubmit}
224+
isSending={isSending}
225+
onStopGeneration={stopGeneration}
226+
userId={session?.user?.id}
227+
/>
228+
<div className='w-full max-w-[42rem] pt-[48px] pb-[32px]'>
229+
<TemplatePrompts onSelect={(prompt) => handleSubmit(prompt)} />
230+
</div>
231+
</div>
226232
</div>
227233
)
228234
}
50.7 KB
Loading
80.4 KB
Loading
30.7 KB
Loading
33.5 KB
Loading
27.6 KB
Loading
54.4 KB
Loading

0 commit comments

Comments
 (0)