diff --git a/src/components/bot-notification/bot-notification-utils.ts b/src/components/bot-notification/bot-notification-utils.ts index eef79a8c6..644335fa7 100644 --- a/src/components/bot-notification/bot-notification-utils.ts +++ b/src/components/bot-notification/bot-notification-utils.ts @@ -46,6 +46,7 @@ export const notification_message = () => ({ strategy_conversion: localize('Save this strategy as an XML file from Deriv Bot for faster re-imports.'), google_drive_error: localize('Your session has expired. Please sign in again.'), xml_import_error: localize('Unsupported file format. Please import a valid XML file.'), + keep_screen_alive: localize('Ensure your screen is active and your connection is stable to avoid interruptions.'), }); export const notification_style = { diff --git a/src/components/bot-stopped.tsx b/src/components/bot-stopped.tsx index de85baec4..1375999e9 100644 --- a/src/components/bot-stopped.tsx +++ b/src/components/bot-stopped.tsx @@ -9,12 +9,22 @@ import Dialog from './shared_ui/dialog'; import { standalone_routes } from './shared'; const BotStopped = observer(() => { - const { dashboard, run_panel } = useStore(); + const { dashboard, run_panel, client } = useStore(); const { is_web_socket_intialised } = dashboard; const { is_running } = run_panel; const isOnline = useNavigatorOnline(); + // Get client information for the report URL + const getCurrency = client?.getCurrency; + const currency = getCurrency?.(); + + // Check if the account is a demo account + // Use the URL parameter to determine if it's a demo account, as this will update when the account changes + const urlParams = new URLSearchParams(window.location.search); + const account_param = urlParams.get('account'); + const is_virtual = client?.is_virtual || account_param === 'demo' || false; + // Determine the type of disconnection const isInternetDisconnection = !isOnline && is_running; const isInternalIssue = !is_web_socket_intialised && isOnline; @@ -31,9 +41,26 @@ const BotStopped = observer(() => { is_visible={shouldShowPopup} is_mobile_full_width className={'dc-dialog bot-stopped-dialog'} - cancel_button_text={!isInternetDisconnection ? localize('Go to Reports') : undefined} + cancel_button_text={!isInternetDisconnection ? localize('View Report') : undefined} confirm_button_text={!isInternetDisconnection ? localize('Back to Bot') : undefined} - onCancel={!isInternetDisconnection ? () => (window.location.href = standalone_routes.positions) : undefined} + onCancel={ + !isInternetDisconnection + ? () => { + const url = new URL(standalone_routes.positions); + + // Add account parameter based on account type + if (is_virtual) { + // For demo accounts, set the account parameter to 'demo' + url.searchParams.set('account', 'demo'); + } else if (currency) { + // For real accounts, set the account parameter to the currency + url.searchParams.set('account', currency); + } + + window.location.href = url.toString(); + } + : undefined + } onConfirm={() => location.reload()} login={() => {}} > @@ -42,7 +69,7 @@ const BotStopped = observer(() => { {isInternetDisconnection ? ( ) : ( - + )}
{ {isInternetDisconnection ? ( ) : ( - + )} diff --git a/src/stores/run-panel-store.ts b/src/stores/run-panel-store.ts index 9879915c2..1596b4944 100644 --- a/src/stores/run-panel-store.ts +++ b/src/stores/run-panel-store.ts @@ -227,6 +227,8 @@ export default class RunPanelStore { summary_card.clear(); this.setContractStage(contract_stages.STARTING); + // Show notification to keep screen alive after all validations pass + botNotification(notification_message().keep_screen_alive); this.dbot.runBot(); }); this.setShowBotStopMessage(false);