Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove logs button from preview loader view #35

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/vscode-extension/src/common/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

// important: order of values in this enum matters
export enum StartupMessage {
InitializingDevice = "Initializing device",

Check warning on line 27 in packages/vscode-extension/src/common/Project.ts

View workflow job for this annotation

GitHub Actions / check

Enum Member name `InitializingDevice` must match one of the following formats: camelCase
StartingPackager = "Starting packager",

Check warning on line 28 in packages/vscode-extension/src/common/Project.ts

View workflow job for this annotation

GitHub Actions / check

Enum Member name `StartingPackager` must match one of the following formats: camelCase
BootingDevice = "Booting device",
Building = "Building",
Installing = "Installing",
Expand Down Expand Up @@ -77,6 +77,7 @@
resumeDebugger(): Promise<void>;
stepOverDebugger(): Promise<void>;
focusBuildOutput(): Promise<void>;
focusExtensionLogsOutput(): Promise<void>;
focusDebugConsole(): Promise<void>;

openNavigation(navigationItemID: string): Promise<void>;
Expand Down
5 changes: 5 additions & 0 deletions packages/vscode-extension/src/project/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ export class Project implements Disposable, MetroDelegate, ProjectInterface {
}
this.buildManager.focusBuildOutput();
}

public async focusExtensionLogsOutput() {
Logger.openOutputPanel();
}

public async focusDebugConsole() {
commands.executeCommand("workbench.panel.repl.view.focus");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.preview-loader-container {
width: 75%;
cursor: pointer;
}

.preview-loader-button-group {
Expand Down
25 changes: 10 additions & 15 deletions packages/vscode-extension/src/webview/components/PreviewLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,17 @@ function PreviewLoader() {
}
}, [projectState]);

function handleLoaderClick() {
if (projectState.startupMessage === StartupMessage.Building) {
project.focusBuildOutput();
} else {
project.focusExtensionLogsOutput();
}
}

return (
<>
<div className="preview-loader-container">
{projectState.startupMessage === StartupMessage.Building && (
<div className="preview-loader-button-group">
<IconButton
onClick={() => project.focusBuildOutput()}
tooltip={{
label: "Open build logs",
side: "top",
}}>
<span className="codicon codicon-symbol-keyword" />
</IconButton>
</div>
)}

<button className="preview-loader-container" onClick={handleLoaderClick}>
<div className="preview-loader-button-group">
<StartupMessageComponent className="preview-loader-message">
{projectState.startupMessage}
Expand All @@ -69,7 +64,7 @@ function PreviewLoader() {
</div>
)}
</div>
</div>
</button>
<ProgressBar progress={progress} />
</>
);
Expand Down
Loading