Skip to content
Closed
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
6 changes: 6 additions & 0 deletions src/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ <h1 class="setup-title">Initialize Copilot</h1>
</button>
</div>

<span
id="api-key-error"
style="color: #ef4444; font-size: 12px; display: none; margin-top: 4px"
>API key cannot be empty</span
>

<button id="save-keys" class="setup-btn">
<span>Save Configuration</span>
<span class="btn-icon">→</span>
Expand Down
13 changes: 13 additions & 0 deletions src/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@

if (!apiKey) {
shakeElement(apiKeyInput);
const errorMsg = document.getElementById("api-key-error");
if (errorMsg) errorMsg.style.display = "block";
return;
}
//Validation.
Expand Down Expand Up @@ -753,3 +755,14 @@
}
});
});

// Clear error message when user starts typing
const apiInputBox = document.getElementById("api-key-input");
if (apiInputBox) {
apiInputBox.addEventListener("input", () => {
const errorMsg = document.getElementById("api-key-error");
if (errorMsg && errorMsg.style.display === "block") {

Check warning on line 764 in src/popup.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer using an optional chain expression instead, as it's more concise and easier to read.

See more on https://sonarcloud.io/project/issues?id=shouri123_Late-Meet&issues=AZ87Yhw-p7dppQPiOsPR&open=AZ87Yhw-p7dppQPiOsPR&pullRequest=859
errorMsg.style.display = "none";
}
});
}
Loading