From 00a908ae1242ff6461cecb31731ea1b4de7af5c2 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Sun, 28 Jul 2024 15:11:57 +0530 Subject: [PATCH] Move subscription card to Profile settings section. Remove Billing section - Why Profile section and billing section looked too empty (1 card each). Combining them makes the setting page look more complete. Shows subscription options early on - Details - Made Futurist text orange - Made Unsubscribe a down button instead of cloud slash - Updated toast title to subscription - Improve Futurist trial title and description --- src/interface/web/app/settings/page.tsx | 133 ++++++++++++------------ 1 file changed, 64 insertions(+), 69 deletions(-) diff --git a/src/interface/web/app/settings/page.tsx b/src/interface/web/app/settings/page.tsx index 50bf2f62..3912e1df 100644 --- a/src/interface/web/app/settings/page.tsx +++ b/src/interface/web/app/settings/page.tsx @@ -56,6 +56,7 @@ import { FloppyDisk, PlugsConnected, ArrowCircleUp, + ArrowCircleDown, } from "@phosphor-icons/react"; import NavMenu from "../components/navMenu/navMenu"; @@ -272,13 +273,13 @@ export default function SettingsView() { // Notify user of subscription change toast({ - title: "💳 Billing", + title: "💳 Subscription", description: userConfig?.subscription_state === "unsubscribed" ? "Your subscription was cancelled" : "Your Futurist subscription has been renewed", }); } catch (error) { console.error('Error changing subscription:', error); toast({ - title: "💳 Billing", + title: "💳 Subscription", description: state === "cancel" ? "Failed to cancel subscription. Try again or contact us at team@khoj.dev" : "Failed to renew subscription. Try again or contact us at team@khoj.dev", }); } @@ -384,6 +385,67 @@ export default function SettingsView() { + + + + Subscription + + +

Current Plan

+ {userConfig.subscription_state === "trial" && ( + <> +

Futurist (Trial)

+

You are on a 14 day trial of the Khoj Futurist plan. Check pricing page to compare plans.

+ + ) || userConfig.subscription_state === "subscribed" && ( + <> +

Futurist

+

Subscription renews on { userConfig.subscription_renewal_date }

+ + ) || userConfig.subscription_state === "unsubscribed" && ( + <> +

Futurist

+

Subscription ends on { userConfig.subscription_renewal_date }

+ + ) || userConfig.subscription_state === "expired" && ( + <> +

Free Plan

+ {userConfig.subscription_renewal_date && ( +

Subscription expired on { userConfig.subscription_renewal_date }

+ ) || ( +

Check pricing page to compare plans.

+ )} + + )} +
+ + {(userConfig.subscription_state == "subscribed") && ( + + ) || (userConfig.subscription_state == "unsubscribed") && ( + + ) || ( + + )} + +
@@ -646,73 +708,6 @@ export default function SettingsView() {
-
-
Billing
-
- - - - Subscription - - -

Current Plan

- {userConfig.subscription_state === "trial" && ( - <> -

Futurist Trial

-

You are on a 14 day trial of the Khoj Futurist plan

-

See pricing for details

- - ) || userConfig.subscription_state === "subscribed" && ( - <> -

Futurist

-

Subscription renews on { userConfig.subscription_renewal_date }

- - ) || userConfig.subscription_state === "unsubscribed" && ( - <> -

Futurist

-

Subscription ends on { userConfig.subscription_renewal_date }

- - ) || userConfig.subscription_state === "expired" && ( - <> -

Trial

- {userConfig.subscription_renewal_date && ( -

Your subscription expired on { userConfig.subscription_renewal_date }

- ) || ( -

See pricing for details

- )} - - )} -
- - {(userConfig.subscription_state == "subscribed") && ( - - ) || (userConfig.subscription_state == "unsubscribed") && ( - - ) || ( - - )} - -
-
-