Skip to content

Commit b79cc3e

Browse files
Beking0912inodb
andauthored
Add Interactive Web Tour for Virtual Studies and Group Comparison (#4687)
Co-authored-by: Ino de Bruijn <ino@ino.bio>
1 parent 85a5af3 commit b79cc3e

File tree

26 files changed

+951
-13
lines changed

26 files changed

+951
-13
lines changed

end-to-end-test/local/runtime-config/portal.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ skin.right_nav.show_data_sets=true
7474
skin.right_nav.show_examples=false
7575
skin.right_nav.show_testimonials=false
7676
skin.right_nav.show_whats_new=false
77+
skin.right_nav.show_web_tours=true
7778

7879
# settings controlling what to show in the right navigation bar
7980
skin.study_view.link_text=To build your own case set, try out our enhanced Study View.

src/config/IAppConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export interface IServerConfig {
104104
skin_right_nav_show_testimonials: boolean;
105105
skin_right_nav_show_whats_new: boolean;
106106
skin_right_nav_show_twitter: boolean;
107+
skin_right_nav_show_web_tours: boolean;
107108
skin_right_nav_whats_new_blurb: string | null;
108109
skin_show_about_tab: boolean;
109110
skin_show_data_tab: boolean;

src/config/serverConfigDefaults.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export const ServerConfigDefaults: Partial<IServerConfig> = {
7575
skin_right_nav_show_examples: true,
7676
skin_right_nav_show_testimonials: true,
7777
skin_right_nav_show_whats_new: true,
78+
skin_right_nav_show_web_tours: false,
7879
skin_right_nav_show_twitter: false,
7980
skin_citation_rule_text:
8081
'Please cite: <a href="http://cancerdiscovery.aacrjournals.org/content/2/5/401.abstract" target="_blank">Cerami et al., 2012</a> &amp; <a href="http://www.ncbi.nlm.nih.gov/pubmed/23550210" target="_blank">Gao et al., 2013</a>',

src/pages/groupComparison/GroupComparisonPage.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import { HelpWidget } from 'shared/components/HelpWidget/HelpWidget';
5151
import GroupComparisonPathwayMapper from './pathwayMapper/GroupComparisonPathwayMapper';
5252
import GroupComparisonMutationsTab from './GroupComparisonMutationsTab';
5353
import GroupComparisonPathwayMapperUserSelectionStore from './pathwayMapper/GroupComparisonPathwayMapperUserSelectionStore';
54+
import { Tour } from 'tours';
5455

5556
export interface IGroupComparisonPageProps {
5657
routing: any;
@@ -363,7 +364,7 @@ export default class GroupComparisonPage extends React.Component<
363364
break;
364365
case 1:
365366
studyHeader = (
366-
<h3>
367+
<h3 data-tour="single-study-group-comparison-header">
367368
<StudyLink studyId={studies[0].studyId}>
368369
{studies[0].name}
369370
</StudyLink>
@@ -392,6 +393,7 @@ export default class GroupComparisonPage extends React.Component<
392393
<span>
393394
{studyHeader}Groups from{' '}
394395
<span
396+
data-tour="single-study-group-comparison-attribute"
395397
style={{ fontWeight: 'bold', fontStyle: 'italic' }}
396398
>
397399
{this.store.sessionClinicalAttributeName}
@@ -506,6 +508,7 @@ export default class GroupComparisonPage extends React.Component<
506508
</div>
507509
</div>
508510
<div>{this.tabs.component}</div>
511+
{this.tabs.isComplete && <Tour />}
509512
</div>
510513
</PageLayout>
511514
);

src/pages/groupComparison/groupSelector/GroupSelector.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ export default class GroupSelector extends React.Component<
208208
);
209209
return (
210210
<div
211+
data-tour="single-study-group-comparison-groups"
211212
style={{
212213
display: 'flex',
213214
alignItems: 'center',

src/pages/home/HomePage.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import RightBar from '../../shared/components/rightbar/RightBar';
1111
import './homePage.scss';
1212
import autobind from 'autobind-decorator';
1313
import { createQueryStore } from 'shared/lib/createQueryStore';
14+
import { setTourLocalStorageFromURL } from 'tours';
1415

1516
const win = window as any;
1617

@@ -37,6 +38,10 @@ export default class HomePage extends React.Component<
3738
this.queryStore = createQueryStore();
3839
}
3940

41+
componentDidMount() {
42+
setTourLocalStorageFromURL();
43+
}
44+
4045
private handleTabChange(id: string) {
4146
this.props.routing.updateRoute({ tab: id });
4247
}

src/pages/studyView/StudyViewPage.tsx

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ import { CustomChartData } from 'shared/api/session-service/sessionServiceModels
7676
import { HelpWidget } from 'shared/components/HelpWidget/HelpWidget';
7777
import { buildCBioPortalPageUrl } from 'shared/api/urls';
7878
import StudyViewPageSettingsMenu from 'pages/studyView/menu/StudyViewPageSettingsMenu';
79+
import { Tour } from 'tours';
7980
import QueryString from 'qs';
8081

8182
export interface IStudyViewPageProps {
@@ -367,6 +368,21 @@ export default class StudyViewPage extends React.Component<
367368
}
368369
}
369370

371+
@computed get isLoading() {
372+
return (
373+
this.store.queriedSampleIdentifiers.isPending ||
374+
this.store.invalidSampleIds.isPending ||
375+
this.body.isPending
376+
);
377+
}
378+
379+
@computed get isAnySampleSelected() {
380+
return this.store.selectedSamples.result.length !==
381+
this.store.samples.result.length
382+
? 1
383+
: 0;
384+
}
385+
370386
@computed get studyViewFullUrlWithFilter() {
371387
return `${window.location.protocol}//${window.location.host}${
372388
window.location.pathname
@@ -1024,14 +1040,16 @@ export default class StudyViewPage extends React.Component<
10241040
>
10251041
<LoadingIndicator
10261042
size={'big'}
1027-
isLoading={
1028-
this.store.queriedSampleIdentifiers.isPending ||
1029-
this.store.invalidSampleIds.isPending ||
1030-
this.body.isPending
1031-
}
1043+
isLoading={this.isLoading}
10321044
center={true}
10331045
/>
10341046
{this.body.component}
1047+
{!this.isLoading && (
1048+
<Tour
1049+
studies={this.isAnySampleSelected}
1050+
isLoggedIn={this.props.appStore.isLoggedIn}
1051+
/>
1052+
)}
10351053
</PageLayout>
10361054
);
10371055
}

src/pages/studyView/charts/ChartContainer.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ const COMPARISON_CHART_TYPES: ChartType[] = [
108108
];
109109

110110
export interface IChartContainerProps {
111+
id?: string;
111112
chartMeta: ChartMeta;
112113
chartType: ChartType;
113114
store: StudyViewPageStore;
@@ -466,7 +467,10 @@ export class ChartContainer extends React.Component<IChartContainerProps, {}> {
466467
if (this.selectedRowsKeys!.length >= 2) {
467468
return {
468469
content: (
469-
<div style={{ display: 'flex', alignItems: 'center' }}>
470+
<div
471+
data-tour="mutated-genes-table-compare-btn"
472+
style={{ display: 'flex', alignItems: 'center' }}
473+
>
470474
<ComparisonVsIcon
471475
className={classnames('fa fa-fw')}
472476
style={{ marginRight: 4 }}

src/pages/studyView/studyPageHeader/ActionButtons.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ export default class ActionButtons extends React.Component<
180180
overlay={<span>{this.virtualStudyButtonTooltip}</span>}
181181
>
182182
<button
183+
data-tour="action-button-bookmark"
183184
className="btn btn-default btn-sm"
184185
disabled={!this.props.loadingComplete}
185186
>

src/pages/studyView/studyPageHeader/studySummary/StudySummary.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ export default class StudySummary extends React.Component<
172172
{this.descriptionFirstLine}
173173
{this.hasMoreDescription && (
174174
<i
175+
data-tour="show-more-description-icon"
175176
className={`fa fa-${
176177
this.showMoreDescription ? 'minus' : 'plus'
177178
}-circle`}

src/pages/studyView/tabs/SummaryTab.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ export class StudySummaryTab extends React.Component<
352352
this.store.resetGeneFilter(chartMeta.uniqueKey);
353353
props.selectedGenes = this.store.selectedGenes;
354354
props.onGeneSelect = this.store.onCheckGene;
355+
props.id = 'mutated-genes-table';
355356
props.title = this.store.getChartTitle(
356357
ChartTypeEnum.MUTATED_GENES_TABLE,
357358
props.title
@@ -728,7 +729,7 @@ export class StudySummaryTab extends React.Component<
728729
// 2. The maintainer of RGL repo currently not actively accepts pull requests. So we don't know when the
729730
// issue will be solved.
730731
return (
731-
<div key={chartMeta.uniqueKey}>
732+
<div key={chartMeta.uniqueKey} data-tour={props.id}>
732733
<DelayedRender>
733734
{/* Delay the render after a setTimeout, because synchronous rendering would jam UI updates
734735
and make things laggy */}

src/pages/studyView/virtualStudy/VirtualStudy.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,10 @@ export default class VirtualStudy extends React.Component<
229229

230230
render() {
231231
return (
232-
<div className={styles.virtualStudy}>
232+
<div
233+
data-tour="virtual-study-summary-panel"
234+
className={styles.virtualStudy}
235+
>
233236
<If condition={this.virtualStudy.isError}>
234237
<Then>
235238
<div style={{ textAlign: 'center' }}>
@@ -277,6 +280,7 @@ export default class VirtualStudy extends React.Component<
277280
<div className="input-group-btn">
278281
{this.showSaveButton && (
279282
<button
283+
data-tour="virtual-study-summary-save-btn"
280284
className={classnames(
281285
'btn btn-default',
282286
styles.saveButton
@@ -308,6 +312,7 @@ export default class VirtualStudy extends React.Component<
308312
</button>
309313
)}
310314
<button
315+
data-tour="virtual-study-summary-share-btn"
311316
className={classnames(
312317
'btn btn-default',
313318
styles.saveButton
@@ -422,6 +427,7 @@ export default class VirtualStudy extends React.Component<
422427
</span>
423428
{this.saving && (
424429
<span
430+
data-tour="virtual-study-summary-query-btn"
425431
className="btn btn-default"
426432
onClick={event => {
427433
if (

src/shared/components/PageLayout/PageLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class PageLayout extends React.Component<IPageLayout, {}> {
2828
noMargin
2929
)}
3030
>
31-
<div id="mainColumn">
31+
<div id="mainColumn" data-tour="mainColumn">
3232
<div>{this.props.children}</div>
3333
</div>
3434
{this.props.rightBar && (

src/shared/components/query/CancerStudySelector.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ export default class CancerStudySelector extends React.Component<
238238

239239
return (
240240
<div
241+
data-tour="cancer-study-search-box"
241242
style={{
242243
display: 'flex',
243244
alignItems: 'center',
@@ -268,6 +269,7 @@ export default class CancerStudySelector extends React.Component<
268269
</Then>
269270
</If>
270271
<div
272+
data-tour="cancer-study-list-container"
271273
className={styles.cancerStudyListContainer}
272274
data-test="cancerTypeListContainer"
273275
>

src/shared/components/query/CancerStudyTreeData.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ export const CANCER_TYPE_ROOT = 'tissue';
1010
export const VIRTUAL_STUDY_NAME = 'My Virtual Studies';
1111
export const PHYSICAL_STUDY_NAME = 'Studies';
1212

13-
export type CancerTypeWithVisibility = CancerType & { alwaysVisible?: boolean };
13+
export type CancerTypeWithVisibility = CancerType & {
14+
alwaysVisible?: boolean;
15+
id?: string;
16+
};
1417

1518
export type CancerTreeNode = CancerTypeWithVisibility | CancerStudy;
1619

@@ -51,6 +54,7 @@ export default class CancerStudyTreeData {
5154
};
5255

5356
virtualStudyCategory: CancerTypeWithVisibility = {
57+
id: 'my_virtual_studies_list',
5458
dedicatedColor: '',
5559
name: VIRTUAL_STUDY_NAME,
5660
parent: CANCER_TYPE_ROOT,
@@ -169,6 +173,7 @@ export default class CancerStudyTreeData {
169173
allStudyTags.find(
170174
t => t.studyId === (node as CancerStudy).studyId
171175
);
176+
172177
let studyTags =
173178
foundStudyByTags && foundStudyByTags?.tags
174179
? stringifyTags(JSON.parse(foundStudyByTags.tags))

src/shared/components/query/QueryContainer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ export default class QueryContainer extends React.Component<
426426
}
427427
>
428428
<a
429+
data-tour="explore-studies-button"
429430
onClick={() =>
430431
!this
431432
.exploreCohortsButtonDisabled &&

src/shared/components/query/studyList/StudyList.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,11 @@ export default class StudyList extends QueryStoreComponent<
149149
styles.Level(currentLevel)
150150
);
151151
return (
152-
<ul key={arrayIndex} className={ulClassName}>
152+
<ul
153+
data-tour={cancerType.id}
154+
key={arrayIndex}
155+
className={ulClassName}
156+
>
153157
{heading}
154158
{childStudies.map(this.renderCancerStudy)}
155159
{childCancerTypes.map(this.renderCancerType)}

src/shared/components/rightbar/RightBar.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Link } from 'react-router-dom';
99
import LoadingIndicator from '../loadingIndicator/LoadingIndicator';
1010
import { buildCBioPortalPageUrl } from '../../api/urls';
1111
import { ResultsViewTab } from '../../../pages/resultsView/ResultsViewPageHelpers';
12+
import { Tour } from 'tours';
1213
import { mockOrder } from 'pages/patientView/vafPlot/mockData';
1314
import { remoteData } from 'cbioportal-frontend-commons';
1415
import { sleep } from 'shared/lib/TimeUtils';
@@ -298,10 +299,32 @@ export default class RightBar extends React.Component<
298299
) : null;
299300
}
300301

302+
getHomePageTour() {
303+
const isLoading =
304+
!this.studyStore.cancerTypes.isComplete ||
305+
!this.studyStore.cancerStudies.isComplete ||
306+
!this.studyStore.userVirtualStudies.isComplete;
307+
return getServerConfig().skin_right_nav_show_web_tours ? (
308+
<div className="rightBarSection" style={{ minHeight: '70px' }}>
309+
<h3>Interactive Tours</h3>
310+
{!isLoading && (
311+
<Tour
312+
hideEntry={false}
313+
isLoggedIn={this.studyStore.userLoggedIn}
314+
studies={
315+
this.studyStore.selectableSelectedStudyIds.length
316+
}
317+
/>
318+
)}
319+
</div>
320+
) : null;
321+
}
322+
301323
render() {
302324
return (
303325
<div>
304326
{this.getWhatsNew()}
327+
{this.getHomePageTour()}
305328
{this.getExampleSection()}
306329
{this.getInstallationMap()}
307330
{this.getTestimonialsSection()}

src/shared/components/survival/LeftTruncationCheckbox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const LeftTruncationCheckbox: React.FunctionComponent<LeftTruncationCheckboxProp
6565
{'. '}
6666
This involves adjusting patients at risk
6767
at time t to date of sequencing rather
68-
than date of diagnosis. Note that some
68+
than date of diagnosis. Note that some
6969
patients might be excluded because they
7070
passed away before their biopsies were
7171
sequenced.

0 commit comments

Comments
 (0)