"use client" import { useState } from "react" import { AdminShell } from "@/components/admin/admin-shell" import { StackForm } from "@/components/admin/stack-form" import { useDataStore } from "@/lib/data-store" import type { StackCategory } from "@/lib/types" import { Button } from "@/components/ui/button" import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog" import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@/components/ui/alert-dialog" import { Plus, Pencil, Trash2, Terminal, Layers } from "lucide-react" export default function StackPage() { const { stackCategories, addStackCategory, updateStackCategory, deleteStackCategory } = useDataStore() const [isFormOpen, setIsFormOpen] = useState(false) const [editingCategory, setEditingCategory] = useState(null) const [deletingCategory, setDeletingCategory] = useState(null) const handleCreate = () => { setEditingCategory(null) setIsFormOpen(true) } const handleEdit = (category: StackCategory) => { setEditingCategory(category) setIsFormOpen(true) } const handleSubmit = (data: Omit) => { if (editingCategory) { updateStackCategory(editingCategory.id, data) } else { addStackCategory(data) } setIsFormOpen(false) setEditingCategory(null) } const handleDelete = () => { if (deletingCategory) { deleteStackCategory(deletingCategory.id) setDeletingCategory(null) } } const totalItems = stackCategories.reduce((acc, cat) => acc + cat.items.length, 0) return (
{/* Header */}

Tech Stack

$ atticl stack --list ({stackCategories.length} categories,{" "} {totalItems} items)

{/* Categories grid */}
{stackCategories.map((category) => (

{category.title}

    {category.items.map((item) => (
  • {item}
  • ))}

{category.items.length} {category.items.length === 1 ? "item" : "items"}

))}
{stackCategories.length === 0 && (

No tech stack categories yet.

)} {/* Form dialog */} {editingCategory ? "Edit Category" : "New Category"} setIsFormOpen(false)} /> {/* Delete confirmation */} setDeletingCategory(null)}> Delete Category Are you sure you want to delete the "{deletingCategory?.title}" category? This will remove all{" "} {deletingCategory?.items.length} technologies in it. Cancel Delete
) }