chore: merged with main

This commit is contained in:
Junior Garcia 2024-11-21 08:48:39 -03:00
commit 34bb098be8
31 changed files with 1558 additions and 1898 deletions

View File

@ -16,4 +16,8 @@ NEXT_PUBLIC_PREVIEW=true/false
## Featurebase
NEXT_PUBLIC_FB_FEEDBACK_ORG=
NEXT_PUBLIC_FB_FEEDBACK_URL=
NEXT_PUBLIC_FB_FEEDBACK_URL=
# PostHog
NEXT_PUBLIC_POSTHOG_KEY=your-posthog-key
NEXT_PUBLIC_POSTHOG_HOST=your-posthog-host

View File

@ -1,10 +1,17 @@
"use client";
import type {ReactNode} from "react";
import * as React from "react";
import {NextUIProvider} from "@nextui-org/react";
import {ThemeProvider as NextThemesProvider} from "next-themes";
import {ThemeProviderProps} from "next-themes/dist/types";
import {useRouter} from "next/navigation";
import {useEffect} from "react";
import posthog from "posthog-js";
import {PostHogProvider} from "posthog-js/react";
import {__PROD__} from "@/utils";
export interface ProvidersProps {
children: React.ReactNode;
@ -14,9 +21,29 @@ export interface ProvidersProps {
export function Providers({children, themeProps}: ProvidersProps) {
const router = useRouter();
const ProviderWrapper = ({children}: {children: ReactNode}) => {
useEffect(() => {
if (typeof window !== "undefined") {
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
api_host: "/ingest",
person_profiles: "identified_only",
ui_host: process.env.NEXT_PUBLIC_POSTHOG_HOST,
});
}
}, []);
if (__PROD__) {
return <PostHogProvider client={posthog}>{children}</PostHogProvider>;
}
return children;
};
return (
<NextUIProvider navigate={router.push}>
<NextThemesProvider {...themeProps}>{children}</NextThemesProvider>
</NextUIProvider>
<ProviderWrapper>
<NextUIProvider navigate={router.push}>
<NextThemesProvider {...themeProps}>{children}</NextThemesProvider>
</NextUIProvider>
</ProviderWrapper>
);
}

View File

@ -6,15 +6,17 @@ import Balancer from "react-wrap-balancer";
import {format, parseISO} from "date-fns";
import NextLink from "next/link";
import {AnimatePresence, motion} from "framer-motion";
import {usePostHog} from "posthog-js/react";
import {useIsMounted} from "@/hooks/use-is-mounted";
import {trackEvent} from "@/utils/va";
const BlogPostCard = (post: BlogPost) => {
const isMounted = useIsMounted();
const posthog = usePostHog();
const handlePress = () => {
trackEvent("BlogPostCard - Selection", {
posthog.capture("BlogPostCard - Selection", {
name: post.title,
action: "click",
category: "blog",

View File

@ -15,6 +15,7 @@ import {isAppleDevice, isWebKit} from "@react-aria/utils";
import {create} from "zustand";
import {isEmpty, intersectionBy} from "@nextui-org/shared-utils";
import {writeStorage, useLocalStorage} from "@rehooks/local-storage";
import {usePostHog} from "posthog-js/react";
import {
DocumentCodeBoldIcon,
@ -25,7 +26,6 @@ import {
import searchData from "@/config/search-meta.json";
import {useUpdateEffect} from "@/hooks/use-update-effect";
import {trackEvent} from "@/utils/va";
const hideOnPaths = ["examples"];
@ -139,6 +139,8 @@ export const Cmdk: FC<{}> = () => {
const {isOpen, onClose, onOpen} = useCmdkStore();
const posthog = usePostHog();
const [recentSearches] = useLocalStorage<SearchResultItem[]>(RECENT_SEARCHES_KEY);
const addToRecentSearches = (item: SearchResultItem) => {
@ -196,7 +198,7 @@ export const Cmdk: FC<{}> = () => {
const matches = intersectionBy(...matchesForEachWord, "objectID").slice(0, MAX_RESULTS);
trackEvent("Cmdk - Search", {
posthog.capture("Cmdk - Search", {
name: "cmdk - search",
action: "search",
category: "cmdk",
@ -219,7 +221,7 @@ export const Cmdk: FC<{}> = () => {
e.preventDefault();
isOpen ? onClose() : onOpen();
trackEvent("Cmdk - Open/Close", {
posthog.capture("Cmdk - Open/Close", {
name: "cmdk - open/close",
action: "keydown",
category: "cmdk",
@ -241,7 +243,7 @@ export const Cmdk: FC<{}> = () => {
router.push(item.url);
addToRecentSearches(item);
trackEvent("Cmdk - ItemSelect", {
posthog.capture("Cmdk - ItemSelect", {
name: item.content,
action: "click",
category: "cmdk",

View File

@ -2,11 +2,11 @@
import {useRef} from "react";
import {Button} from "@nextui-org/react";
import {trackEvent} from "@/utils/va";
import {usePostHog} from "posthog-js/react";
export const CustomButton = () => {
const buttonRef = useRef<HTMLButtonElement | null>(null);
const posthog = usePostHog();
const handleConfetti = async () => {
const {clientWidth, clientHeight} = document.documentElement;
@ -29,7 +29,7 @@ export const CustomButton = () => {
},
});
trackEvent("LandingPage - Confetti Button", {
posthog.capture("LandingPage - Confetti Button", {
action: "press",
category: "landing-page",
});

View File

@ -1,10 +1,10 @@
import {Button, ButtonProps, Code, Link, Tooltip} from "@nextui-org/react";
import {ReactNode} from "react";
import Balancer from "react-wrap-balancer";
import {usePostHog} from "posthog-js/react";
import {GithubIcon, NpmIcon, AdobeIcon, StorybookIcon, NextJsIcon} from "@/components/icons";
import {COMPONENT_PATH, COMPONENT_THEME_PATH} from "@/libs/github/constants";
import {trackEvent} from "@/utils/va";
export interface ComponentLinksProps {
component: string;
@ -26,10 +26,12 @@ const ButtonLink = ({
href: string;
tooltip?: string | ReactNode;
}) => {
const posthog = usePostHog();
const handlePress = () => {
if (!href) return;
trackEvent("ComponentLinks - Click", {
posthog.capture("ComponentLinks - Click", {
category: "docs",
action: "click",
data: href || "",

View File

@ -2,6 +2,7 @@
import * as React from "react";
import {Link} from "@nextui-org/react";
import {usePostHog} from "posthog-js/react";
import {useRouter} from "next/navigation";
import {ChevronIcon} from "@nextui-org/shared-icons";
@ -9,7 +10,6 @@ import manifest from "@/config/routes.json";
import {removeFromLast} from "@/utils";
import {Route} from "@/libs/docs/page";
import {useDocsRoute} from "@/hooks/use-docs-route";
import {trackEvent} from "@/utils/va";
export interface FooterNavProps {
currentRoute?: Route;
@ -20,8 +20,10 @@ export const DocsPager: React.FC<FooterNavProps> = ({currentRoute}) => {
const {prevRoute, nextRoute} = useDocsRoute(manifest.routes, currentRoute);
const posthog = usePostHog();
const handlePress = (path: string) => {
trackEvent("DocsPager - Click", {
posthog.capture("DocsPager - Click", {
category: "docs",
action: "click",
data: path || "",

View File

@ -1,6 +1,7 @@
"use client";
import {FC, useEffect, useState} from "react";
import {usePostHog} from "posthog-js/react";
import {ChevronIcon} from "@nextui-org/shared-icons";
import {CollectionBase, Expandable, MultipleSelection, Node, ItemProps} from "@react-types/shared";
import {BaseItem} from "@nextui-org/aria-utils";
@ -27,7 +28,6 @@ import {getRoutePaths} from "./utils";
import {Route} from "@/libs/docs/page";
import {TreeKeyboardDelegate} from "@/utils/tree-keyboard-delegate";
import {trackEvent} from "@/utils/va";
import {FbFeedbackButton} from "@/components/featurebase/fb-feedback-button";
import {FbChangelogButton} from "@/components/featurebase/fb-changelog-button";
import {FbRoadmapLink} from "@/components/featurebase/fb-roadmap-link";
@ -66,6 +66,7 @@ function TreeItem<T>(props: TreeItemProps<T>) {
const router = useRouter();
const pathname = usePathname();
const posthog = usePostHog();
const paths = item.props.path
? getRoutePaths(item.props.path, item.props?.tag)
@ -109,7 +110,7 @@ function TreeItem<T>(props: TreeItemProps<T>) {
} else {
router.push(paths.pathname);
trackEvent("SidebarDocs", {
posthog.capture("SidebarDocs", {
category: "docs",
action: "click",
data: paths.pathname || "",

View File

@ -1,8 +1,7 @@
"use client";
import {useEffect} from "react";
import {trackEvent} from "@/utils/va";
import {usePostHog} from "posthog-js/react";
type Props = {
className?: string;
@ -10,6 +9,8 @@ type Props = {
// ref: https://developers.featurebase.app/install/changelog-widget/install
export const FbChangelogButton = ({className}: Props) => {
const posthog = usePostHog();
useEffect(() => {
const win = window as any;
@ -31,7 +32,7 @@ export const FbChangelogButton = ({className}: Props) => {
const fbButtonOnClick = () => {
(window as any).Featurebase("manually_open_changelog_popup");
trackEvent("Featurebase - Changelog", {
posthog.capture("Featurebase - Changelog", {
name: "featurebase-changelog",
action: "press",
category: "featurebase",

View File

@ -1,8 +1,7 @@
"use client";
import {useEffect} from "react";
import {trackEvent} from "@/utils/va";
import {usePostHog} from "posthog-js/react";
type Props = {
className?: string;
@ -10,6 +9,8 @@ type Props = {
// ref: https://developers.featurebase.app/install/feedback-widget/setup
export const FbFeedbackButton = ({className}: Props) => {
const posthog = usePostHog();
useEffect(() => {
const win = window as any;
@ -27,7 +28,7 @@ export const FbFeedbackButton = ({className}: Props) => {
}, []);
const fbButtonOnClick = () => {
trackEvent("Featurebase - Feedback", {
posthog.capture("Featurebase - Feedback", {
name: "featurebase-feedback",
action: "press",
category: "featurebase",

View File

@ -1,20 +1,21 @@
"use client";
import NextLink from "next/link";
import {usePostHog} from "posthog-js/react";
import arrowRightUpIcon from "@iconify/icons-solar/arrow-right-up-linear";
import {Icon} from "@iconify/react/dist/offline";
import {clsx} from "@nextui-org/shared-utils";
import {trackEvent} from "@/utils/va";
type Props = {
className?: string;
innerClassName?: string;
};
export const FbRoadmapLink = ({className, innerClassName}: Props) => {
const posthog = usePostHog();
const fbLinkOnClick = () => {
trackEvent("Featurebase - Roadmap", {
posthog.capture("Featurebase - Roadmap", {
name: "featurebase-roadmap",
action: "press",
category: "featurebase",

View File

@ -1,25 +1,28 @@
"use client";
import {Button, Link} from "@nextui-org/react";
import {usePostHog} from "posthog-js/react";
import {trackEvent} from "@/utils/va";
export const FigmaButton = () => {
const posthog = usePostHog();
export const FigmaButton = () => (
<Button
isExternal
showAnchorIcon
as={Link}
className="max-w-fit text-current"
color="default"
href="https://www.figma.com/community/file/1267584376234254760"
variant="bordered"
onPress={() => {
trackEvent("FigmaPage - Open Figma Link", {
action: "click",
category: "figma",
});
}}
>
Open in Figma
</Button>
);
return (
<Button
isExternal
showAnchorIcon
as={Link}
className="max-w-fit text-current"
color="default"
href="https://www.figma.com/community/file/1267584376234254760"
variant="bordered"
onPress={() => {
posthog.capture("FigmaPage - Open Figma Link", {
action: "click",
category: "figma",
});
}}
>
Open in Figma
</Button>
);
};

View File

@ -89,319 +89,3 @@ export const CodeRabbitLogo = () => (
/>
</svg>
);
export const ScrumbuissLogo = () => (
<svg
height="35px"
version="1.1"
viewBox="307 646 1434 262"
width="200px"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="m0 0 4 2 12 10 11 9 8 8 8 7 15 13 27 27 5 4 7 8 13 15 9 10 13 17 18 27 8 14 10 19 8 19 9 27 2 9v7l-4 6-5 3-2 1h-6l-11-7-14-12-8-7-12-11-10-8-11-10-8-7-10-9-11-9-10-9-8-6v-2l-3-1-3-3-9-7-11-9-19-14-8-7h-2l9 22 10 18 5 10 12 18 10 14 4 6v7l-8 7h-7l-11-9-10-8-22-14-22-10-27-11-22-7 4 18 9 17 4 9-1 2-10-13-8-14-5-13v-10l4-6h9l19 4 34 11 13 4 2 1-13-23-8-16-12-27-4-11 1-8 5-6 10-4 13 1 13 5 15 9 12 8 16 12 13 10 10 9 10 8 11 9 10 9 8 7 14 13 8 7 12 11 5 5-3-9-4-9-10-20-10-17-11-17-12-18-10-13-14-18-11-13-9-11-12-13-7-8-12-14-18-20v-2l-3-1z"
fill="#E87246"
transform="translate(391,646)"
/>
<path
d="m0 0h28l1 1v72h2l2-4 9-9 10-6 7-2h22l8 3 11 7 8 10 4 8 2 7 1 9v14l-2 15-6 12-9 10-8 8-12 6-10 3-13 1-14-3-5-2 4-1 11 3h10l8-3 7-3 9-7 8-14 3-8 1-6v-30l-4-13-6-10-8-7-7-3-5-1h-8l-10 3-10 6-8 9-1 2-1 79-10 7-9 2h-8l2-4 6-7v-143l-3-5v-2l-6-2z"
fill="#E8764A"
transform="translate(1287,696)"
/>
<path
d="m0 0h37l-6 7-3 4v73l3 11 6 8 6 4 3 1h15l10-4 7-7 3-5 1-4 1-72-2-8-4-5-3-3h38l-6 7-3 4-1 32v45l1 15 3 5 8 5v1h-12l-8-3-8-7-4-9-5 8-5 4-10 5-5 1h-19l-12-5-7-7-6-9-3-10-1-7-1-65-5-6-3-2z"
fill="#E87649"
transform="translate(1412,747)"
/>
<path
d="m0 0 13 1 10 5 11 10 4 9 2 2 1 75 3 5 6 4 1 3h-39l2-4 6-4 1-2v-77l-3-10-5-6-10-5h-13l-14 6-9 6-1 66v13l1 10 6 2 3 2v3h-37v-3l7-6 1-2v-66h-2l-2 4-12 13-7 8v-3l12-14 9-10h2l2-4 6-7 11-9 9-6 16-8z"
fill="#E87347"
transform="translate(1150,747)"
/>
<path
d="m0 0 16 1 13 4 9 7 8 8 4 6-1 2-11-13-10-7-6-3-11-2h-12l-12 2-6 3-7 6-5 8-2 6v12l4 9 5 5 10 7 19 8 22 9 16 12 7 8 3 6 2 11v9l-2 13-5 10-11 12-12 6-16 4h-10l-16-4-12-6-8-8-7-13-2-10 1-4 2 3 3 12 4 8 10 10 15 6 7 2 15 1 13-5 9-6h2l2-4 4-5 4-11v-8l-4-11-5-6-11-7-26-12-16-7-12-9-8-9-4-9-1-4v-19l4-12 8-10 8-7 13-4z"
fill="#E87246"
transform="translate(702,694)"
/>
<path
d="m0 0h38l-3 4h-2l-4 8v70l3 13 4 6 6 5 6 2h12l11-4 10-9 5-5 8-11 10-12 5-5-2 4-3 4-1 11v22l5 5 6 4v2h-10l-9-3-6-5-4-9v-2l-3 3-6 7-14 7-4 1h-19l-10-4-8-6-8-15-2-8-1-9-1-60-9-10z"
fill="#E87246"
transform="translate(964,747)"
/>
<path
d="m0 0 14 1 10 5 9 8 5 10 3 13 1 61 2 10 5 2 4 4h-39l2-4 5-4 1-6v-63l-1-13-4-10-7-6-6-2h-14l-12 6-7 8-3 6-1-4 5-8 8-8 10-5z"
fill="#E87447"
transform="translate(1223,747)"
/>
<path
d="m0 0h13l16 1-1 25v74l2 7 8 5v2h-38l2-4 5-5 1-3v-90l-4-6-4-5z"
fill="#E87246"
transform="translate(882,747)"
/>
<path
d="m0 0 5 2 5 5 3 6v9l-4 11-7 13-1 4-1 60v18l1 16 5 4 7 4v2h-41l2-4 6-4 2-4 1-8v-81l-3-5-6-6 1-2 5 1h12l8-3 7-9 3-6v-11l-4-6-6-5z"
fill="#E87145"
transform="translate(1567,707)"
/>
<path
d="m0 0h9l10 2 13 7 12 11 7 11-1 3-7-11-5-6-10-7-11-5-13-2-10 3-11 6-5 4-6 9-6 15-1 5v20l5 15 6 12 9 10 8 5 13 4h11l10-3 8-4 3-3h2v-2h2l2-4 7-10 2 1-8 12-8 8-17 8-7 2h-16l-16-5-12-6-8-8-7-10-5-15-1-6v-19l5-16 6-9 8-9 14-8 12-4z"
fill="#E87347"
transform="translate(817,747)"
/>
<path
d="m0 0h37l-6 7-3 4v73l3 11 6 8 2 3v3h-6l-6-3-7-6-1-5h-2l-6-8-2-12-1-65-5-6-3-2z"
fill="#E8774A"
transform="translate(1412,747)"
/>
<path
d="m0 0 15 1-3 2-12 1-16 8-8 5-1 66v13l1 10 6 2 3 2v3h-37v-3l7-6 1-2v-66h-2l-2 4-12 13-7 8v-3l12-14 9-10h2l2-4 6-7 11-9 9-6z"
fill="#E87549"
transform="translate(1141,748)"
/>
<path
d="m0 0h22l8 3 11 7 8 10 4 8 2 7 1 9v14l-2 15-6 12-9 10-8 8-12 6-10 3-13 1-14-3-5-2 4-1 11 3h10l8-3 7-3 9-7 8-14 3-8 1-6v-30l-4-13-6-10-8-7-7-3-5-1h-8l-10 3-10 6-7 8-3-1h2l2-4 9-9 10-6z"
fill="#E8764A"
transform="translate(1346,748)"
/>
<path
d="m0 0h12l10 4 10 8 7 9 8 16 10 31-1 4-8-24-5-13-6-11-6-8-1-3-4-2-9-6-4-2h-13l-12 6-6 7-1 3v10l4 6 8 6 11 5 12 4 19 9 7 6 5 9 1 2v13l-3 8-9 10-9 4-4 1h-19l-11-4-7-8-3-6 1-2 7 11 8 5 5 1h18l10-3 5-5 3-8v-7l-4-6-9-6-24-10-17-9-8-8-3-7-1-15 2-9 4-6 10-7z"
fill="#EFB382"
transform="translate(1613,747)"
/>
<path
d="m0 0h14l12 4 14 8 4 5-5-2-14-8-10-4-11-1-16 8-5 5-1 3v12l6 7 12 7 19 7 17 8 8 8 5 10v10l-4 10-6 8-5 4-9 3h-22l-7-3-6-4-7-11-4-13-1-9 2 4 6 16 6 10 6 5 7 2h19l10-4 4-5 2-4v-11l-4-6-10-6-22-9-16-8-7-6-6-12-1-4v-9l4-11 5-6 10-6z"
fill="#F0B585"
transform="translate(1692,747)"
/>
<path
d="m0 0h38l-10 10-1 3-1 52-7 8-8 11-2 1-1-74-7-8z"
fill="#E87246"
transform="translate(1040,747)"
/>
<path
d="m0 0 5 3 7 7 9 11 10 11 13 17 18 27 8 14 10 19 8 19 9 27 2 9v7l-4 6-5 3-2 1h-6l-11-7-14-12-8-7-2-3 4 1v2l4 1v2l4 1 7 6v2l3 1 2 2 5 2 6 3 5-1 5-8-1-8-2-10-3-10-4-10-4-14-4-10-5-9v-2h-2l-4-9-3-4-5-10-14-20-2-2-3-5-5-4-12-16-9-11-10-10z"
fill="#F0BA8A"
transform="translate(479,727)"
/>
<path
d="m0 0 4 2 1 3 11 3 14 6 3 2v2l12 2 6 3 10 10 4 5-5 3-10-4-4-3-16-7-9-4-8-3-6-4-4-5-3-5z"
fill="#E87145"
transform="translate(1590,782)"
/>
<path
d="m0 0v3l-4 5-1 11v22l5 5 6 4v2h-10l-9-3-6-5-4-9v-2l-3 1 1-4 5-5 7-9z"
fill="#E87549"
transform="translate(1072,809)"
/>
<path
d="m0 0h12l10 4 10 8 7 9 8 16 10 31-1 4-8-24-5-13-6-11-6-8-1-3-4-2-9-6-4-2h-13l-12 6-6 7-1 3v10l4 6 8 6 5 3-2 1-7-2-7-3-5-5-2 4-1-14 2-9 4-6 10-7z"
fill="#EFAF7F"
transform="translate(1613,747)"
/>
<path
d="m0 0 5 2 10 6 1 4 9 3 10 4 4 1 1 2 5 3 3 2 1 6-4 1-10-6-11-5-12-5-4-1v-2l-6-2-4-4v-8z"
fill="#E87145"
transform="translate(1678,786)"
/>
<path
d="m0 0 5 2 5 5 3 6v9l-4 11-7 13-1 4-1 60v34l-2-1-2-10v-20l1-44 1-21-2-4 1-1-5-1 4-2 6-4 7-11 1-2v-11l-4-6-6-5z"
fill="#F1BE8D"
transform="translate(1567,707)"
/>
<path
d="m0 0 27 1v8l-5 5-11 10-2-3-1-9-4-6-4-4z"
fill="#E87549"
transform="translate(1089,747)"
/>
<path
d="m0 0h6l4 4 2 4-1 7-5 5-3 2-6-1-6-7v-7l7-6z"
fill="#E87549"
transform="translate(1557,707)"
/>
<path
d="m0 0h15l6 3 2 2v7l-6 5-5-1-7-8-3-2h-10l-3 1h-9v-1l13-3z"
fill="#E8794C"
transform="translate(933,748)"
/>
<path
d="m0 0 3 3v2h2l3 6 6 5 7 2h3l-1-2 6 1 3 1h15l10-4 7-7 3-5 2 1-5 9-6 5-10 5-5 1h-19l-12-5-7-7-6-10z"
fill="#EFAE7E"
transform="translate(1426,837)"
/>
<path
d="m0 0 5 3 7 7 9 11 10 11 13 17 18 27 3 7-5-2-2-5-4-7-8-12-5-7-2-2-3-5-5-4-12-16-9-11-10-10z"
fill="#F0B887"
transform="translate(479,727)"
/>
<path
d="m0 0 3 3 3 12 4 8 10 10 15 6 7 2 15 1 8-2-1 3-9 2h-10l-16-4-12-6-8-8-7-13-2-10z"
fill="#E9794D"
transform="translate(656,818)"
/>
<path
d="m0 0h12l10 4 10 8 7 9 8 16 10 31-1 4-8-24-5-13-6-11-6-8-1-3-4-2-9-6-4-2h-13l-3 1-1-3z"
fill="#EFB483"
transform="translate(1613,747)"
/>
<path
d="m0 0 5 2 5 5 3 6v9l-4 11-7 13-2 11h-2v-9l-2-4 1-1-5-1 4-2 6-4 7-11 1-2v-11l-4-6-6-5z"
fill="#EEA878"
transform="translate(1567,707)"
/>
<path
d="m0 0h22l4 2h-11l-2 1 2 1v2l-7-1h-8l-10 3-10 6-7 8-3-1h2l2-4 9-9 10-6z"
fill="#EFB383"
transform="translate(1346,748)"
/>
<path
d="m0 0 16 1 13 4 9 7 8 8 4 6-1 2-11-13-10-7-6-3-11-2h-12l-12 2-5 2-4-1 2-2 11-3z"
fill="#EA8658"
transform="translate(702,694)"
/>
<path
d="m0 0 4 2 8 7 28 28h-4l-12-12-4-1v-3l-7-7-4-1-7-7z"
fill="#ED9F70"
transform="translate(439,688)"
/>
<path
d="m0 0 2 4 6 16 6 10 6 5 7 2 17 1v2h-19l-7-3-6-4-7-11-4-13z"
fill="#ED9F70"
transform="translate(1670,819)"
/>
<path
d="m0 0h9l10 2 13 7 12 11 7 11-1 3-7-11-5-6-10-7-11-5-13-2-4-1z"
fill="#EC9465"
transform="translate(817,747)"
/>
<path
d="m0 0h9l6 1-1 2h-14v2l-12 6-7 8-3 6-1-4 5-8 8-8z"
fill="#EFB383"
transform="translate(1213,748)"
/>
<path
d="m0 0 15 1-3 2-12 1-16 8-12 7 2-4 5-4 16-9z"
fill="#EEA777"
transform="translate(1141,748)"
/>
<path
d="m0 0 4 2 12 10 8 7 2 4-4-2h-4l-11-11-4-5v-2l-3-1z"
fill="#EEA676"
transform="translate(391,646)"
/>
<path
d="m0 0 2 1-3 3v2h-2l-1 8 9 1 6-2-1 5-5 3-6-1-6-7v-7z"
fill="#F0BA89"
transform="translate(1555,708)"
/>
<path
d="m0 0 4 2 12 10 8 7 9 7 5 5 10 9-2 2-12-11-15-14-10-8-9-8z"
fill="#EFB282"
transform="translate(459,783)"
/>
<path
d="m0 0h12l10 4 10 8 1 4-3-1v-2l-4-2-9-6-4-2h-13l-3 1-1-3z"
fill="#F0BA8B"
transform="translate(1613,747)"
/>
<path
d="m0 0 4 2 12 19 10 15-1 3-4-5-11-18-10-15z"
fill="#EFB181"
transform="translate(493,769)"
/>
<path d="m0 0 5 2 6 4v1h-12l-8-3v-2l2-1h6z" fill="#EFAD7D" transform="translate(1515,854)" />
<path
d="m0 0h3l9 16 5 10v2l-3-1-8-15v-2h-2l-4-9z"
fill="#F0BD8C"
transform="translate(542,810)"
/>
<path
d="m0 0 17 2v1l-9 1v2l3 5v33h-1l-1-31-3-5-6-6z"
fill="#F0BA89"
transform="translate(1541,747)"
/>
<path
d="m0 0 7 1 8 2h10l9-3 3 1-1 3-12 2-12-1-12-4z"
fill="#EC9566"
transform="translate(1323,855)"
/>
<path
d="m0 0 8 1 11 4 13 8 3 4-5-2-14-8-10-4-6-2z"
fill="#F1BE8D"
transform="translate(1701,747)"
/>
<path
d="m0 0 3 1 4 2-10 3-10 6-7 8-3-1h2l2-4 9-9z"
fill="#EFB181"
transform="translate(1339,750)"
/>
<path
d="m0 0 10 3 9 7 8 8 4 6-1 2-11-13-10-7-10-5z"
fill="#EC9365"
transform="translate(721,696)"
/>
<path d="m0 0 11 7 2 1v2h-28v-1h18z" fill="#F0B887" transform="translate(1567,851)" />
<path
d="m0 0h9v1l-10 3-11 6-6 5 2-4 3-3-1-2 7-4z"
fill="#ED9F72"
transform="translate(1692,747)"
/>
<path d="m0 0h2l-2 6 3 3-1 3h-12l2-4 6-4z" fill="#EFB584" transform="translate(1549,849)" />
<path d="m0 0h4l-2 4-6 5-11 4h-9v-1l16-4 5-3z" fill="#F0B989" transform="translate(1651,846)" />
<path
d="m0 0 2 1-8 12-8 8-8 4h-2v-2l8-4 3-3h2v-2h2l2-4z"
fill="#EB8C5E"
transform="translate(868,832)"
/>
<path
d="m0 0 2 2-7 11-14 14-6 3 1-3 6-4 10-10 7-10z"
fill="#F0BC8B"
transform="translate(1396,824)"
/>
<path d="m0 0 9 6 7 7 7 11-1 3-7-11-5-6-10-7z" fill="#EC9B6C" transform="translate(845,754)" />
<path d="m0 0 2 2-2 3-1 32h-1l-1-10v-21z" fill="#F0BB8A" transform="translate(1515,753)" />
<path
d="m0 0 4 1 11 7 8 10 3 6-2 1-6-10-7-7-11-7z"
fill="#F0B685"
transform="translate(1372,750)"
/>
<path d="m0 0 2 4 6 16 3 7-4-1-5-13-2-8z" fill="#F0B585" transform="translate(1670,819)" />
<path d="m0 0 1 3-7 7-9 11-6 5 2-4 11-13z" fill="#EFB080" transform="translate(1094,783)" />
<path d="m0 0 2 2 10 21 1 5h-2l-9-20-3-7z" fill="#EFB383" transform="translate(524,817)" />
<path d="m0 0 8 6 15 14-1 2-12-11-10-9z" fill="#EEAC7C" transform="translate(508,825)" />
<path
d="m0 0 5 2 5 5 3 6v9l-3 3v-13l-4-6-6-5z"
fill="#EFB080"
transform="translate(1567,707)"
/>
<path
d="m0 0 4 2 6 5v3l10 10-1 2-12-12-4-5v-2l-3-1z"
fill="#E87145"
transform="translate(391,646)"
/>
<path d="m0 0 3 3 3 12 3 7h-3l-4-8-2-10z" fill="#E97D51" transform="translate(656,818)" />
<path d="m0 0 2 1-5 9-6 5h-2l2-4 8-9z" fill="#EEAA7A" transform="translate(1493,839)" />
<path d="m0 0 15 1-3 2-15 1v-3z" fill="#F0B887" transform="translate(1141,748)" />
<path d="m0 0 4 2 8 10v2l-4-2-6-7z" fill="#EFAD7D" transform="translate(439,688)" />
<path d="m0 0 3 3v2h2l3 6 6 5v2l-4-2-8-9-3-6z" fill="#EFB282" transform="translate(1426,837)" />
<path
d="m0 0m-1 1m-1 1m-1 1 1 3-7 8-3 6-1-4 5-8z"
fill="#EEA777"
transform="translate(1203,753)"
/>
<path d="m0 0 3 1 4 2-10 3-4 1 2-4z" fill="#EEA475" transform="translate(1339,750)" />
<path d="m0 0 8 1 11 4-1 2-18-6z" fill="#EFB383" transform="translate(1701,747)" />
<path d="m0 0 4 1 7 7 4 6-1 2-11-13z" fill="#ED9F70" transform="translate(737,706)" />
<path d="m0 0h3l6 7 4 3-6-1-5-5z" fill="#EEA575" transform="translate(1679,846)" />
<path d="m0 0 4 1 7 6v3l-3-1v-2l-4-2-4-3z" fill="#F3C49F" transform="translate(1635,753)" />
<path d="m0 0h6l1 3-8-1zm4 3 3 2h-17v-1z" fill="#EA875A" transform="translate(1223,747)" />
<path d="m0 0m-1 1 3 2-12 7 2-4 5-4z" fill="#EDA273" transform="translate(1123,757)" />
<path d="m0 0 5 4 7 9-2 2-8-10z" fill="#EFB483" transform="translate(446,707)" />
<path d="m0 0 1 2-4 9h-3v-3z" fill="#ED9F70" transform="translate(1578,731)" />
<path d="m0 0h10l-1 2-9 1-3 1-1-3z" fill="#F3CBA5" transform="translate(1613,747)" />
<path d="m0 0h9l-2 4 1 4-7-6z" fill="#F0B887" transform="translate(1486,747)" />
<path d="m0 0h4l-2 4-4 4h-2l2-5z" fill="#EC9A6B" transform="translate(1651,846)" />
<path d="m0 0 4 2 6 5-4 1-3-3v-2l-3-1z" fill="#EA8255" transform="translate(391,646)" />
<path d="m0 0 5 1-4 1z" fill="#F1BE8D" transform="translate(1318,853)" />
<path d="m0 0" fill="#F1BE8D" transform="translate(1316,852)" />
</svg>
);

View File

@ -1,13 +1,12 @@
"use client";
import React, {ReactNode} from "react";
import {usePostHog} from "posthog-js/react";
import {tv} from "tailwind-variants";
import {Card, CardHeader, CardBody, LinkProps, SlotsToClasses} from "@nextui-org/react";
import {useRouter} from "next/navigation";
import {LinkIcon} from "@nextui-org/shared-icons";
import {trackEvent} from "@/utils/va";
const styles = tv({
slots: {
base: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",
@ -37,10 +36,12 @@ interface FeaturesGridProps {
export const FeaturesGrid: React.FC<FeaturesGridProps> = ({features, classNames, ...props}) => {
const router = useRouter();
const posthog = usePostHog();
const slots = styles();
const handleClick = (feat: Feature) => {
trackEvent("FeaturesGrid - Click", {
posthog.capture("FeaturesGrid - Click", {
name: feat.title,
action: "click",
category: "docs",

View File

@ -4,20 +4,22 @@ import NextLink from "next/link";
import {Button, Link, Chip, Snippet} from "@nextui-org/react";
import {ArrowRightIcon} from "@nextui-org/shared-icons";
import dynamic from "next/dynamic";
import {usePostHog} from "posthog-js/react";
import {FloatingComponents} from "./floating-components";
import {GithubIcon} from "@/components/icons";
import {title, subtitle} from "@/components/primitives";
import {trackEvent} from "@/utils/va";
const BgLooper = dynamic(() => import("./bg-looper").then((mod) => mod.BgLooper), {
ssr: false,
});
export const Hero = () => {
const posthog = usePostHog();
const handlePressAnnouncement = (name: string, url: string) => {
trackEvent("NavbarItem", {
posthog.capture("NavbarItem", {
name,
action: "press",
category: "home - hero",
@ -68,7 +70,7 @@ export const Hero = () => {
radius="full"
size="lg"
onPress={() => {
trackEvent("Hero - Get Started", {
posthog.capture("Hero - Get Started", {
name: "Get Started",
action: "click",
category: "landing-page",
@ -84,7 +86,7 @@ export const Hero = () => {
radius: "full",
}}
onCopy={() => {
trackEvent("Hero - Copy Install Command", {
posthog.capture("Hero - Copy Install Command", {
name: "Copy",
action: "click",
category: "landing-page",
@ -105,7 +107,7 @@ export const Hero = () => {
startContent={<GithubIcon />}
variant="bordered"
onPress={() => {
trackEvent("Hero - Github", {
posthog.capture("Hero - Github", {
name: "Github",
action: "click",
category: "landing-page",

View File

@ -5,13 +5,13 @@ import {ArrowRightIcon} from "@nextui-org/shared-icons";
import {clsx} from "@nextui-org/shared-utils";
import NextLink from "next/link";
import {Code} from "@nextui-org/react";
import {usePostHog} from "posthog-js/react";
import {FeaturesGrid} from "./features-grid";
import {sectionWrapper, subtitle, title} from "@/components/primitives";
import {GithubIcon, NoteLinearIcon, NextJsIcon} from "@/components/icons";
import {useIsMounted} from "@/hooks/use-is-mounted";
import {trackEvent} from "@/utils/va";
const bannerSuggestions = [
{
@ -36,6 +36,8 @@ const bannerSuggestions = [
export const InstallBanner = () => {
const isMounted = useIsMounted();
const posthog = usePostHog();
return (
<section
className={sectionWrapper({
@ -71,7 +73,7 @@ export const InstallBanner = () => {
radius="full"
size="md"
onClick={() => {
trackEvent("InstallBanner - Get Started", {
posthog.capture("InstallBanner - Get Started", {
action: "press",
category: "landing-page",
data: "/docs/guide/installation",
@ -90,7 +92,7 @@ export const InstallBanner = () => {
startContent={<GithubIcon />}
variant="bordered"
onClick={() => {
trackEvent("InstallBanner - Github", {
posthog.capture("InstallBanner - Github", {
action: "press",
category: "landing-page",
data: "https://github.com/nextui-org/nextui",

View File

@ -1,8 +1,7 @@
"use client";
import {Link} from "@nextui-org/react";
import {trackEvent} from "@/utils/va";
import {usePostHog} from "posthog-js/react";
export type Sponsor = {
name: string;
@ -11,13 +10,15 @@ export type Sponsor = {
};
export const SponsorItem = ({name, href, logo}: Sponsor) => {
const posthog = usePostHog();
return (
<Link
isExternal
className="flex flex-col items-center justify-center"
href={href}
onClick={() => {
trackEvent("Hero - Sponsors", {
posthog.capture("Hero - Sponsors", {
name,
action: "click",
category: "hero",

View File

@ -1,7 +1,7 @@
import {Button, Link} from "@nextui-org/react";
import {sectionWrapper} from "@/components/primitives";
import {Story2DesignLogo, CodeRabbitLogo, ScrumbuissLogo} from "@/components/icons/sponsors";
import {Story2DesignLogo, CodeRabbitLogo} from "@/components/icons/sponsors";
import {HeartFilledIcon} from "@/components/icons";
import {siteConfig} from "@/config/site";
import {Sponsor, SponsorItem} from "@/components/marketing/sponsor-item";
@ -17,11 +17,6 @@ const sponsors: Sponsor[] = [
href: "https://coderabbit.ai/?utm_source=nextui&utm_marketing=oss",
logo: <CodeRabbitLogo />,
},
{
name: "Scrumbuiss",
href: "https://www.scrumbuiss.com/?utm_source=nextui&utm_marketing=oss",
logo: <ScrumbuissLogo />,
},
];
export const Sponsors = () => {

View File

@ -3,6 +3,7 @@
import {FC, useMemo, useRef} from "react";
import {Avatar, AvatarProps, Button, Spacer, Tooltip} from "@nextui-org/react";
import {clamp} from "@nextui-org/shared-utils";
import {usePostHog} from "posthog-js/react";
import {sectionWrapper, titleWrapper, title, subtitle} from "../primitives";
@ -12,7 +13,6 @@ import {OpenCollectiveIcon, PatreonIcon, HeartBoldIcon, PlusLinearIcon} from "@/
import {Sponsor, SPONSOR_TIERS, SPONSOR_COLORS, getTier} from "@/libs/docs/sponsors";
import {SonarPulse} from "@/components/sonar-pulse";
import {useIsMobile} from "@/hooks/use-media-query";
import {trackEvent} from "@/utils/va";
export interface SupportProps {
sponsors: Sponsor[];
@ -95,6 +95,7 @@ const getSponsorAvatarStyles = (index: number, sponsors: Sponsor[] = []) => {
export const Support: FC<SupportProps> = ({sponsors = []}) => {
const sonarRef = useRef(null);
const isMobile = useIsMobile();
const posthog = usePostHog();
const handleExternalLinkClick = (href: string) => {
if (!href) return;
@ -102,7 +103,7 @@ export const Support: FC<SupportProps> = ({sponsors = []}) => {
};
const handleBecomeSponsor = () => {
trackEvent("Support - Become a sponsor", {
posthog.capture("Support - Become a sponsor", {
action: "click",
category: "landing-page",
});

View File

@ -3,6 +3,7 @@ import {clsx} from "@nextui-org/shared-utils";
import * as Components from "@nextui-org/react";
import {Language} from "prism-react-renderer";
import NextImage from "next/image";
import {usePostHog} from "posthog-js/react";
import {ThemeSwitch} from "./theme-switch";
@ -12,7 +13,6 @@ import * as DocsComponents from "@/components/docs/components";
import * as BlogComponents from "@/components/blog/components";
import {Codeblock} from "@/components/docs/components";
import {VirtualAnchor, virtualAnchorEncode} from "@/components/virtual-anchor";
import {trackEvent} from "@/utils/va";
const Table: React.FC<{children?: React.ReactNode}> = ({children}) => {
return (
@ -123,6 +123,7 @@ const Code = ({
const isMultiLine = (children as string)?.split?.("\n")?.length > 2;
const language = (className?.replace(/language-/, "") ?? "jsx") as Language;
const codeString = String(children).trim();
const posthog = usePostHog();
if (!className) {
return <InlineCode>{children}</InlineCode>;
@ -146,7 +147,7 @@ const Code = ({
}}
codeString={codeString}
onCopy={() => {
trackEvent("MDXComponents - Copy", {
posthog.capture("MDXComponents - Copy", {
category: "docs",
action: "copyCode",
});
@ -159,9 +160,10 @@ const Code = ({
const Link = ({href, children}: {href?: string; children?: React.ReactNode}) => {
const isExternal = href?.startsWith("http");
const posthog = usePostHog();
const handlePress = () => {
trackEvent("MDXComponents - Click", {
posthog.capture("MDXComponents - Click", {
category: "docs",
action: "click",
data: href || "",

View File

@ -28,6 +28,7 @@ import {motion, AnimatePresence} from "framer-motion";
import {useEffect} from "react";
import {usePress} from "@react-aria/interactions";
import {useFocusRing} from "@react-aria/focus";
import {usePostHog} from "posthog-js/react";
import {currentVersion} from "@/utils/version";
import {siteConfig} from "@/config/site";
@ -38,7 +39,6 @@ import {useIsMounted} from "@/hooks/use-is-mounted";
import {DocsSidebar} from "@/components/docs/sidebar";
import {useCmdkStore} from "@/components/cmdk";
import {FbRoadmapLink} from "@/components/featurebase/fb-roadmap-link";
import {trackEvent} from "@/utils/va";
export interface NavbarProps {
routes: Route[];
@ -59,6 +59,8 @@ export const Navbar: FC<NavbarProps> = ({children, routes, mobileRoutes = [], sl
const cmdkStore = useCmdkStore();
const posthog = usePostHog();
useEffect(() => {
if (isMenuOpen) {
setIsMenuOpen(false);
@ -71,7 +73,7 @@ export const Navbar: FC<NavbarProps> = ({children, routes, mobileRoutes = [], sl
const handleOpenCmdk = () => {
cmdkStore.onOpen();
trackEvent("Navbar - Search", {
posthog.capture("Navbar - Search", {
name: "navbar - search",
action: "press",
category: "cmdk",
@ -126,7 +128,7 @@ export const Navbar: FC<NavbarProps> = ({children, routes, mobileRoutes = [], sl
};
const handlePressNavbarItem = (name: string, url: string) => {
trackEvent("NavbarItem", {
posthog.capture("NavbarItem", {
name,
action: "press",
category: "navbar",

View File

@ -4,15 +4,17 @@ import {Icon} from "@iconify/react/dist/offline";
import arrowRightIcon from "@iconify/icons-solar/arrow-right-linear";
import {usePathname} from "next/navigation";
import {useEffect} from "react";
import {usePostHog} from "posthog-js/react";
import {trackEvent} from "@/utils/va";
import emitter from "@/libs/emitter";
const hideOnPaths = ["examples"];
export const ProBanner = () => {
const posthog = usePostHog();
const handleClick = () => {
trackEvent("NextUI Pro Banner", {
posthog.capture("NextUI Pro Banner", {
action: "click",
category: "landing-page",
});

View File

@ -1,8 +1,6 @@
import * as React from "react";
import {Analytics} from "@vercel/analytics/react";
import Script from "next/script";
import {__PROD__} from "@/utils";
export function ScriptProviders() {
return (
@ -23,7 +21,6 @@ export function ScriptProviders() {
src="https://widget.kapa.ai/kapa-widget.bundle.js"
strategy="afterInteractive"
/>
{__PROD__ && <Analytics />}
</>
);
}

View File

@ -6,9 +6,9 @@ import {SwitchProps, useSwitch} from "@nextui-org/react";
import {useTheme} from "next-themes";
import {clsx} from "@nextui-org/shared-utils";
import {useIsSSR} from "@react-aria/ssr";
import {usePostHog} from "posthog-js/react";
import {SunFilledIcon, MoonFilledIcon} from "@/components/icons";
import {trackEvent} from "@/utils/va";
export interface ThemeSwitchProps {
className?: string;
@ -18,11 +18,12 @@ export interface ThemeSwitchProps {
export const ThemeSwitch: FC<ThemeSwitchProps> = ({className, classNames}) => {
const {theme, setTheme} = useTheme();
const isSSR = useIsSSR();
const posthog = usePostHog();
const onChange = () => {
theme === "light" ? setTheme("dark") : setTheme("light");
trackEvent("ThemeChange", {
posthog.capture("ThemeChange", {
action: "click",
category: "theme",
data: theme === "light" ? "dark" : "light",

View File

@ -22,6 +22,22 @@ const nextConfig = {
"nextui.org",
],
},
rewrites: async () => {
return [
{
destination: "https://us-assets.i.posthog.com/static/:path*",
source: "/ingest/static/:path*",
},
{
destination: "https://us.i.posthog.com/:path*",
source: "/ingest/:path*",
},
{
destination: "https://us.i.posthog.com/decide",
source: "/ingest/decide",
},
];
},
};
module.exports = withContentlayer(nextConfig);

View File

@ -49,7 +49,6 @@
"@react-stately/layout": "3.13.9",
"@react-stately/tree": "3.8.1",
"@rehooks/local-storage": "^2.4.5",
"@vercel/analytics": "^1.2.2",
"canvas-confetti": "^1.9.2",
"cmdk": "^0.2.0",
"color2k": "^2.0.2",
@ -70,6 +69,7 @@
"parse-numeric-range": "1.2.0",
"prism-react-renderer": "^1.2.1",
"querystring": "^0.2.1",
"posthog-js": "1.187.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.10.1",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -2,4 +2,3 @@ export const __PROD__ = process.env.NODE_ENV === "production";
export const __DEV__ = process.env.NODE_ENV !== "production";
export const __TEST__ = process.env.NODE_ENV === "test";
export const __PREVIEW__ = process.env.IS_PREVIEW === "true";
export const __IS_VA_ENABLED__ = process.env.IS_VA_ENABLED === "true";

View File

@ -6,19 +6,7 @@ import fs from "fs";
*/
export function getAllSponsors() {
const sponsorsRcPath = path.resolve(".sponsorsrc");
const openCollectiveSponsors = JSON.parse(fs.readFileSync(sponsorsRcPath, "utf-8"));
const patreonSponsors = [
{
MemberId: "000000",
tier: "Gold Sponsor 🥇",
currency: "USD",
lastTransactionAt: "2024-07-14 00:00",
lastTransactionAmount: 100,
name: "Scrumbuiss",
image: "/sponsors/000000.webp",
website: "https://www.scrumbuiss.com",
},
];
const sponsors = JSON.parse(fs.readFileSync(sponsorsRcPath, "utf-8"));
return [...openCollectiveSponsors, ...patreonSponsors];
return sponsors;
}

View File

@ -1,34 +0,0 @@
import va from "@vercel/analytics";
export function getUniqueID(prefix: string) {
return `${prefix}-${new Date().getTime()}`;
}
export type TrackEvent = {
category: string;
action: string;
name?: string;
data?: any;
};
const getSessionId = () => {
let sessionId = getUniqueID("session");
// save session id in local storage if it doesn't exist
if (!localStorage.getItem("sessionId")) {
localStorage.setItem("sessionId", sessionId);
return sessionId;
} else {
return localStorage.getItem("sessionId") ?? sessionId;
}
};
export const trackEvent = (label: string, event: TrackEvent) => {
const sessionId = getSessionId();
va.track(label, {
...event,
sessionId,
});
};

2853
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff