diff --git a/client/src/components/ContentBlock.vue b/client/src/components/ContentBlock.vue index 98ce4c37..b00c39a1 100644 --- a/client/src/components/ContentBlock.vue +++ b/client/src/components/ContentBlock.vue @@ -5,6 +5,7 @@ >
@@ -43,6 +44,7 @@

{{ instrumentLabel }} @@ -129,13 +131,35 @@ specialClass() { return `content-block--${this.contentBlock.type.toLowerCase()}`; }, + isInstrumentBlock() { + return !!this.contentBlock.instrumentCategory; + }, + instrumentStyle() { + if (this.isInstrumentBlock) { + return { + backgroundColor: this.contentBlock.instrumentCategory.background + }; + } + return {}; + }, instrumentLabel() { const contentType = this.contentBlock.type.toLowerCase(); - if (contentType.startsWith('base')) { // all instruments start with `base` + if (contentType.startsWith('base')) { // all legacy instruments start with `base` return instrumentCategory(contentType); } + if (this.isInstrumentBlock) { + return instrumentCategory(this.contentBlock.instrumentCategory.name); + } return ''; }, + instrumentLabelStyle() { + if (this.isInstrumentBlock) { + return { + color: this.contentBlock.instrumentCategory.foreground + }; + } + return {}; + }, canEditContentBlock() { return this.contentBlock.mine && !this.contentBlock.indent; }, @@ -316,6 +340,10 @@ } } + &--instrument { + @include content-box-base; + } + /deep/ p { line-height: 1.5; margin-bottom: 1em; diff --git a/client/src/components/content-blocks/InstrumentWidget.vue b/client/src/components/content-blocks/InstrumentWidget.vue index 85c1e684..f33c8d4c 100644 --- a/client/src/components/content-blocks/InstrumentWidget.vue +++ b/client/src/components/content-blocks/InstrumentWidget.vue @@ -8,6 +8,9 @@ {{ $flavor.textInstrument }} anzeigen diff --git a/client/src/components/instruments/FilterEntry.vue b/client/src/components/instruments/FilterEntry.vue index 0bb6f242..d308ce62 100644 --- a/client/src/components/instruments/FilterEntry.vue +++ b/client/src/components/instruments/FilterEntry.vue @@ -39,7 +39,7 @@ }, category: { type: Object, - default: () => {}, + default: () => ({}), }, }, diff --git a/client/src/helpers/instrumentType.js b/client/src/helpers/instrumentType.js index f2562d29..4247bf07 100644 --- a/client/src/helpers/instrumentType.js +++ b/client/src/helpers/instrumentType.js @@ -8,7 +8,7 @@ const instrumentType = (instrument) => { } else { return instrument.type.category.name; } - return typeDictionary[category] || ''; + return typeDictionary[category] || category || ''; }; const instrumentCategory = (instrument) => { diff --git a/client/src/styles/_mixins.scss b/client/src/styles/_mixins.scss index 2b67900e..8a5eafaf 100644 --- a/client/src/styles/_mixins.scss +++ b/client/src/styles/_mixins.scss @@ -61,18 +61,25 @@ } -@mixin content-box($color-list) { - background-color: nth($color-list, 2); +@mixin content-box-base { padding: 15px; align-items: start; border-radius: $default-border-radius; /deep/ .button { - border-color: nth($color-list, 1); background-color: $color-white; } } +@mixin content-box($color-list) { + @include content-box-base; + background-color: nth($color-list, 2); + + /deep/ .button { + border-color: nth($color-list, 1); + } +} + @mixin desktop { @media (min-width: 1200px) { @content