Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
d528b282
Unverified
Commit
d528b282
authored
Nov 22, 2022
by
lynn
Committed by
GitHub
Nov 22, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: nft promo banner init state fix (#5384)
init
parent
c1cb7120
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
13 deletions
+13
-13
NftExploreBanner.tsx
src/nft/components/nftExploreBanner/NftExploreBanner.tsx
+5
-5
hooks.tsx
src/state/user/hooks.tsx
+5
-5
reducer.ts
src/state/user/reducer.ts
+3
-3
No files found.
src/nft/components/nftExploreBanner/NftExploreBanner.tsx
View file @
d528b282
...
@@ -4,7 +4,7 @@ import { Box } from 'nft/components/Box'
...
@@ -4,7 +4,7 @@ import { Box } from 'nft/components/Box'
import
{
bodySmall
,
subhead
}
from
'
nft/css/common.css
'
import
{
bodySmall
,
subhead
}
from
'
nft/css/common.css
'
import
{
X
}
from
'
react-feather
'
import
{
X
}
from
'
react-feather
'
import
{
useNavigate
}
from
'
react-router-dom
'
import
{
useNavigate
}
from
'
react-router-dom
'
import
{
use
Show
NftPromoBanner
}
from
'
state/user/hooks
'
import
{
use
Hide
NftPromoBanner
}
from
'
state/user/hooks
'
import
styled
from
'
styled-components/macro
'
import
styled
from
'
styled-components/macro
'
import
{
StyledInternalLink
}
from
'
theme
'
import
{
StyledInternalLink
}
from
'
theme
'
import
{
Z_INDEX
}
from
'
theme/zIndex
'
import
{
Z_INDEX
}
from
'
theme/zIndex
'
...
@@ -88,16 +88,16 @@ const StyledImageContainer = styled(Box)`
...
@@ -88,16 +88,16 @@ const StyledImageContainer = styled(Box)`
`
`
export
default
function
NftExploreBanner
()
{
export
default
function
NftExploreBanner
()
{
const
[
showNftPromoBanner
,
stopShowingNftPromoBanner
]
=
useShow
NftPromoBanner
()
const
[
hideNftPromoBanner
,
toggleHideNftPromoBanner
]
=
useHide
NftPromoBanner
()
const
navigate
=
useNavigate
()
const
navigate
=
useNavigate
()
const
navigateToNfts
=
()
=>
{
const
navigateToNfts
=
()
=>
{
navigate
(
'
/nfts
'
)
navigate
(
'
/nfts
'
)
stopShowing
NftPromoBanner
()
toggleHide
NftPromoBanner
()
}
}
return
(
return
(
<
PopupContainer
show=
{
show
NftPromoBanner
}
onClick=
{
navigateToNfts
}
>
<
PopupContainer
show=
{
!
hide
NftPromoBanner
}
onClick=
{
navigateToNfts
}
>
<
InnerContainer
>
<
InnerContainer
>
<
StyledImageContainer
as=
"img"
src=
{
randomizedNftImage
}
draggable=
{
false
}
/>
<
StyledImageContainer
as=
"img"
src=
{
randomizedNftImage
}
draggable=
{
false
}
/>
<
TextContainer
>
<
TextContainer
>
...
@@ -121,7 +121,7 @@ export default function NftExploreBanner() {
...
@@ -121,7 +121,7 @@ export default function NftExploreBanner() {
onClick=
{
(
e
)
=>
{
onClick=
{
(
e
)
=>
{
e
.
preventDefault
()
e
.
preventDefault
()
e
.
stopPropagation
()
e
.
stopPropagation
()
stopShowing
NftPromoBanner
()
toggleHide
NftPromoBanner
()
}
}
}
}
/>
/>
</
InnerContainer
>
</
InnerContainer
>
...
...
src/state/user/hooks.tsx
View file @
d528b282
...
@@ -272,15 +272,15 @@ export function useURLWarningVisible(): boolean {
...
@@ -272,15 +272,15 @@ export function useURLWarningVisible(): boolean {
return
useAppSelector
((
state
:
AppState
)
=>
state
.
user
.
URLWarningVisible
)
return
useAppSelector
((
state
:
AppState
)
=>
state
.
user
.
URLWarningVisible
)
}
}
export
function
use
Show
NftPromoBanner
():
[
boolean
,
()
=>
void
]
{
export
function
use
Hide
NftPromoBanner
():
[
boolean
,
()
=>
void
]
{
const
dispatch
=
useAppDispatch
()
const
dispatch
=
useAppDispatch
()
const
showNftPromoBanner
=
useAppSelector
((
state
)
=>
state
.
user
.
NFTPromoBannerVisible
)
const
hideNftPromoBanner
=
useAppSelector
((
state
)
=>
state
.
user
.
hideNFTPromoBanner
)
const
stopShowing
NftPromoBanner
=
useCallback
(()
=>
{
const
toggleHide
NftPromoBanner
=
useCallback
(()
=>
{
dispatch
(
updateShowNftPromoBanner
({
showNftPromoBanner
:
fals
e
}))
dispatch
(
updateShowNftPromoBanner
({
hideNFTPromoBanner
:
tru
e
}))
},
[
dispatch
])
},
[
dispatch
])
return
[
showNftPromoBanner
,
stopShowing
NftPromoBanner
]
return
[
hideNftPromoBanner
,
toggleHide
NftPromoBanner
]
}
}
/**
/**
...
...
src/state/user/reducer.ts
View file @
d528b282
...
@@ -48,7 +48,7 @@ export interface UserState {
...
@@ -48,7 +48,7 @@ export interface UserState {
timestamp
:
number
timestamp
:
number
URLWarningVisible
:
boolean
URLWarningVisible
:
boolean
NFTPromoBannerVisible
:
boolean
// whether or not we should show
the nft explore promo banner
hideNFTPromoBanner
:
boolean
// whether or not we should hide
the nft explore promo banner
// undefined means has not gone through A/B split yet
// undefined means has not gone through A/B split yet
showSurveyPopup
:
boolean
|
undefined
showSurveyPopup
:
boolean
|
undefined
...
@@ -75,7 +75,7 @@ export const initialState: UserState = {
...
@@ -75,7 +75,7 @@ export const initialState: UserState = {
pairs
:
{},
pairs
:
{},
timestamp
:
currentTimestamp
(),
timestamp
:
currentTimestamp
(),
URLWarningVisible
:
true
,
URLWarningVisible
:
true
,
NFTPromoBannerVisible
:
tru
e
,
hideNFTPromoBanner
:
fals
e
,
showSurveyPopup
:
undefined
,
showSurveyPopup
:
undefined
,
showDonationLink
:
true
,
showDonationLink
:
true
,
}
}
...
@@ -124,7 +124,7 @@ const userSlice = createSlice({
...
@@ -124,7 +124,7 @@ const userSlice = createSlice({
state
.
showDonationLink
=
action
.
payload
.
showDonationLink
state
.
showDonationLink
=
action
.
payload
.
showDonationLink
},
},
updateShowNftPromoBanner
(
state
,
action
)
{
updateShowNftPromoBanner
(
state
,
action
)
{
state
.
NFTPromoBannerVisible
=
action
.
payload
.
NFTPromoBannerVisible
state
.
hideNFTPromoBanner
=
action
.
payload
.
hideNFTPromoBanner
},
},
addSerializedToken
(
state
,
{
payload
:
{
serializedToken
}
})
{
addSerializedToken
(
state
,
{
payload
:
{
serializedToken
}
})
{
if
(
!
state
.
tokens
)
{
if
(
!
state
.
tokens
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment