Initial commit: WaMarket MVP

Marketplace inversée (Next.js 16 App Router + Supabase Cloud) : auth,
schéma + RLS, publication de besoins avec upload d'images, feed avec
filtres, offres, acceptation via RPC, messagerie temps réel,
dashboards, et Dockerfile pour déploiement Coolify.
This commit is contained in:
2026-07-30 14:33:17 +00:00
commit af81124d48
82 changed files with 16824 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
import { verifySession } from "@/lib/dal";
export default async function DashboardLayout({
children,
}: {
children: React.ReactNode;
}) {
await verifySession();
return (
<main className="mx-auto max-w-5xl px-4 py-8 sm:px-6 sm:py-10">
{children}
</main>
);
}
+69
View File
@@ -0,0 +1,69 @@
import Link from "next/link";
import { verifySession } from "@/lib/dal";
import { createClient } from "@/lib/supabase/server";
import { Badge } from "@/components/ui/badge";
import { Card, CardContent } from "@/components/ui/card";
import { Button } from "@/components/ui/button";
const STATUS_LABEL: Record<string, string> = {
open: "Ouvert",
closed: "Fermé",
fulfilled: "Pourvu",
};
export default async function MyNeedsPage() {
const user = await verifySession();
const supabase = await createClient();
const { data: needs } = await supabase
.from("needs")
.select("id, title, city, status, created_at, categories(name)")
.eq("author_id", user.id)
.order("created_at", { ascending: false });
return (
<div>
<div className="flex items-center justify-between">
<h1 className="text-2xl font-semibold">Mes besoins</h1>
<Button asChild>
<Link href="/needs/new">Nouveau besoin</Link>
</Button>
</div>
{!needs || needs.length === 0 ? (
<p className="mt-6 text-muted-foreground">
Tu n&apos;as pas encore publié de besoin.
</p>
) : (
<div className="mt-6 flex flex-col gap-3">
{needs.map((need) => {
const category = Array.isArray(need.categories)
? need.categories[0]
: need.categories;
return (
<Link key={need.id} href={`/needs/${need.id}`}>
<Card className="transition-shadow hover:shadow-md">
<CardContent className="flex flex-col gap-2 py-4 sm:flex-row sm:items-center sm:justify-between">
<div className="min-w-0">
<p className="truncate font-medium">{need.title}</p>
<p className="text-sm text-muted-foreground">
{need.city}
{category?.name ? ` · ${category.name}` : ""}
</p>
</div>
<Badge
className="w-fit"
variant={need.status === "open" ? "default" : "outline"}
>
{STATUS_LABEL[need.status] ?? need.status}
</Badge>
</CardContent>
</Card>
</Link>
);
})}
</div>
)}
</div>
);
}
+65
View File
@@ -0,0 +1,65 @@
import Link from "next/link";
import { verifySession } from "@/lib/dal";
import { createClient } from "@/lib/supabase/server";
import { Badge } from "@/components/ui/badge";
import { Card, CardContent } from "@/components/ui/card";
const STATUS_LABEL: Record<string, string> = {
pending: "En attente",
accepted: "Acceptée",
rejected: "Refusée",
withdrawn: "Retirée",
};
export default async function MyOffersPage() {
const user = await verifySession();
const supabase = await createClient();
const { data: offers } = await supabase
.from("offers")
.select("id, title, price, status, created_at, need_id, needs(title, city)")
.eq("merchant_id", user.id)
.order("created_at", { ascending: false });
return (
<div>
<h1 className="text-2xl font-semibold">Mes offres</h1>
{!offers || offers.length === 0 ? (
<p className="mt-6 text-muted-foreground">
Tu n&apos;as pas encore envoyé d&apos;offre.
</p>
) : (
<div className="mt-6 flex flex-col gap-3">
{offers.map((offer) => {
const need = Array.isArray(offer.needs)
? offer.needs[0]
: offer.needs;
return (
<Link key={offer.id} href={`/needs/${offer.need_id}`}>
<Card className="transition-shadow hover:shadow-md">
<CardContent className="flex flex-col gap-2 py-4 sm:flex-row sm:items-center sm:justify-between">
<div className="min-w-0">
<p className="truncate font-medium">{offer.title}</p>
<p className="text-sm text-muted-foreground">
{need?.title} · {need?.city} · {offer.price}
</p>
</div>
<Badge
className="w-fit"
variant={
offer.status === "accepted" ? "default" : "outline"
}
>
{STATUS_LABEL[offer.status] ?? offer.status}
</Badge>
</CardContent>
</Card>
</Link>
);
})}
</div>
)}
</div>
);
}