Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions app/composables/useBlogPostBlueskyLink.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { Constellation } from '#shared/utils/constellation'
import { NPMX_SITE } from '#shared/utils/constants'
import { NPMX_SITE, NPMX_DID } from '#shared/utils/constants'

const BLOG_BACKLINK_TTL_IN_SECONDS = 60 * 5

// TODO: Remove did when going live
const TESTING_ROE_DID = 'did:plc:jbeaa5kdaladzwq3r7f5xgwe'
// const TESTING_BACKLINK_URL = 'https://roe.dev/blog/the-golden-thread'
// const NPMX_DID = 'did:plc:u5zp7npt5kpueado77kuihyz'

export interface BlogPostBlueskyLink {
did: string
rkey: string
Expand All @@ -21,7 +16,6 @@ export function useBlogPostBlueskyLink(slug: MaybeRefOrGetter<string | null | un
const s = toValue(slug)
if (!s) return null
return `${NPMX_SITE}/blog/${s}`
// return TESTING_BACKLINK_URL
})

return useAsyncData<BlogPostBlueskyLink | null>(
Expand All @@ -41,7 +35,7 @@ export function useBlogPostBlueskyLink(slug: MaybeRefOrGetter<string | null | un
1,
undefined,
true,
[[TESTING_ROE_DID]],
[[NPMX_DID]],
BLOG_BACKLINK_TTL_IN_SECONDS,
)

Expand All @@ -62,7 +56,7 @@ export function useBlogPostBlueskyLink(slug: MaybeRefOrGetter<string | null | un
1,
undefined,
true,
[[TESTING_ROE_DID]],
[[NPMX_DID]],
BLOG_BACKLINK_TTL_IN_SECONDS,
)

Expand Down
90 changes: 0 additions & 90 deletions app/pages/blog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,99 +56,9 @@ useSeoMeta({
/>
<hr v-if="idx < posts.length - 1" class="border-border-subtle" />
</template>
<!-- :selected="toSuggestionIndex(unifiedSelectedIndex) === idx" -->
<!-- :is-exact-match="
(exactMatchType === 'org' && suggestion.type === 'org') ||
(exactMatchType === 'user' && suggestion.type === 'user')
" -->
<!-- @focus="handleBlogPostSelect" -->
<!-- </div> -->
</article>

<p v-else class="text-center py-20 text-fg-subtle">No posts found.</p>
</article>
</main>
</template>

<!--
// TODO: This should be extracted into a reusable form so search and blog post can both use it
// function scrollToSelectedItem() {
// const pkgIndex = toPackageIndex(unifiedSelectedIndex.value)
// if (pkgIndex !== null) {
// packageListRef.value?.scrollToIndex(pkgIndex)
// }
// }

// function focusSelectedItem() {
// const suggIdx = toSuggestionIndex(unifiedSelectedIndex.value)
// const pkgIdx = toPackageIndex(unifiedSelectedIndex.value)

// nextTick(() => {
// if (suggIdx !== null) {
// const el = document.querySelector<HTMLElement>(`[data-suggestion-index="${suggIdx}"]`)
// el?.focus()
// } else if (pkgIdx !== null) {
// scrollToSelectedItem()
// nextTick(() => {
// const el = document.querySelector<HTMLElement>(`[data-result-index="${pkgIdx}"]`)
// el?.focus()
// })
// }
// })
// }

// function handleResultsKeydown(e: KeyboardEvent) {
// if (totalSelectableCount.value <= 0) return

// const isFromInput = (e.target as HTMLElement).tagName === 'INPUT'

// if (e.key === 'ArrowDown') {
// e.preventDefault()
// userHasNavigated.value = true
// unifiedSelectedIndex.value = clampUnifiedIndex(unifiedSelectedIndex.value + 1)
// if (isFromInput) {
// scrollToSelectedItem()
// } else {
// focusSelectedItem()
// }
// return
// }

// if (e.key === 'ArrowUp') {
// e.preventDefault()
// userHasNavigated.value = true
// unifiedSelectedIndex.value = clampUnifiedIndex(unifiedSelectedIndex.value - 1)
// if (isFromInput) {
// scrollToSelectedItem()
// } else {
// focusSelectedItem()
// }
// return
// }

// if (e.key === 'Enter') {
// if (!resultsMatchQuery.value) return

// const suggIdx = toSuggestionIndex(unifiedSelectedIndex.value)
// const pkgIdx = toPackageIndex(unifiedSelectedIndex.value)

// if (suggIdx !== null) {
// const el = document.querySelector<HTMLElement>(`[data-suggestion-index="${suggIdx}"]`)
// if (el) {
// e.preventDefault()
// el.click()
// }
// } else if (pkgIdx !== null) {
// const el = document.querySelector<HTMLElement>(`[data-result-index="${pkgIdx}"]`)
// if (el) {
// e.preventDefault()
// el.click()
// }
// }
// }
// }

// function handleBlogPostSelect(index: number) {
// // Convert suggestion index to unified index
// unifiedSelectedIndex.value = -(suggestionCount.value - index)
// } -->
1 change: 1 addition & 0 deletions shared/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const CACHE_MAX_AGE_ONE_YEAR = 60 * 60 * 24 * 365
// API Strings
export const NPMX_SITE = 'https://npmx.dev'
export const NPMX_DOCS_SITE = 'https://docs.npmx.dev'
export const NPMX_DID = 'did:plc:u5zp7npt5kpueado77kuihyz'
export const BLUESKY_API = 'https://public.api.bsky.app'
export const BLUESKY_COMMENTS_REQUEST = '/api/atproto/bluesky-comments'
export const NPM_REGISTRY = 'https://registry.npmjs.org'
Expand Down
Loading