@bigbinary/neeto-slack-frontend 0.1.0 → 0.2.1

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/README.md CHANGED
@@ -15,6 +15,7 @@ Available components:
15
15
  - [Connect](#connect)
16
16
  - [Configure](#configure)
17
17
  - [Finish](#finish)
18
+ - [Settings](#settings)
18
19
 
19
20
  View the [example app](./example/src/App.jsx) to see usage.
20
21
 
@@ -414,6 +415,216 @@ Extra fields that need to be displayed in the finish page.
414
415
  </tbody>
415
416
  </table>
416
417
 
418
+ ### Settings
419
+
420
+ ![image](https://user-images.githubusercontent.com/49012815/222901321-f9710196-6721-4ad4-affc-679f65ad4919.png)
421
+
422
+ ```js
423
+ const SETTINGS_FORM_INITIAL_VALUES = {
424
+ channels: [
425
+ { label: "general", value: "K87KJHKS987" },
426
+ { label: "hq", value: "IJHKJ76889H" },
427
+ ],
428
+ selectedChannel: { label: "general", value: "K87KJHKS987" },
429
+ name: "",
430
+ };
431
+
432
+ const { slack, handleSubmit, isSubmitting } = useSlackApi();
433
+ const SETTINGS_FORM_VALIDATION_SCHEMA = {
434
+ name: yup.string().required(),
435
+ };
436
+
437
+ return (
438
+ <Settings
439
+ teamName={slack.teamName}
440
+ initialFormValues={SETTINGS_FORM_INITIAL_VALUES}
441
+ handleSubmit={handleSubmit}
442
+ isSubmitting={isSubmitting}
443
+ className="neeto-ui-my-2"
444
+ validationSchema={SETTINGS_FORM_VALIDATION_SCHEMA}
445
+ >
446
+ {({isDisabled, ...formikProps}) => (
447
+ <Input name="name" value={formikProps.values.name} disabled={isDisabled} className="neeto-ui-my-2" />
448
+ )}
449
+ </Settings>;
450
+ );
451
+ ```
452
+
453
+ <table>
454
+ <thead>
455
+ <tr>
456
+ <th>
457
+
458
+ Prop
459
+
460
+ </th>
461
+ <th>
462
+
463
+ Type
464
+
465
+ </th>
466
+ <th>
467
+
468
+ Description
469
+
470
+ </th>
471
+ </tr>
472
+ </thead>
473
+ <tbody>
474
+
475
+ <tr>
476
+ <td style="vertical-align: top;">
477
+
478
+ children
479
+
480
+ </td>
481
+ <td style="vertical-align: top;">
482
+
483
+ Function | JSX.Element
484
+
485
+ </td>
486
+ <td style="vertical-align: top;">
487
+
488
+ Extra form fields to be included on the ` Configure` page. `isDisabled` should
489
+ be used to disable fields such that they are enabled only by clicking the edit
490
+ button.
491
+
492
+ </td>
493
+ </tr>
494
+ <tr></tr>
495
+ <tr>
496
+ <td style="vertical-align: top;">
497
+
498
+ loading
499
+
500
+ </td>
501
+ <td style="vertical-align: top;">
502
+
503
+ boolean
504
+
505
+ </td>
506
+ <td style="vertical-align: top;">
507
+
508
+ A spinner is disabled instead of form when loading is true.
509
+
510
+ </td>
511
+ </tr>
512
+ <tr></tr>
513
+
514
+ <tr>
515
+ <td style="vertical-align: top;">
516
+
517
+ teamName
518
+
519
+ </td>
520
+ <td style="vertical-align: top;">
521
+
522
+ String
523
+
524
+ </td>
525
+ <td style="vertical-align: top;">
526
+
527
+ Slack team name to be displayed.
528
+
529
+ </td>
530
+ </tr>
531
+ <tr></tr>
532
+ <tr>
533
+ <td style="vertical-align: top;">
534
+
535
+ initialFormValues
536
+
537
+ </td>
538
+ <td style="vertical-align: top;">
539
+
540
+ Object
541
+
542
+ </td>
543
+ <td style="vertical-align: top;">
544
+
545
+ Initial form values for formik. <br/> (Note: Include channels array &
546
+ selectedChannel value) <br/> [Example](./example/src/constants.js)
547
+
548
+ </td>
549
+ </tr>
550
+ <tr></tr>
551
+ <tr>
552
+ <td style="vertical-align: top;">
553
+
554
+ handleSubmit
555
+
556
+ </td>
557
+ <td style="vertical-align: top;">
558
+
559
+ Function
560
+
561
+ </td>
562
+ <td style="vertical-align: top;">
563
+
564
+ Handle formik submit.
565
+
566
+ </td>
567
+ </tr>
568
+ <tr></tr>
569
+ <tr>
570
+ <td style="vertical-align: top;">
571
+
572
+ isSubmitting
573
+
574
+ </td>
575
+ <td style="vertical-align: top;">
576
+
577
+ bool
578
+
579
+ </td>
580
+ <td style="vertical-align: top;">
581
+
582
+ Boolean which is set when submitting the form.
583
+
584
+ </td>
585
+ </tr>
586
+ <tr></tr>
587
+ <tr>
588
+ <td style="vertical-align: top;">
589
+
590
+ className?
591
+
592
+ </td>
593
+ <td style="vertical-align: top;">
594
+
595
+ String
596
+
597
+ </td>
598
+ <td style="vertical-align: top;">
599
+
600
+ Custom classnames to be applied to Configure component
601
+
602
+ </td>
603
+ </tr>
604
+ <tr></tr>
605
+ <tr>
606
+ <td style="vertical-align: top;">
607
+
608
+ validationSchema
609
+
610
+ </td>
611
+ <td style="vertical-align: top;">
612
+
613
+ Object
614
+
615
+ </td>
616
+ <td style="vertical-align: top;">
617
+
618
+ Validation schema for fields using yup.<br/> (Note: No need to include
619
+ selectedChannel validation. Also no need to wrap validationSchema in
620
+ yup.object().shape({..}))<br/> [Example](./example/src/constants.js)
621
+
622
+ </td>
623
+ </tr>
624
+ <tr></tr>
625
+ </tbody>
626
+ </table>
627
+
417
628
  ## Development
418
629
 
419
630
  Install all the dependencies by executing the following command
@@ -445,8 +656,24 @@ will run the example app using webpack.
445
656
  host if changes are not applied.
446
657
  8. Video explanation on how to use yalc: https://vimeo.com/722958162/9e931b640c
447
658
 
448
- ## Building
449
-
450
- The neetoSlack package gets auto-published to npm for every new merge to the
451
- main branch. You can checkout the publish workflow in git actions to get a live
452
- update.
659
+ # Building and releasing.
660
+
661
+ The `@bigbinary/neeto-slack-frontend` package gets published to NPM when we
662
+ merge a PR with `patch`, `minor` or `major` label to the `main` branch. The
663
+ `patch` label is used for bug fixes, `minor` label is used for new features and
664
+ `major` label is used for breaking changes. You can checkout the
665
+ `Create and publish releases` workflow in GitHub Actions to get a live update.
666
+
667
+ In case if you missed to add the label, you can manually publish the package.
668
+ For that first you need to create a PR to update the version number in the
669
+ `package.json` file and merge it to the `main` branch. After merging the PR, you
670
+ need to create a
671
+ [new github release](https://github.com/bigbinary/neeto-slack-frontend/releases/new)
672
+ from main branch. Whenever a new release is created with a new version number,
673
+ the github actions will automatically publish the built package to npm. You can
674
+ checkout the `Publish to npm` workflow in GitHub Actions to get a live update.
675
+
676
+ Please note that before publishing the package, you need to verify the
677
+ functionality in some of the neeto web-apps locally using `yalc` package
678
+ manager. The usage of yalc is explained in this video:
679
+ https://youtu.be/QBiYGP0Rhe0