In home page, you can see the showcases and products. You can also add products to your cart.
-
In home page, we have 4 API calls in Promise. All of them are asynchronous.
-
Showcase API call, which returns a list of showcases.
-
Product API call, which returns a list of products.
-
Banner API call, which returns a list of banners.
-
Categories API call, which returns a list of categories.
-
-
We recommend you to call the API calls in
onShowevent.onLoadis best for the set up of the UI and lists. You can face some UI issues if you call the API calls inonLoadevent. -
We create a
initializedvariable to check if the API calls are done and prevent the call of the API calls again. -
We use
Processorsfor the create dynamic ListView UI elements. -
For Banners, we set dynamic height based on the screen width.
In product detail page, you can see the product details. You can also add the product to your cart and favorite the product.
-
In product detail page, we have product API call based on the product id.
-
In reviews page, If user logged in, user can be review the product.
-
In nutrition page, User can be see the nutrition information.
-
We use SwipeView for the product images.
FlSwipeViewis a wrapper ofSwipeViewand it is used to create a swipe view. -
We use the share button to share the product. When someone click the share button, we will open the share dialog.
-
If someone click the shared link, we will open the product detail page. We do it by using Deeplink.
-
You can look at the
deeplink.tsfor specific deeplink implementation.
In categories (explorer) page, you can see the categories
-
In categories (explorer) page, we have API call for the get categories.
-
We use GridView to list the categories.
-
We use
waitDialogto show the loading while the API call is running.
-
-
We have workaround on this page to due to the Theme issue.
-
if (System.OS === System.OSType.ANDROID) { //Android item widths fails after theme change this fixes it themeService.onChange(() => { this.categoriesGrid.itemCount = this.categories.length; this.categoriesGrid.refreshData(); }); }
-
π Dialog
In category detail page, you can see the products in the category. You can also add products to your cart and search products with the search bar on the top right corner.
-
In category detail page, we have API call for the get products in the category.
-
We use ListView to list the products.
-
We use
waitDialogto show the loading while the API call is running. -
This page also serves
Showcasesproducts along with the products in the category.
-
-
If category or showcases are empty, we show a
Empty Itemin the list.
-
this.route.getState().routeData.isShowcaseis used to check if the products areShowcaseproducts.-
If it is
Showcaseproducts, we show the showcase products in the category detail page. -
If it is
Categoryproducts, we show the products in the category detail page.
-
In cart page, you can see the products in your cart. You can also remove products from your cart and set the quantity of the products.
-
We use
Processorsfor the create dynamic ListView for the list of products in the cart. -
We use
stateto store the products in the cart. On every change of the state, we update the UI and checkout price of the products.
-
In
onShowevent, we usestore.subscribeevent:- To get state changes from the store, and change the UI accordingly.
In favorites page, you can see the products in your favorites. You can also remove products from your favorites.
-
We use
Processorsfor the create dynamic ListView for the list of products in the favorites. -
We use
stateto set and get the products in the favorites. -
We use ListView Swipe to remove products from the favorites.
-
If favorites are empty, we show a
Empty Itemin the list.
In account page, you can see the account information. You can also change the account information and Login/Logout.
-
We use
Processorsfor the create dynamic ListView for the list of account menu. -
We use
stateto get is the user logged in or not. Based on the state, we show the login/logout button.
In settings page, you can change the theme.
- This page is singleton to avoid the create theme instance every time.
π Dialog
We seperate the routes into two parts:
Auth.tsTabbar.ts
They are used to handle the authentication and tabbar and merge them into one file named index.ts in the /scripts/routes folder.
-
We use Tabbar to create the tabbar.
-
Someof pages are modal and stack on top of the other.
pgProductDetailis modal.pgCategoryDetailis modal.
-
In
Tabbar.ts, we watch thebasketCounterstate to update theCarttabbar badge.
π Tabbar
π Pages
In Auth.ts, route is used Login and Signup pages.
-
pgLoginis used to login. There is aLoginbutton on the page. When the user click the button, we call theloginmethod in theAuth.tsservice.-
There is simple validate for the password and email.
-
There is a regex to validate the email.
-
-
pgSignupis used to signup. There is aSignupbutton on the page. When the user click the button, we call thesignupmethod in thecommerce.tsservice.-
There is simple validate for the password and email.
-
There is a regex to validate the email.
-
We use
AttributedStringto create signup terms and conditions text.
-
π TextView
-
We use
textStyleCatalogto set the text style for the text in the app. -
We defined types in the
types.tsfile. -
We use
Reduxto store the state of the app and actions. For more information, please refer to theReduxdocumentation. -
We use
listViewItemTypes.tsto define the type of the listview items and use them in theProcessorsfor the create dynamic ListView. -
We use
Processorsfor the create dynamic ListView. -
setTextDimentions.ts is used to set the text dimentions dynamically.
-
waitDialog.ts is used to show the loading while the API call is running.
-
scripts/serviceFolder is used to store the services:-
commerce.tsis used to call the API's. -
auth.tsis used to handle the authentication. -
index.tsis used to create http service call object. -
token.tsis used to store the token and user information.
-