Skip to content

Commit 435160b

Browse files
committed
fix: remove render anyway button
1 parent 3339d42 commit 435160b

3 files changed

Lines changed: 15 additions & 30 deletions

File tree

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

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,6 @@ const isViewingFile = computed(() => currentNode.value?.type === 'file')
108108
const MAX_FILE_SIZE = 500 * 1024
109109
110110
const isBinaryFile = computed(() => !!filePath.value && isBinaryFilePath(filePath.value))
111-
const showBinaryContent = shallowRef(false)
112-
113-
watch(filePath, () => {
114-
showBinaryContent.value = false
115-
})
116111
117112
const isFileTooLarge = computed(() => {
118113
const size = currentNode.value?.size
@@ -122,11 +117,13 @@ const isFileTooLarge = computed(() => {
122117
// Fetch file content when a file is selected (and not too large)
123118
const fileContentUrl = computed(() => {
124119
// Don't fetch if no file path, file tree not loaded, file is too large, or it's a directory
125-
if (!filePath.value || !fileTree.value || isFileTooLarge.value || !isViewingFile.value) {
126-
return null
127-
}
128-
// Don't fetch binary files until user explicitly requests rendering
129-
if (isBinaryFile.value && !showBinaryContent.value) {
120+
if (
121+
!filePath.value ||
122+
!fileTree.value ||
123+
isFileTooLarge.value ||
124+
!isViewingFile.value ||
125+
isBinaryFile.value
126+
) {
130127
return null
131128
}
132129
return `/api/registry/file/${packageName.value}/v/${version.value}/${filePath.value}`
@@ -533,24 +530,16 @@ defineOgImageComponent('Default', {
533530
</template>
534531

535532
<!-- Binary file warning -->
536-
<div
537-
v-else-if="isViewingFile && isBinaryFile && !showBinaryContent"
538-
class="py-20 text-center"
539-
>
533+
<div v-else-if="isViewingFile && isBinaryFile" class="py-20 text-center">
540534
<div class="i-lucide:binary w-12 h-12 mx-auto text-fg-subtle mb-4" />
541535
<p class="text-fg-muted mb-2">{{ $t('code.binary_file') }}</p>
542536
<p class="text-fg-subtle text-sm mb-4">{{ $t('code.binary_rendering_warning') }}</p>
543-
<div class="flex items-center justify-center gap-3">
544-
<ButtonBase @click="showBinaryContent = true">{{
545-
$t('code.render_anyway')
546-
}}</ButtonBase>
547-
<LinkBase
548-
variant="button-secondary"
549-
:to="`https://cdn.jsdelivr.net/npm/${packageName}@${version}/${filePath}`"
550-
>
551-
{{ $t('code.view_raw') }}
552-
</LinkBase>
553-
</div>
537+
<LinkBase
538+
variant="button-secondary"
539+
:to="`https://cdn.jsdelivr.net/npm/${packageName}@${version}/${filePath}`"
540+
>
541+
{{ $t('code.view_raw') }}
542+
</LinkBase>
554543
</div>
555544

556545
<!-- File too large warning -->

i18n/locales/en.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -779,8 +779,7 @@
779779
"file_path": "File path",
780780
"scroll_to_top": "Scroll to top",
781781
"binary_file": "Binary file",
782-
"binary_rendering_warning": "File type not supported for preview.",
783-
"render_anyway": "Render anyway"
782+
"binary_rendering_warning": "File type not supported for preview."
784783
},
785784
"badges": {
786785
"provenance": {

i18n/schema.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2343,9 +2343,6 @@
23432343
},
23442344
"binary_rendering_warning": {
23452345
"type": "string"
2346-
},
2347-
"render_anyway": {
2348-
"type": "string"
23492346
}
23502347
},
23512348
"additionalProperties": false

0 commit comments

Comments
 (0)