Skip to content

Commit ca2ed9d

Browse files
authored
Allow "help wanted" messages (#516)
1 parent ab2fb41 commit ca2ed9d

19 files changed

+147
-13
lines changed

fixtures/adb/warp-m.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,25 @@
228228
},
229229
"Zoom": {
230230
"type": "Zoom",
231-
"defaultValue": 0
231+
"defaultValue": 0,
232+
"capabilities": [
233+
{
234+
"range": [0, 255],
235+
"name": "Zoom narrow…wide",
236+
"helpWanted": "Correct direction?"
237+
}
238+
]
232239
},
233240
"Focus": {
234241
"type": "Focus",
235-
"defaultValue": 0
242+
"defaultValue": 0,
243+
"capabilities": [
244+
{
245+
"range": [0, 255],
246+
"name": "Focus near…far",
247+
"helpWanted": "Correct direction?"
248+
}
249+
]
236250
},
237251
"Shutter A Rot/Index": {
238252
"type": "Shutter",

fixtures/american-dj/xs-400.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"lastModifyDate": "2017-10-16"
1010
},
1111
"manualURL": "http://adjmedia.s3-website-eu-west-1.amazonaws.com/manuals/XS%20400.pdf",
12+
"helpWanted": "What is tiltMax?",
1213
"physical": {
1314
"dimensions": [169.9, 284.5, 123.6],
1415
"weight": 2.5,

fixtures/boomtonedj/crazy-spot-30.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@
8181
},
8282
{
8383
"range": [57, 127],
84-
"name": "Split colors"
84+
"name": "Split colors",
85+
"helpWanted": "Which DMX value selects which split color?"
8586
},
8687
{
8788
"range": [128, 189],

lib/model/Capability.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ export default class Capability {
6666
return this._jsonObject.name; // required
6767
}
6868

69+
/**
70+
* @returns {?string} A string describing the help that is needed for this capability, or null if no help is needed.
71+
*/
72+
get helpWanted() {
73+
return this._jsonObject.helpWanted || null;
74+
}
75+
6976
/**
7077
* @returns {'start'|'center'|'end'|'hidden'} The method which DMX value to set when this capability is chosen in a menu.
7178
*/

lib/model/Channel.mjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,4 +266,17 @@ export default class Channel extends AbstractChannel {
266266

267267
return this._cache.capabilities;
268268
}
269+
270+
/**
271+
* @returns {!boolean} True if help is needed in a capability of this channel, false otherwise.
272+
*/
273+
get isHelpWanted() {
274+
if (!(`isHelpWanted` in this._cache)) {
275+
this._cache.isHelpWanted = this.capabilities.some(
276+
cap => cap.helpWanted !== null
277+
);
278+
}
279+
280+
return this._cache.isHelpWanted;
281+
}
269282
}

lib/model/Fixture.mjs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,24 @@ export default class Fixture {
154154
return this._jsonObject.comment || ``;
155155
}
156156

157+
/**
158+
* @returns {?string} A string describing the help that is needed for this fixture, or null if no help is needed.
159+
*/
160+
get helpWanted() {
161+
return this._jsonObject.helpWanted || null;
162+
}
163+
164+
/**
165+
* @returns {!boolean} True if help is needed in this fixture (maybe in a capability), false otherwise.
166+
*/
167+
get isHelpWanted() {
168+
if (!(`isHelpWanted` in this._cache)) {
169+
this._cache.isHelpWanted = this.helpWanted !== null || this.availableChannels.concat(this.templateChannels).some(ch => ch.isHelpWanted);
170+
}
171+
172+
return this._cache.isHelpWanted;
173+
}
174+
157175
/**
158176
* @returns {?string} An url to an online version of the fixture's manual. Used as reference for all the information included in this fixture. Defaults to null.
159177
*/
@@ -522,6 +540,18 @@ export default class Fixture {
522540
return this._cache.channelsByKey[key] || null;
523541
}
524542

543+
/**
544+
* @returns {!Array.<Capability>} All available channels' and template channels' capabilities.
545+
*/
546+
get capabilities() {
547+
if (!(`capabilities` in this._cache)) {
548+
const channels = this.availableChannels.concat(this.templateChannels);
549+
this._cache.capabilities = concatArrayProperty(channels, `capabilities`);
550+
}
551+
552+
return this._cache.capabilities;
553+
}
554+
525555
/**
526556
* @returns {!Array.<Mode>} The fixture's different modes providing different channel lists.
527557
*/

schemas/capability.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"color": { "$ref": "definitions.json#/colorString" },
1818
"color2": { "$ref": "definitions.json#/colorString" },
1919
"image": { "$ref": "definitions.json#/nonEmptyString" },
20+
"helpWanted": { "$ref": "definitions.json#/nonEmptyString" },
2021
"switchChannels": {
2122
"type": "object",
2223
"minProperties": 1,

schemas/fixture-redirect.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "http://json-schema.org/draft-07/schema#",
33
"$id": "https://raw.githubusercontent.com/OpenLightingProject/open-fixture-library/master/schemas/fixture-redirect.json",
44

5-
"version": "7.1.1",
5+
"version": "7.2.0",
66

77
"type": "object",
88
"properties": {

schemas/fixture.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "http://json-schema.org/draft-07/schema#",
33
"$id": "https://raw.githubusercontent.com/OpenLightingProject/open-fixture-library/master/schemas/fixture.json",
44

5-
"version": "7.1.1",
5+
"version": "7.2.0",
66

77
"type": "object",
88
"properties": {
@@ -65,6 +65,7 @@
6565
},
6666
"comment": { "$ref": "definitions.json#/nonEmptyMultilineString" },
6767
"manualURL": { "$ref": "definitions.json#/urlString" },
68+
"helpWanted": { "$ref": "definitions.json#/nonEmptyString" },
6869
"rdm": {
6970
"type": "object",
7071
"properties": {

schemas/manufacturers.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "http://json-schema.org/draft-07/schema#",
33
"$id": "https://raw.githubusercontent.com/OpenLightingProject/open-fixture-library/master/schemas/manufacturers.json",
44

5-
"version": "7.1.1",
5+
"version": "7.2.0",
66

77
"type": "object",
88
"propertyNames": {
Lines changed: 1 addition & 0 deletions
Loading

ui/assets/icons/icons.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export default {
99
'chevron-double-down': require(`./chevron-double-down.svg`),
1010
'chevron-double-up': require(`./chevron-double-up.svg`),
1111
'close': require(`./close.svg`),
12+
'comment-question-outline': require(`./comment-question-outline.svg`),
1213
'earth': require(`./earth.svg`),
1314
'email': require(`./email.svg`),
1415
'folder-multiple': require(`./folder-multiple.svg`),

ui/assets/styles/style.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ html, body {
1010
background: $grey-200;
1111
word-wrap: break-word;
1212
text-rendering: optimizeLegibility;
13+
scroll-behavior: smooth;
1314
}
1415

1516
html {
@@ -502,6 +503,20 @@ a.card, .link, .list a {
502503
font-size: 1.2rem;
503504
}
504505

506+
.help-wanted {
507+
position: relative;
508+
margin: 1ex 0;
509+
padding: 0.4em 0.5em 0.4em calc(1.4em + 2*0.5em);
510+
background: $yellow-300;
511+
border-radius: 2px;
512+
min-height: 32px;
513+
514+
.icon {
515+
margin-left: calc(-1.4em - 0.5em);
516+
margin-right: 0.5em;
517+
}
518+
}
519+
505520
/* display mode cards in a 2-col layout and allow values to wrap below labels */
506521
@media (min-width: $tablet) {
507522
.fixture-mode {

ui/assets/styles/vars.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ $blue-600: #1e88e5;
1212
$blue-700: #1976d2;
1313

1414
$yellow-300: #fff176;
15+
$yellow-700: #fbc02d;
1516

1617
$orange-500: #ff9800;
1718
$orange-600: #fb8c00;

ui/components/conditional-details.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</app-conditional-details>
1717
1818
renders:
19-
<div>Hello</div>
19+
<div class="summary">Hello</div>
2020
2121
-->
2222

@@ -89,7 +89,9 @@ export default {
8989
]);
9090
}
9191
92-
return createElement(`div`, this.$slots.summary);
92+
return createElement(`div`, {
93+
class: `summary`
94+
}, this.$slots.summary);
9395
}
9496
};
9597
</script>

ui/components/editor-channel-dialog.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@
206206
#channel-dialog {
207207
max-width: 700px;
208208
width: 80%;
209+
scroll-behavior: auto;
209210
}
210211
</style>
211212

ui/components/fixture-capability-table.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@
5454
<span class="switching-channel-key">{{ switchChannel.key }} (channel&nbsp;{{ switchChannel.index + 1 }}) →</span>&nbsp;{{ switchChannel.to }}
5555
</td>
5656
</tr>
57+
58+
<tr
59+
v-if="cap.helpWanted !== null"
60+
:key="`cap-${index}-helpWanted`">
61+
<td colspan="4" />
62+
<td colspan="2"><div class="help-wanted"><app-svg name="comment-question-outline" title="Help wanted!" />{{ cap.helpWanted }}</div></td>
63+
</tr>
5764
</template>
5865
</tbody>
5966
</table>
@@ -161,6 +168,7 @@ export default {
161168
color2: cap.color2 ? cap.color2.rgb().string() : null,
162169
image: cap.image,
163170
name: cap.name,
171+
helpWanted: cap.helpWanted,
164172
menuClick: cap.menuClick,
165173
switchChannels
166174
};

ui/components/fixture-channel.vue

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
<app-conditional-details class="channel">
44
<template slot="summary">
55
<app-fixture-channel-type-icon :channel="channel" />{{ unwrappedChannel.name }}<code v-if="channelKey" class="channel-key">{{ channelKey }}</code>{{ appendToHeading ? ` ${appendToHeading}` : `` }}
6+
<app-svg
7+
v-if="channel.isHelpWanted"
8+
class="help-wanted-icon"
9+
name="comment-question-outline"
10+
title="Help wanted!" />
611
</template>
712

813
<div v-if="(unwrappedChannel instanceof FineChannel)">
@@ -99,9 +104,16 @@
99104
<style lang="scss" scoped>
100105
@import '~assets/styles/vars.scss';
101106
102-
summary > .icon,
103-
div.channel > .icon {
104-
margin-right: 1.2ex;
107+
summary, .summary {
108+
& > .icon {
109+
margin-right: 1.2ex;
110+
}
111+
112+
& > .help-wanted-icon {
113+
fill: $yellow-700;
114+
margin-left: 0.7ex;
115+
margin-right: 0;
116+
}
105117
}
106118
107119
ol.mode-channels {
@@ -116,7 +128,6 @@ ol.mode-channels {
116128
}
117129
</style>
118130

119-
120131
<script>
121132
import svg from '~/components/svg.vue';
122133
import conditionalDetails from '~/components/conditional-details.vue';

ui/pages/_manufacturerKey/_fixtureKey.vue

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@
4949
<span class="value"><a :href="fixture.manualURL" rel="nofollow">{{ fixture.manualURL }}</a></span>
5050
</section>
5151
52+
<section v-if="fixture.isHelpWanted" class="help-wanted">
53+
<app-svg name="comment-question-outline" title="Help wanted!" /><a href="#contribute">You can help to improve this fixture definition!</a>
54+
{{ fixture.helpWanted !== null ? fixture.helpWanted : `Specific questions are included in the capabilities below.` }}
55+
</section>
56+
5257
<section v-if="fixture.rdm !== null" class="rdm">
5358
<span class="label"><abbr title="Remote Device Management">RDM</abbr> data</span>
5459
<span class="value">
@@ -87,7 +92,7 @@
8792
<div class="clearfix" />
8893
</section>
8994
90-
<section>
95+
<section id="contribute">
9196
<h2>Something wrong with this fixture definition?</h2>
9297
<p>It does not work in your lighting software or you see another problem? Then please help correct it!</p>
9398
<div class="grid list">
@@ -125,6 +130,27 @@
125130
display: inline;
126131
}
127132
}
133+
134+
#contribute:target {
135+
animation: contribute-highlight 1.5s ease;
136+
animation-delay: 0.5s;
137+
animation-fill-mode: backwards;
138+
}
139+
140+
@keyframes contribute-highlight {
141+
0% {
142+
background-color: $blue-100;
143+
box-shadow: 0 0 3px 5px $blue-100;
144+
}
145+
35% {
146+
background-color: $blue-100;
147+
box-shadow: 0 0 3px 5px $blue-100;
148+
}
149+
100% {
150+
background-color: $grey-200; // page background color
151+
box-shadow: 0 0 3px 5px $grey-200;
152+
}
153+
}
128154
</style>
129155
130156
<script>

0 commit comments

Comments
 (0)