From 9435ba88c731fc39c9d7d95b61119360a73a0dd3 Mon Sep 17 00:00:00 2001 From: RYGRIT Date: Fri, 6 Feb 2026 16:15:33 +0800 Subject: [PATCH 1/6] fix: clickable rows & mobile scroll overflow & dynamic line width --- app/components/Code/DirectoryListing.vue | 22 +++++++++++----------- app/components/Code/Viewer.vue | 16 ++++++++++------ app/pages/package-code/[...path].vue | 4 ++-- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/app/components/Code/DirectoryListing.vue b/app/components/Code/DirectoryListing.vue index 62e55bb0ac..9aaab52ff1 100644 --- a/app/components/Code/DirectoryListing.vue +++ b/app/components/Code/DirectoryListing.vue @@ -59,16 +59,15 @@ const parentPath = computed(() => { v-if="parentPath !== null" class="border-b border-border hover:bg-bg-subtle transition-colors" > - + .. - @@ -77,10 +76,10 @@ const parentPath = computed(() => { :key="node.path" class="border-b border-border hover:bg-bg-subtle transition-colors" > - + { class="i-carbon:folder w-4 h-4 text-yellow-600" /> - {{ node.name }} + {{ node.name }} + + {{ formatBytes(node.size) }} + - - - {{ formatBytes(node.size) }} - - diff --git a/app/components/Code/Viewer.vue b/app/components/Code/Viewer.vue index fb6b2a571e..e8f9cd71e2 100644 --- a/app/components/Code/Viewer.vue +++ b/app/components/Code/Viewer.vue @@ -16,6 +16,13 @@ const lineNumbers = computed(() => { return Array.from({ length: props.lines }, (_, i) => i + 1) }) +// Dynamically compute line number column width based on digit count +const lineNumberWidth = computed(() => { + const digits = String(props.lines).length + // ch unit matches monospace digit width + 1.5rem for px-3 padding + return `calc(${digits}ch + 1.5rem)` +}) + // Check if a line is selected function isLineSelected(lineNum: number): boolean { if (!props.selectedLines) return false @@ -55,10 +62,11 @@ watch(