-
Notifications
You must be signed in to change notification settings - Fork 887
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #253 from brave/ts
Adds TS support
- Loading branch information
Showing
77 changed files
with
1,909 additions
and
2,655 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,32 @@ | ||
git: | ||
depth: 10 | ||
notifications: | ||
email: false | ||
|
||
language: node_js | ||
node_js: | ||
- "4" | ||
os: | ||
- linux | ||
- osx | ||
env: | ||
- TARGET_ARCH=x64 | ||
osx_image: xcode7.3 | ||
|
||
matrix: | ||
include: | ||
- os: linux | ||
env: TARGET_ARCH=arm | ||
- os: linux | ||
env: TARGET_ARCH=ia32 | ||
allow_failures: | ||
- os: osx | ||
- "node" | ||
|
||
script: './script/cibuild' | ||
dist: trusty | ||
|
||
branches: | ||
only: | ||
- master | ||
- /\d+\.\d+\.x/ | ||
|
||
cache: | ||
directories: | ||
- $HOME/.npm | ||
- node_modules | ||
|
||
env: | ||
- TEST_SUITE=lint | ||
- TEST_SUITE=test-security | ||
|
||
before_install: | ||
- npm i -g npm | ||
- npm --version | ||
|
||
install: | ||
- npm i | ||
|
||
script: | ||
- npm run $TEST_SUITE | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
import * as React from 'react' | ||
import { bindActionCreators, Dispatch } from 'redux' | ||
import { connect } from 'react-redux' | ||
|
||
// Components | ||
import { RegionalAdBlockEnabled } from './regionalAdBlockEnabled' | ||
import { NumBlockedStat } from './numBlockedStat' | ||
|
||
// Utils | ||
import * as adblockActions from '../actions/adblock_actions' | ||
|
||
interface Props { | ||
actions: any | ||
adblockData: AdBlock.State | ||
} | ||
|
||
class AdblockPage extends React.Component<Props, {}> { | ||
get actions () { | ||
return this.props.actions | ||
} | ||
|
||
render () { | ||
const { adblockData } = this.props | ||
return ( | ||
<div> | ||
<NumBlockedStat adsBlockedStat={adblockData.stats.adsBlockedStat || 0} /> | ||
<RegionalAdBlockEnabled | ||
regionalAdBlockEnabled={adblockData.stats.regionalAdBlockEnabled} | ||
regionalAdBlockTitle={adblockData.stats.regionalAdBlockTitle || ''} | ||
/> | ||
</div>) | ||
} | ||
} | ||
|
||
const mapStateToProps = (state: {adblockData: AdBlock.State}) => ({ | ||
adblockData: state.adblockData | ||
}) | ||
|
||
const mapDispatchToProps = (dispatch: Dispatch) => ({ | ||
actions: bindActionCreators(adblockActions, dispatch) | ||
}) | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(AdblockPage) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
import * as React from 'react' | ||
|
||
interface Props { | ||
adsBlockedStat: number | ||
} | ||
|
||
export const NumBlockedStat = (props: Props) => ( | ||
<div> | ||
<span i18n-content='adsBlocked'/> {props.adsBlockedStat || 0} | ||
</div> | ||
) |
28 changes: 28 additions & 0 deletions
28
components/brave_adblock_ui/components/regionalAdBlockEnabled.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
import * as React from 'react' | ||
|
||
interface Props { | ||
regionalAdBlockEnabled: boolean | ||
regionalAdBlockTitle: string | ||
} | ||
|
||
export const RegionalAdBlockEnabled = (props: Props) => ( | ||
<div> | ||
<span i18n-content='regionalAdblockEnabledTitle'/> | ||
{ | ||
props.regionalAdBlockEnabled | ||
? <span i18n-content='regionalAdblockEnabled'/> | ||
: <span i18n-content='regionalAdblockDisabled'/> | ||
} | ||
<div> | ||
{ | ||
props.regionalAdBlockEnabled | ||
? props.regionalAdBlockTitle | ||
: null | ||
} | ||
</div> | ||
</div> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 9 additions & 7 deletions
16
...ve_adblock_ui/reducers/adblock_reducer.js → ...ve_adblock_ui/reducers/adblock_reducer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.