Code Monkey home page Code Monkey logo

vinderjs's People

Contributors

sizeight avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

atlasstrategic

vinderjs's Issues

reduxBaseElem should be able to accommodate paginated responses

A paginated response has a different structure than a response with all elements included. The reducer should be able to detect the type of response and insert into reducer correctly.

For example:
A response with all elements is an array of objects.

[
  {
    "id": 1,
  },
  {
    "id": 2,
  },
]

A paginated response is an abject with array of objects nested inside

{
  "count": 120,
  "page_size": 20,
  "previous": null,
  "page": 1,
  "next": 2,
  "results": [
    {
      "id": 1,
    },
    {
      "id": 2,
    },
  ],
}

Make validation & initialValues part of definition

Use Yup for validation. This wil result in libraries using our forms not having to install Yup package as well.

Example

[
  [
    {
      "name": "firstName",
      "type": "text",
      "label": "First Name",
      "validation" : { // New field
        "required": true,
        "min": 2,
        "max": 50
      },
      "required": true // Remove this, it is in validation field
    },
]

Reusable <EmptyList /> component

Display a neat centered empty list message for tables and lists that are empty.
Optional icon with message would be a nice feature.

AppIconFontAwesome cleaner structure

// fa-cogs
import { faCogs as faCogsLight } from '@fortawesome/pro-light-svg-icons/faCogs';
import { faCogs } from '@fortawesome/pro-regular-svg-icons/faCogs';
import { faCogs as faCogsSolid } from '@fortawesome/pro-solid-svg-icons/faCogs';
library.add(faCogsLight, faCogs, faCogsSolid);

rewrite as

// cogs
import { faCogs as falCogs } from '@fortawesome/pro-light-svg-icons/faCogs';
import { faCogs as farCogs } from '@fortawesome/pro-regular-svg-icons/faCogs';
import { faCogs as fasCogs } from '@fortawesome/pro-solid-svg-icons/faCogs';
library.add(falCogs, farCogs, fasCogs);

Introduce definition field to <CustomForm /> to describe form

const formDefinition = [
  [
    {
      type: 'datetime',
      name: 'date',
      label: 'Publish date',
      required: true,
      helpText: 'The published date of this post.',
      width: 8,
    },
    {
      type: 'select',
      name: 'status',
      label: 'Status',
      required: true,
      options: [
        { value: 'active', label: 'Published' },
        { value: 'draft', label: 'Draft' },
      ],
      width: 4,
    },
  ],
  [
    {
      type: 'text',
      name: 'title',
      label: 'Title',
      required: true,
      width: 8,
    },
  ],
  [
    {
      type: 'text',
      name: 'slug',
      label: 'Permalink',
      required: true,
      helpText: 'Caution, changing the permalink will break links to this page from other websites.',
      width: 8,
    },
  ],
  [
    {
      type: 'textarea',
      name: 'description',
      label: 'Description',
      required: true,
    },
  ],
  [
    {
      type: 'multi-checkbox',
      name: 'tags',
      label: 'Tags',
      helpText: 'Choose one or more tags.',
      options: tagOptions,
    },
  ],
];

<CustomForm
  definition={tagFormDefinition}
  initialValues={initialValues}
  validationSchema={validationSchema}
  onSubmit={...}
  onCancel={toggleForm}
/>

Introduce reusable WYSIWYG RichText editor

draft-rte does exactly what I need, but it doesn't seem to be actively maintained.
https://react-rte.org/demo

Draft.js is open source, widely used and actively maintained by FB.
https://draftjs.org/

Let's see if we can build our own RTE starting with Draft example and draft-js-utils
https://github.com/facebook/draft-js/tree/master/examples/draft-0-10-0/rich
https://github.com/sstur/draft-js-utils (By author of draft-rte to translate between draft editorState and HTML and vice versa)

Research findings:
Standalone Editors Built on Draft.js -> https://github.com/nikgraf/awesome-draft-js
Froala is a slick but expensice paid for version
Quill has no HTML preview

Upgrade react-datepicker 1.6.0 -> 2.0.0

react-popper dependency conflict

react-datepicker upgraded the react-popper dependency in the 1.6.0 -> 1.7.0 release. This caused our code to break. The reason has to do with reactstrap depending on react-popper 0.10.4 and react-datepicker now depending on a new react-popper major release 1.x.x.

Why would their differing dependencies cause a crash? isn't NPM supposed to manage conflicts like this? Yes, but the issue is inour webpack config.

Our config:

modules: [
  path.join(__dirname, '../node_modules')
]

This forces all modules to resolve from the root node_modules, causing reactstrap to reslover the wrong react-popper.

Change webpack config to:

modules: [
  'node_modules'
]

This resolves node_modules hierarchically.

Hoorah! Changing this fixed the problem!

Moment.js

react-datepicker 2.0.0 drops dependency on moment.js. We should adapt our code to now work without moment.js.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.