From 5e48ffca63f447b1f82da2a2b2505f0ab02b986c Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 27 Apr 2020 21:23:13 -0600 Subject: [PATCH] Update NotificationCard.vue component, add follow requests at top of card, remove card-header --- .../assets/js/components/NotificationCard.vue | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/resources/assets/js/components/NotificationCard.vue b/resources/assets/js/components/NotificationCard.vue index b82d98770..b5a03bc97 100644 --- a/resources/assets/js/components/NotificationCard.vue +++ b/resources/assets/js/components/NotificationCard.vue @@ -2,19 +2,19 @@
-
-

- - Alerts - -

-
Loading...
-
+
+
+
+

+

{{followRequests.count}} Follow Requests

+

+
+
@@ -76,11 +76,20 @@ notifications: {}, notificationCursor: 2, notificationMaxId: 0, + profile: { + locked: false + }, + followRequests: null }; }, mounted() { + let self = this; this.fetchNotifications(); + setTimeout(function() { + self.profile = window._sharedData.curUser; + self.fetchFollowRequests(); + }, 500); }, updated() { @@ -138,29 +147,7 @@ }, timeAgo(ts) { - let date = Date.parse(ts); - let seconds = Math.floor((new Date() - date) / 1000); - let interval = Math.floor(seconds / 31536000); - if (interval >= 1) { - return interval + "y"; - } - interval = Math.floor(seconds / 604800); - if (interval >= 1) { - return interval + "w"; - } - interval = Math.floor(seconds / 86400); - if (interval >= 1) { - return interval + "d"; - } - interval = Math.floor(seconds / 3600); - if (interval >= 1) { - return interval + "h"; - } - interval = Math.floor(seconds / 60); - if (interval >= 1) { - return interval + "m"; - } - return Math.floor(seconds) + "s"; + return window.App.util.format.timeAgo(ts); }, mentionUrl(status) { @@ -219,6 +206,19 @@ } } }); + }, + + fetchFollowRequests() { + if(window._sharedData.curUser.locked == true) { + axios.get('/account/follow-requests.json') + .then(res => { + this.followRequests = res.data; + }) + } + }, + + redirect(url) { + window.location.href = url; } } }