Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add subscription management section to user settings #1587

Merged
merged 6 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ NEXT_PUBLIC_API_URL=https://beta.api.opensauced.pizza/v1
NEXT_PUBLIC_POSTHOG_ID=phc_Y0xz6nK55MEwWjobJsI2P8rsiomZJ6eZLoXehmMy9tt
NEXT_PUBLIC_CLOUD_NAME=dgxgziswe
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=test
NEXT_PUBLIC_STRIPE_SUB_CANCEL_URL=https://billing.stripe.com/p/login/test_bIY8xy3iy6fpeHu3cc
NEXT_PUBLIC_OPENGRAPH_URL=https://beta.opengraph.opensauced.pizza/v1
SENTRY_DSN=https://3f5bb9023ff0407299dd22a6454558f9@o4504872488927232.ingest.sentry.io/4505082236960768
2 changes: 2 additions & 0 deletions components/atoms/Button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export interface ButtonsProps extends React.ButtonHTMLAttributes<HTMLButtonEleme
variant: "primary" | "default" | "dark" | "outline" | "link" | "text";
loading?: boolean;
href?: string;
rel?: string;
target?: string;
showLoadingText?: boolean;
}

Expand Down
28 changes: 25 additions & 3 deletions components/organisms/UserSettingsPage/user-settings-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ const UserSettingsPage = ({ user }: userSettingsPageProps) => {
name="linkedin_url"
/>
<TextInput
className="bg-light-slate-4 text-light-slate-11 font-medium"
className="font-medium bg-light-slate-4 text-light-slate-11"
placeholder="https://discordapp.com/users/832877193112762362"
label="Discord URL"
onChange={handleValidateDiscordUrl}
Expand Down Expand Up @@ -373,8 +373,8 @@ const UserSettingsPage = ({ user }: userSettingsPageProps) => {
Update Preferences
</Button>
</div>
{!hasReports && (
<div className="flex flex-col gap-6 order-first md:order-last">
{!hasReports ? (
<div className="flex flex-col order-first gap-6 md:order-last">
<div className="flex flex-col gap-3">
<label className="text-2xl font-normal text-light-slate-11">Upgrade Access</label>
<div className="w-full sm:max-w-80">
Expand All @@ -383,6 +383,28 @@ const UserSettingsPage = ({ user }: userSettingsPageProps) => {
</div>
<StripeCheckoutButton variant="primary" />
</div>
) : (
<div>
<div className="flex flex-col order-first gap-6 md:order-last">
<div className="flex flex-col gap-3">
<label className="text-2xl font-normal text-light-slate-11">Manage Subscriptions</label>
<div className="w-full md:w-96">
<Text>
You are currently subscribed to the Pro plan and currently have access to all premium features.
</Text>
</div>
</div>
<Button
rel="noopener noreferrer"
target="_blank"
href={process.env.NEXT_PUBLIC_STRIPE_SUB_CANCEL_URL}
className="w-max"
variant="primary"
>
Cancel Subscription
</Button>
</div>
</div>
)}
</div>
</div>
Expand Down