1- import { useState , useEffect } from "react" ;
1+ import { useState , useEffect , useCallback } from "react" ;
22import { Box , CircularProgress , Tab , Tabs , styled } from "@mui/material" ;
3- import { useLocation } from "react-router-dom" ;
3+ import { useLocation , useNavigate } from "react-router-dom" ;
44
55import {
66 GOVERNANCE_ACTIONS_FILTERS ,
77 GOVERNANCE_ACTIONS_SORTING ,
8+ PATHS ,
9+ PDF_PATHS ,
810} from "@consts" ;
9- import { useCardano , useDataActionsBar } from "@context" ;
11+ import { useCardano , useDataActionsBar , useFeatureFlag } from "@context" ;
1012import {
1113 useGetProposalsQuery ,
1214 useGetVoterInfo ,
@@ -18,6 +20,7 @@ import {
1820 GovernanceActionsToVote ,
1921 DashboardGovernanceActionsVotedOn ,
2022} from "@organisms" ;
23+ import { Button } from "@atoms" ;
2124
2225type TabPanelProps = {
2326 children ?: React . ReactNode ;
@@ -74,6 +77,8 @@ export const DashboardGovernanceActions = () => {
7477 const { isMobile } = useScreenDimension ( ) ;
7578 const { t } = useTranslation ( ) ;
7679 const { isEnableLoading } = useCardano ( ) ;
80+ const { isProposalDiscussionForumEnabled } = useFeatureFlag ( ) ;
81+ const navigate = useNavigate ( ) ;
7782
7883 const queryFilters =
7984 chosenFilters . length > 0 ? chosenFilters : defaultCategories ;
@@ -94,6 +99,14 @@ export const DashboardGovernanceActions = () => {
9499 setContent ( newValue ) ;
95100 } ;
96101
102+ const onClickPropose = useCallback ( ( ) => {
103+ navigate (
104+ isProposalDiscussionForumEnabled
105+ ? PDF_PATHS . proposalDiscussionPropose
106+ : PATHS . createGovernanceAction ,
107+ ) ;
108+ } , [ isProposalDiscussionForumEnabled ] ) ;
109+
97110 useEffect ( ( ) => {
98111 window . history . replaceState ( { } , document . title ) ;
99112 } , [ ] ) ;
@@ -126,36 +139,49 @@ export const DashboardGovernanceActions = () => {
126139 ) : (
127140 < >
128141 { ( voter ?. isRegisteredAsDRep || voter ?. isRegisteredAsSoleVoter ) && (
129- < Tabs
130- sx = { {
131- marginTop : 3 ,
132- display : "flex" ,
133- fontSize : 16 ,
134- fontWeight : 500 ,
135- } }
136- value = { content }
137- indicatorColor = "secondary"
138- onChange = { handleChange }
139- aria-label = "Governance Actions tabs"
140- >
141- < StyledTab
142- data-testid = "to-vote-tab"
143- label = { t ( "govActions.toVote" ) }
142+ < Box display = "flex" flexDirection = "row" alignItems = "center" >
143+ < Tabs
144144 sx = { {
145- textTransform : "none" ,
146- width : ! isMobile ? "auto" : "50%" ,
145+ marginTop : 3 ,
146+ display : "flex" ,
147+ fontSize : 16 ,
148+ fontWeight : 500 ,
147149 } }
148- />
149- < StyledTab
150- data-testid = "voted-tab"
151- label = { t ( "govActions.votedOnByMe" ) }
150+ value = { content }
151+ indicatorColor = "secondary"
152+ onChange = { handleChange }
153+ aria-label = "Governance Actions tabs"
154+ >
155+ < StyledTab
156+ data-testid = "to-vote-tab"
157+ label = { t ( "govActions.toVote" ) }
158+ sx = { {
159+ textTransform : "none" ,
160+ width : ! isMobile ? "auto" : "50%" ,
161+ } }
162+ />
163+ < StyledTab
164+ data-testid = "voted-tab"
165+ label = { t ( "govActions.votedOnByMe" ) }
166+ sx = { {
167+ textTransform : "none" ,
168+ width : ! isMobile ? "auto" : "50%" ,
169+ } }
170+ />
171+ </ Tabs >
172+ < Button
173+ data-testid = "proposal-discussion-link"
174+ onClick = { onClickPropose }
152175 sx = { {
153- textTransform : "none" ,
154- width : ! isMobile ? "auto" : "50% ",
176+ display : isMobile ? "none" : "block ",
177+ ml : "auto" ,
155178 } }
156- />
157- </ Tabs >
179+ >
180+ { t ( "govActions.propose" ) }
181+ </ Button >
182+ </ Box >
158183 ) }
184+
159185 < Box height = { isMobile ? 24 : 60 } />
160186 < CustomTabPanel value = { content } index = { 0 } >
161187 < GovernanceActionsToVote
0 commit comments