@@ -4,6 +4,7 @@ import { motion } from 'framer-motion'
44import { useTheme } from 'next-themes'
55import posthog from 'posthog-js'
66import React , { useState , useEffect , useRef } from 'react'
7+ import { AnalyticsEvent } from '@codebuff/common/constants/analytics-events'
78import { match , P } from 'ts-pattern'
89
910import Terminal , { ColorMode , TerminalOutput } from './ui/terminal'
@@ -398,7 +399,7 @@ const TerminalDemo = () => {
398399 } ,
399400 onMutate : ( input ) => {
400401 // Track terminal input event
401- posthog . capture ( 'demo_terminal.command_executed' , {
402+ posthog . capture ( AnalyticsEvent . DEMO_TERMINAL_COMMAND_EXECUTED , {
402403 command : input ,
403404 } )
404405
@@ -495,7 +496,7 @@ const TerminalDemo = () => {
495496
496497 match ( cleanInput )
497498 . with ( 'help' , ( ) => {
498- posthog . capture ( 'demo_terminal.help_viewed' )
499+ posthog . capture ( AnalyticsEvent . DEMO_TERMINAL_HELP_VIEWED )
499500 setTerminalLines ( ( prev ) => [
500501 ...prev ,
501502 < TerminalOutput key = { `help-${ Date . now ( ) } ` } >
@@ -538,7 +539,7 @@ const TerminalDemo = () => {
538539 P . string . includes ( 'optimize' ) ,
539540 P . string . includes ( 'performance' ) ,
540541 ( ) => {
541- posthog . capture ( 'demo_terminal.optimize_requested' )
542+ posthog . capture ( AnalyticsEvent . DEMO_TERMINAL_OPTIMIZE_REQUESTED )
542543 const response = SAMPLE_RESPONSES . optimize
543544
544545 setTerminalLines ( ( prev ) => [
@@ -624,7 +625,7 @@ const TerminalDemo = () => {
624625 s . includes ( 'fix' ) && ( s . includes ( 'memory' ) || s . includes ( 'leak' ) )
625626 ) ,
626627 ( ) => {
627- posthog . capture ( 'demo_terminal.fix_memory_leak' )
628+ posthog . capture ( AnalyticsEvent . DEMO_TERMINAL_FIX_MEMORY_LEAK )
628629 setShowError ( false )
629630 const response = SAMPLE_RESPONSES . fix
630631
@@ -712,7 +713,7 @@ const TerminalDemo = () => {
712713 . with (
713714 P . when ( ( s : string ) => s . includes ( 'refactor' ) && s . includes ( 'auth' ) ) ,
714715 ( ) => {
715- posthog . capture ( 'demo_terminal.refactor_requested' )
716+ posthog . capture ( AnalyticsEvent . DEMO_TERMINAL_REFACTOR_REQUESTED )
716717 const response = SAMPLE_RESPONSES . refactor
717718
718719 setTerminalLines ( ( prev ) => [
@@ -815,7 +816,7 @@ const TerminalDemo = () => {
815816 ( s . includes ( 'dark' ) || s . includes ( 'light' ) ) && s . includes ( 'mode' )
816817 ) ,
817818 ( ) => {
818- posthog . capture ( 'demo_terminal.feature_requested' )
819+ posthog . capture ( AnalyticsEvent . DEMO_TERMINAL_FEATURE_REQUESTED )
819820 const response = SAMPLE_RESPONSES . feature
820821
821822 setTerminalLines ( ( prev ) => [
@@ -905,7 +906,7 @@ const TerminalDemo = () => {
905906 const currentIndex = themes . indexOf ( previewTheme )
906907 const nextTheme = themes [ ( currentIndex + 1 ) % themes . length ]
907908
908- posthog . capture ( 'demo_terminal.theme_changed' , {
909+ posthog . capture ( AnalyticsEvent . DEMO_TERMINAL_THEME_CHANGED , {
909910 from : previewTheme ,
910911 to : nextTheme ,
911912 } )
0 commit comments