Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ember-Migration] Github Workflow and PR Template Improvements #336

Merged
merged 25 commits into from
Dec 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
201033f
Created a navbar
rohan09-raj Nov 29, 2022
de2342a
minor refactoring and fixes
rohan09-raj Nov 29, 2022
37ea549
Created header component
rohan09-raj Nov 30, 2022
0c91c40
created description component
rohan09-raj Nov 30, 2022
242689c
resolved over simplications and minor fixes
rohan09-raj Dec 2, 2022
5504083
created cards
rohan09-raj Dec 2, 2022
4d865ee
made cards and modals responsive
rohan09-raj Dec 3, 2022
9fadee9
minor fix
rohan09-raj Dec 3, 2022
51c8151
created more about component
rohan09-raj Dec 3, 2022
f0ea60d
created scroll to top button
rohan09-raj Dec 4, 2022
3f7e949
CI updated and made minor fixes in PR template
rohan09-raj Dec 5, 2022
6ff17f4
Created a navbar
rohan09-raj Nov 29, 2022
8feb8d8
minor refactoring and fixes
rohan09-raj Nov 29, 2022
ef8cdc8
Created a navbar
rohan09-raj Nov 29, 2022
0ed8f4e
[Ember-Migration] Created a navbar (#325)
rohan09-raj Dec 7, 2022
8052020
minor fixes
rohan09-raj Dec 7, 2022
6cf67ca
Removed repetition of code
rohan09-raj Dec 8, 2022
14574d3
[Ember-Migration] Created a navbar (#325)
rohan09-raj Dec 7, 2022
937820c
created more about component
rohan09-raj Dec 3, 2022
faca654
[Ember-Migration] Created a navbar (#325)
rohan09-raj Dec 7, 2022
ed30104
Merge branch 'develop-ember' into github/workflow
rohan09-raj Dec 8, 2022
f9f367e
Merge branch 'develop-ember' into github/workflow
rohan09-raj Dec 14, 2022
a656803
Merge branch 'develop-ember' into github/workflow
rohan09-raj Dec 15, 2022
f1f94e1
removed redundant code
rohan09-raj Dec 15, 2022
66910f4
Merge branch 'develop-ember' into github/workflow
rohan09-raj Dec 17, 2022
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
Prev Previous commit
Next Next commit
minor refactoring and fixes
  • Loading branch information
rohan09-raj committed Nov 29, 2022
commit de2342a9938ae72895b8e2d90a39b1adb43a6d13
4 changes: 0 additions & 4 deletions app/adapters/application.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import JSONAPIAdapter from '@ember-data/adapter/json-api';

import ENV from 'website-www/config/environment';

console.log(ENV.BASE_API_URL);

export default class ApplicationAdapter extends JSONAPIAdapter {
host = ENV.BASE_API_URL;

Expand Down
22 changes: 11 additions & 11 deletions app/components/navbar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@
</ul>

<div class='nav__login'>
{{#if (not @firstName) }}
<a class='login' id='user-login' href=''>
<button class='login__btn'>
{{#if @isLoggedIn }}
<div class='nav__user' role="button" class="user" {{on "click" this.toggleMenu}} {{on-click-outside
this.outsideClickMenu}}>
<div class='user__msg'>Hello, {{@firstName}}</div>
<img class='user__pic' src={{@profilePicture}} />
<Fa-Icon @icon='chevron-down' />
</div>
{{else}}
<a class='login' href={{this.AUTH_URL}}>
<button class='login__btn' type="button">
<span class='login__text1'>Sign In</span>
<span class='login__text2'>with GitHub</span>
<img class='login__logo' src='assets/icons/github-logo.png' alt='GitHub_Icon' height='20px' width='20px' />
</button>
</a>
{{/if}}

<div class='nav__user' role="button" class="user" {{on "click" this.toggleMenu}} {{on-click-outside
this.outsideClickMenu}}>
<div class='user__msg'>Hello, {{@firstName}}</div>
<img class='user__pic' src={{@profilePicture}} />
<i class="fa-solid fa-chevron-down"></i>
</div>
</div>

<section class="menu {{if this.isMenuOpen " active-menu" "" }}">
<a href="https://my.realdevsquad.com/" class="menu__link">
My Profile
</a>
<hr />
<a href="#" class="menu__link">Sign Out</a>
<div role="button" class="menu__link" {{on "click" (fn @signOut)}}>Sign Out</div>
</section>
</nav>
14 changes: 8 additions & 6 deletions app/components/navbar.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { APPS, AUTH } from '../constants/urls';

export default class NavbarComponent extends Component {
@tracked isNavOpen = false;
@tracked isMenuOpen = false;

HOME_PAGE_URL = 'http://realdevsquad.com/';
AUTH_URL = AUTH.SIGN_IN;
HOME_PAGE_URL = APPS.HOME;

RDS_APPS_MAPPING = [
{
siteName: 'Welcome',
url: 'https://welcome.realdevsquad.com/',
url: APPS.WELCOME,
},
{
siteName: 'Events',
url: 'http://realdevsquad.com/events.html',
url: APPS.EVENTS,
},
{
siteName: 'Members',
url: 'https://members.realdevsquad.com/',
url: APPS.MEMBERS,
},
{
siteName: 'Crypto',
url: 'https://crypto.realdevsquad.com/',
url: APPS.CRYPTO,
},
{
siteName: 'Status',
url: 'https://status.realdevsquad.com/',
url: APPS.STATUS,
},
];

Expand Down
13 changes: 13 additions & 0 deletions app/constants/urls.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const APPS = {
HOME: 'http://realdevsquad.com/',
WELCOME: 'https://welcome.realdevsquad.com/',
EVENTS: 'http://realdevsquad.com/events.html',
MEMBERS: 'https://members.realdevsquad.com/',
CRYPTO: 'https://crypto.realdevsquad.com/',
STATUS: 'https://status.realdevsquad.com/',
};

export const AUTH = {
SIGN_IN:
'https://github.com/login/oauth/authorize?client_id=23c78f66ab7964e5ef97',
};
Empty file removed app/controllers/.gitkeep
Empty file.
21 changes: 21 additions & 0 deletions app/controllers/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Controller from '@ember/controller';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import ENV from 'website-www/config/environment';

export default class ApplicationController extends Controller {
@tracked isLoggedIn = false;

@action async signOut() {
try {
fetch(`${ENV.BASE_API_URL}/auth/signout`, {
method: 'GET',
credentials: 'include',
}).then(() => {
location.reload();
});
} catch (error) {
console.error(error);
}
}
}
61 changes: 24 additions & 37 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,27 @@

<html>

<head>

<meta charset="utf-8" />

<title>Real Dev Squad</title>

<meta name="description" content="" />

<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="icon" href="/assets/favicon.ico" type="image/x-icon" />
{{content-for "head"}}
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css" />

<link
integrity=""
rel="stylesheet"
href="{{rootURL}}assets/website-www.css"
/>

<link
href="https://fonts.googleapis.com/css2?family=Raleway:wght@400..900&display=swap"
rel="stylesheet"
/>
{{content-for "head-footer"}}
</head>

<body>
{{content-for "body"}}
<script src="{{rootURL}}assets/vendor.js"></script>

<script src="{{rootURL}}assets/website-www.js"></script>
{{content-for "body-footer"}}
</body>

</html>

<head>
<meta charset="utf-8" />
<title>Real Dev Squad</title>

<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="icon" href="/assets/favicon.ico" type="image/x-icon" />
{{content-for "head"}}
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css" />
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/website-www.css" />
<link href="https://fonts.googleapis.com/css2?family=Raleway:wght@400..900&display=swap" rel="stylesheet" />
{{content-for "head-footer"}}
</head>

<body>
{{content-for "body"}}
<script src="{{rootURL}}assets/vendor.js"></script>

<script src="{{rootURL}}assets/website-www.js"></script>
{{content-for "body-footer"}}
</body>

</html>
2 changes: 1 addition & 1 deletion app/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class UserModel extends Model {
@attr('string', { defaultValue: 'active' }) status;
@attr roles;
@attr yoe;
@attr('json', { defaultValue: 'dummyProfilePicture.png' }) picture;
@attr picture;
@attr company;
@attr incompleteUserDetails;
@attr github_display_name;
Expand Down
9 changes: 3 additions & 6 deletions app/routes/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { action } from '@ember/object';

export default class IndexRoute extends Route {
@service store;
@service router;

async model() {
return this.store.findRecord('user', 'self');
Expand All @@ -13,12 +14,8 @@ export default class IndexRoute extends Route {
@action
error(error) {
if (error instanceof UnauthorizedError) {
alert('You are not logged in. Please login to continue.');
window.open(
'https://github.com/login/oauth/authorize?client_id=23c78f66ab7964e5ef97',
'_self'
);
return;
// TODO: Handle the unauthorized error
console.log(error.message);
}
}
}
9 changes: 1 addition & 8 deletions app/serializers/application.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
import JSONSerializer from '@ember-data/serializer/json';
import { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';

export default class ApplicationSerializer extends JSONSerializer.extend(
EmbeddedRecordsMixin
) {
attrs = {
picture: { embedded: 'always' },
};
}
export default class ApplicationSerializer extends JSONSerializer {}
18 changes: 9 additions & 9 deletions app/styles/navbar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ nav li {
margin: 15px;
}

.nav__home__link {
display: none;
}

.nav__element {
display: block;
text-decoration: none;
color: var(--color-white);
margin: 55px 40px;
}

.nav__home__link {
display: none;
}

.nav__element.active {
color: var(--color-green);
text-decoration: underline;
Expand Down Expand Up @@ -89,12 +89,12 @@ nav li {
.user__msg {
display: inline;
vertical-align: middle;
margin-right: 10px;
margin-right: 5px;
}

.user__pic {
width: 32px;
height: 32px;
width: 40px;
height: 40px;
border-radius: 50%;
display: inline;
vertical-align: middle;
Expand Down Expand Up @@ -169,12 +169,12 @@ nav li {
}

.nav__login {
margin: 20px 20px;
margin: 18px 20px;
}

.menu {
top: 70px;
right: 30px;
right: 20px;
}
}

Expand Down
7 changes: 6 additions & 1 deletion app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<body>
<Navbar @firstName={{@model.first_name}} @profilePicture={{@model.picture.url}} />
<Navbar
@firstName={{@model.first_name}}
@profilePicture={{@model.picture.url}}
@isLoggedIn={{this.isLoggedIn}}
@signOut={{this.signOut}}
/>
{{outlet}}
</body>
2 changes: 1 addition & 1 deletion config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = function (environment) {
},
};

ENV.BASE_API_URL = 'http://localhost:3000';
ENV.BASE_API_URL = 'https://api.realdevsquad.com';

if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/controllers/application-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { module, test } from 'qunit';
import { setupTest } from 'website-www/tests/helpers';

module('Unit | Controller | application', function (hooks) {
setupTest(hooks);

// TODO: Replace this with your real tests.
test('it exists', function (assert) {
let controller = this.owner.lookup('controller:application');
assert.ok(controller);
});
});