Skip to content

Commit 0517b17

Browse files
committed
website: hardcode the shared Kapa widget config
Keep the shared Ask AI scaffolding in the base branch while inlining the current Kapa widget settings instead of reading them from CI-provided environment variables. Made-with: Cursor
1 parent 40947c8 commit 0517b17

4 files changed

Lines changed: 20 additions & 58 deletions

File tree

src/app/layout.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import "@mantine/spotlight/styles.layer.css";
2222
import "./globals.css";
2323
import { Header } from "@/components/Header";
2424
import KapaWidget from "@/components/KapaWidget";
25-
import { isKapaConfigured } from "@/components/kapa-config";
2625
import {
2726
ANNOUNCEMENT_HEIGHT_PX,
2827
isAnnouncementActive,
@@ -63,7 +62,6 @@ export default function RootLayout({
6362
const headerHeightPx = activeAnnouncement
6463
? BASE_HEADER_HEIGHT_PX + ANNOUNCEMENT_HEIGHT_PX
6564
: BASE_HEADER_HEIGHT_PX;
66-
const kapaConfigured = isKapaConfigured();
6765

6866
return (
6967
<html
@@ -79,10 +77,7 @@ export default function RootLayout({
7977
<MantineProvider theme={theme} defaultColorScheme="auto">
8078
<KapaWidget variant="modal" />
8179
<AppShell header={{ height: "var(--header-height)" }}>
82-
<Header
83-
announcement={activeAnnouncement}
84-
showAskAi={kapaConfigured}
85-
/>
80+
<Header announcement={activeAnnouncement} />
8681

8782
<AppShellMain>
8883
<Container size="xl" mt="xl" px={{ base: "md", xs: "xl" }}>

src/components/Header.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ const links = [
4040

4141
export const Header = ({
4242
announcement,
43-
showAskAi = false,
4443
}: {
4544
announcement?: AnnouncementType;
46-
showAskAi?: boolean;
4745
}) => {
4846
const path = usePathname();
4947
const [burgerOpened, { toggle: toggleBurger, close: closeBurger }] =
@@ -167,7 +165,7 @@ export const Header = ({
167165
<Group align="center">
168166
<Group gap={5} visibleFrom="sm" align="center">
169167
{items}
170-
{showAskAi && renderAskAiButton({})}
168+
{renderAskAiButton({})}
171169
</Group>
172170

173171
<Group visibleFrom="md" gap="xs">
@@ -221,14 +219,12 @@ export const Header = ({
221219
</Popover.Target>
222220
<Popover.Dropdown>
223221
{items}
224-
{showAskAi && (
225-
<Group m="xs" gap="xs">
226-
{renderAskAiButton({
227-
hiddenFrom: "sm",
228-
onClick: closeBurger,
229-
})}
230-
</Group>
231-
)}
222+
<Group m="xs" gap="xs">
223+
{renderAskAiButton({
224+
hiddenFrom: "sm",
225+
onClick: closeBurger,
226+
})}
227+
</Group>
232228
<Group m="xs" gap="xs">
233229
{actionIcons}
234230
</Group>

src/components/KapaWidget.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
import Script from "next/script";
2-
import { getKapaConfig } from "./kapa-config";
2+
import docsConfig from "../../docs-config";
33

44
export type KapaWidgetVariant = "drawer" | "modal" | "page";
55

66
type KapaWidgetProps = {
77
variant: KapaWidgetVariant;
88
};
99

10+
const WEBSITE_ID = "80cbacc9-0b84-48aa-bfb8-0002270176bf";
11+
const PROJECT_NAME = "Prometheus";
12+
const PROJECT_COLOR = "#D86444";
1013
const ASK_AI_TRIGGER_SELECTOR = "[data-kapa-trigger='ask-ai']";
14+
const PROJECT_LOGO_URL = new URL(
15+
"/assets/prometheus-logo.svg",
16+
docsConfig.siteUrl,
17+
).toString();
1118

1219
export default function KapaWidget({ variant }: KapaWidgetProps) {
13-
const config = getKapaConfig();
14-
15-
if (!config) {
16-
return null;
17-
}
18-
1920
const triggerProps =
2021
variant === "page"
2122
? {}
@@ -40,10 +41,10 @@ export default function KapaWidget({ variant }: KapaWidgetProps) {
4041
id="kapa-widget"
4142
strategy="afterInteractive"
4243
src="https://widget.kapa.ai/kapa-widget.bundle.js"
43-
data-website-id={config.websiteId}
44-
data-project-name={config.projectName}
45-
data-project-color={config.projectColor}
46-
data-project-logo={config.projectLogoUrl}
44+
data-website-id={WEBSITE_ID}
45+
data-project-name={PROJECT_NAME}
46+
data-project-color={PROJECT_COLOR}
47+
data-project-logo={PROJECT_LOGO_URL}
4748
data-button-hide="true"
4849
{...triggerProps}
4950
{...variantProps}

src/components/kapa-config.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)