diff --git a/app.json b/app.json index e1f8914..6fd84ef 100644 --- a/app.json +++ b/app.json @@ -55,7 +55,7 @@ "icon": "./assets/app-config/Icon-white-ios1024.png", "supportsTablet": false, "bundleIdentifier": "com.nanaapp.nanavendorsapp", - "buildNumber": "1.1.1" + "buildNumber": "1.1.0" }, "web": { "favicon": "./assets/app-config/favicon.png" diff --git a/mobile-app/api/_request.ts b/mobile-app/api/_request.ts index 25769ca..9eba84f 100644 --- a/mobile-app/api/_request.ts +++ b/mobile-app/api/_request.ts @@ -16,7 +16,7 @@ export function getUrl (gateway: APIService = "VENDOR_GATEWAY"): string { url =`${NetworkMapper.PRODUCTION}/${ApiRoute[gateway]}/v1` } - return 'http://k8s-default-nanahydr-874b0d28d1-561484973.af-south-1.elb.amazonaws.com/vendor-gateway/v1' + return url } const config = { diff --git a/mobile-app/api/network.mapper.ts b/mobile-app/api/network.mapper.ts index ad6f11a..c3da33d 100644 --- a/mobile-app/api/network.mapper.ts +++ b/mobile-app/api/network.mapper.ts @@ -4,7 +4,7 @@ export type APIService = 'API_GATEWAY' | 'VENDOR_GATEWAY' | 'ADMIN_GATEWAY' export const NetworkMapper: Record = { PLAYGROUND: 'http://k8s-default-nanahydr-874b0d28d1-561484973.af-south-1.elb.amazonaws.com', - PRODUCTION: process.env.API_URL ?? 'http://k8s-default-nanahydr-874b0d28d1-561484973.af-south-1.elb.amazonaws.com' + PRODUCTION: process.env.API_URL ?? 'https://api.trynanaapp.com' } diff --git a/mobile-app/screens/AppNavigator/ListingsNavigator/screens/ScheduledListings.tsx b/mobile-app/screens/AppNavigator/ListingsNavigator/screens/ScheduledListings.tsx index 6c4dff5..357b679 100644 --- a/mobile-app/screens/AppNavigator/ListingsNavigator/screens/ScheduledListings.tsx +++ b/mobile-app/screens/AppNavigator/ListingsNavigator/screens/ScheduledListings.tsx @@ -6,7 +6,6 @@ import {FlashList, ListRenderItemInfo} from "@shopify/flash-list"; import {LoaderComponent} from "@components/commons/LoaderComponent"; import {useCallback} from "react"; import {IconButton} from "@components/commons/buttons/IconButton"; -import {useNavigation} from "@react-navigation/native"; import moment from "moment"; export function ScheduledListings (props: {listings: ScheduledListingI[], state: boolean}): JSX.Element { @@ -58,19 +57,25 @@ export function ScheduledListings (props: {listings: ScheduledListingI[], state: export function ListingCard ({listing, onPress}: {listing:ScheduledListingI, onPress: (listing: ScheduledListingI) => void}) { const date = moment(listing.availableDate).format('ddd Do MMMM') return ( - onPress(listing)} style={[tailwind('flex w-full h-full px-2 mb-4 rounded-lg overflow-hidden'), { + onPress(listing)} style={[tailwind(' flex w-full h-full px-2 mb-4 rounded-lg overflow-hidden'), { }]}> - + {listing.listing.name} - - Quantity - {listing.quantity} + + + Quantity remaining + {listing.remainingQuantity} + + + Quantity Sold + {listing.quantity - listing.remainingQuantity } + Available Date @@ -78,7 +83,13 @@ export function ListingCard ({listing, onPress}: {listing:ScheduledListingI, onP + {listing.soldOut && ( + + Sold out + + )} + ) } diff --git a/mobile-app/screens/AppNavigator/ReviewNavigator/screen/ReviewScreen.tsx b/mobile-app/screens/AppNavigator/ReviewNavigator/screen/ReviewScreen.tsx index 24cf88e..0cef91b 100644 --- a/mobile-app/screens/AppNavigator/ReviewNavigator/screen/ReviewScreen.tsx +++ b/mobile-app/screens/AppNavigator/ReviewNavigator/screen/ReviewScreen.tsx @@ -62,8 +62,8 @@ export function ReviewScreen (): JSX.Element { return ( - - Total Sales + + Total Sales - - Approved Listing + + Approved Listing ( - + {value} )} /> - - Delivered orders + + Delivered orders + ); } diff --git a/mobile-app/screens/AppNavigator/SettingsNavigator/SettingsScreenName.enum.ts b/mobile-app/screens/AppNavigator/SettingsNavigator/SettingsScreenName.enum.ts index fccd7d5..e3c81be 100644 --- a/mobile-app/screens/AppNavigator/SettingsNavigator/SettingsScreenName.enum.ts +++ b/mobile-app/screens/AppNavigator/SettingsNavigator/SettingsScreenName.enum.ts @@ -3,5 +3,7 @@ export enum SettingsScreenName { ACCOUNT_PROFILE= 'AccountProfile', RESTAURANT_PROFILE= 'RestaurantProfile', PAYMENT_PROFILE= 'PaymentProfile', - RESTAURANT_SETTINGS= 'RestaurantSettings' + RESTAURANT_SETTINGS= 'RestaurantSettings', + + NOTIFICATION_SETTING = 'NotificationSettings' } diff --git a/mobile-app/screens/AppNavigator/SettingsNavigator/screens/NotificationSettings.tsx b/mobile-app/screens/AppNavigator/SettingsNavigator/screens/NotificationSettings.tsx new file mode 100644 index 0000000..bfee888 --- /dev/null +++ b/mobile-app/screens/AppNavigator/SettingsNavigator/screens/NotificationSettings.tsx @@ -0,0 +1,65 @@ +import {View, Text} from "react-native"; +import {getColor, tailwind} from "@tailwind"; +import {useEffect, useState} from "react"; +import {LoaderComponentScreen} from "@components/commons/LoaderComponent"; +import {_api} from "@api/_request"; +import {showTost} from "@components/commons/Toast"; +import {useToast} from "react-native-toast-notifications"; +import {GoBackButton} from "@screens/AppNavigator/SettingsNavigator/components/Goback"; +import {useNavigation} from "@react-navigation/native"; +import Checkbox from "expo-checkbox"; + +export const NotificationSettings = () => { + const [loading, setLoading] = useState(true) + const [listingNotification, setListingNotification] = useState(undefined) + const toast = useToast() + const navigation = useNavigation() + useEffect(() => { + + void fetchSettings() + }, []) + const saveSettings = () => { + setListingNotification((prev) => !prev) + } + async function fetchSettings (): Promise { + try { + const scheduledListingsNotifications = (await _api.requestData({ + method: 'GET', + url: 'vendor/subscription' + })).data as any + setListingNotification(scheduledListingsNotifications.enabledByVendor) + } catch (error) { + showTost(toast, 'something went wrong fetching settings', 'error') + } finally { + setLoading(false) + } + + } + + if(loading) { + return + } + + return ( + + + navigation.goBack()} /> + + + + Allow users to subscribe to a new listing + This will allow customers to subscribe to your restaurant and get notified when ever you make a new listing + Is only available for Vendors with pre-order delivery + + + + + + + ) +} diff --git a/mobile-app/screens/AppNavigator/SettingsNavigator/screens/Settings.screen.tsx b/mobile-app/screens/AppNavigator/SettingsNavigator/screens/Settings.screen.tsx index b66d768..46bd8c0 100644 --- a/mobile-app/screens/AppNavigator/SettingsNavigator/screens/Settings.screen.tsx +++ b/mobile-app/screens/AppNavigator/SettingsNavigator/screens/Settings.screen.tsx @@ -10,6 +10,7 @@ import { CompleteProfileMsg } from '@components/commons/CompleteProfileMsg'; import { LoaderComponentScreen } from '@components/commons/LoaderComponent'; import { showTost } from '@components/commons/Toast'; import { useToast } from 'react-native-toast-notifications'; +import {SettingsScreenName} from "@screens/AppNavigator/SettingsNavigator/SettingsScreenName.enum"; type SettingsScreenProps = StackScreenProps @@ -84,9 +85,13 @@ if (!hasFetchedProfile) { title="Payment Settings" onPress={() => navigation.navigate('PaymentProfile')} /> navigation.navigate('RestaurantSettings')} /> + navigation.navigate(SettingsScreenName.NOTIFICATION_SETTING)} /> + navigation.navigate('AccountProfile')} disabled /> diff --git a/mobile-app/screens/OnboardingNavigator/screens/Onboarding.screen.tsx b/mobile-app/screens/OnboardingNavigator/screens/Onboarding.screen.tsx index 5fb93ef..7dd64e8 100644 --- a/mobile-app/screens/OnboardingNavigator/screens/Onboarding.screen.tsx +++ b/mobile-app/screens/OnboardingNavigator/screens/Onboarding.screen.tsx @@ -22,7 +22,7 @@ export function OnboardingScreen (): JSX.Element { }, []); return (