This commit is contained in:
Milan Paunovic
2024-11-28 08:38:52 +01:00
parent 3dff040cea
commit dfe7301f6d
7 changed files with 116 additions and 116 deletions

View File

@ -1,5 +1,5 @@
<resources>
<string name="app_name">"Cally "</string>
<string name="app_name">\"Cally \"</string>
<string name="expo_splash_screen_resize_mode" translatable="false">contain</string>
<string name="expo_splash_screen_status_bar_translucent" translatable="false">false</string>
<string name="expo_system_ui_user_interface_style" translatable="false">light</string>

View File

@ -1,18 +1,15 @@
import React from "react";
import {RefreshControl, ScrollView, View} from "react-native";
import CalendarPage from "@/components/pages/calendar/CalendarPage";
import {colorMap} from "@/constants/colorMap";
import TabletCalendarPage from "@/components/pages/(tablet_pages)/calendar/TabletCalendarPage";
import * as Device from "expo-device";
import {DeviceType} from "expo-device";
import {useCalSync} from "@/hooks/useCalSync";
import {colorMap} from "@/constants/colorMap";
export default function Screen() {
const isTablet = Device.deviceType === DeviceType.TABLET;
const {
resyncAllCalendars,
isSyncing,
} = useCalSync();
const {resyncAllCalendars, isSyncing} = useCalSync();
const onRefresh = React.useCallback(async () => {
try {
@ -22,32 +19,7 @@ export default function Screen() {
}
}, [resyncAllCalendars]);
return (
<View style={{ flex: 1 }}>
<View style={{ flex: 1, zIndex: 0 }}>
{Device.deviceType === DeviceType.TABLET ? (
<TabletCalendarPage />
) : (
<CalendarPage />
)}
</View>
<ScrollView
style={{
position: "absolute",
top: 0,
left: isTablet ? "15%" : 0,
height: isTablet ? "9%" : "4%",
width: isTablet ? "62%" : "100%",
zIndex: 50,
backgroundColor: "transparent",
}}
contentContainerStyle={{
flex: 1,
justifyContent: "center",
paddingRight: 200,
}}
refreshControl={
const refreshControl = (
<RefreshControl
colors={[
colorMap.pink,
@ -57,23 +29,58 @@ export default function Screen() {
colorMap.teal,
]}
tintColor={colorMap.pink}
progressBackgroundColor={"white"}
progressBackgroundColor="white"
refreshing={isSyncing}
onRefresh={onRefresh}
style={isTablet ? {
position: "absolute",
left: "50%",
transform: [{translateX: -20}],
} : undefined}
/>
);
if (isTablet) {
return (
<View style={{flex: 1}}>
<View style={{flex: 1, zIndex: 0}}>
<TabletCalendarPage/>
</View>
<ScrollView
style={{
position: "absolute",
left: "50%", // Position at screen center
transform: [
// Offset by half its own width
{ translateX: -20 }, // Assuming the refresh control is ~40px wide
],
top: 0,
left: "15%",
height: "9%",
width: "62%",
zIndex: 50,
backgroundColor: "transparent",
}}
/>
}
contentContainerStyle={{
flex: 1,
justifyContent: "center",
paddingRight: 200,
}}
refreshControl={refreshControl}
bounces={true}
showsVerticalScrollIndicator={false}
pointerEvents={isSyncing ? "auto" : "none"}
/>
</View>
);
}
return (
<ScrollView
style={{flex: 1, height: "100%"}}
contentContainerStyle={{flex: 1, height: "100%"}}
refreshControl={refreshControl}
bounces={true}
showsVerticalScrollIndicator={false}
>
<View style={{flex: 1}}>
<CalendarPage/>
</View>
</ScrollView>
);
}

View File

@ -1,5 +1,5 @@
import React, {memo} from "react";
import {Button, Picker, PickerModes, SegmentedControl, Text, View,} from "react-native-ui-lib";
import {Button, Picker, PickerModes, SegmentedControl, Text, View} from "react-native-ui-lib";
import {MaterialIcons} from "@expo/vector-icons";
import {months} from "./constants";
import {StyleSheet} from "react-native";
@ -8,6 +8,7 @@ import {modeAtom, selectedDateAtom} from "@/components/pages/calendar/atoms";
import {format, isSameDay} from "date-fns";
import * as Device from "expo-device";
import {Mode} from "react-native-big-calendar";
import { FontAwesome5 } from '@expo/vector-icons';
export const CalendarHeader = memo(() => {
const [selectedDate, setSelectedDate] = useAtom(selectedDateAtom);
@ -15,8 +16,8 @@ export const CalendarHeader = memo(() => {
const isTablet = Device.deviceType === Device.DeviceType.TABLET;
const segments = isTablet
? [{label: "D"}, {label: "W"}, {label: "M"}] // Tablet segments
: [{label: "D"}, {label: "3D"}, {label: "M"}]; // Phone segments
? [{label: "D"}, {label: "W"}, {label: "M"}]
: [{label: "D"}, {label: "3D"}, {label: "M"}];
const handleSegmentChange = (index: number) => {
let selectedMode: Mode;
@ -46,28 +47,18 @@ export const CalendarHeader = memo(() => {
const getInitialIndex = () => {
if (isTablet) {
// Tablet index mapping
switch (mode) {
case "day":
return 0;
case "week":
return 1;
case "month":
return 2;
default:
return 1; // Default to week view for tablets
case "day": return 0;
case "week": return 1;
case "month": return 2;
default: return 1;
}
} else {
// Phone index mapping
switch (mode) {
case "day":
return 0;
case "3days":
return 1;
case "month":
return 2;
default:
return 1; // Default to 3day view for phones
case "day": return 0;
case "3days": return 1;
case "month": return 2;
default: return 1;
}
}
};
@ -110,31 +101,16 @@ export const CalendarHeader = memo(() => {
</View>
<View row centerV>
{!isSelectedDateToday && (
<Button
size={"xSmall"}
marginR-0
marginR-1
avoidInnerPadding
style={{
borderRadius: 50,
backgroundColor: "white",
borderWidth: 0.7,
borderColor: "#dadce0",
height: 30,
paddingHorizontal: 10,
}}
labelStyle={{
fontSize: 12,
color: "black",
fontFamily: "Manrope_500Medium",
}}
label={format(new Date(), "dd/MM/yyyy")}
onPress={() => {
setSelectedDate(new Date());
}}
/>
)}
style={styles.todayButton}
onPress={() => setSelectedDate(new Date())}
>
<MaterialIcons name="calendar-today" size={30} color="#5f6368" />
<Text style={styles.todayDate}>{format(new Date(), "d")}</Text>
</Button>
<View>
<SegmentedControl
segments={segments}
@ -159,4 +135,19 @@ const styles = StyleSheet.create({
fontSize: 12,
fontFamily: "Manrope_600SemiBold",
},
todayButton: {
backgroundColor: "transparent",
borderWidth: 0,
height: 30,
width: 30,
alignItems: 'center',
justifyContent: 'center',
},
todayDate: {
position: 'absolute',
fontSize: 12,
fontFamily: "Manrope_600SemiBold",
color: "#5f6368",
top: '30%',
},
});

View File

@ -145,15 +145,10 @@ export const ManuallyAddEventModal = () => {
setIsPrivate(editEvent?.private || false);
setStartTime(() => {
const date = new Date(initialDate ?? new Date());
const minutes = date.getMinutes();
date.setMinutes(0, 0, 0);
if (minutes >= 30) {
date.setHours(date.getHours() + 1);
}
const date = initialDate ?? new Date();
date.setSeconds(0, 0);
return date;
});
setEndTime(() => {
if (editEvent?.end) {
return startOfMinute(new Date(editEvent.end));

View File

@ -11,7 +11,10 @@
},
"preview": {
"distribution": "internal",
"channel": "preview"
"channel": "production",
"android": {
"buildType": "apk"
}
},
"production": {
"channel": "production",

View File

@ -1212,6 +1212,7 @@ async function fetchAndSaveGoogleEvents({token, refreshToken, email, familyId, c
email,
creatorId,
externalOrigin: "google",
private: item.visibility === "private" || item.visibility === "confidential",
};
events.push(googleEvent);
});
@ -1399,7 +1400,7 @@ async function fetchAndSaveMicrosoftEvents({token, refreshToken, email, familyId
const url = `https://graph.microsoft.com/v1.0/me/calendar/events`;
const queryParams = new URLSearchParams({
$select: 'subject,start,end,id,isAllDay',
$select: 'subject,start,end,id,isAllDay,sensitivity',
$filter: `start/dateTime ge '${timeMin}' and end/dateTime le '${timeMax}'`
});
@ -1450,7 +1451,8 @@ async function fetchAndSaveMicrosoftEvents({token, refreshToken, email, familyId
familyId,
email,
creatorId,
externalOrigin: "microsoft"
externalOrigin: "microsoft",
private: item.sensitivity === "private" || item.sensitivity === "confidential",
};
});

View File

@ -9,8 +9,10 @@
"ios": "TAMAGUI_TARGET=native npx expo run:ios",
"ios-native": "TAMAGUI_TARGET=native npx expo run:ios --device",
"dev-ios": "TAMAGUI_TARGET=native npx eas-cli build --profile development --platform ios",
"dev-android": "TAMAGUI_TARGET=native npx eas-cli build --profile development --platform android",
"build-ios": "TAMAGUI_TARGET=native npx eas-cli build --profile production --platform ios",
"build-android": "TAMAGUI_TARGET=native npx eas-cli build --profile production --platform android",
"build-apk": "TAMAGUI_TARGET=native eas build -p android --profile preview",
"build-cicd": "TAMAGUI_TARGET=native npx eas-cli build --profile production --platform all --non-interactive --no-wait --auto-submit ",
"build-ios-cicd": "TAMAGUI_TARGET=native npx eas-cli build --profile production --platform ios --non-interactive --no-wait --auto-submit ",
"build-dev-ios": "TAMAGUI_TARGET=native npx eas-cli build --profile development --platform ios",