Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

Merge branch 'master' into beta

Abdullah Atta5ae024f20a2a
diff --cc apps/web/src/dialogs/settings/components/subscription-status.tsx
index 4d3fed53a,9fc6e8d46..546e43b3a
--- a/apps/web/src/dialogs/settings/components/subscription-status.tsx
+++ b/apps/web/src/dialogs/settings/components/subscription-status.tsx
@@@ -76,78 -107,134 +76,81 @@@ export function SubscriptionStatus()
>
{strings.currentPlan()}
</Text>
- <Text
- variant="heading"
- sx={{
- mt: 2
- }}
- >
- {remainingDays > 0 && (isPro || isProCancelled)
- ? `Pro`
- : remainingDays > 0 && isTrial
- ? "Trial"
- : isBeta
- ? "Beta user"
- : "Basic"}
- </Text>
- <Text variant="body">
- {remainingDays > 0 && (isPro || isProCancelled || isTrial || isBeta)
- ? `Access to all Pro features including unlimited storage for attachments,
- notebooks & tags.`
- : "Access only to basic features including unlimited notes & end-to-end encrypted syncing to unlimited devices."}
- </Text>
- {remainingDays > 0 && (isPro || isProCancelled) ? (
- <Text sx={{ mt: 2 }} variant="subBody">
- {subtitle}. {provider.desc()}
+ <Text variant="heading">{title}</Text>
+ {subtitle ? (
+ <Text variant="body">
+ {subtitle}{" "}
+ {strings.subscriptionProviderInfo[
+ user.subscription.provider || 0
+ ].desc()}
</Text>
) : null}
- <Flex sx={{ gap: 1, mt: 2 }}>
- {provider.type === "Web" && (isPro || isProCancelled) ? (
- <>
- {isPro && (
- <Button
- variant="secondary"
- onClick={async () => {
- const cancelSubscription = await ConfirmDialog.show({
- title: "Cancel subscription?",
- message:
- "Cancelling your subscription will automatically downgrade you to the Basic plan at the end of your billing period. You will have to resubscribe to continue using the Pro features.",
- negativeButtonText: strings.no(),
- positiveButtonText: strings.yes()
- });
- if (cancelSubscription) {
- await TaskManager.startTask({
- type: "modal",
- title: "Cancelling your subscription",
- subtitle: strings.pleaseWait() + "...",
- action: () => db.subscriptions.cancel()
- })
- .catch((e) => showToast("error", e.message))
- .then(() =>
- showToast("success", strings.subCanceled())
- );
- }
- }}
+ {featuresUsage.status === "fulfilled" ? (
+ <Grid
+ sx={{
+ gridTemplateRows: "1fr ".repeat(featuresUsage.value.length),
+ gridTemplateColumns: "1fr 3fr 1fr",
+ borderTop: "1px solid var(--border)",
+ pt: 2,
+ width: "100%"
+ }}
+ >
+ {featuresUsage.value.map((feature, index) => (
+ <>
+ <Text sx={{ gridRow: index + 1, gridColumn: 1 }} variant="body">
+ {getFeature(feature.id).title}
+ </Text>
+ <Text
+ sx={{ gridRow: index + 1, gridColumn: 3, textAlign: "right" }}
+ variant="subBody"
>
- {strings.cancelSub()}
- </Button>
- )}
- <Button
- variant="secondary"
- onClick={async () => {
- const refundSubscription = await ConfirmDialog.show({
- title: "Request refund?",
- message:
- "You will only be issued a refund if you are eligible as per our refund policy. Your account will be immediately downgraded to Basic and your funds will be transferred to your account within 24 hours.",
- negativeButtonText: strings.no(),
- positiveButtonText: strings.yes()
- });
- if (refundSubscription) {
- await TaskManager.startTask({
- type: "modal",
- title: "Requesting refund for your subscription",
- subtitle: strings.pleaseWait() + "...",
- action: () => db.subscriptions.refund()
- })
- .catch((e) => showToast("error", e.message))
- .then(() => showToast("success", strings.refundIssued()));
- }
- }}
- >
- Request a refund
- </Button>
- </>
- ) : null}
- {!isPro && (
- <>
- <Button variant="accent" onClick={() => BuyDialog.show({})}>
- {isProCancelled ? strings.resubToPro() : strings.upgradeToPro()}
- </Button>
- {isBasic && (
- <Button
- variant="secondary"
- onClick={activateTrial}
- sx={{ bg: "background" }}
- >
- {isActivatingTrial ? (
- <Loading size={16} />
- ) : (
- strings.tryFreeFor14Days()
- )}
- </Button>
- )}
- <Button
- variant="secondary"
- onClick={async () => {
- const giftCode = await PromptDialog.show({
- title: strings.redeemGiftCode(),
- description: strings.redeemGiftCodeDesc()
+ {feature.id === "storage"
+ ? `${formatBytes(feature.used)}/${
+ feature.total === Infinity
+ ? "Unlimited"
+ : formatBytes(feature.total)
+ }`
+ : feature.total === Infinity
+ ? "Unlimited"
+ : `${feature.used} of ${feature.total}`}
+ </Text>
+ </>
+ ))}
+ </Grid>
+ ) : null}
+
+ {title === "Free" ? (
+ <Flex sx={{ alignItems: "center", justifyContent: "center", gap: 1 }}>
+ <Button variant="accent" onClick={() => BuyDialog.show({})}>
+ {strings.upgradeToPro()}
+ </Button>
+ <Button
+ variant="secondary"
+ onClick={async () => {
+ const giftCode = await PromptDialog.show({
+ title: strings.redeemGiftCode(),
+ description: strings.redeemGiftCodeDesc()
+ });
+ if (giftCode) {
+ await TaskManager.startTask({
+ type: "modal",
+ title: strings.redeemingGiftCode(),
+ subtitle: strings.pleaseWait() + "...",
- action: () => db.subscriptions.redeemCode(giftCode)
- }).catch((e) => showToast("error", e.message));
++ action: () =>
++ db.subscriptions
++ .redeemCode(giftCode)
++ .catch((e) => showToast("error", e.message))
+ });
- if (giftCode) {
- await TaskManager.startTask({
- type: "modal",
- title: strings.redeemingGiftCode(),
- subtitle: strings.pleaseWait() + "...",
- action: () =>
- db.subscriptions
- .redeemCode(giftCode)
- .catch((e) => showToast("error", e.message))
- });
- }
- }}
- sx={{ bg: "background" }}
- >
- {strings.redeemGiftCode()}
- </Button>
- </>
- )}
- </Flex>
+ }
+ }}
+ sx={{ bg: "background" }}
+ >
+ {strings.redeemGiftCode()}
+ </Button>
+ </Flex>
+ ) : null}
</Flex>
- {isBasic ? <Features /> : null}
+ {/* {isBasic ? <Features /> : null} */}
</>
);
}