Skip to content

Commit 8bd6057

Browse files
committed
feat: preview mode show the pr number
1 parent 85ac3d7 commit 8bd6057

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

app/components/AppHeader.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ const mobileLinks = computed<NavigationConfigWithGroups>(() => [
128128
const showFullSearch = shallowRef(false)
129129
const showMobileMenu = shallowRef(false)
130130
const { env } = useAppConfig().buildInfo
131+
const prId = env === 'preview' ? useRuntimeConfig().public.pullRequestID : 123
131132
132133
// On mobile, clicking logo+search button expands search
133134
const route = useRoute()
@@ -227,6 +228,14 @@ onKeyStroke(
227228
{{ env === 'release' ? 'alpha' : env }}
228229
</span>
229230
</NuxtLink>
231+
<NuxtLink v-if="prId" :to="`https://github.com/npmx-dev/npmx.dev/pull/${prId}`">
232+
<span
233+
aria-hidden="true"
234+
class="text-xs px-1.5 py-0.5 rounded badge-green font-sans font-medium ms-2"
235+
>
236+
PR #{{ prId }}
237+
</span>
238+
</NuxtLink>
230239
</div>
231240
<!-- Spacer when logo is hidden on desktop -->
232241
<span v-else class="hidden sm:block w-1" />

nuxt.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export default defineNuxtConfig({
5252
apiKey: 'f54e21fa3a2a0160595bb058179bfb1e',
5353
indexName: 'npm-search',
5454
},
55+
pullRequestID: process.env.VERCEL_GIT_PULL_REQUEST_ID || undefined,
5556
},
5657
},
5758

0 commit comments

Comments
 (0)