feat: enhance user limits
This commit is contained in:
@@ -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>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user