Skip to content
Open
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
28 changes: 28 additions & 0 deletions app/components/BackButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<script setup lang="ts">
const router = useRouter()
const canGoBack = useCanGoBack()

withDefaults(
defineProps<{
class?: string
}>(),
{
class: '',
},
)
</script>

<template>
<button
v-if="canGoBack"
type="button"
:class="[
'inline-flex items-center gap-2 p-1.5 -mx-1.5 font-mono text-sm text-fg-muted hover:text-fg transition-colors duration-200 rounded focus-visible:outline-accent/70 shrink-0',
$props.class,
]"
@click="router.back()"
>
<span class="i-lucide:arrow-left rtl-flip w-4 h-4" aria-hidden="true" />
<span class="sr-only sm:not-sr-only">{{ $t('nav.back') }}</span>
</button>
</template>
13 changes: 1 addition & 12 deletions app/pages/about.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import type { Role } from '#server/api/contributors.get'
import { SPONSORS } from '~/assets/logos/sponsors'
import { OSS_PARTNERS } from '~/assets/logos/oss-partners'

const router = useRouter()
const canGoBack = useCanGoBack()

useSeoMeta({
title: () => `${$t('about.title')} - npmx`,
ogTitle: () => `${$t('about.title')} - npmx`,
Expand Down Expand Up @@ -57,15 +54,7 @@ const roleLabels = computed(
<h1 class="font-mono text-3xl sm:text-4xl font-medium">
{{ $t('about.heading') }}
</h1>
<button
type="button"
class="cursor-pointer inline-flex items-center gap-2 p-1.5 -mx-1.5 font-mono text-sm text-fg-muted hover:text-fg transition-colors duration-200 rounded focus-visible:outline-accent/70 shrink-0"
@click="router.back()"
v-if="canGoBack"
>
<span class="i-lucide:arrow-left rtl-flip w-4 h-4" aria-hidden="true" />
<span class="hidden sm:inline">{{ $t('nav.back') }}</span>
</button>
<BackButton />
</div>
<p class="text-fg-muted text-lg">
{{ $t('tagline') }}
Expand Down
13 changes: 1 addition & 12 deletions app/pages/accessibility.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ defineOgImageComponent('Default', {
title: () => $t('a11y.title'),
description: () => $t('a11y.welcome', { app: 'npmx' }),
})

const router = useRouter()
const canGoBack = useCanGoBack()
</script>

<template>
Expand All @@ -25,15 +22,7 @@ const canGoBack = useCanGoBack()
<h1 class="font-mono text-3xl sm:text-4xl font-medium">
{{ $t('a11y.title') }}
</h1>
<button
type="button"
class="cursor-pointer inline-flex items-center gap-2 p-1.5 -mx-1.5 font-mono text-sm text-fg-muted hover:text-fg transition-colors duration-200 rounded shrink-0"
@click="router.back()"
v-if="canGoBack"
>
<span class="i-lucide:arrow-left rtl-flip w-4 h-4" aria-hidden="true" />
<span class="sr-only sm:not-sr-only">{{ $t('nav.back') }}</span>
</button>
<BackButton />
</div>
</header>

Expand Down
9 changes: 6 additions & 3 deletions app/pages/blog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ useSeoMeta({
<main class="container w-full flex-1 py-12 sm:py-16 overflow-x-hidden">
<article class="max-w-2xl mx-auto">
<header class="mb-12">
<h1 class="font-mono text-3xl sm:text-4xl font-medium">
{{ $t('blog.heading') }}
</h1>
<div class="flex items-baseline justify-between gap-4 mb-4">
<h1 class="font-mono text-3xl sm:text-4xl font-medium">
{{ $t('blog.heading') }}
</h1>
<BackButton />
</div>
<p class="text-fg-muted text-lg">
{{ $t('tagline') }}
</p>
Expand Down
12 changes: 1 addition & 11 deletions app/pages/compare.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ definePageMeta({
})

const { locale } = useI18n()
const router = useRouter()
const canGoBack = useCanGoBack()
const { copied, copy } = useClipboard({ copiedDuring: 2000 })

// Sync packages with URL query param (stable ref - doesn't change on other query changes)
Expand Down Expand Up @@ -171,15 +169,7 @@ useSeoMeta({
<h1 class="font-mono text-3xl sm:text-4xl font-medium">
{{ $t('compare.packages.title') }}
</h1>
<button
type="button"
class="cursor-pointer inline-flex items-center gap-2 p-1.5 -mx-1.5 font-mono text-sm text-fg-muted hover:text-fg transition-colors duration-200 rounded focus-visible:outline-accent/70 shrink-0"
@click="router.back()"
v-if="canGoBack"
>
<span class="i-lucide:arrow-left rtl-flip w-4 h-4" aria-hidden="true" />
<span class="hidden sm:inline">{{ $t('nav.back') }}</span>
</button>
<BackButton />
</div>
<p class="text-fg-muted text-lg">
{{ $t('compare.packages.tagline') }}
Expand Down
13 changes: 1 addition & 12 deletions app/pages/pds.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<script setup lang="ts">
import type { AtprotoProfile } from '#shared/types/atproto'

const router = useRouter()
const canGoBack = useCanGoBack()

useSeoMeta({
title: () => `${$t('pds.title')} - npmx`,
ogTitle: () => `${$t('pds.title')} - npmx`,
Expand Down Expand Up @@ -51,15 +48,7 @@ const totalAccounts = computed(() => pdsUsers.value.length)
<h1 class="font-mono text-3xl sm:text-4xl font-medium">
{{ $t('pds.title') }}
</h1>
<button
type="button"
class="cursor-pointer inline-flex items-center gap-2 p-1.5 -mx-1.5 font-mono text-sm text-fg-muted hover:text-fg transition-colors duration-200 rounded focus-visible:outline-accent/70 shrink-0"
@click="router.back()"
v-if="canGoBack"
>
<span class="i-lucide:arrow-left rtl-flip w-4 h-4" aria-hidden="true" />
<span class="hidden sm:inline">{{ $t('nav.back') }}</span>
</button>
<BackButton />
</div>
<p class="text-fg-muted text-lg">
{{ $t('pds.meta_description') }}
Expand Down
12 changes: 1 addition & 11 deletions app/pages/privacy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ defineOgImageComponent('Default', {
description: () => $t('privacy_policy.welcome', { app: 'npmx' }),
})

const router = useRouter()
const canGoBack = useCanGoBack()
const buildInfo = useAppConfig().buildInfo
const { locale } = useI18n()
</script>
Expand All @@ -27,15 +25,7 @@ const { locale } = useI18n()
<h1 class="font-mono text-3xl sm:text-4xl font-medium">
{{ $t('privacy_policy.title') }}
</h1>
<button
type="button"
class="cursor-pointer inline-flex items-center gap-2 p-1.5 -mx-1.5 font-mono text-sm text-fg-muted hover:text-fg transition-colors duration-200 rounded focus-visible:outline-accent/70 shrink-0"
@click="router.back()"
v-if="canGoBack"
>
<span class="i-lucide:arrow-left rtl-flip w-4 h-4" aria-hidden="true" />
<span class="sr-only sm:not-sr-only">{{ $t('nav.back') }}</span>
</button>
<BackButton />
</div>
<i18n-t
keypath="privacy_policy.last_updated"
Expand Down
13 changes: 1 addition & 12 deletions app/pages/recharging.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ defineOgImageComponent('Default', {
description: () => $t('vacations.meta_description'),
})

const router = useRouter()
const canGoBack = useCanGoBack()

const { data: stats } = useFetch('/api/repo-stats')

/**
Expand Down Expand Up @@ -74,15 +71,7 @@ const icons = [
<h1 class="font-mono text-3xl sm:text-4xl font-medium">
{{ $t('vacations.heading') }}
</h1>
<button
type="button"
class="cursor-pointer inline-flex items-center gap-2 p-1.5 -mx-1.5 font-mono text-sm text-fg-muted hover:text-fg transition-colors duration-200 rounded focus-visible:outline-accent/70 shrink-0"
@click="router.back()"
v-if="canGoBack"
>
<span class="i-lucide:arrow-left rtl-flip w-4 h-4" aria-hidden="true" />
<span class="sr-only sm:not-sr-only">{{ $t('nav.back') }}</span>
</button>
<BackButton />
</div>
<i18n-t
keypath="vacations.subtitle"
Expand Down
11 changes: 1 addition & 10 deletions app/pages/settings.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script setup lang="ts">
const router = useRouter()
const canGoBack = useCanGoBack()
const { settings } = useSettings()
const { locale, locales, setLocale: setNuxti18nLocale } = useI18n()
const colorMode = useColorMode()
Expand Down Expand Up @@ -51,15 +50,7 @@ const setLocale: typeof setNuxti18nLocale = locale => {
<h1 class="font-mono text-3xl sm:text-4xl font-medium">
{{ $t('settings.title') }}
</h1>
<button
type="button"
class="cursor-pointer inline-flex items-center gap-2 p-1.5 -mx-1.5 font-mono text-sm text-fg-muted hover:text-fg transition-colors duration-200 rounded focus-visible:outline-accent/70 shrink-0"
@click="router.back()"
v-if="canGoBack"
>
<span class="i-lucide:arrow-left rtl-flip w-4 h-4" aria-hidden="true" />
<span class="sr-only sm:not-sr-only">{{ $t('nav.back') }}</span>
</button>
<BackButton />
</div>
<p class="text-fg-muted text-lg">
{{ $t('settings.tagline') }}
Expand Down
Loading