mirror of
https://github.com/jnsahaj/tweakcn.git
synced 2026-09-01 05:35:43 +08:00
fix: Add back analytics for ai gen theme
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import { toast } from "@/components/ui/use-toast";
|
||||
import { useAIThemeGenerationStore } from "@/store/ai-theme-generation-store";
|
||||
import { usePostHog } from "posthog-js/react";
|
||||
|
||||
export function useAIThemeGeneration() {
|
||||
const generateTheme = useAIThemeGenerationStore((state) => state.generateTheme);
|
||||
const loading = useAIThemeGenerationStore((state) => state.loading);
|
||||
const cancelThemeGeneration = useAIThemeGenerationStore((state) => state.cancelThemeGeneration);
|
||||
const posthog = usePostHog();
|
||||
|
||||
const handleGenerateTheme = async (prompt: string) => {
|
||||
try {
|
||||
@@ -15,6 +17,10 @@ export function useAIThemeGeneration() {
|
||||
description: "Your AI-generated theme has been applied",
|
||||
});
|
||||
|
||||
posthog.capture("AI_GENERATE_THEME", {
|
||||
prompt,
|
||||
});
|
||||
|
||||
return result; // Return the result from the store
|
||||
} catch (error) {
|
||||
if (error instanceof Error && error.name === "AbortError") {
|
||||
|
||||
Reference in New Issue
Block a user