Skip to content

Commit

Permalink
feat: removed payments and limits
Browse files Browse the repository at this point in the history
  • Loading branch information
nickytonline committed Oct 16, 2024
1 parent 0e52d57 commit 408c10c
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 133 deletions.
2 changes: 0 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ NEXT_PUBLIC_API_URL=https://beta.api.opensauced.pizza/v2
NEXT_PUBLIC_EXP_API_URL=https://beta.api.opensauced.pizza/v2
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
SENTRY_DSN=https://3f5bb9023ff0407299dd22a6454558f9@o4504872488927232.ingest.sentry.io/4505082236960768
NEXT_PUBLIC_SENTRY_DSN=https://3f5bb9023ff0407299dd22a6454558f9@o4504872488927232.ingest.sentry.io/4505082236960768

Expand Down
38 changes: 13 additions & 25 deletions components/organisms/Reports/reports.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import GitHubIcon from "img/icons/github-icon.svg";
import Button from "components/shared/Button/button";
import Icon from "components/atoms/Icon/icon";
import Title from "components/atoms/Typography/title";
import Text from "components/atoms/Typography/text";
import ReportsHistory from "components/molecules/ReportsHistory/reports-history";
import SelectReportsFilter from "components/molecules/SelectReportsFilter/select-reports-filter";
import StripeCheckoutButton from "components/organisms/StripeCheckoutButton/stripe-checkout-button";

import { Report } from "interfaces/report-type";

Expand All @@ -20,12 +18,11 @@ import getCurrentDate from "lib/utils/get-current-date";
const USERDEVICESTORAGENAME = "reportState";

interface ReportsProps {
hasReports?: boolean;
waitlisted?: boolean;
repositories?: number[];
}

const Reports = ({ hasReports, repositories }: ReportsProps): JSX.Element => {
const Reports = ({ repositories }: ReportsProps): JSX.Element => {
const userDeviceState = localStorage.getItem(USERDEVICESTORAGENAME);
const initialState = userDeviceState ? JSON.parse(userDeviceState as string) : [];
const [reports, setReports] = useState<Report[]>(initialState);
Expand Down Expand Up @@ -64,28 +61,19 @@ const Reports = ({ hasReports, repositories }: ReportsProps): JSX.Element => {
</Title>
<hr className="border-light-slate-6 my-4" />
{user ? (
hasReports ? (
<>
<SelectReportsFilter filterList={filterList} callback={handleFilterClick} />
<>
<SelectReportsFilter filterList={filterList} callback={handleFilterClick} />

{reports.length > 0 && (
<>
<Title className=" relative mt-16" level={3}>
Download History
</Title>
<hr className="border-light-slate-6 my-4" />
<ReportsHistory reportList={reports} repositories={repositories} />
</>
)}
</>
) : (
<>
<Text>Upgrade to a subscription to gain access to generate custom reports!</Text>
<p className="flex justify-center py-4 px-2">
<StripeCheckoutButton variant="primary" className="w-52 h-[38px] flex justify-center" />
</p>
</>
)
{reports.length > 0 && (
<>
<Title className=" relative mt-16" level={3}>
Download History
</Title>
<hr className="border-light-slate-6 my-4" />
<ReportsHistory reportList={reports} repositories={repositories} />
</>
)}
</>
) : (
<div className="flex justify-center py-4">
<Button variant="primary" onClick={async () => await signIn({ provider: "github" })}>
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion interfaces/global-state-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export interface GlobalStateInterface {
sessionToken?: string | null;
providerToken?: string | null;
userId?: number | null;
hasReports?: boolean;
openSearch?: boolean;
dismissFeaturedInsights?: boolean;
}
2 changes: 0 additions & 2 deletions lib/hooks/useSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import useSupabaseAuth from "./useSupabaseAuth";
const useSession = (getSession = false) => {
const { sessionToken } = useSupabaseAuth(getSession);
const store = useStore();
const hasReports = useStore((state) => state.hasReports);
const onboarded = useStore((state) => state.onboarded);
const waitlisted = useStore((state) => state.waitlisted);
const [session, setSession] = useState<false | DbUser>(false);
Expand Down Expand Up @@ -50,7 +49,6 @@ const useSession = (getSession = false) => {
return {
onboarded,
waitlisted,
hasReports,
session,
};
};
Expand Down
13 changes: 0 additions & 13 deletions lib/utils/stripe-client.ts

This file was deleted.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
"@radix-ui/react-tooltip": "^1.0.3",
"@react-spring/web": "^9.7.3",
"@sentry/nextjs": "^7.80.0",
"@stripe/stripe-js": "^1.46.0",
"@supabase/auth-helpers-nextjs": "^0.7.2",
"@supabase/auth-helpers-react": "^0.4.0",
"@supabase/gotrue-js": "^1.22.22",
Expand Down Expand Up @@ -115,7 +114,6 @@
"remark-gfm": "^4.0.0",
"rooks": "^7.4.4",
"schema-dts": "^1.1.0",
"stripe": "^11.8.0",
"swiper": "^10.2.0",
"swr": "^2.0.3",
"tailwindcss-animate": "^1.0.7",
Expand Down
44 changes: 0 additions & 44 deletions pages/workspaces/[workspaceId]/settings.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { FaRegCheckCircle } from "react-icons/fa";
import { useRouter } from "next/router";
import { GetServerSidePropsContext } from "next";
import { createPagesServerClient } from "@supabase/auth-helpers-nextjs";
import { ComponentProps, useState } from "react";
import dynamic from "next/dynamic";
import { useEffectOnce } from "react-use";
import { IoDiamond } from "react-icons/io5";
import { WorkspaceLayout } from "components/Workspaces/WorkspaceLayout";
import Button from "components/shared/Button/button";
import TextInput from "components/atoms/TextInput/text-input";
Expand All @@ -27,9 +25,7 @@ import { WORKSPACE_UPDATED_EVENT } from "components/shared/AppSidebar/AppSidebar
import { WorkspacesTabList } from "components/Workspaces/WorkspacesTabList";
import { deleteCookie, setCookie } from "lib/utils/server/cookies";
import WorkspaceVisibilityModal from "components/Workspaces/WorkspaceVisibilityModal";
import Card from "components/atoms/Card/card";
import { WorkspaceHeader } from "components/Workspaces/WorkspaceHeader";
import { getStripe } from "lib/utils/stripe-client";
import WorkspaceMembersConfig from "components/Workspaces/WorkspaceMembersConfig/workspace-members-config";
import { useWorkspaceMembers } from "lib/hooks/api/useWorkspaceMembers";
import ClientOnly from "components/atoms/ClientOnly/client-only";
Expand Down Expand Up @@ -193,11 +189,6 @@ const WorkspaceSettings = ({ workspace, canDeleteWorkspace, overLimit }: Workspa
if (error) {
toast({ description: "There's been an error", variant: "danger" });
}

if (data) {
const stripe = await getStripe();
stripe?.redirectToCheckout({ sessionId: data.sessionId as string });
}
};

const changeVisibility = async () => {
Expand Down Expand Up @@ -331,41 +322,6 @@ const WorkspaceSettings = ({ workspace, canDeleteWorkspace, overLimit }: Workspa
</Button>
</div>

{workspace.payee_user_id ? (
<section className="flex flex-col gap-4">
<div className="flex gap-4 items-center">
<h3 className="font-medium">Manage Subscription</h3>
<div className="flex gap-2 items-center text-white px-3 py-2 bg-gradient-to-l from-gradient-orange-one to-gradient-orange-two rounded-full">
<p className="text-sm font-medium">PRO</p>
<IoDiamond />
</div>
</div>
<p className="text-sm text-slate-600">
This Workspace is currently subscribed to the PRO Workspace plan.
</p>
<Button href={process.env.NEXT_PUBLIC_STRIPE_SUB_CANCEL_URL} variant="primary" className="w-fit">
Manage Subscription
</Button>
</section>
) : (
<Card className="flex flex-col gap-4 px-6 pt-5 pb-6">
<h2 className="text-md font-medium">Upgrade your workspace</h2>
<div id="upgrade" className="flex gap-4">
<FaRegCheckCircle className="text-light-grass-8 w-6 h-6" />
<div className="flex flex-col gap-2">
<h3 className="text-sm font-medium">Make your workspace private</h3>
<p className="text-sm text-slate-500">
While our free workspaces are exclusively public, upgrading to a Pro workspace gives you the power
to choose between public or private settings for your projects.
</p>
</div>
</div>
<Button variant="primary" className="w-fit mt-2" onClick={upgradeThisWorkspace}>
Upgrade Workspace
</Button>
</Card>
)}

{canDeleteWorkspace && (
<div className="flex flex-col p-6 rounded-2xl bg-light-slate-4">
<Title className="!text-1xl !leading-none !border-light-slate-8 border-b pb-4" level={4}>
Expand Down

0 comments on commit 408c10c

Please sign in to comment.