Skip to content

Commit

Permalink
fixed layout to match across miller and grid layout
Browse files Browse the repository at this point in the history
  • Loading branch information
visnkmr committed Mar 27, 2024
1 parent e84bd6b commit 8716944
Show file tree
Hide file tree
Showing 7 changed files with 226 additions and 291 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "filedime",
"version": "0.9.52",
"version": "0.9.53",
"private": true,
"engines": {
"node": "20.x"
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "filedime"
version = "0.9.52"
version = "0.9.53"
description = "rust based file explorer."
authors = ["visnk"]
license = ""
Expand Down
3 changes: 1 addition & 2 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"withGlobalTauri": true
},
"package": {
"productName": "filedime",
"version": "0.9.52"
"productName": "filedime"
},
"tauri": {
"allowlist": {
Expand Down
160 changes: 3 additions & 157 deletions src/components/greet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ import { ToastAction } from "./ui/toast";
import Link from "next/link";
import MillerCol from "./millercol";
import GPTchatinterface from "./gptchatinterface";
let supportedfiles = [
import EachFromGrid from "./grideach";
export let supportedfiles = [
"csv",
"xlsx",
"xls",
Expand Down Expand Up @@ -2080,162 +2081,7 @@ export default function Greet() {
.slice(currentpage*perpage,((currentpage)+1)*perpage)
.map((message, index) => (
<div key={index} className="m-3 flex flex-row">
<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">

<ContextMenu >
<ContextMenuTrigger className="h-full w-full overflow-hidden">
<HoverCard >
<HoverCardTrigger className="h-full w-full">
<span className="flex justify-items-center w-full h-full p-6 overflow-hidden" onDoubleClick={
()=>
{
goto(message)
}
}>
<div className="w-full">
<div className={`w-full ${showthumbnail?"":"hidden"}`}>
{![...IMAGE_TYPES,...VIDEO_TYPES].some(type => message.name.includes(type))?<div
className={`flex bg-gray-200 dark:bg-slate-500 w-full place-items-center h-[200px] overflow-${scrollorauto}`}
></div>:""}
{IMAGE_TYPES.some(type => message.name.includes(type))?(
<div
className={`flex bg-gray-200 dark:bg-slate-500 w-full place-items-center h-[200px] overflow-${scrollorauto}`}
>
<LazyLoadImage
className="w-full object-fill"
src={`${convertFileSrc(message.path)}`}/></div>

):""}
{VIDEO_TYPES.some(type => message.name.includes(type))?(
<VideoComponent path={message.path} hoverplay={true}/>):""}
</div>
<div className="flex flex-row justify-start gap-3 items-center">

<div className="overflow-visible">

{message.is_dir?<Folder className="h-6 w-6" />:<FileIcon className="h-6 w-6" />}
</div>
<div className="w-full flex justify-between overflow-hidden">

<span className="font-medium text-lg overflow-hidden">{message.name}{message.foldercon>0 ? "(" + message.foldercon + ")" : ""}</span>

</div>
</div>
</div>
</span>

</HoverCardTrigger>
<HoverCardContent className={`${setcolorpertheme} flex flex-col text-center`} >
{message.name}
<br/>
{message.path}
<br/>
{`${message.foldercon>0?`Contains ${message.foldercon} ${message.is_dir?"files":"lines"}`:""}`}
<br/>
{converttstodt(message.timestamp)}
<FRc location={message.path} size={message.size} rawsize={message.rawfs}/>
<br/>
{<button onClick={()=>{
let fi:FileItem={
name: "",
path: message.parent,
is_dir: true,
size: 0,
rawfs: 0,
lmdate: 0,
timestamp: 0,
foldercon: 0,
ftype: "",
parent: "",
}
goto(fi)
}}>Open file location</button>}
</HoverCardContent>
</HoverCard>


</ContextMenuTrigger>
<ContextMenuContent className=''>
<p className='text-sm'>{message.path}</p>
<ContextMenuItem onSelect={(e)=>{
invoke("newwindow",
{
path: message.path,
ff:""
});

}}>Open in new window</ContextMenuItem>
<ContextMenuItem onSelect={(e)=>{
newtab(message.path)
}}>Open in new tab</ContextMenuItem>
<ContextMenuItem onSelect={()=>{
invoke(
"addmark",
{
windowname:appWindow?.label,
path: message.path,
id:new Date().getTime().toString()
}
);
}}>Add bookmark</ContextMenuItem>
<ContextMenuItem onSelect={(e)=>{
useEffect(() => {
if (typeof window !== 'undefined'){

try {
navigator.clipboard.writeText(message.path);
console.log('Content copied to clipboard');
} catch (err) {
console.error('Failed to copy: ', err);
}
}
},[])}}
>Copy path to clipboard</ContextMenuItem>
<ContextMenuItem onSelect={(e)=>{
setfos((old)=>[...old,message.path])
}}>Copy</ContextMenuItem>
</ContextMenuContent>
</ContextMenu>
<div className="absolute end-0 ">

{!message.is_dir
// &&
// [...MARKDOWN_TYPES,...PLAIN_TEXT,...IMAGE_TYPES,...].some(type => message.path.includes(type))
// &&(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)))
?(
<Sheet modal={false}>
<SheetTrigger className="h-full px-3 p-4 focus:bg-gray-200 focus:dark:bg-gray-700">
<HoverCard>
<HoverCardTrigger>
<EyeIcon className="h-4 w-4 "/>
</HoverCardTrigger>
<HoverCardContent className={`${setcolorpertheme}`}>
Preview
</HoverCardContent>
</HoverCard>
</SheetTrigger>
<SheetContent
className={`${setcolorpertheme} h-[90%] overflow-hidden`} side={"right"} onPointerDownOutside={(e) => e.preventDefault()} onInteractOutside={(e) => e.preventDefault()}>
<ReadFileComp message={message}/>
</SheetContent>
</Sheet>):(
<div className="">
<HoverCard>

<HoverCardTrigger>
<Button className="h-full p-4 px-3 focus:bg-gray-200 focus:dark:bg-gray-700" size={"none"} variant={"ghost"} onClick={()=>{

populatesearchlist(message.path)
}}><ScanSearchIcon className="h-4 w-4"/></Button>
</HoverCardTrigger>
<HoverCardContent className={`${setcolorpertheme}`}>
Load folder contents to search
</HoverCardContent>
</HoverCard>
</div>
)}
</div>
</Button>
<EachFromGrid message={message} goto={goto} populatesearchlist={populatesearchlist} newtab={newtab} setfos={setfos} showthumbnail={showthumbnail} appWindow={appWindow}/>
</div>

))}
Expand Down
Loading

0 comments on commit 8716944

Please sign in to comment.