ui fixes and tweaks

This commit is contained in:
ivic00
2024-11-20 21:09:44 +01:00
parent 81477ed85b
commit b5aac0af2a
13 changed files with 137 additions and 33 deletions

View File

@ -14,6 +14,8 @@ export default function Screen() {
const [refreshing, setRefreshing] = useState(false); const [refreshing, setRefreshing] = useState(false);
const [shouldRefresh, setShouldRefresh] = useAtom(refreshTriggerAtom); const [shouldRefresh, setShouldRefresh] = useAtom(refreshTriggerAtom);
const isTablet: boolean = Device.deviceType === DeviceType.TABLET;
const { const {
isConnectedToGoogle, isConnectedToGoogle,
isConnectedToMicrosoft, isConnectedToMicrosoft,
@ -48,7 +50,7 @@ export default function Screen() {
return ( return (
<View style={{ flex: 1 }}> <View style={{ flex: 1 }}>
<View style={{ flex: 1, zIndex: -2 }}> <View style={{ flex: 1, zIndex: 0 }}>
{Device.deviceType === DeviceType.TABLET ? ( {Device.deviceType === DeviceType.TABLET ? (
<TabletCalendarPage /> <TabletCalendarPage />
) : ( ) : (
@ -60,14 +62,17 @@ export default function Screen() {
style={{ style={{
position: "absolute", position: "absolute",
top: 0, top: 0,
left: Device.deviceType === DeviceType.TABLET ? "15%" : 0, left: isTablet ? "15%" : "0",
right: Device.deviceType === DeviceType.TABLET ? "25%" : 0, height: isTablet ? "9%" : "4%",
height: Device.deviceType === DeviceType.TABLET ? "9%" : "12%", width: isTablet ? "62%" : "100%",
width: Device.deviceType === DeviceType.TABLET ? "62%" : "100%", zIndex: 50,
zIndex: 100,
backgroundColor: "transparent", backgroundColor: "transparent",
}} }}
contentContainerStyle={{ flex: 1 }} contentContainerStyle={{
flex: 1,
justifyContent: "center",
paddingRight: 200,
}}
refreshControl={ refreshControl={
<RefreshControl <RefreshControl
colors={[ colors={[
@ -81,6 +86,14 @@ export default function Screen() {
progressBackgroundColor={"white"} progressBackgroundColor={"white"}
refreshing={refreshing || isSyncing} refreshing={refreshing || isSyncing}
onRefresh={onRefresh} onRefresh={onRefresh}
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
],
}}
/> />
} }
bounces={true} bounces={true}

View File

@ -38,7 +38,14 @@ const TabletChoresPage = () => {
{user.pfp ? ( {user.pfp ? (
<ImageBackground <ImageBackground
source={{ uri: user.pfp }} source={{ uri: user.pfp }}
style={styles.pfp} style={[
styles.pfp,
(user.eventColor && {
borderWidth: 2,
borderColor: user.eventColor,
}) ||
undefined,
]}
borderRadius={13.33} borderRadius={13.33}
/> />
) : ( ) : (

View File

@ -20,7 +20,14 @@ const UsersList = () => {
<ImageBackground <ImageBackground
key={index} key={index}
source={{ uri: member.pfp }} source={{ uri: member.pfp }}
style={styles.pfp} style={[
styles.pfp,
(member.eventColor && {
borderWidth: 2,
borderColor: member.eventColor,
}) ||
undefined,
]}
borderRadius={100} borderRadius={100}
/> />
) : ( ) : (

View File

@ -8,13 +8,13 @@ export default function CalendarPage() {
<View <View
style={{ flex: 1, height: "100%", padding: 10 }} style={{ flex: 1, height: "100%", padding: 10 }}
paddingH-22 paddingH-22
paddingT-0 paddingT-22
> >
<HeaderTemplate {/*<HeaderTemplate
message={"Let's get your week started !"} message={"Let's get your week started !"}
isWelcome isWelcome
isCalendar={true} isCalendar={true}
/> />*/}
<InnerCalendar /> <InnerCalendar />
</View> </View>
); );

View File

@ -324,6 +324,7 @@ export const EventCalendar: React.FC<EventCalendarProps> = React.memo(
ampm ampm
// renderCustomDateForMonth={renderCustomDateForMonth} // renderCustomDateForMonth={renderCustomDateForMonth}
/> />
<View style={{backgroundColor: 'white', height: 50, width: '100%'}} />
</> </>
); );
@ -337,6 +338,7 @@ const styles = StyleSheet.create({
}, },
calHeader: { calHeader: {
borderWidth: 0, borderWidth: 0,
paddingBottom: 60,
}, },
dayModeHeader: { dayModeHeader: {
alignSelf: "flex-start", alignSelf: "flex-start",

View File

@ -25,7 +25,7 @@ export const InnerCalendar = () => {
return ( return (
<> <>
<View <View
style={{flex: 1, backgroundColor: "#fff", borderRadius: 30, marginBottom: 60, overflow: "hidden"}} style={{flex: 1, backgroundColor: "#fff", borderRadius: 30, marginBottom: 10, overflow: "hidden"}}
ref={calendarContainerRef} ref={calendarContainerRef}
onLayout={onLayout} onLayout={onLayout}
> >

View File

@ -59,7 +59,6 @@ const EditGroceryItem = ({
const handleSubmit = () => { const handleSubmit = () => {
inputRef?.current?.blur(); inputRef?.current?.blur();
console.log("CALLLLLL");
if (editGrocery.setSubmit) { if (editGrocery.setSubmit) {
editGrocery.setSubmit(true); editGrocery.setSubmit(true);
} }

View File

@ -190,6 +190,8 @@ const GroceryItem = ({
aspectRatio: 1, aspectRatio: 1,
borderRadius: 22, borderRadius: 22,
overflow: "hidden", overflow: "hidden",
borderWidth: 2,
borderColor: profileData.eventColor
}} }}
/> />
) : ( ) : (

View File

@ -170,7 +170,14 @@ const MyGroup: React.FC<MyGroupProps> = ({
> >
{member.pfp ? ( {member.pfp ? (
<ImageBackground <ImageBackground
style={styles.pfp} style={[
styles.pfp,
(member.eventColor && {
borderWidth: 2,
borderColor: member.eventColor,
}) ||
undefined,
]}
borderRadius={10.56} borderRadius={10.56}
source={{ uri: member.pfp || undefined }} source={{ uri: member.pfp || undefined }}
/> />

View File

@ -173,7 +173,14 @@ const MyProfile = () => {
{pfpUri ? ( {pfpUri ? (
<Image <Image
key={pfpUri} key={pfpUri}
style={styles.pfp} style={[
styles.pfp,
(profileData?.eventColor && {
borderWidth: 2,
borderColor: profileData.eventColor,
}) ||
undefined,
]}
source={pfpUri ? { uri: pfpUri } : null} source={pfpUri ? { uri: pfpUri } : null}
/> />
) : ( ) : (

View File

@ -179,6 +179,8 @@ const ToDoItem = (props: {
aspectRatio: 1, aspectRatio: 1,
borderRadius: 22, borderRadius: 22,
overflow: "hidden", overflow: "hidden",
borderWidth: 2,
borderColor: member.eventColor || 'transparent'
}} }}
/> />
) : ( ) : (
@ -187,6 +189,9 @@ const ToDoItem = (props: {
position: "relative", position: "relative",
width: 24.64, width: 24.64,
aspectRatio: 1, aspectRatio: 1,
borderWidth: 2,
borderRadius: 100,
borderColor: member.eventColor || 'transparent'
}} }}
> >
<View <View

View File

@ -28,11 +28,11 @@ const AssigneesDisplay = ({selectedAttendees, setSelectedAttendees}: {
{member?.pfp ? ( {member?.pfp ? (
<Image <Image
source={{uri: member?.pfp}} source={{uri: member?.pfp}}
style={styles.image} style={[styles.image, {borderWidth: 2, borderColor: member.eventColor || 'transparent'}]}
children={<RemoveAssigneeBtn/>} children={<RemoveAssigneeBtn/>}
/> />
) : ( ) : (
<View style={styles.initialsCircle}> <View style={[styles.initialsCircle, {borderWidth: 2, borderColor: member.eventColor || 'transparent'}]}>
<Text style={styles.initialsText}> <Text style={styles.initialsText}>
{getInitials(member.firstName, member.lastName)} {getInitials(member.firstName, member.lastName)}
</Text> </Text>

View File

@ -5,10 +5,8 @@ import { StyleSheet } from "react-native";
import { colorMap } from "@/constants/colorMap"; import { colorMap } from "@/constants/colorMap";
import { useAtom, useSetAtom } from "jotai"; import { useAtom, useSetAtom } from "jotai";
import { isFamilyViewAtom, settingsPageIndex } from "../pages/calendar/atoms"; import { isFamilyViewAtom, settingsPageIndex } from "../pages/calendar/atoms";
import { useGetChildrenByParentId } from "@/hooks/firebase/useGetChildrenByParentId";
import { useGetFamilyMembers } from "@/hooks/firebase/useGetFamilyMembers"; import { useGetFamilyMembers } from "@/hooks/firebase/useGetFamilyMembers";
import { UserProfile } from "@/hooks/firebase/types/profileTypes"; import { UserProfile } from "@/hooks/firebase/types/profileTypes";
import { child } from "@react-native-firebase/storage";
import CachedImage from "expo-cached-image"; import CachedImage from "expo-cached-image";
import { router } from "expo-router"; import { router } from "expo-router";
@ -24,7 +22,7 @@ const HeaderTemplate = (props: {
}) => { }) => {
const { user, profileData } = useAuthContext(); const { user, profileData } = useAuthContext();
const { data: members } = useGetFamilyMembers(); const { data: members, refetch } = useGetFamilyMembers();
const [children, setChildren] = useState<UserProfile[]>([]); const [children, setChildren] = useState<UserProfile[]>([]);
const [isFamilyView] = useAtom(isFamilyViewAtom); const [isFamilyView] = useAtom(isFamilyViewAtom);
const setSettingsPageIndexAtom = useSetAtom(settingsPageIndex); const setSettingsPageIndexAtom = useSetAtom(settingsPageIndex);
@ -48,6 +46,7 @@ const HeaderTemplate = (props: {
overflow: "hidden", overflow: "hidden",
marginRight: 20, marginRight: 20,
backgroundColor: profileData?.eventColor ?? colorMap.pink, backgroundColor: profileData?.eventColor ?? colorMap.pink,
zIndex: 100,
}, },
pfpTxt: { pfpTxt: {
fontFamily: "Manrope_500Medium", fontFamily: "Manrope_500Medium",
@ -94,13 +93,23 @@ const HeaderTemplate = (props: {
<TouchableOpacity onPress={handlePfpPress}> <TouchableOpacity onPress={handlePfpPress}>
<CachedImage <CachedImage
source={{ uri: profileData.pfp }} source={{ uri: profileData.pfp }}
style={styles.pfp} style={[
styles.pfp,
(profileData.eventColor && {
borderWidth: 2,
borderColor: profileData.eventColor,
}) ||
undefined,
]}
cacheKey={profileData.pfp} cacheKey={profileData.pfp}
/> />
</TouchableOpacity> </TouchableOpacity>
{isFamilyView && props.isCalendar && ( {isFamilyView && props.isCalendar && children.length > 0 && (
<View style={styles.childrenPfpArr} row> <View style={styles.childrenPfpArr} row>
{children?.slice(0, 3).map((child, index) => { {children.slice(0, 3).map((child, index) => {
{
console.log("yeaaaah");
}
const bgColor: string = child.eventColor || colorMap.pink; const bgColor: string = child.eventColor || colorMap.pink;
return child.pfp ? ( return child.pfp ? (
<Image <Image
@ -108,9 +117,7 @@ const HeaderTemplate = (props: {
style={[styles.childrenPfp, { left: index * 19 }]} style={[styles.childrenPfp, { left: index * 19 }]}
/> />
) : ( ) : (
<TouchableOpacity <TouchableOpacity onPress={handlePfpPress}>
onPress={handlePfpPress}
>
<View <View
style={[ style={[
styles.childrenPfp, styles.childrenPfp,
@ -143,12 +150,60 @@ const HeaderTemplate = (props: {
)} )}
</View> </View>
) : ( ) : (
<View style={styles.pfp} center> <>
<Text style={styles.pfpTxt}> <TouchableOpacity onPress={handlePfpPress}>
{profileData?.firstName?.at(0)} <View style={[styles.pfp, { zIndex: 200 }]} center>
{profileData?.lastName?.at(0)} <Text style={styles.pfpTxt}>
</Text> {profileData?.firstName?.at(0)}
</View> {profileData?.lastName?.at(0)}
</Text>
</View>
</TouchableOpacity>
{isFamilyView && props.isCalendar && children.length > 0 && (
<View style={styles.childrenPfpArr} row>
{children.slice(0, 3).map((child, index) => {
{
console.log("yeaaaah");
}
const bgColor: string = child.eventColor || colorMap.pink;
return child.pfp ? (
<Image
source={{ uri: child.pfp }}
style={[styles.childrenPfp, { left: index * 19 }]}
/>
) : (
<TouchableOpacity onPress={handlePfpPress}>
<View
style={[
styles.childrenPfp,
{ left: index * 19, backgroundColor: bgColor },
]}
center
>
<Text style={{ color: "white" }}>
{child?.firstName?.at(0)}
{child?.firstName?.at(1)}
</Text>
</View>
</TouchableOpacity>
);
})}
{children?.length > 3 && (
<View style={[styles.childrenPfp, { left: 3 * 19 }]} center>
<Text
style={{
color: "white",
fontFamily: "Manrope_600SemiBold",
fontSize: 12,
}}
>
+{children.length - 3}
</Text>
</View>
)}
</View>
)}
</>
)} )}
<View gap-3> <View gap-3>
{props.isWelcome && ( {props.isWelcome && (