Skip to content

Commit 7c33268

Browse files
feat(explorer): remove grid view option, and remove FileActions as it's not needed anymore
1 parent 36ab629 commit 7c33268

File tree

6 files changed

+4
-209
lines changed

6 files changed

+4
-209
lines changed

src/app/[...rest]/page.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { getFileType } from "@/lib/previewHelper";
99
import { formatPathToBreadcrumb } from "@/lib/utils";
1010

1111
import {
12-
FileActions,
1312
FileBreadcrumb,
1413
FileExplorerLayout,
1514
FileReadme,
@@ -108,7 +107,6 @@ export default async function RestPage({ params }: Props) {
108107
<div className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform">
109108
<CardTitle>Browse files</CardTitle>
110109
</div>
111-
<FileActions />
112110
</div>
113111
</CardHeader>
114112

src/app/page.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import config from "@/config/gIndex.config";
88
import { cn } from "@/lib/utils";
99

1010
import {
11-
FileActions,
1211
FileBreadcrumb,
1312
FileExplorerLayout,
1413
FileReadme,
@@ -56,14 +55,6 @@ interface ReadmeData {
5655
};
5756
}
5857

59-
// Fallback components for Suspense
60-
const FileActionsFallback = () => (
61-
<div className="flex items-center gap-2">
62-
<Skeleton className="h-10 w-16" />
63-
<Skeleton className="h-10 w-10" />
64-
</div>
65-
);
66-
6758
const FileReadmeFallback = () => (
6859
<Card>
6960
<CardHeader>
@@ -330,11 +321,6 @@ export default function RootPage() {
330321
{(data as FileData).data?.files?.length || 0} items
331322
</Badge>
332323
</div>
333-
<div className="flex items-center gap-2">
334-
<Suspense fallback={<FileActionsFallback />}>
335-
<FileActions />
336-
</Suspense>
337-
</div>
338324
</div>
339325
</CardHeader>
340326

src/components/explorer/FileActions.tsx

Lines changed: 0 additions & 97 deletions
This file was deleted.

src/components/explorer/FileItem.tsx

Lines changed: 2 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { bytesToReadable, durationToReadable, formatDate } from "@/lib/utils";
1616
import useRouter from "@/hooks/usePRouter";
1717

1818
import { Button } from "@/components/ui/button";
19-
import { Card, CardHeader, CardTitle } from "@/components/ui/card";
2019
import {
2120
ContextMenu,
2221
ContextMenuContent,
@@ -38,7 +37,6 @@ import {
3837
DropdownMenuTrigger,
3938
} from "@/components/ui/dropdown-menu";
4039
import Icon, { type IconName } from "@/components/ui/icon";
41-
import Image from "next/image";
4240

4341
// import { GetMostRecentFileUpdate } from "@/actions/folder";
4442

@@ -320,7 +318,7 @@ const FileItemActions = ({
320318
// =================================================================================================
321319
// MAIN FILE ITEM COMPONENT
322320
// =================================================================================================
323-
export const FileItem = ({ data: file, layout }: Props) => {
321+
export const FileItem = ({ data: file }: Props) => {
324322
const router = useRouter();
325323
const pathname = usePathname();
326324
const [isInfoModalOpen, setInfoModalOpen] = useState(false);
@@ -371,85 +369,6 @@ export const FileItem = ({ data: file, layout }: Props) => {
371369
isFolder,
372370
};
373371

374-
const renderGridItem = () => (
375-
<Card
376-
className="group relative cursor-pointer overflow-hidden transition-all duration-200 hover:shadow-sm"
377-
onClick={handleClick}
378-
>
379-
<div className="relative flex h-32 w-full items-center justify-center bg-muted/30">
380-
{file.thumbnailLink && file.mimeType.includes("image") ? (
381-
<Image
382-
src={`/api/thumb/${file.encryptedId}`}
383-
alt={file.name}
384-
className="h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"
385-
width={128}
386-
height={128}
387-
/>
388-
) : (
389-
<div className="flex flex-col items-center justify-center">
390-
<div
391-
className="flex items-center justify-center w-16 h-16 rounded-xl mb-2 shadow-sm"
392-
style={{
393-
backgroundColor: `${fileColor}15`,
394-
border: `2px solid ${fileColor}20`,
395-
}}
396-
>
397-
<Icon
398-
name={fileIcon}
399-
className="h-8 w-8 transition-colors"
400-
style={{ color: fileColor }}
401-
/>
402-
</div>
403-
{file.fileExtension && (
404-
<div
405-
className="mt-1 px-2 py-1 rounded text-xs font-mono border transition-colors"
406-
style={{
407-
backgroundColor: `${fileColor}10`,
408-
borderColor: `${fileColor}30`,
409-
color: fileColor,
410-
}}
411-
>
412-
{file.fileExtension.toUpperCase()}
413-
</div>
414-
)}
415-
</div>
416-
)}
417-
<div className="absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity">
418-
<FileItemActions {...actionProps} />
419-
</div>
420-
</div>
421-
<CardHeader className="p-3">
422-
<CardTitle className="line-clamp-2 text-sm font-medium mb-2">
423-
{file.name}
424-
</CardTitle>
425-
<div className="flex items-center justify-between text-xs text-muted-foreground">
426-
<span className="font-mono flex items-center gap-1">
427-
{isFolder ? (
428-
<>
429-
<div
430-
className="w-2 h-2 rounded-full"
431-
style={{ backgroundColor: fileColor }}
432-
></div>
433-
<span>DIR</span>
434-
</>
435-
) : (
436-
<>
437-
<div
438-
className="w-2 h-2 rounded-full"
439-
style={{ backgroundColor: fileColor }}
440-
></div>
441-
<span>{bytesToReadable(file.size ?? 0)}</span>
442-
</>
443-
)}
444-
</span>
445-
<span className="font-mono">
446-
{formatDate(file.modifiedTime).split(" ")[0]}
447-
</span>
448-
</div>
449-
</CardHeader>
450-
</Card>
451-
);
452-
453372
const renderListItem = () => (
454373
<div
455374
className="group flex cursor-pointer items-center gap-4 border-b border-border/30 p-3 transition-all duration-150 hover:bg-muted/30"
@@ -513,9 +432,7 @@ export const FileItem = ({ data: file, layout }: Props) => {
513432
return (
514433
<>
515434
<ContextMenu>
516-
<ContextMenuTrigger>
517-
{layout === "grid" ? renderGridItem() : renderListItem()}
518-
</ContextMenuTrigger>
435+
<ContextMenuTrigger>{renderListItem()}</ContextMenuTrigger>
519436
<ContextMenuContent className="w-48">
520437
<ContextMenuItem onSelect={actionProps.onOpen}>
521438
<Icon name="ArrowRight" className="mr-2 h-4 w-4" />

src/components/explorer/FileLayout.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import { type z } from "zod";
99

1010
import { type Schema_File } from "@/types/schema";
1111

12-
import { cn } from "@/lib/utils";
13-
1412
import useLoading from "@/hooks/useLoading";
1513

1614
import { FileItem } from "@/components/explorer";
@@ -137,14 +135,8 @@ const FileExplorerLayout = React.memo(
137135
</div>
138136
)}
139137

140-
{/* Files Grid/List */}
141-
<div
142-
className={cn(
143-
layout === "list"
144-
? "flex flex-col"
145-
: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4"
146-
)}
147-
>
138+
{/* Files List */}
139+
<div className="flex flex-col">
148140
{filesList.map((file) => (
149141
<div key={file.encryptedId}>
150142
<FileItem data={file} layout={layout} />

src/components/explorer/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ export { default as FileExplorerLayout } from "./FileLayout";
66
export { default as FileBreadcrumb } from "./FileBreadcrumbs";
77

88
// Lazy loaded components for better performance
9-
export const FileActions = lazy(() => import("./FileActions"));
109
export const FileReadme = lazy(() => import("./FileReadme"));

0 commit comments

Comments
 (0)