-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtour.ts
More file actions
193 lines (182 loc) · 7.54 KB
/
Copy pathtour.ts
File metadata and controls
193 lines (182 loc) · 7.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
// Declare Driver.js global (loaded via CDN)
declare const driver: any;
interface TourStep {
element?: string;
popover: {
title: string;
description: string;
side?: string;
align?: string;
};
onHighlightStarted?: (element?: Element, step?: any, options?: any) => void;
}
class MetriqTour {
private driverObj: any;
constructor() {
// Fix for Driver.js CDN potentially namespacing the constructor
const driverConstructor = (window as any).driver?.js?.driver || (window as any).driver;
if (!driverConstructor) {
console.error("MetriqTour: Driver.js not loaded");
return;
}
this.driverObj = driverConstructor({
showProgress: true,
animate: true,
steps: this.getSteps(),
doneBtnText: 'Done',
closeBtnText: 'Close',
nextBtnText: 'Next',
prevBtnText: 'Previous',
});
}
private getSteps(): TourStep[] {
return [
{
element: '.brand',
popover: {
title: 'Welcome to Metriq',
description: 'The community-driven platform for benchmarking quantum hardware and compilers. Navigate the performance landscape.',
side: 'bottom',
align: 'start'
}
},
{
element: '.tabs--views',
popover: {
title: 'Primary Navigation',
description: 'Switch between the high-level platform leaderboard, explore individual benchmark results, and read benchmark definitions',
side: 'bottom',
align: 'center'
}
},
{
element: '#view-platforms-btn',
popover: {
title: 'Platform Leaderboard',
description: 'Compare global quantum systems using the aggregated Metriq Score—a normalized performance metric across diverse architectures. <a href="#view=platforms&help=metriq-score">Learn more</a>',
side: 'bottom',
align: 'center'
},
onHighlightStarted: () => {
window.scrollTo({ top: 0, behavior: 'auto' });
document.getElementById('view-platforms-btn')?.click();
void document.body.offsetHeight; // Force reflow
}
},
{
element: '#platforms-container', // Target container instead of table to be safer
popover: {
title: 'Device Specifications',
description: 'At a glance view of perfomance across providers and devices, as well as information on recent benchmark data contributions.',
side: 'top',
align: 'center'
},
onHighlightStarted: () => {
document.getElementById('view-platforms-btn')?.click();
void document.body.offsetHeight;
}
},
{
element: '.link-platforms-json',
popover: {
title: 'Platforms Index JSON',
description: 'Download a JSON view of the high-level platform data',
side: 'left',
align: 'center'
},
onHighlightStarted: () => {
document.getElementById('view-platforms-btn')?.click();
}
},
{
element: '#view-results-btn',
popover: {
title: 'Benchmark Analysis',
description: 'Explore granular individual benchmark results from the community-contributed metriq dataset',
side: 'bottom',
align: 'center'
},
onHighlightStarted: () => {
window.scrollTo({ top: 0, behavior: 'auto' });
document.getElementById('view-results-btn')?.click();
void document.body.offsetHeight; // Force reflow
}
},
{
element: '#panel-graph', // Target the graph panel
popover: {
title: 'Performance Trends',
description: 'Visualize benchmark and provider performance over time',
side: 'left',
align: 'center'
},
onHighlightStarted: () => {
document.getElementById('view-results-btn')?.click();
document.getElementById('tab-graph')?.click();
void document.body.offsetHeight;
}
},
{
element: '.smart-controls',
popover: {
title: 'Parametric Filtering',
description: 'Isolate specific variables. Slice the dataset by cloud provider, device, or benchmark protocol.',
side: 'bottom',
align: 'center'
},
onHighlightStarted: () => {
document.getElementById('view-results-btn')?.click();
document.getElementById('tab-table')?.click(); // Filter step needs table view
void document.body.offsetHeight;
}
},
{
popover: {
title: 'Result Deep Dive',
description: 'Click on any row in the table to see more details about the Device, job parameters, and raw results.',
side: 'bottom',
align: 'center'
},
onHighlightStarted: () => {
document.getElementById('view-results-btn')?.click();
document.getElementById('tab-table')?.click();
void document.body.offsetHeight;
}
},
{
element: '#view-benchmarks-btn',
popover: {
title: 'Benchmark Definitions',
description: 'Reference the Metriq Gym documentation to understand benchmark definitions and parameters.',
side: 'bottom',
align: 'center'
},
onHighlightStarted: () => {
window.scrollTo({ top: 0, behavior: 'auto' });
document.getElementById('view-benchmarks-btn')?.click();
void document.body.offsetHeight;
}
},
{
element: '.brand', // Back to start/neutral
popover: {
title: 'Start Exploring',
description: "You are ready to analyze the state of the art. Restart this tour via the 'Take a tour' button at any time.",
side: 'bottom',
align: 'start'
},
onHighlightStarted: () => {
// Reset to default view at the end? Or leave them where they are.
// Let's go back to platforms as it's the "home" view.
document.getElementById('view-platforms-btn')?.click();
}
}
];
}
public start() {
if (!this.driverObj) return;
this.driverObj.drive();
}
}
// Global instance to be used by main.ts or inline script
(window as any).MetriqTour = MetriqTour;