mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
* Added initial bailey api
* wip
* implement new panel header
* Fixed lint
* add ability to mark notification as seen
* add notification count, remove top badge from user and add ability to mark multiple notifications as seen
* add support dismissall and mark all as read
* do not dismiss actionable notif
* mark as seen when menu is opened instead of closed
* implement ordering, list of actionable notifications
* add groups messages and fix badges count
* add notifications for received cards
* send card received notification to target not sender
* rename notificaion field
* fix integration tests
* mark cards notifications as read and update tests
* add mystery items notifications
* add unallocated stats points notifications
* fix linting
* simplify code
* refactoring and fixes
* fix dropdown opening
* start splitting notifications into their own component
* add notifications for inbox messages
* fix unit tests
* fix default buttons styles
* add initial bailey support
* add title and tests to new stuff notification
* add notification if a group task needs more work
* add tests and fixes for marking a task as needing more work
* make sure user._v is updated
* remove console.log
* notification: hover status and margins
* start styling notifications, add separate files and basic functionalities
* fix tests
* start adding mystery items notification
* wip card notification
* fix cards text
* initial implementation inbox messages
* initial implementation group messages
* disable inbox notifications until mobile is ready
* wip group chat messages
* finish mystery and card notifications
* add bailey notification and fix a lot of stuff
* start adding guilds and parties invitations
* misc invitation fixes
* fix lint issues
* remove old code and add key to notifications
* fix tests
* remove unused code
* add link for public guilds invite
* starts to implement needs work notification design and feature
* fixes to needs work, add group task approved notification
* finish needs work feature
* lots of fixes
* implement quest notification
* bailey fixes and static page
* routing fixes
* fixes # this.$store.dispatch(guilds:join, {groupId: group.id, type: party});
* read notifications on click
* chat notifications
* fix tests for chat notifications
* fix chat notification test
* fix tests
* fix tests (again)
* try awaiting
* remove only
* more sleep
* add bailey tests
* fix icons alignment
* fix issue with multiple points notifications
* remove merge code
* fix rejecting guild invitation
* make remove area bigger
* fix error with notifications and add migration
* fix migration
* fix typos
* add cleanup migration too
* notifications empty state, new counter color, fix marking messages as seen in guilds
* fixes
* add image and install correct packages
* fix mongoose version
* update bailey
* typo
* make sure chat is marked as read after other requests
162 lines
3.1 KiB
Vue
162 lines
3.1 KiB
Vue
<template lang="pug">
|
|
.notification.dropdown-item.dropdown-separated.d-flex.justify-content-between(
|
|
@click="clicked"
|
|
)
|
|
.notification-icon.d-flex.justify-content-center.align-items-center(
|
|
v-if="hasIcon",
|
|
:class="{'is-not-bailey': isNotBailey}",
|
|
)
|
|
slot(name="icon")
|
|
.notification-content
|
|
slot(name="content")
|
|
.notification-remove(@click.stop="canRemove ? remove() : null",)
|
|
.svg-icon(
|
|
v-if="canRemove",
|
|
v-html="icons.close",
|
|
)
|
|
</template>
|
|
|
|
<style lang="scss"> // Not scoped because the classes could be used in i18n strings
|
|
@import '~client/assets/scss/colors.scss';
|
|
.notification-small {
|
|
font-size: 12px;
|
|
line-height: 1.33;
|
|
color: $gray-200;
|
|
}
|
|
|
|
.notification-ellipses {
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
width: 100%;
|
|
}
|
|
|
|
.notification-bold {
|
|
font-weight: bold;
|
|
}
|
|
|
|
.notification-bold-blue {
|
|
font-weight: bold;
|
|
color: $blue-10;
|
|
}
|
|
|
|
.notification-bold-purple {
|
|
font-weight: bold;
|
|
color: $purple-300;
|
|
}
|
|
|
|
.notification-yellow {
|
|
color: #bf7d1a;
|
|
}
|
|
|
|
.notification-green {
|
|
color: #1CA372;
|
|
}
|
|
</style>
|
|
|
|
<style lang="scss" scoped>
|
|
@import '~client/assets/scss/colors.scss';
|
|
|
|
.notification {
|
|
width: 378px;
|
|
max-width: 100%;
|
|
padding: 9px 20px 10px 24px;
|
|
overflow: hidden;
|
|
|
|
&:active, &:hover {
|
|
color: inherit;
|
|
}
|
|
}
|
|
|
|
.notification-icon {
|
|
margin-right: 16px;
|
|
|
|
&.is-not-bailey {
|
|
width: 31px;
|
|
height: 32px;
|
|
}
|
|
}
|
|
|
|
.notifications-buttons {
|
|
margin-top: 12px;
|
|
|
|
.btn {
|
|
margin-right: 8px;
|
|
}
|
|
}
|
|
|
|
.notification-content {
|
|
// total distance from notification top and bottom edges are 15 and 16 pixels
|
|
margin-top: 6px;
|
|
margin-bottom: 6px;
|
|
|
|
flex-grow: 1;
|
|
white-space: normal;
|
|
|
|
font-size: 14px;
|
|
line-height: 1.43;
|
|
color: $gray-50;
|
|
|
|
max-width: calc(100% - 26px); // to make space for the close icon
|
|
}
|
|
|
|
.notification-remove {
|
|
// total distance from the notification top edge is 20 pixels
|
|
margin-top: 7px;
|
|
|
|
width: 18px;
|
|
height: 18px;
|
|
margin-left: 12px;
|
|
padding: 4px;
|
|
|
|
.svg-icon {
|
|
width: 10px;
|
|
height: 10px;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
import closeIcon from 'assets/svg/close.svg';
|
|
import { mapActions, mapState } from 'client/libs/store';
|
|
|
|
export default {
|
|
props: ['notification', 'canRemove', 'hasIcon', 'readAfterClick'],
|
|
data () {
|
|
return {
|
|
icons: Object.freeze({
|
|
close: closeIcon,
|
|
}),
|
|
};
|
|
},
|
|
computed: {
|
|
...mapState({user: 'user.data'}),
|
|
isNotBailey () {
|
|
return this.notification.type !== 'NEW_STUFF';
|
|
},
|
|
},
|
|
methods: {
|
|
...mapActions({
|
|
readNotification: 'notifications:readNotification',
|
|
}),
|
|
clicked () {
|
|
if (this.readAfterClick === true) {
|
|
this.readNotification({notificationId: this.notification.id});
|
|
}
|
|
|
|
this.$emit('click');
|
|
},
|
|
remove () {
|
|
if (this.notification.type === 'NEW_CHAT_MESSAGE') {
|
|
const groupId = this.notification.data.group.id;
|
|
this.$store.dispatch('chat:markChatSeen', {groupId});
|
|
if (this.user.newMessages[groupId]) {
|
|
this.$delete(this.user.newMessages, groupId);
|
|
}
|
|
} else {
|
|
this.readNotification({notificationId: this.notification.id});
|
|
}
|
|
},
|
|
},
|
|
};
|
|
</script> |