diff options
| author | Henry Jameson <me@hjkos.com> | 2018-06-19 16:17:50 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2018-07-06 20:12:09 +0300 |
| commit | 8ccebbe1564fe76b376eee83ad985b934edcbfa9 (patch) | |
| tree | 0d058c52b460d4647ddfae046695a2470f4e2be7 /src/components/user_card_content/user_card_content.js | |
| parent | fa8c221f3a6f9b1421e29aa014304576810a08e6 (diff) | |
both bugs fixed. it's reactive and no more conflicting cards
Diffstat (limited to 'src/components/user_card_content/user_card_content.js')
| -rw-r--r-- | src/components/user_card_content/user_card_content.js | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/src/components/user_card_content/user_card_content.js b/src/components/user_card_content/user_card_content.js index 7e0ea0da..48e0ea02 100644 --- a/src/components/user_card_content/user_card_content.js +++ b/src/components/user_card_content/user_card_content.js @@ -3,16 +3,6 @@ import { hex2rgb } from '../../services/color_convert/color_convert.js' export default { 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: { headingStyle () { const color = this.$store.state.config.colors.bg @@ -45,29 +35,22 @@ export default { }, userHighlightEnabled: { get () { - return this.userHighlightLocal + return this.$store.state.config.highlight[this.user.screen_name] }, - set (value) { - const config = this.$store.state.config - config.highlight = config.highlight || {} - if (value) { - this.userHighlightLocal = config.highlight[this.user.screen_name] = '#FFFFFF' + set (enabled) { + if (enabled) { + this.$store.dispatch('setHighlight', { user: this.user.screen_name, color: '#FFFFFF' }) } else { - this.userHighlightLocal = undefined - delete config.highlight[this.user.screen_name] + this.$store.dispatch('setHighlight', { user: this.user.screen_name, color: undefined }) } } }, userHighlightColor: { get () { - const config = this.$store.state.config - config.highlight = config.highlight || {} - return config.highlight[this.user.screen_name] + return this.$store.state.config.highlight[this.user.screen_name] }, - set (value) { - const config = this.$store.state.config - config.highlight = config.highlight || {} - config.highlight[this.user.screen_name] = value + set (color) { + this.$store.dispatch('setHighlight', { user: this.user.screen_name, color }) } } }, |
