init: kovakemlak-crm project scaffold
- Next.js 16 + Appwrite multi-tenant emlak CRM - Database: kovakemlak-db (properties, customers, customer_searches, property_matches, presentations, investors, activities, tenant_settings) - Same stack as isletmem-kovakcrm (shadcn/ui template base) - Modules: portföy, müşteri takibi, arama kriterleri, otomatik eşleştirme, sunum linki, yatırımcı portalı
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { Crown } from "lucide-react";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog";
|
||||
|
||||
type Props = {
|
||||
open: boolean;
|
||||
onOpenChange: (v: boolean) => void;
|
||||
message?: string;
|
||||
};
|
||||
|
||||
export function PlanLimitDialog({ open, onOpenChange, message }: Props) {
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent>
|
||||
<DialogHeader>
|
||||
<DialogTitle className="flex items-center gap-2">
|
||||
<Crown className="size-5 text-amber-500" />
|
||||
Ücretsiz plan sınırına ulaştınız
|
||||
</DialogTitle>
|
||||
<DialogDescription>
|
||||
{message ?? "Yeni kayıt eklemek için Pro plana geçmeniz gerekiyor."}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div className="rounded-md border bg-muted/30 p-3 text-sm space-y-1">
|
||||
<div className="font-medium text-foreground">Pro plan ile gelen avantajlar</div>
|
||||
<ul className="text-muted-foreground space-y-0.5 list-disc list-inside">
|
||||
<li>Sınırsız müşteri, finans kaydı, yazılım</li>
|
||||
<li>Sınırsız ekip üyesi</li>
|
||||
<li>Audit log + öncelikli destek</li>
|
||||
</ul>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<Button variant="outline" onClick={() => onOpenChange(false)}>
|
||||
Kapat
|
||||
</Button>
|
||||
<Button asChild>
|
||||
<Link href="/settings/billing">
|
||||
<Crown className="size-4" />
|
||||
Pro'ya geç
|
||||
</Link>
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
import Link from "next/link";
|
||||
import { AlertTriangle, Crown } from "lucide-react";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import {
|
||||
RESOURCE_LABELS,
|
||||
type PlanResource,
|
||||
type PlanUsage,
|
||||
} from "@/lib/appwrite/plan-limits";
|
||||
|
||||
const SOFT_THRESHOLD = 0.8;
|
||||
|
||||
export function UsageBanner({
|
||||
usage,
|
||||
resource,
|
||||
}: {
|
||||
usage: PlanUsage;
|
||||
resource: PlanResource;
|
||||
}) {
|
||||
if (usage.plan === "pro") return null;
|
||||
|
||||
const u = usage.usage[resource];
|
||||
if (u.limit === Number.POSITIVE_INFINITY) return null;
|
||||
|
||||
const ratio = u.used / u.limit;
|
||||
if (ratio < SOFT_THRESHOLD) return null;
|
||||
|
||||
const label = RESOURCE_LABELS[resource];
|
||||
const reached = u.reached;
|
||||
|
||||
return (
|
||||
<Card
|
||||
className={
|
||||
reached
|
||||
? "border-destructive/40 bg-destructive/5"
|
||||
: "border-amber-500/40 bg-amber-500/5"
|
||||
}
|
||||
>
|
||||
<CardContent className="flex flex-col gap-3 py-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="flex items-start gap-2 text-sm">
|
||||
<AlertTriangle
|
||||
className={`size-4 mt-0.5 shrink-0 ${
|
||||
reached ? "text-destructive" : "text-amber-600"
|
||||
}`}
|
||||
/>
|
||||
<div>
|
||||
<span className="font-medium">
|
||||
{reached ? "Sınıra ulaşıldı" : "Sınıra yaklaşıyorsun"}:
|
||||
</span>{" "}
|
||||
<span className="text-muted-foreground">
|
||||
{u.used} / {u.limit} {label}.
|
||||
</span>
|
||||
{reached && (
|
||||
<span className="text-muted-foreground"> Yeni {label} eklemek için Pro'ya geç.</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<Button asChild size="sm" variant={reached ? "default" : "outline"}>
|
||||
<Link href="/settings/billing">
|
||||
<Crown className="size-3.5" />
|
||||
Pro'ya geç
|
||||
</Link>
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user