@@ -40,7 +40,7 @@ function PdfViewer({ path, onClose }: { path: string; onClose: () => void }) {
4040 return (
4141 < div className = "flex flex-col h-full" >
4242 < div className = "flex items-center justify-between px-3 py-2 bg-[#16162a] border-b border-gray-700 shrink-0" >
43- < span className = "text-sm text-gray-300 truncate " > { path } </ span >
43+ < span className = "text-sm text-gray-300 overflow-x-auto scrollbar-none whitespace-nowrap min-w-0 flex-1 select-all " > { path } </ span >
4444 < div className = "flex items-center gap-2" >
4545 < div className = "flex items-center gap-1 border border-gray-700 rounded overflow-hidden" >
4646 < button onClick = { zoomOut } className = "px-2 py-0.5 text-xs text-gray-400 hover:text-white hover:bg-gray-700" > -</ button >
@@ -56,35 +56,33 @@ function PdfViewer({ path, onClose }: { path: string; onClose: () => void }) {
5656 </ a >
5757 < button
5858 onClick = { onClose }
59- className = "p-1 text-gray-400 hover:text-white transition-colors"
59+ className = "p-1 bg-gray-700 hover:bg-gray-600 text-gray-300 hover:text-white rounded transition-colors"
6060 title = "Close"
6161 >
62- < svg className = "w-4 h-4 " fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" > < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M6 18L18 6M6 6l12 12" /> </ svg >
62+ < svg className = "w-3.5 h-3.5 " fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" > < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M6 18L18 6M6 6l12 12" /> </ svg >
6363 </ button >
6464 </ div >
6565 </ div >
6666 < div
67- className = "flex-1 min-h-0 overflow-auto relative "
67+ className = "flex-1 min-h-0 overflow-auto bg-[#0d0d1a] flex items-center justify-center "
6868 onTouchMove = { handleTouchMove }
6969 onTouchEnd = { handleTouchEnd }
7070 >
71- { /* Spacer div sized to the scaled iframe dimensions so scrolling works */ }
72- < div style = { { width : `${ 100 * zoom } %` , height : `${ 100 * zoom } %` , pointerEvents : "none" } } />
73- { /* Iframe scaled from top-left, positioned absolutely */ }
74- < iframe
75- src = { `/api/files/download?path=${ encodeURIComponent ( path ) } &inline=1` }
76- title = { path }
71+ < div
7772 style = { {
78- position : "absolute" ,
79- top : 0 ,
80- left : 0 ,
81- width : `${ 100 / zoom } %` ,
82- height : `${ 100 / zoom } %` ,
83- border : "none" ,
84- transform : `scale(${ zoom } )` ,
85- transformOrigin : "top left" ,
73+ width : zoom <= 1 ? `${ zoom * 100 } %` : `${ zoom * 100 } %` ,
74+ height : zoom <= 1 ? `${ zoom * 100 } %` : `${ zoom * 100 } %` ,
75+ minWidth : zoom > 1 ? `${ zoom * 100 } %` : undefined ,
76+ minHeight : zoom > 1 ? `${ zoom * 100 } %` : undefined ,
77+ flexShrink : 0 ,
8678 } }
87- />
79+ >
80+ < iframe
81+ src = { `/api/files/download?path=${ encodeURIComponent ( path ) } &inline=1` }
82+ title = { path }
83+ className = "w-full h-full border-0"
84+ />
85+ </ div >
8886 </ div >
8987 </ div >
9088 ) ;
@@ -109,7 +107,7 @@ export default function FileViewer({ path, content, onSave, onClose }: FileViewe
109107 return (
110108 < div className = "flex flex-col h-full" >
111109 < div className = "flex items-center justify-between px-3 py-2 bg-[#16162a] border-b border-gray-700 shrink-0" >
112- < span className = "text-sm text-gray-300 truncate " > { path } </ span >
110+ < span className = "text-sm text-gray-300 overflow-x-auto scrollbar-none whitespace-nowrap min-w-0 flex-1 select-all " > { path } </ span >
113111 < div className = "flex items-center gap-2" >
114112 < a
115113 href = { `/api/files/download?path=${ encodeURIComponent ( path ) } ` }
@@ -120,10 +118,10 @@ export default function FileViewer({ path, content, onSave, onClose }: FileViewe
120118 </ a >
121119 < button
122120 onClick = { onClose }
123- className = "p-1 text-gray-400 hover:text-white transition-colors"
121+ className = "p-1 bg-gray-700 hover:bg-gray-600 text-gray-300 hover:text-white rounded transition-colors"
124122 title = "Close"
125123 >
126- < svg className = "w-4 h-4 " fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" > < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M6 18L18 6M6 6l12 12" /> </ svg >
124+ < svg className = "w-3.5 h-3.5 " fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" > < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M6 18L18 6M6 6l12 12" /> </ svg >
127125 </ button >
128126 </ div >
129127 </ div >
0 commit comments