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

add qwant support #654

Merged
merged 2 commits into from
Oct 17, 2018
Merged
Changes from 1 commit
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
15 changes: 14 additions & 1 deletion components/brave_new_tab_ui/components/privateTab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { Page, PageWrapper } from 'brave-ui/features/newTab'

// Components group
import PrivateTab from './privateTab'
import QwantTab from './qwantTab'
import QwantTorTab from './qwantTorTab'
import TorTab from './torTab'

interface Props {
Expand All @@ -18,12 +20,23 @@ interface Props {
}

export default class NewPrivateTab extends React.PureComponent<Props, {}> {
get isQwant () {
return navigator.language === 'de' || navigator.language === 'fr'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This can be a static const defined at the module level, since it does not rely on any props or anything to do with the component

}

get currentWindow () {
const { isTor, useAlternativePrivateSearchEngine, onChangePrivateSearchEngine } = this.props
if (isTor) {
if (this.isQwant) {
return <QwantTorTab />
}
return <TorTab />
}

if (this.isQwant) {
return <QwantTab />
}

return (
<PrivateTab
useAlternativePrivateSearchEngine={useAlternativePrivateSearchEngine}
Expand All @@ -35,7 +48,7 @@ export default class NewPrivateTab extends React.PureComponent<Props, {}> {
render () {
const { isTor } = this.props
return (
<Page isPrivate={!isTor}>
<Page isPrivate={!isTor && !this.isQwant}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not private if it's de or fr language?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just to change the background color. I should have written isDefaultPrivate but need to level up my naming game :P

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cezaraugusto that's ok, when things calm down we should look to improve some naming all around the webui's

<PageWrapper>
{this.currentWindow}
</PageWrapper>
Expand Down