Skip to content

Commit

Permalink
fix: update element selectors for tour (#1461)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanders11 authored Sep 21, 2023
1 parent dfcc8df commit ca21e04
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/less/components/version-select.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.bp3-fill {
.version-chooser {
#version-chooser {
width: 100%;
}
}
1 change: 1 addition & 0 deletions src/renderer/components/commands-action-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ export const GistActionButton = observer(
<ButtonGroup className="button-gist-action">
{this.renderPrivacyMenu()}
<Button
id="button-action"
onClick={this.handleClick}
loading={isPerformingAction}
icon={getActionIcon()}
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/components/commands-runner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ export const Runner = observer(
} = this.props.appState;

const state = currentElectronVersion?.state;
const props: ButtonProps = { className: 'button-run', disabled: true };
const props: ButtonProps = { disabled: true };

if ([downloading, missing].includes(state) && !isOnline) {
props.text = 'Offline';
props.icon = 'satellite';
return <Button {...props} type={undefined} />;
return <Button id="button-run" {...props} type={undefined} />;
}

switch (state) {
Expand Down Expand Up @@ -78,7 +78,7 @@ export const Runner = observer(
}
}

return <Button {...props} type={undefined} />;
return <Button id="button-run" {...props} type={undefined} />;
}
},
);
14 changes: 7 additions & 7 deletions src/renderer/components/tour-welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function getWelcomeTour(): Set<TourScriptStep> {
},
{
name: 'select-versions',
selector: 'button.version-chooser',
selector: '#version-chooser',
title: '📇 Choose an Electron Version',
content: (
<>
Expand All @@ -60,13 +60,13 @@ export function getWelcomeTour(): Set<TourScriptStep> {
},
{
name: 'button-run',
selector: '.button-run',
selector: '#button-run',
title: '🚀 Run Your Fiddle',
content: <p>Hit this button to give your Fiddle a try and start it.</p>,
},
{
name: 'button-publish',
selector: '.button-publish',
name: 'button-action',
selector: '#button-action',
title: '🗺 Share Your Fiddle',
content: (
<>
Expand Down Expand Up @@ -111,7 +111,7 @@ export function getWelcomeTour(): Set<TourScriptStep> {
},
{
name: 'main-editor',
selector: 'div.mosaic-window.main',
selector: 'div.mosaic-window.main\\.js',
title: '📝 Main Script',
content: (
<>
Expand All @@ -137,7 +137,7 @@ export function getWelcomeTour(): Set<TourScriptStep> {
},
{
name: 'html-editor',
selector: 'div.mosaic-window.html',
selector: 'div.mosaic-window.index\\.html',
title: '📝 HTML',
content: (
<p>
Expand All @@ -152,7 +152,7 @@ export function getWelcomeTour(): Set<TourScriptStep> {
},
{
name: 'renderer-editor',
selector: 'div.mosaic-window.renderer',
selector: 'div.mosaic-window.renderer\\.js',
title: '📝 Renderer Script',
content: (
<>
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/version-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export const VersionSelect = observer(
disabled={!!this.props.disabled}
>
<Button
className="version-chooser"
id="version-chooser"
text={`Electron v${version}`}
icon={getItemIcon(currentVersion)}
onContextMenu={(e: React.MouseEvent<HTMLButtonElement>) => {
Expand Down
8 changes: 8 additions & 0 deletions src/renderer/utils/position-for-rect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ export function positionForRect(
return { ...result, type: 'bottom' };
}

// Okay, let's try bottom left
result.left = target.left - margin - size.width;
result.top = target.top + target.height + margin;

if (isResultOkay(result, size)) {
return { ...result, type: 'left' };
}

// Top middle would require us to measure the
// text height, which is a bit gross. I'll leave
// this commented out for now, but if you need it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ exports[`Action button component renders 1`] = `
</Blueprint3.Popover>
<Blueprint3.Button
icon="upload"
id="button-action"
loading={false}
onClick={[Function]}
text="Publish"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,83 +2,83 @@

exports[`Runner component renders InstallState.downloading 1`] = `
<Blueprint3.Button
className="button-run"
disabled={true}
icon={
<Blueprint3.Spinner
size={16}
value={50}
/>
}
id="button-run"
text="Downloading"
/>
`;

exports[`Runner component renders InstallState.installed 1`] = `
<Blueprint3.Button
className="button-run"
disabled={false}
icon="play"
id="button-run"
onClick={[MockFunction]}
text="Run"
/>
`;

exports[`Runner component renders InstallState.missing 1`] = `
exports[`Runner component renders InstallState.installing 1`] = `
<Blueprint3.Button
className="button-run"
disabled={true}
icon={
<Blueprint3.Spinner
size={16}
/>
}
text="Checking status"
id="button-run"
text="Unzipping"
/>
`;

exports[`Runner component renders InstallState.installing 1`] = `
exports[`Runner component renders InstallState.missing 1`] = `
<Blueprint3.Button
className="button-run"
disabled={true}
icon={
<Blueprint3.Spinner
size={16}
/>
}
text="Unzipping"
id="button-run"
text="Checking status"
/>
`;

exports[`Runner component renders idle 1`] = `
<Blueprint3.Button
className="button-run"
disabled={false}
icon="play"
id="button-run"
onClick={[MockFunction]}
text="Run"
/>
`;

exports[`Runner component renders installing modules 1`] = `
<Blueprint3.Button
className="button-run"
disabled={false}
icon={
<Blueprint3.Spinner
size={16}
/>
}
id="button-run"
text="Installing modules"
/>
`;

exports[`Runner component renders running 1`] = `
<Blueprint3.Button
active={true}
className="button-run"
disabled={false}
icon="stop"
id="button-run"
onClick={[MockFunction]}
text="Stop"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ exports[`Header component renders the tour once started 1`] = `
</p>
</React.Fragment>,
"name": "select-versions",
"selector": "button.version-chooser",
"selector": "#version-chooser",
"title": "📇 Choose an Electron Version",
},
{
"content": <p>
Hit this button to give your Fiddle a try and start it.
</p>,
"name": "button-run",
"selector": ".button-run",
"selector": "#button-run",
"title": "🚀 Run Your Fiddle",
},
{
Expand All @@ -104,8 +104,8 @@ exports[`Header component renders the tour once started 1`] = `
You can also package your Fiddle as a standalone binary or as an installer from the "Tasks" menu.
</p>
</React.Fragment>,
"name": "button-publish",
"selector": ".button-publish",
"name": "button-action",
"selector": "#button-action",
"title": "🗺 Share Your Fiddle",
},
{
Expand Down Expand Up @@ -142,7 +142,7 @@ exports[`Header component renders the tour once started 1`] = `
</p>
</React.Fragment>,
"name": "main-editor",
"selector": "div.mosaic-window.main",
"selector": "div.mosaic-window.main\\.js",
"title": "📝 Main Script",
},
{
Expand All @@ -163,7 +163,7 @@ exports[`Header component renders the tour once started 1`] = `
like we would in Node.js.
</p>,
"name": "html-editor",
"selector": "div.mosaic-window.html",
"selector": "div.mosaic-window.index\\.html",
"title": "📝 HTML",
},
{
Expand All @@ -188,7 +188,7 @@ exports[`Header component renders the tour once started 1`] = `
</p>
</React.Fragment>,
"name": "renderer-editor",
"selector": "div.mosaic-window.renderer",
"selector": "div.mosaic-window.renderer\\.js",
"title": "📝 Renderer Script",
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ exports[`VersionSelect component renders 1`] = `
onItemSelect={[Function]}
>
<Blueprint3.Button
className="version-chooser"
disabled={false}
icon="cloud"
id="version-chooser"
onContextMenu={[Function]}
text="Electron v1.0.0"
/>
Expand Down
2 changes: 1 addition & 1 deletion tools/webpack/webpack.renderer.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const rendererConfig: Configuration = {
// Workaround for Blueprint issue
// See https://github.com/palantir/blueprint/issues/3739
new DefinePlugin({
'process.env': `(${JSON.stringify(process.env)})`,
'process.env': '{}',
}),
],
resolve: {
Expand Down

0 comments on commit ca21e04

Please sign in to comment.