@bigbinary/neeto-github-frontend 1.0.10 → 1.0.11

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.
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import React, { useState, useRef } from 'react';
2
+ import classNames from 'classnames';
2
3
  import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
3
4
  import { Settings, Plus, Building, User, CannedResponses, Lock } from '@bigbinary/neeto-icons';
4
5
  import { Button, Typography, Input, Pane } from '@bigbinary/neetoui';
5
6
  import { Github } from '@bigbinary/neeto-icons/misc';
6
- import classNames from 'classnames';
7
7
  import { isPresent, noop } from '@bigbinary/neeto-cist';
8
8
  import Search from '@bigbinary/neeto-molecules/Search';
9
9
  import { Trans, useTranslation } from 'react-i18next';
@@ -77,9 +77,9 @@ var List$1 = withT(function (_ref) {
77
77
  return window.open(profileUrl, "_blank");
78
78
  }
79
79
  }), /*#__PURE__*/React.createElement(Typography, {
80
- className: "neeto-ui-text-gray-900 mx-2 text-sm",
80
+ className: "neeto-ui-text-gray-900 mx-2 text-lg",
81
81
  component: "span",
82
- style: "h3"
82
+ style: "h2"
83
83
  }, "\u2022"), /*#__PURE__*/React.createElement(Typography, {
84
84
  style: "body2"
85
85
  }, t("neetoGithub.countOf.repos", {
@@ -197,10 +197,15 @@ var NoRepositories = withT(function (_ref) {
197
197
  });
198
198
 
199
199
  var RepositoryTile = function RepositoryTile(_ref) {
200
- var onConnect = _ref.onConnect,
200
+ var isConnecting = _ref.isConnecting,
201
+ onConnect = _ref.onConnect,
201
202
  repository = _ref.repository;
202
203
  var _useTranslation = useTranslation(),
203
204
  t = _useTranslation.t;
205
+ var _useState = useState(false),
206
+ _useState2 = _slicedToArray(_useState, 2),
207
+ isLoading = _useState2[0],
208
+ setIsLoading = _useState2[1];
204
209
  var id = repository.id,
205
210
  fullName = repository.fullName,
206
211
  isPrivate = repository.isPrivate,
@@ -219,18 +224,21 @@ var RepositoryTile = function RepositoryTile(_ref) {
219
224
  }), /*#__PURE__*/React.createElement("div", {
220
225
  className: "hidden md:inline-block"
221
226
  }, /*#__PURE__*/React.createElement(Typography, {
222
- className: "neeto-ui-text-gray-900 mx-2 text-sm",
227
+ className: "neeto-ui-text-gray-900 mx-2 text-lg",
223
228
  component: "span",
224
- style: "h3"
229
+ style: "h2"
225
230
  }, "\u2022"), /*#__PURE__*/React.createElement(DateFormat.FromNow, {
226
231
  date: updatedAt
227
232
  }))), /*#__PURE__*/React.createElement(Button, {
233
+ disabled: isConnecting,
234
+ loading: isLoading,
228
235
  style: "primary",
229
236
  type: "button",
230
237
  onClick: function onClick() {
231
238
  return onConnect({
232
239
  repoType: "private",
233
- repository: repository
240
+ repository: repository,
241
+ setIsLoading: setIsLoading
234
242
  });
235
243
  }
236
244
  }, t("neetoGithub.connect")));
@@ -241,6 +249,7 @@ var List = withT(function (_ref) {
241
249
  isPublicRepoAllowed = _ref.isPublicRepoAllowed,
242
250
  filteredRepositories = _ref.filteredRepositories,
243
251
  repositories = _ref.repositories,
252
+ isConnecting = _ref.isConnecting,
244
253
  onConnect = _ref.onConnect,
245
254
  installationUrl = _ref.installationUrl,
246
255
  troubleshootUrl = _ref.troubleshootUrl;
@@ -251,10 +260,12 @@ var List = withT(function (_ref) {
251
260
  })
252
261
  }, isPresent(repositories) ? /*#__PURE__*/React.createElement(Scrollable, {
253
262
  className: "m-0 h-full w-full overflow-y-scroll p-0 shadow-inner"
254
- }, isPresent(filteredRepositories) ? filteredRepositories.map(function (repository) {
263
+ }, isPresent(filteredRepositories) ? filteredRepositories.map(function (repository, index) {
255
264
  return /*#__PURE__*/React.createElement(RepositoryTile, {
265
+ isConnecting: isConnecting,
256
266
  onConnect: onConnect,
257
- repository: repository
267
+ repository: repository,
268
+ key: index
258
269
  });
259
270
  }) : /*#__PURE__*/React.createElement(Typography, {
260
271
  className: "flex h-full w-full items-center justify-center",
@@ -286,6 +297,7 @@ var NotConnected = withT(function (_ref) {
286
297
 
287
298
  var Private = function Private(_ref) {
288
299
  var isConnected = _ref.isConnected,
300
+ isConnecting = _ref.isConnecting,
289
301
  isPublicRepoAllowed = _ref.isPublicRepoAllowed,
290
302
  repositories = _ref.repositories,
291
303
  onConnect = _ref.onConnect,
@@ -324,9 +336,10 @@ var Private = function Private(_ref) {
324
336
  count: filteredRepositories.length
325
337
  }))
326
338
  }), /*#__PURE__*/React.createElement(List, {
327
- isPublicRepoAllowed: isPublicRepoAllowed,
328
339
  filteredRepositories: filteredRepositories,
329
340
  installationUrl: installationUrl,
341
+ isConnecting: isConnecting,
342
+ isPublicRepoAllowed: isPublicRepoAllowed,
330
343
  onConnect: onConnect,
331
344
  repositories: repositories,
332
345
  troubleshootUrl: troubleshootUrl
@@ -340,13 +353,18 @@ var Private = function Private(_ref) {
340
353
  };
341
354
 
342
355
  var Public = function Public(_ref) {
343
- var onConnect = _ref.onConnect;
356
+ var isConnecting = _ref.isConnecting,
357
+ onConnect = _ref.onConnect;
344
358
  var _useTranslation = useTranslation(),
345
359
  t = _useTranslation.t;
346
- var _useState = useState(""),
360
+ var _useState = useState(false),
347
361
  _useState2 = _slicedToArray(_useState, 2),
348
- publicRepoUrl = _useState2[0],
349
- setPublicRepoUrl = _useState2[1];
362
+ isLoading = _useState2[0],
363
+ setIsLoading = _useState2[1];
364
+ var _useState3 = useState(""),
365
+ _useState4 = _slicedToArray(_useState3, 2),
366
+ publicRepoUrl = _useState4[0],
367
+ setPublicRepoUrl = _useState4[1];
350
368
  return /*#__PURE__*/React.createElement("div", {
351
369
  className: "transition-drop-shadow neeto-ui-border-gray-300 neeto-ui-rounded-md border border-solid px-8 py-7 font-sans transition-colors"
352
370
  }, /*#__PURE__*/React.createElement("div", {
@@ -386,7 +404,8 @@ var Public = function Public(_ref) {
386
404
  className: "relative"
387
405
  }, /*#__PURE__*/React.createElement(Button, {
388
406
  className: "rounded-b rounded-l-none rounded-r rounded-t",
389
- disabled: !isPresent(publicRepoUrl),
407
+ disabled: !isPresent(publicRepoUrl) || isLoading || isConnecting,
408
+ loading: isLoading,
390
409
  size: "large",
391
410
  style: "primary",
392
411
  type: "button",
@@ -395,7 +414,8 @@ var Public = function Public(_ref) {
395
414
  repoType: "public",
396
415
  repository: {
397
416
  fullName: publicRepoUrl
398
- }
417
+ },
418
+ setIsLoading: setIsLoading
399
419
  });
400
420
  }
401
421
  }, t("neetoGithub.continue"))))));
@@ -403,6 +423,7 @@ var Public = function Public(_ref) {
403
423
 
404
424
  var Repositories = function Repositories(_ref) {
405
425
  var isConnected = _ref.isConnected,
426
+ isConnecting = _ref.isConnecting,
406
427
  isPublicRepoAllowed = _ref.isPublicRepoAllowed,
407
428
  repositories = _ref.repositories,
408
429
  onConnect = _ref.onConnect,
@@ -411,13 +432,15 @@ var Repositories = function Repositories(_ref) {
411
432
  return /*#__PURE__*/React.createElement("div", {
412
433
  className: "w-full space-y-6"
413
434
  }, /*#__PURE__*/React.createElement(Private, {
414
- isPublicRepoAllowed: isPublicRepoAllowed,
415
435
  installationUrl: installationUrl,
416
436
  isConnected: isConnected,
437
+ isConnecting: isConnecting,
438
+ isPublicRepoAllowed: isPublicRepoAllowed,
417
439
  onConnect: onConnect,
418
440
  repositories: repositories,
419
441
  troubleshootUrl: troubleshootUrl
420
442
  }), isPublicRepoAllowed && /*#__PURE__*/React.createElement(Public, {
443
+ isConnecting: isConnecting,
421
444
  onConnect: onConnect
422
445
  }));
423
446
  };
@@ -427,6 +450,8 @@ var NeetoGithubNanoContainer = function NeetoGithubNanoContainer(_ref) {
427
450
  accounts = _ref$accounts === void 0 ? [] : _ref$accounts,
428
451
  installationUrl = _ref.installationUrl,
429
452
  isConnected = _ref.isConnected,
453
+ _ref$isConnecting = _ref.isConnecting,
454
+ isConnecting = _ref$isConnecting === void 0 ? false : _ref$isConnecting,
430
455
  _ref$isPublicRepoAllo = _ref.isPublicRepoAllowed,
431
456
  isPublicRepoAllowed = _ref$isPublicRepoAllo === void 0 ? false : _ref$isPublicRepoAllo,
432
457
  onConnect = _ref.onConnect,
@@ -436,10 +461,14 @@ var NeetoGithubNanoContainer = function NeetoGithubNanoContainer(_ref) {
436
461
  _ref$isPane = _ref.isPane,
437
462
  isPane = _ref$isPane === void 0 ? false : _ref$isPane;
438
463
  return /*#__PURE__*/React.createElement("div", {
439
- className: "flex w-full flex-col-reverse xl:flex-row"
464
+ className: classNames("flex w-full flex-col-reverse", {
465
+ "2xl:flex-row": isPane,
466
+ "xl:flex-row": !isPane
467
+ })
440
468
  }, /*#__PURE__*/React.createElement(Repositories, {
441
469
  installationUrl: installationUrl,
442
470
  isConnected: isConnected,
471
+ isConnecting: isConnecting,
443
472
  isPublicRepoAllowed: isPublicRepoAllowed,
444
473
  onConnect: onConnect,
445
474
  repositories: repositories,
@@ -448,8 +477,8 @@ var NeetoGithubNanoContainer = function NeetoGithubNanoContainer(_ref) {
448
477
  accounts: accounts,
449
478
  installationUrl: installationUrl,
450
479
  isConnected: isConnected,
451
- onConnect: onConnect,
452
- isPane: isPane
480
+ isPane: isPane,
481
+ onConnect: onConnect
453
482
  }));
454
483
  };
455
484
 
@@ -2706,9 +2735,11 @@ var newInstallationParams = lib.stringify({
2706
2735
  var NEW_INSTALLATION_URL = "/github_integrations/app_installations/new?".concat(newInstallationParams);
2707
2736
  var TROUBLESHOOT_URL = "https://render.com/docs/github#troubleshooting";
2708
2737
 
2709
- var NeetoGithubNanoModal = function NeetoGithubNanoModal(_ref) {
2738
+ var NeetoGithubNanoPane = function NeetoGithubNanoPane(_ref) {
2710
2739
  var isOpen = _ref.isOpen,
2711
2740
  onClose = _ref.onClose,
2741
+ _ref$isConnecting = _ref.isConnecting,
2742
+ isConnecting = _ref$isConnecting === void 0 ? false : _ref$isConnecting,
2712
2743
  _ref$isConnected = _ref.isConnected,
2713
2744
  isConnected = _ref$isConnected === void 0 ? false : _ref$isConnected,
2714
2745
  _ref$isPublicRepoAllo = _ref.isPublicRepoAllowed,
@@ -2745,6 +2776,7 @@ var NeetoGithubNanoModal = function NeetoGithubNanoModal(_ref) {
2745
2776
  accounts: accounts,
2746
2777
  installationUrl: installationUrl,
2747
2778
  isConnected: isConnected,
2779
+ isConnecting: isConnecting,
2748
2780
  isPublicRepoAllowed: isPublicRepoAllowed,
2749
2781
  onConnect: onConnect,
2750
2782
  repositories: repositories,
@@ -2758,5 +2790,5 @@ var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r
2758
2790
  var css = ".width-calc{width:calc(100% - 82px)}.neeto-github-modal-pane-wrapper{width:min(75%,1280px)}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL2NvbXBvbmVudHMvX3JlcG9zaXRvcnktdGlsZS5zY3NzIiwiYXBwL2phdmFzY3JpcHQvc3R5bGVzaGVldHMvYXBwbGljYXRpb24uc2NzcyIsImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL2NvbXBvbmVudHMvX3BhbmUuc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxZQUNFLHVCQ0NGLENDRkEsaUNBQ0UscUJES0YiLCJzb3VyY2VzQ29udGVudCI6WyIud2lkdGgtY2FsYyB7XG4gIHdpZHRoOiBjYWxjKDEwMCUgLSA4MnB4KTtcbn1cbiIsIi53aWR0aC1jYWxjIHtcbiAgd2lkdGg6IGNhbGMoMTAwJSAtIDgycHgpO1xufVxuXG4ubmVldG8tZ2l0aHViLW1vZGFsLXBhbmUtd3JhcHBlciB7XG4gIHdpZHRoOiBtaW4oNzUlLCAxMjgwcHgpO1xufSIsIi5uZWV0by1naXRodWItbW9kYWwtcGFuZS13cmFwcGVyIHtcbiAgd2lkdGg6IG1pbig3NSUsIDEyODBweCk7XG59XG4iXX0= */";
2759
2791
  n(css,{});
2760
2792
 
2761
- export { NeetoGithubNanoContainer, NeetoGithubNanoModal };
2793
+ export { NeetoGithubNanoContainer, NeetoGithubNanoPane };
2762
2794
  //# sourceMappingURL=index.js.map