Skip to content

Commit

Permalink
biome style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
shanaka95 committed Feb 1, 2025
1 parent 7c2b108 commit 68dd945
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 92 deletions.
62 changes: 29 additions & 33 deletions app/src/components/ContextualQuestionActivityChoice.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
import { Text } from "@shadcn/components";
import { Text } from '@shadcn/components';

import type { ContextualQuestionProps, OnboardingFormData } from "@src/types";
import { useFormikContext } from "formik";
import LottieView from "lottie-react-native";
import { Gamepad2 } from "lucide-react-native";
import { type ReactNode, useState } from "react";
import { TouchableOpacity, View } from "react-native";
import { ChoresButtonModal } from "./ChoresButtonModal";
import { InfoAlertIcon } from "./InfoAlert";
import type { ContextualQuestionProps, OnboardingFormData } from '@src/types';
import { useFormikContext } from 'formik';
import LottieView from 'lottie-react-native';
import { Gamepad2 } from 'lucide-react-native';
import { type ReactNode, useState } from 'react';
import { TouchableOpacity, View } from 'react-native';
import { ChoresButtonModal } from './ChoresButtonModal';
import { InfoAlertIcon } from './InfoAlert';

export const ContextualQuestionActivityChoice: React.FC<
ContextualQuestionProps
> = (props) => {
export const ContextualQuestionActivityChoice: React.FC<ContextualQuestionProps> = (props) => {
const { onNext } = props;
const { setFieldValue, values } = useFormikContext<OnboardingFormData>();
const [activityType, setActivityType] = useState("");
const [activityType, setActivityType] = useState('');

const onChange = (value: string | undefined) => {
if (!value) return;
setActivityType(value);
setFieldValue("type", value);
setFieldValue('type', value);
};

const onChangeAndNext = (value: string | undefined) => {
Expand All @@ -28,58 +26,56 @@ export const ContextualQuestionActivityChoice: React.FC<
};

const onChoreSelectionComplete = (choreType: string) => {
setFieldValue("choreType", choreType);
setFieldValue('choreType', choreType);
onNext();
};

const IconWrapper = ({ children }: { children: ReactNode }) => (
<View className="flex items-center justify-center">{children}</View>
<View className='flex items-center justify-center'>{children}</View>
);

return (
<View className="flex flex-1 items-stretch justify-center">
<View className="flex flex-1 flex-col items-center justify-center mb-4">
<View className='flex flex-1 items-stretch justify-center'>
<View className='flex flex-1 flex-col items-center justify-center mb-4'>
<LottieView
autoPlay={true}
loop={true}
source={require("../../assets/activity.json")}
source={require('../../assets/activity.json')}
style={{ width: 320, height: 320 }}
/>
</View>
<View className="flex flex-1 flex-col items-stretch gap-y-6">
<View className="flex flex-col items-center">
<View className="flex flex-row gap-x-3 items-center justify-center mb-4">
<Text className="text-2xl text-center font-medium">
Select an activity type
</Text>
<View className='flex flex-1 flex-col items-stretch gap-y-6'>
<View className='flex flex-col items-center'>
<View className='flex flex-row gap-x-3 items-center justify-center mb-4'>
<Text className='text-2xl text-center font-medium'>Select an activity type</Text>
<InfoAlertIcon
title={"What does this mean?"}
title={'What does this mean?'}
description={
"Whether you are in the mood to tackle chores or enjoy some free play, select what suits you best!"
'Whether you are in the mood to tackle chores or enjoy some free play, select what suits you best!'
}
/>
</View>
<Text className="text-lg text-center">
<Text className='text-lg text-center'>
Are you looking to do some chores or play today?
</Text>
</View>
<View className="flex items-center justify-center flex-row gap-4">
<View className='flex items-center justify-center flex-row gap-4'>
<ChoresButtonModal
activityType={activityType}
onPress={() => onChange("chores")}
onPress={() => onChange('chores')}
onFinish={(chore) => onChoreSelectionComplete(chore)}
/>

<TouchableOpacity
onPress={() => onChangeAndNext("play")}
onPress={() => onChangeAndNext('play')}
className={`h-28 w-28 rounded-xl flex items-center justify-center ${
activityType === "play" ? "bg-secondary" : "bg-white"
activityType === 'play' ? 'bg-secondary' : 'bg-white'
}`}
>
<IconWrapper>
<Gamepad2 size={32} />
</IconWrapper>
<Text className="text-center text-md mt-4">Play</Text>
<Text className='text-center text-md mt-4'>Play</Text>
</TouchableOpacity>
</View>
</View>
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/HealthConsiderationsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Text } from '@shadcn/components/ui/text';
import { iconWithClassName } from '@shadcn/icons/iconWithClassName';
import { CheckCircle, Plus, X } from 'lucide-react-native';
import { useState } from 'react';
import { ScrollView, View } from 'react-native';
import { ScrollView } from 'react-native';

iconWithClassName(Plus);
iconWithClassName(CheckCircle);
Expand Down
59 changes: 25 additions & 34 deletions app/src/routes/AuthRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
// Description: This file defines the navigation structure for authenticated users using React Navigation.
// It sets up a drawer navigator with routes for various authenticated screens such as Home and Profile.

import { createDrawerNavigator } from "@react-navigation/drawer";
import { Drawer, Loading } from "@src/components";
import { Collections, Screens, fireAuth, fireStore } from "@src/constants";
import { createDrawerNavigator } from '@react-navigation/drawer';
import { Drawer, Loading } from '@src/components';
import { Collections, Screens, fireAuth, fireStore } from '@src/constants';
import {
ActivityPlayer,
Favorite,
Feedback,
History,
Home,
NewKid,
NewPlay,
Onboarding,
Profile,
Welcome,
History
} from "@src/screens";
import { doc, getDoc } from "firebase/firestore";
import { useEffect, useState } from "react";
import { useAuthState } from "react-firebase-hooks/auth";
Welcome
} from '@src/screens';
import { doc, getDoc } from 'firebase/firestore';
import { useEffect, useState } from 'react';
import { useAuthState } from 'react-firebase-hooks/auth';

// Define the parameter types for the AuthRoutes drawer navigator
export type AuthRoutesParams = {
Expand Down Expand Up @@ -54,7 +54,7 @@ export const AuthRoutes: React.FC = () => {
if (!user) return;
const userDocRef = doc(fireStore, Collections.Users, user.uid);
const docData = await getDoc(userDocRef);
setIsFirstTimeUser(!docData.exists() || !docData.get("kids"));
setIsFirstTimeUser(!docData.exists() || !docData.get('kids'));
} catch (error) {
console.log(error);
} finally {
Expand All @@ -65,12 +65,7 @@ export const AuthRoutes: React.FC = () => {
}, []);

if (isLoading) {
return (
<Loading
heading="Loading..."
description="Please wait while we load the content."
/>
);
return <Loading heading='Loading...' description='Please wait while we load the content.' />;
}

return (
Expand All @@ -83,76 +78,72 @@ export const AuthRoutes: React.FC = () => {
component={Welcome}
options={{
headerShown: false,
gestureHandlerProps: { enabled: false },
gestureHandlerProps: { enabled: false }
}}
/>
<AuthDrawer.Screen
name={Screens.Home}
component={Home}
options={{ headerShown: false }}
/>
<AuthDrawer.Screen name={Screens.Home} component={Home} options={{ headerShown: false }} />
<AuthDrawer.Screen
name={Screens.Profile}
component={Profile}
options={{
headerShown: false,
gestureHandlerProps: { enabled: false },
gestureHandlerProps: { enabled: false }
}}
/>
<AuthDrawer.Screen
name={Screens.Onboarding}
component={Onboarding}
options={{
headerShown: false,
gestureHandlerProps: { enabled: false },
gestureHandlerProps: { enabled: false }
}}
/>
<AuthDrawer.Screen
name={Screens.ActivityPlayer}
component={ActivityPlayer}
options={{
headerShown: false,
gestureHandlerProps: { enabled: false },
gestureHandlerProps: { enabled: false }
}}
/>
<AuthDrawer.Screen
name={Screens.Favorite}
component={Favorite}
options={{
headerShown: false,
gestureHandlerProps: { enabled: false },
gestureHandlerProps: { enabled: false }
}}
/>
<AuthDrawer.Screen
name={Screens.NewPlay}
component={NewPlay}
options={{
headerShown: false,
gestureHandlerProps: { enabled: false },
gestureHandlerProps: { enabled: false }
}}
/>
<AuthDrawer.Screen
name={Screens.NewKid}
component={NewKid}
options={{
headerShown: false,
gestureHandlerProps: { enabled: false },
gestureHandlerProps: { enabled: false }
}}
/>
<AuthDrawer.Screen
name={Screens.Feedback}
component={Feedback}
options={{
headerShown: false,
gestureHandlerProps: { enabled: false },
options={{
headerShown: false,
gestureHandlerProps: { enabled: false }
}}
/>
<AuthDrawer.Screen
name={Screens.History}
component={History}
options={{
headerShown: false,
gestureHandlerProps: { enabled: false },
options={{
headerShown: false,
gestureHandlerProps: { enabled: false }
}}
/>
</AuthDrawer.Navigator>
Expand Down
18 changes: 7 additions & 11 deletions app/src/screens/History.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { useNavigation } from '@react-navigation/native';
import { Text } from '@shadcn/components';
import { fireAuth, Collections, fireStore, Screens, Stacks } from '@src/constants';
import { Collections, Screens, Stacks, fireAuth, fireStore } from '@src/constants';
import type { HistoryActivity } from '@src/types';
import type { AppNavigation } from '@src/types';
import { collection, doc, getDocs, updateDoc } from 'firebase/firestore';
import { UserIcon } from 'lucide-react-native';
import React, { useEffect } from 'react';
import type { AppNavigation } from '@src/types';
import { useAuthState } from 'react-firebase-hooks/auth';
import { Image, ScrollView, TouchableOpacity, View } from 'react-native';
import FeatherIcon from 'react-native-vector-icons/Feather';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
import type { IconProps } from 'react-native-vector-icons/Icon';
import { UserIcon } from 'lucide-react-native';

import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';

export const History: React.FC = () => {
const { navigate } = useNavigation<AppNavigation>();
Expand Down Expand Up @@ -113,7 +112,6 @@ export const History: React.FC = () => {

return (
<View className='flex flex-1 flex-col px-6 gap-y-4'>

<View className='flex flex-row items-center justify-between mt-4'>
<View className='flex flex-row items-center gap-x-4'>
{user?.photoURL ? (
Expand All @@ -123,13 +121,11 @@ export const History: React.FC = () => {
<UserIcon className='text-gray-500 w-6 h-6' />
</View>
)}
<Text className='text-l font-bold text-primary text-xl '>
History
</Text>
<Text className='text-l font-bold text-primary text-xl '>History</Text>
</View>

<TouchableOpacity onPress={onHomeBtnPressed} className="ml-auto">
<FeatherIconCasted name="home" size={27} color="#620674" />
<TouchableOpacity onPress={onHomeBtnPressed} className='ml-auto'>
<FeatherIconCasted name='home' size={27} color='#620674' />
</TouchableOpacity>
</View>

Expand Down
8 changes: 4 additions & 4 deletions app/src/screens/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useFocusEffect, useNavigation} from '@react-navigation/native';
import { Ionicons } from '@expo/vector-icons';
import { useFocusEffect, useNavigation } from '@react-navigation/native';
import { Text } from '@shadcn/components';
import { Card, CardHeader } from '@shadcn/components/ui/card';
import { iconWithClassName } from '@shadcn/icons/iconWithClassName';
Expand All @@ -11,7 +12,6 @@ import { useCallback, useEffect, useState } from 'react';
import type React from 'react';
import { useAuthState } from 'react-firebase-hooks/auth';
import { ActivityIndicator, FlatList, Image, TouchableOpacity, View } from 'react-native';
import { Ionicons } from '@expo/vector-icons';

iconWithClassName(UserRoundCog);

Expand Down Expand Up @@ -174,11 +174,11 @@ export const Home: React.FC = () => {
<ActivityIndicator size='large' color='#0000ff' />
) : (
<View className='w-full flex'>
<View className="flex-row items-center justify-between my-4">
<View className='flex-row items-center justify-between my-4'>
{/* Recent Favorites */}
<Text className='text-2xl font-bold my-4'>Added to Favorites</Text>
<TouchableOpacity onPress={onHistoryBtnPressed}>
<Ionicons name="time-outline" size={30} className="mr-3" color="#620674"/>
<Ionicons name='time-outline' size={30} className='mr-3' color='#620674' />
</TouchableOpacity>
</View>
{favoriteActivities.length === 0 ? (
Expand Down
Loading

0 comments on commit 68dd945

Please sign in to comment.