Skip to content

Commit

Permalink
implemented account creation and improved checkout flow for delivery …
Browse files Browse the repository at this point in the history
…selection
  • Loading branch information
roncodes committed Dec 26, 2024
1 parent 857b8d6 commit 98267af
Show file tree
Hide file tree
Showing 29 changed files with 632 additions and 265 deletions.
12 changes: 6 additions & 6 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 190,
"tabWidth": 4,
"jsxSingleQuote": true
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 190,
"tabWidth": 4,
"jsxSingleQuote": true
}
1 change: 0 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
nodeLinker: node-modules

# yarnPath: .yarn/releases/yarn-3.6.4.cjs
130 changes: 65 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,52 +34,52 @@ Open source ecommerce mobile app for on-demand orders. Setup ecommerce marketpla

## Table of Contents

- [About](#about)
- [Use cases](#use-cases)
- [Screenshots](#screenshots)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Configure Environment](#configure-environment)
- [Running in Simulator](#running-in-simulator)
- [Run the app in iOS Simulator](#run-the-app-in-ios-simulator)
- [Run the app in Android Simulator](#run-the-app-in-android-simulator)
- [Push Notifications](#push-notifications)
- [APNS Push Notifications](#apns-push-notifications)
- [FCM Push Notifications](#fcm-push-notifications)
- [Generate Assets](#generate-assets)
- [Configuration](#configuration)
- [Application Configuration](#appconfig)
- [Interface Configuration](#uiconfig)
- [Internationalization and Translations](#internationalization-and-translations)
- [Internationalization](#internationalization)
- [Translations](#translations)
- [Payment Gateways](#payment-gateways)
- [Stripe](#stripe)
- [Store Locations](#store-locations)
- [Store Hours](#store-hours)
- [Multi-Vendor](#multi-vendor)
- [Creating a network](#creating-a-network)
- [Inviting to network](#inviting-to-network)
- [Configuring network](#configuring-network)
- [Launch network on app](#launch-network-on-app)
- [Cart](#cart)
- [Customer Authentication](#customer-authentication)
- [Creating a customer account](#creating-a-customer-account)
- [Logging in a customer](#logging-in-a-customer)
- [Delivery/ Service Rates](#delivery-service-rates)
- [Location based quote](#location-based-quote)
- [Checkout](#checkout)
- [Creating a checkout token](#creating-a-checkout-token)
- [Capture checkout](#capture-checkout)
- [Driver/Agent App](#driver-agent-app)
- [Proof of delivery](#proof-of-delivery)
- [Orders](#orders)
- [Auto-accept orders](#auto-accept-orders)
- [Manually accept orders](#manually-accept-orders)
- [Auto-assign orders](#auto-assign-orders)
- [Manually assign orders](#manually-assign-orders)
- [Documentation](#documentation)
- [Roadmap](#roadmap)
- [About](#about)
- [Use cases](#use-cases)
- [Screenshots](#screenshots)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Configure Environment](#configure-environment)
- [Running in Simulator](#running-in-simulator)
- [Run the app in iOS Simulator](#run-the-app-in-ios-simulator)
- [Run the app in Android Simulator](#run-the-app-in-android-simulator)
- [Push Notifications](#push-notifications)
- [APNS Push Notifications](#apns-push-notifications)
- [FCM Push Notifications](#fcm-push-notifications)
- [Generate Assets](#generate-assets)
- [Configuration](#configuration)
- [Application Configuration](#appconfig)
- [Interface Configuration](#uiconfig)
- [Internationalization and Translations](#internationalization-and-translations)
- [Internationalization](#internationalization)
- [Translations](#translations)
- [Payment Gateways](#payment-gateways)
- [Stripe](#stripe)
- [Store Locations](#store-locations)
- [Store Hours](#store-hours)
- [Multi-Vendor](#multi-vendor)
- [Creating a network](#creating-a-network)
- [Inviting to network](#inviting-to-network)
- [Configuring network](#configuring-network)
- [Launch network on app](#launch-network-on-app)
- [Cart](#cart)
- [Customer Authentication](#customer-authentication)
- [Creating a customer account](#creating-a-customer-account)
- [Logging in a customer](#logging-in-a-customer)
- [Delivery/ Service Rates](#delivery-service-rates)
- [Location based quote](#location-based-quote)
- [Checkout](#checkout)
- [Creating a checkout token](#creating-a-checkout-token)
- [Capture checkout](#capture-checkout)
- [Driver/Agent App](#driver-agent-app)
- [Proof of delivery](#proof-of-delivery)
- [Orders](#orders)
- [Auto-accept orders](#auto-accept-orders)
- [Manually accept orders](#manually-accept-orders)
- [Auto-assign orders](#auto-assign-orders)
- [Manually assign orders](#manually-assign-orders)
- [Documentation](#documentation)
- [Roadmap](#roadmap)

### About

Expand All @@ -89,15 +89,15 @@ _Notice: Network/ Multi-vendor functionality is still a work in progress._

#### Use Cases

- Food delivery app
- Services booking app
- Hyperlocal shopping app
- Hyperlocal marketplace app
- Alcohol delivery app
- Cannabis delivery app
- Lawn care booking app
- Transportation booking app
- and much more...
- Food delivery app
- Services booking app
- Hyperlocal shopping app
- Hyperlocal marketplace app
- Alcohol delivery app
- Cannabis delivery app
- Lawn care booking app
- Transportation booking app
- and much more...

### Screenshots

Expand All @@ -106,10 +106,10 @@ _Notice: Network/ Multi-vendor functionality is still a work in progress._

### Prerequisites

- [Yarn](https://yarnpkg.com/) or [NPM](https://nodejs.org/en/)
- [React Native CLI](https://reactnative.dev/docs/environment-setup)
- Xcode 12+
- Android Studio
- [Yarn](https://yarnpkg.com/) or [NPM](https://nodejs.org/en/)
- [React Native CLI](https://reactnative.dev/docs/environment-setup)
- Xcode 12+
- Android Studio

### Installation

Expand All @@ -128,7 +128,7 @@ corepack enable
corepack prepare [email protected] --activate
yarn
bundle install
cd ios
cd ios
bundle exec pod install
touch .env
```
Expand Down Expand Up @@ -516,8 +516,8 @@ If you would like to make contributions to the Fleetbase Javascript SDK document

### Roadmap

- Global state management with redux
- Write proper react hooks for sdks
- Add debounce on products search
- Add network/marketplace views
- Shopify & Woocommerce adapters
- Global state management with redux
- Write proper react hooks for sdks
- Add debounce on products search
- Add network/marketplace views
- Shopify & Woocommerce adapters
7 changes: 2 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
<title>React Native Web</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:[email protected]&display=swap"
rel="stylesheet"
/>
<link href="https://fonts.googleapis.com/css2?family=Inter:[email protected]&display=swap" rel="stylesheet" />
<style id="bootsplash-style">
#bootsplash {
position: absolute;
Expand All @@ -24,7 +21,7 @@
background-color: #ffffff;
}
#bootsplash-logo {
content: url("data:image/svg+xml;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAMAAACahl6sAAACH1BMVEX///9XT+xORev+/f/+/v9ZUexQSOtYUOxaUuz9/f9cVOzj4vzT0fr8/P9PRutORepVTeuzsPbHxPlPR+tRSetNRetORuuJg/Kno/W3s/fKyPlVTexYUez8/P5bU+zt7P1iWu2SjfPY1vr9/f6opPVMQ+qdmfRTS+v9/P7Ewfjk4vxaU+xSSutZUuxWTuz8+/9jXO3+/v5UTOvQzvqCfPHa2PtQR+uwrfZSSezv7v39/P/7+v9MROv6+f5sZe+cmPSYk/NTSutdVe3x8f5/efHu7v3n5vz4+P6Ig/JvaO/Avfjj4fzl5PyRjPN2b/D///9hWe1ya+9RSOtvaO6TjvOVkPN3cfD19f6ZlfSFf/HNy/r08/67uPdpYu7V0/pWT+uBe/F0be9MROqLhfJfV+2uqvbS0PqlofXf3ftdVeyhnfRTS+ymovXq6f1ORupxau95c/Ds6/1mX+7c2/vNyvmgnPS5tfe1svfJx/m9uvjPzfrFwvhlXe729f6WkfOwrPZUTOxZUOyPivLd3Pv39/7h4PudmPRiW+3Y1vuEfvF5cvCzr/fo5/2GgPFoYe58dvB7dPCNiPKemfSjn/X7+v+MhvKqpvXDwPiXk/PGw/mppfXZ1/t1bu+TjvOppfX9/v/49/7Dwfl9d/GEf/HW1PprZO+4tPfb2fvX1fvg3vysqPZZUevg3/xYT+zv7/1GPepQR+rIxflEO+hDOunOzPrz3QSMAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKAElEQVR4nO2c+XsTxxmAZ9cz2lkT2aLSijZGAqqUDWjl2DKIxkY2NnaMzfHhAwMFY+5whdNAORMgECAQDj+BhOR5kuZqQtu0tP9g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AEBJyDgBAScgF73AVSL/wP7VGvX0DwojAAAAABJRU5ErkJggg==');
width: 100px;
height: 100px;
}
Expand Down
16 changes: 13 additions & 3 deletions src/components/CheckoutButton.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
import { Spinner, YStack, Button, useTheme } from 'tamagui';
import { useNavigation } from '@react-navigation/native';
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome';
import { faRocket, faUnlock } from '@fortawesome/free-solid-svg-icons';
import { formatCurrency } from '../utils/format';
import { useAuth } from '../contexts/AuthContext';
import useCart from '../hooks/use-cart';

const CheckoutButton = ({ total = 0, onCheckout, onAuthRequired, disabled = false, isLoading = false, ...props }) => {
const CheckoutButton = ({ total = 0, onCheckout, onAuthRequired, disabled = false, isLoading = false }) => {
const theme = useTheme();
const navigation = useNavigation();
const { isAuthenticated } = useAuth();
const [cart, updateCart] = useCart();

const handleAuthRequired = () => {
if (typeof onAuthRequired === 'function') {
onAuthRequired();
} else {
navigation.navigate('StoreProfileTab', { screen: 'PhoneLogin' });
}
};

return (
<YStack width='100%'>
{isAuthenticated ? (
<Button onPress={onCheckout} size='$5' bg='$green-600' flex={1} opacity={disabled ? 0.75 : 1} disabled={disabled} {...props}>
<Button onPress={onCheckout} size='$5' bg='$green-600' flex={1} opacity={disabled ? 0.75 : 1} disabled={disabled}>
<Button.Icon>{isLoading ? <Spinner color='$green-100' /> : <FontAwesomeIcon icon={faRocket} color={theme['green-100'].val} />}</Button.Icon>
<Button.Text color='$green-100' fontWeight='bold' fontSize='$5'>
Checkout {formatCurrency(total, cart.getAttribute('currency'))}
</Button.Text>
</Button>
) : (
<Button onPress={onAuthRequired} size='$5' bg='$blue-600' flex={1} disabled={true} {...props}>
<Button onPress={handleAuthRequired} size='$5' bg='$blue-600' flex={1}>
<Button.Icon>
<FontAwesomeIcon icon={faUnlock} color={theme['blue-100'].val} />
</Button.Icon>
Expand Down
Loading

0 comments on commit 98267af

Please sign in to comment.