Skip to content

Commit 719cf0c

Browse files
committed
feat: add userUtils for calculating user highlight styles, user in moderation notes modal
1 parent df061ff commit 719cf0c

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/components/modals/profile/ModerationNotes.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<div class="comments">
77
<div class="comment-container">
88
<div class="comment" v-for="comment in userNotes.data" :key="comment.id">
9-
<div class="avatar circle">
10-
<!-- <img ng-style="usernotesvm.avatarHighlight(comment.author_highlight_color)" ng-src="{{comment.author_avatar || $webConfigs.default_avatar }}" /> -->
9+
<div class="avatar" :class="defaultAvatarShape">
10+
<img :src="comment.author_avatar || defaultAvatar" @error="$event.target.src=defaultAvatar" :style="avatarHighlight(comment.author_highlight_color)">
1111
</div>
1212
<div class="content">
1313
<div class="title">
@@ -75,6 +75,7 @@ import Modal from '@/components/layout/Modal.vue'
7575
import { reactive, toRefs, inject, onBeforeMount, onBeforeUpdate } from 'vue'
7676
import { cloneDeep } from 'lodash'
7777
import humanDate from '@/composables/filters/humanDate'
78+
import { avatarHighlight } from '@/composables/utils/userUtils'
7879
import { usersApi } from '@/api'
7980
import { AuthStore } from '@/composables/stores/auth'
8081
@@ -131,13 +132,15 @@ export default {
131132
userNotes: {},
132133
note: '',
133134
errorMessage: '',
135+
defaultAvatar: window.default_avatar,
136+
defaultAvatarShape: window.default_avatar_shape,
134137
accessControl: {
135138
delete: true,
136139
update: true
137140
}
138141
})
139142
140-
return { ...toRefs(v), leaveNote, editUserNote, pullPage, humanDate, close }
143+
return { ...toRefs(v), leaveNote, editUserNote, pullPage, avatarHighlight, humanDate, close }
141144
}
142145
}
143146
</script>

src/composables/utils/userUtils.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export const avatarHighlight = color => color ? { border: `0.125rem solid ${color}` } : {}
2+
3+
export const usernameHighlight = color => color ? {
4+
background: color,
5+
padding: '0 0.125rem',
6+
color: '#ffffff'
7+
} : {}

0 commit comments

Comments
 (0)