Files
web/apps/base-docs/docusaurus.config.js
Brendan from DeFi 100e7604fd Feat/add events to docs (#587)
* Created logEvent utility

* Added event tracking to OCS Banner

* Created CustomNavbarLink with event tracking

* created custom navbar dropdown link with event tracking

* added event tracking to P0 navbar elements

* Added eventDetail parameter to event tracking

* Updated Bootcamp link

* enforced cursor pointer on custom navbar links

* updated navbar elements to include event tracking

* event tracking for navbar social links

* added target property to custom navbar elements

* made links to off-domain locations open in new tab

* updated tutorials data

* implemented tracking on connect wallet buttons

* removed duplicate connect button from StudentProgress component

* Links now send events with high importance

* Cleaned up StudentProgress component

* Social clicks use useCallback

* bugfix for logEvent

* created callbacks for social click handlers

* improved social click callbacks

* updated event names

* updated connect wallet event names on base.org

* added full typing to logEvent utility

* refactored logEvent typing

* added userId to event data options

* updated base-docs logEvent immplementations

* updated Connect Wallet event for base.org

* changed component_type to the expected

* Updated event logging for onchain summer banner
2024-06-25 15:06:59 -07:00

351 lines
8.7 KiB
JavaScript

const dotenv = require('dotenv');
dotenv.config();
const baseConfig = {
baseUrl: '/',
favicon: 'img/favicon.ico',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
organizationName: 'frontend',
projectName: 'web',
themeConfig: {
docs: {
sidebar: {
autoCollapseCategories: true,
hideable: true,
},
},
},
};
const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/oceanicNext');
const APP_TITLE = 'Base';
const PRODUCT_NAME = 'Base';
const config = {
...baseConfig,
title: APP_TITLE,
tagline: '',
url: 'https://docs.base.org',
headTags: [
{
tagName: 'meta',
attributes: {
property: 'og:type',
content: 'website',
},
},
{
tagName: 'meta',
attributes: {
property: 'og:title',
content: 'Base | Docs',
},
},
{
tagName: 'meta',
attributes: {
property: 'og:description',
content:
'Explore the documentation for Base, a secure, low-cost, builder-friendly Ethereum L2.',
},
},
{
tagName: 'meta',
attributes: {
property: 'og:image',
content: 'https://docs.base.org/img/base-open-graph.png',
},
},
{
tagName: 'meta',
attributes: {
name: 'twitter:card',
content: 'summary_large_image',
},
},
{
tagName: 'meta',
attributes: {
property: 'twitter:domain',
content: 'base.org',
},
},
{
tagName: 'meta',
attributes: {
name: 'twitter:title',
content: 'Base | Docs',
},
},
{
tagName: 'meta',
attributes: {
name: 'twitter:description',
content:
'Explore the documentation for Base, a secure, low-cost, builder-friendly Ethereum L2.',
},
},
{
tagName: 'meta',
attributes: {
name: 'twitter:image',
content: 'https://docs.base.org/img/base-open-graph.png',
},
},
],
customFields: {
nodeEnv: process.env.NODE_ENV,
sprigEnvironmentId: 'Q2ppiEaeSEJI',
},
presets: [
[
'classic',
{
docs: {
sidebarPath: require.resolve('./sidebars.js'),
routeBasePath: '/docs',
},
theme: {
customCss: [
require.resolve('./src/css/custom.css'),
require.resolve('@rainbow-me/rainbowkit/styles.css'),
],
},
},
],
],
plugins: [
[
'@docusaurus/plugin-content-docs',
{
id: 'base-camp',
path: 'base-camp',
routeBasePath: 'base-camp',
sidebarPath: require.resolve('./base-camp/sidebars.js'),
},
],
[
'@docusaurus/plugin-content-docs',
{
id: 'tutorials',
path: 'tutorials',
routeBasePath: 'tutorials',
sidebarPath: require.resolve('./tutorials/sidebars.js'),
breadcrumbs: false,
},
],
'docusaurus-node-polyfills',
[
'@docusaurus/plugin-client-redirects',
{
createRedirects(existingPath) {
if (existingPath.includes('/tutorials')) {
return [existingPath.replace('/tutorials', '/guides')];
}
return undefined;
},
},
],
],
scripts: [
{
src: 'https://static-assets.coinbase.com/js/cca/v0.0.1.js',
async: true,
},
],
clientModules: [require.resolve('./src/utils/initCCA.ts')],
themeConfig: {
image: 'img/base-open-graph.png',
...baseConfig.themeConfig,
navbar: {
logo: {
alt: `${PRODUCT_NAME} Docs`,
src: 'img/logo.svg',
srcDark: 'img/logo_dark.svg',
},
items: [
{
to: '/',
exact: true,
navposition: 'bottomLeft',
label: 'Home',
},
{
type: 'doc',
docId: 'overview',
navposition: 'bottomLeft',
label: 'Docs',
},
{
to: '/tutorials',
navposition: 'bottomLeft',
label: 'Tutorials',
type: 'custom-navbarLink',
eventLabel: 'tutorials',
eventContext: 'navbar',
},
{
to: '/base-camp/docs/welcome',
navposition: 'bottomLeft',
label: 'Camp',
items: [
{
label: 'Learn',
to: '/base-camp/docs/welcome',
type: 'custom-dropdownLink',
eventLabel: 'camp_learn',
eventContext: 'navbar',
},
{
label: 'Track your progress',
to: '/base-camp/progress',
type: 'custom-dropdownLink',
eventLabel: 'camp_trackprogress',
eventContext: 'navbar',
},
{
label: 'Bootcamp',
to: 'https://base.org/bootcamp',
target: '_blank',
type: 'custom-dropdownLink',
eventLabel: 'camp_bootcamp',
eventContext: 'navbar',
},
],
},
{
type: 'dropdown',
label: 'Ecosystem',
navposition: 'topRight',
items: [
{
label: 'Apps',
to: 'https://www.base.org/ecosystem',
target: '_blank',
type: 'custom-dropdownLink',
eventLabel: 'ecosystem_apps',
eventContext: 'navbar',
},
{
label: 'Grants',
to: 'https://paragraph.xyz/@grants.base.eth/calling-based-builders',
target: '_blank',
type: 'custom-dropdownLink',
eventLabel: 'ecosystem_grants',
eventContext: 'navbar',
},
],
},
{
label: 'Bridge',
navposition: 'topRight',
to: 'https://bridge.base.org/',
target: '_blank',
type: 'custom-navbarLink',
eventLabel: 'bridge',
eventContext: 'navbar',
},
{
type: 'dropdown',
label: 'Builders',
navposition: 'topRight',
items: [
{
label: 'Block Explorer',
to: 'https://base.blockscout.com/',
target: '_blank',
type: 'custom-dropdownLink',
eventLabel: 'builders_blockexplorer',
eventContext: 'navbar',
},
{
label: 'Status',
to: 'https://status.base.org/',
target: '_blank',
type: 'custom-dropdownLink',
eventLabel: 'builders_status',
eventContext: 'navbar',
},
{
label: 'Bug Bounty',
to: 'https://hackerone.com/coinbase',
target: '_blank',
type: 'custom-dropdownLink',
eventLabel: 'builders_bugbounty',
eventContext: 'navbar',
},
],
},
{
type: 'dropdown',
label: 'About',
navposition: 'topRight',
items: [
{
label: 'Mission',
to: 'https://www.base.org/about',
target: '_blank',
type: 'custom-dropdownLink',
eventLabel: 'about_mission',
eventContext: 'navbar',
},
{
label: 'Blog',
to: 'https://base.mirror.xyz/',
target: '_blank',
type: 'custom-dropdownLink',
eventLabel: 'about_blog',
eventContext: 'navbar',
},
{
label: 'Jobs',
to: 'https://www.base.org/jobs',
target: '_blank',
type: 'custom-dropdownLink',
eventLabel: 'about_jobs',
eventContext: 'navbar',
},
],
},
// Langauge selection dropdown will be supported in the future
// {
// type: 'localeDropdown',
// navposition: 'bottomRight',
// },
],
},
algolia: {
// Application ID
appId: 'EG1Y9QIPP9',
// Public API key - safe to commit
apiKey: '59218c35b3c3e1aa3cdca101ca109839',
indexName: 'prod',
contextualSearch: false,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ['solidity'],
},
colorMode: {
defaultMode: 'dark',
disableSwitch: false,
respectPrefersColorScheme: false,
},
},
// Langauge selection dropdown will be supported in the future
// i18n: {
// defaultLocale: 'en',
// locales: ['en', 'fr'],
// localeConfigs: {},
// },
};
module.exports = config;