Skip to content

Commit

Permalink
feat: Disable bulk
Browse files Browse the repository at this point in the history
  • Loading branch information
amaury1093 committed Dec 30, 2023
1 parent 70a5175 commit 2289f1d
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/app/[lang]/dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { SAAS_10K_PRODUCT_ID } from "@/util/subs";
import { SubscriptionHeader } from "./SubscriptionHeader";
import { SubscriptionWithPrice } from "@/supabase/supabaseServer";
import { Dictionary } from "@/dictionaries";
import { ENABLE_BULK } from "@/util/helpers";

interface DashboardProps {
children: React.ReactNode;
Expand All @@ -31,7 +32,7 @@ export function Dashboard({
<Spacer h={2} />
</>
)}
{tab !== false && (
{tab !== false && ENABLE_BULK && (
<Tabs
d={d}
bulkDisabled={
Expand Down
5 changes: 5 additions & 0 deletions src/app/[lang]/dashboard/bulk/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ import { Csv } from "./Csv";
import { Spacer } from "@/components/Geist";
import { BulkHistory } from "./BulkHistory";
import { redirect } from "next/navigation";
import { ENABLE_BULK } from "@/util/helpers";

export default async function Bulk({
params: { lang },
}: {
params: { lang: string };
}) {
if (!ENABLE_BULK) {
return redirect(`/${lang}/dashboard/verify`);
}

const session = await getSession();
if (!session) {
return redirect(`/${lang}/login`);
Expand Down
6 changes: 5 additions & 1 deletion src/app/[lang]/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getSubscription } from "@/supabase/supabaseServer";
import { ENABLE_BULK } from "@/util/helpers";
import {
COMMERCIAL_LICENSE_PRODUCT_ID,
SAAS_100K_PRODUCT_ID,
Expand All @@ -19,7 +20,10 @@ export default async function Dashboard({
RedirectType.replace
);
case SAAS_100K_PRODUCT_ID:
return redirect(`/${lang}/dashboard/bulk`, RedirectType.replace);
return redirect(
`/${lang}/dashboard/${ENABLE_BULK ? "bulk" : "verify"}`,
RedirectType.replace
);
default:
return redirect(`/${lang}/dashboard/verify`, RedirectType.replace);
}
Expand Down
13 changes: 9 additions & 4 deletions src/app/[lang]/pricing/SaaS100k.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ProductCard } from "./ProductCard";
import type { ProductCardProps } from "./ProductCard";
import Markdown from "marked-react";
import { SpanRenderer } from "@/components/Markdown";
import { ENABLE_BULK } from "@/util/helpers";

export function SaaS100k(
props: Omit<ProductCardProps, "title">
Expand All @@ -19,9 +20,13 @@ export function SaaS100k(
</Text>
}
features={[
<Markdown renderer={SpanRenderer} key="licenseFeatures-1">
{d.bulk}
</Markdown>,
ENABLE_BULK ? (
<Markdown renderer={SpanRenderer} key="licenseFeatures-1">
{d.bulk}
</Markdown>
) : (
""
),
d.reacher_ip,
<Markdown renderer={SpanRenderer} key="saasFeatures-2">
{d.full_feature}
Expand All @@ -30,7 +35,7 @@ export function SaaS100k(
{d.support}
</Markdown>,
d.cancel,
]}
].filter((x) => !!x)}
subtitle={<span>{d.subtitle}</span>}
/>
);
Expand Down
4 changes: 3 additions & 1 deletion src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ export const config = {
* - _next/static (static files)
* - _next/image (image optimization files)
* - favicon (favicon file)
* - monitoring (health check)
* - js (JavaScript files)
*/
"/((?!api|_next/static|_next/image|favicon).*)",
"/((?!api|_next/static|_next/image|favicon|monitoring|js).*)",
],
};

Expand Down
2 changes: 2 additions & 0 deletions src/util/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,5 @@ export function formatDate(d: string | Date, locale?: string): string {
locale: locale === "fr" ? fr : enUS,
});
}

export const ENABLE_BULK: boolean = false;

0 comments on commit 2289f1d

Please sign in to comment.