feat: enhance user limits

This commit is contained in:
gosangam
2026-06-23 14:21:59 +05:30
parent f92b41384e
commit 7b81bbc791
4 changed files with 27 additions and 11 deletions
+3 -4
View File
@@ -8,9 +8,6 @@ import { useAuth } from "@/components/auth/auth-provider";
import { appendHighlight, hasHighlight } from "@/lib/text-highlight";
import { displaySourceLabel } from "@/lib/source-reference";
const FREE_LIMIT = 1;
const PREMIUM_LIMIT = 5;
export default function MyBookmarksPage() {
const { user } = useAuth();
const [list, setList] = useState<Bookmark[]>([]);
@@ -40,7 +37,9 @@ export default function MyBookmarksPage() {
}
}
const limit = user?.role === "admin" || user?.plan === "premium" ? PREMIUM_LIMIT : FREE_LIMIT;
// Effective cap from the server (plan default merged with any admin
// override). -1 would mean unlimited (bookmarks aren't, today).
const limit = user?.limits?.bookmarks ?? 1;
if (loading) return <p className="text-sm text-muted-foreground">Loading…</p>;