Skip to content

delphineuw/Us

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Us


Table of Contents

  1. Setup
  2. Admin Panel
  3. Components

LGU remark

- Mysql DB - npx sequelize-cli db:seed:all - comment event.start/end - fix some issues for localhost string - ifconfig for ip = IF - android : same wifi as server - android mi A1 : fucked up layout

Setup 🖥

git clone

cd <directory>

npm install

additionnal :

// npm install netlify-cli -g brew tap heroku/brew && brew install heroku

You have to set environnement variables in the "backend" directory as follows:

// nodemon.json

{
  "env": {
    "PORT": 4000,
    "DB_HOST": <localhost?>,
    "DB_USER": "root",
    "DB_PASSWORD": <password?>,
    "DB_NAME": "us"
  }
}

in the config directory, add a file called config.json.

{
  "development": {
    "username": "root",
    "password": "<password?>",
    "database": "us",
    "host": " <localhost?>",
    "dialect": "mysql",
    "PORT": 4000
  },
  "test": {
    "username": "root",
    "password": "<password?>",
    "database": "us",
    "host": " <localhost?>",
    "dialect": "mysql",
    "PORT": 4000
  },
  "production": {
    "username": "root",
    "password": "<password?>",
    "database": "us",
    "host": " <localhost?>",
    "dialect": "mysql",
    "PORT": 4000
  }
}

In the case, you receive a network issue message; add a file in utils, names 'idAdd.js' and add it to the gitignore file. Inside this file, add your ip address. repeat the operation in the frontend directory;

const ipAdd = "<your ip address>";
export default ipAdd;

When it's done, setup sequelize with this cmds

npx sequelize db:migrate

you can read more on the sequelize doc here => https://github.com/sequelize/cli

To run the app, install expo and/or an IOS/Android emulator.

Admin Panel 📝

you can manage the app with the Admin Panel at this address

http://localhost:4000/admin/login

in order to login, add this lines to the nodemon.json file;

{
  "env": {
    "PORT": 4000,
    "DB_HOST": <localhost?>,
    "DB_USER": "root",
    "DB_PASSWORD": <password?>,
    "DB_NAME": "us"
    "ADMIN_EMAIL": "<email?>",
    "ADMIN_PASSWORD": "<user_name?>"
  }
}

Components Doc 📝

Form

v2

<Form inputs={exampleForm} onSubmit={submitHandler} />

inputs

  • Type: Array
  • Required: True

onSubmmit

  • Type: Callback
  • Required: True

Text Input

v2

<InputTemplate
    placeholder={input.placeholder}
    label={input.label}
    multiline={input.multiline}
    type={input.type}
    security={input.security}
    autoCapitalize={input.autoCapitalize}
    value={input.value}
    onChange={text => changeHandler(text, input)}
    />

id

  • Type: Number
  • Required: True

render

  • Type: 'text'
  • Required: True

placeholder

  • Type: String
  • Required: False

label

  • Type: String
  • Required: True

multiline

  • Type: Boolean
  • Required: True

type

security

  • Type: Boolean
  • Required: False

autoCapitalize

  • Type: String
  • Required: True

value

  • Type: String
  • Required: True

Radio Input

v2

<RadioTemplate
       label={input.label}
       options={input.options}
       value={input.value}
       onChange={option => changeHandler(option, input)}
       />

label

  • Type: String
  • Required: True

options

  • Type: Array
  • Required: True

value

  • Type: String
  • Required: True

Date Input

v2

<DatePickerTemplate
       label={input.label}
       value={input.value}
       onChange={date => changeHandler(date, input)}
       />

label

  • Type: String
  • Required: True

value

  • Type: String
  • Required: True

Example:

const exampleForm = [
  {
    id: 1,
    render: 'text',
    placeholder: 'Write here...',
    label: 'Email',
    multiline: false,
    type: 'emailAddress',
    security: false,
    autoCapitalize: 'none',
    value: ''
  },
  {
    id: 2,
    render: 'text',
    placeholder: 'Write here...',
    label: 'Password',
    multiline: false,
    type: 'password',
    security: true,
    autoCapitalize: 'none',
    value: ''
  },
  {
    id: 3,
    render: 'radio',
    label: 'Gender',
    options: ['Male', 'Female', 'Other'],
    value: 'Other'
  },
  {
    id: 4,
    render: 'date',
    label: 'Date of birth',
    value: new Date()
  }
];

const App = () => {
  const submitHandler = data => console.log(data);

  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <FormTemplate inputs={exampleForm} onSubmit={submitHandler} />
    </View>
  );
};

WORK IN PROGRESS ...

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •