Skip to content

Commit c6465e7

Browse files
authored
Merge pull request #793 from valory-xyz/mohan/disabled-modius-withdrawal
feat: Withdrawals disabled for modius
2 parents 10ab704 + a542c69 commit c6465e7

File tree

3 files changed

+33
-32
lines changed

3 files changed

+33
-32
lines changed

frontend/components/YourWalletPage/WithdrawFunds.tsx

+31-27
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { ServicesService } from '@/service/Services';
1616
import { Address } from '@/types/Address';
1717

1818
import { CustomAlert } from '../Alert';
19-
import { FeatureNotEnabled } from '../FeatureNotEnabled';
2019

2120
const { Text } = Typography;
2221

@@ -76,6 +75,7 @@ export const WithdrawFunds = () => {
7675
const { selectedService, refetch: refetchServices } = useServices();
7776
const { refetch: refetchMasterWallets } = useMasterWalletContext();
7877
const { updateBalances } = useBalanceContext();
78+
const isWithdrawFundsEnabled = useFeatureFlag('withdraw-funds');
7979

8080
const { service, isServiceRunning } = useService(
8181
selectedService?.service_config_id,
@@ -155,46 +155,50 @@ export const WithdrawFunds = () => {
155155
handleCancel,
156156
]);
157157

158-
const withdrawAllButton = useMemo(
159-
() => (
160-
<Button
161-
onClick={showModal}
162-
block
163-
size="large"
164-
disabled={!service || !isServiceStakedForMinimumDuration}
165-
>
166-
Withdraw all funds
167-
</Button>
168-
),
169-
[showModal, service, isServiceStakedForMinimumDuration],
170-
);
158+
const withdrawAllTooltipText = useMemo(() => {
159+
if (!isWithdrawFundsEnabled) {
160+
return 'Available soon!';
161+
}
171162

172-
const withdrawAllTooltip = useMemo(() => {
173163
// countdown to withdrawal
174164
if (!isServiceStakedForMinimumDuration) {
175165
return `${minDurationMessage} ${countdownDisplay}`;
176166
}
177167

178168
return null;
179-
}, [countdownDisplay, isServiceStakedForMinimumDuration]);
169+
}, [
170+
countdownDisplay,
171+
isServiceStakedForMinimumDuration,
172+
isWithdrawFundsEnabled,
173+
]);
180174

181175
const modalButtonText = useMemo(() => {
182-
if (isWithdrawalLoading) return 'Loading';
176+
if (isWithdrawalLoading) return 'Loading...';
183177
return 'Proceed';
184178
}, [isWithdrawalLoading]);
185179

186-
const isWithdrawFundsEnabled = useFeatureFlag('withdraw-funds');
187-
if (!isWithdrawFundsEnabled) return <FeatureNotEnabled />;
188-
189180
return (
190181
<>
191-
{withdrawAllTooltip ? (
192-
<Tooltip title={<Text className="text-sm">{withdrawAllTooltip}</Text>}>
193-
{withdrawAllButton}
194-
</Tooltip>
195-
) : (
196-
withdrawAllButton
197-
)}
182+
<Tooltip
183+
title={
184+
withdrawAllTooltipText ? (
185+
<Text className="text-sm">{withdrawAllTooltipText}</Text>
186+
) : null
187+
}
188+
>
189+
<Button
190+
onClick={showModal}
191+
disabled={
192+
!service ||
193+
!isServiceStakedForMinimumDuration ||
194+
!isWithdrawFundsEnabled
195+
}
196+
block
197+
size="large"
198+
>
199+
Withdraw all funds
200+
</Button>
201+
</Tooltip>
198202

199203
{!isServiceRunning && <ServiceNotRunning />}
200204

frontend/components/YourWalletPage/YourAgent.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
useBalanceContext,
1616
useServiceBalances,
1717
} from '@/hooks/useBalanceContext';
18-
import { useFeatureFlag } from '@/hooks/useFeatureFlag';
1918
import { useRewardContext } from '@/hooks/useRewardContext';
2019
import { useService } from '@/hooks/useService';
2120
import { useServices } from '@/hooks/useServices';
@@ -358,12 +357,10 @@ const YourAgentWalletBreakdown = () => {
358357
};
359358

360359
export const YourAgentWallet = () => {
361-
const isWithdrawFundsEnabled = useFeatureFlag('withdraw-funds');
362-
363360
return (
364361
<>
365362
<YourAgentWalletBreakdown />
366-
{isWithdrawFundsEnabled && <WithdrawFunds />}
363+
<WithdrawFunds />
367364
</>
368365
);
369366
};

frontend/hooks/useFeatureFlag.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const FEATURES_CONFIG = FeaturesConfigSchema.parse({
6464
},
6565
[AgentType.Modius]: {
6666
'manage-wallet': true,
67-
'withdraw-funds': true,
67+
'withdraw-funds': false,
6868
'last-transactions': true,
6969
'rewards-streak': true,
7070
'staking-contract-section': true,

0 commit comments

Comments
 (0)