Skip to content

Commit

Permalink
fix(ai-route): click logo icon route a home page
Browse files Browse the repository at this point in the history
  • Loading branch information
Shoaibdev7 committed Jul 24, 2024
1 parent 27d7bad commit 6a5e2c2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/App/MainToolbar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useNavigate } from 'react-router-dom'
import styled from 'styled-components'
import AddContentIcon from '~/components/Icons/AddContentIcon'
import AddSourceIcon from '~/components/Icons/AddSourceIcon'
Expand All @@ -7,12 +8,12 @@ import SettingsIcon from '~/components/Icons/SettingsIcon'
import SourcesTableIcon from '~/components/Icons/SourcesTableIcon'
import { Flex } from '~/components/common/Flex'
import { Text } from '~/components/common/Text'
import { useAiSummaryStore } from '~/stores/useAiSummaryStore'
import { useFeatureFlagStore } from '~/stores/useFeatureFlagStore'
import { useModal } from '~/stores/useModalStore'
import { useUserStore } from '~/stores/useUserStore'
import { colors } from '~/utils/colors'
import { isSphinx } from '~/utils/isSphinx'
import { useNavigate } from 'react-router-dom'

export const MainToolbar = () => {
const { open: openSourcesModal } = useModal('sourcesTable')
Expand All @@ -23,15 +24,21 @@ export const MainToolbar = () => {
const { open: openFeedbackModal } = useModal('feedback')
const navigate = useNavigate()

const { resetAiSummaryAnswer } = useAiSummaryStore()
const customSchemaFeatureFlag = useFeatureFlagStore((s) => s.customSchemaFeatureFlag)
const userFeedbackFeatureFlag = useFeatureFlagStore((s) => s.userFeedbackFeatureFlag)

const [isAdmin] = useUserStore((s) => [s.isAdmin])
const sphinxEnabled = isSphinx()

const handleLogoClick = () => {
resetAiSummaryAnswer()
navigate('/')
}

return (
<Wrapper>
<LogoButton onClick={() => navigate('/')}>
<LogoButton onClick={handleLogoClick}>
<img alt="Second brain" src="logo.svg" />
</LogoButton>
{isAdmin ? (
Expand Down

0 comments on commit 6a5e2c2

Please sign in to comment.