Skip to content

Commit ea482f6

Browse files
Merge staging into feature/lambda-get-started
2 parents 054bace + 5bf1da6 commit ea482f6

File tree

5 files changed

+71
-83
lines changed

5 files changed

+71
-83
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "UX: New style for the login window"
4+
}

packages/core/src/amazonq/activation.ts

Lines changed: 23 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ import { Commands, placeholder } from '../shared/vscode/commands2'
2323
import { focusAmazonQPanel, focusAmazonQPanelKeybinding } from '../codewhispererChat/commands/registerCommands'
2424
import { TryChatCodeLensProvider, tryChatCodeLensCommand } from '../codewhispererChat/editor/codelens'
2525
import { Auth } from '../auth'
26-
import { learnMoreUri } from '../codewhisperer/models/constants'
27-
import { openUrl } from '../shared/utilities/vsCodeUtils'
28-
import { AuthUtil } from '../codewhisperer'
29-
import { ConnectionStateChangeEvent } from '../auth/auth'
3026
import { telemetry } from '../shared/telemetry'
3127

3228
export async function activate(context: ExtensionContext) {
@@ -64,10 +60,7 @@ export async function activate(context: ExtensionContext) {
6460
})
6561

6662
await activateBadge()
67-
void setupAuthNotification(
68-
appInitContext.onDidChangeAmazonQVisibility.event,
69-
Auth.instance.onDidChangeConnectionState
70-
)
63+
void setupAuthNotification()
7164
}
7265

7366
function registerApps(appInitContext: AmazonQAppInitContext) {
@@ -80,85 +73,38 @@ function registerApps(appInitContext: AmazonQAppInitContext) {
8073
* Display a notification to user for Log In.
8174
*
8275
* Authentication Notification is displayed when:
83-
* - The user closes the Amazon Q chat panel, and
84-
* - The user has not performed any authentication action.
85-
*
86-
* Error Notification is displayed when:
87-
* - The user closes the Amazon Q chat panel, and
88-
* - The user attempts an authentication action but is not logged in.
76+
* - User is not authenticated
77+
* - Once every session
8978
*
90-
* @param {Event} onAmazonQChatVisibility - Event indicating the visibility status of the Amazon Q chat.
91-
* @param {Event} onDidUpdateConnection - Event indicating the authentication connection update.
9279
*/
93-
async function setupAuthNotification(
94-
onAmazonQChatVisibility: vscode.Event<boolean>,
95-
onDidUpdateConnection: vscode.Event<ConnectionStateChangeEvent | undefined>
96-
) {
97-
let isAmazonQVisible = true // Assume Chat is open by default.
80+
async function setupAuthNotification() {
9881
let notificationDisplayed = false // Auth Notification should be displayed only once.
99-
let authConnection: ConnectionStateChangeEvent
100-
101-
// Updates the visibility state of the Amazon Q chat.
102-
const updateVisibility = async (visible: boolean) => {
103-
isAmazonQVisible = visible
104-
await tryShowNotification()
105-
}
82+
await tryShowNotification()
10683

107-
// Updates the source of the connection for Amazon Q sign in.
108-
const updateConnection = async (connection: ConnectionStateChangeEvent | undefined) => {
109-
if (connection) {
110-
authConnection = connection
111-
await tryShowNotification()
84+
async function tryShowNotification() {
85+
// Do not show the notification if the IDE starts and user is already authenticated.
86+
if (Auth.instance.activeConnection) {
87+
notificationDisplayed = true
11288
}
113-
}
114-
115-
const disposables: vscode.Disposable[] = [
116-
onAmazonQChatVisibility(updateVisibility),
117-
onDidUpdateConnection(updateConnection),
118-
]
11989

120-
async function tryShowNotification() {
121-
if (notificationDisplayed || Auth.instance.activeConnection) {
90+
if (notificationDisplayed) {
12291
return
12392
}
12493

12594
const source = 'authNotification'
126-
127-
if (!isAmazonQVisible && !authConnection && !AuthUtil.instance.isConnectionExpired()) {
128-
const buttonAction = 'Sign In'
129-
notificationDisplayed = true
130-
disposables.forEach(item => item.dispose())
131-
132-
telemetry.toolkit_showNotification.emit({
133-
component: 'editor',
134-
id: source,
135-
reason: 'notLoggedIn',
136-
result: 'Succeeded',
137-
})
138-
const selection = await vscode.window.showWarningMessage('Start using Amazon Q', buttonAction)
139-
140-
if (selection === buttonAction) {
141-
void focusAmazonQPanel.execute(placeholder, source)
142-
}
143-
} else if (!isAmazonQVisible && authConnection.state === 'authenticating') {
144-
const buttonAction = 'Open documentation'
145-
notificationDisplayed = true
146-
disposables.forEach(item => item.dispose())
147-
148-
telemetry.toolkit_showNotification.emit({
149-
component: 'editor',
150-
id: source,
151-
reason: 'authenticating',
152-
result: 'Succeeded',
153-
})
154-
const selection = await vscode.window.showWarningMessage(
155-
'See Amazon Q documentation for help on signing in',
156-
buttonAction
157-
)
158-
159-
if (selection === buttonAction) {
160-
void openUrl(vscode.Uri.parse(`${learnMoreUri}#q-in-IDE-setup-bid`), source)
161-
}
95+
const buttonAction = 'Sign In'
96+
notificationDisplayed = true
97+
98+
telemetry.toolkit_showNotification.emit({
99+
component: 'editor',
100+
id: source,
101+
reason: 'notLoggedIn',
102+
result: 'Succeeded',
103+
})
104+
const selection = await vscode.window.showWarningMessage('Start using Amazon Q', buttonAction)
105+
106+
if (selection === buttonAction) {
107+
void focusAmazonQPanel.execute(placeholder, source)
162108
}
163109
}
164110
}

packages/core/src/login/webview/vue/login.vue

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
<!-- This Vue File is the login webview of AWS Toolkit and Amazon Q.-->
22
<template>
3-
<div v-bind:class="[disabled ? 'disabled-form' : '']" class="auth-container" @click="handleDocumentClick">
3+
<div
4+
v-bind:class="[disabled ? 'disabled-form' : '']"
5+
class="auth-container"
6+
:data-app="app"
7+
@click="handleDocumentClick"
8+
v-if="stage !== 'CONNECTED'"
9+
>
410
<div class="logoIcon bottomMargin">
511
<!-- Icon -->
612

713
<svg
8-
v-if="app === 'AMAZONQ' && stage !== 'CONNECTED'"
14+
v-if="app === 'AMAZONQ'"
915
width="71"
1016
height="71"
1117
viewBox="0 0 71 71"
@@ -46,7 +52,7 @@
4652
</defs>
4753
</svg>
4854
<svg
49-
v-if="app === 'TOOLKIT' && stage !== 'CONNECTED'"
55+
v-if="app === 'TOOLKIT'"
5056
width="100"
5157
height="80"
5258
viewBox="0 0 54 40"
@@ -226,7 +232,6 @@
226232
</div>
227233
</template>
228234

229-
<template v-if="stage === 'CONNECTED'"> </template>
230235
<template v-if="stage === 'AWS_PROFILE'">
231236
<button class="back-button bottomMargin" @click="handleBackButtonClick">
232237
<svg width="13" height="11" viewBox="0 0 13 11" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -624,6 +629,16 @@ export default defineComponent({
624629
width: 260px;
625630
}
626631
632+
.auth-container[data-app='AMAZONQ'] {
633+
border-radius: 11px;
634+
background: rgba(30, 30, 30, 0.8);
635+
padding: 15px;
636+
}
637+
638+
.vscode-light .auth-container[data-app='AMAZONQ'] {
639+
background: rgba(255, 255, 255, 1);
640+
}
641+
627642
.header {
628643
font-size: var(--font-size-base);
629644
font-weight: bold;

packages/core/src/login/webview/vue/reauthenticate.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The goal is to have all state managed outside of this Vue file. Instead all stat
77
and the final results are retrieved by the frontend. For this Component to update the root Component must refresh it.
88
-->
99
<template>
10-
<div v-show="doShow" id="reauthenticate-container">
10+
<div v-show="doShow" id="reauthenticate-container" :data-app="app">
1111
<!-- Icon -->
1212
<div id="icon-container">
1313
<svg
@@ -157,6 +157,17 @@ export default defineComponent({
157157
width: 100%;
158158
}
159159
160+
#reauthenticate-container[data-app='AMAZONQ'] {
161+
border-radius: 11px;
162+
background: rgba(30, 30, 30, 0.8);
163+
padding: 15px;
164+
width: 70%;
165+
}
166+
167+
.vscode-light .auth-container[data-app='AMAZONQ'] {
168+
background: rgba(255, 255, 255, 1);
169+
}
170+
160171
/* Immediate children */
161172
#reauthenticate-container > * {
162173
margin-bottom: 2rem;

packages/core/src/login/webview/vue/root.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ configure app to AMAZONQ if for Amazon Q login
33
-->
44
<template>
55
<!-- Body -->
6-
<div class="body" style="height: 100vh">
6+
<div class="body" style="height: 100vh" :data-app="app">
77
<!-- Functionality -->
88
<Login v-if="authFlowState === 'LOGIN'" :app="app"></Login>
99
<Reauthenticate
@@ -62,6 +62,14 @@ export default defineComponent({
6262
})
6363
</script>
6464
<style>
65+
body {
66+
/**
67+
* Overriding the margin and padding defined by vscode
68+
* https://github.com/microsoft/vscode/blame/54e0cddffb51553e76fb8d65474ba855c30621e8/src/vs/workbench/contrib/webview/browser/pre/index.html
69+
*/
70+
padding: 0;
71+
}
72+
6573
.body {
6674
/* The container takes up the entire height of the screen */
6775
height: 100vh;
@@ -70,4 +78,8 @@ export default defineComponent({
7078
/* All items are centered horizontally */
7179
align-items: center;
7280
}
81+
82+
.body[data-app='AMAZONQ'] {
83+
background: linear-gradient(11deg, #541fae 0%, #38b1ff 100.5%);
84+
}
7385
</style>

0 commit comments

Comments
 (0)