Skip to content

Commit a834d7a

Browse files
committed
tell the homies about npmx
1 parent 81402ee commit a834d7a

File tree

5 files changed

+61
-3
lines changed

5 files changed

+61
-3
lines changed

app/pages/profile/[handle]/index.vue

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ async function updateProfile() {
5353
displayName: displayNameInput.value,
5454
description: descriptionInput.value || undefined,
5555
website: websiteInput.value || undefined,
56+
recordExists: true,
5657
}
5758
5859
try {
@@ -77,6 +78,20 @@ async function updateProfile() {
7778
7879
const { data: likes, status } = useProfileLikes(handle)
7980
81+
const showInviteSection = computed(() => {
82+
return (
83+
profile.value.recordExists === false &&
84+
status.value === 'success' &&
85+
!likes.value?.records?.length &&
86+
user.value?.handle !== handle.value
87+
)
88+
})
89+
90+
const inviteUrl = computed(() => {
91+
const text = $t('profile.invite.compose_text', { handle: handle.value })
92+
return `https://bsky.app/intent/compose?text=${encodeURIComponent(text)}`
93+
})
94+
8095
useSeoMeta({
8196
title: () => $t('profile.seo_title', { handle: handle.value }),
8297
description: () => $t('profile.seo_description', { handle: handle.value }),
@@ -182,6 +197,19 @@ defineOgImageComponent('Default', {
182197
<div v-else-if="likes?.records" class="grid grid-cols-1 lg:grid-cols-2 gap-4">
183198
<PackageLikeCard v-for="like in likes.records" :packageUrl="like.value.subjectRef" />
184199
</div>
200+
201+
<!-- Invite section: shown when user does not have npmx profile or any like lexicons -->
202+
<div
203+
v-if="showInviteSection"
204+
class="flex flex-col items-start gap-4 p-6 bg-bg-subtle border border-border rounded-lg"
205+
>
206+
<p class="text-fg-muted">
207+
{{ $t('profile.invite.message') }}
208+
</p>
209+
<LinkBase variant="button-secondary" classicon="i-simple-icons:bluesky" :to="inviteUrl">
210+
{{ $t('profile.invite.share_button') }}
211+
</LinkBase>
212+
</div>
185213
</section>
186214
</main>
187215
</template>

i18n/locales/en.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,12 @@
160160
"seo_title": "{handle} - npmx",
161161
"seo_description": "npmx profile by {handle}",
162162
"not_found": "Profile Not Found",
163-
"not_found_message": "The profile for {handle} could not be found."
163+
"not_found_message": "The profile for {handle} could not be found.",
164+
"invite": {
165+
"message": "It doesn't look like they're using npmx yet. Want to tell them about it?",
166+
"share_button": "Share on Bluesky",
167+
"compose_text": "Hey {'@'}{handle}! Have you checked out npmx.dev yet? It's a fast, modern browser for the npm registry.\nhttps://npmx.dev"
168+
}
164169
},
165170
"package": {
166171
"not_found": "Package Not Found",

i18n/schema.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,21 @@
486486
},
487487
"not_found_message": {
488488
"type": "string"
489+
},
490+
"invite": {
491+
"type": "object",
492+
"properties": {
493+
"message": {
494+
"type": "string"
495+
},
496+
"share_button": {
497+
"type": "string"
498+
},
499+
"compose_text": {
500+
"type": "string"
501+
}
502+
},
503+
"additionalProperties": false
489504
}
490505
},
491506
"additionalProperties": false

lunaria/files/en-GB.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,12 @@
159159
"seo_title": "{handle} - npmx",
160160
"seo_description": "npmx profile by {handle}",
161161
"not_found": "Profile Not Found",
162-
"not_found_message": "The profile for {handle} could not be found."
162+
"not_found_message": "The profile for {handle} could not be found.",
163+
"invite": {
164+
"message": "It doesn't look like they're using npmx yet. Want to tell them about it?",
165+
"share_button": "Share on Bluesky",
166+
"compose_text": "Hey {'@'}{handle}! Have you checked out npmx.dev yet? It's a fast, modern browser for the npm registry.\nhttps://npmx.dev"
167+
}
163168
},
164169
"package": {
165170
"not_found": "Package Not Found",

lunaria/files/en-US.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,12 @@
159159
"seo_title": "{handle} - npmx",
160160
"seo_description": "npmx profile by {handle}",
161161
"not_found": "Profile Not Found",
162-
"not_found_message": "The profile for {handle} could not be found."
162+
"not_found_message": "The profile for {handle} could not be found.",
163+
"invite": {
164+
"message": "It doesn't look like they're using npmx yet. Want to tell them about it?",
165+
"share_button": "Share on Bluesky",
166+
"compose_text": "Hey {'@'}{handle}! Have you checked out npmx.dev yet? It's a fast, modern browser for the npm registry.\nhttps://npmx.dev"
167+
}
163168
},
164169
"package": {
165170
"not_found": "Package Not Found",

0 commit comments

Comments
 (0)