Skip to content

Notifications Analytics #160

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

Merged
merged 33 commits into from
Apr 29, 2020
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8782470
Added Notifications Popup
luizrrodrigues Feb 10, 2020
c8308af
Compiled
luizrrodrigues Feb 10, 2020
c1f70f3
Added dist/prod to allow install package via github url
luizrrodrigues Feb 11, 2020
bfa124c
Notifications Popup Fixes
luizrrodrigues Feb 17, 2020
5ac71ba
Fix tests snapshot
luizrrodrigues Feb 17, 2020
1853b7d
Notifications Listing Page
luizrrodrigues Feb 27, 2020
9b24c41
Updated mock data
luizrrodrigues Mar 2, 2020
5457b4b
Backend Integration + Fixes + Broadcast type
luizrrodrigues Mar 9, 2020
418a7ef
Merge branch 'develop' into notifications
luizrrodrigues Mar 30, 2020
b0dcceb
Added dist to gitignore
luizrrodrigues Mar 30, 2020
f827249
ci: test release npm bump up
sushilshinde Mar 30, 2020
71dd786
Google Analytics tracking
luizrrodrigues Mar 31, 2020
d3a0509
Fix tests
luizrrodrigues Mar 31, 2020
9208d34
Added react-ga to webpack config
luizrrodrigues Mar 31, 2020
aea9f00
Added 'prepare' script to package.json
luizrrodrigues Apr 1, 2020
d52d6a0
Merge branch 'develop' into notifications-analytics
sushilshinde Apr 14, 2020
fa544cd
Removing test dist tag
sushilshinde Apr 14, 2020
7acf22c
Moved GA tracking ID to config file
luizrrodrigues Apr 14, 2020
bdecaa1
Fix clean script to run rimraf locally
luizrrodrigues Apr 15, 2020
74e0342
Fix CircleCI: Added 'npm install' to release job
luizrrodrigues Apr 15, 2020
d0e80ec
adding dist tag
sushilshinde Apr 16, 2020
74e49d6
Test release npm bump up
sushilshinde Apr 16, 2020
b01a6bc
Merge pull request #157 from topcoder-platform/notifications-analytics
sushilshinde Apr 23, 2020
0022348
Bump up test release version to 1000.13.4
sushilshinde Apr 23, 2020
4e2fd09
Adding dist tag
sushilshinde Apr 23, 2020
f428f7f
Remove prepare script from package.json
luizrrodrigues Apr 24, 2020
bf0c152
adding dist tag
sushilshinde Apr 27, 2020
0492a60
Test release npm ver bump up to 1000.13.5
sushilshinde Apr 27, 2020
a04774f
changed test version
sushilshinde Apr 28, 2020
091309b
Merge pull request #158 from topcoder-platform/notifications-analytics
sushilshinde Apr 28, 2020
b438ce2
Removed dist tag
sushilshinde Apr 29, 2020
14035d5
Npm ver bump up for production release to v0.17.0
sushilshinde Apr 29, 2020
b5fb7d0
Removed npm install from release job
luizrrodrigues Apr 29, 2020
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
Notifications Popup Fixes
Challenge: 30115261
Submission: 351307
  • Loading branch information
luizrrodrigues committed Feb 17, 2020
commit bfa124c91970d94e07954552cabe7941b0d9f17d
6 changes: 3 additions & 3 deletions dist/dev/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/prod/index.js

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions src/actions/notifications.js
Original file line number Diff line number Diff line change
@@ -109,6 +109,32 @@ async function markAllNotificationAsSeenDone() {
}


/**
* @static
* @desc Creates an action that signals beginning of dismiss all challenge notifications
* loading.
* @return {Action}
*/
function dismissChallengeNotificationsInit() {
return { };
}

/**
* @static
* @desc Creates an action that dismisses all challenge notifications
* @return {Action}
*/
async function dismissChallengeNotificationsDone(challengeId) {
let data;
try {
data = await getService().dismissChallengeNotifications(challengeId);
} catch (e) {
data = [];
}
return data;
}


export default createActions({
NOTIFICATIONS: {
GET_NOTIFICATIONS_INIT: getNotificationsInit,
@@ -119,5 +145,7 @@ export default createActions({
MARK_ALL_NOTIFICATION_AS_READ_DONE: markAllNotificationAsReadDone,
MARK_ALL_NOTIFICATION_AS_SEEN_INIT: markAllNotificationAsSeenInit,
MARK_ALL_NOTIFICATION_AS_SEEN_DONE: markAllNotificationAsSeenDone,
DISMISS_CHALLENGE_NOTIFICATIONS_INIT: dismissChallengeNotificationsInit,
DISMISS_CHALLENGE_NOTIFICATIONS_DONE: dismissChallengeNotificationsDone,
},
});
38 changes: 38 additions & 0 deletions src/reducers/notifications.js
Original file line number Diff line number Diff line change
@@ -165,6 +165,42 @@ function onMarkAllNotificationAsSeenDone(state, { error, payload }) {
};
}

/**
* Handles NOTIFICATIONS/DISMISS_CHALLENGE_NOTIFICATIONS_INIT action.
* @param {Object} state
* @return {Object} New state
*/
function onDismissChallengeNotificationsInit(state) {
return { ...state };
}

/**
* Handles NOTIFICATIONS/DISMISS_CHALLENGE_NOTIFICATIONS_DONE action.
* @param {Object} state
* @param {Object} action
* @return {Object} New state.
*/
function onDismissChallengeNotificationsDone(state, { error, payload }) {
if (error) {
logger.error('Failed to dismiss notification!', payload);
fireErrorMessage(
'ERROR: Failed to dismiss the notification',
'Please, try again a bit later',
);
return {
...state,
fetchNotificationsFailure: true,
items: [],
};
}

return {
...state,
items: payload,
fetchNotificationsFailure: false,
};
}


/**
* Creates a new Members reducer with the specified initial state.
@@ -182,6 +218,8 @@ function create(initialState = {}) {
[a.markAllNotificationAsReadDone]: onMarkAllNotificationAsReadDone,
[a.markAllNotificationAsSeenInit]: onMarkAllNotificationAsSeenInit,
[a.markAllNotificationAsSeenDone]: onMarkAllNotificationAsSeenDone,
[a.dismissChallengeNotificationsInit]: onDismissChallengeNotificationsInit,
[a.dismissChallengeNotificationsDone]: onDismissChallengeNotificationsDone,
}, initialState);
}

12 changes: 12 additions & 0 deletions src/services/notifications.js
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@
* notifications.
*/

import _ from 'lodash';

const eventTypes = {
PROJECT: {
ACTIVE: 'connect.notification.project.active',
@@ -214,6 +216,16 @@ class NotificationService {
}
return this.MockNotifications;
}

/**
* Dismiss challenge notifications.
* @return {Promise} Resolves to the notification information object.
*/
async dismissChallengeNotifications(challengeId) {
this.MockNotifications = _.filter(this.MockNotifications, n => n.sourceId !== challengeId);

return this.MockNotifications;
}
}

let lastInstance = null;