diff --git a/ApplicationsFormatted.tsx b/ApplicationsFormatted.tsx new file mode 100644 index 0000000..a165394 Binary files /dev/null and b/ApplicationsFormatted.tsx differ diff --git a/app/dashboard/applications/Applications.tsx b/app/dashboard/applications/Applications.tsx index 8d28083..84d7952 100644 --- a/app/dashboard/applications/Applications.tsx +++ b/app/dashboard/applications/Applications.tsx @@ -25,6 +25,8 @@ import { List, Pencil, Zap, + ViewIcon, + Grid3X3, } from "lucide-react"; import { Card, @@ -76,6 +78,12 @@ import { import { StatusIndicator } from "@/components/status-indicator"; import { Toaster } from "@/components/ui/sonner" import { toast } from "sonner" +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; interface Application { id: number; @@ -129,23 +137,42 @@ export default function Dashboard() { const savedLayout = Cookies.get("layoutPreference-app"); const savedItemsPerPage = Cookies.get("itemsPerPage-app"); const initialIsGridLayout = savedLayout === "grid"; - const defaultItemsPerPage = initialIsGridLayout ? 15 : 5; + const initialIsCompactLayout = savedLayout === "compact"; + const defaultItemsPerPage = initialIsGridLayout ? 15 : (initialIsCompactLayout ? 30 : 5); const initialItemsPerPage = savedItemsPerPage ? parseInt(savedItemsPerPage) : defaultItemsPerPage; const [isGridLayout, setIsGridLayout] = useState(initialIsGridLayout); + const [isCompactLayout, setIsCompactLayout] = useState(initialIsCompactLayout); const [itemsPerPage, setItemsPerPage] = useState(initialItemsPerPage); const customInputRef = useRef(null); const debounceTimerRef = useRef(null); - const toggleLayout = () => { - const newLayout = !isGridLayout; - setIsGridLayout(newLayout); - Cookies.set("layoutPreference-app", newLayout ? "grid" : "standard", { - expires: 365, - path: "/", - sameSite: "strict", - }); - // Don't automatically change itemsPerPage when layout changes + const toggleLayout = (layout: string) => { + if (layout === "standard") { + setIsGridLayout(false); + setIsCompactLayout(false); + Cookies.set("layoutPreference-app", "standard", { + expires: 365, + path: "/", + sameSite: "strict", + }); + } else if (layout === "grid") { + setIsGridLayout(true); + setIsCompactLayout(false); + Cookies.set("layoutPreference-app", "grid", { + expires: 365, + path: "/", + sameSite: "strict", + }); + } else if (layout === "compact") { + setIsGridLayout(false); + setIsCompactLayout(true); + Cookies.set("layoutPreference-app", "compact", { + expires: 365, + path: "/", + sameSite: "strict", + }); + } }; const handleItemsPerPageChange = (value: string) => { @@ -335,20 +362,30 @@ export default function Dashboard() {
Your Applications
- + + + + + + toggleLayout("standard")}> + List View + + toggleLayout("grid")}> + Grid View + + toggleLayout("compact")}> + Compact View + + + - setEditName(e.target.value) - } - /> -
-
- - -
-
- -