diff --git a/frontend/app/components/admin/sidenav.hbs b/frontend/app/components/admin/sidenav.hbs index 94ba4cc7e..fb2031e52 100644 --- a/frontend/app/components/admin/sidenav.hbs +++ b/frontend/app/components/admin/sidenav.hbs @@ -52,6 +52,11 @@ {{t 'admin.sidenav.manage_badges'}} + diff --git a/frontend/app/components/badge/badge-unlocked.hbs b/frontend/app/components/badge/badge-unlocked.hbs new file mode 100644 index 000000000..5cbf54921 --- /dev/null +++ b/frontend/app/components/badge/badge-unlocked.hbs @@ -0,0 +1,48 @@ + + +
+ {{t 'badge.unlocked.title'}} +
+
+ {{t 'badge.unlocked.points' numOfPoints=this.badge.points}} +
+
+ {{#if this.badge.iconUrl}} + + {{else}} + {{svg-jar 'badge' width='100' height='100'}} + {{/if}} +
+
+ {{this.badge.name}} +
+
+ {{this.badge.description}} +
+
+ + {{t 'badge.unlocked.publish'}} + + + {{t 'badge.unlocked.share'}} + +
+
+ + + {{t 'badge_popup.ok'}} + + +
+ \ No newline at end of file diff --git a/frontend/app/components/badge/badge-unlocked.js b/frontend/app/components/badge/badge-unlocked.js new file mode 100644 index 000000000..b4ebc3d8a --- /dev/null +++ b/frontend/app/components/badge/badge-unlocked.js @@ -0,0 +1,31 @@ +import Component from '@glimmer/component'; +import { tracked } from '@glimmer/tracking'; +import { action } from '@ember/object'; +import { inject as service } from '@ember/service'; +import { events } from '../../utils/socket-events'; + +export default class BadgeUnlockedComponent extends Component { + @service socket; + @service store; + @service router; + + @tracked showBadgeUnlockedModal = false; + @tracked badge; + + @action + hideBadgeUnlockedModal() { + this.showBadgeUnlockedModal = false; + } + + @action + notificationEventIntercept() { + this.socket.socket.on(events.user.badge.unlocked, (notification) => { + setTimeout(async () => { + if (!this.showBadgeUnlockedModal) { + this.badge = await this.store.find('badge', notification.badgeId); + this.showBadgeUnlockedModal = true; + } + }, 3000); + }); + } +} diff --git a/frontend/app/components/leaderboard/top-leader.hbs b/frontend/app/components/leaderboard/top-leader.hbs new file mode 100644 index 000000000..2c0afc4e7 --- /dev/null +++ b/frontend/app/components/leaderboard/top-leader.hbs @@ -0,0 +1,67 @@ +
+
+
+
+ +
+
+ + Jane Doe + + + Nairobi + +
+
+
+ + 3,000 + + + {{t 'leaderboard.earnedPoints'}} + +
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +5 +
+
+ {{!-- + {{t 'admin.users_and_badges.buttons.view_user'}} + --}} +
+ {{#if (eq @position 'first')}} +
+ {{/if}} +
\ No newline at end of file diff --git a/frontend/app/components/leaderboard/top-leader.scss b/frontend/app/components/leaderboard/top-leader.scss new file mode 100644 index 000000000..4b7864122 --- /dev/null +++ b/frontend/app/components/leaderboard/top-leader.scss @@ -0,0 +1,175 @@ +$palette: ( + primary: #f57010, + white: #ffff, + darkCharcoal: rgba(87, 92, 88, 1), + teach: #32a583, + eucalyptus: #28a745, +); + +.leader-card { + width: 422px; + height: 155px; + box-shadow: 0px 3px 30px rgba(0, 0, 0, 0.29); + border-radius: 5px; + margin-left: 8px; + padding: 15px; + + .image-container { + max-height: 52px; + max-width: 52px; + + img { + box-shadow: 0px 3px 6px rgb(0 0 0 / 7%); + border: 3px solid rgba(255, 255, 255, 1); + } + } + + .details { + padding-left: 8px; + + .name { + font-size: 19px; + color: map-get($palette, darkCharcoal); + font-weight: 500; + } + + .location { + font-size: 15px; + color: map-get($palette, darkCharcoal); + } + } + + .points { + color: map-get($palette, eucalyptus); + font-weight: 700; + font-size: 19px; + } + + .points-title { + font-size: 15px; + color: map-get($palette, darkCharcoal); + } +} + +.leader-card { + .badges-list { + display: flex; + position: relative; + + .badge-icon-container { + width: 30px; + height: 30px; + position: absolute; + display: flex; + flex-direction: column; + flex-wrap: nowrap; + align-items: center; + justify-content: center; + border-radius: 50%; + background-color: white; + box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.05); + border: 3px solid rgba(255, 255, 255, 1); + font-size: 11px; + font-weight: 700; + + .badge-icon { + width: 100%; + height: 100%; + } + + &:nth-child(2) { + margin-left: 20px; + } + + &:nth-child(3) { + margin-left: 40px; + } + + &:nth-child(4) { + margin-left: 60px; + } + } + } +} + +.leader-card.first { + height: 180px; + background-repeat: no-repeat; + background-position: 0% 0%; + background-origin: padding-box; + background-image: linear-gradient( + 119deg, + rgba(126, 87, 194, 1) 0%, + rgba(171, 71, 188, 1) 100% + ); + background-color: transparent; + background-clip: padding-box; + + .image-container { + max-height: 62px; + max-width: 62px; + } + + .name, + .location, + .points, + .points-title { + color: map-get($palette, white); + } + + .bottom { + padding-bottom: 10px; + padding-top: 10px; + } + + .view-profile-btn { + background-color: map-get($palette, white); + border-color: map-get($palette, white); + color: map-get($palette, darkCharcoal); + } +} + +.first { + position: relative; + + .confetti-one { + position: absolute; + background-image: url('/images/confetti.svg'); + width: 70%; + height: 55px; + background-size: cover; + top: -40px; + left: -30px; + background-repeat: no-repeat; + z-index: -1; + } + + .confetti-two { + position: absolute; + background-image: url('/images/confetti-1.svg'); + width: 70%; + height: 55px; + background-size: cover; + top: -40px; + right: -60px; + background-repeat: no-repeat; + z-index: -1; + } +} + +.image-container { + max-width: 40px; + max-height: 40px; + + .user-profile-image { + width: 100%; + height: 100%; + border-radius: 50%; + } +} + +.view-profile-btn { + font-size: 13px; + padding-bottom: 4px; + padding-top: 4px; +} diff --git a/frontend/app/components/main-header.hbs b/frontend/app/components/main-header.hbs index b846adcbf..612f29cb8 100644 --- a/frontend/app/components/main-header.hbs +++ b/frontend/app/components/main-header.hbs @@ -35,6 +35,11 @@ {{t "buttons.teach"}} +