Skip to content

Commit 4fd1645

Browse files
Add banner to repos table calling out connections
1 parent 4a933f5 commit 4fd1645

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed

packages/web/src/app/[domain]/repos/[id]/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export default async function RepoDetailPage({ params }: { params: Promise<{ id:
102102
</CardTitle>
103103
</CardHeader>
104104
<CardContent>
105-
<DisplayDate date={repo.createdAt} className="text-2xl font-semibold" />
105+
<span className="text-2xl font-semibold"><DisplayDate date={repo.createdAt} /></span>
106106
</CardContent>
107107
</Card>
108108

@@ -121,7 +121,7 @@ export default async function RepoDetailPage({ params }: { params: Promise<{ id:
121121
</CardTitle>
122122
</CardHeader>
123123
<CardContent>
124-
{repo.indexedAt ? <DisplayDate date={repo.indexedAt} className="text-2xl font-semibold" /> : "Never"}
124+
<span className="text-2xl font-semibold">{repo.indexedAt ? <DisplayDate date={repo.indexedAt} /> : "Never"}</span>
125125
</CardContent>
126126
</Card>
127127

@@ -140,7 +140,7 @@ export default async function RepoDetailPage({ params }: { params: Promise<{ id:
140140
</CardTitle>
141141
</CardHeader>
142142
<CardContent>
143-
{nextIndexAttempt ? <DisplayDate date={nextIndexAttempt} className="text-2xl font-semibold" /> : "-"}
143+
<span className="text-2xl font-semibold">{nextIndexAttempt ? <DisplayDate date={nextIndexAttempt} /> : "-"}</span>
144144
</CardContent>
145145
</Card>
146146
</div>

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1+
import { InfoIcon } from "lucide-react";
12
import { NavigationMenu } from "../components/navigationMenu";
3+
import { SINGLE_TENANT_ORG_DOMAIN } from "@/lib/constants";
4+
import Link from "next/link";
5+
import { getCurrentUserRole, getReposStats } from "@/actions";
6+
import { isServiceError } from "@/lib/utils";
7+
import { ServiceErrorException } from "@/lib/serviceError";
8+
import { OrgRole } from "@sourcebot/db";
29

310
interface LayoutProps {
411
children: React.ReactNode;
@@ -12,9 +19,22 @@ export default async function Layout(
1219
const { domain } = params;
1320
const { children } = props;
1421

22+
const repoStats = await getReposStats();
23+
if (isServiceError(repoStats)) {
24+
throw new ServiceErrorException(repoStats);
25+
}
26+
27+
const userRoleInOrg = await getCurrentUserRole(domain);
28+
1529
return (
1630
<div className="min-h-screen flex flex-col">
1731
<NavigationMenu domain={domain} />
32+
{(repoStats.numberOfRepos === 0 && userRoleInOrg === OrgRole.OWNER) && (
33+
<div className="w-full flex flex-row justify-center items-center bg-accent py-0.5">
34+
<InfoIcon className="w-4 h-4 mr-1" />
35+
<span><span className="font-medium">No repositories configured.</span> Create a <Link href={`/${SINGLE_TENANT_ORG_DOMAIN}/settings/connections`} className="text-link hover:underline">connection</Link> to get started.</span>
36+
</div>
37+
)}
1838
<main className="flex-grow flex justify-center p-4 bg-backgroundSecondary relative">
1939
<div className="w-full max-w-6xl rounded-lg p-6">
2040
<div className="container mx-auto">

packages/web/src/app/[domain]/settings/connections/[id]/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export default async function ConnectionDetailPage(props: ConnectionDetailPagePr
121121
</CardTitle>
122122
</CardHeader>
123123
<CardContent>
124-
<DisplayDate date={connection.createdAt} className="text-2xl font-semibold" />
124+
<span className="text-2xl font-semibold"><DisplayDate date={connection.createdAt} /></span>
125125
</CardContent>
126126
</Card>
127127

@@ -159,7 +159,7 @@ export default async function ConnectionDetailPage(props: ConnectionDetailPagePr
159159
</CardTitle>
160160
</CardHeader>
161161
<CardContent>
162-
{nextSyncAttempt ? <DisplayDate date={nextSyncAttempt} className="text-2xl font-semibold" /> : "-"}
162+
<span className="text-2xl font-semibold">{nextSyncAttempt ? <DisplayDate date={nextSyncAttempt} /> : "-"}</span>
163163
</CardContent>
164164
</Card>
165165
</div>

packages/web/src/app/[domain]/settings/connections/components/connectionsTable.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export const columns: ColumnDef<Connection>[] = [
8888
<Image
8989
src={codeHostIcon.src}
9090
alt={`${connection.codeHostType} logo`}
91+
className={codeHostIcon.className}
9192
width={20}
9293
height={20}
9394
/>

0 commit comments

Comments
 (0)