Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
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
vicotor
frontend
Commits
b903406f
Commit
b903406f
authored
Sep 08, 2023
by
isstuev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
design changes
parent
ff1463e2
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
42 additions
and
43 deletions
+42
-43
AddressQrCode.tsx
ui/address/details/AddressQrCode.tsx
+2
-2
NFTItem.tsx
ui/address/tokens/NFTItem.tsx
+7
-8
NftFallback.tsx
ui/shared/nft/NftFallback.tsx
+4
-3
NftImageWithFullscreen.tsx
ui/shared/nft/NftImageWithFullscreen.tsx
+1
-1
NftMedia.tsx
ui/shared/nft/NftMedia.tsx
+4
-1
NftMediaFullscreenModal.tsx
ui/shared/nft/NftMediaFullscreenModal.tsx
+1
-1
NftVideo.tsx
ui/shared/nft/NftVideo.tsx
+2
-6
NftVideoWithFullscreen.tsx
ui/shared/nft/NftVideoWithFullscreen.tsx
+2
-5
utils.ts
ui/shared/nft/utils.ts
+8
-0
TokenInventoryItem.tsx
ui/token/TokenInventoryItem.tsx
+11
-16
No files found.
ui/address/details/AddressQrCode.tsx
View file @
b903406f
...
@@ -21,10 +21,11 @@ import QRCode from 'qrcode';
...
@@ -21,10 +21,11 @@ import QRCode from 'qrcode';
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
Address
as
AddressType
}
from
'
types/api/address
'
;
import
type
{
Address
as
AddressType
}
from
'
types/api/address
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
qrCodeIcon
from
'
icons/qr_code.svg
'
;
import
qrCodeIcon
from
'
icons/qr_code.svg
'
;
import
getPageType
from
'
lib/mixpanel/getPageType
'
;
import
getPageType
from
'
lib/mixpanel/getPageType
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
const
SVG_OPTIONS
=
{
const
SVG_OPTIONS
=
{
margin
:
0
,
margin
:
0
,
...
@@ -101,7 +102,6 @@ const AddressQrCode = ({ address, className, isLoading }: Props) => {
...
@@ -101,7 +102,6 @@ const AddressQrCode = ({ address, className, isLoading }: Props) => {
<
ModalBody
mb=
{
0
}
>
<
ModalBody
mb=
{
0
}
>
<
AddressEntity
<
AddressEntity
mb=
{
3
}
mb=
{
3
}
fontSize=
"md"
fontWeight=
{
500
}
fontWeight=
{
500
}
color=
"text"
color=
"text"
address=
{
address
}
address=
{
address
}
...
...
ui/address/tokens/NFTItem.tsx
View file @
b903406f
import
{
Flex
,
Link
,
Text
,
LinkBox
,
LinkOverlay
,
useColorModeValue
,
Skeleton
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
Flex
,
Link
,
Text
,
useColorModeValue
,
Skeleton
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
AddressTokenBalance
}
from
'
types/api/address
'
;
import
type
{
AddressTokenBalance
}
from
'
types/api/address
'
;
...
@@ -12,27 +12,26 @@ import TruncatedTextTooltip from 'ui/shared/TruncatedTextTooltip';
...
@@ -12,27 +12,26 @@ import TruncatedTextTooltip from 'ui/shared/TruncatedTextTooltip';
type
Props
=
AddressTokenBalance
&
{
isLoading
:
boolean
};
type
Props
=
AddressTokenBalance
&
{
isLoading
:
boolean
};
const
NFTItem
=
({
token
,
token_id
:
tokenId
,
token_instance
:
tokenInstance
,
isLoading
}:
Props
)
=>
{
const
NFTItem
=
({
token
,
token_id
:
tokenId
,
token_instance
:
tokenInstance
,
isLoading
}:
Props
)
=>
{
const
token
Link
=
route
({
pathname
:
'
/token/[hash]
'
,
query
:
{
hash
:
token
.
address
}
})
;
const
token
InstanceLink
=
tokenId
?
route
({
pathname
:
'
/token/[hash]/instance/[id]
'
,
query
:
{
hash
:
token
.
address
,
id
:
tokenId
}
})
:
undefined
;
return
(
return
(
<
Link
Box
<
Box
w=
{
{
base
:
'
100%
'
,
lg
:
'
210px
'
}
}
w=
{
{
base
:
'
100%
'
,
lg
:
'
210px
'
}
}
border=
"1px solid"
border=
"1px solid"
borderColor=
{
useColorModeValue
(
'
blackAlpha.100
'
,
'
whiteAlpha.200
'
)
}
borderColor=
{
useColorModeValue
(
'
blackAlpha.100
'
,
'
whiteAlpha.200
'
)
}
borderRadius=
"12px"
borderRadius=
"12px"
p=
"10px"
p=
"10px"
_hover=
{
{
boxShadow
:
'
md
'
}
}
fontSize=
"sm"
fontSize=
"sm"
fontWeight=
{
500
}
fontWeight=
{
500
}
lineHeight=
"20px"
lineHeight=
"20px"
>
>
<
Link
Overlay
href=
{
isLoading
?
undefined
:
token
Link
}
>
<
Link
href=
{
isLoading
?
undefined
:
tokenInstance
Link
}
>
<
NftMedia
<
NftMedia
mb=
"18px"
mb=
"18px"
url=
{
tokenInstance
?.
animation_url
||
tokenInstance
?.
image_url
||
null
}
url=
{
tokenInstance
?.
animation_url
||
tokenInstance
?.
image_url
||
null
}
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
/>
/>
</
Link
Overlay
>
</
Link
>
{
tokenId
&&
(
{
tokenId
&&
(
<
Flex
mb=
{
2
}
ml=
{
1
}
>
<
Flex
mb=
{
2
}
ml=
{
1
}
>
<
Text
whiteSpace=
"pre"
variant=
"secondary"
>
ID#
</
Text
>
<
Text
whiteSpace=
"pre"
variant=
"secondary"
>
ID#
</
Text
>
...
@@ -44,7 +43,7 @@ const NFTItem = ({ token, token_id: tokenId, token_instance: tokenInstance, isLo
...
@@ -44,7 +43,7 @@ const NFTItem = ({ token, token_id: tokenId, token_instance: tokenInstance, isLo
whiteSpace=
"nowrap"
whiteSpace=
"nowrap"
textOverflow=
"ellipsis"
textOverflow=
"ellipsis"
overflow=
"hidden"
overflow=
"hidden"
href=
{
route
({
pathname
:
'
/token/[hash]/instance/[id]
'
,
query
:
{
hash
:
token
.
address
,
id
:
tokenId
}
})
}
href=
{
tokenInstanceLink
}
>
>
{
tokenId
}
{
tokenId
}
</
Link
>
</
Link
>
...
@@ -58,7 +57,7 @@ const NFTItem = ({ token, token_id: tokenId, token_instance: tokenInstance, isLo
...
@@ -58,7 +57,7 @@ const NFTItem = ({ token, token_id: tokenId, token_instance: tokenInstance, isLo
noCopy
noCopy
noSymbol
noSymbol
/>
/>
</
Link
Box
>
</
Box
>
);
);
};
};
...
...
ui/shared/nft/NftFallback.tsx
View file @
b903406f
import
{
Icon
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
Icon
,
useColorModeValue
,
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
nftIcon
from
'
icons/nft_shield.svg
'
;
import
nftIcon
from
'
icons/nft_shield.svg
'
;
const
NftFallback
=
()
=>
{
const
NftFallback
=
(
{
className
}:
{
className
?:
string
}
)
=>
{
return
(
return
(
<
Icon
<
Icon
className=
{
className
}
as=
{
nftIcon
}
as=
{
nftIcon
}
p=
"50px"
p=
"50px"
color=
{
useColorModeValue
(
'
blackAlpha.500
'
,
'
whiteAlpha.500
'
)
}
color=
{
useColorModeValue
(
'
blackAlpha.500
'
,
'
whiteAlpha.500
'
)
}
...
@@ -14,4 +15,4 @@ const NftFallback = () => {
...
@@ -14,4 +15,4 @@ const NftFallback = () => {
);
);
};
};
export
default
NftFallback
;
export
default
chakra
(
NftFallback
)
;
ui/shared/nft/NftImageWithFullscreen.tsx
View file @
b903406f
...
@@ -20,7 +20,7 @@ const NftImageWithFullscreen = ({ src, onLoad, onError }: Props) => {
...
@@ -20,7 +20,7 @@ const NftImageWithFullscreen = ({ src, onLoad, onError }: Props) => {
<>
<>
<
NftImage
src=
{
src
}
onLoad=
{
onLoad
}
onError=
{
onError
}
onClick=
{
onOpen
}
/>
<
NftImage
src=
{
src
}
onLoad=
{
onLoad
}
onError=
{
onError
}
onClick=
{
onOpen
}
/>
<
NftMediaFullscreenModal
isOpen=
{
isOpen
}
onClose=
{
onClose
}
>
<
NftMediaFullscreenModal
isOpen=
{
isOpen
}
onClose=
{
onClose
}
>
<
Image
src=
{
src
}
alt=
"Token instance image"
maxH=
"90vh"
w=
"100%"
maxW=
"90vw"
/>
<
Image
src=
{
src
}
alt=
"Token instance image"
maxH=
"90vh"
maxW=
"90vw"
/>
</
NftMediaFullscreenModal
>
</
NftMediaFullscreenModal
>
</>
</>
);
);
...
...
ui/shared/nft/NftMedia.tsx
View file @
b903406f
...
@@ -10,6 +10,7 @@ import NftImageWithFullscreen from './NftImageWithFullscreen';
...
@@ -10,6 +10,7 @@ import NftImageWithFullscreen from './NftImageWithFullscreen';
import
NftVideo
from
'
./NftVideo
'
;
import
NftVideo
from
'
./NftVideo
'
;
import
NftVideoWithFullscreen
from
'
./NftVideoWithFullscreen
'
;
import
NftVideoWithFullscreen
from
'
./NftVideoWithFullscreen
'
;
import
useNftMediaType
from
'
./useNftMediaType
'
;
import
useNftMediaType
from
'
./useNftMediaType
'
;
import
{
mediaStyleProps
}
from
'
./utils
'
;
interface
Props
{
interface
Props
{
url
:
string
|
null
;
url
:
string
|
null
;
...
@@ -23,6 +24,7 @@ const NftMedia = ({ url, className, isLoading, withFullscreen }: Props) => {
...
@@ -23,6 +24,7 @@ const NftMedia = ({ url, className, isLoading, withFullscreen }: Props) => {
const
[
isLoadingError
,
setIsLoadingError
]
=
React
.
useState
(
false
);
const
[
isLoadingError
,
setIsLoadingError
]
=
React
.
useState
(
false
);
const
{
ref
,
inView
}
=
useInView
({
triggerOnce
:
true
});
const
{
ref
,
inView
}
=
useInView
({
triggerOnce
:
true
});
const
type
=
useNftMediaType
(
url
,
!
isLoading
&&
inView
);
const
type
=
useNftMediaType
(
url
,
!
isLoading
&&
inView
);
const
handleMediaLoaded
=
React
.
useCallback
(()
=>
{
const
handleMediaLoaded
=
React
.
useCallback
(()
=>
{
...
@@ -36,7 +38,8 @@ const NftMedia = ({ url, className, isLoading, withFullscreen }: Props) => {
...
@@ -36,7 +38,8 @@ const NftMedia = ({ url, className, isLoading, withFullscreen }: Props) => {
const
content
=
(()
=>
{
const
content
=
(()
=>
{
if
(
!
url
||
isLoadingError
)
{
if
(
!
url
||
isLoadingError
)
{
return
<
NftFallback
/>;
const
styleProps
=
withFullscreen
?
{}
:
mediaStyleProps
;
return
<
NftFallback
{
...
styleProps
}
/>;
}
}
const
props
=
{
const
props
=
{
...
...
ui/shared/nft/NftMediaFullscreenModal.tsx
View file @
b903406f
...
@@ -17,7 +17,7 @@ const NftMediaFullscreenModal = ({ isOpen, onClose, children }: Props) => {
...
@@ -17,7 +17,7 @@ const NftMediaFullscreenModal = ({ isOpen, onClose, children }: Props) => {
<
Modal
isOpen=
{
isOpen
}
onClose=
{
onClose
}
motionPreset=
"none"
>
<
Modal
isOpen=
{
isOpen
}
onClose=
{
onClose
}
motionPreset=
"none"
>
<
ModalOverlay
/>
<
ModalOverlay
/>
<
ModalContent
w=
"unset"
maxW=
"100vw"
p=
{
0
}
>
<
ModalContent
w=
"unset"
maxW=
"100vw"
p=
{
0
}
>
<
ModalCloseButton
position=
"fixed"
color=
"whiteAlpha.800"
/>
<
ModalCloseButton
position=
"fixed"
top=
{
{
base
:
2.5
,
lg
:
8
}
}
right=
{
{
base
:
2.5
,
lg
:
8
}
}
color=
"whiteAlpha.800"
/>
{
children
}
{
children
}
</
ModalContent
>
</
ModalContent
>
</
Modal
>
</
Modal
>
...
...
ui/shared/nft/NftVideo.tsx
View file @
b903406f
import
{
chakra
}
from
'
@chakra-ui/react
'
;
import
{
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
mediaStyleProps
}
from
'
./utils
'
;
import
{
mediaStyleProps
,
videoPlayProps
}
from
'
./utils
'
;
interface
Props
{
interface
Props
{
src
:
string
;
src
:
string
;
...
@@ -13,12 +13,8 @@ interface Props {
...
@@ -13,12 +13,8 @@ interface Props {
const
NftVideo
=
({
src
,
onLoad
,
onError
,
onClick
}:
Props
)
=>
{
const
NftVideo
=
({
src
,
onLoad
,
onError
,
onClick
}:
Props
)
=>
{
return
(
return
(
<
chakra
.
video
<
chakra
.
video
{
...
videoPlayProps
}
src=
{
src
}
src=
{
src
}
autoPlay
disablePictureInPicture
loop
muted
playsInline
onCanPlayThrough=
{
onLoad
}
onCanPlayThrough=
{
onLoad
}
onError=
{
onError
}
onError=
{
onError
}
borderRadius=
"md"
borderRadius=
"md"
...
...
ui/shared/nft/NftVideoWithFullscreen.tsx
View file @
b903406f
...
@@ -6,6 +6,7 @@ import React from 'react';
...
@@ -6,6 +6,7 @@ import React from 'react';
import
NftMediaFullscreenModal
from
'
./NftMediaFullscreenModal
'
;
import
NftMediaFullscreenModal
from
'
./NftMediaFullscreenModal
'
;
import
NftVideo
from
'
./NftVideo
'
;
import
NftVideo
from
'
./NftVideo
'
;
import
{
videoPlayProps
}
from
'
./utils
'
;
interface
Props
{
interface
Props
{
src
:
string
;
src
:
string
;
...
@@ -21,12 +22,8 @@ const NftVideoWithFullscreen = ({ src, onLoad, onError }: Props) => {
...
@@ -21,12 +22,8 @@ const NftVideoWithFullscreen = ({ src, onLoad, onError }: Props) => {
<
NftVideo
src=
{
src
}
onLoad=
{
onLoad
}
onError=
{
onError
}
onClick=
{
onOpen
}
/>
<
NftVideo
src=
{
src
}
onLoad=
{
onLoad
}
onError=
{
onError
}
onClick=
{
onOpen
}
/>
<
NftMediaFullscreenModal
isOpen=
{
isOpen
}
onClose=
{
onClose
}
>
<
NftMediaFullscreenModal
isOpen=
{
isOpen
}
onClose=
{
onClose
}
>
<
chakra
.
video
<
chakra
.
video
{
...
videoPlayProps
}
src=
{
src
}
src=
{
src
}
autoPlay
disablePictureInPicture
loop
muted
playsInline
onCanPlayThrough=
{
onLoad
}
onCanPlayThrough=
{
onLoad
}
onError=
{
onError
}
onError=
{
onError
}
maxH=
"90vh"
maxH=
"90vh"
...
...
ui/shared/nft/utils.ts
View file @
b903406f
...
@@ -39,3 +39,11 @@ export const mediaStyleProps = {
...
@@ -39,3 +39,11 @@ export const mediaStyleProps = {
},
},
},
},
};
};
export
const
videoPlayProps
=
{
autoPlay
:
true
,
disablePictureInPicture
:
true
,
loop
:
true
,
muted
:
true
,
playsInline
:
true
,
};
ui/token/TokenInventoryItem.tsx
View file @
b903406f
import
{
Flex
,
Text
,
LinkBox
,
LinkOverlay
,
useColorModeValue
,
Skeleton
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
Flex
,
Text
,
Link
,
useColorModeValue
,
Skeleton
}
from
'
@chakra-ui/react
'
;
import
NextLink
from
'
next/link
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
TokenInstance
}
from
'
types/api/token
'
;
import
type
{
TokenInstance
}
from
'
types/api/token
'
;
import
{
route
}
from
'
nextjs-routes
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
LinkInternal
from
'
ui/shared/LinkInternal
'
;
import
LinkInternal
from
'
ui/shared/LinkInternal
'
;
...
@@ -24,29 +25,22 @@ const NFTItem = ({ item, isLoading }: Props) => {
...
@@ -24,29 +25,22 @@ const NFTItem = ({ item, isLoading }: Props) => {
/>
/>
);
);
const
url
=
route
({
pathname
:
'
/token/[hash]/instance/[id]
'
,
query
:
{
hash
:
item
.
token
.
address
,
id
:
item
.
id
}
});
return
(
return
(
<
Link
Box
<
Box
w=
{
{
base
:
'
100%
'
,
lg
:
'
210px
'
}
}
w=
{
{
base
:
'
100%
'
,
lg
:
'
210px
'
}
}
border=
"1px solid"
border=
"1px solid"
borderColor=
{
useColorModeValue
(
'
blackAlpha.100
'
,
'
whiteAlpha.200
'
)
}
borderColor=
{
useColorModeValue
(
'
blackAlpha.100
'
,
'
whiteAlpha.200
'
)
}
borderRadius=
"12px"
borderRadius=
"12px"
p=
"10px"
p=
"10px"
_hover=
{
{
boxShadow
:
isLoading
?
'
none
'
:
'
md
'
}
}
fontSize=
"sm"
fontSize=
"sm"
fontWeight=
{
500
}
fontWeight=
{
500
}
lineHeight=
"20px"
lineHeight=
"20px"
>
>
{
isLoading
?
mediaElement
:
(
<
Link
href=
{
isLoading
?
undefined
:
url
}
>
<
NextLink
{
mediaElement
}
href=
{
{
pathname
:
'
/token/[hash]/instance/[id]
'
,
query
:
{
hash
:
item
.
token
.
address
,
id
:
item
.
id
}
}
}
</
Link
>
passHref
legacyBehavior
>
<
LinkOverlay
>
{
mediaElement
}
</
LinkOverlay
>
</
NextLink
>
)
}
{
item
.
id
&&
(
{
item
.
id
&&
(
<
Flex
mb=
{
2
}
ml=
{
1
}
>
<
Flex
mb=
{
2
}
ml=
{
1
}
>
<
Text
whiteSpace=
"pre"
variant=
"secondary"
>
ID#
</
Text
>
<
Text
whiteSpace=
"pre"
variant=
"secondary"
>
ID#
</
Text
>
...
@@ -58,6 +52,7 @@ const NFTItem = ({ item, isLoading }: Props) => {
...
@@ -58,6 +52,7 @@ const NFTItem = ({ item, isLoading }: Props) => {
whiteSpace=
"nowrap"
whiteSpace=
"nowrap"
display=
"block"
display=
"block"
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
href=
{
url
}
>
>
{
item
.
id
}
{
item
.
id
}
</
LinkInternal
>
</
LinkInternal
>
...
@@ -77,7 +72,7 @@ const NFTItem = ({ item, isLoading }: Props) => {
...
@@ -77,7 +72,7 @@ const NFTItem = ({ item, isLoading }: Props) => {
/>
/>
</
Flex
>
</
Flex
>
)
}
)
}
</
Link
Box
>
</
Box
>
);
);
};
};
...
...
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