File tree Expand file tree Collapse file tree 4 files changed +54
-67
lines changed
Expand file tree Collapse file tree 4 files changed +54
-67
lines changed Original file line number Diff line number Diff line change @@ -12,16 +12,18 @@ const CopyButton = ({
1212 displayText,
1313 buttonText,
1414 tooltipWithText = false ,
15+ tooltipText = 'Copy' ,
1516 className,
1617} : {
1718 textToCopy : string ;
1819 displayText ?: string ;
1920 buttonText ?: string ;
2021 tooltipWithText ?: boolean ;
22+ tooltipText ?: string ;
2123 className ?: string ;
2224} ) => {
2325 const [ showTooltip , setShowTooltip ] = useState ( false ) ;
24- const [ tooltipMessage , setTooltipMessage ] = useState ( 'Copy' ) ;
26+ const [ tooltipMessage , setTooltipMessage ] = useState ( tooltipText ) ;
2527
2628 const handleCopy = ( ) => {
2729 navigator . clipboard . writeText ( textToCopy ) . then ( ( ) => {
@@ -35,7 +37,7 @@ const CopyButton = ({
3537 if ( tooltipWithText && displayText ) {
3638 setTooltipMessage ( `Copy "${ displayText } "` ) ;
3739 } else {
38- setTooltipMessage ( 'Copy' ) ;
40+ setTooltipMessage ( tooltipText ) ;
3941 }
4042 setShowTooltip ( true ) ;
4143 } ;
Original file line number Diff line number Diff line change 1+ import { decodeTag } from 'iexec/utils' ;
2+ import CopyButton from '@/components/CopyButton' ;
3+ import { truncateAddress } from '@/utils/truncateAddress' ;
4+
5+ const Tags = ( props : { children : string } ) => {
6+ const { children : raw } = props ;
7+
8+ let tags : string [ ] | null = null ;
9+ try {
10+ tags = decodeTag ( raw ) ;
11+ } catch {
12+ // If decoding fails, fall back to displaying raw encoded tag
13+ }
14+ return (
15+ < div className = "flex items-center gap-1" >
16+ { tags ? (
17+ tags . length > 0 ? (
18+ tags . map ( ( t ) => (
19+ < span
20+ className = "inline-flex w-fit rounded-full border px-4 py-2 text-xs uppercase"
21+ key = { t }
22+ >
23+ { t }
24+ </ span >
25+ ) )
26+ ) : (
27+ < span className = "text-muted-foreground" > None</ span >
28+ )
29+ ) : (
30+ < >
31+ < span className = "hidden md:inline" > { raw } </ span >
32+ < span className = "inline md:hidden" > { truncateAddress ( raw ) } </ span >
33+ </ >
34+ ) } { ' ' }
35+ < CopyButton
36+ className = "ml-2"
37+ textToCopy = { raw }
38+ tooltipText = "Copy raw tag"
39+ />
40+ </ div >
41+ ) ;
42+ } ;
43+
44+ export default Tags ;
Original file line number Diff line number Diff line change 11import { DealQuery } from '@/graphql/poco/graphql' ;
22import CopyButton from '@/components/CopyButton' ;
33import SmartLinkGroup from '@/components/SmartLinkGroup' ;
4- import Bytes from '@/modules/Bytes' ;
54import JsonBlock from '@/modules/JsonBlock' ;
5+ import Tags from '@/modules/Tags' ;
66import DealEvent from '@/modules/events/DealEvent' ;
77import { ClaimButton } from '@/modules/tasks/ClaimButton' ;
88import {
@@ -73,38 +73,8 @@ export function buildDealDetails({
7373 } ) ,
7474 ...( deal . tag && {
7575 Tag : {
76- tooltip : (
77- < >
78- Indicates the execution environment type defined by iExec :
79- < ul className = "list-inside list-disc" >
80- < li >
81- < code className = "bg-primary-foreground text-primary -mx-1 rounded-sm px-1 py-px" >
82- 0x0
83- </ code >
84- : Standard
85- </ li >
86- < li >
87- < code className = "bg-primary-foreground text-primary -mx-1 rounded-sm px-1 py-px" >
88- 0x3
89- </ code >
90- : SGX Scone
91- </ li >
92- < li >
93- < code className = "bg-primary-foreground text-primary -mx-1 rounded-sm px-1 py-px" >
94- 0x5
95- </ code >
96- : SGX Gramine
97- </ li >
98- < li >
99- < code className = "bg-primary-foreground text-primary -mx-1 rounded-sm px-1 py-px" >
100- 0x9
101- </ code >
102- : TDX
103- </ li >
104- </ ul >
105- </ >
106- ) ,
107- value : < Bytes > { deal . tag } </ Bytes > ,
76+ tooltip : < > Indicates the execution environment type defined by iExec</ > ,
77+ value : < Tags > { deal . tag } </ Tags > ,
10878 } ,
10979 } ) ,
11080 ...( deal . app && {
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import CopyButton from '@/components/CopyButton';
33import SmartLinkGroup from '@/components/SmartLinkGroup' ;
44import Bytes from '@/modules/Bytes' ;
55import JsonBlock from '@/modules/JsonBlock' ;
6+ import Tags from '@/modules/Tags' ;
67import TaskEvent from '@/modules/events/TaskEvent' ;
78import useUserStore from '@/stores/useUser.store' ;
89import { taskResultToObject } from '@/utils/format' ;
@@ -69,38 +70,8 @@ export function buildTaskDetails({ task }: { task: TaskQuery['task'] }) {
6970 } ) ,
7071 ...( task . deal . tag && {
7172 Tag : {
72- tooltip : (
73- < >
74- Indicates the execution environment type defined by iExec :
75- < ul className = "list-inside list-disc" >
76- < li >
77- < code className = "bg-primary-foreground text-primary -mx-1 rounded-sm px-1 py-px" >
78- 0x0
79- </ code >
80- : Standard
81- </ li >
82- < li >
83- < code className = "bg-primary-foreground text-primary -mx-1 rounded-sm px-1 py-px" >
84- 0x3
85- </ code >
86- : SGX Scone
87- </ li >
88- < li >
89- < code className = "bg-primary-foreground text-primary -mx-1 rounded-sm px-1 py-px" >
90- 0x5
91- </ code >
92- : SGX Gramine
93- </ li >
94- < li >
95- < code className = "bg-primary-foreground text-primary -mx-1 rounded-sm px-1 py-px" >
96- 0x9
97- </ code >
98- : TDX
99- </ li >
100- </ ul >
101- </ >
102- ) ,
103- value : < Bytes > { task . deal . tag } </ Bytes > ,
73+ tooltip : < > Indicates the execution environment type defined by iExec</ > ,
74+ value : < Tags > { task . deal . tag } </ Tags > ,
10475 } ,
10576 } ) ,
10677 ...( task . deal . app && {
You can’t perform that action at this time.
0 commit comments