@@ -16,6 +16,8 @@ import { type UnpkgMeta } from '~/types';
1616import { type PackageCodePageProps } from '~/types/pages' ;
1717import { buildCodeBrowserFileTree , getCodeBrowserFilePath } from '~/util/codeBrowser' ;
1818import { TimeRange } from '~/util/datetime' ;
19+ import { formatBytes } from '~/util/formatBytes' ;
20+ import { pluralize } from '~/util/strings' ;
1921import tw from '~/util/tailwind' ;
2022
2123export default function PackageCodeScene ( { apiData, packageName } : PackageCodePageProps ) {
@@ -70,6 +72,11 @@ export default function PackageCodeScene({ apiData, packageName }: PackageCodePa
7072 [ filteredFiles , data ?. prefix ]
7173 ) ;
7274
75+ const totalFilesSize = useMemo (
76+ ( ) => filteredFiles . reduce ( ( total , file ) => total + ( file . size ?? 0 ) , 0 ) ,
77+ [ filteredFiles ]
78+ ) ;
79+
7380 if ( ! library ) {
7481 return < NotFound /> ;
7582 }
@@ -147,19 +154,37 @@ export default function PackageCodeScene({ apiData, packageName }: PackageCodePa
147154 ? tw `h-[320px] flex-grow-0 border-b`
148155 : tw `w-[320px] flex-grow border-r` ,
149156 ] }
150- contentContainerStyle = { tw `flex-0 py -2` } >
157+ contentContainerStyle = { tw `pt -2` } >
151158 { filteredFiles . length > 0 ? (
152- < CodeBrowserFileTree
153- tree = { fileTree }
154- activeFile = { activeFile }
155- onSelectFile = { setActiveFile }
156- />
159+ < >
160+ < CodeBrowserFileTree
161+ tree = { fileTree }
162+ activeFile = { activeFile }
163+ onSelectFile = { setActiveFile }
164+ />
165+ < View style = { tw `h-2` } />
166+ </ >
157167 ) : (
158168 < View style = { tw `px-3 py-2` } >
159169 < Label style = { tw `text-center` } > No files match this search.</ Label >
160170 </ View >
161171 ) }
162172 </ ScrollView >
173+ { filteredFiles . length > 0 && (
174+ < View
175+ style = { [
176+ tw `relative flex min-h-[26px] flex-row items-center justify-between gap-3 border-r border-t border-palette-gray2 bg-default px-3 pb-px dark:border-default` ,
177+ isSmallScreen && tw `border-r-0` ,
178+ ] } >
179+ < Label style = { tw `font-light text-secondary` } >
180+ < span style = { tw `font-medium` } > { filteredFiles . length } </ span > { ' ' }
181+ { pluralize ( 'file' , filteredFiles . length ) }
182+ </ Label >
183+ < Label style = { tw `font-light text-secondary` } >
184+ < span style = { tw `font-medium` } > { formatBytes ( totalFilesSize ) } </ span >
185+ </ Label >
186+ </ View >
187+ ) }
163188 </ View >
164189 < View
165190 style = { [
0 commit comments