diff options
| -rw-r--r-- | package.json | 3 | ||||
| -rw-r--r-- | scraper/client/paper/paper.verify.js | 62 | ||||
| -rw-r--r-- | webpack.geocode.prod.js | 49 | ||||
| -rw-r--r-- | webpack.splash.prod.js | 1 |
4 files changed, 107 insertions, 8 deletions
diff --git a/package.json b/package.json index 3dbb8353..4cd2f10d 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "deploy": "NODE_ENV=production webpack --config ./webpack.config.prod.js && git commit -am 'deploy' && git push origin master && ssh vframe@vframe ./restart.sh", "watchSplash": "NODE_ENV=development webpack --config ./webpack.splash.dev.js --colors --watch", "buildSplash": "NODE_ENV=production webpack --config ./webpack.splash.prod.js", - "watchGeocode": "NODE_ENV=development webpack --config ./webpack.geocode.dev.js --colors --watch" + "watchGeocode": "NODE_ENV=development webpack --config ./webpack.geocode.dev.js --colors --watch", + "buildGeocode": "NODE_ENV=production webpack --config ./webpack.geocode.prod.js" }, "repository": { "type": "git", diff --git a/scraper/client/paper/paper.verify.js b/scraper/client/paper/paper.verify.js index 8cb14d84..5f85a551 100644 --- a/scraper/client/paper/paper.verify.js +++ b/scraper/client/paper/paper.verify.js @@ -11,12 +11,14 @@ import { Loader, Autocomplete } from '../common' const initialState = { citation: null, uses_dataset: false, - doesnt_use_dataset: false, + doesnt_use_dataset: true, images_in_paper: false, - verified_by: '', + verified_by: localStorage.getItem('verify.username') || '', + reference: '', notes: '', pdf_index: 0, } + class PaperVerify extends Component { state = { ...initialState @@ -65,6 +67,7 @@ class PaperVerify extends Component { doesnt_use_dataset: paper.doesnt_use_dataset === "TRUE", images_in_paper: paper.images_in_paper === "TRUE", verified_by: paper.verified_by, + reference: paper.reference, notes: paper.notes, }) } @@ -87,18 +90,47 @@ class PaperVerify extends Component { save() { console.log(this.state) + let date = new Date() + let mon = date.getMonth() + 1 + if (mon < 10) mon = "0" + mon + let day = date.getDate() + if (day < 10) day = "0" + day + let time = date.toTimeString().split(" ")[0] + let dateString = date.getFullYear() + '-' + mon + '-' + day + ' ' + time + localStorage.setItem('verify.username', this.state.verified_by) this.props.actions.postVerification({ paper_id: this.state.citation.id, title: this.state.citation.title, + dataset: this.props.api.paperInfo.dataset.key, uses_dataset: this.state.uses_dataset, doesnt_use_dataset: this.state.doesnt_use_dataset, images_in_paper: this.state.images_in_paper, verified_by: this.state.verified_by, + reference: this.state.reference, notes: this.state.notes, + date: dateString, }) this.next(false) } + prev() { + const { key } = this.props.api.paperInfo.dataset + const { paperInfo } = this.props.api + let citationIndex = (paperInfo.citations || []) + .findIndex(f => f.id === this.state.citation.id) + if (citationIndex === -1) { + history.push('/paper/' + key + '/info/') + } else { + citationIndex -= 1 + if (citationIndex < 0) { + history.push('/paper/' + key + '/info/') + } else { + let nextId = paperInfo.citations[citationIndex].id + history.push('/paper/' + key + '/verify/' + nextId) + } + } + } + next() { const { key } = this.props.api.paperInfo.dataset const { paperInfo } = this.props.api @@ -148,7 +180,7 @@ class PaperVerify extends Component { <a href={'https://www.semanticscholar.org/paper/' + citation.id} target="_blank" - className={i === this.state.pdf_index ? 'selected pdfLink' : 'pdfLink'} + className={'pdfLink'} > {'[semantic scholar]'} </a> @@ -186,11 +218,11 @@ class PaperVerify extends Component { <label>{"Uses images from dataset"}</label> <input className='vetting' - type='radio' + type='checkbox' name='images_in_paper' checked={!!this.state.images_in_paper} onChange={e => this.setState({ - images_in_paper: !e.target.checked, + images_in_paper: e.target.checked, })} /> </div> @@ -207,9 +239,22 @@ class PaperVerify extends Component { </div> <div className='param'> + <label>Reference</label> + <textarea + rows={3} + cols={50} + type='text' + className='notes' + value={this.state.notes} + placeholder='Notes' + onChange={e => this.setState({ notes: e.target.value })} + /> + </div> + + <div className='param'> <label>Notes</label> <textarea - rows={4} + rows={3} cols={50} type='text' className='notes' @@ -228,6 +273,11 @@ class PaperVerify extends Component { <button className='btn' + onClick={this.prev.bind(this)} + >{'Prev >'}</button> + + <button + className='btn' onClick={this.next.bind(this)} >{'Next >'}</button> </div> diff --git a/webpack.geocode.prod.js b/webpack.geocode.prod.js new file mode 100644 index 00000000..0c3b3bcb --- /dev/null +++ b/webpack.geocode.prod.js @@ -0,0 +1,49 @@ +require('dotenv').config() + +const webpack = require('webpack') +const path = require('path') +const UglifyJsPlugin = require('uglifyjs-webpack-plugin') + +module.exports = { + entry: { + main: './scraper/client/index.js' + }, + output: { + path: path.resolve(__dirname, 'scraper/reports'), + filename: 'geocode-app.js' + }, + plugins: [ + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': '"production"', + 'process.env.S3_HOST': '"' + process.env.S3_HOST + '"', + 'process.env.API_HOST': '""', + }), + new UglifyJsPlugin(), + new webpack.optimize.AggressiveMergingPlugin() + ], + devtool: 'inline-source-map', + module: { + rules: [ + { + test: /\.css$/, + use: ['style-loader', 'css-loader'] + }, + { + test: /\.js$/, + // include: path.resolve(__dirname, 'client'), + exclude: /(node_modules|bower_components|build)/, + loader: 'babel-loader', + options: { + presets: ['env'], + plugins: [ + require('babel-plugin-transform-runtime'), + require('babel-plugin-transform-es2015-arrow-functions'), + require('babel-plugin-transform-object-rest-spread'), + require('babel-plugin-transform-class-properties'), + require('babel-plugin-transform-react-jsx'), + ] + } + } + ] + } +}; diff --git a/webpack.splash.prod.js b/webpack.splash.prod.js index 78359a8c..e0689424 100644 --- a/webpack.splash.prod.js +++ b/webpack.splash.prod.js @@ -3,7 +3,6 @@ require('dotenv').config() const webpack = require('webpack') const path = require('path') const UglifyJsPlugin = require('uglifyjs-webpack-plugin') -// const CleanWebpackPlugin = require('clean-webpack-plugin') module.exports = { entry: { |
