Fix details/notes missing from events

This commit is contained in:
Milan Paunovic
2024-10-20 16:03:46 +02:00
parent 641bae7e99
commit 7ae714e075
5 changed files with 40 additions and 21 deletions

View File

@ -72,12 +72,14 @@ export const AddEventDialog = () => {
style={{marginTop: 20, alignItems: "center", width: "100%"}} style={{marginTop: 20, alignItems: "center", width: "100%"}}
> >
<Button <Button
disabled
style={{ style={{
marginBottom: 10, marginBottom: 10,
backgroundColor: "#ea156c", backgroundColor: "#ea156c",
justifyContent: "center", justifyContent: "center",
width: "100%", width: "100%",
paddingVertical: 13, paddingVertical: 13,
opacity: 0.5
}} }}
label="Scan Image" label="Scan Image"
labelStyle={styles.btnLabel} labelStyle={styles.btnLabel}
@ -104,12 +106,14 @@ export const AddEventDialog = () => {
/> />
<Button <Button
disabled
style={{ style={{
marginBottom: 10, marginBottom: 10,
backgroundColor: "#05a8b6", backgroundColor: "#05a8b6",
justifyContent: "center", justifyContent: "center",
width: "100%", width: "100%",
paddingVertical: 13, paddingVertical: 13,
opacity: 0.5
}} }}
label="Add To Do" label="Add To Do"
labelStyle={styles.btnLabel} labelStyle={styles.btnLabel}

View File

@ -50,6 +50,7 @@ export const EventCalendar: React.FC<EventCalendarProps> = React.memo(({calendar
const handlePressEvent = useCallback((event: CalendarEvent) => { const handlePressEvent = useCallback((event: CalendarEvent) => {
if (mode === "day") { if (mode === "day") {
setEditVisible(true); setEditVisible(true);
console.log({event})
setEventForEdit(event); setEventForEdit(event);
} else { } else {
setMode("day") setMode("day")

View File

@ -10,12 +10,13 @@ import {
Switch, Switch,
Text, Text,
TextField, TextField,
TextFieldRef,
TouchableOpacity, TouchableOpacity,
View, View,
} from "react-native-ui-lib"; } from "react-native-ui-lib";
import {ScrollView} from "react-native-gesture-handler"; import {ScrollView} from "react-native-gesture-handler";
import {useSafeAreaInsets} from "react-native-safe-area-context"; import {useSafeAreaInsets} from "react-native-safe-area-context";
import {useEffect, useState} from "react"; import {useEffect, useRef, useState} from "react";
import {AntDesign, Feather, Ionicons,} from "@expo/vector-icons"; import {AntDesign, Feather, Ionicons,} from "@expo/vector-icons";
import {PickerMultiValue} from "react-native-ui-lib/src/components/picker/types"; import {PickerMultiValue} from "react-native-ui-lib/src/components/picker/types";
import {useCreateEvent} from "@/hooks/firebase/useCreateEvent"; import {useCreateEvent} from "@/hooks/firebase/useCreateEvent";
@ -57,7 +58,10 @@ export const ManuallyAddEventModal = () => {
initialDate: selectedNewEventDate || editEvent?.start initialDate: selectedNewEventDate || editEvent?.start
} }
const detailsRef = useRef<TextFieldRef>(null)
const [title, setTitle] = useState<string>(editEvent?.title || ""); const [title, setTitle] = useState<string>(editEvent?.title || "");
const [details, setDetails] = useState<string>(editEvent?.notes || "");
const [isAllDay, setIsAllDay] = useState(editEvent?.allDay || false); const [isAllDay, setIsAllDay] = useState(editEvent?.allDay || false);
const [isPrivate, setIsPrivate] = useState<boolean>(editEvent?.private || false); const [isPrivate, setIsPrivate] = useState<boolean>(editEvent?.private || false);
const [startTime, setStartTime] = useState(() => { const [startTime, setStartTime] = useState(() => {
@ -87,6 +91,7 @@ export const ManuallyAddEventModal = () => {
useEffect(() => { useEffect(() => {
setTitle(editEvent?.title || ""); setTitle(editEvent?.title || "");
setDetails(editEvent?.notes || "");
setIsAllDay(editEvent?.allDay || false); setIsAllDay(editEvent?.allDay || false);
setIsPrivate(editEvent?.private || false); setIsPrivate(editEvent?.private || false);
setStartTime(() => { setStartTime(() => {
@ -150,9 +155,11 @@ export const ManuallyAddEventModal = () => {
endDate: finalEndDate, endDate: finalEndDate,
allDay: isAllDay, allDay: isAllDay,
attendees: selectedAttendees, attendees: selectedAttendees,
id: editEvent?.id notes: details
}; };
if (editEvent?.id) eventData.id = editEvent?.id
await createEvent(eventData); await createEvent(eventData);
close(); close();
@ -253,7 +260,7 @@ export const ManuallyAddEventModal = () => {
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<ScrollView> <ScrollView style={{minHeight: "85%"}}>
<TextField <TextField
placeholder="Add event title" placeholder="Add event title"
value={title} value={title}
@ -414,7 +421,8 @@ export const ManuallyAddEventModal = () => {
</View> </View>
<View marginL-35> <View marginL-35>
<AssigneesDisplay setSlectedAttendees={setSelectedAttendees} selectedAttendees={selectedAttendees}/> <AssigneesDisplay setSlectedAttendees={setSelectedAttendees}
selectedAttendees={selectedAttendees}/>
</View> </View>
<View style={styles.divider}/> <View style={styles.divider}/>
@ -476,7 +484,8 @@ export const ManuallyAddEventModal = () => {
</View> </View>
</View> </View>
<View style={styles.divider}/> <View style={styles.divider}/>
<View marginH-30 marginB-0 row spread centerV> <View marginH-30 marginB-0 spread centerV flex-1>
<TouchableOpacity onPress={() => detailsRef?.current?.focus()}>
<View row centerV> <View row centerV>
<MenuIcon/> <MenuIcon/>
<Text <Text
@ -489,7 +498,10 @@ export const ManuallyAddEventModal = () => {
Add Details Add Details
</Text> </Text>
</View> </View>
<View></View> </TouchableOpacity>
<TextField value={details} onChangeText={setDetails} ref={detailsRef} maxLength={2000} multiline
numberOfLines={10} marginT-10 style={{flex: 1, minHeight: 180}}/>
</View> </View>
</ScrollView> </ScrollView>
<Button <Button

View File

@ -10,4 +10,5 @@ export interface CalendarEvent {
eventColor?: string; // Optional color to represent the event eventColor?: string; // Optional color to represent the event
participants?: string[]; // Optional list of participants or attendees participants?: string[]; // Optional list of participants or attendees
private?: boolean; private?: boolean;
notes?: string
} }

View File

@ -77,6 +77,7 @@ export const useGetEvents = () => {
end: new Date(event.endDate.seconds * 1000), end: new Date(event.endDate.seconds * 1000),
hideHours: event.allDay, hideHours: event.allDay,
eventColor: eventColor, eventColor: eventColor,
notes: event.notes
}; };
}) })
); );