'use client'; import { useState, useEffect } from 'react'; import { getCheatsheets } from '@/lib/actions/cheatsheetActions'; import { BookOpen, Copy, Check, Loader2 } from 'lucide-react'; export default function CheatsheetsPage() { const [copiedItem, setCopiedItem] = useState(null); const [cheatsheets, setCheatsheets] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { async function loadData() { setLoading(true); const res = await getCheatsheets(); setCheatsheets(res); setLoading(false); } loadData(); }, []); const handleCopyCommand = async (command: string) => { try { await navigator.clipboard.writeText(command); setCopiedItem(command); setTimeout(() => setCopiedItem(null), 2000); } catch (err) { console.error(err); } }; return (
{/* Page Header */}
Quick Reference Cheatsheets

Developer Cheatsheets & Essential Commands

Copy Git, Next.js, Docker, and Python commands in one click directly from ayris.tech developer reference guides.

{/* Cheatsheets List */} {loading ? (
Loading cheatsheets...
) : (
{cheatsheets.map((sheet) => (
{sheet.category}

{sheet.title}

Updated: {new Date(sheet.lastUpdated).toLocaleDateString()}

{sheet.description}

{/* Items */}
{sheet.items?.map((item: any, idx: number) => (
{item.command}

{item.description}

))}
))}
)}
); }