diff --git a/src/routes/api/create-watchlist/+server.ts b/src/routes/api/create-watchlist/+server.ts index d4bf949c..c5454f04 100644 --- a/src/routes/api/create-watchlist/+server.ts +++ b/src/routes/api/create-watchlist/+server.ts @@ -6,7 +6,7 @@ export const POST: RequestHandler = async ({ request, locals }) => { let output; // For non-Pro users, ensure they can only have 1 watchlist. - if (user?.tier !== 'Pro') { + if (!['Pro','Plus']?.includes(user?.tier)) { // Get the current watchlists for the user. const existingWatchlists = await pb.collection("watchlist").getFullList({ filter: `user="${user.id}"` @@ -15,7 +15,7 @@ export const POST: RequestHandler = async ({ request, locals }) => { // If the user already has a watchlist, return an error response. if (existingWatchlists.length >= 1) { return new Response( - JSON.stringify({ error: "Non-Pro users can only have 1 watchlist" }), + JSON.stringify({ error: "Upgrade your account to unlock unlimited watchlists." }), { status: 403 } ); } diff --git a/src/routes/api/update-watchlist/+server.ts b/src/routes/api/update-watchlist/+server.ts index 8ddaf766..a0ce2e0d 100644 --- a/src/routes/api/update-watchlist/+server.ts +++ b/src/routes/api/update-watchlist/+server.ts @@ -11,9 +11,8 @@ export const POST = (async ({ request, locals }) => { let output; - // Determine the ticker limit: 50 for Pro users, 5 for non-Pro users. - const isProUser = user?.tier === "Pro" || user?.tier === "Plus"; - const tickerLimit = isProUser ? 100 : 5; + const isSubscribed = user?.tier === "Pro" || user?.tier === "Plus"; + const tickerLimit = user?.tier === "Pro" ? 300 : user?.tier === 'Plus' ? 100 : 5; try { const watchList = await pb.collection("watchlist").getOne(watchListId); @@ -40,7 +39,7 @@ export const POST = (async ({ request, locals }) => { if (tickerInput.length > tickerLimit) { return new Response( JSON.stringify({ - error: isProUser + error: isSubscribed ? `You can only have up to ${tickerLimit} stocks in your watchlist.` : `Upgrade to Pro to add unlimited stocks!`, }), @@ -67,7 +66,7 @@ export const POST = (async ({ request, locals }) => { if (newTickerList.length > tickerLimit) { return new Response( JSON.stringify({ - error: isProUser + error: isSubscribed ? `You can only have up to ${tickerLimit} stocks in your watchlist.` : `Upgrade to Pro to add unlimited stocks`, }), @@ -83,7 +82,7 @@ export const POST = (async ({ request, locals }) => { if (tickersArray.length > tickerLimit) { return new Response( JSON.stringify({ - error: isProUser + error: isSubscribed ? `You can only have up to ${tickerLimit} stocks in your watchlist.` : `Upgrade to Pro to add unlimited stocks!`, }), diff --git a/src/routes/pricing/+page.svelte b/src/routes/pricing/+page.svelte index 3be5386b..bd89b3f6 100644 --- a/src/routes/pricing/+page.svelte +++ b/src/routes/pricing/+page.svelte @@ -203,7 +203,7 @@ stroke-width="2" d="M5 13l4 4L19 7" >1 Watchlist + >1 Watchlist (up to 5 stocks)
  • Unlimited Watchlist + >Unlimited Watchlist (up to 100 stocks)
  • Everything in Plus and ...
  • +
  • + Watchlist with up to 300 stocks +
  • +