Skip to content

Commit 9f1ab71

Browse files
authored
fix(amazonq): profile page styling
## Problem https://quip-amazon.com/MOnPAkOTTGzQ/Amazon-Q-Developer-Bug-Bash-for-FRA#temp:C:aQWe6702ee5b8e6421785dd3e9eb - Buttons not aligned with description text - No loading indication ## Solution - use same styling as `login.vue` - when users login and pending profile selection, before plugin receives API response, staying in the page "Authenticating in the browser" - when users press "retry", change "continue" text to "refreshing"
1 parent a42cc18 commit 9f1ab71

File tree

2 files changed

+101
-57
lines changed

2 files changed

+101
-57
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ export function getReadyElementId() {
603603
}
604604
</script>
605605

606-
<style>
606+
<style scoped>
607607
@import './base.css';
608608
609609
.selectable-item {

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

Lines changed: 100 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div v-show="doShow" id="profile-selector-container" :data-app="app">
33
<!-- Icon -->
4-
<div id="icon-container">
4+
<div id="icon-container" class="bottomMargin">
55
<svg
66
v-if="app === 'AMAZONQ'"
77
width="71"
@@ -45,16 +45,19 @@
4545
</svg>
4646
</div>
4747

48-
<div class="text-container">
49-
<div id="title">Choose a Q Developer profile</div>
50-
<div class="description">
48+
<template v-if="isFirstLoading">
49+
<div class="header bottomMargin">Authenticating in browser...</div>
50+
<button class="continue-button">Cancel</button>
51+
</template>
52+
53+
<template v-else>
54+
<div class="header">Choose a Q Developer profile</div>
55+
<div class="subHeader bottomMargin topMargin">
5156
Your administrator has given you access to Q from multiple profiles. Choose the profile that meets your
5257
current working needs. You can change your profile at any time.
5358
</div>
54-
</div>
5559

56-
<div id="content-container">
57-
<div class="options">
60+
<div class="bottomMargin">
5861
<!-- TODO: should use profile.arn as item-id but not idx, which will require more work to refactor auth flow code path -->
5962
<SelectableItem
6063
v-for="(profile, idx) in availableRegionProfiles"
@@ -65,30 +68,31 @@
6568
:item-sub-title="`${profile.region}`"
6669
:item-text="`Account: ${profile.description}`"
6770
:isSelected="selectedRegionProfileIndex === idx"
68-
:class="['option', { selected: selectedRegionProfileIndex === idx }]"
71+
:class="['selectable-item', { selected: selectedRegionProfileIndex === idx }]"
6972
></SelectableItem>
7073
</div>
7174

72-
<div v-if="errorMessage" id="error-message">
75+
<div v-if="errorMessage" id="error-message" class="bottomMargin">
7376
We couldn't load your Q Developer profiles. Please try again.
7477
</div>
7578

7679
<div>
7780
<template v-if="errorMessage">
78-
<button id="reload" class="continue-button" v-on:click="listAvailableProfiles">Try again</button>
79-
<button id="signout" v-on:click="signout">Sign Out</button>
81+
<button id="reload" class="continue-button" v-on:click="retryLoadProfiles">Try again</button>
82+
<button id="signout" class="topMargin" v-on:click="signout">Sign Out</button>
8083
</template>
8184
<template v-else>
8285
<button
8386
class="continue-button"
8487
id="profile-selection-continue-button"
8588
v-on:click="onClickContinue()"
89+
:disabled="isRetryLoading"
8690
>
87-
Continue
91+
{{ isRetryLoading ? 'Refreshing' : 'Continue' }}
8892
</button>
8993
</template>
9094
</div>
91-
</div>
95+
</template>
9296
</div>
9397
</template>
9498
<script lang="ts">
@@ -119,6 +123,8 @@ export default defineComponent({
119123
doShow: false,
120124
availableRegionProfiles: [] as RegionProfile[],
121125
selectedRegionProfileIndex: 0,
126+
isFirstLoading: false,
127+
isRetryLoading: false,
122128
}
123129
},
124130
props: {
@@ -134,8 +140,8 @@ export default defineComponent({
134140
async created() {
135141
this.doShow = true
136142
},
137-
async beforeMount() {
138-
await this.listAvailableProfiles()
143+
async mounted() {
144+
this.firstTimeLoadProfiles()
139145
},
140146
methods: {
141147
toggleItemSelection(itemId: number) {
@@ -153,6 +159,18 @@ export default defineComponent({
153159
client.emitUiClick('auth_signout')
154160
await client.signout()
155161
},
162+
// hack to have 2 different flag because we want to render differently for 2 paths
163+
async retryLoadProfiles() {
164+
this.isRetryLoading = true
165+
await this.listAvailableProfiles()
166+
this.isRetryLoading = false
167+
},
168+
firstTimeLoadProfiles() {
169+
this.isFirstLoading = true
170+
this.listAvailableProfiles().then(() => {
171+
this.isFirstLoading = false
172+
})
173+
},
156174
async listAvailableProfiles() {
157175
this.errorMessage = ''
158176
const r = await client.listRegionProfiles()
@@ -190,74 +208,97 @@ export function getReadyElementId() {
190208
margin: auto;
191209
position: absolute;
192210
top: var(--auth-container-top);
211+
max-width: 260px;
193212
width: 90vw;
194-
max-width: 400px;
195213
}
196214
197-
#content-container {
198-
display: flex;
199-
flex-direction: column;
200-
/* All items are centered vertically */
201-
justify-content: space-between;
202-
/** The overall height of the container, then spacing is automatic between child elements */
203-
/* height: 7rem; */
204-
align-items: center;
215+
.selectable-item {
216+
margin-bottom: 5px;
217+
/* margin-top: 10px; */
218+
cursor: pointer;
219+
width: 100%;
205220
}
206221
207-
#content-container > * {
208-
width: 100%;
209-
max-width: 260px;
222+
.header {
223+
font-size: var(--font-size-base);
224+
font-weight: bold;
210225
}
211226
212-
#icon-container {
213-
display: flex;
214-
flex-direction: column;
215-
/* justify-content: center; */
216-
align-items: center;
227+
.vscode-dark .header {
228+
color: white;
229+
}
230+
.vscode-light .header {
231+
color: black;
217232
}
218233
219-
.text-container {
220-
display: flex;
221-
flex-direction: column;
222-
margin-bottom: 1rem;
223-
margin-left: 2rem;
224-
margin-top: 1rem;
234+
.title {
235+
margin-bottom: 3px;
236+
margin-top: 3px;
237+
font-size: var(--font-size-base);
238+
font-weight: 500;
239+
}
240+
.vscode-dark .title {
241+
color: white;
242+
}
243+
.vscode-light .title {
244+
color: black;
225245
}
226246
227-
#title {
247+
.subHeader {
248+
font-size: var(--font-size-sm);
249+
}
250+
.continue-button {
251+
background-color: var(--vscode-button-background);
252+
color: white;
253+
width: 100%;
254+
height: 30px;
255+
border: none;
256+
border-radius: 4px;
228257
font-weight: bold;
229-
margin-bottom: 1.5px;
258+
margin-bottom: 3px;
259+
margin-top: 3px;
260+
cursor: pointer;
261+
font-size: var(--font-size-base);
230262
}
231263
232-
.description {
233-
margin-top: 0.5rem;
234-
font-weight: normal;
264+
.continue-button:disabled {
265+
background-color: var(--vscode-input-background);
266+
color: #6f6f6f;
267+
cursor: not-allowed;
235268
}
236269
237-
#error-message {
238-
text-align: center;
239-
font-size: var(--font-size-base);
270+
body.vscode-high-contrast:not(body.vscode-high-contrast-light) .continue-button {
271+
background-color: white;
272+
color: var(--vscode-input-background);
273+
}
274+
275+
body.vscode-high-contrast:not(body.vscode-high-contrast-light) .continue-button:disabled {
276+
background-color: #6f6f6f;
277+
color: var(--vscode-input-background);
240278
}
241279
242280
body.vscode-high-contrast-light .continue-button {
243281
background-color: var(--vscode-button-background);
244282
color: white;
245283
}
246284
247-
body.vscode-high-contrast-light .continue-button:disabled {
248-
background-color: #6f6f6f;
249-
color: var(--vscode-input-background);
285+
.bottomMargin {
286+
margin-bottom: 12px;
287+
}
288+
.topMargin {
289+
margin-top: 6px;
250290
}
251291
252-
.options {
253-
text-align: center;
292+
#icon-container {
293+
display: flex;
294+
flex-direction: column;
295+
/* justify-content: center; */
254296
align-items: center;
255297
}
256298
257-
.option {
258-
width: 100%;
259-
margin-bottom: 7px;
260-
cursor: pointer;
299+
#error-message {
300+
text-align: center;
301+
font-size: var(--font-size-base);
261302
}
262303
263304
button#signout {
@@ -266,6 +307,9 @@ button#signout {
266307
border: none;
267308
background: none;
268309
user-select: none;
269-
margin-top: 0.5rem;
310+
width: 100%;
311+
display: flex;
312+
flex-direction: column;
313+
align-items: center;
270314
}
271315
</style>

0 commit comments

Comments
 (0)