Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit a69264a

Browse files
author
vikasrohit
committed
SUP-2231, New Empty States for Dashboard and Profile, SUP-2231, User has past challenges but not able to access the past challenges from dashboard as user do not have any active challenges.
-- Added never participation logic for challenges section on dashboard Reference for the text: https://appirio.atlassian.net/browse/SUP-2209?focusedCommentId=17437&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17437
1 parent c6d0cb3 commit a69264a

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

app/my-dashboard/my-challenges/my-challenges.controller.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
function MyChallengesWidgetController(ChallengeService, UserService, $log, CONSTANTS, userIdentity, $q) {
99
var vm = this;
1010
vm.domain = CONSTANTS.domain;
11+
vm.neverParticipated = false;
1112
vm.loading = true;
1213
vm.userHasChallenges = true;
1314
vm.challengeView = 'tile';
@@ -19,7 +20,9 @@
1920

2021
function activate() {
2122
vm.myChallenges = [];
22-
getChallenges();
23+
_checkForParticipation().then(function() {
24+
getChallenges();
25+
});
2326
}
2427

2528
function getChallenges() {
@@ -71,5 +74,19 @@
7174
vm.challengeView = view;
7275
}
7376
}
77+
78+
function _checkForParticipation() {
79+
var params = {
80+
limit: 1,
81+
offset: 0
82+
};
83+
return ChallengeService.getUserChallenges(handle, params).then(function(challenges) {
84+
if (challenges.metadata.totalCount > 0) {
85+
vm.neverParticipated = true;
86+
} else {
87+
vm.neverParticipated = true;
88+
}
89+
});
90+
}
7491
}
7592
})();

app/my-dashboard/my-challenges/my-challenges.jade

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
header(ng-hide="vm.loading || !vm.userHasChallenges")
2-
h1.section-title Active Challenges
2+
h1.section-title My Challenges
33

44
.challenge-view-toggle(ng-show="vm.userHasChallenges")
55
button.tile(ng-click="vm.toggleView('tile')", ng-class="{ disabled: vm.challengeView === 'tile' }") Grid
@@ -9,11 +9,15 @@ header(ng-hide="vm.loading || !vm.userHasChallenges")
99
.section-loading(ng-show="vm.loading")
1010

1111
section.noChallenges(ng-if="!vm.userHasChallenges && !vm.loading")
12-
empty-state-placeholder(title="My Challenges", description="Compete in challenges to win money, test yourself against the world's best, and learn new skills", show="!vm.userHasChallenges")
13-
.info-links
14-
a.find-challenges.tc-btn.tc-btn-s(ng-href="https://www.{{DOMAIN}}/challenges/?pageIndex=1") Find Challenges
12+
.never-participated(ng-if="vm.neverParticipated")
13+
empty-state-placeholder(title="My Challenges", description="Compete in challenges to win money, test yourself against the world's best, and learn new skills", show="vm.neverParticipated")
14+
.info-links
15+
a.find-challenges.tc-btn.tc-btn-s(ng-href="https://www.{{DOMAIN}}/challenges/?pageIndex=1") Find Challenges
1516

16-
a.learn-more(href="https://www.{{DOMAIN}}/member-onboarding") Learn More
17+
a.learn-more(href="https://www.{{DOMAIN}}/member-onboarding") Learn More
18+
empty-state-placeholder(title="My Challenges", description="You don't have any active challenges. Ready to find your next challenge?", show="!vm.userHasChallenges")
19+
.info-links
20+
a.find-challenges.tc-btn.tc-btn-s(ng-href="https://www.{{DOMAIN}}/challenges/?pageIndex=1") Explore Open Challenges
1721

1822
section.hasChallenges(ng-if="vm.userHasChallenges && !vm.loading", ng-class="{ 'list-view-active': vm.challengeView === 'list' }")
1923
.section-titles(ng-show="vm.challengeView === 'list'")

0 commit comments

Comments
 (0)