-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Affiliates banner and share dialog ui (#985)
- Loading branch information
Showing
14 changed files
with
297 additions
and
8 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,3 @@ | ||
export const AFFILIATES_EARN_PER_MONTH = 1500; | ||
|
||
export const AFFILIATES_FEE_DISCOUNT = 500; |
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
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
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 |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { styled } from 'twin.macro'; | ||
|
||
import { AFFILIATES_EARN_PER_MONTH, AFFILIATES_FEE_DISCOUNT } from '@/constants/affiliates'; | ||
import { ButtonAction, ButtonSize } from '@/constants/buttons'; | ||
import { DialogTypes } from '@/constants/dialogs'; | ||
import { STRING_KEYS } from '@/constants/localization'; | ||
|
||
import { useStringGetter } from '@/hooks/useStringGetter'; | ||
import { useURLConfigs } from '@/hooks/useURLConfigs'; | ||
|
||
import { Button } from '@/components/Button'; | ||
import { Icon, IconName } from '@/components/Icon'; | ||
import { Link } from '@/components/Link'; | ||
|
||
import { useAppDispatch } from '@/state/appTypes'; | ||
import { openDialog } from '@/state/dialogs'; | ||
|
||
export const AffiliatesBanner = () => { | ||
const stringGetter = useStringGetter(); | ||
const { affiliateProgram } = useURLConfigs(); | ||
|
||
const dispatch = useAppDispatch(); | ||
return ( | ||
<$Background tw="row m-1 justify-between gap-0.5 rounded-0.5 bg-color-layer-1 pl-1 pr-2"> | ||
<div tw="row"> | ||
<img src="/affiliates-hedgie.png" alt="affiliates hedgie" tw="mt-1 h-8" /> | ||
<div tw="column items-start gap-0.5"> | ||
<div tw="row"> | ||
<$Triangle /> | ||
<div tw="inline-block rounded-0.5 bg-color-layer-6 px-1 py-0.5 font-bold text-color-text-2"> | ||
{stringGetter({ | ||
key: STRING_KEYS.EARN_FOR_EACH_TRADER, | ||
params: { AMOUNT_USD: AFFILIATES_EARN_PER_MONTH.toLocaleString() }, | ||
})} | ||
</div> | ||
</div> | ||
<div tw="ml-0.5"> | ||
{stringGetter({ | ||
key: STRING_KEYS.REFER_FOR_DISCOUNTS_FIRST_ORDER, | ||
params: { | ||
AMOUNT_USD: AFFILIATES_FEE_DISCOUNT.toLocaleString(), | ||
}, | ||
})}{' '} | ||
<br /> | ||
{stringGetter({ | ||
key: STRING_KEYS.WANT_TO_VIEW_EARNINGS, | ||
params: { | ||
LINK: ( | ||
<Link href={affiliateProgram} isInline isAccent> | ||
{stringGetter({ key: STRING_KEYS.AFFILIATES_PROGRAM })} → | ||
</Link> | ||
), | ||
}, | ||
})} | ||
</div> | ||
</div> | ||
</div> | ||
<div> | ||
<Button | ||
action={ButtonAction.Primary} | ||
slotLeft={<Icon iconName={IconName.Giftbox} />} | ||
size={ButtonSize.Medium} | ||
onClick={() => { | ||
dispatch(openDialog(DialogTypes.ShareAffiliate())); | ||
}} | ||
> | ||
{stringGetter({ key: STRING_KEYS.INVITE_FRIENDS })} | ||
</Button> | ||
</div> | ||
</$Background> | ||
); | ||
}; | ||
|
||
const $Background = styled.div` | ||
background-image: url('/grid-background.svg'); | ||
background-repeat: no-repeat; | ||
background-position-x: 100%; | ||
background-size: contain; | ||
`; | ||
|
||
const $Triangle = styled.div` | ||
width: 0; | ||
height: 0; | ||
border-top: 0.5rem solid transparent; | ||
border-bottom: 0.5rem solid transparent; | ||
border-right: 0.5rem solid var(--color-layer-6); | ||
`; |
Oops, something went wrong.