Skip to content

Commit f781ab1

Browse files
committed
feedback and fixed build
1 parent 1ba266a commit f781ab1

File tree

8 files changed

+21
-29
lines changed

8 files changed

+21
-29
lines changed

packages/web/src/app/[domain]/components/pendingApproval.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ import { LogoutEscapeHatch } from "@/app/components/logoutEscapeHatch"
33
import { SourcebotLogo } from "@/app/components/sourcebotLogo"
44
import { auth } from "@/auth"
55

6-
interface PendingApprovalCardProps {
7-
domain: string
8-
}
9-
10-
export const PendingApprovalCard = async ({ domain }: PendingApprovalCardProps) => {
6+
export const PendingApprovalCard = async () => {
117
const session = await auth()
128
const userId = session?.user?.id
139

packages/web/src/app/[domain]/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default async function Layout({
6868
});
6969

7070
if (hasPendingApproval) {
71-
return <PendingApprovalCard domain={domain} />
71+
return <PendingApprovalCard />
7272
} else {
7373
return <SubmitJoinRequest domain={domain} />
7474
}

packages/web/src/app/invite/page.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
77
import { SourcebotLogo } from "@/app/components/sourcebotLogo";
88
import { AuthMethodSelector } from "@/app/components/authMethodSelector";
99
import { JoinOrganizationButton } from "@/app/invite/components/joinOrganizationButton"
10-
import { Button } from "@/components/ui/button";
1110
import { LogoutEscapeHatch } from "@/app/components/logoutEscapeHatch";
1211
import { getAuthProviders } from "@/lib/authProviders";
1312

@@ -70,7 +69,7 @@ function WelcomeCard({ inviteLinkId, providers }: { inviteLinkId: string; provid
7069
<CardContent className="space-y-6">
7170
<div className="text-center space-y-3">
7271
<p className="text-[var(--muted-foreground)] text-[15px] leading-6">
73-
You've been invited to join this Sourcebot deployment. Sign up to get started.
72+
You&apos;ve been invited to join this Sourcebot deployment. Sign up to get started.
7473
</p>
7574
</div>
7675

packages/web/src/app/onboard/components/memberApprovalRequiredToggle.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function MemberApprovalRequiredToggle() {
4444
}
4545

4646
fetchInitialValue()
47-
}, [])
47+
}, [toast])
4848

4949
const handleToggle = async (checked: boolean) => {
5050
setIsLoading(true)

packages/web/src/app/onboard/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export default async function Onboarding({ searchParams }: OnboardingProps) {
138138
},
139139
{
140140
id: "complete",
141-
title: "You're All Set!",
141+
title: "You&apos;re All Set!",
142142
subtitle: (
143143
<>
144144
Your Sourcebot deployment is ready. Check out these resources to get started.
@@ -354,7 +354,7 @@ function NonOwnerOnboardingMessage() {
354354
Owner Access Required
355355
</p>
356356
<p className="text-sm text-muted-foreground leading-relaxed">
357-
Only the organization owner can complete the initial setup and configuration. Once onboarding is complete, you'll be able to access Sourcebot.
357+
Only the organization owner can complete the initial setup and configuration. Once onboarding is complete, you&apos;ll be able to access Sourcebot.
358358
</p>
359359
</div>
360360
</div>

packages/web/src/app/page.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
import { auth } from "@/auth";
2-
import { prisma } from "@/prisma";
32
import { redirect } from "next/navigation";
43
import { SINGLE_TENANT_ORG_DOMAIN } from "@/lib/constants";
4+
import { getOrgFromDomain } from "@/data/org";
55

66
export default async function Page() {
7-
const org = await prisma.org.findUnique({
8-
where: {
9-
domain: SINGLE_TENANT_ORG_DOMAIN
10-
},
11-
});
7+
const org = await getOrgFromDomain(SINGLE_TENANT_ORG_DOMAIN);
128

139
if (!org || !org.isOnboarded) {
1410
return redirect("/onboard");

packages/web/src/data/org.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@ import 'server-only';
22
import { prisma } from '@/prisma';
33

44
export const getOrgFromDomain = async (domain: string) => {
5-
const org = await prisma.org.findUnique({
6-
where: {
7-
domain: domain
8-
}
9-
});
5+
try {
6+
const org = await prisma.org.findUnique({
7+
where: {
8+
domain: domain
9+
}
10+
});
1011

11-
return org;
12+
return org;
13+
} catch (error) {
14+
// During build time we won't be able to access the database, so we catch and return null in this case
15+
// so that we can statically build pages that hit the DB (ex. to check if the org is onboarded)
16+
console.error('Error fetching org from domain:', error);
17+
return null;
18+
}
1219
}

packages/web/src/ee/features/sso/sso.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@ import Keycloak from "next-auth/providers/keycloak";
77
import Gitlab from "next-auth/providers/gitlab";
88
import MicrosoftEntraID from "next-auth/providers/microsoft-entra-id";
99
import { prisma } from "@/prisma";
10-
import { notFound, ServiceError } from "@/lib/serviceError";
11-
import { OrgRole } from "@sourcebot/db";
12-
import { getSeats, SOURCEBOT_UNLIMITED_SEATS } from "@sourcebot/shared";
13-
import { StatusCodes } from "http-status-codes";
14-
import { ErrorCode } from "@/lib/errorCodes";
1510
import { OAuth2Client } from "google-auth-library";
16-
import { sew } from "@/actions";
1711
import Credentials from "next-auth/providers/credentials";
1812
import type { User as AuthJsUser } from "next-auth";
1913
import { onCreateUser } from "@/lib/authUtils";

0 commit comments

Comments
 (0)