-
-
Notifications
You must be signed in to change notification settings - Fork 378
feat: add package access/collaborators page #2307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
thealxlabs
wants to merge
1
commit into
npmx-dev:main
Choose a base branch
from
thealxlabs:feat/package-access-page
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| <script setup lang="ts"> | ||
| definePageMeta({ | ||
| name: 'package-access', | ||
| scrollMargin: 200, | ||
| }) | ||
|
|
||
| const route = useRoute('package-access') | ||
|
|
||
| const packageName = computed(() => { | ||
| const { org, name } = route.params | ||
| return org ? `${org}/${name}` : name | ||
| }) | ||
|
|
||
| const { data: pkg } = usePackage(packageName) | ||
|
|
||
| const resolvedVersion = computed(() => { | ||
| const latest = pkg.value?.['dist-tags']?.latest | ||
| if (!latest) return null | ||
| return latest | ||
| }) | ||
|
|
||
| const displayVersion = computed(() => pkg.value?.requestedVersion ?? null) | ||
|
|
||
| const latestVersion = computed(() => { | ||
| if (!pkg.value) return null | ||
| const latestTag = pkg.value['dist-tags']?.latest | ||
| if (!latestTag) return null | ||
| return pkg.value.versions[latestTag] ?? null | ||
| }) | ||
|
|
||
| const versionUrlPattern = computed(() => { | ||
| const split = packageName.value.split('/') | ||
| if (split.length === 2) { | ||
| return `/package/${split[0]}/${split[1]}/v/{version}` | ||
| } | ||
| return `/package/${packageName.value}/v/{version}` | ||
| }) | ||
|
|
||
| const { isConnected } = useConnector() | ||
| const connectorModal = import.meta.client ? useModal('connector-modal') : null | ||
|
|
||
| useSeoMeta({ | ||
| title: () => `Access - ${packageName.value} - npmx`, | ||
| description: () => `Manage access and collaborators for ${packageName.value}`, | ||
| }) | ||
| </script> | ||
|
|
||
| <template> | ||
| <main class="flex-1 pb-8"> | ||
| <PackageHeader | ||
| :pkg="pkg ?? null" | ||
| :resolved-version="resolvedVersion" | ||
| :display-version="displayVersion" | ||
| :latest-version="latestVersion" | ||
| :version-url-pattern="versionUrlPattern" | ||
| page="access" | ||
| /> | ||
|
|
||
| <div class="container py-6"> | ||
| <h1 class="font-mono text-xl font-semibold mb-1"> | ||
| {{ $t('package.access.page_title') }} | ||
| </h1> | ||
| <p class="text-sm text-fg-muted mb-6"> | ||
| {{ $t('package.access.page_subtitle', { name: packageName }) }} | ||
| </p> | ||
|
|
||
| <ClientOnly> | ||
| <template v-if="isConnected"> | ||
| <PackageAccessControls :package-name="packageName" /> | ||
| </template> | ||
| <template v-else> | ||
| <div class="py-12 text-center"> | ||
| <span class="i-lucide:lock w-12 h-12 mx-auto mb-4 text-fg-subtle block" /> | ||
| <p class="text-fg-muted mb-2 font-medium"> | ||
| {{ $t('package.access.connect_required') }} | ||
| </p> | ||
| <p class="text-sm text-fg-subtle mb-6"> | ||
| {{ $t('package.access.connect_hint') }} | ||
| </p> | ||
| <ButtonBase variant="primary" @click="connectorModal?.open()"> | ||
| {{ $t('connector.modal.connect') }} | ||
| </ButtonBase> | ||
| </div> | ||
| </template> | ||
| <template #fallback> | ||
| <div class="space-y-4"> | ||
| <SkeletonInline v-for="i in 4" :key="i" class="h-12 w-full rounded-md" /> | ||
| </div> | ||
| </template> | ||
| </ClientOnly> | ||
| </div> | ||
| </main> | ||
| </template> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 449
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 207
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 704
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 156
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 432
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 189
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 217
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 473
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 6258
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 2094
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 50373
Localise SEO metadata instead of hard-coding English copy.
useSeoMetacurrently bypasses translations, so metadata stays English in non-English locales. Other pages likeabout.vueandaccessibility.vuealready follow this localisation pattern.🌍 Suggested fix
useSeoMeta({ - title: () => `Access - ${packageName.value} - npmx`, - description: () => `Manage access and collaborators for ${packageName.value}`, + title: () => `${$t('package.access.page_title')} - ${packageName.value} - npmx`, + description: () => $t('package.access.page_subtitle', { name: packageName.value }), })📝 Committable suggestion