Skip to content

Commit da51b4c

Browse files
refactor: simplify account menu avatars
1 parent e5f60f6 commit da51b4c

File tree

1 file changed

+35
-67
lines changed

1 file changed

+35
-67
lines changed

app/components/Header/AccountMenu.client.vue

Lines changed: 35 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ const isOpen = shallowRef(false)
1818
/** Check if connected to at least one service */
1919
const hasAnyConnection = computed(() => isNpmConnected.value || !!atprotoUser.value)
2020
21-
/** Check if connected to both services */
22-
const hasBothConnections = computed(() => isNpmConnected.value && !!atprotoUser.value)
23-
2421
/** Only show count of active (pending/approved/running) operations */
2522
const operationCount = computed(() => activeOperations.value.length)
2623
@@ -64,13 +61,7 @@ function openAuthModal() {
6461
@click="isOpen = !isOpen"
6562
class="border-none"
6663
>
67-
<!-- Stacked avatars when connected -->
68-
<span
69-
v-if="hasAnyConnection"
70-
class="flex items-center"
71-
:class="hasBothConnections ? '-space-x-2' : ''"
72-
>
73-
<!-- npm avatar (first/back) -->
64+
<span v-if="hasAnyConnection" class="flex items-center">
7465
<img
7566
v-if="isNpmConnected && npmAvatar"
7667
:src="npmAvatar"
@@ -79,38 +70,25 @@ function openAuthModal() {
7970
height="24"
8071
class="w-6 h-6 rounded-full ring-2 ring-bg object-cover"
8172
/>
82-
<span
83-
v-else-if="isNpmConnected"
84-
class="w-6 h-6 rounded-full bg-bg-muted ring-2 ring-bg flex items-center justify-center"
85-
>
86-
<span class="i-carbon-terminal w-3 h-3 text-fg-muted" aria-hidden="true" />
87-
</span>
88-
89-
<!-- Atmosphere avatar (second/front, overlapping) -->
9073
<img
91-
v-if="atprotoUser?.avatar"
74+
v-else-if="atprotoUser?.avatar"
9275
:src="atprotoUser.avatar"
9376
:alt="atprotoUser.handle"
9477
width="24"
9578
height="24"
9679
class="w-6 h-6 rounded-full ring-2 ring-bg object-cover"
97-
:class="hasBothConnections ? 'relative z-10' : ''"
9880
/>
9981
<span
100-
v-else-if="atprotoUser"
82+
v-else
10183
class="w-6 h-6 rounded-full bg-bg-muted ring-2 ring-bg flex items-center justify-center"
102-
:class="hasBothConnections ? 'relative z-10' : ''"
10384
>
10485
<span class="i-carbon-cloud w-3 h-3 text-fg-muted" aria-hidden="true" />
10586
</span>
10687
</span>
107-
108-
<!-- "connect" text when not connected -->
109-
<span v-if="!hasAnyConnection" class="font-mono text-sm">
88+
<span v-else class="font-mono text-sm">
11089
{{ $t('account_menu.connect') }}
11190
</span>
11291

113-
<!-- Chevron -->
11492
<span
11593
class="i-carbon-chevron-down w-3 h-3 transition-transform duration-200"
11694
:class="{ 'rotate-180': isOpen }"
@@ -139,9 +117,8 @@ function openAuthModal() {
139117
<div
140118
class="bg-bg-subtle/80 backdrop-blur-sm border border-border-subtle rounded-lg shadow-lg shadow-bg-elevated/50 overflow-hidden px-1"
141119
>
142-
<!-- Connected accounts section -->
143-
<div v-if="hasAnyConnection" class="py-1">
144-
<!-- npm CLI connection -->
120+
<div class="py-1">
121+
<!-- npm CLI - Connected or Connect option -->
145122
<button
146123
v-if="isNpmConnected && npmUser"
147124
type="button"
@@ -184,7 +161,34 @@ function openAuthModal() {
184161
</span>
185162
</button>
186163

187-
<!-- Atmosphere connection -->
164+
<button
165+
v-else
166+
type="button"
167+
role="menuitem"
168+
class="w-full px-3 py-2.5 flex items-center gap-3 hover:bg-bg-muted transition-colors text-start rounded-md"
169+
@click="openConnectorModal"
170+
>
171+
<span class="w-8 h-8 rounded-full bg-bg-muted flex items-center justify-center">
172+
<span
173+
v-if="isNpmConnecting"
174+
class="i-carbon-circle-dash w-4 h-4 text-yellow-500 animate-spin"
175+
aria-hidden="true"
176+
/>
177+
<span v-else class="i-carbon-terminal w-4 h-4 text-fg-muted" aria-hidden="true" />
178+
</span>
179+
<span class="flex-1 min-w-0">
180+
<span class="font-mono text-sm text-fg block">
181+
{{
182+
isNpmConnecting
183+
? $t('account_menu.connecting')
184+
: $t('account_menu.connect_npm_cli')
185+
}}
186+
</span>
187+
<span class="text-xs text-fg-subtle">{{ $t('account_menu.npm_cli_desc') }}</span>
188+
</span>
189+
</button>
190+
191+
<!-- Atmosphere - Connected or Connect option -->
188192
<button
189193
v-if="atprotoUser"
190194
type="button"
@@ -213,45 +217,9 @@ function openAuthModal() {
213217
<span class="text-xs text-fg-subtle">{{ $t('account_menu.atmosphere') }}</span>
214218
</span>
215219
</button>
216-
</div>
217-
218-
<!-- Divider (only if we have connections AND options to connect) -->
219-
<div
220-
v-if="hasAnyConnection && (!isNpmConnected || !atprotoUser)"
221-
class="border-t border-border"
222-
/>
223-
224-
<!-- Connect options -->
225-
<div v-if="!isNpmConnected || !atprotoUser" class="py-1">
226-
<button
227-
v-if="!isNpmConnected"
228-
type="button"
229-
role="menuitem"
230-
class="w-full px-3 py-2.5 flex items-center gap-3 hover:bg-bg-muted transition-colors text-start rounded-md"
231-
@click="openConnectorModal"
232-
>
233-
<span class="w-8 h-8 rounded-full bg-bg-muted flex items-center justify-center">
234-
<span
235-
v-if="isNpmConnecting"
236-
class="i-carbon-circle-dash w-4 h-4 text-yellow-500 animate-spin"
237-
aria-hidden="true"
238-
/>
239-
<span v-else class="i-carbon-terminal w-4 h-4 text-fg-muted" aria-hidden="true" />
240-
</span>
241-
<span class="flex-1 min-w-0">
242-
<span class="font-mono text-sm text-fg block">
243-
{{
244-
isNpmConnecting
245-
? $t('account_menu.connecting')
246-
: $t('account_menu.connect_npm_cli')
247-
}}
248-
</span>
249-
<span class="text-xs text-fg-subtle">{{ $t('account_menu.npm_cli_desc') }}</span>
250-
</span>
251-
</button>
252220

253221
<button
254-
v-if="!atprotoUser"
222+
v-else
255223
type="button"
256224
role="menuitem"
257225
class="w-full px-3 py-2.5 flex items-center gap-3 hover:bg-bg-muted transition-colors text-start rounded-md"

0 commit comments

Comments
 (0)