diff --git a/app/.prettierrc b/app/.prettierrc new file mode 100644 index 0000000..2b3e125 --- /dev/null +++ b/app/.prettierrc @@ -0,0 +1,8 @@ +{ + "trailingComma": "es5", + "semi": true, + "singleQuote": true, + "endOfLine": "lf", + "tabWidth": 2, + "jsxSingleQuote": true +} diff --git a/app/main.wasp b/app/main.wasp index 5e4e3ef..f0ce5b1 100644 --- a/app/main.wasp +++ b/app/main.wasp @@ -83,6 +83,9 @@ app SaaSTemplate { ("@faker-js/faker", "8.3.1"), ("@google-analytics/data", "4.1.0"), ("openai", "^4.24.1"), + ("lucide-react", "0.306.0"), + ("prettier", "3.1.1"), + ("prettier-plugin-tailwindcss", "0.5.11") ], } diff --git a/app/src/client/app/DemoAppPage.tsx b/app/src/client/app/DemoAppPage.tsx index a8b654b..46a7b30 100644 --- a/app/src/client/app/DemoAppPage.tsx +++ b/app/src/client/app/DemoAppPage.tsx @@ -7,6 +7,7 @@ import { useQuery } from '@wasp/queries'; import getAllTasksByUser from '@wasp/queries/getAllTasksByUser'; import { Task } from '@wasp/entities'; import { CgSpinner } from 'react-icons/cg'; +import { XSquare } from 'lucide-react'; export default function DemoAppPage() { return ( @@ -35,12 +36,20 @@ export default function DemoAppPage() { type TodoProps = Pick; function Todo({ id, isDone, description, time }: TodoProps) { - const handleCheckboxChange = async (e: React.ChangeEvent) => { - await updateTask({ id, isDone: e.currentTarget.checked }); + const handleCheckboxChange = async ( + e: React.ChangeEvent + ) => { + await updateTask({ + id, + isDone: e.currentTarget.checked, + }); }; const handleTimeChange = async (e: React.ChangeEvent) => { - await updateTask({ id, time: e.currentTarget.value }); + await updateTask({ + id, + time: e.currentTarget.value, + }); }; const handleDeleteClick = async () => { @@ -53,11 +62,17 @@ function Todo({ id, isDone, description, time }: TodoProps) {
- {description} + + {description} +
- hrs + + hrs +
-
); } -function NewTaskForm({ handleCreateTask }: { handleCreateTask: typeof createTask }) { +function NewTaskForm({ + handleCreateTask, +}: { + handleCreateTask: typeof createTask; +}) { const [description, setDescription] = useState(''); const [todaysHours, setTodaysHours] = useState('8'); const [response, setResponse] = useState(null); const [isPlanGenerating, setIsPlanGenerating] = useState(false); - const { data: tasks, isLoading: isTasksLoading } = useQuery(getAllTasksByUser); + const { data: tasks, isLoading: isTasksLoading } = + useQuery(getAllTasksByUser); useEffect(() => { console.log('response', response); @@ -107,7 +133,9 @@ function NewTaskForm({ handleCreateTask }: { handleCreateTask: typeof createTask const handleGeneratePlan = async () => { try { setIsPlanGenerating(true); - const response = await generateGptResponse({ hours: todaysHours }); + const response = await generateGptResponse({ + hours: todaysHours, + }); if (response) { console.log('response', response); setResponse(JSON.parse(response)); @@ -130,6 +158,11 @@ function NewTaskForm({ handleCreateTask }: { handleCreateTask: typeof createTask placeholder='Enter task description' value={description} onChange={(e) => setDescription(e.currentTarget.value)} + onKeyDown={(e) => { + if (e.key === 'Enter') { + handleSubmit(); + } + }} /> {!!response && (
-

Today's Schedule

+

+ Today's Schedule +

@@ -210,11 +254,18 @@ function TaskTable({ schedule }: { schedule: any[] }) { {task.name} - {task.priority} priority + + {' '} + {task.priority} priority + @@ -224,7 +275,10 @@ function TaskTable({ schedule }: { schedule: any[] }) { - + ))} @@ -234,7 +288,10 @@ function TaskTable({ schedule }: { schedule: any[] }) { - + ))} @@ -252,8 +309,10 @@ function Subtask({ description, time }: { description: string; time: number }) { if (time === 0) return 0; const hours = Math.floor(time); const minutes = Math.round((time - hours) * 60); - return `${hours > 0 ? hours + 'hr' : ''} ${minutes > 0 ? minutes + 'min' : ''}`; - } + return `${hours > 0 ? hours + 'hr' : ''} ${ + minutes > 0 ? minutes + 'min' : '' + }`; + }; const minutes = useMemo(() => convertHrsToMinutes(time), [time]); @@ -265,8 +324,20 @@ function Subtask({ description, time }: { description: string; time: number }) { checked={isDone} onChange={(e) => setIsDone(e.currentTarget.checked)} /> - {description} - {minutes} + + {description} + + + {minutes} + ); }