diff --git a/assets/icons/logomark.svg b/assets/icons/logomark.svg new file mode 100644 index 0000000000..7b0e2c79c1 --- /dev/null +++ b/assets/icons/logomark.svg @@ -0,0 +1 @@ + diff --git a/src/alf/tokens.ts b/src/alf/tokens.ts index 880f377a2c..7ca5bf4cff 100644 --- a/src/alf/tokens.ts +++ b/src/alf/tokens.ts @@ -108,8 +108,7 @@ export const gradients = { nordic: { values: [ [0, '#083367'], - [0.4, '#1A4972'], - [0.6, '#386D84'], + [0.4, '#386D84'], [1, '#9EE8C1'], ], hover_value: '#3A7085', @@ -124,3 +123,8 @@ export const gradients = { hover_value: '#755B62', }, } as const + +export const blueskyPlus = { + dark: '#083367', + light: '#9EE8C1', +} diff --git a/src/components/icons/BlueskyPlus.tsx b/src/components/icons/BlueskyPlus.tsx index 3261aa5e2e..3f478ab444 100644 --- a/src/components/icons/BlueskyPlus.tsx +++ b/src/components/icons/BlueskyPlus.tsx @@ -42,13 +42,13 @@ export function Logotype(props: Props) { const {fill, size: _size, style, gradient, ...rest} = useCommonSVGProps(props) // @ts-ignore it's fiiiiine const size = parseInt(rest.width || 100) - const ratio = 78 / 330 + const ratio = 88 / 330 const {_} = useLingui() return ( )} + + + + Subscriptions + + + @@ -162,12 +175,6 @@ export function SettingsScreen({}: Props) { Moderation - - - - Subscriptions - - diff --git a/src/screens/Settings/components/SettingsList.tsx b/src/screens/Settings/components/SettingsList.tsx index 520df41187..c2eed0d976 100644 --- a/src/screens/Settings/components/SettingsList.tsx +++ b/src/screens/Settings/components/SettingsList.tsx @@ -5,6 +5,7 @@ import {HITSLOP_10} from '#/lib/constants' import {atoms as a, useTheme, ViewStyleProp} from '#/alf' import * as Button from '#/components/Button' import {ChevronRight_Stroke2_Corner0_Rounded as ChevronRightIcon} from '#/components/icons/Chevron' +import {Props as IconProps} from '#/components/icons/common' import {Link, LinkProps} from '#/components/Link' import {createPortalGroup} from '#/components/Portal' import {Text} from '#/components/Typography' @@ -177,8 +178,10 @@ export function ItemIcon({ icon: Comp, size = 'xl', color: colorProp, + iconProps, }: Omit, 'position'> & { color?: string + iconProps?: Pick }) { const t = useTheme() const {destructive, withinGroup} = useContext(ItemContext) @@ -201,7 +204,7 @@ export function ItemIcon({ const content = ( - + ) diff --git a/src/screens/Subscriptions/index.tsx b/src/screens/Subscriptions/index.tsx index e2c2ba8e28..16b897ad0c 100644 --- a/src/screens/Subscriptions/index.tsx +++ b/src/screens/Subscriptions/index.tsx @@ -1,12 +1,18 @@ +import React from 'react' import {View} from 'react-native' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {NativeStackScreenProps} from '@react-navigation/native-stack' import {CommonNavigatorParams} from '#/lib/routes/types' +import {isAndroid, isIOS, isWeb} from '#/platform/detection' import {PurchasesState, usePurchases} from '#/state/purchases' import {useManageSubscription} from '#/state/purchases/hooks/useManageSubscription' -import {SubscriptionGroupId} from '#/state/purchases/types' +import { + PlatformId, + SubscriptionGroupId, + SubscriptionOfferingId, +} from '#/state/purchases/types' import {APISubscription} from '#/state/purchases/types' import {CenteredView} from '#/view/com/util/Views' import {atoms as a, tokens, useTheme} from '#/alf' @@ -14,15 +20,18 @@ import {Admonition} from '#/components/Admonition' import {Button, ButtonIcon, ButtonText} from '#/components/Button' import {useDialogControl} from '#/components/Dialog' import {BlueskyPlus} from '#/components/dialogs/BlueskyPlus' +import {Divider} from '#/components/Divider' import {GradientFill} from '#/components/GradientFill' +import {AndroidLogo} from '#/components/icons/AndroidLogo' +import {AppleLogo} from '#/components/icons/AppleLogo' import {ArrowRotateCounterClockwise_Stroke2_Corner0_Rounded as Rotate} from '#/components/icons/ArrowRotateCounterClockwise' -import {Full as BlueskyPlusLogo} from '#/components/icons/BlueskyPlus' +import {Full as BlueskyPlusLogo, Logotype} from '#/components/icons/BlueskyPlus' import {CheckThick_Stroke2_Corner0_Rounded as Check} from '#/components/icons/Check' import {Clock_Stroke2_Corner0_Rounded as Clock} from '#/components/icons/Clock' +import {Globe_Stroke2_Corner0_Rounded as Globe} from '#/components/icons/Globe' import {PlusLarge_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus' -import {SettingsGear2_Stroke2_Corner0_Rounded as Gear} from '#/components/icons/SettingsGear2' import * as Layout from '#/components/Layout' -import {createStaticClick, InlineLinkText, Link} from '#/components/Link' +import {createStaticClick, Link} from '#/components/Link' import {Loader} from '#/components/Loader' import {Text} from '#/components/Typography' @@ -40,7 +49,7 @@ export function Subscriptions(_props: ScreenProps) { - + {purchases.status === 'loading' ? ( @@ -113,13 +122,9 @@ function Core({ ] return ( - - - + {isSubscribedToCore ? ( - - - + ) : null} {!isSubscribedToCore && ( @@ -136,6 +141,8 @@ function Core({ ) : ( <> + + Building a better internet needs your support. @@ -221,6 +228,7 @@ function Core({ )} + {/* + */} ) } @@ -254,51 +263,134 @@ function CoreSubscriptions(props: {subscriptions: APISubscription[]}) { const {_, i18n} = useLingui() const {mutateAsync: manageSubscription} = useManageSubscription() + const copy = React.useMemo(() => { + return { + [SubscriptionOfferingId.CoreMonthly]: { + title: _(msg`Monthly`), + }, + [SubscriptionOfferingId.CoreAnnual]: { + title: _(msg`Annual`), + }, + } + }, [_]) + return props.subscriptions.map(sub => { const endDate = i18n.date(new Date(sub.periodEndsAt), {dateStyle: 'medium'}) const StatusIcon = sub.renews ? Rotate : Clock + const c = copy[sub.offering] + const canManage = + (isWeb && sub.platform === PlatformId.Web) || + (isIOS && sub.platform === PlatformId.Ios) || + (isAndroid && sub.platform === PlatformId.Android) + const PlatformIcon = { + [PlatformId.Ios]: AppleLogo, + [PlatformId.Android]: AndroidLogo, + [PlatformId.Web]: Globe, + }[sub.platform] return ( - + + + - - - - - Active - - + + {c.title} + - - - {endDate} - + + {sub.renews ? Active : Cancelled} + - { - manageSubscription() - })} - style={[a.justify_center]}> - - + + + + {endDate} + + + + + + + + + + Managed via web + + + + {canManage && ( + { + manageSubscription() + })} + style={[a.justify_center]}> + + Manage + + + )} ) diff --git a/src/state/purchases/types.ts b/src/state/purchases/types.ts index ee0dd4844d..10c57349b3 100644 --- a/src/state/purchases/types.ts +++ b/src/state/purchases/types.ts @@ -48,6 +48,7 @@ export type SubscriptionOffering = export type APISubscription = { group: SubscriptionGroupId platform: PlatformId + offering: SubscriptionOfferingId renews: boolean periodDtartsAt: string periodEndsAt: string