diff --git a/client/src/components/Home/MyFiles.tsx b/client/src/components/Home/MyFiles.tsx
index 170c777..275c286 100644
--- a/client/src/components/Home/MyFiles.tsx
+++ b/client/src/components/Home/MyFiles.tsx
@@ -44,6 +44,11 @@ import {
Play,
AlertCircle,
MoreVertical,
+ FileVideo,
+ FileAudio,
+ FileImage,
+ FileCode,
+ Check,
} from "lucide-react";
import { motion, AnimatePresence } from "framer-motion";
import { notify as toast } from "@/services/toastService";
@@ -1103,26 +1108,64 @@ formatFileSize
// ✅ Get file icon based on type
- function getFileIcon(type: string) {
- switch (type) {
- case "image":
- return ;
- case "application":
- return ;
- default:
- return ;
- }
+ function getFileIcon(type: string, fileName?: string) {
+ const ext = fileName?.split(".").pop()?.toLowerCase();
+
+ // Check by extension first for specificity
+ if (ext === "pdf") return ;
+ if (["doc", "docx"].includes(ext || "")) return ;
+ if (["xls", "xlsx"].includes(ext || "")) return ;
+ if (["ppt", "pptx"].includes(ext || "")) return ;
+ if (["txt", "md", "csv"].includes(ext || "")) return ;
+ if (["html", "css", "js", "ts", "jsx", "tsx", "json"].includes(ext || "")) return ;
+ if (["mp3", "wav", "ogg", "flac", "aac"].includes(ext || "")) return ;
+ if (["mp4", "mov", "avi", "mkv", "webm"].includes(ext || "")) return ;
+ if (["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp"].includes(ext || "")) return ;
+
+ // Fallback to MIME type category
+ switch (type) {
+ case "image":
+ return ;
+ case "video":
+ return ;
+ case "audio":
+ return ;
+ case "text":
+ return ;
+ case "application":
+ return ;
+ default:
+ return ;
}
+ }
// ✅ Get file type color
- const getFileTypeColor = (type: string) => {
+ const getFileTypeColor = (type: string, fileName?: string) => {
+ const ext = fileName?.split(".").pop()?.toLowerCase();
+
+ // Specific extension colors
+ if (ext === "pdf") return "#e74c3c";
+ if (["doc", "docx"].includes(ext || "")) return "#2980b9";
+ if (["xls", "xlsx"].includes(ext || "")) return "#27ae60";
+ if (["ppt", "pptx"].includes(ext || "")) return "#e67e22";
+ if (["txt", "md", "csv"].includes(ext || "")) return "#95a5a6";
+ if (["html", "css", "js", "ts", "jsx", "tsx", "json"].includes(ext || "")) return "#f39c12";
+ if (["mp3", "wav", "ogg", "flac", "aac"].includes(ext || "")) return "#9b59b6";
+ if (["mp4", "mov", "avi", "mkv", "webm"].includes(ext || "")) return "#e74c3c";
+ if (["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp"].includes(ext || "")) return "#3498db";
+
+ // Fallback to MIME type category
switch (type) {
case "image":
return "#3498db";
- case "application":
- return "#2ecc71";
case "video":
return "#e74c3c";
+ case "audio":
+ return "#9b59b6";
+ case "text":
+ return "#95a5a6";
+ case "application":
+ return "#2ecc71";
default:
return "#9b59b6";
}
@@ -1787,11 +1830,11 @@ formatFileSize
-
- {getFileIcon(file.type)}
+
+ {getFileIcon(file.type, file.name)}
)}
@@ -1885,11 +1928,11 @@ formatFileSize
-
- {getFileIcon(file.type)}
+
+ {getFileIcon(file.type, file.name)}
@@ -2084,11 +2127,11 @@ formatFileSize
-
- {getFileIcon(file.type)}
+
+ {getFileIcon(file.type, file.name)}
@@ -2144,8 +2187,8 @@ formatFileSize
{file.type.toUpperCase()}
@@ -2337,11 +2380,11 @@ formatFileSize
-
- {getFileIcon(file.type)}
+
+ {getFileIcon(file.type, file.name)}