Skip to content

Commit dd49a5a

Browse files
committed
feat: rename readme tab to main tab
1 parent b11869f commit dd49a5a

6 files changed

Lines changed: 33 additions & 24 deletions

File tree

app/components/AppFooter.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,25 +88,25 @@ const closeModal = () => modalRef.value?.close?.()
8888
</p>
8989
<ul class="mb-8 flex flex-col gap-2">
9090
<li class="flex gap-2 items-center">
91-
<kbd class="kbd">.</kbd>
92-
<span>{{ $t('shortcuts.open_code_view') }}</span>
93-
</li>
94-
<li class="flex gap-2 items-center">
95-
<kbd class="kbd">r</kbd>
96-
<span>{{ $t('shortcuts.open_readme') }}</span>
91+
<kbd class="kbd">m</kbd>
92+
<span>{{ $t('shortcuts.open_main') }}</span>
9793
</li>
9894
<li class="flex gap-2 items-center">
9995
<kbd class="kbd">d</kbd>
10096
<span>{{ $t('shortcuts.open_docs') }}</span>
10197
</li>
10298
<li class="flex gap-2 items-center">
103-
<kbd class="kbd">c</kbd>
104-
<span>{{ $t('shortcuts.compare_from_package') }}</span>
99+
<kbd class="kbd">.</kbd>
100+
<span>{{ $t('shortcuts.open_code_view') }}</span>
105101
</li>
106102
<li class="flex gap-2 items-center">
107103
<kbd class="kbd">f</kbd>
108104
<span>{{ $t('shortcuts.open_diff') }}</span>
109105
</li>
106+
<li class="flex gap-2 items-center">
107+
<kbd class="kbd">c</kbd>
108+
<span>{{ $t('shortcuts.compare_from_package') }}</span>
109+
</li>
110110
</ul>
111111
<p class="text-fg-muted leading-relaxed">
112112
<i18n-t keypath="shortcuts.disable_shortcuts" tag="span" scope="global">

app/components/Package/Header.vue

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const props = defineProps<{
1414
latestVersion: SlimVersion | null
1515
provenanceData: ProvenanceDetails | null
1616
provenanceStatus: string
17-
page: 'readme' | 'docs' | 'code' | 'diff'
17+
page: 'main' | 'docs' | 'code' | 'diff'
1818
}>()
1919
2020
const { requestedVersion, orgName } = usePackageRoute()
@@ -107,7 +107,7 @@ const codeLink = computed((): RouteLocationRaw | null => {
107107
}
108108
})
109109
110-
const readmeLink = computed((): RouteLocationRaw | null => {
110+
const mainLink = computed((): RouteLocationRaw | null => {
111111
if (props.pkg == null || props.resolvedVersion == null) {
112112
return null
113113
}
@@ -145,12 +145,12 @@ onKeyStroke(
145145
)
146146
147147
onKeyStroke(
148-
e => keyboardShortcuts.value && isKeyWithoutModifiers(e, 'r') && !isEditableElement(e.target),
148+
e => keyboardShortcuts.value && isKeyWithoutModifiers(e, 'm') && !isEditableElement(e.target),
149149
e => {
150-
if (readmeLink.value === null) return
150+
if (mainLink.value === null) return
151151
e.preventDefault()
152152
153-
navigateTo(readmeLink.value)
153+
navigateTo(mainLink.value)
154154
},
155155
{ dedupe: true },
156156
)
@@ -355,7 +355,7 @@ const likeAction = async () => {
355355
>
356356
<LinkBase
357357
variant="button-secondary"
358-
to="#provenance"
358+
:to="packageRoute(packageName, resolvedVersion, '#provenance')"
359359
:aria-label="$t('package.provenance_section.view_more_details')"
360360
classicon="i-lucide:shield-check"
361361
class="py-1.5 px-2.5 me-2"
@@ -393,13 +393,13 @@ const likeAction = async () => {
393393
:class="$style.packageNav"
394394
>
395395
<LinkBase
396-
v-if="readmeLink"
397-
:to="readmeLink"
398-
aria-keyshortcuts="r"
396+
v-if="mainLink"
397+
:to="mainLink"
398+
aria-keyshortcuts="m"
399399
class="decoration-none border-b-2 p-1 hover:border-accent/50 lowercase"
400-
:class="page === 'readme' ? 'border-accent text-accent!' : 'border-transparent'"
400+
:class="page === 'main' ? 'border-accent text-accent!' : 'border-transparent'"
401401
>
402-
{{ $t('package.readme.title') }}
402+
{{ $t('package.links.main') }}
403403
</LinkBase>
404404
<LinkBase
405405
v-if="docsLink"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ const showSkeleton = shallowRef(false)
584584
:provenance-data="provenanceData"
585585
:provenance-status="provenanceStatus"
586586
:class="$style.areaHeader"
587-
page="readme"
587+
page="main"
588588
/>
589589
<article id="package-article" :class="$style.packagePage">
590590
<!-- Package details -->
@@ -1012,7 +1012,7 @@ const showSkeleton = shallowRef(false)
10121012
:class="{ 'bg-bg border-border border-b': isReadmeHeaderPinned }"
10131013
:style="{ top: readmeStickyTop }"
10141014
>
1015-
<h2 id="readme-heading" class="group text-xs text-fg-subtle uppercase tracking-wider">
1015+
<h2 id="readme-heading" class="group text-fg-subtle uppercase font-medium">
10161016
<LinkBase to="#readme">
10171017
{{ $t('package.readme.title') }}
10181018
</LinkBase>

app/utils/router.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import type { RouteLocationRaw } from 'vue-router'
22

3-
export function packageRoute(packageName: string, version?: string | null): RouteLocationRaw {
3+
export function packageRoute(
4+
packageName: string,
5+
version?: string | null,
6+
hash?: string,
7+
): RouteLocationRaw {
48
const [org, name = ''] = packageName.startsWith('@') ? packageName.split('/') : ['', packageName]
59

610
if (version) {
@@ -12,6 +16,7 @@ export function packageRoute(packageName: string, version?: string | null): Rout
1216
// remove spaces to be correctly resolved by router
1317
version: version.replace(/\s+/g, ''),
1418
},
19+
hash,
1520
}
1621
}
1722

i18n/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"open_code_view": "Open code view",
3838
"open_docs": "Open docs",
3939
"disable_shortcuts": "You can disable keyboard shortcuts in {settings}.",
40-
"open_readme": "Open readme",
40+
"open_main": "Open main information",
4141
"open_diff": "Open version differences"
4242
},
4343
"search": {
@@ -287,6 +287,7 @@
287287
"view_source": "View source"
288288
},
289289
"links": {
290+
"main": "main",
290291
"repo": "repo",
291292
"homepage": "homepage",
292293
"issues": "issues",

i18n/schema.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
"disable_shortcuts": {
116116
"type": "string"
117117
},
118-
"open_readme": {
118+
"open_main": {
119119
"type": "string"
120120
},
121121
"open_diff": {
@@ -865,6 +865,9 @@
865865
"links": {
866866
"type": "object",
867867
"properties": {
868+
"main": {
869+
"type": "string"
870+
},
868871
"repo": {
869872
"type": "string"
870873
},

0 commit comments

Comments
 (0)