chore: remove custome event

This commit is contained in:
Faisal Amir 2024-11-20 20:46:46 +07:00 committed by Louis
parent dd503767a2
commit 899822a581

View File

@ -7,7 +7,6 @@ import {
SquareCodeIcon, SquareCodeIcon,
} from 'lucide-react' } from 'lucide-react'
import posthog from 'posthog-js'
import { twMerge } from 'tailwind-merge' import { twMerge } from 'tailwind-merge'
import { MainViewState } from '@/constants/screens' import { MainViewState } from '@/constants/screens'
@ -35,14 +34,11 @@ export default function RibbonPanel() {
const threads = useAtomValue(threadsAtom) const threads = useAtomValue(threadsAtom)
const isDownloadALocalModel = useAtomValue(isDownloadALocalModelAtom) const isDownloadALocalModel = useAtomValue(isDownloadALocalModelAtom)
const onMenuClick = (state: MainViewState, id: string) => { const onMenuClick = (state: MainViewState) => {
if (mainViewState === state) return if (mainViewState === state) return
if (serverEnabled && state === MainViewState.Thread) return if (serverEnabled && state === MainViewState.Thread) return
if (state === MainViewState.Settings) setSelectedSetting('My Models') if (state === MainViewState.Settings) setSelectedSetting('My Models')
setMainViewState(state) setMainViewState(state)
posthog.capture('mainViewScreen', {
screen: id,
})
setEditMessage('') setEditMessage('')
} }
@ -59,25 +55,21 @@ export default function RibbonPanel() {
/> />
), ),
state: MainViewState.Thread, state: MainViewState.Thread,
id: 'thread_screen',
}, },
{ {
name: 'Hub', name: 'Hub',
icon: <LayoutGridIcon size={18} className="flex-shrink-0" />, icon: <LayoutGridIcon size={18} className="flex-shrink-0" />,
state: MainViewState.Hub, state: MainViewState.Hub,
id: 'hub_screen',
}, },
{ {
name: 'Local API Server', name: 'Local API Server',
icon: <SquareCodeIcon size={18} className="flex-shrink-0" />, icon: <SquareCodeIcon size={18} className="flex-shrink-0" />,
state: MainViewState.LocalServer, state: MainViewState.LocalServer,
id: 'local_api_server_screen',
}, },
{ {
name: 'Settings', name: 'Settings',
icon: <SettingsIcon size={18} className="flex-shrink-0" />, icon: <SettingsIcon size={18} className="flex-shrink-0" />,
state: MainViewState.Settings, state: MainViewState.Settings,
id: 'setting',
}, },
] ]
@ -106,7 +98,7 @@ export default function RibbonPanel() {
i === 1 && 'mb-auto' i === 1 && 'mb-auto'
)} )}
key={i} key={i}
onClick={() => onMenuClick(menu.state, menu.id)} onClick={() => onMenuClick(menu.state)}
> >
<Tooltip <Tooltip
side="right" side="right"