working, somewhat

This commit is contained in:
Henry Jameson 2018-06-18 11:36:58 +03:00
parent 148e691199
commit f911182a2f
6 changed files with 99 additions and 14 deletions

View file

@ -6,6 +6,7 @@ import PostStatusForm from '../post_status_form/post_status_form.vue'
import UserCardContent from '../user_card_content/user_card_content.vue'
import StillImage from '../still-image/still-image.vue'
import { filter, find } from 'lodash'
import { hex2rgb } from '../../services/color_convert/color_convert.js'
const Status = {
name: 'Status',
@ -34,12 +35,21 @@ const Status = {
muteWords () {
return this.$store.state.config.muteWords
},
repeaterClass () {
const user = this.statusoid.user
return this.highlightClass(user)
},
userClass () {
console.log(this.statusoid.user)
console.log(this.statusoid.user.screen_name)
return 'USER____' + this.statusoid.user.screen_name
.replace(/\./g,'_')
.replace(/\@/g,'_AT_')
const user = this.retweet ? (this.statusoid.retweeted_status.user) : this.statusoid.user
return this.highlightClass(user)
},
repeaterStyle () {
const user = this.statusoid.user
return this.highlightStyle(user)
},
userStyle () {
const user = this.retweet ? (this.statusoid.retweeted_status.user) : this.statusoid.user
return this.highlightStyle(user)
},
hideAttachments () {
return (this.$store.state.config.hideAttachments && !this.inConversation) ||
@ -172,6 +182,28 @@ const Status = {
},
replyLeave () {
this.showPreview = false
},
highlightStyle (user) {
const color = this.$store.state.config.highlight[user.screen_name]
if (!color) return
const rgb = hex2rgb(color)
const tintColor = `rgba(${Math.floor(rgb.r)}, ${Math.floor(rgb.g)}, ${Math.floor(rgb.b)}, .1)`
const tintColor2 = `rgba(${Math.floor(rgb.r)}, ${Math.floor(rgb.g)}, ${Math.floor(rgb.b)}, .2)`
return {
backgroundImage: [
'repeating-linear-gradient(-45deg,',
tintColor, ',',
tintColor, '20px,',
tintColor2, '20px,',
tintColor2, '40px',
].join(' '),
backgroundPosition: '0 0'
}
},
highlightClass (user) {
return 'USER____' + user.screen_name
.replace(/\./g,'_')
.replace(/\@/g,'_AT_')
}
},
watch: {