Skip to content

Commit 1fd6005

Browse files
Further wip
1 parent beb187b commit 1fd6005

15 files changed

+377
-264
lines changed
413 KB
Loading
1.51 MB
Loading
381 KB
Loading

packages/web/src/actions.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { auth } from "./auth";
2525
import { getConnection } from "./data/connection";
2626
import { IS_BILLING_ENABLED } from "./ee/features/billing/stripe";
2727
import InviteUserEmail from "./emails/inviteUserEmail";
28-
import { MOBILE_UNSUPPORTED_SPLASH_SCREEN_DISMISSED_COOKIE_NAME, SEARCH_MODE_COOKIE_NAME, SINGLE_TENANT_ORG_DOMAIN, SOURCEBOT_GUEST_USER_ID, SOURCEBOT_SUPPORT_EMAIL } from "./lib/constants";
28+
import { AGENTIC_SEARCH_TUTORIAL_DISMISSED_COOKIE_NAME, MOBILE_UNSUPPORTED_SPLASH_SCREEN_DISMISSED_COOKIE_NAME, SEARCH_MODE_COOKIE_NAME, SINGLE_TENANT_ORG_DOMAIN, SOURCEBOT_GUEST_USER_ID, SOURCEBOT_SUPPORT_EMAIL } from "./lib/constants";
2929
import { orgDomainSchema, orgNameSchema, repositoryQuerySchema } from "./lib/schemas";
3030
import { TenancyMode, ApiKeyPayload } from "./lib/types";
3131
import { decrementOrgSeatCount, getSubscriptionForOrg } from "./ee/features/billing/serverUtils";
@@ -2015,6 +2015,13 @@ export async function setSearchModeCookie(searchMode: "precise" | "agentic") {
20152015
});
20162016
}
20172017

2018+
export async function setAgenticSearchTutorialDismissedCookie(dismissed: boolean) {
2019+
const cookieStore = await cookies();
2020+
cookieStore.set(AGENTIC_SEARCH_TUTORIAL_DISMISSED_COOKIE_NAME, dismissed ? "true" : "false", {
2021+
httpOnly: false, // Allow client-side access
2022+
});
2023+
}
2024+
20182025
////// Helpers ///////
20192026

20202027
const parseConnectionConfig = (config: string) => {

packages/web/src/app/[domain]/components/homepage/agenticSearch.tsx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import { ChatBoxToolbar } from "@/features/chat/components/chatBox/chatBoxToolba
66
import { LanguageModelInfo, SearchScope } from "@/features/chat/types";
77
import { useCreateNewChatThread } from "@/features/chat/useCreateNewChatThread";
88
import { RepositoryQuery, SearchContextQuery } from "@/lib/types";
9-
import { useState } from "react";
9+
import { useCallback, useState } from "react";
1010
import { SearchModeSelector, SearchModeSelectorProps } from "./toolbar";
1111
import { useLocalStorage } from "usehooks-ts";
1212
import { DemoExamples } from "@/types";
1313
import { AskSourcebotDemoCards } from "./askSourcebotDemoCards";
14-
import { AskSourcebotTutorial } from "./askSourcebotTutorial";
14+
import { AgenticSearchTutorialDialog } from "./agenticSearchTutorialDialog";
15+
import { setAgenticSearchTutorialDismissedCookie } from "@/actions";
1516

1617
interface AgenticSearchProps {
1718
searchModeSelectorProps: SearchModeSelectorProps;
@@ -24,6 +25,7 @@ interface AgenticSearchProps {
2425
name: string | null;
2526
}[];
2627
demoExamples: DemoExamples | undefined;
28+
isTutorialDismissed: boolean;
2729
}
2830

2931
export const AgenticSearch = ({
@@ -32,11 +34,17 @@ export const AgenticSearch = ({
3234
repos,
3335
searchContexts,
3436
demoExamples,
37+
isTutorialDismissed,
3538
}: AgenticSearchProps) => {
3639
const { createNewChatThread, isLoading } = useCreateNewChatThread();
3740
const [selectedSearchScopes, setSelectedSearchScopes] = useLocalStorage<SearchScope[]>("selectedSearchScopes", [], { initializeWithValue: false });
3841
const [isContextSelectorOpen, setIsContextSelectorOpen] = useState(false);
39-
const [isTutorialOpen, setIsTutorialOpen] = useState(true);
42+
43+
const [isTutorialOpen, setIsTutorialOpen] = useState(!isTutorialDismissed);
44+
const onTutorialDismissed = useCallback(() => {
45+
setIsTutorialOpen(false);
46+
setAgenticSearchTutorialDismissedCookie(true);
47+
}, []);
4048

4149
return (
4250
<div className="flex flex-col items-center w-full">
@@ -78,10 +86,11 @@ export const AgenticSearch = ({
7886
/>
7987
)}
8088

81-
<AskSourcebotTutorial
82-
isOpen={isTutorialOpen}
83-
onClose={() => setIsTutorialOpen(false)}
84-
/>
89+
{isTutorialOpen && (
90+
<AgenticSearchTutorialDialog
91+
onClose={onTutorialDismissed}
92+
/>
93+
)}
8594
</div >
8695
)
8796
}

0 commit comments

Comments
 (0)