Skip to content

Commit

Permalink
Merge pull request #1426 from turnerran/main
Browse files Browse the repository at this point in the history
Removed some redundant code
  • Loading branch information
Javier Toledo authored Sep 4, 2023
2 parents 70eb649 + 16e1faa commit 9bda21f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 38 deletions.
16 changes: 4 additions & 12 deletions website/src/components/BoosterChat/BoosterChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function BoosterChat(): JSX.Element {
}

const handleSearch = async (query: string) => {
if (query?.trim() === '' || query === null) {
if (query?.trim() === '') {
return
}

Expand Down Expand Up @@ -79,11 +79,8 @@ export default function BoosterChat(): JSX.Element {
<AskAIDisclaimer />
{!hasSearched && (
<div className="bc-quick-questions-panel">
<button
className="bc-quick-question"
onClick={() => onQuickQuestionClick('What is Booster Framework?')}
>
What is Booster Framework?
<button className="bc-quick-question" onClick={() => onQuickQuestionClick('What is Booster Framework?')}>
What is Booster Framework?
</button>
<button className="bc-quick-question" onClick={() => onQuickQuestionClick("Summary of Booster's components")}>
Summary of Booster's components
Expand All @@ -108,12 +105,7 @@ export default function BoosterChat(): JSX.Element {
</button>
</div>
)}
<ChatResponse
questionId={questionId}
response={response}
loading={loading}
hasFinished={hasFinished}
/>
<ChatResponse questionId={questionId} response={response} loading={loading} hasFinished={hasFinished} />
</div>
)
}
Expand Down
12 changes: 6 additions & 6 deletions website/src/components/CustomSidebarItem.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import React from 'react';
import React from 'react'

function CustomSidebarItem({ item }) {
const handleClick = () => {
if (customProps && customProps.trackingEvent) {
fathom.trackGoal(customProps.trackingEvent, 0);
if (customProps?.trackingEvent) {
fathom.trackGoal(customProps.trackingEvent, 0)
}
};
}

return (
<a className="menu__link" href={item.href} onClick={handleClick}>
{item.label}
</a>
);
)
}

export default CustomSidebarItem;
export default CustomSidebarItem
13 changes: 6 additions & 7 deletions website/src/theme/DocSidebarItem/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import React from 'react';
import DocSidebarItem from '@theme-original/DocSidebarItem';
import React from 'react'
import DocSidebarItem from '@theme-original/DocSidebarItem'

export default function DocSidebarItemWrapper(props) {
const handleClick = (customProps) => {
if (customProps && customProps.trackingEvent) {
fathom.trackGoal(customProps.trackingEvent, 0);
if (customProps?.trackingEvent) {
fathom.trackGoal(customProps.trackingEvent, 0)
}
};
}

return (
<div onClick={() => handleClick(props.item.customProps)}>
<DocSidebarItem {...props} />
</div>
);
)
}

9 changes: 2 additions & 7 deletions website/src/theme/NavbarItem/CustomNavbarItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function CustomNavbarItem(props: { imageURL: string; altText: str
}

const handleSearch = async (query: string, controller: AbortController) => {
if (query?.trim() === '' || query === null) {
if (query?.trim() === '') {
return
}

Expand Down Expand Up @@ -125,12 +125,7 @@ export default function CustomNavbarItem(props: { imageURL: string; altText: str
resetSearchResponse={null}
/>
<AskAIDisclaimer />
<ChatResponse
questionId={questionId}
response={response}
loading={loading}
hasFinished={hasFinished}
/>
<ChatResponse questionId={questionId} response={response} loading={loading} hasFinished={hasFinished} />
</Modal>
</>
)
Expand Down
12 changes: 6 additions & 6 deletions website/src/theme/NavbarItem/NavbarNavLink.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React from 'react';
import NavbarNavLink from '@theme-original/NavbarItem/NavbarNavLink';
import React from 'react'
import NavbarNavLink from '@theme-original/NavbarItem/NavbarNavLink'

export default function NavbarNavLinkWrapper(props) {
const handleClick = (customProps) => {
if (customProps && customProps.trackingEvent) {
fathom.trackGoal(customProps.trackingEvent, 0);
if (customProps?.trackingEvent) {
fathom.trackGoal(customProps.trackingEvent, 0)
}
};
}

return (
<div onClick={() => handleClick(props.customProps)}>
<NavbarNavLink {...props} />
</div>
);
)
}

0 comments on commit 9bda21f

Please sign in to comment.