Skip to content

Commit

Permalink
Merge pull request #74 from farabi-deriv/farabi/fix--tutorial-tab-tra…
Browse files Browse the repository at this point in the history
…nslation-on-load

farabi/fix--tutorial-tab-translation-on-load
  • Loading branch information
farabi-deriv authored Oct 3, 2024
2 parents 36cf2ac + bac096e commit 393a5c7
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const NoSearchResult = observer(() => {
<Localize i18n_default_text='No results found' />
</Text>
<Text className='dc-tabs__content--no-result__content' lineHeight='xxs'>
<Localize i18n_default_text={`We couldn’t find anything matching "${faq_search_value}".`} />
<Localize i18n_default_text='We couldn’t find anything matching' />
<Localize i18n_default_text={` ${faq_search_value}`} />
</Text>
<Text className='dc-tabs__content--no-result__content' lineHeight='xxs'>
<Localize i18n_default_text='Try another term.' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const QuickStrategyGuides = () => {

return (
<div className='tutorials-quick-strategy'>
{tutorial_selected_strategy === '' && quick_strategy_tab_content.length > 0 && (
{tutorial_selected_strategy === '' && quick_strategy_tab_content().length > 0 && (
<Text
className='tutorials-quick-strategy__title'
weight='bold'
Expand All @@ -29,7 +29,7 @@ const QuickStrategyGuides = () => {
<QuickStrategyGuidesDetail
tutorial_selected_strategy={tutorial_selected_strategy}
setTutorialSelectedStrategy={setTutorialSelectedStrategy}
quick_strategy_tab_content={quick_strategy_tab_content}
quick_strategy_tab_content={quick_strategy_tab_content()}
/>
</div>
);
Expand Down
30 changes: 15 additions & 15 deletions src/pages/tutorials/tutorials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,41 +40,41 @@ const TutorialsTab = observer(({ handleTabChange }: TTutorialsTab) => {
}, [active_tab_tutorials]);

const has_content_guide_tab =
guide_tab_content.length > 0 ||
video_tab_content.length > 0 ||
faq_tab_content.length > 0 ||
quick_strategy_tab_content.length > 0;
guide_tab_content().length > 0 ||
video_tab_content().length > 0 ||
faq_tab_content().length > 0 ||
quick_strategy_tab_content().length > 0;

const tutorial_tabs = (): TTutorialsTabItem[] => [
const tutorial_tabs: TTutorialsTabItem[] = [
{
label: localize('Guide'),
content: (
<GuideContent
is_dialog_open={is_dialog_open}
guide_tab_content={guide_tab_content}
video_tab_content={video_tab_content}
guide_tab_content={guide_tab_content()}
video_tab_content={video_tab_content()}
/>
),
},
{
label: localize('FAQ'),
content: <FAQContent faq_list={faq_tab_content} handleTabChange={handleTabChange} />,
content: <FAQContent faq_list={faq_tab_content()} handleTabChange={handleTabChange} />,
},
{
label: localize('Quick strategy guides'),
content: <QuickStrategyGuides quick_strategy_tab_content={quick_strategy_tab_content} />,
content: <QuickStrategyGuides quick_strategy_tab_content={quick_strategy_tab_content()} />,
},
{
label: localize('Search'),
content: has_content_guide_tab ? (
<>
<GuideContent
is_dialog_open={is_dialog_open}
guide_tab_content={guide_tab_content}
video_tab_content={video_tab_content}
guide_tab_content={guide_tab_content()}
video_tab_content={video_tab_content()}
/>
<FAQContent faq_list={faq_tab_content} />
<QuickStrategyGuides quick_strategy_tab_content={quick_strategy_tab_content} />
<FAQContent faq_list={faq_tab_content()} />
<QuickStrategyGuides quick_strategy_tab_content={quick_strategy_tab_content()} />
</>
) : (
<NoSearchResult />
Expand All @@ -83,9 +83,9 @@ const TutorialsTab = observer(({ handleTabChange }: TTutorialsTab) => {
];

return isDesktop ? (
<TutorialsTabDesktop tutorial_tabs={tutorial_tabs()} prev_active_tutorials={prev_active_tutorials} />
<TutorialsTabDesktop tutorial_tabs={tutorial_tabs} prev_active_tutorials={prev_active_tutorials} />
) : (
<TutorialsTabMobile tutorial_tabs={tutorial_tabs()} prev_active_tutorials={prev_active_tutorials} />
<TutorialsTabMobile tutorial_tabs={tutorial_tabs} prev_active_tutorials={prev_active_tutorials} />
);
});

Expand Down
24 changes: 12 additions & 12 deletions src/stores/dashboard-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,10 @@ export default class DashboardStore implements IDashboardStore {
toast_message = '';
is_web_socket_intialised = true;
search_param = '';
guide_tab_content = user_guide_content();
video_tab_content = guide_content();
faq_tab_content = faq_content();
quick_strategy_tab_content = quick_strategy_content();
guide_tab_content = user_guide_content;
video_tab_content = guide_content;
faq_tab_content = faq_content;
quick_strategy_tab_content = quick_strategy_content;
filtered_tab_list = [];
is_chart_modal_visible = false;
is_trading_view_modal_visible = false;
Expand All @@ -244,10 +244,10 @@ export default class DashboardStore implements IDashboardStore {
};

resetTutorialTabContent = () => {
this.guide_tab_content = user_guide_content();
this.video_tab_content = guide_content();
this.faq_tab_content = faq_content();
this.quick_strategy_tab_content = quick_strategy_content();
this.guide_tab_content = user_guide_content;
this.video_tab_content = guide_content;
this.faq_tab_content = faq_content;
this.quick_strategy_tab_content = quick_strategy_content;
};

filterTuotrialTab = (search_param: string) => {
Expand Down Expand Up @@ -278,10 +278,10 @@ export default class DashboardStore implements IDashboardStore {
return quick_strategy_content()[Number(index)];
});

this.guide_tab_content = filtered_user_guide;
this.video_tab_content = filter_video_guide;
this.faq_tab_content = filtered_faq_content;
this.quick_strategy_tab_content = filtered_quick_strategy_content;
this.guide_tab_content = () => filtered_user_guide;
this.video_tab_content = () => filter_video_guide;
this.faq_tab_content = () => filtered_faq_content;
this.quick_strategy_tab_content = () => filtered_quick_strategy_content;

return filtered_tutorial_content;
};
Expand Down

0 comments on commit 393a5c7

Please sign in to comment.