Skip to content

Commit e6a2fd2

Browse files
authored
feat(web): add Book a Call button to sidebar and docs navbar (#1441)
1 parent 628683d commit e6a2fd2

5 files changed

Lines changed: 42 additions & 3 deletions

File tree

docs/docs.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@
231231
"navbar": {
232232
"primary": {
233233
"type": "button",
234-
"label": "GitHub",
235-
"href": "https://github.com/sourcebot-dev/sourcebot"
234+
"label": "Book a Call",
235+
"href": "https://calendly.com/michael-sourcebot/sourcebot-call?utm_source=docs"
236236
}
237237
},
238238
"footer": {
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import {
2+
SidebarMenu,
3+
SidebarMenuButton,
4+
SidebarMenuItem,
5+
} from "@/components/ui/sidebar"
6+
import { Phone } from "lucide-react"
7+
8+
const BOOK_A_CALL_BASE_URL = "https://calendly.com/michael-sourcebot/sourcebot-call"
9+
10+
interface BookACallSidebarButtonProps {
11+
// When the deployment is the public "ask GitHub" app, attribute bookings
12+
// to `public-app` so they can be told apart from self-hosted instances.
13+
isAskGhEnabled: boolean
14+
}
15+
16+
export function BookACallSidebarButton({ isAskGhEnabled }: BookACallSidebarButtonProps) {
17+
const utmSource = isAskGhEnabled ? "public-app" : "app"
18+
const href = `${BOOK_A_CALL_BASE_URL}?utm_source=${utmSource}`
19+
20+
return (
21+
<SidebarMenu>
22+
<SidebarMenuItem>
23+
<SidebarMenuButton asChild tooltip="Book a Call">
24+
<a href={href} target="_blank" rel="noopener noreferrer">
25+
<Phone className="h-4 w-4" />
26+
<span>Book a Call</span>
27+
</a>
28+
</SidebarMenuButton>
29+
</SidebarMenuItem>
30+
</SidebarMenu>
31+
)
32+
}

packages/web/src/app/(app)/@sidebar/components/defaultSidebar/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { RepoVisitHistory } from "./repoVisitHistory";
1414
import { getAuthContext, withAuth } from "@/middleware/withAuth";
1515
import { sew } from "@/middleware/sew";
1616
import { hasEntitlement, isValidLicenseActive } from "@/lib/entitlements";
17+
import { env } from "@sourcebot/shared";
1718

1819
const SIDEBAR_CHAT_LIMIT = 30;
1920
export const SIDEBAR_REPO_VISITS_LIMIT = 10;
@@ -57,6 +58,7 @@ export async function DefaultSidebar() {
5758
session={session}
5859
collapsible="icon"
5960
isValidLicenseActive={licenseActive}
61+
isAskGhEnabled={env.EXPERIMENT_ASK_GH_ENABLED === 'true'}
6062
headerContent={
6163
<Nav
6264
isSettingsNotificationVisible={isSettingsNotificationVisible}

packages/web/src/app/(app)/@sidebar/components/settingsSidebar/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { SidebarBase } from "../sidebarBase";
66
import { Nav } from "./nav";
77
import { SettingsSidebarHeader } from "./header";
88
import { isValidLicenseActive } from "@/lib/entitlements";
9+
import { env } from "@sourcebot/shared";
910

1011
export async function SettingsSidebar() {
1112
const session = await auth();
@@ -22,6 +23,7 @@ export async function SettingsSidebar() {
2223
session={session}
2324
collapsible="none"
2425
isValidLicenseActive={licenseActive}
26+
isAskGhEnabled={env.EXPERIMENT_ASK_GH_ENABLED === 'true'}
2527
headerContent={<SettingsSidebarHeader />}
2628
>
2729
<Nav groups={sidebarNavGroups} />

packages/web/src/app/(app)/@sidebar/components/sidebarBase.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import { KeyboardShortcutHint } from "@/app/components/keyboardShortcutHint";
4545
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
4646
import { Separator } from "@/components/ui/separator";
4747
import { WhatsNewSidebarButton } from "./whatsNewSidebarButton";
48+
import { BookACallSidebarButton } from "./bookACallSidebarButton";
4849
import { UpgradeButton } from "./upgradeButton";
4950
import { useIsMobile } from "@/hooks/use-mobile";
5051

@@ -58,9 +59,10 @@ interface SidebarBaseProps {
5859
headerContent: ReactNode;
5960
children: ReactNode;
6061
isValidLicenseActive: boolean;
62+
isAskGhEnabled: boolean;
6163
}
6264

63-
export function SidebarBase({ session, collapsible = "icon", headerContent, children, isValidLicenseActive }: SidebarBaseProps) {
65+
export function SidebarBase({ session, collapsible = "icon", headerContent, children, isValidLicenseActive, isAskGhEnabled }: SidebarBaseProps) {
6466
const [isScrolled, setIsScrolled] = useState(false);
6567
const contentRef = useRef<HTMLDivElement>(null);
6668
const isMobile = useIsMobile();
@@ -118,6 +120,7 @@ export function SidebarBase({ session, collapsible = "icon", headerContent, chil
118120
<CollapseSidebarButton />
119121
}
120122
<WhatsNewSidebarButton />
123+
<BookACallSidebarButton isAskGhEnabled={isAskGhEnabled} />
121124
{session ? (
122125
<MeControlDropdownMenu session={session} />
123126
) : (

0 commit comments

Comments
 (0)