Skip to content

Commit dbc0496

Browse files
committed
data: added actions to preStatements
1 parent 921301c commit dbc0496

File tree

5 files changed

+118
-4
lines changed

5 files changed

+118
-4
lines changed

data/preStatements.json

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,36 @@
33
"id": "1",
44
"verb": "Support",
55
"object": "their team",
6-
"isPublic": true
6+
"isPublic": true,
7+
"actions": [
8+
{
9+
"id": "a1",
10+
"creationDate": "2024-02-15T10:00:00.000Z",
11+
"dueDate": "2024-02-20T10:00:00.000Z",
12+
"text": "Schedule team meeting"
13+
},
14+
{
15+
"id": "a2",
16+
"creationDate": "2024-02-15T10:00:00.000Z",
17+
"dueDate": "2024-02-22T10:00:00.000Z",
18+
"text": "Send follow-up email"
19+
}
20+
]
721
},
822
{
923
"id": "2",
1024
"descriptor": "coding practice",
1125
"verb": "Improve",
1226
"object": "software quality",
13-
"isPublic": false
27+
"isPublic": false,
28+
"actions": [
29+
{
30+
"id": "a3",
31+
"creationDate": "2024-02-16T10:00:00.000Z",
32+
"dueDate": "2024-02-25T10:00:00.000Z",
33+
"text": "Review coding guidelines"
34+
}
35+
]
1436
},
1537
{
1638
"id": "3",
@@ -23,7 +45,15 @@
2345
"descriptor": "marketing ideas",
2446
"verb": "Engage",
2547
"object": "potential customers",
26-
"isPublic": true
48+
"isPublic": true,
49+
"actions": [
50+
{
51+
"id": "a4",
52+
"creationDate": "2024-02-17T10:00:00.000Z",
53+
"dueDate": "2024-02-28T10:00:00.000Z",
54+
"text": "Draft social media campaign"
55+
}
56+
]
2757
},
2858
{
2959
"id": "5",

package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"clsx": "^2.1.1",
2323
"cmdk": "^1.0.4",
2424
"compromise": "^14.14.4",
25+
"date-fns": "^4.1.0",
2526
"framer-motion": "^12.4.1",
2627
"lucide-react": "^0.475.0",
2728
"react": "^18.3.1",
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import React from 'react';
2+
import { format } from 'date-fns';
3+
import { MoreVertical, Edit2, Trash2, Plus } from 'lucide-react';
4+
import { Button } from '../ui/button';
5+
import {
6+
DropdownMenu,
7+
DropdownMenuTrigger,
8+
DropdownMenuContent,
9+
DropdownMenuItem,
10+
} from '../ui/dropdown-menu';
11+
import type { Action } from '../../../types/types';
12+
13+
export interface ActionPreviewProps {
14+
actions: Action[];
15+
onEditAction: (actionId: string) => void;
16+
onDeleteAction: (actionId: string) => void;
17+
onAddAction: () => void;
18+
}
19+
20+
const ActionPreview: React.FC<ActionPreviewProps> = ({
21+
actions,
22+
onEditAction,
23+
onDeleteAction,
24+
onAddAction,
25+
}) => {
26+
return (
27+
<div className='space-y-2 mt-4'>
28+
{actions.map((action) => (
29+
<div
30+
key={action.id}
31+
className='bg-gray-50 p-3 rounded-lg flex items-center justify-between'
32+
>
33+
<div>
34+
<p>{action.text}</p>
35+
<p className='text-sm text-gray-500 mt-1'>
36+
Due: {format(new Date(action.dueDate), 'PP')}
37+
</p>
38+
</div>
39+
<DropdownMenu>
40+
<DropdownMenuTrigger asChild>
41+
<Button variant='ghost' size='icon'>
42+
<MoreVertical size={18} className='text-gray-500' />
43+
</Button>
44+
</DropdownMenuTrigger>
45+
<DropdownMenuContent align='end'>
46+
<DropdownMenuItem onClick={() => onEditAction(action.id)}>
47+
<Edit2 className='mr-2 h-4 w-4' />
48+
Edit
49+
</DropdownMenuItem>
50+
<DropdownMenuItem
51+
onClick={() => onDeleteAction(action.id)}
52+
className='text-red-600'
53+
>
54+
<Trash2 className='mr-2 h-4 w-4' />
55+
Delete
56+
</DropdownMenuItem>
57+
</DropdownMenuContent>
58+
</DropdownMenu>
59+
</div>
60+
))}
61+
<div
62+
className='bg-gray-50 p-3 rounded-lg flex items-center justify-center cursor-pointer hover:bg-gray-100'
63+
onClick={onAddAction}
64+
>
65+
<Plus className='w-4 h-4 mr-2' />
66+
<span>Add Action</span>
67+
</div>
68+
</div>
69+
);
70+
};
71+
72+
export default ActionPreview;

types/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export interface Action {
22
id: string;
33
creationDate: string;
44
dueDate: string;
5-
action: string;
5+
text: string;
66
}
77
export interface Statement {
88
id: string;

0 commit comments

Comments
 (0)