Skip to content

Commit 49152ff

Browse files
committed
feat(package): add back provenance popover
1 parent 4df6684 commit 49152ff

File tree

1 file changed

+40
-12
lines changed

1 file changed

+40
-12
lines changed

app/pages/package/[...package].vue

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -495,16 +495,46 @@ function handleClick(event: MouseEvent) {
495495
>
496496
<span v-else>v{{ resolvedVersion }}</span>
497497

498-
<a
499-
v-if="hasProvenance(displayVersion)"
500-
:href="`https://www.npmjs.com/package/${pkg.name}/v/${resolvedVersion}#provenance`"
501-
target="_blank"
502-
rel="noopener noreferrer"
503-
class="inline-flex items-center justify-center gap-1.5 text-fg-muted hover:text-fg transition-colors duration-200 min-w-6 min-h-6"
504-
:title="$t('package.verified_provenance')"
505-
>
506-
<span class="i-solar:shield-check-outline w-3.5 h-3.5 shrink-0" aria-hidden="true" />
507-
</a>
498+
<template v-if="hasProvenance(displayVersion) && provenanceBadgeMounted">
499+
<div class="relative inline-flex">
500+
<AppPopover position="bottom">
501+
<template #content>
502+
<p class="flex items-center gap-2 text-fg m-0">
503+
<span
504+
class="i-solar:shield-check-outline w-3.5 h-3.5 shrink-0 text-emerald-500"
505+
aria-hidden="true"
506+
/>
507+
<span>{{
508+
provenanceData && provenanceStatus !== 'pending'
509+
? $t('package.provenance_section.built_and_signed_on', {
510+
provider: provenanceData.providerLabel,
511+
})
512+
: $t('package.verified_provenance')
513+
}}</span>
514+
</p>
515+
<a href="#provenance" class="block mt-1.5 link font-medium">
516+
{{ $t('package.provenance_section.view_more_details') }}
517+
</a>
518+
</template>
519+
<template #default="{ popoverVisible, popoverId }">
520+
<a
521+
href="#provenance"
522+
:aria-label="$t('package.provenance_section.view_more_details')"
523+
:aria-expanded="popoverVisible"
524+
aria-haspopup="true"
525+
:aria-controls="popoverVisible ? popoverId : undefined"
526+
class="inline-flex items-center justify-center gap-1.5 text-fg-muted hover:text-emerald-500 transition-colors duration-200 min-w-6 min-h-6"
527+
:class="popoverVisible && 'text-emerald-500'"
528+
>
529+
<span
530+
class="i-solar:shield-check-outline w-3.5 h-3.5 shrink-0"
531+
aria-hidden="true"
532+
/>
533+
</a>
534+
</template>
535+
</AppPopover>
536+
</div>
537+
</template>
508538
<span
509539
v-if="requestedVersion && latestVersion && resolvedVersion !== latestVersion.version"
510540
class="text-fg-subtle text-sm shrink-0"
@@ -1027,8 +1057,6 @@ function handleClick(event: MouseEvent) {
10271057
<PackageProvenanceSection
10281058
v-else-if="provenanceData"
10291059
:details="provenanceData"
1030-
:package-name="pkg.name"
1031-
:version="displayVersion?.version"
10321060
class="mt-8"
10331061
/>
10341062
</section>

0 commit comments

Comments
 (0)