mirror of
https://github.com/EdiFarcas/Giveaway-app.git
synced 2026-06-22 07:00:57 +03:00
Update 1
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Giveaway" ADD COLUMN "entryCost" INTEGER NOT NULL DEFAULT 7000000;
|
||||
@@ -64,6 +64,7 @@ model Giveaway {
|
||||
prize String
|
||||
active Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
entryCost Int @default(7000000)
|
||||
entries Entry[]
|
||||
}
|
||||
|
||||
|
||||
+24
-14
@@ -1,23 +1,33 @@
|
||||
import { getServerSession } from "next-auth";
|
||||
import { authOptions } from "../api/auth/[...nextauth]/route";
|
||||
import { db } from "@/lib/db";
|
||||
import { redirect } from "next/navigation";
|
||||
import GiveawayCard from "@/components/GiveawayCard";
|
||||
|
||||
export default async function GiveawaysPage() {
|
||||
// Fetch giveaways from the database
|
||||
const giveaways = await db.giveaway.findMany({
|
||||
where: { active: true },
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
description: true,
|
||||
prize: true,
|
||||
},
|
||||
});
|
||||
|
||||
export default async function ProfilePage() {
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50 py-12 px-4 sm:px-6 lg:px-8">
|
||||
<div className="max-w-3xl mx-auto">
|
||||
<div className="bg-black rounded-2xl shadow-xl overflow-hidden">
|
||||
{/* Profile Header */}
|
||||
<div className="bg-gradient-to-r from-purple-600 to-blue-500 p-6">
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="h-16 w-16 bg-white rounded-full flex items-center justify-center">
|
||||
</div>
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold text-white">{"Giveaway page"}</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="max-w-7xl mx-auto">
|
||||
<h1 className="text-3xl font-bold text-gray-800 mb-8">Active Giveaways</h1>
|
||||
<div className="text-black grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{giveaways.map((giveaway) => (
|
||||
<GiveawayCard
|
||||
key={giveaway.id}
|
||||
title={giveaway.title}
|
||||
description={giveaway.description}
|
||||
imageUrl={giveaway.prize} // Assuming prize is a URL to an image
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,10 +8,12 @@ interface GiveawayCardProps {
|
||||
|
||||
const GiveawayCard: React.FC<GiveawayCardProps> = ({ title, description, imageUrl }) => {
|
||||
return (
|
||||
<div className="card">
|
||||
<img src={imageUrl} alt={title} className="card-image" />
|
||||
<h3>{title}</h3>
|
||||
<p>{description}</p>
|
||||
<div className="bg-white shadow-md rounded-lg overflow-hidden">
|
||||
<img src={imageUrl} alt={title} className="w-full h-48 object-cover" />
|
||||
<div className="p-4">
|
||||
<h3 className="text-lg font-bold mb-2">{title}</h3>
|
||||
<p className="text-gray-600 text-sm">{description}</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user