Skip to content

Commit e59bc63

Browse files
committed
fix: make header connection status more minimal
1 parent c8405ee commit e59bc63

2 files changed

Lines changed: 33 additions & 18 deletions

File tree

app/app.vue

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,14 @@ onUnmounted(() => {
8585
<kbd class="hidden sm:inline-flex items-center justify-center w-5 h-5 text-xs bg-bg-muted border border-border rounded">/</kbd>
8686
</NuxtLink>
8787
</li>
88-
<li class="flex">
89-
<a
90-
href="https://github.com/danielroe/npmx.dev"
91-
rel="noopener noreferrer"
92-
class="link-subtle font-mono text-sm inline-flex items-center gap-1.5"
93-
>
94-
<span class="i-carbon-logo-github w-4 h-4" />
95-
<span class="hidden sm:inline">github</span>
96-
</a>
97-
</li>
9888
<li class="flex">
9989
<ClientOnly>
10090
<ConnectorStatus />
91+
<template #fallback>
92+
<div class="w-8 h-8 flex items-center justify-center">
93+
<span class="w-2.5 h-2.5 rounded-full bg-fg-subtle" />
94+
</div>
95+
</template>
10196
</ClientOnly>
10297
</li>
10398
</ul>

app/components/ConnectorStatus.vue

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
const { isConnected, isConnecting, npmUser, error, activeOperations, hasPendingOperations } = useConnector()
33
44
const showModal = ref(false)
5+
const showTooltip = ref(false)
56
67
const statusText = computed(() => {
78
if (isConnecting.value) return 'connecting…'
8-
if (isConnected.value && npmUser.value) return `@${npmUser.value}`
9+
if (isConnected.value && npmUser.value) return `connected as @${npmUser.value}`
910
if (isConnected.value) return 'connected'
10-
return 'disconnected'
11+
return 'connect local CLI'
1112
})
1213
1314
const statusColor = computed(() => {
@@ -31,28 +32,47 @@ const ariaLabel = computed(() => {
3132
<div class="relative">
3233
<button
3334
type="button"
34-
class="flex items-center gap-2 px-3 py-1.5 font-mono text-xs text-fg-muted hover:text-fg bg-bg-subtle border border-border rounded-md transition-colors duration-200 hover:border-border-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50"
35+
class="relative flex items-center justify-center w-8 h-8 rounded-md transition-colors duration-200 hover:bg-bg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50"
3536
:aria-label="ariaLabel"
3637
@click="showModal = true"
38+
@mouseenter="showTooltip = true"
39+
@mouseleave="showTooltip = false"
40+
@focus="showTooltip = true"
41+
@blur="showTooltip = false"
3742
>
43+
<!-- Status dot -->
3844
<span
39-
class="w-2 h-2 rounded-full transition-colors duration-200"
45+
class="w-2.5 h-2.5 rounded-full transition-colors duration-200"
4046
:class="statusColor"
4147
aria-hidden="true"
4248
/>
43-
<span class="hidden sm:inline">{{ statusText }}</span>
44-
<span class="sm:hidden">{{ isConnected ? 'on' : 'off' }}</span>
45-
<!-- Operation count badge (only active operations) -->
49+
<!-- Operation count badge (overlaid) -->
4650
<span
4751
v-if="isConnected && operationCount > 0"
48-
class="min-w-[1.25rem] h-5 px-1 flex items-center justify-center font-mono text-xs rounded-full"
52+
class="absolute -top-0.5 -right-0.5 min-w-[1rem] h-4 px-1 flex items-center justify-center font-mono text-[10px] rounded-full"
4953
:class="hasPendingOperations ? 'bg-yellow-500 text-black' : 'bg-blue-500 text-white'"
5054
aria-hidden="true"
5155
>
5256
{{ operationCount }}
5357
</span>
5458
</button>
5559

60+
<!-- Tooltip -->
61+
<Transition
62+
enter-active-class="transition-opacity duration-150"
63+
leave-active-class="transition-opacity duration-100"
64+
enter-from-class="opacity-0"
65+
leave-to-class="opacity-0"
66+
>
67+
<div
68+
v-if="showTooltip"
69+
role="tooltip"
70+
class="absolute right-0 top-full mt-2 px-2 py-1 font-mono text-xs text-fg bg-bg-elevated border border-border rounded shadow-lg whitespace-nowrap z-50"
71+
>
72+
{{ statusText }}
73+
</div>
74+
</Transition>
75+
5676
<ConnectorModal
5777
v-model:open="showModal"
5878
/>

0 commit comments

Comments
 (0)