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
1679fe7a
Commit
1679fe7a
authored
Feb 08, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NftImage
parent
98efbf80
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
14 deletions
+59
-14
NFTItem.tsx
ui/address/tokens/NFTItem.tsx
+6
-11
TokenInstance.tsx
ui/pages/TokenInstance.tsx
+1
-1
NftImage.tsx
ui/shared/NftImage.tsx
+49
-0
TokenInstanceDetails.tsx
ui/tokenInstance/TokenInstanceDetails.tsx
+3
-2
No files found.
ui/address/tokens/NFTItem.tsx
View file @
1679fe7a
import
{
Center
,
Flex
,
Icon
,
Link
,
Text
,
LinkBox
,
LinkOverlay
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
Link
,
Text
,
LinkBox
,
LinkOverlay
,
useColorModeValue
}
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
'
;
import
NFTIcon
from
'
icons/nft_shield.svg
'
;
import
link
from
'
lib/link/link
'
;
import
link
from
'
lib/link/link
'
;
import
NftImage
from
'
ui/shared/NftImage
'
;
import
TokenLogo
from
'
ui/shared/TokenLogo
'
;
import
TokenLogo
from
'
ui/shared/TokenLogo
'
;
import
TruncatedTextTooltip
from
'
ui/shared/TruncatedTextTooltip
'
;
import
TruncatedTextTooltip
from
'
ui/shared/TruncatedTextTooltip
'
;
...
@@ -16,7 +16,6 @@ const NFTItem = ({ token, token_id: tokenId }: Props) => {
...
@@ -16,7 +16,6 @@ const NFTItem = ({ token, token_id: tokenId }: Props) => {
return
(
return
(
<
LinkBox
<
LinkBox
w=
{
{
base
:
'
calc((100% - 12px)/2)
'
,
lg
:
'
210px
'
}
}
w=
{
{
base
:
'
calc((100% - 12px)/2)
'
,
lg
:
'
210px
'
}
}
h=
{
{
base
:
'
auto
'
,
lg
:
'
272px
'
}
}
border=
"1px solid"
border=
"1px solid"
borderColor=
{
useColorModeValue
(
'
blackAlpha.100
'
,
'
whiteAlpha.200
'
)
}
borderColor=
{
useColorModeValue
(
'
blackAlpha.100
'
,
'
whiteAlpha.200
'
)
}
borderRadius=
"12px"
borderRadius=
"12px"
...
@@ -27,15 +26,11 @@ const NFTItem = ({ token, token_id: tokenId }: Props) => {
...
@@ -27,15 +26,11 @@ const NFTItem = ({ token, token_id: tokenId }: Props) => {
lineHeight=
"20px"
lineHeight=
"20px"
>
>
<
LinkOverlay
href=
{
tokenLink
}
/>
<
LinkOverlay
href=
{
tokenLink
}
/>
<
Center
<
NftImage
w=
{
{
base
:
'
100%
'
,
lg
:
'
182px
'
}
}
h=
{
{
base
:
'
calc((100vw - 36px)/2 - 12px)
'
,
lg
:
'
182px
'
}
}
bg=
{
useColorModeValue
(
'
blackAlpha.50
'
,
'
whiteAlpha.50
'
)
}
mb=
"18px"
mb=
"18px"
borderRadius=
"12px"
url=
{
null
}
>
fallbackPadding=
"30px"
<
Icon
as=
{
NFTIcon
}
boxSize=
"112px"
color=
{
useColorModeValue
(
'
blackAlpha.500
'
,
'
whiteAlpha.500
'
)
}
/>
/>
</
Center
>
{
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
>
...
...
ui/pages/TokenInstance.tsx
View file @
1679fe7a
...
@@ -27,7 +27,7 @@ const TokenInstance = () => {
...
@@ -27,7 +27,7 @@ const TokenInstance = () => {
const
hash
=
router
.
query
.
hash
?.
toString
();
const
hash
=
router
.
query
.
hash
?.
toString
();
const
id
=
router
.
query
.
id
?.
toString
();
const
id
=
router
.
query
.
id
?.
toString
();
const
hasGoBackLink
=
appProps
.
referrer
&&
appProps
.
referrer
.
includes
(
`/token/
${
hash
}
`
);
const
hasGoBackLink
=
appProps
.
referrer
&&
appProps
.
referrer
.
includes
(
`/token/
${
hash
}
`
)
&&
!
appProps
.
referrer
.
includes
(
'
instance
'
)
;
const
scrollRef
=
React
.
useRef
<
HTMLDivElement
>
(
null
);
const
scrollRef
=
React
.
useRef
<
HTMLDivElement
>
(
null
);
...
...
ui/shared/NftImage.tsx
0 → 100644
View file @
1679fe7a
import
{
AspectRatio
,
chakra
,
Icon
,
Image
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
nftIcon
from
'
icons/nft_shield.svg
'
;
interface
Props
{
url
:
string
|
null
;
className
?:
string
;
fallbackPadding
?:
string
;
}
interface
FallbackProps
{
className
?:
string
;
padding
?:
string
;
}
const
Fallback
=
({
className
,
padding
}:
FallbackProps
)
=>
{
return
(
<
Icon
className=
{
className
}
as=
{
nftIcon
}
p=
{
padding
??
'
50px
'
}
color=
{
useColorModeValue
(
'
blackAlpha.500
'
,
'
whiteAlpha.500
'
)
}
/>
);
};
const
NftImage
=
({
url
,
className
,
fallbackPadding
}:
Props
)
=>
{
return
(
<
AspectRatio
className=
{
className
}
ratio=
{
1
/
1
}
bgColor=
{
useColorModeValue
(
'
blackAlpha.50
'
,
'
whiteAlpha.50
'
)
}
overflow=
"hidden"
borderRadius=
"md"
>
<
Image
w=
"100%"
h=
"100%"
objectFit=
"contain"
src=
{
url
||
undefined
}
alt=
"Token instance image"
fallback=
{
<
Fallback
className=
{
className
}
padding=
{
fallbackPadding
}
/>
}
/>
</
AspectRatio
>
);
};
export
default
chakra
(
NftImage
);
ui/tokenInstance/TokenInstanceDetails.tsx
View file @
1679fe7a
import
{
Box
,
Flex
,
Grid
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
Grid
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
TokenInstance
}
from
'
types/api/tokens
'
;
import
type
{
TokenInstance
}
from
'
types/api/tokens
'
;
...
@@ -8,6 +8,7 @@ import AddressIcon from 'ui/shared/address/AddressIcon';
...
@@ -8,6 +8,7 @@ import AddressIcon from 'ui/shared/address/AddressIcon';
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
import
CopyToClipboard
from
'
ui/shared/CopyToClipboard
'
;
import
CopyToClipboard
from
'
ui/shared/CopyToClipboard
'
;
import
DetailsInfoItem
from
'
ui/shared/DetailsInfoItem
'
;
import
DetailsInfoItem
from
'
ui/shared/DetailsInfoItem
'
;
import
NftImage
from
'
ui/shared/NftImage
'
;
import
TokenSnippet
from
'
ui/shared/TokenSnippet/TokenSnippet
'
;
import
TokenSnippet
from
'
ui/shared/TokenSnippet/TokenSnippet
'
;
import
TokenInstanceCreatorAddress
from
'
./details/TokenInstanceCreatorAddress
'
;
import
TokenInstanceCreatorAddress
from
'
./details/TokenInstanceCreatorAddress
'
;
...
@@ -66,7 +67,7 @@ const TokenInstanceDetails = ({ data, scrollRef }: Props) => {
...
@@ -66,7 +67,7 @@ const TokenInstanceDetails = ({ data, scrollRef }: Props) => {
</
DetailsInfoItem
>
</
DetailsInfoItem
>
<
TokenInstanceTransfersCount
hash=
{
data
.
token
.
address
}
id=
{
data
.
id
}
onClick=
{
handleCounterItemClick
}
/>
<
TokenInstanceTransfersCount
hash=
{
data
.
token
.
address
}
id=
{
data
.
id
}
onClick=
{
handleCounterItemClick
}
/>
</
Grid
>
</
Grid
>
<
Box
boxSize=
"250px"
bgColor=
"lightpink
"
flexShrink=
{
0
}
/>
<
NftImage
url=
{
data
.
image_url
}
w=
"250px
"
flexShrink=
{
0
}
/>
</
Flex
>
</
Flex
>
);
);
};
};
...
...
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