Tasks & Email
Last updated on 2026-09-02
The tasks and email modules provide productivity tools for CRM users. All data is stored in Supabase and all mutations use Server Actions. Tasks cover to-dos, calendar scheduling, and activity logging. Email provides an integrated inbox, compose workflow, templates, and automated sequences.
Task List
Route: /tasks
A task management view with real CRUD operations against the tasks table.
- Task items -- checkbox (calls
updateTaskServer Action to toggle status), title, priority flag (high = red, medium = amber, low = green), due date badge (color-coded), assignee avatar, and linked contact/deal names (from joined queries) - Filter tabs -- My Tasks (filtered by
assignee_id = auth.uid()), All Tasks, and Completed (filtered bystatus = 'completed') - Search -- text input filtering tasks by title via Supabase
.ilike() - Sort options -- sort by due date, priority, or creation date via
.order() - Add task dialog -- modal form that calls
createTaskServer Action with title, description, priority, due date, assignee (fromprofiles), and optional contact/deal links - Inline edit -- click task title to edit inline; saves via
updateTaskServer Action - Bulk actions -- select multiple tasks to mark complete or delete via batch Server Actions
Priority Indicators
| Priority | Color | Flag Icon |
|---|---|---|
| High | red (text-red-500) |
FlagTriangleRight filled |
| Medium | amber (text-amber-500) |
FlagTriangleRight filled |
| Low | green (text-green-500) |
FlagTriangleRight outline |
Due Date Badges
| Status | Color | Condition |
|---|---|---|
| Overdue | red background | due_date < today |
| Due today | amber background | due_date === today |
| Due this week | blue background | due_date within 7 days |
| Upcoming | gray background | due_date > 7 days |
Data Sources
| Data | Source | Query |
|---|---|---|
| Tasks | tasks table |
With assignee, contact, and deal joins |
| Team members | profiles table |
For assignee select |
| Contacts | contacts table |
For contact linking |
| Deals | deals table |
For deal linking |
Calendar
Route: /tasks/calendar
A monthly calendar grid displaying tasks and activities from Supabase.
- Monthly grid -- calendar cells with event pills for each day, queried by date range from
tasksandactivities - Event pills -- color-coded by type: meeting = blue, call = green, task = orange, email = purple
- Day click -- opens detail panel listing all events for that day with full details
- Month navigation -- previous/next month buttons and "Today" button
- Event creation -- double-click a day to open the add task dialog pre-filled with that date
- Responsive -- on mobile, collapses to a list view grouped by day
Event Type Colors
| Type | Pill Color | Icon |
|---|---|---|
| Meeting | blue (bg-blue-100 text-blue-700) |
Calendar |
| Call | green (bg-green-100 text-green-700) |
Phone |
| Task | orange (bg-orange-100 text-orange-700) |
CheckSquare |
purple (bg-purple-100 text-purple-700) |
Mail |
Activity Log
Route: /tasks/activity
A comprehensive log of all CRM activities from the activities table.
- Activity entries -- type icon, description, user avatar and name (joined from
profiles), related entity links (contact, deal, company), and timestamp - Filters -- filter by user, activity type (multi-select), and date range; all filters translate to Supabase query parameters
- Pagination -- server-side pagination via
.range() - Export -- button to export the filtered activity log as CSV
Email Inbox
Route: /email
A Gmail-style email inbox with data from the emails table.
- Folder tabs -- Inbox, Sent, and Drafts filtered by
emails.foldercolumn; unread count badges fromcountquery withis_read = false - Email list -- sender avatar, name, subject (bold if unread), preview snippet, timestamp, and star toggle (calls
updateEmailServer Action to toggleis_starred) - Reading pane -- side panel showing full email content with sender info and reply/forward buttons
- Search -- text input filtering by sender, subject, or body via Supabase
.or(ilike)query - CRM contact linking -- sender email is matched against
contacts.emailto link to contact detail - Bulk actions -- mark as read, star, or delete via batch Server Actions
Inbox Layout
+---------------+-------------------------------+
| [Inbox] | From: John Smith |
| [Sent] | Subject: Re: Proposal Review |
| [Drafts] | Date: Sep 1, 2026 10:30 AM |
|---------------+ |
| * Email 1 | Hi Sarah, |
| Email 2 | |
| Email 3 | I've reviewed the proposal... |
| * Email 4 | |
| Email 5 | [Reply] [Forward] |
+---------------+-------------------------------+
Email Compose
Route: /email/compose
A composition screen that creates emails via the createEmail Server Action.
- To field -- input with contact autocomplete querying
contactsby name or email - CC/BCC -- expandable fields with the same autocomplete
- Subject -- text input
- Body -- textarea with basic formatting toolbar
- Template insertion -- "Insert Template" button queries
email_templatesfrom Supabase; merge fields are populated from the linked contact/deal data - CRM linking -- dropdown to associate the email with a contact or deal; the
contact_idanddeal_idare stored on the email record - Send -- calls
createEmailwithfolder = 'sent'and also creates an activity record
Email Templates
Route: /tasks/templates
A library of reusable email templates stored in the email_templates table.
- Template list -- card grid showing template name, subject preview, category badge, usage count, and last modified date
- Search -- text input filtering by name or subject
- Category filter -- dropdown filter by template category
- Create template -- modal form that calls
createEmailTemplateServer Action - Merge fields --
{{firstName}},{{companyName}},{{dealName}},{{dealValue}},{{ownerName}},{{meetingDate}} - Edit/duplicate/delete -- per-template actions via Server Actions
- Preview -- modal rendering the template with sample merge field data
Available Merge Fields
| Field | Token | Example Output |
|---|---|---|
| First Name | {{firstName}} |
John |
| Last Name | {{lastName}} |
Smith |
| Company Name | {{companyName}} |
Acme Corp |
| Deal Name | {{dealName}} |
Enterprise License |
| Deal Value | {{dealValue}} |
$45,000 |
| Owner Name | {{ownerName}} |
Sarah Chen |
| Meeting Date | {{meetingDate}} |
September 5, 2026 |
Email Sequences
Route: /email/sequences
Automated email sequence management stored in email_sequences and email_sequence_steps.
- Sequence list -- data table showing name, status badge (Active = green, Paused = amber, Draft = gray), step count (from
email_sequence_stepscount), enrolled contacts, open rate, and reply rate - Sequence detail -- step builder with ordered steps from
email_sequence_steps:- Email steps -- linked to an
email_templateor custom content - Wait steps -- configurable
delay_days - Condition steps -- branch on
opened,clicked, orreplied - Add/reorder steps -- calls
createSequenceStepandupdateSequenceStepServer Actions
- Email steps -- linked to an
- Create/edit sequence -- calls
createEmailSequenceorupdateEmailSequenceServer Actions
Sequence Step Types
| Step Type | Icon | Description |
|---|---|---|
Mail |
Send an email using a template or custom content | |
| Wait | Clock |
Pause the sequence for N days |
| Condition | GitBranch |
Branch based on recipient behavior |
Next Steps
- Reports & Analytics -- sales dashboards and pipeline analytics
- Deals & Pipeline -- Kanban pipeline board and deal management
- Server Actions -- complete reference for all mutations