both bugs fixed. it's reactive and no more conflicting cards
This commit is contained in:
parent
fa8c221f3a
commit
8ccebbe156
@ -22,11 +22,14 @@ const Notification = {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
userClass () {
|
userClass () {
|
||||||
return highlightClass(this.notification.action.user, this.$store)
|
return highlightClass(this.notification.action.user)
|
||||||
},
|
},
|
||||||
userStyle () {
|
userStyle () {
|
||||||
return highlightStyle(this.notification.action.user, this.$store)
|
const highlight = this.$store.state.config.highlight
|
||||||
},
|
const user = this.notification.action.user
|
||||||
|
const color = highlight[user.screen_name]
|
||||||
|
return highlightStyle(color)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,19 +38,23 @@ const Status = {
|
|||||||
},
|
},
|
||||||
repeaterClass () {
|
repeaterClass () {
|
||||||
const user = this.statusoid.user
|
const user = this.statusoid.user
|
||||||
return highlightClass(user, this.$store)
|
return highlightClass(user)
|
||||||
},
|
},
|
||||||
userClass () {
|
userClass () {
|
||||||
const user = this.retweet ? (this.statusoid.retweeted_status.user) : this.statusoid.user
|
const user = this.retweet ? (this.statusoid.retweeted_status.user) : this.statusoid.user
|
||||||
return highlightClass(user, this.$store)
|
return highlightClass(user)
|
||||||
},
|
},
|
||||||
repeaterStyle () {
|
repeaterStyle () {
|
||||||
const user = this.statusoid.user
|
const user = this.statusoid.user
|
||||||
return highlightStyle(user, this.$store)
|
const highlight = this.$store.state.config.highlight
|
||||||
|
const color = highlight[user.screen_name]
|
||||||
|
return highlightStyle(color)
|
||||||
},
|
},
|
||||||
userStyle () {
|
userStyle () {
|
||||||
const user = this.retweet ? (this.statusoid.retweeted_status.user) : this.statusoid.user
|
const user = this.retweet ? (this.statusoid.retweeted_status.user) : this.statusoid.user
|
||||||
return highlightStyle(user, this.$store)
|
const highlight = this.$store.state.config.highlight
|
||||||
|
const color = highlight[user.screen_name]
|
||||||
|
return highlightStyle(color)
|
||||||
},
|
},
|
||||||
hideAttachments () {
|
hideAttachments () {
|
||||||
return (this.$store.state.config.hideAttachments && !this.inConversation) ||
|
return (this.$store.state.config.hideAttachments && !this.inConversation) ||
|
||||||
|
@ -3,16 +3,6 @@ import { hex2rgb } from '../../services/color_convert/color_convert.js'
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: [ 'user', 'switcher', 'selected', 'hideBio' ],
|
props: [ 'user', 'switcher', 'selected', 'hideBio' ],
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
userHighlightLocal: ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted () {
|
|
||||||
const config = this.$store.state.config
|
|
||||||
config.highlight = config.highlight || {}
|
|
||||||
this.userHighlightLocal = config.highlight[this.user.screen_name]
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
headingStyle () {
|
headingStyle () {
|
||||||
const color = this.$store.state.config.colors.bg
|
const color = this.$store.state.config.colors.bg
|
||||||
@ -45,29 +35,22 @@ export default {
|
|||||||
},
|
},
|
||||||
userHighlightEnabled: {
|
userHighlightEnabled: {
|
||||||
get () {
|
get () {
|
||||||
return this.userHighlightLocal
|
return this.$store.state.config.highlight[this.user.screen_name]
|
||||||
},
|
},
|
||||||
set (value) {
|
set (enabled) {
|
||||||
const config = this.$store.state.config
|
if (enabled) {
|
||||||
config.highlight = config.highlight || {}
|
this.$store.dispatch('setHighlight', { user: this.user.screen_name, color: '#FFFFFF' })
|
||||||
if (value) {
|
|
||||||
this.userHighlightLocal = config.highlight[this.user.screen_name] = '#FFFFFF'
|
|
||||||
} else {
|
} else {
|
||||||
this.userHighlightLocal = undefined
|
this.$store.dispatch('setHighlight', { user: this.user.screen_name, color: undefined })
|
||||||
delete config.highlight[this.user.screen_name]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
userHighlightColor: {
|
userHighlightColor: {
|
||||||
get () {
|
get () {
|
||||||
const config = this.$store.state.config
|
return this.$store.state.config.highlight[this.user.screen_name]
|
||||||
config.highlight = config.highlight || {}
|
|
||||||
return config.highlight[this.user.screen_name]
|
|
||||||
},
|
},
|
||||||
set (value) {
|
set (color) {
|
||||||
const config = this.$store.state.config
|
this.$store.dispatch('setHighlight', { user: this.user.screen_name, color })
|
||||||
config.highlight = config.highlight || {}
|
|
||||||
config.highlight[this.user.screen_name] = value
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -9,9 +9,10 @@
|
|||||||
<i class="icon-link-ext usersettings"></i>
|
<i class="icon-link-ext usersettings"></i>
|
||||||
</a>
|
</a>
|
||||||
<div class="floater" v-if="switcher || isOtherUser">
|
<div class="floater" v-if="switcher || isOtherUser">
|
||||||
<input type="checkbox" id="userHighlightCheck" v-model="userHighlightEnabled">
|
<!-- id's need to be unique, otherwise vue confuses which user-card checkbox belongs to -->
|
||||||
<label :title="$t('settings.highlight')" for="userHighlightCheck"></label>
|
<input type="color" :id="'userHighlightColor'+user.id" v-if="userHighlightEnabled" v-model="userHighlightColor"/>
|
||||||
<input type="color" id="userHighlightColor" v-if="userHighlightLocal" v-model="userHighlightColor"/>
|
<input type="checkbox" class="button" :id="'userHighlightCheck'+user.id" v-model="userHighlightEnabled">
|
||||||
|
<label :title="$t('settings.highlight')" :for="'userHighlightCheck'+user.id"></label>
|
||||||
</div>
|
</div>
|
||||||
<div class='container'>
|
<div class='container'>
|
||||||
<router-link :to="{ name: 'user-profile', params: { id: user.id } }">
|
<router-link :to="{ name: 'user-profile', params: { id: user.id } }">
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { set } from 'vue'
|
import { set, delete as del } from 'vue'
|
||||||
import StyleSetter from '../services/style_setter/style_setter.js'
|
import StyleSetter from '../services/style_setter/style_setter.js'
|
||||||
|
|
||||||
const defaultState = {
|
const defaultState = {
|
||||||
@ -10,7 +10,8 @@ const defaultState = {
|
|||||||
autoLoad: true,
|
autoLoad: true,
|
||||||
streaming: false,
|
streaming: false,
|
||||||
hoverPreview: true,
|
hoverPreview: true,
|
||||||
muteWords: []
|
muteWords: [],
|
||||||
|
highlight: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
@ -18,12 +19,22 @@ const config = {
|
|||||||
mutations: {
|
mutations: {
|
||||||
setOption (state, { name, value }) {
|
setOption (state, { name, value }) {
|
||||||
set(state, name, value)
|
set(state, name, value)
|
||||||
|
},
|
||||||
|
setHighlight (state, { user, color }) {
|
||||||
|
if (color) {
|
||||||
|
set(state.highlight, user, color)
|
||||||
|
} else {
|
||||||
|
del(state.highlight, user)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
setPageTitle ({state}, option = '') {
|
setPageTitle ({state}, option = '') {
|
||||||
document.title = `${option} ${state.name}`
|
document.title = `${option} ${state.name}`
|
||||||
},
|
},
|
||||||
|
setHighlight ({ commit, dispatch }, { user, color }) {
|
||||||
|
commit('setHighlight', {user, color})
|
||||||
|
},
|
||||||
setOption ({ commit, dispatch }, { name, value }) {
|
setOption ({ commit, dispatch }, { name, value }) {
|
||||||
commit('setOption', {name, value})
|
commit('setOption', {name, value})
|
||||||
switch (name) {
|
switch (name) {
|
||||||
|
@ -43,10 +43,6 @@ export const mutations = {
|
|||||||
setUserForStatus (state, status) {
|
setUserForStatus (state, status) {
|
||||||
status.user = state.usersObject[status.user.id]
|
status.user = state.usersObject[status.user.id]
|
||||||
},
|
},
|
||||||
setHighlighted (state, { user: {id}, color }) {
|
|
||||||
const user = state.usersObject[id]
|
|
||||||
set(user, 'color', color)
|
|
||||||
},
|
|
||||||
setColor (state, { user: {id}, highlighted }) {
|
setColor (state, { user: {id}, highlighted }) {
|
||||||
const user = state.usersObject[id]
|
const user = state.usersObject[id]
|
||||||
set(user, 'highlight', highlighted)
|
set(user, 'highlight', highlighted)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { hex2rgb } from '../color_convert/color_convert.js'
|
import { hex2rgb } from '../color_convert/color_convert.js'
|
||||||
const highlightStyle = (user, store) => {
|
const highlightStyle = (color) => {
|
||||||
const color = store.state.config.highlight[user.screen_name]
|
if (typeof color !== 'string') return
|
||||||
if (!color) return
|
|
||||||
const rgb = hex2rgb(color)
|
const rgb = hex2rgb(color)
|
||||||
const tintColor = `rgba(${Math.floor(rgb.r)}, ${Math.floor(rgb.g)}, ${Math.floor(rgb.b)}, .1)`
|
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)`
|
const tintColor2 = `rgba(${Math.floor(rgb.r)}, ${Math.floor(rgb.g)}, ${Math.floor(rgb.b)}, .2)`
|
||||||
|
Loading…
Reference in New Issue
Block a user