@lingk/sync 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -213,13 +213,13 @@ module.exports =
213
213
  return _react2.default.createElement(
214
214
  'div',
215
215
  { className: 'env-section-body' },
216
- config.message && !isGoogle && _react2.default.createElement(
216
+ config.message && !isGoogle && !isFlatFile ? _react2.default.createElement(
217
217
  'p',
218
218
  null,
219
219
  config.message,
220
220
  _react2.default.createElement('br', null),
221
221
  _react2.default.createElement('br', null)
222
- ),
222
+ ) : _react2.default.createElement('div', { style: { height: 13 } }),
223
223
  isOauth ? _react2.default.createElement(Oauth, { wizard: wizard, onCheck: check,
224
224
  creds: this.props.creds, providerType: providerType,
225
225
  onGenerateUrl: function onGenerateUrl(urlType) {
@@ -463,6 +463,13 @@ module.exports =
463
463
  });
464
464
  };
465
465
 
466
+ _this3.onReject = function () {
467
+ _this3.setState({ dropError: 'File is too big!' });
468
+ setTimeout(function () {
469
+ _this3.setState({ dropError: null });
470
+ }, 3500);
471
+ };
472
+
466
473
  _this3.upload = function () {
467
474
  var _this3$props = _this3.props,
468
475
  setCsvFields = _this3$props.setCsvFields,
@@ -477,7 +484,8 @@ module.exports =
477
484
  _this3.state = {
478
485
  meta: [],
479
486
  fileContents: [],
480
- uploading: false
487
+ uploading: false,
488
+ dropError: null
481
489
  };
482
490
  return _this3;
483
491
  }
@@ -487,7 +495,8 @@ module.exports =
487
495
  value: function render() {
488
496
  var _state = this.state,
489
497
  meta = _state.meta,
490
- uploading = _state.uploading;
498
+ uploading = _state.uploading,
499
+ dropError = _state.dropError;
491
500
  var _props2 = this.props,
492
501
  metadata = _props2.metadata,
493
502
  inputs = _props2.inputs;
@@ -503,12 +512,16 @@ module.exports =
503
512
  { style: { display: 'inline-block' } },
504
513
  _react2.default.createElement(
505
514
  _reactDropzone2.default,
506
- { onDrop: this.onDrop,
507
- className: 'dropzone' },
508
- _react2.default.createElement(
515
+ { onDropAccepted: this.onDrop, onDropRejected: this.onReject,
516
+ className: 'dropzone', maxSize: 1000000 },
517
+ !dropError ? _react2.default.createElement(
509
518
  'p',
510
519
  null,
511
- 'Drop one or more files here, or click to select files to upload.'
520
+ 'Drop one or more CSV files here, or click to select files to upload.'
521
+ ) : _react2.default.createElement(
522
+ 'p',
523
+ { style: { color: '#c9302c', fontWeight: 'bold' } },
524
+ dropError
512
525
  )
513
526
  )
514
527
  ),
@@ -549,7 +562,7 @@ module.exports =
549
562
  meta.map(function (f, i) {
550
563
  return _react2.default.createElement(
551
564
  'li',
552
- { key: i },
565
+ { key: i, style: { listStyle: 'none' } },
553
566
  f.name,
554
567
  ' - ',
555
568
  formatBytes(f.byteSize)
@@ -557,19 +570,37 @@ module.exports =
557
570
  })
558
571
  )
559
572
  ),
560
- !uploading && metadata && metadata.length > 0 && _react2.default.createElement(
573
+ !uploading && !hasFile && metadata && metadata.length > 0 && _react2.default.createElement(
561
574
  'div',
562
- {
563
- style: { marginLeft: 20, display: 'inline-block', marginTop: 13, verticalAlign: 'top' } },
575
+ { style: {
576
+ marginLeft: 20, display: 'inline-block', marginTop: 13, verticalAlign: 'top'
577
+ } },
564
578
  _react2.default.createElement(
565
- 'strong',
566
- { style: { marginRight: 5 } },
567
- metadata && metadata.length
579
+ 'div',
580
+ { style: { marginBottom: 4 } },
581
+ _react2.default.createElement(
582
+ 'strong',
583
+ { style: { marginRight: 5 } },
584
+ metadata && metadata.length
585
+ ),
586
+ _react2.default.createElement(
587
+ 'strong',
588
+ null,
589
+ 'file' + (metadata.length === 1 ? '' : 's') + ' uploaded'
590
+ )
568
591
  ),
569
592
  _react2.default.createElement(
570
- 'span',
593
+ 'ul',
571
594
  null,
572
- 'file' + (metadata.length === 1 ? '' : 's') + ' uploaded'
595
+ metadata.map(function (f, i) {
596
+ return _react2.default.createElement(
597
+ 'li',
598
+ { key: i, style: { listStyle: 'none' } },
599
+ f.name,
600
+ ' - ',
601
+ formatBytes(f.byteSize)
602
+ );
603
+ })
573
604
  )
574
605
  )
575
606
  );