Skip to content

Commit

Permalink
feature: minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Suraj Auwal committed Oct 26, 2023
1 parent 539c15e commit 1828992
Show file tree
Hide file tree
Showing 43 changed files with 378 additions and 16,477 deletions.
1 change: 0 additions & 1 deletion .idea/hades.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ const { getDefaultConfig } = require('expo/metro-config')
const defaultConfig = getDefaultConfig(__dirname)

defaultConfig.resolver.extraNodeModules.stream = require.resolve('stream-browserify')
// defaultConfig.resolver.sourceExts = ['jsx','js','ts','tsx'] //add here

module.exports = defaultConfig
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function ControlledTextInputWithLabel(props: ControlledTextInputWithLabel
onFocus={() => setInputFocus(true)}
onBlur={() => setInputFocus(false)}
placeholderTextColor={getColor('brand-gray-800')}
style={[tailwind('rounded-lg bg-primary-200 flex flex-row items-center justify-center w-full p-3 text-xs font-medium text-black', {
style={[tailwind('rounded-lg bg-primary-200 flex lowercase flex-row items-center justify-center w-full p-3 text-xs font-medium text-black', {
'text-sm': Device.osName === 'iOS',
'border-0.5 border-primary-500': inputFocus
}), {
Expand Down
2 changes: 2 additions & 0 deletions mobile-app/screens/AppNavigator/AppNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import * as Notifications from "expo-notifications";
import * as Device from 'expo-device'
import {Notification} from "expo-notifications";
import Constants from "expo-constants";
import {fetchDeliveries} from "@store/delivery.reducer";

const App = createStackNavigator<AppParamList>()

Expand Down Expand Up @@ -71,6 +72,7 @@ export function AppNavigator(): JSX.Element {
dispatch(fetchOrders() as any)
dispatch(fetchAllListings())
dispatch(fetchWallet())
dispatch(fetchDeliveries())
}, [])


Expand Down
138 changes: 77 additions & 61 deletions mobile-app/screens/AppNavigator/BottomNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,68 +81,84 @@ export function BottomTabNavigator ():JSX.Element {
),
}}
/>
<BottomTab.Screen
component={WalletNavigator}
name={AppScreenName.WALLET}
options={{
<BottomTab.Screen
component={WalletNavigator}
name={AppScreenName.WALLET}
listeners={{
tabPress: (e) => {
!profileComplete && e.preventDefault()
}
}}
options={{
tabBarTestID: "BottomTabHome",
tabBarIcon: ({ color }) => (
<IconComponent iconType='Feather' name="credit-card" size={24} color={color}/>
),

tabBarTestID: "BottomTabHome",
tabBarIcon: ({ color }) => (
<IconComponent iconType='Feather' name="credit-card" size={24} color={color}/>
),
}}
/>
<BottomTab.Screen
component={ListingsNavigator}
name={AppScreenName.LISTINGS}
options={{
tabBarLabel: ({ focused, color }) =>
getTabBarLabel({
focused,
color,
title: 'Listings',
}),
tabBarTestID: "BottomTabHome",
tabBarIcon: ({ color }) => (
<IconComponent iconType='Feather' name="list" size={24} color={color}/>
),
}}
/>
<BottomTab.Screen
component={ReviewNavigator}
name={AppScreenName.REVIEWS}
options={{
tabBarLabel: ({ focused, color }) =>
getTabBarLabel({
focused,
color,
title: 'Reviews',
}),
tabBarTestID: "BottomTabHome",
tabBarIcon: ({ color }) => (
<IconComponent iconType='Feather' name="message-circle" size={24} color={color}/>
),
}}
/>
<BottomTab.Screen
component={SettingsNavigator}
name={AppScreenName.SETTINGS}
options={{
tabBarLabel: ({ focused, color }) =>
getTabBarLabel({
focused,
color,
title: 'Profile',
}),
tabBarTestID: "BottomTabHome",
tabBarIcon: ({ color }) => (
<View style={tailwind('relative')}>
<IconComponent style={tailwind()} iconType='MaterialCommunityIcons' name="account-circle-outline" size={24} color={color}/>
{!profileComplete && (<View style={tailwind('absolute z-50 w-2 h-2 rounded-full bg-red-500 top-0 right-0 ')} />)}
</View>
),
}}
/>
}}
/>
<BottomTab.Screen
component={ListingsNavigator}
name={AppScreenName.LISTINGS}
listeners={{
tabPress: (e) => {
!profileComplete && e.preventDefault()
}
}}
options={{

tabBarLabel: ({ focused, color }) =>
getTabBarLabel({
focused,
color,
title: 'Listings',
}),
tabBarTestID: "BottomTabHome",
tabBarIcon: ({ color }) => (
<IconComponent iconType='Feather' name="list" size={24} color={color}/>
),
}}
/>
<BottomTab.Screen
component={ReviewNavigator}
name={AppScreenName.REVIEWS}
listeners={{
tabPress: (e) => {
!profileComplete && e.preventDefault()
}
}}
options={{
tabBarLabel: ({ focused, color }) =>
getTabBarLabel({
focused,
color,
title: 'Reviews',
}),
tabBarTestID: "BottomTabHome",
tabBarIcon: ({ color }) => (
<IconComponent iconType='Feather' name="message-circle" size={24} color={color}/>
),
}}
/>
<BottomTab.Screen
component={SettingsNavigator}
name={AppScreenName.SETTINGS}
options={{
tabBarLabel: ({ focused, color }) =>
getTabBarLabel({
focused,
color,
title: 'Profile',
}),
tabBarTestID: "BottomTabHome",
tabBarIcon: ({ color }) => (
<View style={tailwind('relative')}>
<IconComponent style={tailwind()} iconType='MaterialCommunityIcons' name="account-circle-outline" size={24} color={color}/>
{!profileComplete && (<View style={tailwind('absolute z-50 w-2 h-2 rounded-full bg-red-500 top-0 right-0 ')} />)}
</View>
),
}}
/>
</BottomTab.Navigator>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import {useSafeAreaInsets} from "react-native-safe-area-context";
import {AddCategory} from "@screens/AppNavigator/ListingsNavigator/screens/AddCategory";
import {AddOption} from "@screens/AppNavigator/ListingsNavigator/screens/AddOption";
import {AddMenu} from "@screens/AppNavigator/ListingsNavigator/screens/AddMenu";
import {ListingCategoryI, ListingMenuI, ListingOptionGroupI} from "@imagyne/eatlater-types";
import {ListingCategoryI, ListingMenuI, ListingOptionGroupI} from "@nanahq/sticky";
import {SingleMenu} from "@screens/AppNavigator/ListingsNavigator/screens/SingleMenu";
import {AddScheduledListing} from "@screens/AppNavigator/ListingsNavigator/screens/AddScheduledListing";


export interface ListingsParams {
Expand Down Expand Up @@ -59,6 +60,7 @@ export function ListingsNavigator(): JSX.Element {
}}
/>


<ListingsStack.Screen
component={SingleListingScreen}
name={ListingsScreenName.GET_LISTING}
Expand All @@ -76,6 +78,14 @@ export function ListingsNavigator(): JSX.Element {
}}
/>

<ListingsStack.Screen
component={AddScheduledListing}
name={ListingsScreenName.SCHEDULED}
options={{
headerShown: true,
headerTitle: 'New Scheduled Listing'
}}
/>
<ListingsStack.Screen
component={AddOption}
name={ListingsScreenName.ADD_OPTION}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ export enum ListingsScreenName {
ADD_LISTING= 'AddListing',
ADD_CATEGORY = 'AddCategory',
ADD_OPTION = 'AddOption',
SINGLE_MENU = 'SingleMenu'
SINGLE_MENU = 'SingleMenu',

SCHEDULED = 'AddScheduledListing'
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import { Pressable, ScrollView, Switch, Text, View} from "react-native";
import {getColor, tailwind} from '@tailwind'
import {useEffect, useState} from "react";
Expand All @@ -10,19 +11,31 @@ import {IconComponent} from "@components/commons/IconComponent";
import {TextWithMoreInfo} from "@components/Text/TextWithMoreInfo";
import {useForm} from "react-hook-form";
import {ControlledTextInputWithLabel} from "@components/commons/inputs/ControlledTextInput";
import { ListingMenuI} from "@imagyne/eatlater-types";
import { ListingMenuI} from "@nanahq/sticky";
import {IconButton} from "@components/commons/buttons/IconButton";
import {useAppDispatch} from "@store/index";
import {addOrUpdateCategory} from "@store/listings.reducer";
import Toast from "react-native-toast-message";
import { showTost } from "@components/commons/Toast";
import { useToast } from "react-native-toast-notifications";
import {TouchableOpacity} from "react-native-gesture-handler";

type AddCategoryNavProps = StackScreenProps<ListingsParams, "AddCategory">
enum TagSelection {
'SELECT'= 'SELECT',
'UNSELECT' = 'UNSELECT'
}

const operations = [
{
label: 'Pre order',
value: 'PRE_ORDER'
},
{
label: 'On demand',
value: 'ON_DEMAND'
}
]
export const CAT_TAGS = [
'african',
'lunch',
Expand All @@ -37,6 +50,7 @@ export const CAT_TAGS = [

export function AddCategory ({route, navigation}: AddCategoryNavProps): JSX.Element {
const [isLive, setIsLive] = useState<boolean>(false)
const [operationType,setType ] = useState<string>('');
const [tags, setTags] = useState<string[]>([])
const dispatch = useAppDispatch()
const toast = useToast()
Expand All @@ -51,14 +65,22 @@ export function AddCategory ({route, navigation}: AddCategoryNavProps): JSX.Elem
setMenu(route?.params?.category.listingsMenu)
setIsLive(route?.params?.category.isLive)
setTags(route?.params?.category.tags)
//@ts-ignore
setType(route?.params?.category?.type)
}
}, [])

const toggleSwitch = (): void => {
setIsLive((prev) => !prev)
}


const handleSelectOperationType = (value: string, type: 'SELECT' | 'UNSELECT'): void => {
if (type === 'UNSELECT') {
setType('')
} else {
setType(value)
}
}

function selectTags (tag: string, action: TagSelection): void {
switch (action) {
Expand Down Expand Up @@ -93,6 +115,7 @@ export function AddCategory ({route, navigation}: AddCategoryNavProps): JSX.Elem
name: data.name,
isLive,
tags,
type: operationType
}
}

Expand All @@ -102,16 +125,10 @@ export function AddCategory ({route, navigation}: AddCategoryNavProps): JSX.Elem
const res = await dispatch(addOrUpdateCategory({payload, type})).unwrap()

if (res.status === 1) {
Toast.show({
type: 'success',
text1: 'Operation successful',
autoHide: true,
})

showTost(toast, 'Category added!', 'success')
setTimeout(() => {
void navigation.goBack()
}, 3000)
}, 2000)
}
} catch (error: any) {
showTost(toast, typeof error.message !== 'string' ? error.message[0] : error.message, 'error')
Expand All @@ -138,6 +155,11 @@ return true
if (category.listingsMenu.length !== menu.length) {
return true
}

// @ts-ignore
if(operations !== category?.type) {
return true
}
return false
}
return (
Expand Down Expand Up @@ -165,6 +187,21 @@ return true
value={isLive}
/>
</View>
<View style={tailwind('flex flex-row items-center w-full mt-5')}>
{operations?.map(type => (
<TouchableOpacity key={type.value} style={tailwind('w-28 flex flex-row items-center justify-center border-brand-gray-400 rounded-sm border-0.5 py-2 px-1 mr-1 relative', {
'border-primary-500': type.value === operationType
})} onPress={() => handleSelectOperationType(type.value, type.value === operationType ? 'UNSELECT': 'SELECT')}>
<Text >{type.label}</Text>
<View
style={tailwind('rounded-full w-2 h-2 absolute bottom-1 right-1', {
'bg-primary-500': type.value === operationType,
'border-0.5 border-brand-gray-400': type.value !== operationType
})}
/>
</TouchableOpacity>
))}
</View>
<View>
<TextWithMoreInfo
containerStyle={tailwind('mt-5')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from "@screens/AppNavigator/ListingsNavigator/screens/components/ListingsPhotosUploadButton";
import * as ImagePicker from "expo-image-picker";
import {useForm} from "react-hook-form";
import {ListingCategoryI, ListingMenuI} from "@imagyne/eatlater-types";
import {ListingCategoryI, ListingMenuI} from "@nanahq/sticky";
import {ControlledTextInputWithLabel} from "@components/commons/inputs/ControlledTextInput";
import {RootState, useAppDispatch, useAppSelector} from "@store/index";
import { fetchMenus} from "@store/listings.reducer";
Expand Down Expand Up @@ -58,7 +58,7 @@ export function AddMenu (): JSX.Element {
photo: null,
isLive: true,
isAvailable: true,
categoryId: ''
categoryId: '',
})

const [category, setCategory] = useState<{name: string, id: string}>({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {StackScreenProps} from "@react-navigation/stack";
import {ListingsParams} from "@screens/AppNavigator/ListingsNavigator/ListingsNavigator";
import {useForm} from "react-hook-form";
import {ControlledTextInputWithLabel} from "@components/commons/inputs/ControlledTextInput";
import {ListingOption} from "@imagyne/eatlater-types";
import {ListingOption} from "@nanahq/sticky";
import {useAppDispatch} from "@store/index";
import {updateOptionGroup} from "@store/listings.reducer";
import Toast from "react-native-toast-message";
Expand Down
Loading

0 comments on commit 1828992

Please sign in to comment.