Skip to content

Commit b56f782

Browse files
committed
fixed NCP welcome selection
1 parent 77d51ab commit b56f782

File tree

2 files changed

+40
-32
lines changed

2 files changed

+40
-32
lines changed

brev/welcome-ui/app.js

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -480,37 +480,45 @@
480480
if (backPartner) showInstallScreen("picker");
481481
});
482482

483-
const installBody = $("#install-body");
484-
if (installBody) {
485-
installBody.addEventListener("click", (e) => {
486-
const tile = e.target.closest("[data-provider-id]");
487-
if (!tile) return;
488-
const id = tile.getAttribute("data-provider-id");
489-
if (!id) return;
490-
e.preventDefault();
491-
if (id === "nvidia") {
492-
showInstallScreen("nvidia");
493-
apiKeyInput.focus();
494-
if (!installTriggered && !installFailed) triggerInstall();
495-
} else {
496-
showInstallScreen("partner", id);
497-
}
498-
});
499-
installBody.addEventListener("keydown", (e) => {
500-
if (e.key !== "Enter" && e.key !== " ") return;
501-
const tile = e.target.closest("[data-provider-id]");
502-
if (!tile) return;
503-
const id = tile.getAttribute("data-provider-id");
504-
if (!id) return;
505-
e.preventDefault();
506-
if (id === "nvidia") {
507-
showInstallScreen("nvidia");
508-
apiKeyInput.focus();
509-
if (!installTriggered && !installFailed) triggerInstall();
510-
} else {
511-
showInstallScreen("partner", id);
512-
}
513-
});
483+
function handleProviderChoice(id) {
484+
if (id === "nvidia") {
485+
showInstallScreen("nvidia");
486+
apiKeyInput.focus();
487+
if (!installTriggered && !installFailed) triggerInstall();
488+
} else {
489+
showInstallScreen("partner", id);
490+
}
491+
}
492+
493+
function onProviderPickerClick(e) {
494+
const tile = e.target.closest("[data-provider-id]");
495+
if (!tile) return;
496+
const id = tile.getAttribute("data-provider-id");
497+
if (!id) return;
498+
e.preventDefault();
499+
e.stopPropagation();
500+
handleProviderChoice(id);
501+
}
502+
503+
function onProviderPickerKeydown(e) {
504+
if (e.key !== "Enter" && e.key !== " ") return;
505+
const tile = e.target.closest("[data-provider-id]");
506+
if (!tile) return;
507+
const id = tile.getAttribute("data-provider-id");
508+
if (!id) return;
509+
e.preventDefault();
510+
handleProviderChoice(id);
511+
}
512+
513+
if (installProviderPicker) {
514+
installProviderPicker.addEventListener("click", onProviderPickerClick);
515+
installProviderPicker.addEventListener("keydown", onProviderPickerKeydown);
516+
} else {
517+
const installBody = $("#install-body");
518+
if (installBody) {
519+
installBody.addEventListener("click", onProviderPickerClick);
520+
installBody.addEventListener("keydown", onProviderPickerKeydown);
521+
}
514522
}
515523

516524
closeOnBackdrop(overlayInstall);

brev/welcome-ui/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,6 @@ <h4 class="error-card__title">Something went wrong</h4>
169169
OpenShell Sandbox &middot; NVIDIA
170170
</footer>
171171

172-
<script src="app.js?v=12"></script>
172+
<script src="app.js?v=13"></script>
173173
</body>
174174
</html>

0 commit comments

Comments
 (0)