Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed some redundant code #1426

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
);
)
}
Loading