@@ -8,7 +8,10 @@ const tokenInput = shallowRef('')
88const portInput = shallowRef (' 31415' )
99const { copied, copy } = useClipboard ({ copiedDuring: 2000 })
1010
11+ const hasAttemptedConnect = shallowRef (false )
12+
1113async function handleConnect() {
14+ hasAttemptedConnect .value = true
1215 const port = Number .parseInt (portInput .value , 10 ) || 31415
1316 const success = await connect (tokenInput .value .trim (), port )
1417 if (success ) {
@@ -42,6 +45,7 @@ const executeNpmxConnectorCommand = computed(() => {
4245watch (open , isOpen => {
4346 if (isOpen ) {
4447 tokenInput .value = ' '
48+ hasAttemptedConnect .value = false
4549 }
4650})
4751 </script >
@@ -116,10 +120,58 @@ watch(open, isOpen => {
116120
117121 <!-- Disconnected state -->
118122 <form v-else class =" space-y-4" @submit.prevent =" handleConnect" >
123+ <!-- Contributor-only notice -->
124+ <div class =" p-3 bg-amber-500/10 border border-amber-500/30 rounded-lg" >
125+ <div class =" space-y-2" >
126+ <span
127+ class =" inline-block px-2 py-0.5 text-xs font-bold uppercase tracking-wider bg-amber-500/20 text-amber-400 rounded"
128+ >
129+ {{ $t('connector.modal.contributor_badge') }}
130+ </span >
131+ <p class =" text-sm text-fg-muted" >
132+ <i18n-t keypath =" connector.modal.contributor_notice" >
133+ <template #link >
134+ <a
135+ href =" https://github.com/npmx-dev/npmx.dev/blob/main/CONTRIBUTING.md#local-connector-cli"
136+ target =" _blank"
137+ rel =" noopener noreferrer"
138+ class =" text-amber-400 hover:underline"
139+ >
140+ {{ $t('connector.modal.contributor_link') }}
141+ </a >
142+ </template >
143+ </i18n-t >
144+ </p >
145+ </div >
146+ </div >
147+
119148 <p class =" text-sm text-fg-muted" >
120149 {{ $t('connector.modal.run_hint') }}
121150 </p >
122151
152+ <div
153+ class =" flex items-center p-3 bg-bg-muted border border-border rounded-lg font-mono text-sm"
154+ >
155+ <span class =" text-fg-subtle" >$</span >
156+ <span class =" text-fg-subtle ms-2" >pnpm npmx-connector</span >
157+ <button
158+ type =" button"
159+ :aria-label ="
160+ copied ? $t('connector.modal.copied') : $t('connector.modal.copy_command')
161+ "
162+ class =" ms-auto text-fg-subtle hover:text-fg transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50 rounded"
163+ @click =" copy('pnpm npmx-connector')"
164+ >
165+ <span v-if =" !copied" class =" i-carbon:copy block w-5 h-5" aria-hidden =" true" />
166+ <span
167+ v-else
168+ class =" i-carbon:checkmark block w-5 h-5 text-green-500"
169+ aria-hidden =" true"
170+ />
171+ </button >
172+ </div >
173+
174+ <!-- TODO: Uncomment when npmx-connector is published to npm
123175 <div
124176 class="flex items-center p-3 bg-bg-muted border border-border rounded-lg font-mono text-sm"
125177 >
@@ -145,6 +197,7 @@ watch(open, isOpen => {
145197 </button>
146198 </div>
147199 </div>
200+ -->
148201
149202 <p class =" text-sm text-fg-muted" >{{ $t('connector.modal.paste_token') }}</p >
150203
@@ -193,9 +246,9 @@ watch(open, isOpen => {
193246 </details >
194247 </div >
195248
196- <!-- Error message -->
249+ <!-- Error message (only show after user explicitly clicks Connect) -->
197250 <div
198- v-if =" error"
251+ v-if =" error && hasAttemptedConnect "
199252 role =" alert"
200253 class =" p-3 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-md"
201254 >
0 commit comments