Add a component to use the vocal agent quickly and putted this component in home, tasklist, calendr (normal and 20) - #34
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new “QuickVoiceAdd” UI control and supporting service to quickly record and send a short voice command to the backend, then wires that control into multiple entry points (Home, Task list, Calendar, Calendar20). It also includes a small SafeAreaView adjustment and new i18n strings for the quick-add UI labels.
Changes:
- Added
QuickVoiceAddcomponent (pill/FAB variants) usingexpo-audiorecording + waveform UI + success state. - Added
sendQuickVoiceAddservice to upload audio via multipart/form-data to/chat/voice-command. - Integrated QuickVoiceAdd into Home, TaskList, Calendar, and Calendar20, and added i18n keys for the UI label/sent text.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/services/quickVoiceAddService.ts | New service to upload recorded audio to the backend voice-command endpoint. |
| src/components/BotChat/QuickVoiceAdd.tsx | New reusable voice quick-add recorder/sender UI component (pill/FAB). |
| src/navigation/screens/Home.tsx | Renders QuickVoiceAdd in the Home chat area. |
| src/components/TaskList/TaskListContainer.tsx | Replaces the single add button with a dock containing manual add + voice quick add. |
| src/components/TaskList/styles.ts | Adds styles for the new add/voice dock and manual button. |
| src/components/Calendar20/FABMenu.tsx | Updates Calendar20 FAB to a dock with manual add + voice quick add. |
| src/components/Calendar20/Calendar20View.tsx | Tracks voice active state and adds a backdrop while voice UI is active; wires FAB callbacks. |
| src/components/Calendar/CalendarView.tsx | Adds header dock actions and a modal flow to auto-start voice quick add. |
| src/navigation/screens/Notes.tsx | Adjusts SafeAreaView edges configuration. |
| src/locales/en.json | Adds home.quickAdd.* strings (label/sent). |
| src/locales/it.json | Adds home.quickAdd.* strings (label/sent). |
Comments suppressed due to low confidence (4)
src/components/BotChat/QuickVoiceAdd.tsx:186
sendRecordingtreats a successful response asreceived || recivied, which leaks the backend typo into the UI layer. After normalizing the response insendQuickVoiceAdd, this component should only check a single field (and ideally rely on HTTP status + a well-defined success flag).
setState('sending');
const result = await sendQuickVoiceAdd(uri, model);
if (!result.received && !result.recivied) {
throw new Error(result.error || 'Audio non ricevuto dal server');
}
src/components/BotChat/QuickVoiceAdd.tsx:283
- The cancel button is disabled for any state other than
recording(includingsending). If the network request stalls, the user has no way to exit besides waiting. Consider allowing cancel duringsendingas well (and aborting/ignoring the in-flight request) so the UI can always recover from slow/offline conditions.
<Pressable style={styles.cancelButton} onPress={cancelRecording} disabled={state !== 'recording'}>
<Ionicons name="close" size={18} color={state === 'recording' ? colors.textSecondary : colors.textTertiary} />
</Pressable>
src/components/Calendar/CalendarView.tsx:383
- The voice-add trigger button reuses the same accessibility label/hint as the manual add button (
tasks.accessibility.addTask*). Screen readers won’t be able to distinguish the actions. Consider adding dedicated i18n strings for “add task with voice” and using them here.
<TouchableOpacity
style={styles.voiceTriggerButton}
onPress={() => setVoiceAddModalVisible(true)}
activeOpacity={0.82}
accessibilityRole="button"
accessibilityLabel={t("tasks.accessibility.addTaskLabel")}
accessibilityHint={t("tasks.accessibility.addTaskHint")}
>
src/components/Calendar/CalendarView.tsx:403
- The new
voiceAddModalVisibleflow introduces a modal overlay but doesn’t setaccessibilityViewIsModal/accessiblesemantics for the modal content. Consider adding proper modal accessibility props (and focusing the control) so screen readers don’t navigate to the underlying calendar while the voice modal is open.
const renderVoiceAddModal = () => (
<Modal
visible={voiceAddModalVisible}
transparent
animationType="fade"
onRequestClose={() => setVoiceAddModalVisible(false)}
>
<View style={styles.voiceModalOverlay}>
<Pressable
style={StyleSheet.absoluteFill}
onPress={() => setVoiceAddModalVisible(false)}
/>
<View style={styles.voiceModalContent} pointerEvents="box-none">
<QuickVoiceAdd
model="base"
Comment on lines
+4
to
+8
| export interface QuickVoiceAddResponse { | ||
| received: boolean; | ||
| recivied?: boolean; | ||
| processing?: boolean; | ||
| model?: 'base' | 'advanced'; |
Comment on lines
+128
to
+146
| const permission = await requestRecordingPermissionsAsync(); | ||
| if (!permission.granted) { | ||
| Alert.alert('Microfono non disponibile', 'Abilita il microfono per usare Quick add.'); | ||
| return; | ||
| } | ||
|
|
||
| await setAudioModeAsync({ | ||
| allowsRecording: true, | ||
| playsInSilentMode: true, | ||
| }); | ||
| await recorder.prepareToRecordAsync(RecordingPresets.HIGH_QUALITY); | ||
| recorder.record(); | ||
| isRecordingRef.current = true; | ||
| recordingStartRef.current = Date.now(); | ||
| setState('recording'); | ||
| } catch (error) { | ||
| console.error('[QuickVoiceAdd] startRecording error:', error); | ||
| Alert.alert('Errore registrazione', 'Non sono riuscito ad avviare il microfono.'); | ||
| setState('idle'); |
Comment on lines
+356
to
+361
| const handleVoiceAddSuccess = () => { | ||
| fetchTasks(); | ||
| setTimeout(() => { | ||
| setVoiceAddModalVisible(false); | ||
| }, 1150); | ||
| }; |
Comment on lines
+19
to
+25
| <TouchableOpacity | ||
| style={styles.manualFab} | ||
| onPress={onNewTask} | ||
| activeOpacity={0.82} | ||
| accessibilityRole="button" | ||
| accessibilityLabel="Aggiungi manualmente" | ||
| > |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.