Skip to content

Commit 4917e3e

Browse files
Add 'add repos' button that appears in the demo site
1 parent a5a6d18 commit 4917e3e

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

demo-site-config.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
// This is the config file for https://demo.sourcebot.dev.
2+
// To add a new repository, edit this file and open a PR.
3+
// After the PR is merged, the deploy demo workflow will
4+
// run (see: https://github.com/sourcebot-dev/sourcebot/actions/workflows/deploy-demo.yml),
5+
// after which the changes will be reflected on the demo site.
16
{
27
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
38
"connections": {
4-
// https://docs.sourcebot.dev/docs/connections/github
9+
// Defines the GitHub repositories.
10+
// See: https://docs.sourcebot.dev/docs/connections/github
511
"github-repos": {
612
"type": "github",
713
"token": {
@@ -221,12 +227,10 @@
221227
"envoyproxy/envoy"
222228
]
223229
},
224-
// https://docs.sourcebot.dev/docs/connections/gitlab
230+
// Defines the GitLab repositories.
231+
// See: https://docs.sourcebot.dev/docs/connections/gitlab
225232
"gitlab-repos": {
226233
"type": "gitlab",
227-
"token": {
228-
"env": "GITLAB_TOKEN"
229-
},
230234
"projects": [
231235
"gnachman/iterm2"
232236
]

packages/web/src/components/ui/data-table.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ import {
2222
import { Button } from "@/components/ui/button"
2323
import { Input } from "@/components/ui/input"
2424
import * as React from "react"
25-
25+
import { PlusIcon } from "lucide-react"
26+
import { env } from "@/env.mjs"
2627

2728
interface DataTableProps<TData, TValue> {
2829
columns: ColumnDef<TData, TValue>[]
@@ -60,7 +61,7 @@ export function DataTable<TData, TValue>({
6061

6162
return (
6263
<div>
63-
<div className="flex items-center py-4">
64+
<div className="flex items-center justify-between py-4">
6465
<Input
6566
placeholder={searchPlaceholder}
6667
value={(table.getColumn(searchKey)?.getFilterValue() as string) ?? ""}
@@ -69,6 +70,22 @@ export function DataTable<TData, TValue>({
6970
}
7071
className="max-w-sm"
7172
/>
73+
{/*
74+
Show a button on the demo site that allows users to add new repositories
75+
by updating the demo-site-config.json file and opening a PR.
76+
*/}
77+
{env.NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT === "demo" && (
78+
<Button
79+
variant="default"
80+
size="default"
81+
onClick={() => {
82+
window.open("https://github.com/sourcebot-dev/sourcebot/edit/main/demo-site-config.json", "_blank");
83+
}}
84+
>
85+
<PlusIcon className="w-4 h-4" />
86+
Add repository
87+
</Button>
88+
)}
7289
</div>
7390
<div className="rounded-md border">
7491
<Table>

0 commit comments

Comments
 (0)