Skip to content

Commit fb8f6f4

Browse files
Merge branch 'main' into bkellam/ask_sb_tutorial
2 parents a2743db + 45416a4 commit fb8f6f4

File tree

6 files changed

+143
-50
lines changed

6 files changed

+143
-50
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
- Add search context to ask sourcebot context selector. [#397](https://github.com/sourcebot-dev/sourcebot/pull/397)
1212
- Add ability to include/exclude connection in search context. [#399](https://github.com/sourcebot-dev/sourcebot/pull/399)
1313
- Search context refactor to search scope and demo card UI changes. [#405](https://github.com/sourcebot-dev/sourcebot/pull/405)
14+
- Add GitHub star toast. [#409](https://github.com/sourcebot-dev/sourcebot/pull/409)
1415
- Added a onboarding modal when first visiting the homepage when `ask` mode is selected. [#408](https://github.com/sourcebot-dev/sourcebot/pull/408)
1516

1617
### Fixed
1718
- Fixed multiple writes race condition on config file watcher. [#398](https://github.com/sourcebot-dev/sourcebot/pull/398)
1819

1920
### Changed
2021
- Bumped AI SDK and associated packages version. [#404](https://github.com/sourcebot-dev/sourcebot/pull/404)
22+
- Bumped form-data package version. [#407](https://github.com/sourcebot-dev/sourcebot/pull/407)
23+
- Bumped next version. [#406](https://github.com/sourcebot-dev/sourcebot/pull/406)
2124

2225
## [4.6.0] - 2025-07-25
2326

packages/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
"langfuse-vercel": "^3.38.4",
146146
"lucide-react": "^0.517.0",
147147
"micromatch": "^4.0.8",
148-
"next": "14.2.26",
148+
"next": "14.2.30",
149149
"next-auth": "^5.0.0-beta.25",
150150
"next-navigation-guard": "^0.2.0",
151151
"next-themes": "^0.3.0",
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
'use client';
2+
3+
import { useToast } from "@/components/hooks/use-toast";
4+
import { ToastAction } from "@/components/ui/toast";
5+
import { useEffect } from "react";
6+
import { GitHubLogoIcon } from "@radix-ui/react-icons";
7+
import { captureEvent } from "@/hooks/useCaptureEvent";
8+
9+
const POPUP_SHOWN_COOKIE = "github_popup_shown";
10+
const POPUP_START_TIME_COOKIE = "github_popup_start_time";
11+
const POPUP_DELAY_S = 60;
12+
const SOURCEBOT_GITHUB_URL = "https://github.com/sourcebot-dev/sourcebot";
13+
14+
function getCookie(name: string): string | null {
15+
if (typeof document === "undefined") return null;
16+
17+
const cookies = document.cookie.split(';').map(cookie => cookie.trim());
18+
const targetCookie = cookies.find(cookie => cookie.startsWith(`${name}=`));
19+
20+
if (!targetCookie) return null;
21+
22+
return targetCookie.substring(`${name}=`.length);
23+
}
24+
25+
function setCookie(name: string, value: string, days: number = 365) {
26+
if (typeof document === "undefined") return;
27+
28+
try {
29+
const expires = new Date();
30+
expires.setTime(expires.getTime() + (days * 24 * 60 * 60 * 1000));
31+
document.cookie = `${name}=${value}; expires=${expires.toUTCString()}; path=/; SameSite=Lax`;
32+
} catch (error) {
33+
console.warn('Failed to set GitHub popup cookie:', error);
34+
}
35+
}
36+
37+
export const GitHubStarToast = () => {
38+
const { toast } = useToast();
39+
40+
useEffect(() => {
41+
const hasShownPopup = getCookie(POPUP_SHOWN_COOKIE);
42+
const startTime = getCookie(POPUP_START_TIME_COOKIE);
43+
44+
if (hasShownPopup) {
45+
return;
46+
}
47+
48+
const currentTime = Date.now();
49+
if (!startTime) {
50+
setCookie(POPUP_START_TIME_COOKIE, currentTime.toString());
51+
return;
52+
}
53+
54+
const elapsed = currentTime - parseInt(startTime, 10);
55+
if (elapsed >= (POPUP_DELAY_S * 1000)) {
56+
toast({
57+
title: "Star us on GitHub ❤️",
58+
description: "If you've found Sourcebot useful, please consider starring us on GitHub. Your support means a lot!",
59+
duration: 15 * 1000,
60+
action: (
61+
<div className="flex flex-col gap-1">
62+
<ToastAction
63+
altText="GitHub Button"
64+
onClick={() => {
65+
captureEvent('wa_github_star_toast_clicked', {});
66+
window.open(SOURCEBOT_GITHUB_URL, "_blank");
67+
}}
68+
>
69+
<div className="flex items-center gap-2">
70+
<GitHubLogoIcon className="w-4 h-4" />
71+
Sourcebot
72+
</div>
73+
</ToastAction>
74+
</div>
75+
)
76+
});
77+
78+
captureEvent('wa_github_star_toast_displayed', {});
79+
setCookie(POPUP_SHOWN_COOKIE, "true");
80+
}
81+
}, [toast]);
82+
83+
return null;
84+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { GcpIapAuth } from "./components/gcpIapAuth";
2121
import { getAnonymousAccessStatus, getMemberApprovalRequired } from "@/actions";
2222
import { JoinOrganizationCard } from "@/app/components/joinOrganizationCard";
2323
import { LogoutEscapeHatch } from "@/app/components/logoutEscapeHatch";
24+
import { GitHubStarToast } from "./components/githubStarToast";
2425

2526
interface LayoutProps {
2627
children: React.ReactNode,
@@ -134,6 +135,7 @@ export default async function Layout({
134135
<SyntaxGuideProvider>
135136
{children}
136137
<SyntaxReferenceGuide />
138+
<GitHubStarToast />
137139
</SyntaxGuideProvider>
138140
)
139141
}

packages/web/src/lib/posthogEvents.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,5 +293,8 @@ export type PosthogEventMap = {
293293
exampleTitle: string,
294294
exampleUrl: string,
295295
},
296+
//////////////////////////////////////////////////////////////////
297+
wa_github_star_toast_displayed: {},
298+
wa_github_star_toast_clicked: {},
296299
}
297300
export type PosthogEvent = keyof PosthogEventMap;

yarn.lock

Lines changed: 50 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2441,10 +2441,10 @@ __metadata:
24412441
languageName: node
24422442
linkType: hard
24432443

2444-
"@next/env@npm:14.2.26":
2445-
version: 14.2.26
2446-
resolution: "@next/env@npm:14.2.26"
2447-
checksum: 10c0/e895d5d94f26c52f01c98450e269b10de9b785acf1011feb3ed1d003ac076e776369c32ba183bd603e0dcc8192e545ead59373f6c5e262c38a3659636edd69ca
2444+
"@next/env@npm:14.2.30":
2445+
version: 14.2.30
2446+
resolution: "@next/env@npm:14.2.30"
2447+
checksum: 10c0/b5ff1dc9aeb03f998694c9ec309d3b4a75bfad315d77e61a729b19fdc96c409f850efb4917440657fd69bf1f8aa9f63a5ee4f18626d4c66cb86c77e901759a58
24482448
languageName: node
24492449
linkType: hard
24502450

@@ -2464,9 +2464,9 @@ __metadata:
24642464
languageName: node
24652465
linkType: hard
24662466

2467-
"@next/swc-darwin-arm64@npm:14.2.26":
2468-
version: 14.2.26
2469-
resolution: "@next/swc-darwin-arm64@npm:14.2.26"
2467+
"@next/swc-darwin-arm64@npm:14.2.30":
2468+
version: 14.2.30
2469+
resolution: "@next/swc-darwin-arm64@npm:14.2.30"
24702470
conditions: os=darwin & cpu=arm64
24712471
languageName: node
24722472
linkType: hard
@@ -2478,9 +2478,9 @@ __metadata:
24782478
languageName: node
24792479
linkType: hard
24802480

2481-
"@next/swc-darwin-x64@npm:14.2.26":
2482-
version: 14.2.26
2483-
resolution: "@next/swc-darwin-x64@npm:14.2.26"
2481+
"@next/swc-darwin-x64@npm:14.2.30":
2482+
version: 14.2.30
2483+
resolution: "@next/swc-darwin-x64@npm:14.2.30"
24842484
conditions: os=darwin & cpu=x64
24852485
languageName: node
24862486
linkType: hard
@@ -2492,9 +2492,9 @@ __metadata:
24922492
languageName: node
24932493
linkType: hard
24942494

2495-
"@next/swc-linux-arm64-gnu@npm:14.2.26":
2496-
version: 14.2.26
2497-
resolution: "@next/swc-linux-arm64-gnu@npm:14.2.26"
2495+
"@next/swc-linux-arm64-gnu@npm:14.2.30":
2496+
version: 14.2.30
2497+
resolution: "@next/swc-linux-arm64-gnu@npm:14.2.30"
24982498
conditions: os=linux & cpu=arm64 & libc=glibc
24992499
languageName: node
25002500
linkType: hard
@@ -2506,9 +2506,9 @@ __metadata:
25062506
languageName: node
25072507
linkType: hard
25082508

2509-
"@next/swc-linux-arm64-musl@npm:14.2.26":
2510-
version: 14.2.26
2511-
resolution: "@next/swc-linux-arm64-musl@npm:14.2.26"
2509+
"@next/swc-linux-arm64-musl@npm:14.2.30":
2510+
version: 14.2.30
2511+
resolution: "@next/swc-linux-arm64-musl@npm:14.2.30"
25122512
conditions: os=linux & cpu=arm64 & libc=musl
25132513
languageName: node
25142514
linkType: hard
@@ -2520,9 +2520,9 @@ __metadata:
25202520
languageName: node
25212521
linkType: hard
25222522

2523-
"@next/swc-linux-x64-gnu@npm:14.2.26":
2524-
version: 14.2.26
2525-
resolution: "@next/swc-linux-x64-gnu@npm:14.2.26"
2523+
"@next/swc-linux-x64-gnu@npm:14.2.30":
2524+
version: 14.2.30
2525+
resolution: "@next/swc-linux-x64-gnu@npm:14.2.30"
25262526
conditions: os=linux & cpu=x64 & libc=glibc
25272527
languageName: node
25282528
linkType: hard
@@ -2534,9 +2534,9 @@ __metadata:
25342534
languageName: node
25352535
linkType: hard
25362536

2537-
"@next/swc-linux-x64-musl@npm:14.2.26":
2538-
version: 14.2.26
2539-
resolution: "@next/swc-linux-x64-musl@npm:14.2.26"
2537+
"@next/swc-linux-x64-musl@npm:14.2.30":
2538+
version: 14.2.30
2539+
resolution: "@next/swc-linux-x64-musl@npm:14.2.30"
25402540
conditions: os=linux & cpu=x64 & libc=musl
25412541
languageName: node
25422542
linkType: hard
@@ -2548,9 +2548,9 @@ __metadata:
25482548
languageName: node
25492549
linkType: hard
25502550

2551-
"@next/swc-win32-arm64-msvc@npm:14.2.26":
2552-
version: 14.2.26
2553-
resolution: "@next/swc-win32-arm64-msvc@npm:14.2.26"
2551+
"@next/swc-win32-arm64-msvc@npm:14.2.30":
2552+
version: 14.2.30
2553+
resolution: "@next/swc-win32-arm64-msvc@npm:14.2.30"
25542554
conditions: os=win32 & cpu=arm64
25552555
languageName: node
25562556
linkType: hard
@@ -2562,9 +2562,9 @@ __metadata:
25622562
languageName: node
25632563
linkType: hard
25642564

2565-
"@next/swc-win32-ia32-msvc@npm:14.2.26":
2566-
version: 14.2.26
2567-
resolution: "@next/swc-win32-ia32-msvc@npm:14.2.26"
2565+
"@next/swc-win32-ia32-msvc@npm:14.2.30":
2566+
version: 14.2.30
2567+
resolution: "@next/swc-win32-ia32-msvc@npm:14.2.30"
25682568
conditions: os=win32 & cpu=ia32
25692569
languageName: node
25702570
linkType: hard
@@ -2576,9 +2576,9 @@ __metadata:
25762576
languageName: node
25772577
linkType: hard
25782578

2579-
"@next/swc-win32-x64-msvc@npm:14.2.26":
2580-
version: 14.2.26
2581-
resolution: "@next/swc-win32-x64-msvc@npm:14.2.26"
2579+
"@next/swc-win32-x64-msvc@npm:14.2.30":
2580+
version: 14.2.30
2581+
resolution: "@next/swc-win32-x64-msvc@npm:14.2.30"
25822582
conditions: os=win32 & cpu=x64
25832583
languageName: node
25842584
linkType: hard
@@ -6646,7 +6646,7 @@ __metadata:
66466646
langfuse-vercel: "npm:^3.38.4"
66476647
lucide-react: "npm:^0.517.0"
66486648
micromatch: "npm:^4.0.8"
6649-
next: "npm:14.2.26"
6649+
next: "npm:14.2.30"
66506650
next-auth: "npm:^5.0.0-beta.25"
66516651
next-navigation-guard: "npm:^0.2.0"
66526652
next-themes: "npm:^0.3.0"
@@ -11170,14 +11170,15 @@ __metadata:
1117011170
linkType: hard
1117111171

1117211172
"form-data@npm:^4.0.0":
11173-
version: 4.0.2
11174-
resolution: "form-data@npm:4.0.2"
11173+
version: 4.0.4
11174+
resolution: "form-data@npm:4.0.4"
1117511175
dependencies:
1117611176
asynckit: "npm:^0.4.0"
1117711177
combined-stream: "npm:^1.0.8"
1117811178
es-set-tostringtag: "npm:^2.1.0"
11179+
hasown: "npm:^2.0.2"
1117911180
mime-types: "npm:^2.1.12"
11180-
checksum: 10c0/e534b0cf025c831a0929bf4b9bbe1a9a6b03e273a8161f9947286b9b13bf8fb279c6944aae0070c4c311100c6d6dbb815cd955dc217728caf73fad8dc5b8ee9c
11181+
checksum: 10c0/373525a9a034b9d57073e55eab79e501a714ffac02e7a9b01be1c820780652b16e4101819785e1e18f8d98f0aee866cc654d660a435c378e16a72f2e7cac9695
1118111182
languageName: node
1118211183
linkType: hard
1118311184

@@ -14299,20 +14300,20 @@ __metadata:
1429914300
languageName: node
1430014301
linkType: hard
1430114302

14302-
"next@npm:14.2.26":
14303-
version: 14.2.26
14304-
resolution: "next@npm:14.2.26"
14303+
"next@npm:14.2.30":
14304+
version: 14.2.30
14305+
resolution: "next@npm:14.2.30"
1430514306
dependencies:
14306-
"@next/env": "npm:14.2.26"
14307-
"@next/swc-darwin-arm64": "npm:14.2.26"
14308-
"@next/swc-darwin-x64": "npm:14.2.26"
14309-
"@next/swc-linux-arm64-gnu": "npm:14.2.26"
14310-
"@next/swc-linux-arm64-musl": "npm:14.2.26"
14311-
"@next/swc-linux-x64-gnu": "npm:14.2.26"
14312-
"@next/swc-linux-x64-musl": "npm:14.2.26"
14313-
"@next/swc-win32-arm64-msvc": "npm:14.2.26"
14314-
"@next/swc-win32-ia32-msvc": "npm:14.2.26"
14315-
"@next/swc-win32-x64-msvc": "npm:14.2.26"
14307+
"@next/env": "npm:14.2.30"
14308+
"@next/swc-darwin-arm64": "npm:14.2.30"
14309+
"@next/swc-darwin-x64": "npm:14.2.30"
14310+
"@next/swc-linux-arm64-gnu": "npm:14.2.30"
14311+
"@next/swc-linux-arm64-musl": "npm:14.2.30"
14312+
"@next/swc-linux-x64-gnu": "npm:14.2.30"
14313+
"@next/swc-linux-x64-musl": "npm:14.2.30"
14314+
"@next/swc-win32-arm64-msvc": "npm:14.2.30"
14315+
"@next/swc-win32-ia32-msvc": "npm:14.2.30"
14316+
"@next/swc-win32-x64-msvc": "npm:14.2.30"
1431614317
"@swc/helpers": "npm:0.5.5"
1431714318
busboy: "npm:1.6.0"
1431814319
caniuse-lite: "npm:^1.0.30001579"
@@ -14353,7 +14354,7 @@ __metadata:
1435314354
optional: true
1435414355
bin:
1435514356
next: dist/bin/next
14356-
checksum: 10c0/d5792ad9aff56b42648456f9cced2f269100c4d4200590c2f4e419f3ad2c5795b57f7caf273bc336323f866dbb31268197b46a07016ca7e55637d68b53176b29
14357+
checksum: 10c0/47b6a1e96d9263894da150bbb2c98c123b1630a0a88eb55c2129938557c51e8e55edf1d43364f7721b472fb4977e9567541f9c504a69ccf8138d0128cb682561
1435714358
languageName: node
1435814359
linkType: hard
1435914360

0 commit comments

Comments
 (0)