@@ -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 ) {
@@ -38,10 +41,10 @@ const executeNpmxConnectorCommand = computed(() => {
3841 })
3942})
4043
41- // Reset form when modal opens
4244watch (open , isOpen => {
4345 if (isOpen ) {
4446 tokenInput .value = ' '
47+ hasAttemptedConnect .value = false
4548 }
4649})
4750 </script >
@@ -82,6 +85,31 @@ watch(open, isOpen => {
8285
8386 <!-- Disconnected state -->
8487 <form v-else class =" space-y-4" @submit.prevent =" handleConnect" >
88+ <!-- Contributor-only notice -->
89+ <div class =" p-3 bg-amber-500/10 border border-amber-500/30 rounded-lg" >
90+ <div class =" space-y-2" >
91+ <span
92+ class =" inline-block px-2 py-0.5 text-xs font-bold uppercase tracking-wider bg-amber-500/20 text-amber-400 rounded"
93+ >
94+ {{ $t('connector.modal.contributor_badge') }}
95+ </span >
96+ <p class =" text-sm text-fg-muted" >
97+ <i18n-t keypath =" connector.modal.contributor_notice" >
98+ <template #link >
99+ <a
100+ href =" https://github.com/npmx-dev/npmx.dev/blob/main/CONTRIBUTING.md#local-connector-cli"
101+ target =" _blank"
102+ rel =" noopener noreferrer"
103+ class =" text-amber-400 hover:underline"
104+ >
105+ {{ $t('connector.modal.contributor_link') }}
106+ </a >
107+ </template >
108+ </i18n-t >
109+ </p >
110+ </div >
111+ </div >
112+
85113 <p class =" text-sm text-fg-muted" >
86114 {{ $t('connector.modal.run_hint') }}
87115 </p >
@@ -90,26 +118,46 @@ watch(open, isOpen => {
90118 class =" flex items-center p-3 bg-bg-muted border border-border rounded-lg font-mono text-sm"
91119 >
92120 <span class =" text-fg-subtle" >$</span >
93- <span class =" text-fg-subtle ms-2" >{{ executeNpmxConnectorCommand }}</span >
94- <div class =" ms-auto flex items-center gap-2" >
95- <PackageManagerSelect />
96-
97- <button
98- type =" button"
99- :aria-label =" copied ? $t('connector.modal.copied') : $t('connector.modal.copy_command')"
100- 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"
101- @click =" copyCommand"
102- >
103- <span v-if =" !copied" class =" i-carbon:copy block w-5 h-5" aria-hidden =" true" />
104- <span
105- v-else
106- class =" i-carbon:checkmark block w-5 h-5 text-green-500"
107- aria-hidden =" true"
108- />
109- </button >
110- </div >
121+ <span class =" text-fg-subtle ms-2" >pnpm npmx-connector</span >
122+ <button
123+ type =" button"
124+ :aria-label =" copied ? $t('connector.modal.copied') : $t('connector.modal.copy_command')"
125+ 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"
126+ @click =" copy('pnpm npmx-connector')"
127+ >
128+ <span v-if =" !copied" class =" i-carbon:copy block w-5 h-5" aria-hidden =" true" />
129+ <span v-else class =" i-carbon:checkmark block w-5 h-5 text-green-500" aria-hidden =" true" />
130+ </button >
111131 </div >
112132
133+ <!-- TODO: Uncomment when npmx-connector is published to npm
134+ <div
135+ class="flex items-center p-3 bg-bg-muted border border-border rounded-lg font-mono text-sm"
136+ >
137+ <span class="text-fg-subtle">$</span>
138+ <span class="text-fg-subtle ms-2">{{ executeNpmxConnectorCommand }}</span>
139+ <div class="ms-auto flex items-center gap-2">
140+ <PackageManagerSelect />
141+
142+ <button
143+ type="button"
144+ :aria-label="
145+ copied ? $t('connector.modal.copied') : $t('connector.modal.copy_command')
146+ "
147+ 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"
148+ @click="copyCommand"
149+ >
150+ <span v-if="!copied" class="i-carbon:copy block w-5 h-5" aria-hidden="true" />
151+ <span
152+ v-else
153+ class="i-carbon:checkmark block w-5 h-5 text-green-500"
154+ aria-hidden="true"
155+ />
156+ </button>
157+ </div>
158+ </div>
159+ -->
160+
113161 <p class =" text-sm text-fg-muted" >{{ $t('connector.modal.paste_token') }}</p >
114162
115163 <div class =" space-y-3" >
@@ -157,9 +205,9 @@ watch(open, isOpen => {
157205 </details >
158206 </div >
159207
160- <!-- Error message -->
208+ <!-- Error message (only show after user explicitly clicks Connect) -->
161209 <div
162- v-if =" error"
210+ v-if =" error && hasAttemptedConnect "
163211 role =" alert"
164212 class =" p-3 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-md"
165213 >
0 commit comments