Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kuza one #517

Open
wants to merge 57 commits into
base: develop
Choose a base branch
from
Open
Changes from 2 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
258dc55
feat: adding sign in flow
Mar 26, 2024
89ba8b6
feat: initial setup for mobilit bap
Mar 26, 2024
2ee6435
Merge pull request #288 from beckn/sign-in-flow
ujjwal502 Mar 26, 2024
526033a
Merge pull request #287 from beckn/mobility-bap
kundanEminds Mar 27, 2024
490f824
feat: homepage ui with bb
Mar 27, 2024
1907105
Merge pull request #292 from beckn/dsep-home-page
ujjwal502 Mar 27, 2024
28f4222
feat: pushing gitignore in dsep
Mar 28, 2024
d8f7834
feat: initial setup of tourism app
Mar 28, 2024
0d79d14
feat: search API integration, type creations and data mapping in hooks
Mar 28, 2024
6de1842
Merge pull request #380 from beckn/tourism-app
ujjwal502 Mar 28, 2024
453a26f
fix: product-summary
ankitShogun Mar 29, 2024
c435d32
Merge pull request #381 from beckn/search-api-integration
ujjwal502 Mar 29, 2024
36bcb5c
feat: auth rtk query integrated properly
ankitShogun Mar 30, 2024
3f12266
feat: search data mapping in low level components
Mar 29, 2024
8a74f44
Merge pull request #441 from beckn/search-api-integration
ujjwal502 Apr 1, 2024
0a9442e
feat: adding generic client layer url
Apr 1, 2024
0a578c4
feat: courses product description page
Apr 1, 2024
40c40a0
feat: integrating gcl
ankitShogun Apr 1, 2024
54ca983
Merge pull request #461 from beckn/dsep-product-description
ujjwal502 Apr 2, 2024
01131b2
feat: adding some changes in the product price bb
Apr 2, 2024
c265ed9
Merge pull request #467 from beckn/dsep-product-description
ujjwal502 Apr 2, 2024
518f975
Merge pull request #464 from beckn/rtk-query-integration
ankitShogun Apr 2, 2024
180a589
feat: course select changes
Apr 2, 2024
80878a3
Merge pull request #472 from beckn/dsep-product-description
ujjwal502 Apr 2, 2024
22d58ae
feat: cart transformer added
ankitShogun Apr 2, 2024
bb89679
feat: cart & checkout
ankitShogun Apr 2, 2024
e59ace3
Merge pull request #477 from beckn/rtk-query-integration
ankitShogun Apr 2, 2024
0088a43
feat: init call initiated
ankitShogun Apr 2, 2024
6d18378
feat: adding init flow (ui, api and data mapping )
Apr 3, 2024
d396f1a
feat: checkout integrated & order details
ankitShogun Apr 3, 2024
b19cb5e
Merge pull request #492 from beckn/courses-init
ujjwal502 Apr 3, 2024
dc76f60
feat: course confirm changes
Apr 3, 2024
c8e6994
Merge pull request #495 from beckn/course-confirm
ujjwal502 Apr 3, 2024
27066be
feat: ui fixes
ankitShogun Apr 4, 2024
af56742
fix: props exported
ankitShogun Apr 4, 2024
5dd68ac
fix: fixed product summary page
Apr 4, 2024
fe156b6
Merge pull request #496 from beckn/kuza-one-product-summary
ankitShogun Apr 4, 2024
9dc0d3e
fix: ui fix 2
ankitShogun Apr 4, 2024
9593046
fix: fixed cart ui issue
Apr 4, 2024
9a74368
feat: coffee catalogs integrated
ankitShogun Apr 4, 2024
4bc1458
Merge pull request #500 from beckn/kuza-one-cart-fix
ankitShogun Apr 4, 2024
0562b7f
feat: order details data mapping
Apr 4, 2024
43724b0
feat: updated changes
ankitShogun Apr 4, 2024
d58ab70
fix: fixed filter functionality
Apr 4, 2024
28b6224
Merge pull request #501 from beckn/kuza-one-ui-fixesV1
ankitShogun Apr 4, 2024
28bfb4a
fix: bottom header fixes
skrushna1704 Apr 4, 2024
0c134b5
Merge pull request #502 from beckn/kuza-one-bugFixes
ankitShogun Apr 4, 2024
d1051b9
feat: product details ui improved
ankitShogun Apr 4, 2024
013237d
Merge pull request #493 from beckn/kuza-one
ankitShogun Apr 4, 2024
dcd7653
fix: ui fixes
ankitShogun Apr 5, 2024
eee2eb7
fix: file structure corrected
ankitShogun Apr 5, 2024
260b4f9
fix: ui
ankitShogun Apr 5, 2024
c9e278d
fix: build issue
ankitShogun Apr 5, 2024
fc99d11
fix: fixed order details data
Apr 5, 2024
5523d8d
Merge pull request #513 from beckn/kuza-one-order-details
ankitShogun Apr 5, 2024
bc2baa4
fix: cuurency issuue and some ui issue
skrushna1704 Apr 5, 2024
f1e3789
Merge pull request #515 from beckn/kuzaOne-currencyBugs
ankitShogun Apr 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions apps/dsep/components/productCard/product-card-renderer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import { Flex, Box, Image, Text } from '@chakra-ui/react'
import { useRouter } from 'next/router'
import React, { useEffect, useState } from 'react'
import { useLanguage } from '../../hooks/useLanguage'
import StarIcon from '../../public/images/Star.svg'
import { Coordinate } from '../../types/common.types'
import { toBinary } from '../../utilities/common-utils'
import ProductPrice from '../UI/ProductPrice'

const ProductCardRenderer = (data: any) => {
// const [distance, setDistance] = useState(0)
const { dataSource } = data
const { t } = useLanguage()
const router = useRouter()
const encodedProduct = window.btoa(toBinary(JSON.stringify(dataSource)))

const extraInfoMapper: { [key: string]: string } = {
// TODO :- To add the mapping of duration
['Duration']: '1 month',
['Sold by']: dataSource.providerName
}

console.log(extraInfoMapper)

// TODO :- to do some refactoring here and get some components from buolding block
return (
<Flex
onClick={() => console.log('this is a product clicked ')}
minH={'168px'}
maxH={'100%'}
boxShadow="0px 20px 25px rgba(0, 0, 0, 0.10), 0px 8px 10px rgba(0, 0, 0, 0.10)"
mt={'64px'}
mx={{ md: 6 }}
rounded="xl"
bg="#fff"
position="relative"
mb={'20px'}
>
<Box w="125px">
<Box>
<Image
width={'110px'}
height={'188px'}
src={dataSource.item.images[0].url}
alt={dataSource.item.name}
borderTopLeftRadius={'10px'}
borderBottomLeftRadius={'10px'}
/>
</Box>
</Box>
<Box
p="10px"
pt="11px"
w="63%"
position="relative"
display={'flex'}
flexDir={'column'}
>
<Flex
justifyContent="space-between"
alignItems="flex-start"
w="100%"
>
<Text
w="80%"
fontWeight="600"
fontSize="15px"
mb="10px"
noOfLines={2}
textOverflow="ellipsis"
whiteSpace="pre-wrap"
overflowWrap="break-word"
>
{dataSource.item.name}
</Text>
</Flex>

{Object.keys(extraInfoMapper).map((key, idx) => {
return (
<Flex
key={idx}
fontSize="12px"
alignItems="center"
mb="8px"
>
<Text fontWeight="600">{key}:</Text>
<Text
pl="3px"
noOfLines={1}
textOverflow="ellipsis"
whiteSpace="pre-wrap"
overflowWrap="break-word"
>
{extraInfoMapper[key]}
</Text>
</Flex>
)
})}

<Flex
justifyContent={'space-between'}
alignItems={'center'}
position={'absolute'}
bottom={'11px'}
width={'calc(100% - 30px)'}
>
<ProductPrice price={parseFloat(dataSource.item.price.value)} />
<Flex alignItems={'center'}>
<Image
alt="rating-icon"
src={StarIcon}
/>
<Text
fontSize="12px"
pl="5px"
>
{dataSource.item.rating}
</Text>
</Flex>
</Flex>
{/* </Flex> */}
</Box>
</Flex>
)
}

export default ProductCardRenderer
97 changes: 48 additions & 49 deletions apps/dsep/components/productList/ProductList.tsx
Original file line number Diff line number Diff line change
@@ -1,72 +1,71 @@
import React, { useEffect, useState } from 'react'
import { useLanguage } from '../../hooks/useLanguage'
import { RetailItem } from '../../lib/types/products'
import Card from '../UI/card/Card'
import Sort from './Sort'
import { useDispatch, useSelector } from 'react-redux'
import { SortedProductsListActions } from '../../store/sortedProductList-slice'
import { IProductListRootState } from '../../lib/types/productList'
import { Box } from '@chakra-ui/react'
import { ParsedItemModel } from '../../types/search.types'
import { ProductCard } from '@beckn-ui/becknified-components'
import ProductCardRenderer from '../productCard/product-card-renderer'

interface Props {
// TODO :- to change this after the proper data mapping in the product cards
productList: any
productList: ParsedItemModel[]
}

export const sortByExpensive = (product1: ParsedItemModel, product2: ParsedItemModel): number => {
return parseFloat(product2.item.price.value) - parseFloat(product1.item.price.value)
}

export const sortByCheapest = (product1: ParsedItemModel, product2: ParsedItemModel): number => {
return parseFloat(product1.item.price.value) - parseFloat(product2.item.price.value)
}

const ProductList: React.FC<Props> = ({ productList }) => {
const { t } = useLanguage()

const [selectedRadioBtn, setSelectedRadioBtn] = useState<string>('all')
const dispatch = useDispatch()
const [sortedProductList, setSortedProductList] = useState<ParsedItemModel[]>(productList)

useEffect(() => {
dispatch(
SortedProductsListActions.sortProductsList({
productsList: productList,
sortBasedOn: selectedRadioBtn
})
)
}, [dispatch, productList, selectedRadioBtn])
const clonedproductList = structuredClone(productList)
if (selectedRadioBtn === 'expensive') {
return setSortedProductList(clonedproductList.sort(sortByExpensive))
}

const sortedProductList = useSelector((state: IProductListRootState) => state.sortedProductsList.productsList)
if (selectedRadioBtn === 'cheapest') {
return setSortedProductList(clonedproductList.sort(sortByCheapest))
}

if (selectedRadioBtn === 'all') {
return setSortedProductList(clonedproductList)
}
}, [selectedRadioBtn])

function onChangeHandler(e: React.ChangeEvent<HTMLInputElement>) {
setSelectedRadioBtn(e.currentTarget.id)
}

return (
<div>
{/* <Breadcrumb /> */}
{/* <SubmenuCategory /> */}

<div className="w-full xl:max-w-[2100px] mx-auto">
{sortedProductList && sortedProductList.length ? (
<div>
<Sort
selectedBtn={selectedRadioBtn}
onChangeSelectedBtn={onChangeHandler}
<>
<Box
mt={'50px'}
className="hideScroll"
maxH={'calc(100vh - 168px)'}
overflowY="scroll"
>
<Sort
onChangeSelectedBtn={onChangeHandler}
selectedBtn={selectedRadioBtn}
/>
<Box marginTop={'107px'}>
{sortedProductList.map((item, idx) => (
<ProductCard
key={idx}
ComponentRenderer={ProductCardRenderer}
dataSource={item}
/>
<div
className="grid gap-4 md:gap-2 grid-cols-6 md:grid-cols-12 hideScroll"
style={{
marginTop: '140px',
maxHeight: 'Calc(100vh - 260px)',
overflowY: 'scroll'
}}
>
{sortedProductList.map((product: RetailItem) => {
return (
<Card
key={product.id}
product={product}
/>
)
})}
</div>
</div>
) : (
<p className="text-palette-mute text-center mt-14">{t.noProduct}</p>
)}
</div>
</div>
))}
</Box>
</Box>
</>
)
}

1 change: 0 additions & 1 deletion apps/dsep/components/productList/Sort.tsx
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@ const Sort: React.FC<Props> = ({ selectedBtn: selectedRadioBtn, onChangeSelected

return (
<Box
mt={'-106px'}
position={'fixed'}
zIndex={'8'}
background={'#fff'}
34 changes: 18 additions & 16 deletions apps/dsep/pages/search.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { useEffect, useState } from 'react'
import { useDispatch } from 'react-redux'
import { Box } from '@chakra-ui/react'
import { LoaderWithMessage } from '@beckn-ui/molecules'
import { ProductCard, Sort } from '@beckn-ui/becknified-components'
import SearchBar from '../components/header/SearchBar'
import ProductList from '../components/productList/ProductList'
import useRequest from '../hooks/useRequest'
@@ -12,6 +14,7 @@ import { useRouter } from 'next/router'
import { getParsedSearchlist } from '../utilities/search-utils'
import { ParsedItemModel, SearchResponseModel } from '../types/search.types'
import CustomToast from '../components/customToast/custom-toast'
import ProductCardRenderer from '../components/productCard/product-card-renderer'

//Mock data for testing search API. Will remove after the resolution of CORS issue

@@ -100,22 +103,21 @@ const Search = () => {
}}
/>
</Box>
<div>
{loading ? (
<div>
<Loader
stylesForLoadingText={{
fontWeight: '600',
fontSize: '16px'
}}
subLoadingText={t.coursesCatalogLoader}
loadingText={t.catalogLoader}
/>
</div>
) : (
<ProductList productList={items} />
)}
</div>

{loading ? (
<Box
display={'grid'}
height={'calc(100vh - 300px)'}
alignContent={'center'}
>
<LoaderWithMessage
loadingText={t.catalogLoader}
loadingSubText={t.coursesCatalogLoader}
/>
</Box>
) : (
<ProductList productList={items} />
)}
</>
)
}
3 changes: 3 additions & 0 deletions packages/molecules/src/components/LoaderWithMessage/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import LoaderWithMessage from './loader-with-message'

export default LoaderWithMessage
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Loader } from '@beckn-ui/molecules'
import { Box, Text } from '@chakra-ui/react'
import React from 'react'
import { LoaderWithMessagePropsModel } from './loader-with-message.types'

const LoaderWithMessage: React.FC<LoaderWithMessagePropsModel> = props => {
const { loadingText = '', loadingSubText = '' } = props
return (
<Loader>
<Box
mt={'13px'}
display={'flex'}
flexDir={'column'}
alignItems={'center'}
>
<Text
fontWeight={600}
fontSize={'17px'}
>
{loadingText}
</Text>
<Text
textAlign={'center'}
fontWeight={400}
fontSize={'15px'}
>
{loadingSubText}
</Text>
</Box>
</Loader>
)
}

export default React.memo(LoaderWithMessage)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface LoaderWithMessagePropsModel {
loadingText: string
loadingSubText: string
}
1 change: 1 addition & 0 deletions packages/molecules/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -6,3 +6,4 @@ export { default as Typography } from './typography'
export { default as Input } from './input'
export { default as Form } from './form'
export { default as BottomModal } from './bottom-modal'
export { default as LoaderWithMessage } from './LoaderWithMessage'
1 change: 1 addition & 0 deletions packages/molecules/src/components/types.ts
Original file line number Diff line number Diff line change
@@ -5,3 +5,4 @@ export * from './typography/typography.types'
export * from './beckn-provider/beckn-provider.types'
export * from './form/form.types'
export * from './bottom-modal/bottom-modal.types'
export * from './LoaderWithMessage/loader-with-message.types'