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
203d5af7
Commit
203d5af7
authored
Aug 28, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add copy link button
parent
2b0f8d35
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
7 deletions
+39
-7
share.svg
icons/share.svg
+3
-0
name.d.ts
public/icons/name.d.ts
+1
-0
MarketplaceAppCard.tsx
ui/marketplace/MarketplaceAppCard.tsx
+34
-3
MarketplaceList.tsx
ui/marketplace/MarketplaceList.tsx
+1
-4
No files found.
icons/share.svg
0 → 100644
View file @
203d5af7
<svg
viewBox=
"0 0 15 17"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<path
d=
"M12.502 11.242a2.491 2.491 0 0 0-1.802.77L4.919 8.758c.112-.42.112-.863 0-1.284L10.7 4.222a2.492 2.492 0 1 0-.614-1.088L4.303 6.386a2.5 2.5 0 1 0 0 3.461l5.781 3.253a2.5 2.5 0 1 0 2.417-1.858Z"
fill=
"currentColor"
/>
</svg>
public/icons/name.d.ts
View file @
203d5af7
...
@@ -116,6 +116,7 @@
...
@@ -116,6 +116,7 @@
|
"
score/score-not-ok
"
|
"
score/score-not-ok
"
|
"
score/score-ok
"
|
"
score/score-ok
"
|
"
search
"
|
"
search
"
|
"
share
"
|
"
social/canny
"
|
"
social/canny
"
|
"
social/coingecko
"
|
"
social/coingecko
"
|
"
social/coinmarketcap
"
|
"
social/coinmarketcap
"
...
...
ui/marketplace/MarketplaceAppCard.tsx
View file @
203d5af7
import
{
IconButton
,
Image
,
Link
,
LinkBox
,
Skeleton
,
useColorModeValue
,
chakra
,
Flex
}
from
'
@chakra-ui/react
'
;
import
{
IconButton
,
Image
,
Link
,
LinkBox
,
Skeleton
,
useColorModeValue
,
chakra
,
Flex
,
Tooltip
,
useClipboard
,
useDisclosure
}
from
'
@chakra-ui/react
'
;
import
type
{
MouseEvent
}
from
'
react
'
;
import
type
{
MouseEvent
}
from
'
react
'
;
import
React
,
{
useCallback
}
from
'
react
'
;
import
React
,
{
useCallback
,
useState
,
useEffect
}
from
'
react
'
;
import
type
{
MarketplaceAppWithSecurityReport
,
ContractListTypes
,
AppRating
}
from
'
types/client/marketplace
'
;
import
type
{
MarketplaceAppWithSecurityReport
,
ContractListTypes
,
AppRating
}
from
'
types/client/marketplace
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
isBrowser
from
'
lib/isBrowser
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
AppSecurityReport
from
'
./AppSecurityReport
'
;
import
AppSecurityReport
from
'
./AppSecurityReport
'
;
import
FavoriteIcon
from
'
./FavoriteIcon
'
;
import
FavoriteIcon
from
'
./FavoriteIcon
'
;
...
@@ -56,6 +58,20 @@ const MarketplaceAppCard = ({
...
@@ -56,6 +58,20 @@ const MarketplaceAppCard = ({
const
isMobile
=
useIsMobile
();
const
isMobile
=
useIsMobile
();
const
categoriesLabel
=
categories
.
join
(
'
,
'
);
const
categoriesLabel
=
categories
.
join
(
'
,
'
);
const
linkToApp
=
isBrowser
()
?
window
.
location
.
origin
+
`/apps/
${
id
}
`
:
''
;
const
{
hasCopied
,
onCopy
}
=
useClipboard
(
linkToApp
,
1000
);
const
[
copied
,
setCopied
]
=
useState
(
false
);
// have to implement controlled tooltip because of the issue - https://github.com/chakra-ui/chakra-ui/issues/7107
const
{
isOpen
,
onOpen
,
onClose
}
=
useDisclosure
();
useEffect
(()
=>
{
if
(
hasCopied
)
{
setCopied
(
true
);
}
else
{
setCopied
(
false
);
}
},
[
hasCopied
]);
const
handleInfoClick
=
useCallback
((
event
:
MouseEvent
)
=>
{
const
handleInfoClick
=
useCallback
((
event
:
MouseEvent
)
=>
{
event
.
preventDefault
();
event
.
preventDefault
();
onInfoClick
(
id
);
onInfoClick
(
id
);
...
@@ -168,7 +184,7 @@ const MarketplaceAppCard = ({
...
@@ -168,7 +184,7 @@ const MarketplaceAppCard = ({
>
>
More info
More info
</
Link
>
</
Link
>
<
Flex
alignItems=
"center"
gap=
{
3
}
>
<
Flex
alignItems=
"center"
>
<
Rating
<
Rating
appId=
{
id
}
appId=
{
id
}
rating=
{
rating
}
rating=
{
rating
}
...
@@ -188,7 +204,22 @@ const MarketplaceAppCard = ({
...
@@ -188,7 +204,22 @@ const MarketplaceAppCard = ({
h=
{
{
base
:
6
,
md
:
'
30px
'
}
}
h=
{
{
base
:
6
,
md
:
'
30px
'
}
}
onClick=
{
handleFavoriteClick
}
onClick=
{
handleFavoriteClick
}
icon=
{
<
FavoriteIcon
isFavorite=
{
isFavorite
}
/>
}
icon=
{
<
FavoriteIcon
isFavorite=
{
isFavorite
}
/>
}
ml=
{
2
}
/>
/>
<
Tooltip
label=
{
copied
?
'
Copied
'
:
'
Copy link to clipboard
'
}
isOpen=
{
isOpen
||
copied
}
>
<
IconButton
aria
-
label=
"Copy link"
variant=
"ghost"
colorScheme=
"gray"
w=
{
{
base
:
6
,
md
:
'
30px
'
}
}
h=
{
{
base
:
6
,
md
:
'
30px
'
}
}
onClick=
{
onCopy
}
onMouseEnter=
{
onOpen
}
onMouseLeave=
{
onClose
}
icon=
{
<
IconSvg
name=
"share"
boxSize=
{
4
}
color=
"gray.400"
/>
}
ml=
{
{
base
:
1
,
md
:
0
}
}
/>
</
Tooltip
>
</
Flex
>
</
Flex
>
</
Flex
>
</
Flex
>
)
}
)
}
...
...
ui/marketplace/MarketplaceList.tsx
View file @
203d5af7
...
@@ -45,10 +45,7 @@ const MarketplaceList = ({
...
@@ -45,10 +45,7 @@ const MarketplaceList = ({
return
apps
.
length
>
0
?
(
return
apps
.
length
>
0
?
(
<>
<>
<
Grid
<
Grid
templateColumns=
{
{
templateColumns=
{
{
md
:
'
repeat(auto-fill, minmax(270px, 1fr))
'
}
}
md
:
'
repeat(auto-fill, minmax(230px, 1fr))
'
,
lg
:
'
repeat(auto-fill, minmax(260px, 1fr))
'
,
}
}
autoRows=
"1fr"
autoRows=
"1fr"
gap=
{
{
base
:
'
16px
'
,
md
:
'
24px
'
}
}
gap=
{
{
base
:
'
16px
'
,
md
:
'
24px
'
}
}
marginTop=
{
{
base
:
0
,
lg
:
3
}
}
marginTop=
{
{
base
:
0
,
lg
:
3
}
}
...
...
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