Fix posthog callsites
This commit is contained in:
@@ -18,7 +18,6 @@ import {
|
||||
import { ChatList } from "./ChatList";
|
||||
import { AppList } from "./AppList";
|
||||
import { HelpDialog } from "./HelpDialog"; // Import the new dialog
|
||||
import { usePostHog } from "posthog-js/react";
|
||||
|
||||
// Menu items.
|
||||
const items = [
|
||||
@@ -146,8 +145,6 @@ function AppIcons({
|
||||
}: {
|
||||
onHoverChange: (state: HoverState) => void;
|
||||
}) {
|
||||
const { capture } = usePostHog();
|
||||
|
||||
const routerState = useRouterState();
|
||||
const pathname = routerState.location.pathname;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ import { useRunApp } from "@/hooks/useRunApp";
|
||||
import { AutoApproveSwitch } from "../AutoApproveSwitch";
|
||||
import { usePostHog } from "posthog-js/react";
|
||||
export function ChatInput({ chatId }: { chatId?: number }) {
|
||||
const { capture } = usePostHog();
|
||||
const posthog = usePostHog();
|
||||
const [inputValue, setInputValue] = useAtom(chatInputValueAtom);
|
||||
const textareaRef = useRef<HTMLTextAreaElement>(null);
|
||||
const { settings, updateSettings, isAnyProviderSetup } = useSettings();
|
||||
@@ -105,7 +105,7 @@ export function ChatInput({ chatId }: { chatId?: number }) {
|
||||
const currentInput = inputValue;
|
||||
setInputValue("");
|
||||
await streamMessage({ prompt: currentInput, chatId });
|
||||
capture("chat:submit");
|
||||
posthog.capture("chat:submit");
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
@@ -126,7 +126,7 @@ export function ChatInput({ chatId }: { chatId?: number }) {
|
||||
`Approving proposal for chatId: ${chatId}, messageId: ${messageId}`
|
||||
);
|
||||
setIsApproving(true);
|
||||
capture("chat:approve");
|
||||
posthog.capture("chat:approve");
|
||||
try {
|
||||
const result = await IpcClient.getInstance().approveProposal({
|
||||
chatId,
|
||||
@@ -160,7 +160,7 @@ export function ChatInput({ chatId }: { chatId?: number }) {
|
||||
`Rejecting proposal for chatId: ${chatId}, messageId: ${messageId}`
|
||||
);
|
||||
setIsRejecting(true);
|
||||
capture("chat:reject");
|
||||
posthog.capture("chat:reject");
|
||||
try {
|
||||
const result = await IpcClient.getInstance().rejectProposal({
|
||||
chatId,
|
||||
|
||||
@@ -6,7 +6,6 @@ import { useSettings } from "@/hooks/useSettings";
|
||||
import { homeChatInputValueAtom } from "@/atoms/chatAtoms"; // Use a different atom for home input
|
||||
import { useAtom } from "jotai";
|
||||
import { useStreamChat } from "@/hooks/useStreamChat";
|
||||
import { usePostHog } from "posthog-js/react";
|
||||
|
||||
export function HomeChatInput({ onSubmit }: { onSubmit: () => void }) {
|
||||
const [inputValue, setInputValue] = useAtom(homeChatInputValueAtom);
|
||||
|
||||
@@ -24,7 +24,7 @@ export default function HomePage() {
|
||||
const setIsPreviewOpen = useSetAtom(isPreviewOpenAtom);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const { streamMessage } = useStreamChat({ hasChatId: false });
|
||||
const { capture } = usePostHog();
|
||||
const posthog = usePostHog();
|
||||
// Get the appId from search params
|
||||
const appId = search.appId ? Number(search.appId) : null;
|
||||
|
||||
@@ -53,7 +53,7 @@ export default function HomePage() {
|
||||
setSelectedAppId(result.app.id);
|
||||
setIsPreviewOpen(false);
|
||||
await refreshApps(); // Ensure refreshApps is awaited if it's async
|
||||
capture("home:chat-submit");
|
||||
posthog.capture("home:chat-submit");
|
||||
navigate({ to: "/chat", search: { id: result.chatId } });
|
||||
} catch (error) {
|
||||
console.error("Failed to create chat:", error);
|
||||
|
||||
Reference in New Issue
Block a user