|
| 1 | +import type { Meta, StoryObj } from '@storybook/react'; |
| 2 | +import { action } from '@storybook/addon-actions'; |
| 3 | +import { TasksView } from './TasksView'; |
| 4 | +import type { Reminder, DigitalColleague } from './TasksView'; |
| 5 | + |
| 6 | +const meta: Meta<typeof TasksView> = { |
| 7 | + title: 'DC/Views/TasksView', |
| 8 | + component: TasksView, |
| 9 | + parameters: { |
| 10 | + layout: 'fullscreen', |
| 11 | + }, |
| 12 | + tags: ['autodocs'], |
| 13 | +}; |
| 14 | + |
| 15 | +export default meta; |
| 16 | +type Story = StoryObj<typeof TasksView>; |
| 17 | + |
| 18 | +const mockColleagues: DigitalColleague[] = [ |
| 19 | + { id: '1', name: 'Alex AI', department: 'Development', role: 'Senior Developer' }, |
| 20 | + { id: '2', name: 'Maya Bot', department: 'Design', role: 'UX Designer' }, |
| 21 | + { id: '3', name: 'Sam Assistant', department: 'Marketing', role: 'Marketing Specialist' }, |
| 22 | + { id: '4', name: 'Jordan Helper', department: 'Support', role: 'Customer Success' }, |
| 23 | + { id: '5', name: 'Riley Automation', department: 'Operations', role: 'DevOps Engineer' }, |
| 24 | +]; |
| 25 | + |
| 26 | +const mockReminders: Reminder[] = [ |
| 27 | + { |
| 28 | + id: '1', |
| 29 | + title: 'Review quarterly report', |
| 30 | + description: 'Go through Q4 performance metrics and prepare summary for the team meeting', |
| 31 | + dueDate: new Date(2024, 2, 15), // March 15, 2024 |
| 32 | + dueTime: '14:30', |
| 33 | + colleague: mockColleagues[0], |
| 34 | + isCompleted: false, |
| 35 | + isRecurring: false, |
| 36 | + priority: 'high', |
| 37 | + reminderEnabled: true, |
| 38 | + reminderMinutes: 30, |
| 39 | + createdAt: new Date(2024, 2, 10), |
| 40 | + tags: ['quarterly', 'review', 'urgent'] |
| 41 | + }, |
| 42 | + { |
| 43 | + id: '2', |
| 44 | + title: 'Weekly team standup', |
| 45 | + description: 'Join the weekly team synchronization meeting to discuss progress and blockers', |
| 46 | + dueDate: new Date(2024, 2, 18), // March 18, 2024 |
| 47 | + dueTime: '10:00', |
| 48 | + colleague: mockColleagues[1], |
| 49 | + isCompleted: false, |
| 50 | + isRecurring: true, |
| 51 | + recurrencePattern: 'weekly', |
| 52 | + recurrenceInterval: 1, |
| 53 | + priority: 'medium', |
| 54 | + reminderEnabled: true, |
| 55 | + reminderMinutes: 15, |
| 56 | + createdAt: new Date(2024, 2, 11), |
| 57 | + tags: ['meeting', 'standup', 'weekly'] |
| 58 | + }, |
| 59 | + { |
| 60 | + id: '3', |
| 61 | + title: 'Update project documentation', |
| 62 | + description: 'Refresh the README and add new API documentation for the latest features', |
| 63 | + dueDate: new Date(2024, 2, 20), // March 20, 2024 |
| 64 | + colleague: mockColleagues[2], |
| 65 | + isCompleted: true, |
| 66 | + isRecurring: false, |
| 67 | + priority: 'low', |
| 68 | + reminderEnabled: false, |
| 69 | + createdAt: new Date(2024, 2, 12), |
| 70 | + completedAt: new Date(2024, 2, 19), |
| 71 | + tags: ['documentation', 'api'] |
| 72 | + }, |
| 73 | + { |
| 74 | + id: '4', |
| 75 | + title: 'Follow up on customer feedback', |
| 76 | + description: 'Reach out to customers who provided feedback last week and discuss next steps', |
| 77 | + dueDate: new Date(2024, 2, 14), // March 14, 2024 (overdue) |
| 78 | + dueTime: '16:00', |
| 79 | + colleague: mockColleagues[3], |
| 80 | + isCompleted: false, |
| 81 | + isRecurring: false, |
| 82 | + priority: 'high', |
| 83 | + reminderEnabled: true, |
| 84 | + reminderMinutes: 60, |
| 85 | + createdAt: new Date(2024, 2, 8), |
| 86 | + tags: ['customer', 'feedback', 'follow-up'] |
| 87 | + }, |
| 88 | + { |
| 89 | + id: '5', |
| 90 | + title: 'Monthly backup verification', |
| 91 | + description: 'Verify that all systems are backing up correctly and data integrity is maintained', |
| 92 | + dueDate: new Date(), // Today |
| 93 | + dueTime: '09:00', |
| 94 | + colleague: mockColleagues[4], |
| 95 | + isCompleted: false, |
| 96 | + isRecurring: true, |
| 97 | + recurrencePattern: 'monthly', |
| 98 | + recurrenceInterval: 1, |
| 99 | + priority: 'medium', |
| 100 | + reminderEnabled: true, |
| 101 | + reminderMinutes: 1440, // 1 day before |
| 102 | + createdAt: new Date(2024, 1, 15), |
| 103 | + tags: ['backup', 'verification', 'monthly', 'system'] |
| 104 | + }, |
| 105 | + { |
| 106 | + id: '6', |
| 107 | + title: 'Design review session', |
| 108 | + description: 'Review the latest mockups and prototypes with the design team', |
| 109 | + dueDate: new Date(Date.now() + 24 * 60 * 60 * 1000), // Tomorrow |
| 110 | + dueTime: '11:30', |
| 111 | + colleague: mockColleagues[1], |
| 112 | + isCompleted: false, |
| 113 | + isRecurring: false, |
| 114 | + priority: 'medium', |
| 115 | + reminderEnabled: true, |
| 116 | + reminderMinutes: 30, |
| 117 | + createdAt: new Date(), |
| 118 | + tags: ['design', 'review', 'mockups'] |
| 119 | + } |
| 120 | +]; |
| 121 | + |
| 122 | +export const Default: Story = { |
| 123 | + args: { |
| 124 | + initialReminders: mockReminders, |
| 125 | + initialColleagues: mockColleagues, |
| 126 | + onAddReminder: action('onAddReminder'), |
| 127 | + onUpdateReminder: action('onUpdateReminder'), |
| 128 | + onDeleteReminder: action('onDeleteReminder'), |
| 129 | + }, |
| 130 | +}; |
| 131 | + |
| 132 | +export const Empty: Story = { |
| 133 | + args: { |
| 134 | + initialReminders: [], |
| 135 | + initialColleagues: mockColleagues, |
| 136 | + onAddReminder: action('onAddReminder'), |
| 137 | + onUpdateReminder: action('onUpdateReminder'), |
| 138 | + onDeleteReminder: action('onDeleteReminder'), |
| 139 | + }, |
| 140 | +}; |
| 141 | + |
| 142 | +export const CompletedOnly: Story = { |
| 143 | + args: { |
| 144 | + initialReminders: mockReminders.filter(r => r.isCompleted), |
| 145 | + initialColleagues: mockColleagues, |
| 146 | + onAddReminder: action('onAddReminder'), |
| 147 | + onUpdateReminder: action('onUpdateReminder'), |
| 148 | + onDeleteReminder: action('onDeleteReminder'), |
| 149 | + }, |
| 150 | +}; |
| 151 | + |
| 152 | +export const OverdueOnly: Story = { |
| 153 | + args: { |
| 154 | + initialReminders: mockReminders.filter(r => { |
| 155 | + const now = new Date(); |
| 156 | + const due = new Date(r.dueDate); |
| 157 | + if (r.dueTime) { |
| 158 | + const [hours, minutes] = r.dueTime.split(':'); |
| 159 | + due.setHours(parseInt(hours), parseInt(minutes)); |
| 160 | + } |
| 161 | + return due < now && !r.isCompleted; |
| 162 | + }), |
| 163 | + initialColleagues: mockColleagues, |
| 164 | + onAddReminder: action('onAddReminder'), |
| 165 | + onUpdateReminder: action('onUpdateReminder'), |
| 166 | + onDeleteReminder: action('onDeleteReminder'), |
| 167 | + }, |
| 168 | +}; |
| 169 | + |
| 170 | +export const HighPriorityOnly: Story = { |
| 171 | + args: { |
| 172 | + initialReminders: mockReminders.filter(r => r.priority === 'high'), |
| 173 | + initialColleagues: mockColleagues, |
| 174 | + onAddReminder: action('onAddReminder'), |
| 175 | + onUpdateReminder: action('onUpdateReminder'), |
| 176 | + onDeleteReminder: action('onDeleteReminder'), |
| 177 | + }, |
| 178 | +}; |
| 179 | + |
| 180 | +export const RecurringOnly: Story = { |
| 181 | + args: { |
| 182 | + initialReminders: mockReminders.filter(r => r.isRecurring), |
| 183 | + initialColleagues: mockColleagues, |
| 184 | + onAddReminder: action('onAddReminder'), |
| 185 | + onUpdateReminder: action('onUpdateReminder'), |
| 186 | + onDeleteReminder: action('onDeleteReminder'), |
| 187 | + }, |
| 188 | +}; |
| 189 | + |
| 190 | +export const WithInteractions: Story = { |
| 191 | + args: { |
| 192 | + initialReminders: mockReminders, |
| 193 | + initialColleagues: mockColleagues, |
| 194 | + onAddReminder: action('onAddReminder'), |
| 195 | + onUpdateReminder: action('onUpdateReminder'), |
| 196 | + onDeleteReminder: action('onDeleteReminder'), |
| 197 | + }, |
| 198 | +}; |
0 commit comments