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
+5 -2
View File
@@ -73,8 +73,11 @@ export function TextSelectionToolbar() {
};
}, [user]);
const bookmarkLimit = user?.plan === "premium" ? 5 : 1;
const limitReached = !!user && bookmarkCount >= bookmarkLimit;
// Effective bookmark cap from the server (plan default merged with any admin
// override). -1 would mean unlimited (never reached).
const bookmarkLimit = user?.limits?.bookmarks ?? 1;
const limitReached =
!!user && bookmarkLimit >= 0 && bookmarkCount >= bookmarkLimit;
// Track whether the user is interacting with our toolbar/popovers
const interactingRef = useRef(false);