Coder Social home page Coder Social logo

Comments (11)

gabrielrtakeda avatar gabrielrtakeda commented on August 11, 2024 2

Introduction

It should capture users data when use match widget.

API Structure

On the API, the Activist's table follows the fields below:

field type
id int
name string
email string
phone object
document_number string
document_type string
created_at timestamp
updated_at timestamp

Input fields

The name input should be the full name or we must add one more input, splitting in firstname and lastname and when we go to save that data, we concatenate each other.

Current

  • The current MatchWidget layout is following below:

screen shot 2016-08-02 at 20 44 46

With inputs to capture users data

  • Update: After selects the options of match, the name and email inputs should be shown:

screen shot 2016-08-03 at 13 04 12

- After all data has been filled up, the "Match" button enables:

screen shot 2016-08-02 at 20 59 14

With inputs error messages

  • If user inputs an email that not corresponds to correct email format, it shows an error message.

screen shot 2016-08-03 at 13 52 02

Code

The inputs may be rendered by a custom component <Input /> inside /app/scripts/components/MatchWidget directory. Something like jsx code below:

<Input
  uid="input-match-name"
  type="text"
  label="Nome"
  placeholder="Insira aqui seu nome"
  required={true}
  onChange={e => { this.setState({ name: e.target.value }) }}
  show={!!selectedChoiceA}
/>

from bonde-clients.

gabrielrtakeda avatar gabrielrtakeda commented on August 11, 2024

The error message is a reusable component that uses into FormWidget component too. For that reason, i'll isolate it in a separated file inside /app/components/FormUtil/Error.

Code example

<Error
  message="Email inválido"
  classes={['mb1', 'orange', 'regular']} // {array} optional, for more customizability
  styles={{ backgroundColor: '#fff' }} // {object} optional, for more customizability
/>

This file structure follows the conventions of mern-starter boilterplate for reusable components. (thanks to @igr-santos for the advices)

The <Input /> component may be inside that structure too.

from bonde-clients.

gabrielrtakeda avatar gabrielrtakeda commented on August 11, 2024

Needs to split <Input /> component in <Input /> and <Label /> components.
Current <Input /> component don't follow the SRP (Single Responsibility Principle), which render an input and label element. 😞

from bonde-clients.

igr-santos avatar igr-santos commented on August 11, 2024

Need have a responsibility to SRP (Single Responsibility Principle), I guess split code not is better choice, but a container with Input and Label according of props received a good choice

from bonde-clients.

gabrielrtakeda avatar gabrielrtakeda commented on August 11, 2024

Suggestion

The current <Input /> component renders the html below:

<div className="mb2" style="display: block">
  <label className="h4 caps bold mb1">Nome *</label>
  <input
    id="input-match-name"
    className="field-light block full-width h3"
    onChange="function()"
    placeholder="Insira seu nome aqui"
    type="text"
    required="false"
  />
</div>

Options

The options a have are:

  • Pass <label> element as a children of Input but, this isn't a good idea semantically. And because i don't want to write the line <label className="h4 caps bold mb1">Nome *</label> every time i need the <label> element.
<Input
  uid="input-match-name"
  type="text"
  placeholder="Insira aqui seu nome">
  <label className="h4 caps bold mb1">Nome *</label>
</Input>
  • Or split it and treat it as a separated components.
<Label text="Nome *" />
<Input
  uid="input-match-name"
  type="text"
  placeholder="Insira aqui seu nome"
/>

Motivation

It's more a question of standardization than how components will work together.. I don't want to write every the same css classes to renders a label that already exists in another part of application.

from bonde-clients.

gabrielrtakeda avatar gabrielrtakeda commented on August 11, 2024

Needs to migrate MatchWidget to new modularized structure.

from bonde-clients.

gabrielrtakeda avatar gabrielrtakeda commented on August 11, 2024

Needs to refactor action types, which actually is included in WidgetActions.js file.

from bonde-clients.

gabrielrtakeda avatar gabrielrtakeda commented on August 11, 2024

Needs to create an endpoint to save user and selected match data. The payload may be something like this:

Payload

// This is what API will receive as payload.
{
  "activist_match": {
    "match_id": 72,
    "activist": {
      "name": "Gabriel Ramos Takeda",
      "email": "[email protected]"
    }
  }
}

And, how we will send these data on the "activists view" side, we'll don't have any credential data. So the API must don't needs to authenticate the post request. (Maybe warning?)

from bonde-clients.

gabrielrtakeda avatar gabrielrtakeda commented on August 11, 2024

API commit: nossas/bonde-server@e91e9d0

from bonde-clients.

gabrielrtakeda avatar gabrielrtakeda commented on August 11, 2024

Needs to merge add-modularized-structure into add-match-widget branch and adapt according to the new modularized folder structure.

from bonde-clients.

gabrielrtakeda avatar gabrielrtakeda commented on August 11, 2024

Needs to add lastname to sync with mailchimp.

Screenshot:

screen shot 2016-08-09 at 13 34 48

from bonde-clients.

Related Issues (20)

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.