Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 12 additions & 11 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,28 @@ name: Continuous Integration

on:
push:
branches:
branches:
- '**'

pull_request:
branches:
branches:
- '**'

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build
- run: npm test
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try



/package-lock.json
2 changes: 1 addition & 1 deletion .husky/post-checkout
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if [[ "$NODE_ENV" != "production" ]]; then

echo "\n 🚧 Dependencies are being installed, please wait for a while. ⏳\n"

yarn
npm install

echo "\nCongratulations, you are good to go! ⚡⚡⚡\n"
fi
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

echo "Checking for linting problems, please wait⏳\n"

yarn lint
npm run lint
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ branches:
- master

script:
- yarn test
- npm test
60 changes: 29 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,61 +6,59 @@ A personal dashboard website where you can do profile related stuff!

You will need the following things properly installed on your computer.

- [Git](https://git-scm.com/)
- [Node.js](https://nodejs.org/) (with npm)
- [Ember CLI](https://ember-cli.com/)
- [Google Chrome](https://google.com/chrome/)
* [Git](https://git-scm.com/)
* [Node.js](https://nodejs.org/) (with npm)
* [Ember CLI](https://ember-cli.com/)
* [Google Chrome](https://google.com/chrome/)

## Installation

We are moving to yarn, to ensure that we use yarn , we are moving ahead with [Volta](https://docs.volta.sh/guide/#why-volta)
To install Volta, please follow the [process](https://docs.volta.sh/guide/getting-started)

- `git clone <repository-url>` this repository
- `cd website-my`
- `yarn`
* `git clone <repository-url>` this repository
* `cd website-my`
* `npm install`

## Running / Development

- `yarn dev`
- (or `ember s`)
- Visit your app at [http://localhost](http://localhost).
- Visit your tests at [http://localhost/tests](http://localhost/tests).
* `npm run dev`
* (or `ember s`)
* Visit your app at [http://localhost](http://localhost).
* Visit your tests at [http://localhost/tests](http://localhost/tests).

### Code Generators

Make use of the many generators for code, try `ember help generate` for more details

### Running Tests

- `yarn test`
- `yarn test:ember`
- `yarn test:ember:server`
- (or `ember test` and `ember test --server`)
- You can also visit the `/tests` route when running dev server
* `npm run test`
* `npm run test:ember`
* `npm run test:ember:server`
* (or `ember test` and `ember test --server`)
* You can also visit the `/tests` route when running dev server

### Available run commands

- `npx ntl`
- (or `yarn run` to see the list)
* `npx ntl`
* (or `npm run` to see the list)

### Linting

- `yarn lint`: To allow the linter to check for problems
- `yarn lint:fix`: To allow linter to fix the auto-fixable problems
* `npm run lint`: To allow the linter to check for problems
* `npm run lint:fix`: To allow linter to fix the auto-fixable problems

### Note: For solving CORS errors while making API calls during development, please make sure to follow step 1 from [this](https://github.com/Real-Dev-Squad/website-code-docs/tree/main/docs/dev/https-dev-url-cors) documentation . This project has taken care of step 2 in itself.

### Building

- `yarn build` (production)
- (or `ember build --environment production`)
- `ember build` (development)
* `npm run build` (production)
* (or `ember build --environment production`)
* `ember build` (development)


## Further Reading / Useful Links

- [ember.js](https://emberjs.com/)
- [ember-cli](https://ember-cli.com/)
- Development Browser Extensions
- [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
- [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)
* [ember.js](https://emberjs.com/)
* [ember-cli](https://ember-cli.com/)
* Development Browser Extensions
* [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
* [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)
1 change: 1 addition & 0 deletions app/components/form-input.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<div class="field">
<label for={{@for}}>{{@label}}:</label>
<Input
data-test-id="form-input-{{@id}}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be a static named id, so that we can easily grab it in the tests.

Suggested change
data-test-id="form-input-{{@id}}"
data-test-id="form-input"

@id={{@id}}
@type={{@type}}
@value={{@value}}
Expand Down
12 changes: 0 additions & 12 deletions app/components/sign-up/button.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,26 @@
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import { NEW_SIGNUP_FLOW } from '../../constants/analytics';

export default class ButtonComponent extends Component {
@service analytics;

@action
buttonClickHandler() {
const { state, clickHandler, disabled } = this.args;
let event;

switch (state) {
case 'get-started':
event = NEW_SIGNUP_FLOW.USER_GETTING_STARTED;
!disabled ? clickHandler('firstName') : '';
break;
case 'firstName':
event = NEW_SIGNUP_FLOW.USER_FIRST_NAME;
!disabled ? clickHandler('lastName') : '';
break;
case 'lastName':
event = NEW_SIGNUP_FLOW.USER_LAST_NAME;
!disabled ? clickHandler('username') : '';
break;
case 'username':
event = NEW_SIGNUP_FLOW.USER_USERNAME;
!disabled ? clickHandler() : '';
break;
default:
event = NEW_SIGNUP_FLOW.SOMETHING_WENT_WRONG;
return;
}

this.analytics.trackEvent(event);
}
}
24 changes: 0 additions & 24 deletions app/constants/analytics.js

This file was deleted.

2 changes: 0 additions & 2 deletions app/constants/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ export const GET_STARTED_SUB_HEADING =

export const THANK_YOU_MAIN_HEADING = 'Congratulations!';
export const THANK_YOU_SUB_HEADING = 'Lets get you started on your journey';

export const GOTO_URL = 'https://realdevsquad.com/goto';
3 changes: 1 addition & 2 deletions app/controllers/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ export default class ProfileController extends Controller {
@action emailValidator(email) {
if (typeof email !== 'string') return false;

const pattern =
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
const pattern = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
const index = this.fields.findIndex((field) => field.type === 'email');

if (pattern.test(email)) {
Expand Down
28 changes: 5 additions & 23 deletions app/controllers/signup.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import Controller from '@ember/controller';
import { action, set } from '@ember/object';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
import registerUser from '../utils/register-api';
import { GOTO_URL } from '../constants/signup';
import { NEW_SIGNUP_FLOW, OLD_SIGNUP_FLOW } from '../constants/analytics';
import ENV from 'website-my/config/environment'; // remove this when new flow goes live

const BASE_URL = ENV.BASE_API_URL; // remove this when new flow goes live

export default class SignupController extends Controller {
@service analytics;

queryParams = ['state', 'dev'];

@tracked isSubmitClicked = false;
Expand Down Expand Up @@ -259,8 +254,7 @@ export default class SignupController extends Controller {
@action emailValidator(email) {
if (typeof email !== 'string') return false;

const pattern =
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
const pattern = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
const index = this.fields.findIndex((field) => field.type === 'email');

if (pattern.test(email)) {
Expand Down Expand Up @@ -288,7 +282,6 @@ export default class SignupController extends Controller {
// submit
// https://github.com/Real-Dev-Squad/website-api-contracts/tree/main/users#patch-usersself
e.preventDefault();
this.analytics.trackEvent(OLD_SIGNUP_FLOW.SUBMIT_CLICKED);
const cleanReqObject = this.sanitizeRequestObject(this.formData);
this.isSubmitClicked = true;

Expand All @@ -304,15 +297,11 @@ export default class SignupController extends Controller {

const { status } = response;
if (status === 204) {
this.analytics.identifyUser();
this.analytics.trackEvent(OLD_SIGNUP_FLOW.USER_REGISTERED);
window.open(GOTO_URL, '_self');
window.open('https://realdevsquad.com/goto', '_self');
} else {
this.analytics.trackEvent(OLD_SIGNUP_FLOW.UNABLE_TO_SIGNUP);
alert('Something went wrong. Please check console errors.');
}
} catch (error) {
this.analytics.trackEvent(OLD_SIGNUP_FLOW.UNABLE_TO_REGISTER);
console.error('Error : ', error);
} finally {
this.isSubmitClicked = false;
Expand Down Expand Up @@ -346,21 +335,14 @@ export default class SignupController extends Controller {
registerUser(user)
.then((res) => {
if (res.status === 204) {
this.analytics.identifyUser();
this.analytics.trackEvent(NEW_SIGNUP_FLOW.USER_REGISTERED);
window.open(GOTO_URL, '_self');
window.open('https://realdevsquad.com/goto', '_self');
} else {
this.analytics.trackEvent(NEW_SIGNUP_FLOW.UNABLE_TO_SIGNUP);
res.json().then((res) => {
const error = res.errors[0];
this.errorMessage = error.title;
this.errorMessage = res.errors[0].title;
});
}
})
.catch((err) => {
this.errorMessage = err;
this.analytics.trackEvent(NEW_SIGNUP_FLOW.UNABLE_TO_REGISTER);
})
.catch((err) => (this.errorMessage = err))
.finally(() => {
this.isSubmitClicked = false;
});
Expand Down
8 changes: 1 addition & 7 deletions app/routes/signup.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import ENV from 'website-my/config/environment';
import { SIGNUP } from '../constants/analytics';

export default class SignupRoute extends Route {
@service analytics;

async model() {
this.analytics.trackEvent(SIGNUP.PAGE_LOADED);
const response = await fetch(`${ENV.BASE_API_URL}/users/self`, {
credentials: 'include',
});
Expand All @@ -20,9 +15,8 @@ export default class SignupRoute extends Route {
);
}
if (response.status === 200 && !userData.incompleteUserDetails) {
this.analytics.trackEvent(SIGNUP.USER_ALREADY_REGISTERED);
alert("You already have filled the up form. You'll now be redirected.");
window.open('https://realdevsquad.com/goto', '_self');
window.open('https://realdevsquad.com/goto', '_self'); // if user is there => realdevsquad,com => no ---> up
}
}
}
18 changes: 0 additions & 18 deletions app/services/analytics.js

This file was deleted.

Loading