@@ -11,7 +11,13 @@ import { Button } from "@/primitives/Button";
11
11
import { Icon , IconType } from "@/primitives/Icon" ;
12
12
import { PoolStatus , PoolType } from "@/types" ;
13
13
14
- import { getManagerUrl , getBuilderUrl , getExplorerUrl } from "~checker/utils" ;
14
+ import {
15
+ getApplyLink ,
16
+ getPoolLinkOnExplorer ,
17
+ getProgramLinkOnManager ,
18
+ getManagerUrl ,
19
+ getVotingInterfaceLinkOnExplorer ,
20
+ } from "~checker/utils" ;
15
21
16
22
import { PoolBadge } from "../PoolBadge" ;
17
23
@@ -38,13 +44,11 @@ export const PoolSummary = (pool: PoolSummaryProps) => {
38
44
const { toast } = useToast ( ) ;
39
45
const chainInfo = getChainInfo ( pool . chainId ) ;
40
46
41
- const managerUrl = getManagerUrl ( pool . chainId ) ;
42
- const builderUrl = getBuilderUrl ( pool . chainId ) ;
43
- const explorerUrl = getExplorerUrl ( pool . chainId ) ;
44
-
45
47
let poolStatus : PoolStatus ;
46
48
const poolType = pool . strategyName as PoolType ;
47
49
50
+ const managerUrl = getManagerUrl ( pool . chainId , poolType ) ;
51
+
48
52
const now = new Date ( ) ;
49
53
50
54
const registerStartDate = pool . applicationsStartTime
@@ -67,9 +71,9 @@ export const PoolSummary = (pool: PoolSummaryProps) => {
67
71
} else {
68
72
poolStatus = PoolStatus . PreRound ;
69
73
}
70
- const applyLink = ` ${ builderUrl } /#/chains/ ${ pool . chainId } /rounds/ ${ pool . poolId } /apply` ;
71
- const explorerLink = ` ${ explorerUrl } /#/round/ ${ pool . chainId } / ${ pool . poolId } ` ;
72
- const managerProgramLink = ` ${ managerUrl } /#/chain/ ${ pool . chainId } /program/ ${ pool . programId } ` ;
74
+ const applyLink = getApplyLink ( pool . chainId , pool . poolId , poolType ) ;
75
+ const explorerLink = getPoolLinkOnExplorer ( pool . chainId , pool . poolId , poolType ) ;
76
+ const managerProgramLink = getProgramLinkOnManager ( pool . chainId , pool . programId , poolType ) ;
73
77
const breadcrumbItems = [
74
78
{ label : "My Programs" , href : managerUrl } ,
75
79
{
@@ -81,6 +85,13 @@ export const PoolSummary = (pool: PoolSummaryProps) => {
81
85
href : explorerLink ,
82
86
} ,
83
87
] ;
88
+
89
+ const { registerDateLabel, allocationDateLabel, viewButton } = getInfoBasedOnPoolType (
90
+ poolType ,
91
+ pool ,
92
+ explorerLink ,
93
+ ) ;
94
+
84
95
return (
85
96
< div className = { cn ( variants . variants . default , "grid grid-cols-2 py-6" ) } >
86
97
< div className = "flex flex-col items-start justify-start gap-4" >
@@ -105,14 +116,14 @@ export const PoolSummary = (pool: PoolSummaryProps) => {
105
116
startDate = { registerStartDate }
106
117
endDate = { registerEndDate }
107
118
isLoading = { pool . isLoading }
108
- label = "Review"
119
+ label = { registerDateLabel }
109
120
/>
110
121
< IconLabel
111
122
type = "roundPeriod"
112
123
startDate = { allocationStartDate }
113
124
endDate = { allocationEndDate }
114
125
isLoading = { pool . isLoading }
115
- label = "Voting"
126
+ label = { allocationDateLabel }
116
127
/>
117
128
</ div >
118
129
</ div >
@@ -140,14 +151,45 @@ export const PoolSummary = (pool: PoolSummaryProps) => {
140
151
) ;
141
152
} }
142
153
/>
143
- < Button
144
- icon = { < Icon type = { IconType . EXPLORER } /> }
145
- className = "border-grey-100 bg-white text-black shadow-sm"
146
- value = "View round"
147
- onClick = { ( ) => window . open ( explorerLink , "_blank" ) }
148
- />
154
+ { viewButton }
149
155
</ div >
150
156
</ div >
151
157
</ div >
152
158
) ;
153
159
} ;
160
+
161
+ function getInfoBasedOnPoolType ( poolType : PoolType , pool : PoolSummaryProps , explorerLink : string ) {
162
+ let allocationDateLabel ;
163
+ let registerDateLabel ;
164
+ let viewButton ;
165
+
166
+ if ( poolType === PoolType . Retrofunding ) {
167
+ registerDateLabel = "Applications" ;
168
+ allocationDateLabel = "Voting" ;
169
+ viewButton = (
170
+ < Button
171
+ icon = { < Icon type = { IconType . LINK } /> }
172
+ className = "border-grey-100 bg-white text-black shadow-sm"
173
+ value = "Voting Interface"
174
+ onClick = { ( ) =>
175
+ window . open (
176
+ getVotingInterfaceLinkOnExplorer ( pool . chainId , pool . poolId , poolType ) ,
177
+ "_blank" ,
178
+ )
179
+ }
180
+ />
181
+ ) ;
182
+ } else {
183
+ registerDateLabel = "Review" ;
184
+ allocationDateLabel = "Allocation" ;
185
+ viewButton = (
186
+ < Button
187
+ icon = { < Icon type = { IconType . EXPLORER } /> }
188
+ className = "border-grey-100 bg-white text-black shadow-sm"
189
+ value = "View round"
190
+ onClick = { ( ) => window . open ( explorerLink , "_blank" ) }
191
+ />
192
+ ) ;
193
+ }
194
+ return { registerDateLabel, allocationDateLabel, viewButton } ;
195
+ }
0 commit comments