mirror of
https://github.com/urosran/cally.git
synced 2025-07-15 09:45:20 +00:00
Test adding events by clicking on calendar cells
This commit is contained in:
2
app.json
2
app.json
@ -16,7 +16,7 @@
|
|||||||
"supportsTablet": true,
|
"supportsTablet": true,
|
||||||
"bundleIdentifier": "com.cally.app",
|
"bundleIdentifier": "com.cally.app",
|
||||||
"googleServicesFile": "./ios/GoogleService-Info.plist",
|
"googleServicesFile": "./ios/GoogleService-Info.plist",
|
||||||
"buildNumber": "10"
|
"buildNumber": "11"
|
||||||
},
|
},
|
||||||
"android": {
|
"android": {
|
||||||
"adaptiveIcon": {
|
"adaptiveIcon": {
|
||||||
|
@ -5,6 +5,7 @@ import {Button, Picker, PickerModes, SegmentedControl, Text, View} from "react-n
|
|||||||
import {MaterialIcons} from "@expo/vector-icons";
|
import {MaterialIcons} from "@expo/vector-icons";
|
||||||
import {AddEventDialog} from "@/components/pages/calendar/AddEventDialog";
|
import {AddEventDialog} from "@/components/pages/calendar/AddEventDialog";
|
||||||
import {useGetEvents} from "@/hooks/firebase/useGetEvents";
|
import {useGetEvents} from "@/hooks/firebase/useGetEvents";
|
||||||
|
import {ManuallyAddEventModal} from "@/components/pages/calendar/ManuallyAddEventModal";
|
||||||
|
|
||||||
const modeMap = new Map([
|
const modeMap = new Map([
|
||||||
[0, "day"],
|
[0, "day"],
|
||||||
@ -21,6 +22,8 @@ export default function Screen() {
|
|||||||
const [calendarHeight, setCalendarHeight] = useState(0);
|
const [calendarHeight, setCalendarHeight] = useState(0);
|
||||||
const [mode, setMode] = useState<"week" | "month" | "day">("week");
|
const [mode, setMode] = useState<"week" | "month" | "day">("week");
|
||||||
const [selectedDate, setSelectedDate] = useState<Date>(new Date());
|
const [selectedDate, setSelectedDate] = useState<Date>(new Date());
|
||||||
|
const [selectedNewEventDate, setSelectedNewEndDate] = useState<Date | undefined>(undefined);
|
||||||
|
|
||||||
|
|
||||||
const calendarContainerRef = useRef(null);
|
const calendarContainerRef = useRef(null);
|
||||||
const { data: events} = useGetEvents()
|
const { data: events} = useGetEvents()
|
||||||
@ -109,6 +112,7 @@ export default function Screen() {
|
|||||||
events={events ?? []}
|
events={events ?? []}
|
||||||
height={calendarHeight}
|
height={calendarHeight}
|
||||||
activeDate={selectedDate}
|
activeDate={selectedDate}
|
||||||
|
onPressCell={setSelectedNewEndDate}
|
||||||
onSwipeEnd={(newDate) => {
|
onSwipeEnd={(newDate) => {
|
||||||
console.log(newDate)
|
console.log(newDate)
|
||||||
setSelectedDate(newDate);
|
setSelectedDate(newDate);
|
||||||
@ -117,7 +121,9 @@ export default function Screen() {
|
|||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<AddEventDialog/>
|
<AddEventDialog />
|
||||||
|
<ManuallyAddEventModal show={!!selectedNewEventDate} close={() => setSelectedNewEndDate(undefined)}/>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -29,14 +29,14 @@ const daysOfWeek = [
|
|||||||
{label: "Sunday", value: "sunday"},
|
{label: "Sunday", value: "sunday"},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const ManuallyAddEventModal = ({show, close}: { show: boolean, close: () => void }) => {
|
export const ManuallyAddEventModal = ({show, close, initialDate}: { show: boolean, close: () => void, initialDate?: Date }) => {
|
||||||
const {user} = useAuthContext()
|
const {user} = useAuthContext()
|
||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
|
|
||||||
const [title, setTitle] = useState<string>("");
|
const [title, setTitle] = useState<string>("");
|
||||||
|
|
||||||
const [isAllDay, setIsAllDay] = useState(false);
|
const [isAllDay, setIsAllDay] = useState(false);
|
||||||
const [startTime, setStartTime] = useState(new Date());
|
const [startTime, setStartTime] = useState(initialDate ?? new Date());
|
||||||
const [endTime, setEndTime] = useState(new Date())
|
const [endTime, setEndTime] = useState(new Date())
|
||||||
|
|
||||||
const [startDate, setStartDate] = useState(new Date());
|
const [startDate, setStartDate] = useState(new Date());
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>10</string>
|
<string>11</string>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSAppTransportSecurity</key>
|
<key>NSAppTransportSecurity</key>
|
||||||
@ -61,6 +61,7 @@
|
|||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
|
||||||
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
|
||||||
</array>
|
</array>
|
||||||
<key>UILaunchStoryboardName</key>
|
<key>UILaunchStoryboardName</key>
|
||||||
<string>SplashScreen</string>
|
<string>SplashScreen</string>
|
||||||
|
Reference in New Issue
Block a user