From b7cc19b719cd8bae77260f525edf80678d69356a Mon Sep 17 00:00:00 2001 From: Mo Tarbin Date: Sun, 12 Jul 2026 18:11:00 -0400 Subject: [PATCH] format --- src/views/components/AddTaskModal.jsx | 622 +++++++++++++------------- 1 file changed, 321 insertions(+), 301 deletions(-) diff --git a/src/views/components/AddTaskModal.jsx b/src/views/components/AddTaskModal.jsx index fcf6207..8f5a08d 100644 --- a/src/views/components/AddTaskModal.jsx +++ b/src/views/components/AddTaskModal.jsx @@ -22,6 +22,8 @@ import { import SmartTaskTitleInput from './SmartTaskTitleInput' import KeyboardShortcutHint from '../../components/common/KeyboardShortcutHint' +import { useDocumentScanner } from '../../hooks/useDocumentScanner' +import { localAIService } from '../../service/LocalAIService' import { TASK_COLOR } from '../../utils/Colors' import AssigneePickerField from './AssigneePickerField' import AttachmentPickerField from './AttachmentPickerField' @@ -29,12 +31,10 @@ import DueDatePickerField from './DueDatePickerField' import LabelsPickerField from './LabelsPickerField' import LearnMoreButton from './LearnMore' import NotificationPickerField from './NotificationPickerField' -import ScanPanel from './ScanToTask/ScanPanel' -import { useDocumentScanner } from '../../hooks/useDocumentScanner' -import { localAIService } from '../../service/LocalAIService' import PriorityPickerField from './PriorityPickerField' import RepeatPickerField from './RepeatPickerField' import RichTextEditor from './RichTextEditor' +import ScanPanel from './ScanToTask/ScanPanel' import SubTasks from './SubTask' const getDefaultNotification = () => { const storedDefault = localStorage.getItem('defaultNotificationTemplate') @@ -558,7 +558,11 @@ const TaskInput = ({ onChoreUpdate, isModalOpen, onClose }) => { createChore() } - const handleTaskExtracted = ({ taskName, description: extractedDesc, dueDate: extractedDue }) => { + const handleTaskExtracted = ({ + taskName, + description: extractedDesc, + dueDate: extractedDue, + }) => { if (taskName) { processText(taskName) } @@ -700,314 +704,330 @@ const TaskInput = ({ onChoreUpdate, isModalOpen, onClose }) => { return ( <> - - - - - } - > - {!showScan && ( - <> - - - Task in a sentence: - - - This feature lets you create a task simply by typing a - sentence. It attempt parses the sentence to identify the - task's due date, priority, and frequency. - - - - Examples: - - - -
  • - Priority:For highest priority any of the - following keyword P1, Urgent,{' '} - Important, or ASAP. For lower - priorities, use P2, P3, or P4. -
  • -
  • - Due date: Specify dates with phrases - like tomorrow, next week,{' '} - Monday, or August 1st at 12pm. -
  • -
  • - Frequency: Set recurring tasks with - terms like daily, weekly,{' '} - monthly, yearly, or patterns such as{' '} - every Tuesday and Thursday. -
  • -
    - - } - /> -
    - - { - setScanAutoCapture(true) - setShowScan(true) - } : undefined} - onPhotoSelected={llmAvailable ? dataUrl => { - setScanAutoCapture(false) - setPendingPhotoUrl(dataUrl) - setShowScan(true) - } : undefined} - placeholder='Type your task...' - onChange={text => { - setTaskText(text) - if (!text) setTaskTitle('') - }} - customRenderer={renderedParts} - onEnterPressed={handleEnterPressed} - suggestions={{ - '#': { - value: 'id', - display: 'name', - options: userLabels ? userLabels : [], - }, - '!': { - value: 'id', - display: 'name', - options: [ - { id: '1', name: 'P1' }, - { id: '2', name: 'P2' }, - { id: '3', name: 'P3' }, - { id: '4', name: 'P4' }, - ], - }, - '@': { - value: 'userId', - display: 'displayName', - options: [ - { userId: 'anyone', displayName: 'Anyone' }, - ...(circleMembers?.res || []), - ], - }, - '*': { - value: 'id', - display: 'name', - options: [ - { id: '1', name: '1 point' }, - { id: '5', name: '5 points' }, - { id: '10', name: '10 points' }, - { id: '25', name: '25 points' }, - { id: '50', name: '50 points' }, - { id: '100', name: '100 points' }, - ], - }, - }} - /> -
    - + - { - setDueDate(null) - setDueDateOnly(null) - setDueTime(null) - setUseCustomTime(false) - }} - /> - setFrequency(null)} - /> - setPriority(0)} - emptyDisplay={pickerEmptyDisplay} - priorityColors={priorityColors} - priorityLabels={priorityLabels} - /> - { - if (!userId) { - setAssignees([]) - } else { - setAssignees([{ userId }]) - } - }} - onClear={() => setAssignees([])} - currentUserId={userProfile?.id} - members={circleMembers?.res || []} - /> - setLabelsV2([])} - labels={userLabels || []} - /> - setAttachments([])} - emptyDisplay={pickerEmptyDisplay} - entityType='chore_attachment_draft' - draftId={draftId} - /> - setNotificationMetadata({ templates: [] })} - emptyDisplay={pickerEmptyDisplay} - /> - - - - {!hasDescription && ( - - )} - {!hasSubTasks && ( - - )} - - - {hasDescription && ( - - Description: -
    - + Cancel + {showKeyboardShortcuts && ( + -
    -
    - )} - {hasSubTasks && ( + )} + + + + } + > + {!showScan && ( + <> - Subtasks: - + Task in a sentence: + + + This feature lets you create a task simply by typing a + sentence. It attempt parses the sentence to identify the + task's due date, priority, and frequency. + + + + Examples: + + + +
  • + Priority:For highest priority any of + the following keyword P1, Urgent,{' '} + Important, or ASAP. For lower + priorities, use P2, P3, or{' '} + P4. +
  • +
  • + Due date: Specify dates with phrases + like tomorrow, next week,{' '} + Monday, or August 1st at 12pm. +
  • +
  • + Frequency: Set recurring tasks with + terms like daily, weekly,{' '} + monthly, yearly, or patterns such as{' '} + every Tuesday and Thursday. +
  • +
    + + } + /> +
    + + { + setScanAutoCapture(true) + setShowScan(true) + } + : undefined + } + onPhotoSelected={ + llmAvailable + ? dataUrl => { + setScanAutoCapture(false) + setPendingPhotoUrl(dataUrl) + setShowScan(true) + } + : undefined + } + placeholder='Type your task...' + onChange={text => { + setTaskText(text) + if (!text) setTaskTitle('') + }} + customRenderer={renderedParts} + onEnterPressed={handleEnterPressed} + suggestions={{ + '#': { + value: 'id', + display: 'name', + options: userLabels ? userLabels : [], + }, + '!': { + value: 'id', + display: 'name', + options: [ + { id: '1', name: 'P1' }, + { id: '2', name: 'P2' }, + { id: '3', name: 'P3' }, + { id: '4', name: 'P4' }, + ], + }, + '@': { + value: 'userId', + display: 'displayName', + options: [ + { userId: 'anyone', displayName: 'Anyone' }, + ...(circleMembers?.res || []), + ], + }, + '*': { + value: 'id', + display: 'name', + options: [ + { id: '1', name: '1 point' }, + { id: '5', name: '5 points' }, + { id: '10', name: '10 points' }, + { id: '25', name: '25 points' }, + { id: '50', name: '50 points' }, + { id: '100', name: '100 points' }, + ], + }, + }} /> - )} - - )} - {showScan && ( - { - setShowScan(false) - setScanAutoCapture(false) - setPendingPhotoUrl(null) - }} - /> - )} -
    + + { + setDueDate(null) + setDueDateOnly(null) + setDueTime(null) + setUseCustomTime(false) + }} + /> + setFrequency(null)} + /> + setPriority(0)} + emptyDisplay={pickerEmptyDisplay} + priorityColors={priorityColors} + priorityLabels={priorityLabels} + /> + { + if (!userId) { + setAssignees([]) + } else { + setAssignees([{ userId }]) + } + }} + onClear={() => setAssignees([])} + currentUserId={userProfile?.id} + members={circleMembers?.res || []} + /> + setLabelsV2([])} + labels={userLabels || []} + /> + setAttachments([])} + emptyDisplay={pickerEmptyDisplay} + entityType='chore_attachment_draft' + draftId={draftId} + /> + setNotificationMetadata({ templates: [] })} + emptyDisplay={pickerEmptyDisplay} + /> + + + + {!hasDescription && ( + + )} + {!hasSubTasks && ( + + )} + + + {hasDescription && ( + + Description: +
    + +
    +
    + )} + {hasSubTasks && ( + + Subtasks: + + + )} + + )} + + {showScan && ( + { + setShowScan(false) + setScanAutoCapture(false) + setPendingPhotoUrl(null) + }} + /> + )} +
    ) }