mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 15:09:33 +01:00
web: show subscription provider info in subscription settings
This commit is contained in:
committed by
Abdullah Atta
parent
523ae5b07b
commit
6b4f7900ec
@@ -32,13 +32,6 @@ import { BuyDialog } from "../../buy-dialog";
|
|||||||
import { strings } from "@notesnook/intl";
|
import { strings } from "@notesnook/intl";
|
||||||
import { PromptDialog } from "../../prompt";
|
import { PromptDialog } from "../../prompt";
|
||||||
|
|
||||||
const PROVIDER_MAP = {
|
|
||||||
0: "Streetwriters",
|
|
||||||
1: "iOS",
|
|
||||||
2: "Android",
|
|
||||||
3: "Web",
|
|
||||||
4: "Gift card"
|
|
||||||
} as const;
|
|
||||||
export function SubscriptionStatus() {
|
export function SubscriptionStatus() {
|
||||||
const user = useUserStore((store) => store.user);
|
const user = useUserStore((store) => store.user);
|
||||||
|
|
||||||
@@ -46,7 +39,8 @@ export function SubscriptionStatus() {
|
|||||||
await db.user.activateTrial();
|
await db.user.activateTrial();
|
||||||
});
|
});
|
||||||
|
|
||||||
const provider = PROVIDER_MAP[user?.subscription?.provider || 0];
|
const provider =
|
||||||
|
strings.subscriptionProviderInfo[user?.subscription?.provider || 0];
|
||||||
const {
|
const {
|
||||||
isTrial,
|
isTrial,
|
||||||
isBeta,
|
isBeta,
|
||||||
@@ -74,7 +68,7 @@ export function SubscriptionStatus() {
|
|||||||
const expiryDate = dayjs(user?.subscription?.expiry).format("MMMM D, YYYY");
|
const expiryDate = dayjs(user?.subscription?.expiry).format("MMMM D, YYYY");
|
||||||
const startDate = dayjs(user?.subscription?.start).format("MMMM D, YYYY");
|
const startDate = dayjs(user?.subscription?.start).format("MMMM D, YYYY");
|
||||||
return isPro
|
return isPro
|
||||||
? provider === "Streetwriters" || provider === "Gift card"
|
? provider.type === "Streetwriters" || provider.type === "Gift card"
|
||||||
? `Ending on ${expiryDate}`
|
? `Ending on ${expiryDate}`
|
||||||
: `Next payment on ${expiryDate}.`
|
: `Next payment on ${expiryDate}.`
|
||||||
: isProCancelled
|
: isProCancelled
|
||||||
@@ -134,10 +128,10 @@ export function SubscriptionStatus() {
|
|||||||
: "Access only to basic features including unlimited notes & end-to-end encrypted syncing to unlimited devices."}
|
: "Access only to basic features including unlimited notes & end-to-end encrypted syncing to unlimited devices."}
|
||||||
</Text>
|
</Text>
|
||||||
<Text sx={{ mt: 2 }} variant="subBody">
|
<Text sx={{ mt: 2 }} variant="subBody">
|
||||||
{subtitle}
|
{subtitle}. {provider.desc()}
|
||||||
</Text>
|
</Text>
|
||||||
<Flex sx={{ gap: 1, mt: 2 }}>
|
<Flex sx={{ gap: 1, mt: 2 }}>
|
||||||
{provider === "Web" && (isPro || isProCancelled) ? (
|
{provider.type === "Web" && (isPro || isProCancelled) ? (
|
||||||
<>
|
<>
|
||||||
{isPro && (
|
{isPro && (
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
Reference in New Issue
Block a user