Skip to content

Commit

Permalink
Merge pull request #91 from deriv-com/sandeep/bot-2292/bug-fixing
Browse files Browse the repository at this point in the history
BOT-2292/ fix: 🔥 added scroll into view for accordions
  • Loading branch information
shafin-deriv authored Oct 17, 2024
2 parents 605d391 + b6db62c commit 5eff1ac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/external/bot-skeleton/utils/local-storage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import localForage from 'localforage';
import LZString from 'lz-string';
import { config } from '../constants';
import { save_types } from '../constants/save-type';
import DBotStore from '../scratch/dbot-store';

/**
* Save workspace to localStorage
* @param {String} save_type // constants/save_types.js (unsaved, local, googledrive)
Expand Down Expand Up @@ -31,7 +33,7 @@ export const saveWorkspaceToRecent = async (xml, save_type = save_types.UNSAVED)
workspaces.push({
id: workspace_id,
timestamp: current_timestamp,
name: save_modal.bot_name,
name: config().default_file_name,
xml: current_xml,
save_type,
});
Expand Down
5 changes: 4 additions & 1 deletion src/pages/dashboard/load-bot-preview/recent-workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import classnames from 'classnames';
import { observer } from 'mobx-react-lite';
import { getRecentFileIcon } from '@/components/load-modal/recent-workspace';
import Popover from '@/components/shared_ui/popover';
import Text from '@/components/shared_ui/text';
import { DBOT_TABS } from '@/constants/bot-contents';
import { timeSince } from '@/external/bot-skeleton';
Expand Down Expand Up @@ -166,7 +167,9 @@ const RecentWorkspace = observer(({ workspace, index }: TRecentWorkspace) => {
viewRecentStrategy(item.type);
}}
>
{item.icon}
<Popover alignment='top' message={item.label} zIndex={'9999'}>
{item.icon}
</Popover>
</div>
))}
</div>
Expand Down
5 changes: 4 additions & 1 deletion src/pages/tutorials/faq-content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ const FAQContent = ({ faq_list, handleTabChange }: TFAQContent) => {
const previous_sibling_element = open_accordion_element?.previousElementSibling as HTMLElement;
if (faq_wrapper_element.current && open_accordion_element) {
const offset = previous_sibling_element ? previous_sibling_element.offsetTop - 80 : 0;
scrollToElement(faq_wrapper_element?.current, offset);
const desktop_scroll_element = document.querySelector('.dc-tabs__content--tutorials') as HTMLElement;
const mobile_scroll_element = document.querySelector('.tutorials-mobile__faq') as HTMLElement;
const scroll_element = isDesktop ? desktop_scroll_element : mobile_scroll_element;
scrollToElement(scroll_element, offset);
}
if (timer_id?.current) clearTimeout(timer_id.current);
}, 5);
Expand Down

0 comments on commit 5eff1ac

Please sign in to comment.