-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from nada-deriv/migration
feat: src and hooks from v2
- Loading branch information
Showing
750 changed files
with
31,534 additions
and
38 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
import { QueryParamProvider } from 'use-query-params'; | ||
import { ReactRouter5Adapter } from 'use-query-params/adapters/react-router-5'; | ||
|
||
import AppContent from './routes/AppContent'; | ||
|
||
const App = () => { | ||
return <div>Deriv P2P</div>; | ||
return ( | ||
<QueryParamProvider adapter={ReactRouter5Adapter}> | ||
<AppContent /> | ||
</QueryParamProvider> | ||
); | ||
}; | ||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.p2p-advertiser-name { | ||
display: grid; | ||
grid-gap: 1.6rem; | ||
grid-template-columns: min-content auto max-content; | ||
|
||
@include mobile { | ||
grid-template-columns: min-content auto; | ||
} | ||
|
||
&__details { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
gap: 0.4rem; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { TAdvertiserStats } from 'types'; | ||
|
||
import { useSettings } from '@deriv/api-v2'; | ||
import { LabelPairedEllipsisVerticalLgRegularIcon } from '@deriv/quill-icons'; | ||
import { Text, useDevice } from '@deriv-com/ui'; | ||
|
||
import { UserAvatar } from '@/components'; | ||
import { getCurrentRoute } from '@/utils'; | ||
|
||
import AdvertiserNameBadges from './AdvertiserNameBadges'; | ||
import AdvertiserNameStats from './AdvertiserNameStats'; | ||
import AdvertiserNameToggle from './AdvertiserNameToggle'; | ||
|
||
import './AdvertiserName.scss'; | ||
|
||
const AdvertiserName = ({ advertiserStats }: { advertiserStats: DeepPartial<TAdvertiserStats> }) => { | ||
const { | ||
data: { email }, | ||
} = useSettings(); | ||
const { isDesktop } = useDevice(); | ||
const isMyProfile = getCurrentRoute() === 'my-profile'; | ||
|
||
const name = advertiserStats?.name || email; | ||
|
||
return ( | ||
<div className='p2p-advertiser-name' data-testid='dt_advertiser_name'> | ||
<UserAvatar nickname={name!} size={isDesktop ? 64 : 42} textSize='lg' /> | ||
<div className='p2p-advertiser-name__details'> | ||
<div className='flex items-center gap-3'> | ||
<Text size='md' weight='bold'> | ||
{name} | ||
</Text> | ||
{(advertiserStats?.should_show_name || !isMyProfile) && ( | ||
<Text color='less-prominent' size='sm'> | ||
({advertiserStats?.fullName}) | ||
</Text> | ||
)} | ||
</div> | ||
<AdvertiserNameStats advertiserStats={advertiserStats} /> | ||
<AdvertiserNameBadges advertiserStats={advertiserStats} /> | ||
</div> | ||
{isDesktop && isMyProfile && <AdvertiserNameToggle advertiserInfo={advertiserStats} />} | ||
{isDesktop && !isMyProfile && <LabelPairedEllipsisVerticalLgRegularIcon className='cursor-pointer' />} | ||
</div> | ||
); | ||
}; | ||
AdvertiserName.displayName = 'AdvertiserName'; | ||
|
||
export default AdvertiserName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.p2p-advertiser-name-badges { | ||
display: flex; | ||
gap: 0.4rem; | ||
padding: 0.4rem 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { TAdvertiserStats } from 'types'; | ||
|
||
import { Badge } from '@/components'; | ||
|
||
import './AdvertiserNameBadges.scss'; | ||
|
||
/** | ||
* This component is used to show an advertiser's badge, for instance: | ||
* +100 Trades, ID verified, Address not verified, etc | ||
* | ||
* Use cases are usually in My Profile page and Advertiser page used under the advertiser's name | ||
*/ | ||
const AdvertiserNameBadges = ({ advertiserStats }: { advertiserStats: DeepPartial<TAdvertiserStats> }) => { | ||
const { isAddressVerified, isIdentityVerified, totalOrders } = advertiserStats || {}; | ||
|
||
return ( | ||
<div className='p2p-advertiser-name-badges' data-testid='dt_advertiser_name_badges'> | ||
{(totalOrders || 0) >= 100 && <Badge label='100+' status='trades' variant='warning' />} | ||
<Badge | ||
label='ID' | ||
status={isIdentityVerified ? 'verified' : 'not verified'} | ||
variant={isIdentityVerified ? 'success' : 'general'} | ||
/> | ||
<Badge | ||
label='Address' | ||
status={isAddressVerified ? 'verified' : 'not verified'} | ||
variant={isAddressVerified ? 'success' : 'general'} | ||
/> | ||
</div> | ||
); | ||
}; | ||
AdvertiserNameBadges.displayName = 'AdvertiserNameBadges'; | ||
|
||
export default AdvertiserNameBadges; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.p2p-advertiser-name-stats { | ||
display: flex; | ||
align-items: center; | ||
|
||
@include mobile { | ||
flex-direction: column; | ||
align-items: flex-start; | ||
justify-content: center; | ||
gap: 2rem; | ||
} | ||
|
||
& div { | ||
display: flex; | ||
align-items: center; | ||
gap: 0.8rem; | ||
padding: 0 0.8rem; | ||
border-left: 1px solid #f2f3f4; | ||
|
||
@include mobile { | ||
border-left: none; | ||
padding: 0; | ||
} | ||
|
||
&:first-child { | ||
padding-left: 0; | ||
padding-right: 0.8rem; | ||
border-left: none; | ||
} | ||
} | ||
|
||
&__rating { | ||
display: flex; | ||
gap: 0.5rem; | ||
} | ||
} |
Oops, something went wrong.