|
| 1 | +// Admin Events Page - src/app/events/page.tsx |
1 | 2 | "use client"; |
2 | 3 |
|
3 | 4 | import { useState, useEffect } from "react"; |
@@ -46,28 +47,33 @@ export default function AdminEventsPage() { |
46 | 47 | </tr> |
47 | 48 | </thead> |
48 | 49 | <tbody> |
49 | | - {events.map((e: Event) => ( |
50 | | - <tr key={e.id} className="border-t"> |
51 | | - <td className="p-2">{e.title}</td> |
52 | | - <td className="p-2">{e.venue}</td> |
53 | | - <td className="p-2">{new Date(e.date).toLocaleDateString()}</td> |
54 | | - <td className="p-2 flex gap-2"> |
55 | | - <button |
56 | | - onClick={() => router.push(`/events/${e.id}/edit`)} |
57 | | - className="p-1 bg-yellow-300 rounded" |
58 | | - > |
59 | | - <Pencil className="w-4 h-4" /> |
60 | | - </button> |
61 | | - <button |
62 | | - onClick={() => deleteEvent(e.id)} |
63 | | - className="p-1 bg-red-500 text-white rounded" |
64 | | - > |
65 | | - <Trash className="w-4 h-4" /> |
66 | | - </button> |
67 | | - </td> |
68 | | - </tr> |
69 | | - ))} |
70 | | - </tbody> |
| 50 | + {events.map((e: Event) => ( |
| 51 | + <tr |
| 52 | + key={e.id} |
| 53 | + className="border-t cursor-pointer hover:bg-gray-50" |
| 54 | + onClick={() => router.push(`/events/${e.id}`)} |
| 55 | + > |
| 56 | + <td className="p-2">{e.title}</td> |
| 57 | + <td className="p-2">{e.venue}</td> |
| 58 | + <td className="p-2">{new Date(e.date).toLocaleDateString()}</td> |
| 59 | + <td className="p-2 flex gap-2" onClick={(ev) => ev.stopPropagation()}> |
| 60 | + <button |
| 61 | + onClick={() => router.push(`/events/${e.id}/edit`)} |
| 62 | + className="p-1 bg-yellow-300 rounded" |
| 63 | + > |
| 64 | + <Pencil className="w-4 h-4" /> |
| 65 | + </button> |
| 66 | + <button |
| 67 | + onClick={() => deleteEvent(e.id)} |
| 68 | + className="p-1 bg-red-500 text-white rounded" |
| 69 | + > |
| 70 | + <Trash className="w-4 h-4" /> |
| 71 | + </button> |
| 72 | + </td> |
| 73 | + </tr> |
| 74 | + ))} |
| 75 | +</tbody> |
| 76 | + |
71 | 77 | </table> |
72 | 78 | </div> |
73 | 79 | ); |
|
0 commit comments