@@ -85,7 +85,8 @@ import { ToastAction } from "./ui/toast";
85
85
import Link from "next/link" ;
86
86
import MillerCol from "./millercol" ;
87
87
import GPTchatinterface from "./gptchatinterface" ;
88
- let supportedfiles = [
88
+ import EachFromGrid from "./grideach" ;
89
+ export let supportedfiles = [
89
90
"csv" ,
90
91
"xlsx" ,
91
92
"xls" ,
@@ -2080,162 +2081,7 @@ export default function Greet() {
2080
2081
. slice ( currentpage * perpage , ( ( currentpage ) + 1 ) * perpage )
2081
2082
. map ( ( message , index ) => (
2082
2083
< div key = { index } className = "m-3 flex flex-row" >
2083
- < Button size = { "none" } variant = { "outline" } className = "relative m-0 h-full w-full flex justify-start overflow-hidden focus:bg-gray-200 focus:dark:bg-gray-700" >
2084
-
2085
- < ContextMenu >
2086
- < ContextMenuTrigger className = "h-full w-full overflow-hidden" >
2087
- < HoverCard >
2088
- < HoverCardTrigger className = "h-full w-full" >
2089
- < span className = "flex justify-items-center w-full h-full p-6 overflow-hidden" onDoubleClick = {
2090
- ( ) =>
2091
- {
2092
- goto ( message )
2093
- }
2094
- } >
2095
- < div className = "w-full" >
2096
- < div className = { `w-full ${ showthumbnail ?"" :"hidden" } ` } >
2097
- { ! [ ...IMAGE_TYPES , ...VIDEO_TYPES ] . some ( type => message . name . includes ( type ) ) ?< div
2098
- className = { `flex bg-gray-200 dark:bg-slate-500 w-full place-items-center h-[200px] overflow-${ scrollorauto } ` }
2099
- > </ div > :"" }
2100
- { IMAGE_TYPES . some ( type => message . name . includes ( type ) ) ?(
2101
- < div
2102
- className = { `flex bg-gray-200 dark:bg-slate-500 w-full place-items-center h-[200px] overflow-${ scrollorauto } ` }
2103
- >
2104
- < LazyLoadImage
2105
- className = "w-full object-fill"
2106
- src = { `${ convertFileSrc ( message . path ) } ` } /> </ div >
2107
-
2108
- ) :"" }
2109
- { VIDEO_TYPES . some ( type => message . name . includes ( type ) ) ?(
2110
- < VideoComponent path = { message . path } hoverplay = { true } /> ) :"" }
2111
- </ div >
2112
- < div className = "flex flex-row justify-start gap-3 items-center" >
2113
-
2114
- < div className = "overflow-visible" >
2115
-
2116
- { message . is_dir ?< Folder className = "h-6 w-6" /> :< FileIcon className = "h-6 w-6" /> }
2117
- </ div >
2118
- < div className = "w-full flex justify-between overflow-hidden" >
2119
-
2120
- < span className = "font-medium text-lg overflow-hidden" > { message . name } { message . foldercon > 0 ? "(" + message . foldercon + ")" : "" } </ span >
2121
-
2122
- </ div >
2123
- </ div >
2124
- </ div >
2125
- </ span >
2126
-
2127
- </ HoverCardTrigger >
2128
- < HoverCardContent className = { `${ setcolorpertheme } flex flex-col text-center` } >
2129
- { message . name }
2130
- < br />
2131
- { message . path }
2132
- < br />
2133
- { `${ message . foldercon > 0 ?`Contains ${ message . foldercon } ${ message . is_dir ?"files" :"lines" } ` :"" } ` }
2134
- < br />
2135
- { converttstodt ( message . timestamp ) }
2136
- < FRc location = { message . path } size = { message . size } rawsize = { message . rawfs } />
2137
- < br />
2138
- { < button onClick = { ( ) => {
2139
- let fi :FileItem = {
2140
- name : "" ,
2141
- path : message . parent ,
2142
- is_dir : true ,
2143
- size : 0 ,
2144
- rawfs : 0 ,
2145
- lmdate : 0 ,
2146
- timestamp : 0 ,
2147
- foldercon : 0 ,
2148
- ftype : "" ,
2149
- parent : "" ,
2150
- }
2151
- goto ( fi )
2152
- } } > Open file location</ button > }
2153
- </ HoverCardContent >
2154
- </ HoverCard >
2155
-
2156
-
2157
- </ ContextMenuTrigger >
2158
- < ContextMenuContent className = '' >
2159
- < p className = 'text-sm' > { message . path } </ p >
2160
- < ContextMenuItem onSelect = { ( e ) => {
2161
- invoke ( "newwindow" ,
2162
- {
2163
- path : message . path ,
2164
- ff :""
2165
- } ) ;
2166
-
2167
- } } > Open in new window</ ContextMenuItem >
2168
- < ContextMenuItem onSelect = { ( e ) => {
2169
- newtab ( message . path )
2170
- } } > Open in new tab</ ContextMenuItem >
2171
- < ContextMenuItem onSelect = { ( ) => {
2172
- invoke (
2173
- "addmark" ,
2174
- {
2175
- windowname :appWindow ?. label ,
2176
- path : message . path ,
2177
- id :new Date ( ) . getTime ( ) . toString ( )
2178
- }
2179
- ) ;
2180
- } } > Add bookmark</ ContextMenuItem >
2181
- < ContextMenuItem onSelect = { ( e ) => {
2182
- useEffect ( ( ) => {
2183
- if ( typeof window !== 'undefined' ) {
2184
-
2185
- try {
2186
- navigator . clipboard . writeText ( message . path ) ;
2187
- console . log ( 'Content copied to clipboard' ) ;
2188
- } catch ( err ) {
2189
- console . error ( 'Failed to copy: ' , err ) ;
2190
- }
2191
- }
2192
- } , [ ] ) } }
2193
- > Copy path to clipboard</ ContextMenuItem >
2194
- < ContextMenuItem onSelect = { ( e ) => {
2195
- setfos ( ( old ) => [ ...old , message . path ] )
2196
- } } > Copy</ ContextMenuItem >
2197
- </ ContextMenuContent >
2198
- </ ContextMenu >
2199
- < div className = "absolute end-0 " >
2200
-
2201
- { ! message . is_dir
2202
- // &&
2203
- // [...MARKDOWN_TYPES,...PLAIN_TEXT,...IMAGE_TYPES,...].some(type => message.path.includes(type))
2204
- // &&(message.name.includes(".pdf")||IMAGE_TYPES.some(type => message.name.includes(type))||HTML_TYPE.some(type => message.name.includes(type))||AUDIO_TYPES.some(type => message.name.includes(type)))
2205
- ?(
2206
- < Sheet modal = { false } >
2207
- < SheetTrigger className = "h-full px-3 p-4 focus:bg-gray-200 focus:dark:bg-gray-700" >
2208
- < HoverCard >
2209
- < HoverCardTrigger >
2210
- < EyeIcon className = "h-4 w-4 " />
2211
- </ HoverCardTrigger >
2212
- < HoverCardContent className = { `${ setcolorpertheme } ` } >
2213
- Preview
2214
- </ HoverCardContent >
2215
- </ HoverCard >
2216
- </ SheetTrigger >
2217
- < SheetContent
2218
- className = { `${ setcolorpertheme } h-[90%] overflow-hidden` } side = { "right" } onPointerDownOutside = { ( e ) => e . preventDefault ( ) } onInteractOutside = { ( e ) => e . preventDefault ( ) } >
2219
- < ReadFileComp message = { message } />
2220
- </ SheetContent >
2221
- </ Sheet > ) :(
2222
- < div className = "" >
2223
- < HoverCard >
2224
-
2225
- < HoverCardTrigger >
2226
- < Button className = "h-full p-4 px-3 focus:bg-gray-200 focus:dark:bg-gray-700" size = { "none" } variant = { "ghost" } onClick = { ( ) => {
2227
-
2228
- populatesearchlist ( message . path )
2229
- } } > < ScanSearchIcon className = "h-4 w-4" /> </ Button >
2230
- </ HoverCardTrigger >
2231
- < HoverCardContent className = { `${ setcolorpertheme } ` } >
2232
- Load folder contents to search
2233
- </ HoverCardContent >
2234
- </ HoverCard >
2235
- </ div >
2236
- ) }
2237
- </ div >
2238
- </ Button >
2084
+ < EachFromGrid message = { message } goto = { goto } populatesearchlist = { populatesearchlist } newtab = { newtab } setfos = { setfos } showthumbnail = { showthumbnail } appWindow = { appWindow } />
2239
2085
</ div >
2240
2086
2241
2087
) ) }
0 commit comments