Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit 918093c

Browse files
Merge pull request #275 from microsoft/users/t-xunguy/sensors-placeholder
Place holder for Sensors that are not implemented
2 parents 0607c1e + ca68a7f commit 918093c

File tree

6 files changed

+443
-1
lines changed

6 files changed

+443
-1
lines changed

src/view/components/microbit/Microbit.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,16 @@ const MICROBIT_TOOLBAR_BUTTONS: Array<{ label: string; image: JSX.Element }> = [
8181
image: TOOLBAR_SVG.MOTION_SVG,
8282
label: MICROBIT_TOOLBAR_ID.ACCELEROMETER,
8383
},
84+
{
85+
image: TOOLBAR_SVG.GPIO_SVG,
86+
label: MICROBIT_TOOLBAR_ID.GPIO,
87+
},
88+
{
89+
image: TOOLBAR_SVG.SPEAKER_SVG,
90+
label: MICROBIT_TOOLBAR_ID.SOUND,
91+
},
92+
{
93+
image: TOOLBAR_SVG.WIRELESS_SVG,
94+
label: MICROBIT_TOOLBAR_ID.WIRELESS,
95+
},
8496
];

src/view/components/microbit/__snapshots__/Microbit.spec.tsx.snap

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2968,6 +2968,179 @@ Array [
29682968
</svg>
29692969
</button>
29702970
</div>
2971+
<div
2972+
className="ms-TooltipHost root-49"
2973+
onBlurCapture={[Function]}
2974+
onFocusCapture={[Function]}
2975+
onKeyDown={[Function]}
2976+
onMouseEnter={[Function]}
2977+
onMouseLeave={[Function]}
2978+
>
2979+
<button
2980+
aria-label="toolbar gpio"
2981+
className="toolbar-button button"
2982+
id="toolbar-gpio-button"
2983+
onClick={[Function]}
2984+
role="button"
2985+
style={
2986+
Object {
2987+
"width": 32,
2988+
}
2989+
}
2990+
tabIndex={0}
2991+
>
2992+
<svg
2993+
height="16px"
2994+
version="1.1"
2995+
viewBox="0 0 18 16"
2996+
width="18px"
2997+
xmlns="http://www.w3.org/2000/svg"
2998+
xmlnsXlink="http://www.w3.org/1999/xlink"
2999+
>
3000+
<title>
3001+
GPIO
3002+
</title>
3003+
<desc>
3004+
Created with Sketch.
3005+
</desc>
3006+
<g
3007+
fill="none"
3008+
fill-rule="evenodd"
3009+
id="GPIO"
3010+
stroke="none"
3011+
stroke-width="1"
3012+
>
3013+
<g
3014+
className="button-icon"
3015+
id="Group-10"
3016+
transform="translate(0.000000, 5.000000)"
3017+
>
3018+
<path
3019+
d="M4.80046857,3.47534517 C4.80046857,5.04142012 3.93244826,6 2.49863335,6 C0.938305349,6 0,4.8678501 0,2.99408284 C0,1.14398422 0.941819602,0 2.46349082,0 C3.70050761,0 4.6212417,0.808678501 4.74775478,2.01183432 L3.47559547,2.01183432 C3.34908239,1.51084813 2.96954315,1.20710059 2.46349082,1.20710059 C1.74306911,1.20710059 1.31433034,1.86982249 1.31433034,2.97830375 C1.31433034,4.10650888 1.78875439,4.79289941 2.52674736,4.79289941 C3.11362749,4.79289941 3.52128075,4.40631164 3.55290902,3.83037475 L3.55642327,3.7357002 L2.62866068,3.7357002 L2.62866068,2.74161736 L4.80046857,2.74161736 L4.80046857,3.47534517 Z M5.76337368,0.153846154 L7.9843811,0.153846154 C9.0737993,0.153846154 9.81179227,0.950690335 9.81179227,2.17357002 C9.81179227,3.38461538 9.03514252,4.17751479 7.90706755,4.17751479 L7.05310426,4.17751479 L7.05310426,5.84615385 L5.76337368,5.84615385 L5.76337368,0.153846154 Z M7.05310426,1.26627219 L7.05310426,3.08481262 L7.63647013,3.08481262 C8.18469348,3.08481262 8.50800469,2.76923077 8.50800469,2.17751479 C8.50800469,1.57790927 8.18820773,1.26627219 7.64349863,1.26627219 L7.05310426,1.26627219 Z M12.0468567,5.84615385 L10.7571261,5.84615385 L10.7571261,0.153846154 L12.0468567,0.153846154 L12.0468567,5.84615385 Z M15.5048809,0 C17.0300664,0 18,1.14792899 18,2.99802761 C18,4.85207101 17.0300664,6 15.5048809,6 C13.9726669,6 13.0027333,4.85207101 13.0027333,2.99802761 C13.0027333,1.14792899 13.9832097,0 15.5048809,0 Z M15.5048809,1.19921105 C14.7914877,1.19921105 14.3170636,1.90138067 14.3170636,2.99802761 C14.3170636,4.09861933 14.7844592,4.80078895 15.5048809,4.80078895 C16.2182741,4.80078895 16.6891839,4.09861933 16.6891839,2.99802761 C16.6891839,1.90138067 16.2147599,1.19921105 15.5048809,1.19921105 Z"
3020+
id="GPIO"
3021+
/>
3022+
</g>
3023+
</g>
3024+
</svg>
3025+
</button>
3026+
</div>
3027+
<div
3028+
className="ms-TooltipHost root-49"
3029+
onBlurCapture={[Function]}
3030+
onFocusCapture={[Function]}
3031+
onKeyDown={[Function]}
3032+
onMouseEnter={[Function]}
3033+
onMouseLeave={[Function]}
3034+
>
3035+
<button
3036+
aria-label="toolbar microbit-sound"
3037+
className="toolbar-button button"
3038+
id="toolbar-microbit-sound-button"
3039+
onClick={[Function]}
3040+
role="button"
3041+
style={
3042+
Object {
3043+
"width": 32,
3044+
}
3045+
}
3046+
tabIndex={0}
3047+
>
3048+
<svg
3049+
height="16px"
3050+
version="1.1"
3051+
viewBox="0 0 16 16"
3052+
width="16px"
3053+
xmlns="http://www.w3.org/2000/svg"
3054+
xmlnsXlink="http://www.w3.org/1999/xlink"
3055+
>
3056+
<title>
3057+
Speaker
3058+
</title>
3059+
<desc>
3060+
Created with Sketch.
3061+
</desc>
3062+
<g
3063+
fill="none"
3064+
fill-rule="evenodd"
3065+
id="speaker"
3066+
stroke="none"
3067+
stroke-width="1"
3068+
>
3069+
<g
3070+
className="button-icon"
3071+
id="Group-10"
3072+
transform="translate(1.000000, 1.000000)"
3073+
>
3074+
<g
3075+
id="sound"
3076+
>
3077+
<path
3078+
d="M0,4.46138 C0,4.35093 0.089543,4.26138 0.2,4.26138 L3.35989,4.26138 C3.41494,4.26138 3.46756,4.23869 3.50534,4.19866 L7.40837,0.0631292 C7.53259,-0.0684915 7.75382,0.0194193 7.75382,0.200402 L7.75382,13.7995 C7.75382,13.9805 7.53259,14.0684 7.40837,13.9368 L3.50534,9.80125 C3.46756,9.76122 3.41494,9.73853 3.35989,9.73853 L0.2,9.73853 C0.0895431,9.73853 0,9.64898 0,9.53853 L0,4.46138 Z M9.47694,1.2485 C9.47694,1.11913 9.59801,1.02371 9.72228,1.05971 C12.189,1.77423 14,4.16201 14,6.99903 C14,9.83605 12.189,12.2238 9.72228,12.9384 C9.59801,12.9743 9.47694,12.8789 9.47694,12.7496 L9.47694,12.0651 C9.47694,11.9778 9.53367,11.9011 9.61583,11.8716 C11.4213,11.2241 12.9096,9.1562 12.9096,7.03991 C12.9096,4.92363 11.4213,2.85576 9.61583,2.20821 C9.53367,2.17874 9.47694,2.10205 9.47694,2.01476 L9.47694,1.2485 Z"
3079+
id="Shape"
3080+
/>
3081+
</g>
3082+
</g>
3083+
</g>
3084+
</svg>
3085+
</button>
3086+
</div>
3087+
<div
3088+
className="ms-TooltipHost root-49"
3089+
onBlurCapture={[Function]}
3090+
onFocusCapture={[Function]}
3091+
onKeyDown={[Function]}
3092+
onMouseEnter={[Function]}
3093+
onMouseLeave={[Function]}
3094+
>
3095+
<button
3096+
aria-label="toolbar microbit-wireless"
3097+
className="toolbar-button button"
3098+
id="toolbar-microbit-wireless-button"
3099+
onClick={[Function]}
3100+
role="button"
3101+
style={
3102+
Object {
3103+
"width": 32,
3104+
}
3105+
}
3106+
tabIndex={0}
3107+
>
3108+
<svg
3109+
height="16px"
3110+
version="1.1"
3111+
viewBox="0 0 250 300"
3112+
width="16px"
3113+
xmlns="http://www.w3.org/2000/svg"
3114+
xmlnsXlink="http://www.w3.org/1999/xlink"
3115+
>
3116+
<title>
3117+
Bluetooth and Radio
3118+
</title>
3119+
<g
3120+
className="button-icon"
3121+
fill="none"
3122+
fill-rule="evenodd"
3123+
id="wireless"
3124+
>
3125+
<path
3126+
d="M140,74.584c-17.391,0-31.539,14.148-31.539,31.539c0,13.896,9.037,25.712,21.539,29.905v132.69c0,5.523,4.477,10,10,10 s10-4.477,10-10v-132.69c12.502-4.192,21.539-16.009,21.539-29.905C171.539,88.732,157.391,74.584,140,74.584z"
3127+
/>
3128+
<path
3129+
d="M194.458,36.066c-4.705-2.888-10.863-1.416-13.754,3.29c-2.89,4.707-1.416,10.865,3.291,13.754 c18.594,11.415,29.694,31.232,29.694,53.013c0.002,21.778-11.1,41.595-29.694,53.011c-4.707,2.89-6.181,9.047-3.291,13.754 c1.888,3.075,5.17,4.77,8.532,4.77c1.783,0,3.59-0.477,5.222-1.479c24.567-15.082,39.233-41.271,39.232-70.057 C233.689,77.336,219.023,51.147,194.458,36.066z"
3130+
/>
3131+
<path
3132+
d="M228.532,3.283c-4.418-3.314-10.686-2.416-14,2.001c-3.313,4.418-2.417,10.686,2.002,14 C244.157,39.996,260,71.648,260,106.123c0,34.474-15.843,66.126-43.466,86.839c-4.419,3.313-5.314,9.581-2.002,13.999 c1.965,2.62,4.968,4.001,8.009,4.001c2.087,0,4.192-0.651,5.991-2C261.241,184.437,280,146.953,280,106.123 C280,65.292,261.24,27.808,228.532,3.283z"
3133+
/>
3134+
<path
3135+
d="M96.005,53.111c4.707-2.89,6.181-9.047,3.291-13.754c-2.889-4.705-9.044-6.18-13.754-3.29 c-24.565,15.081-39.231,41.27-39.231,70.056c-0.002,28.786,14.664,54.976,39.231,70.058c1.632,1.001,3.438,1.479,5.222,1.479 c3.361,0,6.645-1.695,8.532-4.77c2.89-4.707,1.416-10.865-3.291-13.754c-18.595-11.416-29.696-31.233-29.694-53.012 C66.311,84.343,77.411,64.526,96.005,53.111z"
3136+
/>
3137+
<path
3138+
d="M63.468,192.962C35.845,172.251,20.002,140.599,20,106.124c0.002-34.477,15.845-66.129,43.466-86.84 c4.419-3.313,5.314-9.581,2.002-14c-3.314-4.419-9.581-5.316-14-2.001C18.762,27.806,0.002,65.29,0,106.124 c0.002,40.832,18.762,78.316,51.47,102.84c1.799,1.349,3.903,1.999,5.991,1.999c3.041,0,6.044-1.382,8.009-4.001 C68.782,202.543,67.887,196.275,63.468,192.962z"
3139+
/>
3140+
</g>
3141+
</svg>
3142+
</button>
3143+
</div>
29713144
</div>
29723145
</div>
29733146
</div>,

src/view/components/toolbar/SensorModalUtils.tsx

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export const TOOLBAR_ICON_LABEL = {
4545
TAG_INPUT: "Tag Input",
4646
TAG_OUTPUT: "Tag Output",
4747
TEMPERATURE: "Temperature Sensor",
48+
WIRELESS: "Bluetooth and Radio",
4849
};
4950
export const CPX_TOOLBAR_ICON_ID = {
5051
GPIO: "toolbar-gpio",
@@ -68,6 +69,9 @@ export const MICROBIT_TOOLBAR_ID = {
6869
ACCELEROMETER: "toolbar-accelerometer-sensor",
6970
LEDS: "toolbar-microbit-led",
7071
PUSH_BUTTON: "toolbar-microbit-button",
72+
GPIO: "toolbar-gpio",
73+
SOUND: "toolbar-microbit-sound",
74+
WIRELESS: "toolbar-microbit-wireless",
7175
};
7276

7377
export interface IModalContent {
@@ -321,6 +325,48 @@ export const MICROBIT_BUTTON_CONTENT = (
321325
id: "microbit_button",
322326
};
323327
};
328+
export const MICROBIT_SOUND_MODAL_CONTENT = (
329+
onUpdateValue: (sensor: SENSOR_LIST, value: number) => void,
330+
sensorValues: { [key: string]: number }
331+
): IModalContent => {
332+
return {
333+
descriptionTitle: "toolbar-microbit-sound.title",
334+
tagInput: undefined,
335+
tagOutput: TAG_OUTPUT_SVG,
336+
descriptionText: "toolbar-microbit-sound.description",
337+
tryItDescription: "toolbar-microbit-sound.tryItDescription",
338+
components: [FEATURE_REQUEST_ON_GITHUB],
339+
id: "microbit_sound",
340+
};
341+
};
342+
export const MICROBIT_GPIO_MODAL_CONTENT = (
343+
onUpdateValue: (sensor: SENSOR_LIST, value: number) => void,
344+
sensorValues: { [key: string]: number }
345+
): IModalContent => {
346+
return {
347+
descriptionTitle: "toolbar-microbit-gpio.title",
348+
tagInput: TAG_INPUT_SVG,
349+
tagOutput: TAG_OUTPUT_SVG,
350+
descriptionText: "toolbar-microbit-gpio.description",
351+
tryItDescription: "toolbar-microbit-gpio.tryItDescription",
352+
components: [FEATURE_REQUEST_ON_GITHUB],
353+
id: "microbit_gpio",
354+
};
355+
};
356+
export const MICROBIT_WIRELESS_MODAL_CONTENT = (
357+
onUpdateValue: (sensor: SENSOR_LIST, value: number) => void,
358+
sensorValues: { [key: string]: number }
359+
): IModalContent => {
360+
return {
361+
descriptionTitle: "toolbar-microbit-wireless.title",
362+
tagInput: TAG_INPUT_SVG,
363+
tagOutput: TAG_OUTPUT_SVG,
364+
descriptionText: "toolbar-microbit-wireless.description",
365+
tryItDescription: "toolbar-microbit-wireless.tryItDescription",
366+
components: [FEATURE_REQUEST_ON_GITHUB],
367+
id: "microbit_wireless",
368+
};
369+
};
324370

325371
export const LABEL_TO_MODAL_CONTENT_CONSTRUCTOR = new Map([
326372
[CPX_TOOLBAR_ICON_ID.GPIO, GPIO_MODAL_CONTENT],
@@ -337,6 +383,9 @@ export const LABEL_TO_MODAL_CONTENT_CONSTRUCTOR = new Map([
337383
[MICROBIT_TOOLBAR_ID.ACCELEROMETER, ACCELEROMETER_MODAL_CONTENT],
338384
[MICROBIT_TOOLBAR_ID.LEDS, MICROBIT_LED_CONTENT],
339385
[MICROBIT_TOOLBAR_ID.PUSH_BUTTON, MICROBIT_BUTTON_CONTENT],
386+
[MICROBIT_TOOLBAR_ID.GPIO, MICROBIT_GPIO_MODAL_CONTENT],
387+
[MICROBIT_TOOLBAR_ID.SOUND, MICROBIT_SOUND_MODAL_CONTENT],
388+
[MICROBIT_TOOLBAR_ID.WIRELESS, MICROBIT_WIRELESS_MODAL_CONTENT],
340389
]);
341390

342391
export const getModalContent = (

0 commit comments

Comments
 (0)