mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
* feat(utils): add featurebase utils * feat(config): add changelog, feedback and roadmap routes * feat(app): add featurebase script * feat(docs): add NEXT_PUBLIC_FB_FEEDBACK_URL * feat(featurebase): add featurebase components * feat(components): add featurebase components to navbar * feat(components): add featurebase components to sidebar * chore(config): remove changelog and feedback at this moment * fix(components): fb-roadmap-link styles * chore(components): hide feedback and changelog at this moment * feat(docs): add NEXT_PUBLIC_FB_FEEDBACK_ORG * feat(featurebase): add trackEvent & revise props
43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
"use client";
|
|
|
|
import {useEffect} from "react";
|
|
|
|
import {trackEvent} from "@/utils/va";
|
|
|
|
type Props = {
|
|
className?: string;
|
|
};
|
|
|
|
// ref: https://developers.featurebase.app/install/feedback-widget/setup
|
|
export const FbFeedbackButton = ({className}: Props) => {
|
|
useEffect(() => {
|
|
const win = window as any;
|
|
|
|
if (typeof win.Featurebase !== "function") {
|
|
win.Featurebase = function () {
|
|
// eslint-disable-next-line prefer-rest-params
|
|
(win.Featurebase.q = win.Featurebase.q || []).push(arguments);
|
|
};
|
|
}
|
|
win.Featurebase("initialize_feedback_widget", {
|
|
organization: process.env.NEXT_PUBLIC_FB_FEEDBACK_ORG,
|
|
theme: "dark",
|
|
email: "",
|
|
});
|
|
}, []);
|
|
|
|
const fbButtonOnClick = () => {
|
|
trackEvent("Featurebase - Feedback", {
|
|
name: "featurebase-feedback",
|
|
action: "press",
|
|
category: "featurebase",
|
|
});
|
|
};
|
|
|
|
return (
|
|
<button data-featurebase-feedback className={className} onClick={fbButtonOnClick}>
|
|
Feedback
|
|
</button>
|
|
);
|
|
};
|