Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
7f4edaf
Merge pull request #4 from CodeLanka/add-location
agentmilindu Mar 30, 2020
8d44d77
UI Fixes
Apr 1, 2020
f8bd5d5
Merging suvin's changes to my master
tdevinda Apr 2, 2020
a2e536b
corrected some text and added new wording
tdevinda Apr 2, 2020
9a7f5a9
added target _blank
tdevinda Apr 2, 2020
c02f343
Moved images to local
Apr 2, 2020
88e9e8e
Merge pull request #6 from Suvink/master
agentmilindu Apr 2, 2020
28a114d
Merge pull request #7 from tdevinda/master
agentmilindu Apr 2, 2020
e12ed77
Merge branch 'Suvink-master' of github.com:CodeLanka/e-Pola
agentmilindu Apr 2, 2020
f52616a
Added MyRequests button
Apr 2, 2020
a5123ff
Merge pull request #8 from Suvink/master
agentmilindu Apr 2, 2020
5dffefc
Fix ESLInt issues
agentmilindu Apr 2, 2020
1c81c3b
Merge pull request #9 from CodeLanka/fix-eslint-errors
agentmilindu Apr 2, 2020
3fe4c79
Remove unwanted ESLintRC
agentmilindu Apr 2, 2020
bd0955e
ES Lint fixes
agentmilindu Apr 2, 2020
6fc8ad3
UI fixes
agentmilindu Apr 2, 2020
45d9641
Merge pull request #10 from CodeLanka/minor-fixes
agentmilindu Apr 2, 2020
2a1a10d
NeedDialog breakpoint issue fixed
Apr 2, 2020
381f8b0
Branding changes and added about page
Apr 3, 2020
3292fa9
Added About page and Minor UI Fixes
Apr 3, 2020
43d1483
Fix styles issue
agentmilindu Apr 4, 2020
20a1802
Fix typo catagory
agentmilindu Apr 4, 2020
98c010a
Change Categories
agentmilindu Apr 4, 2020
c657342
Added pngs and removed svgs
Apr 4, 2020
0887748
Merge branch 'master' of https://github.com/Suvink/e-Pola into Suvink…
agentmilindu Apr 4, 2020
2171661
Change Imoji spacing
agentmilindu Apr 4, 2020
e8db3e3
ES Lint
agentmilindu Apr 4, 2020
2150790
Added favicon
Apr 4, 2020
26bcacd
Added favicon
Apr 4, 2020
a40238c
changed the readme
tdevinda Apr 4, 2020
cb96571
Merge branch 'master' of https://github.com/CodeLanka/e-Pola
tdevinda Apr 4, 2020
3007faf
Added favicon
Apr 4, 2020
e528eb0
Added favicon
Apr 4, 2020
94e5e15
Add App Icons
agentmilindu Apr 4, 2020
5970c26
Added info to the about page
tdevinda Apr 4, 2020
24dda12
Merge pull request #13 from tdevinda/master
agentmilindu Apr 4, 2020
0bf29ec
Change Enoji sizes
agentmilindu Apr 4, 2020
4f3ef14
Merge pull request #14 from CodeLanka/improve-icons
agentmilindu Apr 4, 2020
1065234
Merge pull request #12 from Suvink/master
agentmilindu Apr 4, 2020
25e26f2
Fixes
agentmilindu Apr 4, 2020
f304868
Finish Rebranding
agentmilindu Apr 4, 2020
114b0df
Merge pull request #15 from CodeLanka/finish-rebranding
agentmilindu Apr 4, 2020
900526c
ES Lint
agentmilindu Apr 4, 2020
6cb8b3c
Improved User Account info
agentmilindu Apr 4, 2020
b86aaf8
Merge pull request #16 from CodeLanka/account-info
agentmilindu Apr 4, 2020
4600e90
Added Email template
Apr 5, 2020
f3697ae
added a checkmark to steps in home.
tdevinda Apr 5, 2020
d198d0c
eslint errors fixed fo auto verify
tdevinda Apr 6, 2020
57d640a
more lint errors fixed for ci
tdevinda Apr 6, 2020
c7c15c6
Merge pull request #18 from Suvink/master
agentmilindu Apr 10, 2020
1cd3cb1
Merge pull request #19 from tdevinda/master
agentmilindu Apr 10, 2020
609a795
Add React I18n
agentmilindu Apr 11, 2020
ecbb449
Merge pull request #20 from CodeLanka/add-react-i18n
agentmilindu Apr 11, 2020
a88b58b
Add React i18n improvements
agentmilindu Apr 11, 2020
87aec0d
Merge pull request #1 from CodeLanka/master
pamuditha Apr 11, 2020
875c5f5
added sinhala translations
pamuditha Apr 11, 2020
e5970d9
Add ability to choose lang
agentmilindu Apr 11, 2020
7819e2a
Merge pull request #22 from CodeLanka/add-react-i18n
agentmilindu Apr 11, 2020
f4a10ba
Merge pull request #21 from pamuditha/master
agentmilindu Apr 11, 2020
e323216
Fix typos
agentmilindu Apr 11, 2020
d2eb9bd
Fix typos
agentmilindu Apr 11, 2020
d1002ae
Added translations
Apr 11, 2020
b9693ac
Merge pull request #23 from Suvink/master
agentmilindu Apr 12, 2020
c612a66
added and changed translations
tdevinda Apr 12, 2020
0db8289
Merge branch 'master' of github.com:CodeLanka/e-Pola
agentmilindu Apr 12, 2020
d6465e8
Merge branch 'master' of https://github.com/CodeLanka/e-Pola
tdevinda Apr 12, 2020
62cc3db
Merge pull request #24 from tdevinda/master
agentmilindu Apr 12, 2020
652fdac
Merge branch 'master' into location
tdevinda Apr 15, 2020
be2e597
location update code
tdevinda Apr 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.local
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CI=false
# Needed to skip warnings from jest@beta in package.json
SKIP_PREFLIGHT_CHECK=true

5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,8 @@ module.exports = {
'import/no-dynamic-require': 0
}
}
]
],
globals: {
"fetch": false
}
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
**/*.log
.DS_Store
**/.DS_Store

.idea
*.iml
# Dependencies
**/node_modules

Expand Down
162 changes: 77 additions & 85 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# myProject
# GiveMe.lk (alias e-pola)

GiveMe.lk is a tool for connecting people with essential requirements during the social distancing peroid because the SARS-CoV-2 virus started to spread worldwide.

There are two main aspects of this tool

- Let people in isolation request items they need
- Let suppliers who are working to supply essentials see requirement quantity geographically

[![Build Status][build-status-image]][build-status-url]
[![Code Coverage][coverage-image]][coverage-url]
Expand All @@ -8,78 +15,64 @@

## Table of Contents

1. [Features](#features)
1. [Requirements](#requirements)
1. [Getting Started](#getting-started)
1. [Application Structure](#application-structure)
1. [Development](#development)
1. [Routing](#routing)
1. [Routing](#routing)
1. [Testing](#testing)
1. [Configuration](#configuration)
1. [Production](#production)
1. [Deployment](#deployment)

## Requirements

* node `^10.15.0`
* npm `^6.0.0`
- node `^10.15.0`
- npm `^6.0.0`

## Getting Started

1. Install app and functions dependencies: `npm i && npm i --prefix functions`
1. Install app and functions dependencies: `yarn`
1. Create `src/config.js` file that looks like so if it does not already exist:
```js
const firebase = {
// Config from Firebase console
}

// Overrides for for react-redux-firebase/redux-firestore config
export const reduxFirebase = {}

export const segmentId = '<- Segment ID ->'

export const publicVapidKey = '<- publicVapidKey from Firebase console ->'

export const sentryDsn = '<- DSN From Sentry.io ->'

export default {
env,
firebase,
reduxFirebase,
sentryDsn,
publicVapidKey,
segmentId
}
```
1. Start Development server: `npm start`

While developing, you will probably rely mostly on `npm start`; however, there are additional scripts at your disposal:

|`npm run <script>` |Description|
|-------------------|-----------|
|`start` |Serves your app at `localhost:3000` with automatic refreshing and hot module replacement|
|`start:dist` |Builds the application to `./dist` then serves at `localhost:3000` using firebase hosting emulator|
|`start:emulate` |Same as `start`, but pointed to database emulators (make sure to call `emulators` first to boot up emulators)|
|`build` |Builds the application to `./dist`|
|`emulators` |Starts database emulators for use with `start:emulate`|
|`emulators:all` |Starts database and hosting emulators (used in verify workflow by Cypress)|
|`test` |Runs unit tests with Jest. See [testing](#testing)|
|`test:watch` |Runs `test` in watch mode to re-run tests when changed|
|`test:ui` |Runs ui tests with Cypress. See [testing](#testing)|
|`test:ui:open` |Opens ui tests runner (Cypress Dashboard). See [testing](#testing)|
|`test:ui:emulate` |Same as `test:ui:open` but with tests pointed at emulators|
|`lint` |[Lints](http://stackoverflow.com/questions/8503559/what-is-linting) the project for potential errors|
|`lint:fix` |Lints the project and [fixes all correctable errors](http://eslint.org/docs/user-guide/command-line-interface.html#fix)|

[Husky](https://github.com/typicode/husky) is used to enable `prepush` hook capability. The `prepush` script currently runs `eslint`, which will keep you from pushing if there is any lint within your code. If you would like to disable this, remove the `prepush` script from the `package.json`.

```js
const firebase = {
// Config from Firebase console
// go to console.firebase.google.com
// select your project
// go to settings > General
// under your apps, select the web app
// if there is no app, create one.
};

// Overrides for for react-redux-firebase/redux-firestore config
export const reduxFirebase = {};

export const segmentId = "<- Segment ID ->";

export const publicVapidKey = "<- publicVapidKey from Firebase console ->";

export const sentryDsn = "<- DSN From Sentry.io ->";

export default {
env,
firebase,
reduxFirebase,
sentryDsn,
publicVapidKey,
segmentId,
};
```

1. Start Development server: `yarn start`

## Config Files

There are multiple configuration files:

* Firebase Project Configuration (including settings for how `src/config.js` is built on CI) - `.firebaserc`
* Project Configuration used within source (can change based on environment variables on CI) - `src/config.js`
* Cloud Functions Local Configuration - `functions/.runtimeconfig.json`
- Firebase Project Configuration (including settings for how `src/config.js` is built on CI) - `.firebaserc`
- Project Configuration used within source (can change based on environment variables on CI) - `src/config.js`
- Cloud Functions Local Configuration - `functions/.runtimeconfig.json`

More details in the [Application Structure Section](#application-structure)

Expand Down Expand Up @@ -141,33 +134,33 @@ There are two types of routes definitions:

The most simple way to define a route is a simple object with `path` and `component`:

*src/routes/Home/index.js*
_src/routes/Home/index.js_

```js
import HomePage from './components/HomePage'
import HomePage from "./components/HomePage";

// Sync route definition
export default {
path: '/',
component: HomePage
}
path: "/",
component: HomePage,
};
```

### Async Routes

Routes can also be seperated into their own bundles which are only loaded when visiting that route, which helps decrease the size of your main application bundle. Routes that are loaded asynchronously are defined using `loadable` function which uses `React.lazy` and `React.Suspense`:

*src/routes/NotFound/index.js*
_src/routes/NotFound/index.js_

```js
import loadable from 'utils/components'
import loadable from "utils/components";

// Async route definition
export default {
component: loadable(() =>
import(/* webpackChunkName: 'NotFound' */ './components/NotFoundPage')
)
}
import(/* webpackChunkName: 'NotFound' */ "./components/NotFoundPage")
),
};
```

With this setting, the name of the file (called a "chunk") is defined as part of the code as well as a loading spinner showing while the bundle file is loading.
Expand All @@ -184,20 +177,20 @@ To add a unit test, create a `.spec.js` or `.test.js` file anywhere inside of `s

Cypress is used to write and run UI tests which live in the `cypress` folder. The following npm scripts can be used to run tests:

* Run using Cypress run: `npm run test:ui`
* Open Test Runner UI (`cypress open`): `npm run test:ui:open`
- Run using Cypress run: `npm run test:ui`
- Open Test Runner UI (`cypress open`): `npm run test:ui:open`

To run tests against emulators:
1. Start database emulators: `npm run emulate`
1. Start React app pointed at emulators: `npm run start:emulate`
1. Open Cypress test runner with test utils pointed at emulators: `npm run test:ui:emulate`

1. Start database emulators: `npm run emulate`
1. Start React app pointed at emulators: `npm run start:emulate`
1. Open Cypress test runner with test utils pointed at emulators: `npm run test:ui:emulate`

To Run tests in CI add the following environment variables within your CI provider:

* `SERVICE_ACCOUNT` - Used to create custom auth tokens for test user login
* `FIREBASE_APP_NAME` - name of Firebase app (used to load SDK config)
* `TEST_UID` - UID of the user used for testing
- `SERVICE_ACCOUNT` - Used to create custom auth tokens for test user login
- `FIREBASE_APP_NAME` - name of Firebase app (used to load SDK config)
- `TEST_UID` - UID of the user used for testing

## Deployment

Expand All @@ -222,10 +215,10 @@ For more options on CI settings checkout the [firebase-ci docs](https://github.c

1. Run `firebase:login`
1. Initialize project with `firebase init` then answer:
* What file should be used for Database Rules? -> `database.rules.json`
* What do you want to use as your public directory? -> `build`
* Configure as a single-page app (rewrite all urls to /index.html)? -> `Yes`
* What Firebase project do you want to associate as default? -> **your Firebase project name**
- What file should be used for Database Rules? -> `database.rules.json`
- What do you want to use as your public directory? -> `build`
- Configure as a single-page app (rewrite all urls to /index.html)? -> `Yes`
- What Firebase project do you want to associate as default? -> **your Firebase project name**
1. Build Project: `npm run build`
1. Confirm Firebase config by running locally: `firebase serve`
1. Deploy to Firebase (everything including Hosting and Functions): `firebase deploy`
Expand All @@ -236,15 +229,14 @@ For more options on CI settings checkout the [firebase-ci docs](https://github.c

1. Why node `10` instead of a newer version?

[Cloud Functions runtime runs on `10`](https://cloud.google.com/functions/docs/writing/#the_cloud_functions_runtime), which is why that is what is used for the CI build version.
[Cloud Functions runtime runs on `10`](https://cloud.google.com/functions/docs/writing/#the_cloud_functions_runtime), which is why that is what is used for the CI build version.

[build-status-image]: https://img.shields.io/github/workflow/status/agentmilindu/myProject/Verify?style=flat-square
[build-status-url]: https://github.com/agentmilindu/myProject/actions
[climate-image]: https://img.shields.io/codeclimate/github/agentmilindu/myProject.svg?style=flat-square
[climate-url]: https://codeclimate.com/github/agentmilindu/myProject
[coverage-image]: https://img.shields.io/codeclimate/coverage/github/agentmilindu/myProject.svg?style=flat-square
[coverage-url]: https://codeclimate.com/github/agentmilindu/myProject
[license-image]: https://img.shields.io/npm/l/myProject.svg?style=flat-square
[license-url]: https://github.com/agentmilindu/myProject/blob/master/LICENSE
[build-status-image]: https://img.shields.io/github/workflow/status/CodeLanka/e-Pola/Verify?style=flat-square
[build-status-url]: https://github.com/CodeLanka/e-Pola/actions
[climate-image]: https://img.shields.io/codeclimate/github/CodeLanka/e-Pola.svg?style=flat-square
[climate-url]: https://codeclimate.com/github/CodeLanka/e-Pola
[coverage-image]: https://img.shields.io/codeclimate/coverage/github/CodeLanka/e-Pola.svg?style=flat-square
[coverage-url]: https://codeclimate.com/github/CodeLanka/e-Pola
[license-url]: https://github.com/CodeLanka/e-Pola/blob/master/LICENSE
[code-style-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[code-style-url]: http://standardjs.com/
4 changes: 1 addition & 3 deletions cypress/integration/ProjectsPage.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ describe('Needs Page', () => {
const newNeedTitle = 'Test need'
cy.get(createSelector('new-need-tile')).click()
// Type name of new need into input
cy.get(createSelector('new-need-name'))
.find('input')
.type(newNeedTitle)
cy.get(createSelector('new-need-name')).find('input').type(newNeedTitle)
// Click on the new need button
cy.get(createSelector('new-need-create-button')).click()
// Wait for request to Firebase to add need to return
Expand Down
Loading