Skip to content

Commit 44f18a5

Browse files
authored
Merge pull request #198 from farabi-deriv/farabi/bot-2625/_is-not-a-function-trackjs-error
Farabi/bot-2625/_is-not-a-function-trackjs-error
2 parents 4c81596 + 70adb5b commit 44f18a5

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

src/pages/dashboard/bot-list/save-modal/save-modal.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const SaveModalForm: React.FC<TSaveModalForm> = ({
5454
initialValues={{
5555
is_local: true,
5656
save_as_collection: false,
57-
bot_name: bot_name === config.default_file_name ? '' : bot_name,
57+
bot_name: bot_name === config().default_file_name ? '' : bot_name,
5858
}}
5959
validate={validateBotName}
6060
onSubmit={onConfirmSave}
@@ -80,8 +80,8 @@ const SaveModalForm: React.FC<TSaveModalForm> = ({
8080
placeholder={localize('Untitled Strategy')}
8181
error={touched[field.name] && errors[field.name]}
8282
label={localize('Bot name')}
83-
onFocus={e => setCurrentFocus(e.currentTarget.name)}
84-
onBlur={() => setCurrentFocus(null)}
83+
onFocus={e => setCurrentFocus(e.currentTarget.value)}
84+
onBlur={() => setCurrentFocus('')}
8585
{...field}
8686
/>
8787
)}

src/stores/ui-store.ts

+23-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { action, makeObservable, observable } from 'mobx';
2+
import { isTouchDevice } from '@/components/shared/utils/screen/responsive';
23

34
export default class UiStore {
45
is_mobile = true;
@@ -7,6 +8,7 @@ export default class UiStore {
78
is_chart_layout_default = true;
89
is_dark_mode_on = localStorage.getItem('theme') === 'dark';
910
account_switcher_disabled_message = '';
11+
current_focus = null;
1012
show_prompt = false;
1113
is_trading_assessment_for_new_user_enabled = false;
1214
is_accounts_switcher_on = false;
@@ -16,20 +18,23 @@ export default class UiStore {
1618

1719
constructor() {
1820
makeObservable(this, {
19-
show_prompt: observable,
21+
account_switcher_disabled_message: observable,
22+
current_focus: observable,
23+
is_accounts_switcher_on: observable,
2024
is_dark_mode_on: observable,
21-
is_mobile: observable,
2225
is_desktop: observable,
26+
is_mobile: observable,
2327
is_tablet: observable,
24-
account_switcher_disabled_message: observable,
25-
setDarkMode: action,
26-
setDevice: action,
27-
setAccountSwitcherDisabledMessage: action,
28-
setPromptHandler: action,
29-
setIsTradingAssessmentForNewUserEnabled: action.bound,
3028
is_trading_assessment_for_new_user_enabled: observable,
31-
is_accounts_switcher_on: observable,
29+
show_prompt: observable,
30+
setAccountSwitcherDisabledMessage: action.bound,
31+
setCurrentFocus: action.bound,
32+
setDarkMode: action.bound,
33+
setDevice: action.bound,
34+
setPromptHandler: action.bound,
35+
setIsTradingAssessmentForNewUserEnabled: action.bound,
3236
toggleAccountsDialog: action.bound,
37+
toggleOnScreenKeyboard: action.bound,
3338
});
3439
}
3540

@@ -61,4 +66,13 @@ export default class UiStore {
6166
toggleAccountsDialog(status = !this.is_accounts_switcher_on) {
6267
this.is_accounts_switcher_on = status;
6368
}
69+
70+
toggleOnScreenKeyboard() {
71+
this.is_onscreen_keyboard_active = this.current_focus !== null && this.is_mobile && isTouchDevice();
72+
}
73+
74+
setCurrentFocus(value) {
75+
this.current_focus = value;
76+
this.toggleOnScreenKeyboard();
77+
}
6478
}

0 commit comments

Comments
 (0)