Skip to content

Commit 08d864e

Browse files
committed
fix conflict
2 parents 3ee141c + e3e5453 commit 08d864e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+713
-818
lines changed

.example.env

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Find these values in netlify if you are missing them
2+
# https://app.netlify.com/sites/docs-optimism/configuration/env#content
3+
4+
NEXT_PUBLIC_KAPA_WEBSITE_ID=
5+
NEXT_PUBLIC_GROWTHBOOK_API_HOST=
6+
NEXT_PUBLIC_GROWTHBOOK_CLIENT_KEY=
7+
NEXT_PUBLIC_GA_ID=

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.11.0

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
enable-pre-post-scripts=true
2+
use-node-version=20.11.0
3+
use-pnpm-version=10.2.0

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.11.0

components/AskAIButton.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { RiSparkling2Fill } from '@remixicon/react';
2+
import { useFeature } from '@growthbook/growthbook-react';
3+
4+
const AskAIButton = () => {
5+
const enableDocsAIWidget = useFeature('enable_docs_ai_widget').on;
6+
7+
if (!enableDocsAIWidget) {
8+
return null;
9+
}
10+
11+
return (
12+
<button id='custom-ask-ai-button' className='nx-flex nx-gap-2 nx-items-center nx-py-1.5 nx-px-3 nx-rounded-lg nx-text-sm nx-font-semibold' style={{ backgroundColor: '#FF0420', color: 'white', display: 'flex', alignItems: 'center', gap: '4px' }}>
13+
<span>Ask AI</span>
14+
<RiSparkling2Fill size={14} />
15+
</button>
16+
);
17+
};
18+
19+
export { AskAIButton };

lib/growthbook.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// lib/growthbook.ts
2+
import { GrowthBook } from '@growthbook/growthbook-react';
3+
4+
export const growthbook = new GrowthBook({
5+
apiHost: process.env.NEXT_PUBLIC_GROWTHBOOK_API_HOST || '',
6+
clientKey: process.env.NEXT_PUBLIC_GROWTHBOOK_CLIENT_KEY || ''
7+
});
8+
9+
if (process.env.NEXT_PUBLIC_GROWTHBOOK_API_HOST && process.env.NEXT_PUBLIC_GROWTHBOOK_CLIENT_KEY) {
10+
growthbook.init();
11+
}

netlify.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build.environment]
2+
PNPM_VERSION = "10.2.0"
3+
NODE_VERSION = "20.11.0"

notes/kapa-ai-assistant.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# [kapa.ai](http://kapa.ai) assistant details
2+
3+
## Configuration
4+
5+
Everything required for the code configuration for the [kapa.ai](http://kapa.ai) assistant lies in the `theme.config.ts` file of the repo. There you will find the `<script>` tag which brings in the kapa.ai assistant modal into the website.
6+
7+
Configuration details for this script tag can be found in the [kapa.ai](http://kapa.ai) documentation here: https://docs.kapa.ai/
8+
9+
Currently the website has the modal enabled by a custom button component located at `components/AskAIButton.tsx`
10+
11+
## Enabling/disabling the feature
12+
13+
The kapa AI assistant con be toggled on and off on the website by toggling the **`enable_docs_ai_widget`** feature flag.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
"description": "Optimism Docs",
55
"scripts": {
66
"lint": "eslint . --ext mdx --max-warnings 0 && pnpm spellcheck:lint && pnpm check-breadcrumbs && pnpm check-redirects",
7-
"fix": "eslint . --ext mdx --fix && pnpm spellcheck:fix && pnpm check-breadcrumbs && pnpm fix-redirects",
7+
"fix": "eslint . --ext mdx --fix && pnpm spellcheck:fix && pnpm breadcrumbs && pnpm fix-redirects",
88
"spellcheck:lint": "cspell lint \"**/*.mdx\"",
99
"spellcheck:fix": "cspell --words-only --unique \"**/*.mdx\" | sort --ignore-case | uniq > words.txt",
10-
"linkcheck": "lychee --config ./lychee.toml --quiet \"./pages\"",
1110
"breadcrumbs": "npx ts-node --skip-project utils/create-breadcrumbs.ts",
1211
"check-redirects": "npx ts-node --skip-project utils/redirects.ts",
1312
"fix-redirects": "npx ts-node --skip-project utils/fix-redirects.ts",
@@ -22,12 +21,14 @@
2221
"@eth-optimism/contracts-ts": "^0.17.0",
2322
"@eth-optimism/tokenlist": "^9.0.9",
2423
"@feelback/react": "^0.3.4",
24+
"@growthbook/growthbook-react": "^1.3.1",
2525
"@headlessui/react": "^2.1.8",
26+
"@remixicon/react": "^4.6.0",
2627
"algoliasearch": "^4.23.3",
2728
"clsx": "^2.1.1",
2829
"dotenv": "^16.4.7",
2930
"escape-string-regexp": "^5.0.0",
30-
"next": "14.2.15",
31+
"next": "14.2.21",
3132
"next-sitemap": "^4.2.3",
3233
"nextra": "2.13.2",
3334
"nextra-theme-docs": "2.13.2",

pages/_app.tsx

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,47 @@
1-
import '../styles/global.css'
1+
import '../styles/global.css';
22

3-
import { useEffect, useState } from 'react'
4-
import { useRouter } from 'next/router'
5-
import * as gtag from '../utils/gtag'
6-
import * as aa from "search-insights"
7-
import AlgoliaContext from '@/utils/contexts/AlgoliaContext'
8-
import ScrollDispatcher from '@/components/ScrollDispatcher'
3+
import { useEffect, useState } from 'react';
4+
import { useRouter } from 'next/router';
5+
import * as gtag from '../utils/gtag';
6+
import * as aa from 'search-insights';
7+
import AlgoliaContext from '@/utils/contexts/AlgoliaContext';
8+
import ScrollDispatcher from '@/components/ScrollDispatcher';
9+
import { CustomGrowthBookProvider } from '../providers/GrowthbookProvider';
910

1011
export default function App({ Component, pageProps }) {
1112
const [queryID, setQueryID] = useState(null);
1213
const [objectID, setObjectID] = useState(null);
1314

14-
const router = useRouter()
15+
const router = useRouter();
1516
useEffect(() => {
1617
const handleRouteChange = (url) => {
17-
gtag.pageview(url)
18-
}
19-
router.events.on('routeChangeComplete', handleRouteChange)
18+
gtag.pageview(url);
19+
};
20+
router.events.on('routeChangeComplete', handleRouteChange);
2021
return () => {
21-
router.events.off('routeChangeComplete', handleRouteChange)
22-
}
23-
}, [router.events])
22+
router.events.off('routeChangeComplete', handleRouteChange);
23+
};
24+
}, [router.events]);
2425

2526
aa.default('init', {
26-
appId: "JCF9BUJTB9",
27-
apiKey: "cc766a73d4b0004e3059677de49297a2"
28-
})
27+
appId: 'JCF9BUJTB9',
28+
apiKey: 'cc766a73d4b0004e3059677de49297a2'
29+
});
2930

3031
return (
31-
<AlgoliaContext.Provider
32-
value={{
33-
queryID,
34-
setQueryID,
35-
objectID,
36-
setObjectID,
37-
}}
38-
>
39-
<ScrollDispatcher>
40-
<Component {...pageProps} />
41-
</ScrollDispatcher>
42-
</AlgoliaContext.Provider>
43-
)
32+
<CustomGrowthBookProvider>
33+
<AlgoliaContext.Provider
34+
value={{
35+
queryID,
36+
setQueryID,
37+
objectID,
38+
setObjectID
39+
}}
40+
>
41+
<ScrollDispatcher>
42+
<Component {...pageProps} />
43+
</ScrollDispatcher>
44+
</AlgoliaContext.Provider>
45+
</CustomGrowthBookProvider>
46+
);
4447
}
45-

0 commit comments

Comments
 (0)