diff --git a/components/ProfileDropdown.tsx b/components/ProfileDropdown.tsx
index 81e0505..9d1260b 100644
--- a/components/ProfileDropdown.tsx
+++ b/components/ProfileDropdown.tsx
@@ -6,6 +6,8 @@ import { signOut } from "next-auth/react";
import { useTranslation } from "next-i18next";
import { useUser } from "@/hooks/store/user";
+const stripeEnabled = process.env.NEXT_PUBLIC_STRIPE === "true";
+
export default function ProfileDropdown() {
const { t } = useTranslation();
const { settings, updateSettings } = useLocalSettingsStore();
@@ -73,7 +75,7 @@ export default function ProfileDropdown() {
)}
- {!user.parentSubscriptionId && (
+ {!user.parentSubscriptionId && stripeEnabled && (
- {process.env.NEXT_PUBLIC_STRIPE && (
+ {process.env.NEXT_PUBLIC_STRIPE && !user.parentSubscriptionId && (
{
if (!stripeEnabled) {
- return false;
+ const totalLinks = await prisma.link.count({
+ where: {
+ createdBy: {
+ id: userId,
+ },
+ },
+ });
+
+ return MAX_LINKS_PER_USER - (numberOfImports + totalLinks) < 0;
}
const user = await prisma.user.findUnique({
diff --git a/pages/settings/billing.tsx b/pages/settings/billing.tsx
index 1c561e3..37a938f 100644
--- a/pages/settings/billing.tsx
+++ b/pages/settings/billing.tsx
@@ -28,12 +28,13 @@ export default function Billing() {
const router = useRouter();
const { t } = useTranslation();
- useEffect(() => {
- if (!process.env.NEXT_PUBLIC_STRIPE) router.push("/settings/profile");
- }, []);
-
- const { data: users = [] } = useUsers();
const { data: account } = useUser();
+ const { data: users = [] } = useUsers();
+
+ useEffect(() => {
+ if (!process.env.NEXT_PUBLIC_STRIPE || account.parentSubscriptionId)
+ router.push("/settings/account");
+ }, []);
const [searchQuery, setSearchQuery] = useState("");
const [filteredUsers, setFilteredUsers] = useState();
diff --git a/pages/settings/delete.tsx b/pages/settings/delete.tsx
index 0d11b87..0479d8f 100644
--- a/pages/settings/delete.tsx
+++ b/pages/settings/delete.tsx
@@ -7,6 +7,7 @@ import Link from "next/link";
import Button from "@/components/ui/Button";
import { useTranslation } from "next-i18next";
import getServerSideProps from "@/lib/client/getServerSideProps";
+import { useUser } from "@/hooks/store/user";
export default function Delete() {
const [password, setPassword] = useState("");
@@ -15,6 +16,7 @@ export default function Delete() {
const [submitLoader, setSubmitLoader] = useState(false);
const { data } = useSession();
const { t } = useTranslation();
+ const { data: user } = useUser();
const submit = async () => {
const body = {
@@ -83,7 +85,7 @@ export default function Delete() {
/>
- {process.env.NEXT_PUBLIC_STRIPE && (
+ {process.env.NEXT_PUBLIC_STRIPE && !user.parentSubscriptionId && (