Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7db87d5

Browse files
authoredSep 27, 2017
Merge pull request #1231 from appirio-tech/issue-450
Issue 450
2 parents 6cd066e + 67ac9b8 commit 7db87d5

File tree

10 files changed

+802
-751
lines changed

10 files changed

+802
-751
lines changed
 

‎app/directives/page-state-header/page-state-header.directive.js

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ import _ from 'lodash'
1616
hideMoney: '=',
1717
defaultState: '@'
1818
},
19-
controller: ['CONSTANTS', '$rootScope', '$scope', 'ProfileService', 'logger', '$state', pageStateHeader],
19+
controller: ['CONSTANTS', '$rootScope', '$scope', 'ProfileService', 'logger', '$state', 'ChallengeService', '$q', 'UserService', 'BadgeService', pageStateHeader],
2020
controllerAs: 'vm'
2121
}
2222
})
2323

24-
function pageStateHeader(CONSTANTS, $rootScope, $scope, ProfileService, logger, $state) {
24+
function pageStateHeader(CONSTANTS, $rootScope, $scope, ProfileService, logger, $state, ChallengeService, $q, UserService, BadgeService) {
2525
var vm = this
2626
vm.backHandler = backHandler
2727

@@ -35,13 +35,12 @@ import _ from 'lodash'
3535
function activate() {
3636
vm.handle = $scope.handle
3737
vm.profile = null
38-
vm.handleColor = null
3938
$scope.hideMoney = _.get($scope, 'hideMoney', true)
4039
vm.previousStateName = null
4140
vm.previousStateLabel = null
4241
vm.previousState = null
43-
vm.showBackLink = _.get($scope, 'showBackLink', false)
44-
vm.loading = true
42+
vm.dashboardBadgeName = null
43+
4544

4645
// identifies the previous state
4746
if ($scope.$root.previousState && $scope.$root.previousState.name.length > 0) {
@@ -65,14 +64,32 @@ import _ from 'lodash'
6564
// gets member's profile
6665
ProfileService.getUserProfile(vm.handle).then(function(profile) {
6766
vm.profile = profile
68-
vm.handleColor = ProfileService.getUserHandleColor(vm.profile)
6967

70-
if (!$scope.hideMoney) {
71-
displayMoneyEarned(vm.handle)
72-
} else {
73-
vm.loading = false
74-
}
68+
// get members dashboard badge
69+
UserService.getV2UserProfile(vm.handle).then(function(resp) {
70+
71+
var dashboardAchievement = _filterDashboardAchievement(resp.Achievements || [])[0]
72+
if (dashboardAchievement) {
73+
//Get dashboard badges
74+
vm.dashboardBadge = BadgeService.getAchievementVm(dashboardAchievement)
75+
}
76+
})
77+
7578
})
79+
80+
// get member's challenges to display number of active challenges
81+
$q.all([
82+
ChallengeService.getUserMarathonMatches(vm.handle, { filter: 'status=active' }),
83+
ChallengeService.getUserChallenges(vm.handle, { filter: 'status=active' })
84+
]).then(function(challenges){
85+
var marathonMatches = challenges[0]
86+
var devDesignChallenges = challenges[1]
87+
88+
vm.activeChallenges = marathonMatches.length + devDesignChallenges.length
89+
})
90+
91+
displayMoneyEarned(vm.handle)
92+
7693
}
7794

7895
function backHandler() {
@@ -100,15 +117,21 @@ import _ from 'lodash'
100117
if (!vm.moneyEarned) {
101118
$scope.hideMoney = true
102119
}
103-
104-
vm.loading = false
105120
})
106121
.catch(function(err) {
107122
$scope.hideMoney = true
108-
vm.loading = false
109-
110123
logger.error('Could not get user financial information', err)
111124
})
112125
}
126+
127+
function _filterDashboardAchievement(achievements) {
128+
//Currently only one batch is shown on the dashboard
129+
vm.dashboardBadgeName = 'SRM Engagement Honor'
130+
131+
return achievements.filter(function(achievement) {
132+
return (achievement.description === vm.dashboardBadgeName)
133+
})
134+
}
135+
113136
}
114137
})()

‎app/directives/page-state-header/page-state-header.jade

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,15 @@
66
div(ng-transclude)
77

88
.info
9-
.pic
10-
a(ui-sref="profile.about({userHandle: vm.profile.handle})")
11-
img.profile-circle(ng-if="vm.profile.photoURL", ng-src="{{vm.profile.photoURL}}")
12-
13-
img.profile-circle(ng-if="!vm.profile.photoURL", src=require("../../../assets/images/ico-user-default.svg"))
14-
15-
.user-metrics(id="metrics", ng-hide="vm.loading")
16-
a.handle(style="color:{{vm.handleColor}};", ui-sref="profile.about({userHandle: vm.profile.handle})") {{vm.profile.handle}}
17-
18-
.money-earned(ng-hide="hideMoney")
9+
.item
10+
.value
11+
p(ng-bind="vm.activeChallenges")
12+
.title
13+
p Active Challenges
14+
.item(ng-if="!hideMoney")
15+
.value
1916
p.number(ng-bind="vm.moneyEarned | currency:'$':0")
20-
21-
p Earned
22-
23-
.back-link(ng-if="showBackLink && vm.previousStateLabel")
24-
a(ng-click="vm.backHandler()") Back to {{vm.previousStateLabel}}
25-
17+
.title
18+
p Won in Prizes
19+
.badgeItem(ng-if="vm.dashboardBadge")
20+
.badge(ng-class="(vm.dashboardBadge.specificClass || vm.dashboardBadge.groupClass) + ' ' + (vm.dashboardBadge.type) + 'Badge'" title='{{vm.dashboardBadgeName}}')

‎app/profile/badges/badges.controller.js

Lines changed: 13 additions & 653 deletions
Large diffs are not rendered by default.

‎app/services/badge.service.js

Lines changed: 664 additions & 0 deletions
Large diffs are not rendered by default.

‎assets/css/directives/badge-tooltip.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,3 +678,7 @@ span.subBadge.selected {
678678
background: url(../../images/tt-arrow.png) no-repeat;
679679
background-position: 0 0;
680680
}
681+
682+
.SRM-Engagement-Honor-Badge {
683+
background-position: -146px -671px;
684+
}

‎assets/css/directives/page-state-header.directive.scss

Lines changed: 57 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
.page-state-header {
44
background-color: $gray-lightest;
55
padding: 15px;
6-
border-bottom: 1px solid $gray-light;
6+
border-bottom: 1px solid #D1D3D4;
7+
border-top: 1px solid #D1D3D4;
78

89
header {
910
display: flex;
@@ -22,85 +23,88 @@
2223
.info {
2324
display: flex;
2425
flex-direction: row;
25-
.pic {
26-
img.profile-circle {
27-
border-radius: 50%;
28-
display: inline;
29-
width: 60px;
26+
27+
.item {
28+
display: flex;
29+
flex-direction: column;
30+
justify-content: space-between;
31+
align-items: flex-end;
32+
33+
position: relative;
34+
margin-left: 40px;
35+
margin-right: 20px;
36+
37+
font-family: 'Sofia Pro', Arial, Helvetica, sans-serif;
38+
font-weight: 400;
39+
40+
&:not(:first-child):before {
41+
content: '';
42+
display: block;
43+
position: absolute;
44+
top: -5px;
45+
left: -30px;
46+
width: 1px;
3047
height: 60px;
48+
-ms-transform: translateX(0) translateY(2px) rotate(30deg);
49+
-webkit-transform: translateX(0) translateY(2px) rotate(30deg);
50+
transform: translateX(0) translateY(2px) rotate(30deg);
51+
background-color: #D1D3D4;
3152
}
32-
}
33-
}
3453

35-
.user-metrics {
36-
display: flex;
37-
flex-direction: column;
38-
align-items: flex-start;
39-
justify-content: center;
40-
margin-bottom: 12px;
41-
margin-left: 15px;
42-
@media only screen and (min-width: 600px) {
43-
margin-bottom: 0;
44-
}
54+
.value {
55+
font-size: 24px;
56+
margin-bottom: 15px;
57+
}
58+
59+
.title {
60+
color: #A3A3AE;
61+
font-size: 12px;
62+
text-transform: uppercase;
63+
}
4564

46-
.handle {
47-
@include sofia-pro-medium;
48-
font-size: 24px;
49-
line-height: 29px;
5065
}
5166

52-
.money-earned {
67+
.badgeItem {
5368
display: flex;
54-
flex-direction: row;
55-
align-items: center;
69+
flex-direction: column;
70+
justify-content: space-between;
71+
align-items: flex-end;
5672

57-
.number {
58-
@include sofia-pro-bold;
59-
font-size: 18px;
60-
line-height: 23px;
61-
color: $gray-darkest;
62-
}
73+
position: relative;
74+
margin-left: 40px;
75+
margin-right: 20px;
76+
6377

64-
p:not(.number) {
65-
@include sofia-pro-regular;
66-
font-size: 10px;
67-
line-height: 13px;
68-
text-transform: lowercase;
69-
margin-left: 5px;
70-
color: $accent-gray;
71-
@media only screen and (min-width: 600px) {
72-
font-size: 12px;
73-
line-height: 14px;
74-
}
75-
}
76-
}
78+
font-family: 'Sofia Pro', Arial, Helvetica, sans-serif;
79+
font-weight: 400;
7780

78-
.back-link {
79-
@include sofia-pro-medium;
80-
font-size: 12px;
81-
line-height: 14px;
82-
a {
83-
color: $accent-gray;
84-
}
81+
.value {
82+
font-size: 24px;
83+
margin-bottom: 15px;
84+
}
8585
}
86+
8687
}
8788
}
8889
}
8990

9091

9192
@media (min-width: 768px) {
9293
.page-state-header {
93-
padding: 30px 60px;
94+
padding: 30px 30px;
9495

9596
header {
9697
flex-direction: row;
9798
align-items: center;
9899
justify-content: space-between;
100+
max-width: 1300px;
101+
margin: auto;
99102

100103
.page-info {
101-
order: 2;
104+
order: 1;
102105
display: flex;
103106
flex-direction: row;
107+
margin-left: 20px;
104108
h1 {
105109
font-size: 36px;
106110
line-height: 43px;

‎assets/css/my-dashboard/header-dashboard.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
.header-dashboard {
44
// TODO: Use styleguide class
5-
max-width: 1242px;
6-
margin-left: auto;
7-
margin-right: auto;
5+
margin-left: -10px;
6+
margin-right: -10px;
7+
margin-top: -10px;
8+
margin-bottom: 10px;
89
}

‎assets/images/badge.grid.large.png

16.6 KB
Loading

‎package-lock.json

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Topcoder pages including login, registration, settings, dashboard, profile.",
44
"scripts": {
55
"build": "webpack --bail --progress --build --tc",
6-
"start": "webpack-dev-server --history-api-fallback --host 0.0.0.0 --dev --tc --inline --progress --port 3000",
6+
"start": "webpack-dev-server --history-api-fallback --host local.topcoder-dev.com --dev --tc --inline --progress --port 3000",
77
"start-prod": "webpack-dev-server --history-api-fallback --host local.topcoder.com --prod --tc --inline --progress --port 80",
88
"lint": "eslint .",
99
"test": "karma start --tc --test"

0 commit comments

Comments
 (0)
This repository has been archived.