Skip to content

Commit

Permalink
Fix mynah UI progress indicator (#374)
Browse files Browse the repository at this point in the history
* Fix progress indicator not disappearing after complete result has streamed

* Fix Amazon Q progress spinner bug (#376)
  • Loading branch information
taldekar authored Feb 18, 2025
1 parent 680a01a commit 7bdc736
Showing 1 changed file with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ private String generateCss() {
textarea:placeholder-shown {
line-height: 1.5rem;
}
.mynah-ui-spinner-container > span.mynah-ui-spinner-logo-part > .mynah-ui-spinner-logo-mask.text {
opacity: 1 !important;
}
</style>
""";
}
Expand All @@ -268,7 +271,8 @@ private String generateJS(final String jsEntrypoint) {
postMessage: (message) => {
ideCommand(JSON.stringify(message));
}
}, {
},
{
quickActionCommands: %s,
disclaimerAcknowledged: %b
});
Expand All @@ -284,10 +288,12 @@ private String generateJS(final String jsEntrypoint) {
%s
%s
</script>
""", jsEntrypoint, getWaitFunction(), chatQuickActionConfig,
"true".equals(disclaimerAcknowledged), getArrowKeyBlockingFunction(),
getSelectAllAndCopySupportFunctions(), getPreventEmptyPopupFunction());
getSelectAllAndCopySupportFunctions(), getPreventEmptyPopupFunction(), getFocusOnChatPromptFunction());
}

/*
Expand Down Expand Up @@ -423,6 +429,21 @@ function attachEventListeners(element) {
""".formatted(selector);
}

private String getFocusOnChatPromptFunction() {
return """
window.addEventListener('load', () => {
const chatContainer = document.querySelector('.mynah-chat-prompt');
if (chatContainer) {
chatContainer.addEventListener('click', (event) => {
if (!event.target.closest('.mynah-chat-prompt-input')) {
keepFocusOnPrompt();
}
});
}
});
""";
}

@Override
public final void onSendToChatUi(final String message) {
String script = "window.postMessage(" + message + ");";
Expand Down

0 comments on commit 7bdc736

Please sign in to comment.