Skip to content

Commit 1e3ed27

Browse files
committed
chore: addressed ai comments
1 parent c2108ea commit 1e3ed27

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

app/components/Code/Viewer.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ function syncLineHeights() {
4040
// Reset heights if word wrap is disabled
4141
if (lineNumbersRef.value) {
4242
const nums = lineNumbersRef.value.querySelectorAll<HTMLElement>('.line-number')
43-
nums.forEach(num => (num.style.height = ''))
43+
for (const num of nums) {
44+
num.style.height = ''
45+
}
4446
}
4547
return
4648
}

app/pages/package-code/[[org]]/[packageName]/v/[version]/[...filePath].vue

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ const {
125125
data: fileContent,
126126
status: fileStatus,
127127
execute: fetchFileContent,
128-
} = useFetch<PackageFileContentResponse>(() => fileContentUrl.value!, { immediate: false })
128+
} = useFetch<PackageFileContentResponse>(() => fileContentUrl.value!, {
129+
immediate: false,
130+
})
129131
130132
watch(
131133
fileContentUrl,
@@ -237,7 +239,9 @@ function handleLineClick(lineNum: number, event: MouseEvent) {
237239
}
238240
239241
// Copy link to current line(s)
240-
const { copied: permalinkCopied, copy: copyPermalink } = useClipboard({ copiedDuring: 2000 })
242+
const { copied: permalinkCopied, copy: copyPermalink } = useClipboard({
243+
copiedDuring: 2000,
244+
})
241245
function copyPermalinkUrl() {
242246
const url = new URL(window.location.href)
243247
copyPermalink(url.toString())
@@ -421,11 +425,12 @@ defineOgImageComponent('Default', {
421425
<button
422426
type="button"
423427
class="px-2 py-1 font-mono text-xs text-fg-muted bg-bg-subtle border border-border rounded hover:text-fg hover:border-border-hover transition-colors items-center inline-flex gap-1"
428+
:aria-pressed="wordWrap"
424429
:class="{ 'bg-accent/10 text-accent border-accent/20': wordWrap }"
425430
@click="wordWrap = !wordWrap"
426431
>
427432
<span v-if="!!wordWrap" class="i-lucide:wrap-text w-3 h-3" />
428-
<span v-if="!wordWrap" class="i-lucide:text w-3 h-3" />
433+
<span v-else class="i-lucide:text w-3 h-3" />
429434
{{ $t('code.word_wrap') }}
430435
</button>
431436
<button
@@ -514,7 +519,9 @@ defineOgImageComponent('Default', {
514519
<p class="text-fg-muted mb-2">{{ $t('code.file_too_large') }}</p>
515520
<p class="text-fg-subtle text-sm mb-4">
516521
{{
517-
$t('code.file_size_warning', { size: bytesFormatter.format(currentNode?.size ?? 0) })
522+
$t('code.file_size_warning', {
523+
size: bytesFormatter.format(currentNode?.size ?? 0),
524+
})
518525
}}
519526
</p>
520527
<LinkBase
@@ -567,7 +574,9 @@ defineOgImageComponent('Default', {
567574
<div v-else-if="filePath && fileStatus === 'error'" class="py-20 text-center" role="alert">
568575
<div class="i-lucide:circle-alert w-8 h-8 mx-auto text-fg-subtle mb-4" />
569576
<p class="text-fg-muted mb-2">{{ $t('code.failed_to_load') }}</p>
570-
<p class="text-fg-subtle text-sm mb-4">{{ $t('code.unavailable_hint') }}</p>
577+
<p class="text-fg-subtle text-sm mb-4">
578+
{{ $t('code.unavailable_hint') }}
579+
</p>
571580
<LinkBase
572581
variant="button-secondary"
573582
:to="`https://cdn.jsdelivr.net/npm/${packageName}@${version}/${filePath}`"

0 commit comments

Comments
 (0)